1、贴皮分解板件分页接口补充房名柜名属性;2、贴皮分页问题修复;

This commit is contained in:
gaoqr
2026-07-21 17:30:10 +08:00
parent 0a425032bc
commit 5cdba2ffba
9 changed files with 248 additions and 12 deletions
@@ -1,11 +1,13 @@
package com.cf.imes.module.executor.controller.admin.veneer.vo; package com.cf.imes.module.executor.controller.admin.veneer.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT;
@@ -14,11 +16,15 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT
* 贴皮分解订单分页响应参数。 * 贴皮分解订单分页响应参数。
*/ */
@Data @Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VeneerDecomposeOrderRespVO { public class VeneerDecomposeOrderRespVO {
@Schema(description = "订单号") @Schema(description = "订单号")
private Long orderId; private Long orderId;
@Schema(description = "父订单ID")
private Long parentId;
@Schema(description = "自定义单号") @Schema(description = "自定义单号")
private String customOrderNo; private String customOrderNo;
@@ -40,4 +46,7 @@ public class VeneerDecomposeOrderRespVO {
@Schema(description = "订单日期") @Schema(description = "订单日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY, timezone = TIME_ZONE_DEFAULT)
private LocalDateTime orderDate; private LocalDateTime orderDate;
@Schema(description = "子订单列表")
private List<VeneerDecomposeOrderRespVO> child;
} }
@@ -37,6 +37,12 @@ public class VeneerDecomposePlateRespVO {
@Schema(description = "板件名称,兼容原贴皮分解字段") @Schema(description = "板件名称,兼容原贴皮分解字段")
private String plateName; private String plateName;
@Schema(description = "房名")
private String roomName;
@Schema(description = "柜名")
private String bodyName;
@Schema(description = "颜色") @Schema(description = "颜色")
private String color; private String color;
@@ -1,20 +1,26 @@
package com.cf.imes.module.executor.controller.admin.veneer.vo; package com.cf.imes.module.executor.controller.admin.veneer.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 贴皮管理订单分页响应参数。 * 贴皮管理订单分页响应参数。
*/ */
@Data @Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VeneerManageOrderRespVO { public class VeneerManageOrderRespVO {
@Schema(description = "订单号") @Schema(description = "订单号")
private Long orderId; private Long orderId;
@Schema(description = "父订单ID")
private Long parentId;
@Schema(description = "自定义单号") @Schema(description = "自定义单号")
private String customOrderNo; private String customOrderNo;
@@ -35,4 +41,7 @@ public class VeneerManageOrderRespVO {
@Schema(description = "订单日期") @Schema(description = "订单日期")
private LocalDateTime orderDate; private LocalDateTime orderDate;
@Schema(description = "子订单列表")
private List<VeneerManageOrderRespVO> child;
} }
@@ -35,15 +35,28 @@ public interface VeneerDecomposeMapper {
@Param("orderDateTime") LocalDateTime[] orderDateTime); @Param("orderDateTime") LocalDateTime[] orderDateTime);
/** /**
* 根据根订单ID查询订单及子订单信息。 * 根据当前页根订单ID查询订单信息。
* *
* @param page 分页参数 * @param page 分页参数
* @param rootIds 根订单ID列表 * @param rootIds 根订单ID列表
* @return 订单分页结果 * @return 订单分页结果
*/ */
IPage<VeneerDecomposeOrderRespVO> selectOrderList(@Param("page") IPage<VeneerDecomposeOrderRespVO> page, IPage<VeneerDecomposeOrderRespVO> selectOrderList(@Param("page") IPage<VeneerDecomposeOrderRespVO> page,
@Param("rootIds") List<Long> rootIds); @Param("rootIds") List<Long> rootIds);
/**
* 查询当前页根订单下存在未分解板件的子订单。
*
* @param rootIds 根订单ID列表
* @param req 订单查询条件
* @param orderDateTime 完整订单日期时间范围
* @return 子订单列表
*/
List<VeneerDecomposeOrderRespVO> selectOrderChildList(
@Param("rootIds") List<Long> rootIds,
@Param("req") VeneerDecomposeOrderPageReqVO req,
@Param("orderDateTime") LocalDateTime[] orderDateTime);
/** /**
* 分页查询存在未完成贴皮分解板件的材质。 * 分页查询存在未完成贴皮分解板件的材质。
* *
@@ -35,15 +35,28 @@ public interface VeneerManageMapper {
@Param("orderDateTime") LocalDateTime[] orderDateTime); @Param("orderDateTime") LocalDateTime[] orderDateTime);
/** /**
* 根据根订单 ID 查询订单及子订单信息。 * 根据当前页根订单 ID 查询订单信息。
* *
* @param page 分页参数 * @param page 分页参数
* @param rootIds 根订单 ID 列表 * @param rootIds 根订单 ID 列表
* @return 订单列表 * @return 订单列表
*/ */
IPage<VeneerManageOrderRespVO> selectOrderList(@Param("page") IPage<VeneerManageOrderRespVO> page, IPage<VeneerManageOrderRespVO> selectOrderList(@Param("page") IPage<VeneerManageOrderRespVO> page,
@Param("rootIds") List<Long> rootIds); @Param("rootIds") List<Long> rootIds);
/**
* 查询当前页根订单下存在已分解贴皮板件的子订单。
*
* @param rootIds 根订单ID列表
* @param req 订单查询条件
* @param orderDateTime 完整订单日期时间范围
* @return 子订单列表
*/
List<VeneerManageOrderRespVO> selectOrderChildList(
@Param("rootIds") List<Long> rootIds,
@Param("req") VeneerManageOrderPageReqVO req,
@Param("orderDateTime") LocalDateTime[] orderDateTime);
/** /**
* 分页查询存在已分解贴皮板件的板材。 * 分页查询存在已分解贴皮板件的板材。
* *
@@ -67,6 +80,19 @@ public interface VeneerManageMapper {
@Param("req") VeneerManageOrderPageReqVO req, @Param("req") VeneerManageOrderPageReqVO req,
@Param("orderDateTime") LocalDateTime[] orderDateTime); @Param("orderDateTime") LocalDateTime[] orderDateTime);
/**
* 查询当前页根订单下存在未排贴皮的子订单。
*
* @param rootIds 根订单ID列表
* @param req 订单查询条件
* @param orderDateTime 完整订单日期时间范围
* @return 子订单列表
*/
List<VeneerManageOrderRespVO> selectUnplannedOrderChildList(
@Param("rootIds") List<Long> rootIds,
@Param("req") VeneerManageOrderPageReqVO req,
@Param("orderDateTime") LocalDateTime[] orderDateTime);
/** /**
* 分页查询存在待排单贴皮的板材。 * 分页查询存在待排单贴皮的板材。
* *
@@ -93,11 +93,34 @@ public class VeneerDecomposeServiceImpl implements VeneerDecomposeService {
page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())); page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate()));
List<Long> rootIds = rootPage.getRecords(); List<Long> rootIds = rootPage.getRecords();
if (CollUtil.isEmpty(rootIds)) { if (CollUtil.isEmpty(rootIds)) {
return new PageResult<>(); return new PageResult<>(List.of(), rootPage.getTotal());
} }
IPage<VeneerDecomposeOrderRespVO> result = veneerDecomposeMapper.selectOrderList( IPage<VeneerDecomposeOrderRespVO> result = veneerDecomposeMapper.selectOrderList(
new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds); new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds);
return new PageResult<>(result.getRecords(), rootPage.getTotal()); List<VeneerDecomposeOrderRespVO> rootOrders = result.getRecords();
fillOrderChildren(rootOrders, veneerDecomposeMapper.selectOrderChildList(
rootIds, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())));
return new PageResult<>(rootOrders, rootPage.getTotal());
}
/**
* 按父订单ID分组并回填子订单,分页数量始终以根订单为准。
*
* @param rootOrders 当前页根订单
* @param childOrders 当前页根订单下符合贴皮分解条件的子订单
*/
private void fillOrderChildren(List<VeneerDecomposeOrderRespVO> rootOrders,
List<VeneerDecomposeOrderRespVO> childOrders) {
if (CollUtil.isEmpty(rootOrders) || CollUtil.isEmpty(childOrders)) {
return;
}
Map<Long, List<VeneerDecomposeOrderRespVO>> childMap = new HashMap<>();
for (VeneerDecomposeOrderRespVO childOrder : childOrders) {
childMap.computeIfAbsent(childOrder.getParentId(), key -> new ArrayList<>()).add(childOrder);
}
for (VeneerDecomposeOrderRespVO rootOrder : rootOrders) {
rootOrder.setChild(childMap.get(rootOrder.getOrderId()));
}
} }
@Override @Override
@@ -96,11 +96,14 @@ public class VeneerManageServiceImpl implements VeneerManageService {
page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())); page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate()));
List<Long> rootIds = rootPage.getRecords(); List<Long> rootIds = rootPage.getRecords();
if (CollUtil.isEmpty(rootIds)) { if (CollUtil.isEmpty(rootIds)) {
return new PageResult<>(); return new PageResult<>(List.of(), rootPage.getTotal());
} }
IPage<VeneerManageOrderRespVO> result = veneerManageMapper.selectOrderList( IPage<VeneerManageOrderRespVO> result = veneerManageMapper.selectOrderList(
new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds); new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds);
return new PageResult<>(result.getRecords(), rootPage.getTotal()); List<VeneerManageOrderRespVO> rootOrders = result.getRecords();
fillOrderChildren(rootOrders, veneerManageMapper.selectOrderChildList(
rootIds, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())));
return new PageResult<>(rootOrders, rootPage.getTotal());
} }
@Override @Override
@@ -117,11 +120,34 @@ public class VeneerManageServiceImpl implements VeneerManageService {
page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())); page, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate()));
List<Long> rootIds = rootPage.getRecords(); List<Long> rootIds = rootPage.getRecords();
if (CollUtil.isEmpty(rootIds)) { if (CollUtil.isEmpty(rootIds)) {
return new PageResult<>(); return new PageResult<>(List.of(), rootPage.getTotal());
} }
IPage<VeneerManageOrderRespVO> result = veneerManageMapper.selectOrderList( IPage<VeneerManageOrderRespVO> result = veneerManageMapper.selectOrderList(
new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds); new PageDTO<>(req.getPageNo(), PAGE_SIZE_NONE), rootIds);
return new PageResult<>(result.getRecords(), rootPage.getTotal()); List<VeneerManageOrderRespVO> rootOrders = result.getRecords();
fillOrderChildren(rootOrders, veneerManageMapper.selectUnplannedOrderChildList(
rootIds, req, LocalDateTimeUtils.generateTimeSection(req.getOrderDate())));
return new PageResult<>(rootOrders, rootPage.getTotal());
}
/**
* 按父订单ID分组并回填子订单,分页数量始终以根订单为准。
*
* @param rootOrders 当前页根订单
* @param childOrders 当前页根订单下符合业务条件的子订单
*/
private void fillOrderChildren(List<VeneerManageOrderRespVO> rootOrders,
List<VeneerManageOrderRespVO> childOrders) {
if (CollUtil.isEmpty(rootOrders) || CollUtil.isEmpty(childOrders)) {
return;
}
Map<Long, List<VeneerManageOrderRespVO>> childMap = new HashMap<>();
for (VeneerManageOrderRespVO childOrder : childOrders) {
childMap.computeIfAbsent(childOrder.getParentId(), key -> new ArrayList<>()).add(childOrder);
}
for (VeneerManageOrderRespVO rootOrder : rootOrders) {
rootOrder.setChild(childMap.get(rootOrder.getOrderId()));
}
} }
@Override @Override
@@ -5,6 +5,7 @@
<resultMap id="OrderMap" <resultMap id="OrderMap"
type="com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerDecomposeOrderRespVO"> type="com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerDecomposeOrderRespVO">
<result property="orderId" column="orderId"/> <result property="orderId" column="orderId"/>
<result property="parentId" column="parentId"/>
<result property="orderType" column="orderType"/> <result property="orderType" column="orderType"/>
<result property="customOrderNo" column="customOrderNo"/> <result property="customOrderNo" column="customOrderNo"/>
<result property="customer" column="customer"/> <result property="customer" column="customer"/>
@@ -51,6 +52,7 @@
<select id="selectOrderList" resultMap="OrderMap"> <select id="selectOrderList" resultMap="OrderMap">
SELECT o.id AS orderId, SELECT o.id AS orderId,
o.parent_id AS parentId,
o.order_type AS orderType, o.order_type AS orderType,
o.custom_order_no AS customOrderNo, o.custom_order_no AS customOrderNo,
o.customer, o.customer,
@@ -60,13 +62,48 @@
o.area AS area o.area AS area
FROM orders o FROM orders o
WHERE o.deleted = false WHERE o.deleted = false
AND o.root_id IN AND o.id IN
<foreach collection="rootIds" item="id" open="(" close=")" separator=","> <foreach collection="rootIds" item="id" open="(" close=")" separator=",">
#{id} #{id}
</foreach> </foreach>
ORDER BY o.id DESC ORDER BY o.id DESC
</select> </select>
<select id="selectOrderChildList" resultMap="OrderMap">
SELECT o.id AS orderId,
o.parent_id AS parentId,
o.order_type AS orderType,
o.custom_order_no AS customOrderNo,
o.customer,
o.address,
o.order_date AS orderDate,
o.plate_num AS num,
o.area AS area
FROM orders o
WHERE o.deleted = false
AND IFNULL(o.plate_num, 0) &gt; IFNULL(o.decomposed_veneer_plate_num, 0)
AND o.parent_id IN
<foreach collection="rootIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
<if test="req.orderId != null and req.orderId != ''">
AND CAST(o.id AS CHAR) LIKE CONCAT('%', #{req.orderId}, '%')
</if>
<if test="req.customOrderNo != null and req.customOrderNo != ''">
AND o.custom_order_no LIKE CONCAT('%', #{req.customOrderNo}, '%')
</if>
<if test="req.customer != null and req.customer != ''">
AND o.customer LIKE CONCAT('%', #{req.customer}, '%')
</if>
<if test="req.address != null and req.address != ''">
AND o.address LIKE CONCAT('%', #{req.address}, '%')
</if>
<if test="orderDateTime != null and orderDateTime.length == 2">
AND o.order_date BETWEEN #{orderDateTime[0]} AND #{orderDateTime[1]}
</if>
ORDER BY o.id DESC
</select>
<select id="selectGoodsPage" resultMap="GoodsMap"> <select id="selectGoodsPage" resultMap="GoodsMap">
SELECT og.goods_id AS goodsId, SELECT og.goods_id AS goodsId,
og.goods_name AS goodsName, og.goods_name AS goodsName,
@@ -116,6 +153,8 @@
op.custom_plate_no AS customPlateNo, op.custom_plate_no AS customPlateNo,
op.name, op.name,
op.name AS plateName, op.name AS plateName,
ob.room_name AS roomName,
ob.name AS bodyName,
og.color, og.color,
og.brand, og.brand,
og.material, og.material,
@@ -181,6 +220,9 @@
JOIN order_item oi ON oi.order_id = op.order_id JOIN order_item oi ON oi.order_id = op.order_id
AND oi.plate_id = op.id AND oi.plate_id = op.id
AND oi.plate_id != 0 AND oi.plate_id != 0
LEFT JOIN order_body ob ON ob.organ_id = op.organ_id
AND ob.order_id = op.order_id
AND ob.id = oi.body_id
LEFT JOIN order_group opg ON opg.order_id = op.order_id LEFT JOIN order_group opg ON opg.order_id = op.order_id
AND opg.id = oi.group_id AND opg.id = oi.group_id
WHERE op.deleted = false WHERE op.deleted = false
@@ -215,6 +257,9 @@
JOIN order_item oi ON oi.order_id = op.order_id JOIN order_item oi ON oi.order_id = op.order_id
AND oi.plate_id = op.id AND oi.plate_id = op.id
AND oi.plate_id != 0 AND oi.plate_id != 0
LEFT JOIN order_body ob ON ob.organ_id = op.organ_id
AND ob.order_id = op.order_id
AND ob.id = oi.body_id
LEFT JOIN order_group opg ON opg.order_id = op.order_id LEFT JOIN order_group opg ON opg.order_id = op.order_id
AND opg.id = oi.group_id AND opg.id = oi.group_id
WHERE op.deleted = false WHERE op.deleted = false
@@ -5,6 +5,7 @@
<resultMap id="OrderMap" <resultMap id="OrderMap"
type="com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerManageOrderRespVO"> type="com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerManageOrderRespVO">
<result property="orderId" column="orderId"/> <result property="orderId" column="orderId"/>
<result property="parentId" column="parentId"/>
<result property="orderType" column="orderType"/> <result property="orderType" column="orderType"/>
<result property="customOrderNo" column="customOrderNo"/> <result property="customOrderNo" column="customOrderNo"/>
<result property="customer" column="customer"/> <result property="customer" column="customer"/>
@@ -77,6 +78,7 @@
<select id="selectOrderList" resultMap="OrderMap"> <select id="selectOrderList" resultMap="OrderMap">
SELECT o.id AS orderId, SELECT o.id AS orderId,
o.parent_id AS parentId,
o.order_type AS orderType, o.order_type AS orderType,
o.custom_order_no AS customOrderNo, o.custom_order_no AS customOrderNo,
o.customer, o.customer,
@@ -86,13 +88,48 @@
o.area AS area o.area AS area
FROM orders o FROM orders o
WHERE o.deleted = false WHERE o.deleted = false
AND o.root_id IN AND o.id IN
<foreach collection="rootIds" item="id" open="(" close=")" separator=","> <foreach collection="rootIds" item="id" open="(" close=")" separator=",">
#{id} #{id}
</foreach> </foreach>
ORDER BY o.id DESC ORDER BY o.id DESC
</select> </select>
<select id="selectOrderChildList" resultMap="OrderMap">
SELECT o.id AS orderId,
o.parent_id AS parentId,
o.order_type AS orderType,
o.custom_order_no AS customOrderNo,
o.customer,
o.address,
o.order_date AS orderDate,
o.plate_num AS num,
o.area AS area
FROM orders o
WHERE o.deleted = false
AND IFNULL(o.decomposed_veneer_plate_num, 0) &gt; 0
AND o.parent_id IN
<foreach collection="rootIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
<if test="req.orderId != null and req.orderId != ''">
AND CAST(o.id AS CHAR) LIKE CONCAT('%', #{req.orderId}, '%')
</if>
<if test="req.customOrderNo != null and req.customOrderNo != ''">
AND o.custom_order_no LIKE CONCAT('%', #{req.customOrderNo}, '%')
</if>
<if test="req.customer != null and req.customer != ''">
AND o.customer LIKE CONCAT('%', #{req.customer}, '%')
</if>
<if test="req.address != null and req.address != ''">
AND o.address LIKE CONCAT('%', #{req.address}, '%')
</if>
<if test="orderDateTime != null and orderDateTime.length == 2">
AND o.order_date BETWEEN #{orderDateTime[0]} AND #{orderDateTime[1]}
</if>
ORDER BY o.id DESC
</select>
<select id="selectGoodsPage" resultMap="GoodsMap"> <select id="selectGoodsPage" resultMap="GoodsMap">
SELECT og.goods_id AS goodsId, SELECT og.goods_id AS goodsId,
og.goods_name AS goodsName, og.goods_name AS goodsName,
@@ -198,6 +235,48 @@
ORDER BY og.thickness DESC ORDER BY og.thickness DESC
</select> </select>
<select id="selectUnplannedOrderChildList" resultMap="OrderMap">
SELECT o.id AS orderId,
o.parent_id AS parentId,
o.order_type AS orderType,
o.custom_order_no AS customOrderNo,
o.customer,
o.address,
o.order_date AS orderDate,
o.plate_num AS num,
o.area AS area
FROM orders o
WHERE o.deleted = false
AND IFNULL(o.plate_num, 0) &gt; IFNULL(o.planned_veneer_plate_num, 0)
AND o.parent_id IN
<foreach collection="rootIds" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
AND EXISTS (
SELECT 1
FROM order_plate_veneer opv
WHERE opv.order_id = o.id
AND opv.deleted = false
AND opv.plan_id = 0
)
<if test="req.orderId != null and req.orderId != ''">
AND CAST(o.id AS CHAR) LIKE CONCAT('%', #{req.orderId}, '%')
</if>
<if test="req.customOrderNo != null and req.customOrderNo != ''">
AND o.custom_order_no LIKE CONCAT('%', #{req.customOrderNo}, '%')
</if>
<if test="req.customer != null and req.customer != ''">
AND o.customer LIKE CONCAT('%', #{req.customer}, '%')
</if>
<if test="req.address != null and req.address != ''">
AND o.address LIKE CONCAT('%', #{req.address}, '%')
</if>
<if test="orderDateTime != null and orderDateTime.length == 2">
AND o.order_date BETWEEN #{orderDateTime[0]} AND #{orderDateTime[1]}
</if>
ORDER BY o.id DESC
</select>
<sql id="PlateVeneerColumns"> <sql id="PlateVeneerColumns">
opv.id, opv.id,
opv.veneer_no AS veneerNo, opv.veneer_no AS veneerNo,