From 9f9a7db9da62fb82daefc5ca23dd8a083a8cbb01 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Tue, 16 Jun 2026 17:02:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=85=E9=81=93bug#1704=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=81=E7=94=9F=E4=BA=A7=E7=AB=AF=E5=88=86=E6=9E=90=E9=A1=B5?= =?UTF-8?q?=E6=89=80=E6=9C=89=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E9=83=BD?= =?UTF-8?q?=E9=80=82=E9=85=8D=E5=BC=80=E5=A7=8B000000~=E7=BB=93=E6=9D=9F23?= =?UTF-8?q?5959?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/order/OrderStatisticsServiceImpl.java | 10 +++++++++- .../resources/mapper/order/OrderStatisticsMapper.xml | 11 +++++------ .../src/main/resources/mapper/plan/PlanMapper.xml | 12 +++++------- .../mapper/plate/OrderPlateStatisticsMapper.xml | 8 ++++---- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderStatisticsServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderStatisticsServiceImpl.java index 7baf02609..58d013371 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderStatisticsServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderStatisticsServiceImpl.java @@ -13,8 +13,8 @@ import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.util.NamedValue; import com.cf.imes.framework.common.enums.OrderStatusEnum; import com.cf.imes.framework.common.enums.StatisticsUnit; +import com.cf.imes.framework.common.util.date.LocalDateTimeUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsReqVO; @@ -118,6 +118,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); // 查询订单状态统计数据 List orderStatusRespVOS = orderStatisticsMapper.selectOrderStatusCountGroupBy(reqVO); @@ -167,9 +168,12 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); + // 查询订单单量 Map> orderRespMap = orderStatisticsMapper.selectOrderCountGroupByOrderDate(reqVO).stream() .sorted(Comparator.naturalOrder()) .collect(Collectors.groupingBy(OrderStatisticsStatusRespVO::getDate, LinkedHashMap::new, Collectors.toList())); + // 查询排单单量 Map> planRespMap = planMapper.selectPlanCountGroupByCreateTime(reqVO).stream() .sorted(Comparator.naturalOrder()) .collect(Collectors.groupingBy(OrderPlanStatisticsCountRespVO::getDate, LinkedHashMap::new, Collectors.toList())); @@ -220,6 +224,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); Map> orderRespMap = orderStatisticsMapper.selectOrderAreaGroupByOrderDate(reqVO).stream() .sorted(Comparator.naturalOrder()) .collect(Collectors.groupingBy(OrderStatisticsAreaRespVO::getDate, LinkedHashMap::new, Collectors.toList())); @@ -269,6 +274,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); // 查询时间段内数量最多的小板,列出数量前10的goods_id List topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateCountList(reqVO).stream() .map(OrderGoodsPlateRespVO::getGoodsId) @@ -342,6 +348,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); // 查询时间段内面积最多的小板,列出前10面积的goods_id List topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateAreaList(reqVO).stream() .map(OrderGoodsPlateRespVO::getGoodsId) @@ -415,6 +422,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService { // 所有的日期集合 List dateList = getDateList(reqVO); + reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime())); // 查询满足时间条件的最大用量材质编号 List goodsCodes = planMapper.selectPlanGoodsTopTen(reqVO); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderStatisticsMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderStatisticsMapper.xml index 99dcb71d0..e9777676d 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderStatisticsMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderStatisticsMapper.xml @@ -15,7 +15,7 @@ ,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date)) as date - ,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', WEEK(o.order_date, 1)) AS date + ,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', FLOOR((DayOfMonth(o.order_date)-1)/7)+1) AS date ,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', DAY(o.order_date)) as date @@ -28,7 +28,7 @@ count(o.id) as orderCount from orders o - where o.order_date between #{req.createTime[0]} and DATE_FORMAT(STR_TO_DATE(CONCAT(DATE_FORMAT(#{req.createTime[1]}, '%Y-%m-%d'), ' 23:59:59'), '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s') + where o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} and o.deleted = 0 group by orderStatus, date; @@ -38,18 +38,17 @@ select count(o.id) as orderCount from orders o - where o.order_date between #{req.createTime[0]} and DATE_FORMAT(STR_TO_DATE(CONCAT(DATE_FORMAT(#{req.createTime[1]}, '%Y-%m-%d'), ' 23:59:59'), '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s') + where o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} and o.deleted = 0 group by date; 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 e2eb0ca45..41bec1cf5 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 @@ -63,14 +63,14 @@ ,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', DAY(p.create_time)) as date from order_plan p - where p.create_time between #{req.createTime[0]} and #{req.createTime[1]} + where p.create_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} and p.deleted = 0 group by date; @@ -356,7 +354,7 @@ WHERE deleted = false AND optimize_goods_id IS NOT NULL AND optimize_goods_id != '' - AND optimize_time BETWEEN #{req.createTime[0]} AND #{req.createTime[1]} + AND optimize_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} GROUP BY optimize_goods_id ORDER BY totalScheduledBoardNum DESC LIMIT 10 @@ -384,7 +382,7 @@ FROM order_plan p WHERE p.deleted = false - AND p.optimize_time BETWEEN #{req.createTime[0]} AND #{req.createTime[1]} + AND p.optimize_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} AND p.optimize_goods_id IN #{goodsCode} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/OrderPlateStatisticsMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/OrderPlateStatisticsMapper.xml index aa91ceafc..13921e47d 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/OrderPlateStatisticsMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/OrderPlateStatisticsMapper.xml @@ -8,7 +8,7 @@ left join order_plate a ON g.id = a.goods_id and a.deleted = 0 join orders o ON o.id = a.order_id and o.deleted = 0 where g.deleted = 0 - and o.order_date between #{req.createTime[0]} and #{req.createTime[1]} + and o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} group by g.goods_id order by orderCount desc limit 10; @@ -42,7 +42,7 @@ LEFT JOIN order_plate a ON g.id = a.goods_id and a.deleted = 0 JOIN orders o ON o.id = a.order_id and o.deleted = 0 WHERE g.deleted = 0 - AND o.order_date BETWEEN #{req.createTime[0]} AND #{req.createTime[1]} + AND o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} and g.goods_id in #{goodsId} @@ -58,7 +58,7 @@ left join order_plate a ON g.id = a.goods_id and a.deleted = 0 left join orders o ON o.id = a.order_id and o.deleted = 0 where g.deleted = 0 - and o.order_date between #{req.createTime[0]} and #{req.createTime[1]} + and o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} group by g.goods_id order by orderArea desc limit 10; @@ -93,7 +93,7 @@ LEFT JOIN order_plate a ON g.id = a.goods_id and a.deleted = 0 LEFT JOIN orders o ON o.id = a.order_id and o.deleted = 0 WHERE g.deleted = 0 - AND o.order_date BETWEEN #{req.createTime[0]} AND #{req.createTime[1]} + AND o.order_date between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]} and g.goods_id in #{goodsId}