mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Revert "生产端工作台 - 今日要完成订单/逾期订单 主子单查询修正、备注字段补充"
This reverts commit 044e3ee9a4.
This commit is contained in:
-3
@@ -55,9 +55,6 @@ public class OrderOverdueRespVO {
|
|||||||
@Schema(description = "拆单员")
|
@Schema(description = "拆单员")
|
||||||
private String splitter;
|
private String splitter;
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "子单列表")
|
@Schema(description = "子单列表")
|
||||||
private List<OrderOverdueRespVO> child;
|
private List<OrderOverdueRespVO> child;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-53
@@ -181,70 +181,28 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
|||||||
* 查询今日要完成订单
|
* 查询今日要完成订单
|
||||||
*
|
*
|
||||||
* @param orderDate
|
* @param orderDate
|
||||||
|
* @param organId
|
||||||
* @param page
|
* @param page
|
||||||
* @param rootIds 顶级订单数组
|
* @param orderIds 父级订单数组
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<OrderOverdueRespVO> selectOrderNear(@Param("page") IPage<OrderOverdueRespVO> page,
|
IPage<OrderOverdueRespVO> selectOrderNear(@Param("orderDate") LocalDate orderDate,
|
||||||
@Param("orderDate") LocalDate orderDate,
|
@Param("organId") Long organId,
|
||||||
@Param("rootIds") List<Long> rootIds);
|
@Param("page") IPage<OrderOverdueRespVO> page,
|
||||||
|
@Param("orderIds") Long... orderIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询今日要完成子单
|
|
||||||
*
|
|
||||||
* @param orderDate
|
|
||||||
* @param page
|
|
||||||
* @param mainOrderIds 父级订单数组
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<OrderOverdueRespVO> selectChildOrderNear(@Param("page") IPage<OrderOverdueRespVO> page,
|
|
||||||
@Param("orderDate") LocalDate orderDate,
|
|
||||||
@Param("mainOrderIds") List<Long> mainOrderIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询今日要完成订单
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param orderDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<Long> selectOrderNearRootIds(@Param("page") IPage<OrderOverdueRespVO> page,
|
|
||||||
@Param("orderDate") LocalDate orderDate);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询预期订单root_id
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param today
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<Long> selectOrderOverdueRootIds(@Param("page") IPage<OrderOverdueRespVO> page,
|
|
||||||
@Param("today") LocalDate today);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询预期订单
|
* 查询预期订单
|
||||||
*
|
*
|
||||||
* @param page
|
|
||||||
* @param today
|
* @param today
|
||||||
* @param rootIds 顶级订单数组
|
* @param organId
|
||||||
|
* @param page
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IPage<OrderOverdueRespVO> selectOrderOverdue(@Param("page") IPage<OrderOverdueRespVO> page,
|
IPage<OrderOverdueRespVO> selectOrderOverdue(@Param("today") LocalDate today,
|
||||||
@Param("today") LocalDate today,
|
@Param("organId") Long organId,
|
||||||
@Param("rootIds") List<Long> rootIds);
|
@Param("page") IPage<OrderOverdueRespVO> page);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询预期子单
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param today
|
|
||||||
* @param mainOrderIds 父级订单数组
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<OrderOverdueRespVO> selectChildOrderOverdue(@Param("page") IPage<OrderOverdueRespVO> page,
|
|
||||||
@Param("today") LocalDate today,
|
|
||||||
@Param("mainOrderIds") List<Long> mainOrderIds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单数量统计
|
* 订单数量统计
|
||||||
|
|||||||
+11
-57
@@ -108,7 +108,6 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.pojo.PageParam.PAGE_SIZE_NONE;
|
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||||
@@ -867,72 +866,27 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
public PageResult<OrderOverdueRespVO> getOrderOverdue(PageParam pageParam) {
|
public PageResult<OrderOverdueRespVO> getOrderOverdue(PageParam pageParam) {
|
||||||
LocalDate todayDate = LocalDate.now();
|
LocalDate todayDate = LocalDate.now();
|
||||||
PageDTO<OrderOverdueRespVO> page = new PageDTO<>(pageParam.getPageNo(), pageParam.getPageSize());
|
PageDTO<OrderOverdueRespVO> page = new PageDTO<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||||
|
// 查询超时单
|
||||||
// 查询满足条件的逾期单 root_id
|
IPage<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(todayDate, OrganContextHolder.getOrganId(), page);
|
||||||
IPage<Long> rootIdPage = orderMapper.selectOrderOverdueRootIds(page, todayDate);
|
return new PageResult<>(orderOverdueVOS.getRecords(), orderOverdueVOS.getTotal());
|
||||||
List<Long> rootIds = rootIdPage.getRecords();
|
|
||||||
long rootIdPageTotal = rootIdPage.getTotal();
|
|
||||||
if(rootIdPageTotal == 0 || CollUtil.isEmpty(rootIds)) {
|
|
||||||
return PageResult.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询顶级逾期单,分页在顶级查询做,此处查询全部信息避免分页互相影响
|
|
||||||
PageDTO<OrderOverdueRespVO> secondPage = new PageDTO<>(pageParam.getPageNo(), PAGE_SIZE_NONE);
|
|
||||||
IPage<OrderOverdueRespVO> orderOverdueVOS = orderMapper.selectOrderOverdue(secondPage, todayDate, rootIds);
|
|
||||||
List<OrderOverdueRespVO> records = orderOverdueVOS.getRecords();
|
|
||||||
|
|
||||||
// 查询子单
|
|
||||||
if (CollUtil.isNotEmpty(records)) {
|
|
||||||
// 主单id列表
|
|
||||||
List<Long> mainOrderIds = records.stream().map(OrderOverdueRespVO::getId).toList();
|
|
||||||
// 查询全部子单
|
|
||||||
PageDTO<OrderOverdueRespVO> childPage = new PageDTO<>(pageParam.getPageNo(), PageParam.PAGE_SIZE_NONE);
|
|
||||||
IPage<OrderOverdueRespVO> childOrderOverdueVOS = orderMapper.selectChildOrderOverdue(childPage, todayDate, mainOrderIds);
|
|
||||||
|
|
||||||
List<OrderOverdueRespVO> childList = childOrderOverdueVOS.getRecords();
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(childList)) {
|
|
||||||
// 按 parentId 分组
|
|
||||||
Map<Long, List<OrderOverdueRespVO>> childMap = childList.stream()
|
|
||||||
.collect(Collectors.groupingBy(OrderOverdueRespVO::getParentId));
|
|
||||||
|
|
||||||
// 回填 child
|
|
||||||
for (OrderOverdueRespVO order : records) {
|
|
||||||
order.setChild(childMap.getOrDefault(order.getId(), null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new PageResult<>(records, rootIdPageTotal);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new PageResult<>(records, rootIdPageTotal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OrderOverdueRespVO> getOrderNear(PageParam pageParam) {
|
public PageResult<OrderOverdueRespVO> getOrderNear(PageParam pageParam) {
|
||||||
|
Long organId = OrganContextHolder.getOrganId();
|
||||||
|
|
||||||
PageDTO<OrderOverdueRespVO> page = new PageDTO<>(pageParam.getPageNo(), pageParam.getPageSize());
|
PageDTO<OrderOverdueRespVO> page = new PageDTO<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||||
LocalDate tomorrow = LocalDate.now().plus(1, ChronoUnit.DAYS);
|
LocalDate tomorrow = LocalDate.now().plus(1, ChronoUnit.DAYS);
|
||||||
|
// 查询预警单
|
||||||
// 查询满足条件的预警单 root_id
|
IPage<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(tomorrow, organId, page);
|
||||||
IPage<Long> rootIdPage = orderMapper.selectOrderNearRootIds(page, tomorrow);
|
|
||||||
List<Long> rootIds = rootIdPage.getRecords();
|
|
||||||
long rootIdPageTotal = rootIdPage.getTotal();
|
|
||||||
if(rootIdPageTotal == 0 || CollUtil.isEmpty(rootIds)) {
|
|
||||||
return PageResult.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询顶级预警单,分页在顶级查询做,此处查询全部信息避免分页互相影响
|
|
||||||
PageDTO<OrderOverdueRespVO> secondPage = new PageDTO<>(pageParam.getPageNo(), PAGE_SIZE_NONE);
|
|
||||||
IPage<OrderOverdueRespVO> orderNearVOS = orderMapper.selectOrderNear(secondPage, tomorrow, rootIds);
|
|
||||||
List<OrderOverdueRespVO> records = orderNearVOS.getRecords();
|
List<OrderOverdueRespVO> records = orderNearVOS.getRecords();
|
||||||
|
|
||||||
// 查询子单
|
// 查询子单
|
||||||
if (CollUtil.isNotEmpty(records)) {
|
if (CollUtil.isNotEmpty(records)) {
|
||||||
// 主单id列表
|
// 主单id列表
|
||||||
List<Long> mainOrderIds = records.stream().map(OrderOverdueRespVO::getId).toList();
|
Long[] mainOrderIds = records.stream().map(OrderOverdueRespVO::getId).toArray(Long[]::new);
|
||||||
// 查询全部子单
|
|
||||||
PageDTO<OrderOverdueRespVO> childPage = new PageDTO<>(pageParam.getPageNo(), PageParam.PAGE_SIZE_NONE);
|
PageDTO<OrderOverdueRespVO> childPage = new PageDTO<>(pageParam.getPageNo(), PageParam.PAGE_SIZE_NONE);
|
||||||
IPage<OrderOverdueRespVO> childOrderNearVOS = orderMapper.selectChildOrderNear(childPage, tomorrow, mainOrderIds);
|
IPage<OrderOverdueRespVO> childOrderNearVOS = orderMapper.selectOrderNear(tomorrow, organId, childPage, mainOrderIds);
|
||||||
|
|
||||||
List<OrderOverdueRespVO> childList = childOrderNearVOS.getRecords();
|
List<OrderOverdueRespVO> childList = childOrderNearVOS.getRecords();
|
||||||
|
|
||||||
@@ -946,11 +900,11 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
order.setChild(childMap.getOrDefault(order.getId(), null));
|
order.setChild(childMap.getOrDefault(order.getId(), null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PageResult<>(records, rootIdPageTotal);
|
return new PageResult<>(records, orderNearVOS.getTotal());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PageResult<>(records, rootIdPageTotal);
|
return new PageResult<>(records, orderNearVOS.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+17
-100
@@ -293,68 +293,23 @@
|
|||||||
o.phone_number,
|
o.phone_number,
|
||||||
o.dealer,
|
o.dealer,
|
||||||
o.salesman,
|
o.salesman,
|
||||||
o.splitter,
|
o.splitter
|
||||||
o.remark
|
|
||||||
from orders o
|
from orders o
|
||||||
where o.deleted = false
|
where o.organ_id = #{organId}
|
||||||
|
and o.deleted = 0
|
||||||
and o.status != 4
|
and o.status != 4
|
||||||
and o.delivery_date = #{orderDate}
|
and o.delivery_date = #{orderDate}
|
||||||
<if test="rootIds != null and rootIds.size() > 0">
|
<choose>
|
||||||
AND o.id IN
|
<when test="orderIds != null and orderIds.length > 0">
|
||||||
<foreach item="rootId"
|
AND parent_id IN
|
||||||
collection="rootIds"
|
<foreach item="orderId" collection="orderIds" open="(" separator="," close=")">
|
||||||
open="("
|
#{orderId}
|
||||||
separator=","
|
</foreach>
|
||||||
close=")">
|
</when>
|
||||||
#{rootId}
|
<otherwise>
|
||||||
</foreach>
|
AND parent_id = 0
|
||||||
</if>
|
</otherwise>
|
||||||
</select>
|
</choose>
|
||||||
|
|
||||||
<select id="selectChildOrderNear" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
|
||||||
select
|
|
||||||
o.id,
|
|
||||||
o.customer,
|
|
||||||
o.parent_id,
|
|
||||||
o.status,
|
|
||||||
o.order_date,
|
|
||||||
o.delivery_date,
|
|
||||||
o.order_type,
|
|
||||||
o.custom_order_no,
|
|
||||||
o.address,
|
|
||||||
o.phone_number,
|
|
||||||
o.dealer,
|
|
||||||
o.salesman,
|
|
||||||
o.splitter,
|
|
||||||
o.remark
|
|
||||||
from orders o
|
|
||||||
where o.deleted = false
|
|
||||||
and o.status != 4
|
|
||||||
and o.delivery_date = #{orderDate}
|
|
||||||
<if test="mainOrderIds != null and mainOrderIds.size() > 0">
|
|
||||||
AND o.parent_id IN
|
|
||||||
<foreach item="mainOrderId" collection="mainOrderIds" open="(" separator="," close=")">
|
|
||||||
#{mainOrderId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectOrderNearRootIds" resultType="java.lang.Long">
|
|
||||||
SELECT DISTINCT root_id
|
|
||||||
FROM orders
|
|
||||||
WHERE deleted = false
|
|
||||||
AND status != 4
|
|
||||||
AND delivery_date = #{orderDate}
|
|
||||||
ORDER BY root_id DESC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectOrderOverdueRootIds" resultType="java.lang.Long">
|
|
||||||
SELECT DISTINCT root_id
|
|
||||||
FROM orders
|
|
||||||
WHERE deleted = false
|
|
||||||
AND status != 4
|
|
||||||
AND #{today} >= DATE(delivery_date)
|
|
||||||
ORDER BY root_id DESC
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
<select id="selectOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
||||||
@@ -371,50 +326,12 @@
|
|||||||
o.phone_number,
|
o.phone_number,
|
||||||
o.dealer,
|
o.dealer,
|
||||||
o.salesman,
|
o.salesman,
|
||||||
o.splitter,
|
o.splitter
|
||||||
o.remark
|
|
||||||
from orders o
|
from orders o
|
||||||
where o.deleted = false
|
where o.organ_id = #{organId}
|
||||||
|
and o.deleted = 0
|
||||||
and o.status != 4
|
and o.status != 4
|
||||||
and #{today} >= DATE(o.delivery_date)
|
and #{today} >= DATE(o.delivery_date)
|
||||||
<if test="rootIds != null and rootIds.size() > 0">
|
|
||||||
AND o.id IN
|
|
||||||
<foreach item="rootId"
|
|
||||||
collection="rootIds"
|
|
||||||
open="("
|
|
||||||
separator=","
|
|
||||||
close=")">
|
|
||||||
#{rootId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectChildOrderOverdue" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
|
||||||
select
|
|
||||||
o.id,
|
|
||||||
o.customer,
|
|
||||||
o.parent_id,
|
|
||||||
o.status,
|
|
||||||
o.order_date,
|
|
||||||
o.delivery_date,
|
|
||||||
o.order_type,
|
|
||||||
o.custom_order_no,
|
|
||||||
o.address,
|
|
||||||
o.phone_number,
|
|
||||||
o.dealer,
|
|
||||||
o.salesman,
|
|
||||||
o.splitter,
|
|
||||||
o.remark
|
|
||||||
from orders o
|
|
||||||
where o.deleted = false
|
|
||||||
and o.status != 4
|
|
||||||
and #{today} >= DATE(o.delivery_date)
|
|
||||||
<if test="mainOrderIds != null and mainOrderIds.size() > 0">
|
|
||||||
AND o.parent_id IN
|
|
||||||
<foreach item="mainOrderId" collection="mainOrderIds" open="(" separator="," close=")">
|
|
||||||
#{mainOrderId}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderCountProducePeriod" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO">
|
<select id="selectOrderCountProducePeriod" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCountProducePeriodRespVO">
|
||||||
|
|||||||
Reference in New Issue
Block a user