Commit 1b14068f by 李小惠

修改任务单接口和装备树接口代码

parent d53b5303
......@@ -19,5 +19,8 @@ public class EquipmentTreeDto {
private String maintenancePeriod;
private Boolean isLeaf;
private List<EquipmentTreeDto> children = new ArrayList<>();
public void addChildren(EquipmentTreeDto treeDto){
children.add(treeDto);
}
}
package com.junmp.jyzb.api.bean.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
......
......@@ -15,16 +15,22 @@ public class OrderMainDto implements Serializable {
private String processId;
//单据类型(入库类型)
private String bussinessType;
//订单编号
private String orderCode;
//发物单位
private Long startOrgId;
//发物单位
private String startOrgName;
//收物单位
private Long endOrgId;
//收物单位
private String endOrgName;
private String startOrgUserId;
......@@ -37,6 +43,7 @@ public class OrderMainDto implements Serializable {
private BigDecimal price;
//应入数量
private Integer inventoryQuantity;
private String invList;
......@@ -48,5 +55,10 @@ public class OrderMainDto implements Serializable {
private String note;
private Date createTime;
//审核状态(审批状态)
private String examineState;
//单据状态(入库状态)
private String orderState;
}
......@@ -81,5 +81,8 @@ public class OrderMainReq extends BaseRequest {
private String typeId;
//排序字段
private String sortTableField;
//排序规则
private String sortRules;
}
......@@ -32,10 +32,6 @@ public class UpdateOrderReq extends BaseRequest implements Serializable {
*/
private String bussinessType;
/**
* 业务类型中文简写(用于设置单据单号(订单号))
*/
private String bussinessBrief;
/**
* 订单号
*/
private String orderCode;
......
package com.junmp.jyzb.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.junmp.jyzb.api.bean.dto.EquipmentTypeDto;
import com.junmp.jyzb.api.bean.query.QueryEquipmentTypeReq;
import com.junmp.jyzb.entity.EquipmentType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -17,5 +19,4 @@ public interface EquipmentTypeMapper extends BaseMapper<EquipmentType> {
void setTypeParentIds();
}
\ No newline at end of file
......@@ -21,12 +21,6 @@ public interface OrderMainMapper extends BaseMapper<OrderMain> {
void updateOrder(OrderMain order);
IPage<OrderMain> getOrderPage(Page<OrderMain> page1, @Param("bussinessType")String bussinessType ,
@Param("startOrgId") Long startOrgId, @Param("endOrgId") Long endOrgId,
@Param("orderState") String orderState , @Param("examineState") String examineState,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("typeId") String typeId, @Param("orderType") String orderType);
IPage<OrderMain> getOrderPage(Page<OrderMain> page1,OrderMainReq req);
IPage<OrderMain> getOrderPage(Page<OrderMain> page1,@Param("req") OrderMainReq req);
}
\ No newline at end of file
......@@ -43,17 +43,15 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
public List<EquipmentTypeDto> getEquipmentList(QueryEquipmentTypeReq req) {
LambdaQueryWrapper<EquipmentType> wp= this.createWrapper(req);
List<EquipmentType> list = this.list(wp);
List<EquipmentTypeDto> orgs=new ArrayList<>();
list.forEach(p->{
EquipmentTypeDto org=new EquipmentTypeDto();
BeanPlusUtil.copyProperties(p, org);
orgs.add(org);
});
return orgs;
}
List<EquipmentType> list = list(new LambdaQueryWrapper<EquipmentType>()
.eq(EquipmentType::getType,req.getType()));
List<EquipmentTypeDto> collect = list.stream().map(equipmentType -> {
EquipmentTypeDto org = new EquipmentTypeDto();
BeanPlusUtil.copyProperties(equipmentType, org);
return org;
}).collect(Collectors.toList());
return collect;
}
@Transactional
@Override
......@@ -258,45 +256,41 @@ public class EquipmentTypeServiceImpl extends ServiceImpl<EquipmentTypeMapper, E
return new ResponseResult(HttpStatus.SUCCESS, ReturnMsg.PASS);
}
//获取type整棵树
@Override
//获取整棵type树
public List<EquipmentTreeDto> GetTypeTree() {
//创建一个list存放整棵树
//获取第一层数据
List<EquipmentType> list = list(new LambdaQueryWrapper<EquipmentType>()
.eq(EquipmentType::getParentId, "00000000-0000-0000-0000-000000000000")
.ne(EquipmentType::getId,"00000000-0000-0000-0000-000000000000"));
//遍历第一层数据
List<EquipmentTreeDto> collect = list.stream().map(equipmentType -> {
EquipmentTreeDto equipmentTreeDto = new EquipmentTreeDto();
BeanPlusUtil.copyProperties(equipmentType, equipmentTreeDto);
equipmentTreeDto.setIsLeaf(false);
//遍历第二层数据
List<EquipmentTreeDto> collect1 = queryChildren(equipmentTreeDto.getId()).stream().map(equipmentType1 -> {
EquipmentTreeDto equipmentTreeDto1 = new EquipmentTreeDto();
BeanPlusUtil.copyProperties(equipmentType1, equipmentTreeDto1);
equipmentTreeDto1.setIsLeaf(false);
//遍历第三层数据
List<EquipmentTreeDto> collect2 = queryChildren(equipmentTreeDto1.getId()).stream().map(equipmentType2 -> {
EquipmentTreeDto equipmentTreeDto2 = new EquipmentTreeDto();
BeanPlusUtil.copyProperties(equipmentType2, equipmentTreeDto2);
equipmentTreeDto2.setIsLeaf(true);
return equipmentTreeDto2;
}).collect(Collectors.toList());
equipmentTreeDto1.setChildren(collect2);
return equipmentTreeDto1;
}).collect(Collectors.toList());
equipmentTreeDto.setChildren(collect1);
return equipmentTreeDto;
}).collect(Collectors.toList());
return collect;
}
private List<EquipmentType> queryChildren(String parentId){
return list(new LambdaQueryWrapper<EquipmentType>().eq(EquipmentType::getParentId,parentId));
.ne(EquipmentType::getId, "00000000-0000-0000-0000-000000000000"));
List<EquipmentTreeDto> dtoList = new ArrayList<>();
// 构建根节点列表
List<EquipmentType> rootEntities = new ArrayList<>();
for (EquipmentType entity : list) {
if (entity.getParentId().equals("00000000-0000-0000-0000-000000000000")) {
rootEntities.add(entity);
}
}
// 递归转换为输出类节点
for (EquipmentType rootEntity : rootEntities) {
EquipmentTreeDto dto = convertNode(rootEntity, list);
dtoList.add(dto);
}
return dtoList;
}
private EquipmentTreeDto convertNode(EquipmentType entity, List<EquipmentType> entityList) {
EquipmentTreeDto dto = new EquipmentTreeDto();
BeanPlusUtil.copyProperties(entity,dto);
dto.setIsLeaf(true); // 默认为叶子节点
List<EquipmentTreeDto> children = new ArrayList<>();
for (EquipmentType childEntity : entityList) {
if (childEntity.getParentId().equals(entity.getId())) {
EquipmentTreeDto childDto = convertNode(childEntity, entityList);
children.add(childDto);
dto.setIsLeaf(false); // 存在子节点,当前节点不是叶子节点
}
}
dto.setChildren(children);
return dto;
}
private LambdaQueryWrapper<EquipmentType> createWrapper(QueryEquipmentTypeReq req) {
LambdaQueryWrapper<EquipmentType> wrapper = new LambdaQueryWrapper<>();
......
......@@ -45,4 +45,5 @@ JOIN cte ON p.id = cte.id
SET p.parent_ids = cte.parent_ids;
</update>
</mapper>
\ No newline at end of file
......@@ -64,30 +64,38 @@
where o.id =#{id}
</update>
<select id="getOrderPage" resultType="com.junmp.jyzb.entity.OrderMain">
select * FROM bussiness_order_main WHERE id in(
SELECT order_id FROM bussiness_order_detail WHERE equipment_type = #{typeId}) and order_type=#{orderType}
<if test="null != bussinessType and '' != bussinessType ">
and bussiness_type = #{bussinessType}
select * FROM bussiness_order_main WHERE order_type=#{req.orderType}
<if test="req.typeId != null and req.typeId != ''">
and id in(
SELECT order_id FROM bussiness_order_detail WHERE equipment_type = #{req.typeId})
</if>
<if test="startOrgId != null and startOrgId != ''">
and start_org_id = #{startOrgId}
<if test="null != req.bussinessType and '' != req.bussinessType ">
and bussiness_type = #{req.bussinessType}
</if>
<if test="endOrgId != null and endOrgId != ''">
and end_org_id = #{endOrgId}
<if test="req.startOrgId != null and req.startOrgId != ''">
and start_org_id = #{req.startOrgId}
</if>
<if test="orderState !=null and orderState != ''">
and order_state = #{orderState}
<if test="req.endOrgId != null and req.endOrgId != ''">
and end_org_id = #{req.endOrgId}
</if>
<if test="examineState !=null and examineState != ''">
and examine_state = #{examineState}
<if test="req.orderState !=null and req.orderState != ''">
and order_state = #{req.orderState}
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime}
<if test="req.examineState !=null and req.examineState != ''">
and examine_state = #{req.examineState}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
<if test="req.startTime != null and req.startTime != ''">
and create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null and req.endTime != ''">
and create_time &lt;= #{req.endTime}
</if>
<if test="req.sortTableField != null and req.sortTableField != '' and req.sortRules != null and req.sortRules != '' ">
ORDER BY #{req.sortTableField} #{req.sortRules}
</if>
<if test="(req.sortTableField == null || req.sortTableField == '') and (req.sortRules == null || req.sortRules == '') ">
order by create_time desc
</if>
ORDER BY create_time DESC
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论