Commit 1b14068f by 李小惠

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

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