From 647960c44d36b97263fee0325487f9dea8b24307 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期五, 30 十月 2026 16:32:18 +0800
Subject: [PATCH] feat(cnas,inspect): 客户满意度表单与年度汇总导出、委托单费用优惠维护

---
 cnas-manage/src/main/java/com/ruoyi/manage/controller/ClientSatisfactionController.java |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/cnas-manage/src/main/java/com/ruoyi/manage/controller/ClientSatisfactionController.java b/cnas-manage/src/main/java/com/ruoyi/manage/controller/ClientSatisfactionController.java
index 87f4519..b94ac1b 100644
--- a/cnas-manage/src/main/java/com/ruoyi/manage/controller/ClientSatisfactionController.java
+++ b/cnas-manage/src/main/java/com/ruoyi/manage/controller/ClientSatisfactionController.java
@@ -52,6 +52,10 @@
     @Operation(summary = "瀹㈡埛婊℃剰搴﹁皟鏌ユ柊澧�")
     @PostMapping("/addClientSatisfaction")
     public Result addClientSatisfaction(@RequestBody ClientSatisfaction clientSatisfaction){
+        Result<?> error = fillAssessment(clientSatisfaction);
+        if (error != null) {
+            return error;
+        }
         clientSatisfactionService.save(clientSatisfaction);
         // 杩斿洖淇濆瓨鍚庣殑璁板綍锛堝惈鑷id锛夛紝鍓嶇鎹涓婁紶鏂板鏃舵殏瀛樼殑鐓х墖
         return Result.success(clientSatisfaction);
@@ -64,7 +68,35 @@
     @Operation(summary = "瀹㈡埛婊℃剰搴﹁皟鏌ユ柊澧�")
     @PostMapping("/updateClientSatisfaction")
     public Result updateClientSatisfaction(@RequestBody ClientSatisfaction clientSatisfaction){
+        Result<?> error = fillAssessment(clientSatisfaction);
+        if (error != null) {
+            return error;
+        }
         return Result.success(clientSatisfactionService.updateById(clientSatisfaction));
+    }
+
+    /**
+     * 鏍规嵁10閬撻鐨勮瘎鍒嗚绠楁�诲垎鍜屾弧鎰忓害璇勫畾锛�80鍒嗗強浠ヤ笂涓烘弧鎰忥級
+     */
+    private Result<?> fillAssessment(ClientSatisfaction clientSatisfaction) {
+        Integer[] scores = {clientSatisfaction.getScore1(), clientSatisfaction.getScore2(),
+                clientSatisfaction.getScore3(), clientSatisfaction.getScore4(),
+                clientSatisfaction.getScore5(), clientSatisfaction.getScore6(),
+                clientSatisfaction.getScore7(), clientSatisfaction.getScore8(),
+                clientSatisfaction.getScore9(), clientSatisfaction.getScore10()};
+        int total = 0;
+        for (int i = 0; i < scores.length; i++) {
+            if (scores[i] == null) {
+                return Result.fail("璇峰畬鎴愮" + (i + 1) + "棰樿瘎鍒�");
+            }
+            if (scores[i] < 5 || scores[i] > 10) {
+                return Result.fail("璇勫垎蹇呴』鍦�5鍒�10鍒嗕箣闂�");
+            }
+            total += scores[i];
+        }
+        clientSatisfaction.setTotalScore(total);
+        clientSatisfaction.setSatisfactionResult(total >= 80 ? 0 : 1);
+        return null;
     }
 
     /**
@@ -93,6 +125,16 @@
     }
 
     /**
+     * 瀹㈡埛婊℃剰搴﹀勾搴︽眹鎬诲鍑�
+     * @param year 姹囨�诲勾搴�
+     */
+    @Operation(summary = "瀹㈡埛婊℃剰搴﹀勾搴︽眹鎬诲鍑�")
+    @GetMapping("/exportAnnualSummary")
+    public void exportAnnualSummary(Integer year, HttpServletResponse response){
+        clientSatisfactionService.exportAnnualSummary(year, response);
+    }
+
+    /**
      * 纭瀹㈡埛婊℃剰搴�
      * @param clientSatisfaction 瑕佷慨鏀瑰鎴锋弧鎰忓害鐨勭姸鎬佸璞�
      * @param userId 淇敼浜篿d

--
Gitblit v1.9.3