微信小程序基于短编号获取订单下板件和配件详情接口数据字段修正

This commit is contained in:
gaoqr
2026-04-09 15:41:24 +08:00
parent 3692a20d58
commit e8acca2c3f
9 changed files with 179 additions and 11 deletions
@@ -75,4 +75,13 @@ public class OrderViewPartPageRespVO {
@Schema(description = "CAD图纸文件ID")
private Long cadViewFileId;
@Schema(description = "房间名称")
private String roomName;
@Schema(description = "柜体名称")
private String bodyName;
@Schema(description = "柜体id")
private Long bodyId;
}
@@ -87,4 +87,13 @@ public class OrderViewPlatePageRespVO {
@Schema(description = "备注")
private String remark;
@Schema(description = "房间名称")
private String roomName;
@Schema(description = "柜体名称")
private String bodyName;
@Schema(description = "柜体id")
private Long bodyId;
}
@@ -106,4 +106,14 @@ public class OrdersViewPartsPageDO {
* cad视图文件id
*/
private Long cadViewFileId;
/**
* 房间名称
*/
private String roomName;
/**
* 柜体名称
*/
private String bodyName;
}
@@ -131,4 +131,14 @@ public class OrdersViewPlatesPageDO {
* 自定义板编号
*/
private String customPlateNo;
/**
* 房间名称
*/
private String roomName;
/**
* 柜体名称
*/
private String bodyName;
}
@@ -277,4 +277,29 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
* @return
*/
List<Long> selectComponentCorrelationPartsIds(@Param("orderIds") List<Long> orderIds, @Param("componentIds") List<Long> componentIds, @Param("groupIds") List<Long> groupIds);
/**
* 查询订单下板件视图信息列表
*
* @param orderId
* @param bodyIds
* @param componentIds
* @return
*/
List<OrdersViewPlatesPageDO> selectOrderViewPlates(@Param("orderId") Long orderId,
@Param("bodyIds") Set<Long> bodyIds,
@Param("componentIds") Set<Long> componentIds);
/**
* 查询订单下板件视图信息列表
*
* @param orderId
* @param bodyIds
* @param componentIds
* @return
*/
List<OrdersViewPartsPageDO> selectOrderViewParts(@Param("orderId") Long orderId,
@Param("bodyIds") Set<Long> bodyIds,
@Param("componentIds") Set<Long> componentIds);
}
@@ -778,10 +778,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
}
// 查询所有板件的视图所需信息
PageDTO<OrdersViewPlatesPageDO> page1 = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
IPage<OrdersViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectOrdersViewPlatesPage(page1, List.of(orderId), bodyIds,
null, queryComponentIds, true);
List<OrdersViewPlatesPageDO> plateRecords = viewPlatesPage.getRecords();
List<OrdersViewPlatesPageDO> plateRecords = orderItemMapper.selectOrderViewPlates(orderId, bodyIds, queryComponentIds);
List<OrderViewPlatePageRespVO> plateResult = new ArrayList<>();
if (CollUtil.isNotEmpty(plateRecords)) {
@@ -794,10 +791,7 @@ public class OrderComponentServiceImpl implements OrderComponentService {
}
// 查询所有配件的视图所需信息
PageDTO<OrdersViewPartsPageDO> page2 = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
IPage<OrdersViewPartsPageDO> viewPartsPage = orderItemMapper.selectOrdersViewPartsPage(page2, List.of(orderId), bodyIds,
null, queryComponentIds, null, true);
List<OrdersViewPartsPageDO> partRecords = viewPartsPage.getRecords();
List<OrdersViewPartsPageDO> partRecords = orderItemMapper.selectOrderViewParts(orderId, bodyIds, queryComponentIds);
List<OrderViewPartPageRespVO> partResult = new ArrayList<>();
if (CollUtil.isNotEmpty(partRecords)) {
@@ -25,7 +25,7 @@ public class OrderItemServiceImpl implements OrderItemService {
public List<OrderItemDO> getPlateItemCompId(Long id) {
List<OrderItemDO> plateItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>()
.eq(OrderItemDO::getPlateId, id)
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId));
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId, OrderItemDO::getBodyId));
if (CollUtil.isNotEmpty(plateItemDOS)) {
return plateItemDOS;
}
@@ -36,7 +36,7 @@ public class OrderItemServiceImpl implements OrderItemService {
public List<OrderItemDO> getPartItemCompId(Long partId) {
List<OrderItemDO> partItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>()
.eq(OrderItemDO::getPartsId, partId)
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId));
.select(OrderItemDO::getCompId, OrderItemDO::getGroupId, OrderItemDO::getBodyId));
if (CollUtil.isNotEmpty(partItemDOS)) {
return partItemDOS;
}
@@ -56,6 +56,7 @@ import com.cf.imes.module.executor.service.order.OrderInputProcessor;
import com.cf.imes.module.executor.service.order.OrderService;
import com.cf.imes.module.executor.service.orderbody.OrderBodyService;
import com.cf.imes.module.executor.service.ordercomponent.OrderComponentService;
import com.cf.imes.module.executor.service.orderitem.OrderItemService;
import com.cf.imes.module.system.api.organ.OrganApi;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -131,6 +132,9 @@ public class PlateServiceImpl implements PlateService {
@Resource
private OrderComponentService orderComponentService;
@Resource
private OrderItemService orderItemService;
private static final String FIELD_PLATE_ID = "plateId";
private static final String FIELD_OG_MATERIAL = "og.material";
private static final String FIELD_OG_BRAND = "og.brand";
@@ -1105,7 +1109,19 @@ public class PlateServiceImpl implements PlateService {
OrderDetailComponentPageReqVO detailReqVO = new OrderDetailComponentPageReqVO();
detailReqVO.setOrderId(plateDO.getOrderId());
detailReqVO.setComponentIds(reqVO.getComponentIds());
detailReqVO.setBodyIds(reqVO.getBodyIds());
// 入参的柜体缺省用板件本身的柜体id
Set<Long> bodyIds = reqVO.getBodyIds();
if (CollUtil.isNotEmpty(bodyIds)) {
detailReqVO.setBodyIds(bodyIds);
} else {
List<OrderItemDO> plateItems = orderItemService.getPlateItemCompId(plateDO.getId());
if (CollUtil.isEmpty(plateItems)) {
throw new ServiceException(PLATE_NOT_EXISTS);
}
detailReqVO.setBodyIds(Set.of(plateItems.get(0).getBodyId()));
}
return orderComponentService.getOrderViewCadInfo(detailReqVO);
}
}
@@ -769,4 +769,99 @@
)
GROUP BY oi.parts_id
</select>
<select id="selectOrderViewPlates" resultType="com.cf.imes.module.executor.dal.dataobject.orderItem.OrdersViewPlatesPageDO">
SELECT
op.plate_no,
op.cad_plate_no,
op.name,
op.height,
op.width,
op.thickness,
ob.name AS bodyName,
ob.room_name AS roomName,
ob.id AS bodyId,
t.cad_view_id
<if test="componentIds != null and componentIds.size() > 0">
, t.comp_id
</if>
FROM order_plate op
JOIN (
SELECT plate_id,
MIN(cad_view_id) AS cad_view_id
<if test="componentIds != null and componentIds.size() > 0">
, MIN(comp_id) AS comp_id
</if>
FROM order_item
WHERE order_id = #{orderId} and plate_id != 0
<if test="bodyIds != null and bodyIds.size() > 0">
AND body_id IN
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
#{bodyId}
</foreach>
</if>
<if test="componentIds != null and componentIds.size() > 0">
AND comp_id IN
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
#{componentId}
</foreach>
</if>
GROUP BY plate_id
) t ON t.plate_id = op.id
JOIN order_body ob ON ob.order_id = op.order_id
<if test="bodyIds != null and bodyIds.size() > 0">
AND ob.id IN
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
#{bodyId}
</foreach>
</if>
</select>
<select id="selectOrderViewParts" resultType="com.cf.imes.module.executor.dal.dataobject.orderItem.OrdersViewPartsPageDO">
SELECT
op.id,
op.name,
op.model,
op.spec,
ob.name AS bodyName,
ob.room_name AS roomName,
ob.id AS bodyId,
t.num,
t.cad_view_id
<if test="componentIds != null and componentIds.size() > 0">
, t.comp_id
</if>
FROM order_parts op
JOIN (
SELECT parts_id,
body_id,
cad_view_id,
SUM(num) AS num
<if test="componentIds != null and componentIds.size() > 0">
, MIN(comp_id) AS comp_id
</if>
FROM order_item
WHERE order_id = #{orderId} and parts_id != 0
<if test="bodyIds != null and bodyIds.size() > 0">
AND body_id IN
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
#{bodyId}
</foreach>
</if>
<if test="componentIds != null and componentIds.size() > 0">
AND comp_id IN
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
#{componentId}
</foreach>
</if>
GROUP BY body_id, parts_id, cad_view_id
) t ON t.parts_id = op.id
JOIN order_body ob ON ob.order_id = op.order_id
<if test="bodyIds != null and bodyIds.size() > 0">
AND ob.id IN
<foreach item="bodyId" collection="bodyIds" open="(" separator="," close=")">
#{bodyId}
</foreach>
</if>
</select>
</mapper>