diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OrderRespVOCopy.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OrderRespVOCopy.java index 71f266f51..5da877aea 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OrderRespVOCopy.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OrderRespVOCopy.java @@ -11,8 +11,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; -import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; +import static com.cf.imes.framework.common.util.date.DateUtils.*; /** * @author there @@ -32,11 +31,14 @@ public class OrderRespVOCopy { @Schema(description = "地址") private String address; @Schema(description = "订单日期") - @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT) private Date orderDate; @Schema(description = "交付日期") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private Date deliveryDate; + @Schema(description = "更新时间") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date updateTime; @Schema(description = "片数") private int num; @Schema(description = "平方") diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java index 9de1610fa..d8863169b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java @@ -45,8 +45,8 @@ public interface PlanMapper extends BaseMapperX { .leftJoin(OrderItemDO.class, OrderItemDO::getId, PlanItemDO::getItemId) .leftJoin(OrderDO.class, OrderDO::getId, OrderItemDO::getOrderId) .like(OrderDO::getCustomer, reqVO.getCustomer()) - .orderByAsc(PlanDO::getSort) - .orderByDesc(PlanDO::getId) + .orderBy(true, true, PlanDO::getSort) + .orderByDesc(PlanDO::getUpdateTime) ); } @@ -64,14 +64,16 @@ public interface PlanMapper extends BaseMapperX { .betweenIfPresent(PlanDO::getCreateTime, reqVO.getCreateTime()) .eqIfPresent(PlanDO::getOperator, reqVO.getOperator()) .betweenIfPresent(PlanDO::getProduceTime, reqVO.getProduceTime()) - .orderByDesc(PlanDO::getSort)); -// .orderByDesc(PlanDO::getId)); + .orderBy(true, true, PlanDO::getSort) + .orderByDesc(PlanDO::getUpdateTime)); } List selectPlateListByPlanId(@Param("planId") Long planId, @Param("organId") Long organId); OptimizeParamRespVO getOptimizePlanParam(Long planId); + PlanDO selectPlanByOrderIds(@Param("ids") List ids); + // // default PlanDO selectByOrderId(Long orderId) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java index 88adfbbe0..e45e17248 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateMapper.java @@ -70,7 +70,7 @@ public interface PlateMapper extends BaseMapperX { } // IPage selectPlatePage(@Param("page") IPage page, @Param("orderId")Long organId, @Param("goodsId") String goodsId); - List selectPlatePage(/*@Param("page") IPage page,*/ @Param("orderId")Long orderId,@Param("organId") Long organId/*, @Param("goodsId") String goodsId*/); + List selectPlatePage( @Param("orderId") Long orderId,@Param("organId") Long organId/*, @Param("goodsId") String goodsId*/); IPage selectPlateByPlanId(@Param("page") IPage page, @Param(Constants.WRAPPER) Wrapper wrapper); @@ -120,4 +120,7 @@ public interface PlateMapper extends BaseMapperX { // 根据需要删除的小板id查找具体信息 List selectPlateGoodsListByList(@Param("plates") List goodsIdList, @Param("orderId") Long orderId, @Param("organId") Long organId); + + + List selectGoodsPage( @Param("orderIds") List orderIds, @Param("organId") Long organId); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java index c5a97f075..c7266bf96 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java @@ -214,6 +214,12 @@ public class PlanServiceImpl implements PlanService { } } + private void validatePlan(List ids) { + + planMapper.selectPlanByOrderIds(ids); + + } + @Override public PlanRespVO getPlan(Long id) { PlanDO planDO = planMapper.selectById(id); @@ -321,8 +327,9 @@ public class PlanServiceImpl implements PlanService { queryWrapperX .eq("a.organ_id",getUserOrganId()) .eq("a.status",OrderStatusEnum.NO_SORT.getStatus()) + .eq("a.deleted",false) .likeIfPresent("a.id", pageReqVO.getOrderId() != null ? pageReqVO.getOrderId().toString() : null) - .isNull("opi.item_id") +// .isNull("opi.item_id") .eqIfPresent("a.customer", pageReqVO.getConsignee()) .eqIfPresent("a.custom_order_no", pageReqVO.getDefaultId()) .eqIfPresent("a.address", pageReqVO.getConsigneeAddress()) @@ -332,8 +339,8 @@ public class PlanServiceImpl implements PlanService { .eqIfPresent("op.is_door", pageReqVO.getIsDoor()) .betweenIfPresent("op.height", new BigDecimal[]{pageReqVO.getLongMinRang(), pageReqVO.getLongMaxRang()}) .betweenIfPresent("op.width", new BigDecimal[]{pageReqVO.getWidthMinRang(), pageReqVO.getWidthMaxRang()}) - .groupBy("a.id", " a.order_date", "a.delivery_date", "a.customer", "a.address", "a.custom_order_no","a.create_time") -/* .orderByDesc("a.create_time")*/; + .groupBy("a.id", " a.order_date", "a.delivery_date", "a.customer", "a.address", "a.custom_order_no","a.create_time","a.update_time") + .orderByDesc("a.update_time"); List filterTypes = new ArrayList<>(); if (Objects.nonNull(pageReqVO.getHoleThrough()) && pageReqVO.getHoleThrough()) { filterTypes.add(PlanFilterTypeEnum.DIGGINGTHROUGHTHESHAPE.getType()); @@ -350,12 +357,30 @@ public class PlanServiceImpl implements PlanService { IPage orderRespVOCopies = orderMapper.selectOrderPage(page, queryWrapperX); List records = orderRespVOCopies.getRecords(); - for (OrderRespVOCopy orderRespVOCopy : records) { + List orderIds = records.stream().map(m -> m.getOrderId()).collect(Collectors.toList()); - List platePages = plateMapper.selectPlatePage(orderRespVOCopy.getOrderId(),getUserOrganId()/*, orderRespVOCopy.getGoodsId()*/); - orderRespVOCopy.setPlatePages(platePages); - } + List platePages = plateMapper.selectGoodsPage(orderIds,getUserOrganId()/*, orderRespVOCopy.getGoodsId()*/); + + + + List filteredRecords = records.stream() + .filter(record -> { + List filteredPages = platePages.stream() + .filter(f -> Objects.equals(f.getOrderId(), record.getOrderId())) + .collect(Collectors.toList()); + if (filteredPages.isEmpty()) { + return false; // 移除该记录 + } else { + record.setPlatePages(filteredPages); + return true; // 保留该记录 + } + }) + .collect(Collectors.toList()); + + // 处理后的 filteredRecords 将不包含过滤后的数据为空的 record + orderRespVOCopies.setRecords(filteredRecords); + orderRespVOCopies.setTotal(filteredRecords.size()); if (CollectionUtil.isEmpty(records)) { @@ -364,18 +389,11 @@ public class PlanServiceImpl implements PlanService { return new PageResult<>(orderRespVOCopies.getRecords(), orderRespVOCopies.getTotal()); - -// IPage orderDOPageResult = orderMapper.selectOrderPage(queryWrapperX); - -// if (CollectionUtil.isEmpty(orderDOPageResult.getRecords())) { -// return new PageResult<>(); -// } -// return new PageResult<>(orderDOPageResult.getRecords(), orderDOPageResult.getTotal()); } @Override public List getNotPlanPlateListPage(PlateReqPageVO pageVO) { -// PageDTO page = new PageDTO<>(pageVO.getPageNo(), pageVO.getPageSize()); + List pageRes = plateMapper.selectPlatePage(/*page, */pageVO.getOrderId(),getUserOrganId()/*, pageVO.getGoodsId()*/); return pageRes; } @@ -445,6 +463,7 @@ public class PlanServiceImpl implements PlanService { queryWrapperX.in("p.plan_id", vo.getPlanIds()) .eq("a.organ_id",getUserOrganId()) .eqIfPresent("a.is_door", vo.getIsDoor()) + .eqIfPresent("a.is_special_shaped", vo.getRectangle() != null ? false: null) .eqIfPresent("a.is_special_shaped", vo.getSpecialShaped()) .eqIfPresent("a.is_sculpt", vo.getSculpt()) .betweenIfPresent("a.width", new BigDecimal[]{vo.getWidthMinRang(), vo.getWidthMaxRang()}) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml index 62493b34b..98f3fdbcf 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml @@ -4,17 +4,19 @@ + diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml index a706b2eb6..a8131c5be 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml @@ -121,4 +121,6 @@ + + \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml index 4f78065b8..05955764b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml @@ -329,4 +329,39 @@ + + + \ No newline at end of file