From b3fe06c151dc8455649bf0a46e481ceb83e3ea2a Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 07 十一月 2026 13:37:54 +0800
Subject: [PATCH] feat: 完成好水川 MOM 需求1/2/4/5/8(装箱、BOM成本、销售合同、劳动合同、留样)
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
index 0853b68..f1dd8ce 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesController.java
@@ -14,10 +14,16 @@
import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesSaveReqVO;
import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesShippingReqVO;
+import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesStatisticsPageReqVO;
+import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesStatisticsRespVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeDO;
import cn.iocoder.yudao.module.mes.service.wm.productsales.MesWmProductSalesService;
import cn.iocoder.yudao.module.mes.service.wm.salesnotice.MesWmSalesNoticeService;
+import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi;
+import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO;
+import cn.iocoder.yudao.module.mdm.api.unit.MdmUnitMeasureApi;
+import cn.iocoder.yudao.module.mdm.api.unit.dto.MdmUnitMeasureRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -30,6 +36,7 @@
import java.io.IOException;
import java.util.*;
+import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -47,6 +54,10 @@
private CrmCustomerApi crmCustomerApi;
@Resource
private MesWmSalesNoticeService salesNoticeService;
+ @Resource
+ private MdmItemApi mdmItemApi;
+ @Resource
+ private MdmUnitMeasureApi mdmUnitMeasureApi;
@PostMapping("/create")
@Operation(summary = "鍒涘缓閿�鍞嚭搴撳崟")
@@ -89,6 +100,15 @@
@Valid MesWmProductSalesPageReqVO pageReqVO) {
PageResult<MesWmProductSalesDO> pageResult = productSalesService.getProductSalesPage(pageReqVO);
return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal()));
+ }
+
+ @GetMapping("/statistics-page")
+ @Operation(summary = "鑾峰緱鍙戣揣缁熻鍒嗛〉")
+ public CommonResult<PageResult<MesWmProductSalesStatisticsRespVO>> getProductSalesStatisticsPage(
+ @Valid MesWmProductSalesStatisticsPageReqVO pageReqVO) {
+ PageResult<MesWmProductSalesStatisticsRespVO> pageResult =
+ productSalesService.getProductSalesStatisticsPage(pageReqVO);
+ return success(new PageResult<>(buildStatisticsRespVOList(pageResult.getList()), pageResult.getTotal()));
}
@GetMapping("/export-excel")
@@ -156,6 +176,33 @@
// ==================== 鎷兼帴 VO ====================
+ private List<MesWmProductSalesStatisticsRespVO> buildStatisticsRespVOList(
+ List<MesWmProductSalesStatisticsRespVO> list) {
+ if (CollUtil.isEmpty(list)) {
+ return Collections.emptyList();
+ }
+ // 鎵归噺鏌ヨ瀹㈡埛
+ Map<Long, CrmCustomerRespDTO> customerMap = crmCustomerApi.getCustomerMap(
+ convertSet(list, MesWmProductSalesStatisticsRespVO::getClientId));
+ // 鎵归噺鏌ヨ鐗╂枡涓庤閲忓崟浣�
+ Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(
+ convertSet(list, MesWmProductSalesStatisticsRespVO::getItemId));
+ Map<Long, MdmUnitMeasureRespDTO> unitMeasureMap = mdmUnitMeasureApi.getUnitMeasureList(
+ convertSet(itemMap.values(), MdmItemRespDTO::getUnitMeasureId)).getCheckedData()
+ .stream().collect(Collectors.toMap(MdmUnitMeasureRespDTO::getId, e -> e));
+ // 鎷兼帴鍚嶇О
+ list.forEach(vo -> {
+ MapUtils.findAndThen(customerMap, vo.getClientId(), customer -> vo.setClientName(customer.getName()));
+ MapUtils.findAndThen(itemMap, vo.getItemId(), item -> {
+ vo.setItemCode(item.getCode()).setItemName(item.getName())
+ .setSpecification(item.getSpecification());
+ MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(),
+ unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName()));
+ });
+ });
+ return list;
+ }
+
private List<MesWmProductSalesRespVO> buildRespVOList(List<MesWmProductSalesDO> list) {
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
--
Gitblit v1.9.3