禅道bug#1704修复、生产端分析页所有时间区间都适配开始000000~结束235959

This commit is contained in:
gaoqr
2026-06-16 17:02:12 +08:00
parent 76200f4c38
commit 9f9a7db9da
4 changed files with 23 additions and 18 deletions
@@ -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<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询订单状态统计数据
List<OrderStatisticsStatusRespVO> orderStatusRespVOS = orderStatisticsMapper.selectOrderStatusCountGroupBy(reqVO);
@@ -167,9 +168,12 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询订单单量
Map<String, List<OrderStatisticsStatusRespVO>> orderRespMap = orderStatisticsMapper.selectOrderCountGroupByOrderDate(reqVO).stream()
.sorted(Comparator.naturalOrder())
.collect(Collectors.groupingBy(OrderStatisticsStatusRespVO::getDate, LinkedHashMap::new, Collectors.toList()));
// 查询排单单量
Map<String, List<OrderPlanStatisticsCountRespVO>> 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<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
Map<String, List<OrderStatisticsAreaRespVO>> 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<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询时间段内数量最多的小板,列出数量前10的goods_id
List<String> topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateCountList(reqVO).stream()
.map(OrderGoodsPlateRespVO::getGoodsId)
@@ -342,6 +348,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询时间段内面积最多的小板,列出前10面积的goods_id
List<String> topTenCountGoodsId = orderPlateStatisticsMapper.selectPlateAreaList(reqVO).stream()
.map(OrderGoodsPlateRespVO::getGoodsId)
@@ -415,6 +422,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询满足时间条件的最大用量材质编号
List<String> goodsCodes = planMapper.selectPlanGoodsTopTen(reqVO);
@@ -15,7 +15,7 @@
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date)) as date
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.StatisticsUnit@WEEK.getValue()">
,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
</if>
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.StatisticsUnit@DAY.getValue()">
,CONCAT(YEAR(o.order_date), '-', MONTH(o.order_date), '-', DAY(o.order_date)) as date
@@ -28,7 +28,7 @@
count(o.id) as orderCount
<include refid="dateFormat"/>
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;
</select>
@@ -38,18 +38,17 @@
select count(o.id) as orderCount
<include refid="dateFormat"/>
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;
</select>
<select id="selectOrderAreaGroupByOrderDate"
resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatisticsAreaRespVO">
select sum(op.area) as areaSum
select sum(o.area) as areaSum
<include refid="dateFormat"/>
from orders o
join order_plate op on op.order_id = o.id
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;
</select>
@@ -63,14 +63,14 @@
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', DAY(p.create_time)) as date
</if>
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;
</select>
<select id="selectPlanAreaGroupByCreateTime"
resultType="com.cf.imes.module.executor.controller.admin.plan.vo.OrderPlanStatisticsAreaRespVO">
select sum(op.area) areaSum
select sum(p.plate_area) areaSum
<if test="req.unit != null and req.unit == @com.cf.imes.framework.common.enums.StatisticsUnit@QUARTER.getValue()">
,CONCAT(YEAR(p.create_time), '-', QUARTER(p.create_time)) as date
</if>
@@ -84,9 +84,7 @@
,CONCAT(YEAR(p.create_time), '-', MONTH(p.create_time), '-', DAY(p.create_time)) as date
</if>
from order_plan p
join order_goods g on g.plan_id = p.id
join order_plate op on op.goods_id = g.id
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;
</select>
@@ -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
<foreach collection="goodsCodes" item="goodsCode" open="(" separator="," close=")">
#{goodsCode}
@@ -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
<foreach item="goodsId" collection="goodsIds" open="(" separator="," close=")">
#{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
<foreach item="goodsId" collection="goodsIds" open="(" separator="," close=")">
#{goodsId}