From b0978a62cf2050170793e87fbd01db1760808043 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期三, 04 十一月 2026 09:50:30 +0800
Subject: [PATCH] feat: 从长辉移植新高缺失的六个业务模块(安全生产/能耗/数采/备件/质检台账/售后问题回访)

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java |   66 +++++++++++++++++++++++++++++++--
 1 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java
index db782f7..d26fed6 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/feedback/MesProFeedbackController.java
@@ -4,6 +4,9 @@
 import cn.hutool.core.collection.ListUtil;
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
+import cn.iocoder.yudao.module.mes.service.pro.feedback.dto.MesTaskParamSnapshot;
+import cn.iocoder.yudao.module.mes.service.pro.feedback.dto.MesFeedbackParamSnapshot;
 import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -12,11 +15,14 @@
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackBatchCheckRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackBatchCreateReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackBatchCreateRespVO;
+import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackImportExcelVO;
+import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackImportRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackPageReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackQuickCreateReqVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackQuickCreateRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackRespVO;
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackSaveReqVO;
+import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackSummaryRespVO;
 import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO;
 import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO;
 import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO;
@@ -39,13 +45,16 @@
 import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackTraceRespVO;
 import cn.iocoder.yudao.module.mes.dal.dataobject.qc.ipqc.MesQcIpqcDO;
@@ -61,6 +70,7 @@
 import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants;
 
 import java.io.IOException;
+import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Stream;
 
@@ -136,7 +146,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱鐢熶骇鎶ュ伐")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:pro-feedback:query')")
     public CommonResult<MesProFeedbackRespVO> getFeedback(@RequestParam("id") Long id) {
         MesProFeedbackDO feedback = feedbackService.getFeedback(id);
         if (feedback == null) {
@@ -147,16 +156,25 @@
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱鐢熶骇鎶ュ伐鍒嗛〉")
-    @PreAuthorize("@ss.hasPermission('mes:pro-feedback:query')")
     public CommonResult<PageResult<MesProFeedbackRespVO>> getFeedbackPage(@Valid MesProFeedbackPageReqVO pageReqVO) {
         PageResult<MesProFeedbackDO> pageResult = feedbackService.getFeedbackPage(pageReqVO);
         return success(new PageResult<>(buildFeedbackRespVOList(pageResult.getList()), pageResult.getTotal()));
     }
 
+    @GetMapping("/param-config")
+    @Operation(summary = "鑾峰緱鐢熶骇浠诲姟鍐荤粨鐨勫弬鏁伴噰闆嗛厤缃�")
+    public CommonResult<Map<String, Object>> getParamConfig(@RequestParam("taskId") Long taskId) {
+        MesProTaskDO task = taskService.validateTaskExists(taskId);
+        Map<String, Object> result = new LinkedHashMap<>();
+        result.put("mode", task.getParamCollectMode() == null ? 0 : task.getParamCollectMode());
+        result.put("template", JsonUtils.parseObject(task.getParamTemplateSnapshot(), MesTaskParamSnapshot.class));
+        result.put("shared", JsonUtils.parseObject(task.getParamSharedSnapshot(), MesFeedbackParamSnapshot.class));
+        return success(result);
+    }
+
     @GetMapping("/list-by-task")
     @Operation(summary = "鎸変换鍔¤幏寰楁姤宸ュ巻鍙插垪琛�")
     @Parameter(name = "taskId", description = "浠诲姟缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:pro-feedback:query')")
     public CommonResult<List<MesProFeedbackRespVO>> getFeedbackListByTask(@RequestParam("taskId") Long taskId) {
         List<MesProFeedbackDO> list = feedbackService.getFeedbackListByTaskId(taskId);
         return success(buildFeedbackRespVOList(list));
@@ -172,6 +190,38 @@
         List<MesProFeedbackDO> list = feedbackService.getFeedbackPage(pageReqVO).getList();
         List<MesProFeedbackRespVO> voList = buildFeedbackRespVOList(list);
         ExcelUtils.write(response, "鐢熶骇鎶ュ伐.xls", "鏁版嵁", MesProFeedbackRespVO.class, voList);
+    }
+
+    @GetMapping("/get-import-template")
+    @Operation(summary = "鑾峰緱鐢熶骇鎶ュ伐瀵煎叆妯℃澘")
+    public void importTemplate(HttpServletResponse response) throws IOException {
+        // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+        List<MesProFeedbackImportExcelVO> list = Collections.singletonList(
+                MesProFeedbackImportExcelVO.builder()
+                        .code("FB-001").type(1).taskCode("TASK-001")
+                        .feedbackTime(java.time.LocalDateTime.of(2026, 10, 16, 10, 0, 0))
+                        .scheduledQuantity(new java.math.BigDecimal("100"))
+                        .feedbackQuantity(new java.math.BigDecimal("100"))
+                        .qualifiedQuantity(new java.math.BigDecimal("100"))
+                        .unqualifiedQuantity(new java.math.BigDecimal("0"))
+                        .remark("").build()
+        );
+        // 杈撳嚭
+        ExcelUtils.writeTemplate(response, "鐢熶骇鎶ュ伐瀵煎叆妯℃澘.xls", "鐢熶骇鎶ュ伐鍒楄〃", MesProFeedbackImportExcelVO.class, list);
+    }
+
+    @PostMapping("/import")
+    @Operation(summary = "瀵煎叆鐢熶骇鎶ュ伐")
+    @Parameters({
+            @Parameter(name = "file", description = "Excel 鏂囦欢", required = true),
+            @Parameter(name = "updateSupport", description = "鏄惁鏀寔鏇存柊锛岄粯璁や负 false", example = "true")
+    })
+    @PreAuthorize("@ss.hasPermission('mes:pro-feedback:import')")
+    public CommonResult<MesProFeedbackImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
+                                                                @RequestParam(value = "updateSupport", required = false,
+                                                                        defaultValue = "false") Boolean updateSupport) throws Exception {
+        List<MesProFeedbackImportExcelVO> list = ExcelUtils.read(file, MesProFeedbackImportExcelVO.class);
+        return success(feedbackService.importFeedbackList(list, updateSupport));
     }
 
     @PutMapping("/submit")
@@ -228,7 +278,6 @@
     @GetMapping("/trace/{id}")
     @Operation(summary = "鑾峰緱鎶ュ伐杩芥函淇℃伅", description = "鎶ュ伐 + 浜у嚭/浜у嚭鏄庣粏 + 娑堣��/娑堣�楁槑缁� + IPQC妫�楠�")
     @Parameter(name = "id", description = "鎶ュ伐缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('mes:pro-feedback:query')")
     public CommonResult<MesProFeedbackTraceRespVO> getFeedbackTrace(@PathVariable("id") Long id) {
         MesProFeedbackDO feedback = feedbackService.getFeedback(id);
         if (feedback == null) {
@@ -251,6 +300,15 @@
         return success(trace);
     }
 
+    @GetMapping("/summary")
+    @Operation(summary = "浣滀笟鎴愭灉姹囨�荤粺璁�", description = "鎸夋椂闂磋寖鍥存眹鎬诲凡鎵瑰噯鎶ュ伐鏁伴噺/鍚堟牸鏁伴噺锛屾寜宸ュ崟绫诲瀷銆佹棩鏈熷垎缁�")
+    public CommonResult<MesProFeedbackSummaryRespVO> getFeedbackSummary(
+            @RequestParam(value = "beginDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate beginDate,
+            @RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate,
+            @RequestParam(value = "workOrderType", required = false) Integer workOrderType) {
+        return success(feedbackService.getFeedbackSummary(beginDate, endDate, workOrderType));
+    }
+
     private List<MesProFeedbackRespVO> buildFeedbackRespVOList(List<MesProFeedbackDO> list) {
         if (CollUtil.isEmpty(list)) {
             return Collections.emptyList();

--
Gitblit v1.9.3