From 49120f2b9db33455756a911e56cfefd7c3120a14 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期三, 28 十月 2026 17:05:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/SpStatCaseController.java |   65 +++++++++++++++++++++++++++++---
 1 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/SpStatCaseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/SpStatCaseController.java
index ed39a62..f6877a3 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/SpStatCaseController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/SpStatCaseController.java
@@ -48,13 +48,13 @@
 import static com.ruoyi.web.controller.project.ServiceReimbursementController.convert;
 
 /**
- * 璐圭敤鐢宠涓籆ontroller
+ * 妗堜緥缁熻
  *
  * @author ruoyi
  * @date 2022-01-24
  */
 @Slf4j
-@Api("璐圭敤鐢宠涓�")
+@Api("妗堜緥缁熻")
 @RestController
 @RequestMapping("/project/spstatcase")
 public class SpStatCaseController extends BaseController {
@@ -63,14 +63,67 @@
     SpstatCaseService spstatCaseService;
 
     /**
-     * 鏌ヨ璐圭敤鐢宠涓诲垪琛�
+     * 鏌ヨ妗堜緥缁熻
      */
-    @ApiOperation("鏌ヨ璐圭敤鐢宠涓诲垪琛�")
-    @PostMapping("/list")
-    public TableDataInfo list(@RequestBody SpStatCaseReq spStatCaseReq) {
+    @ApiOperation("鏌ヨ妗堜緥缁熻")
+    @PostMapping("/spStatCaselist")
+    public TableDataInfo spStatCaselist(@RequestBody SpStatCaseReq spStatCaseReq) {
         startPage();
         return getDataTable(spstatCaseService.getListBypower(spStatCaseReq));
     }
 
+    /**
+     * 瀵煎嚭妗堜緥缁熻
+     */
+    @ApiOperation("瀵煎嚭妗堜緥缁熻")
+    @Log(title = "妗堜緥缁熻", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(SpStatCaseReq spStatCaseReq) {
+        List<SpStatCase> list = spstatCaseService.getListBypower(spStatCaseReq);
+        ExcelUtil<SpStatCase> util = new ExcelUtil<SpStatCase>(SpStatCase.class);
+        return util.exportExcel(list, "妗堜緥缁熻鏁版嵁");
+    }
+
+    /**
+     * 瀵煎嚭妗堜緥缁熻锛堟寜涓氬姟缁勶級
+     */
+    @ApiOperation("瀵煎嚭妗堜緥缁熻锛堟寜涓氬姟缁勶級")
+    @Log(title = "妗堜緥缁熻", businessType = BusinessType.EXPORT)
+    @GetMapping("/exportDept")
+    public AjaxResult exportDept(SpStatCaseReq spStatCaseReq) {
+        List<SpStatCase> list = spstatCaseService.getListBypower(spStatCaseReq);
+        Map<String, SpStatCaseDept> grouped = new LinkedHashMap<String, SpStatCaseDept>();
+        for (SpStatCase row : list) {
+            String key = StringUtils.isNotEmpty(row.getDeptid()) ? row.getDeptid() : row.getDeptname();
+            if (key == null) {
+                key = "";
+            }
+            SpStatCaseDept dept = grouped.get(key);
+            if (dept == null) {
+                dept = new SpStatCaseDept();
+                dept.setDeptname(row.getDeptname() == null ? "鏈垎缁�" : row.getDeptname());
+                dept.setCaseTotal(0);
+                dept.setTerminationTotal(0);
+                grouped.put(key, dept);
+            }
+            dept.setCaseTotal(dept.getCaseTotal() + toInt(row.getWorkflowsum()));
+            dept.setTerminationTotal(dept.getTerminationTotal() + toInt(row.getTerminationcase()));
+        }
+        List<SpStatCaseDept> result = new ArrayList<SpStatCaseDept>(grouped.values());
+        ExcelUtil<SpStatCaseDept> util = new ExcelUtil<SpStatCaseDept>(SpStatCaseDept.class);
+        return util.exportExcel(result, "妗堜緥缁熻锛堟寜涓氬姟缁勶級");
+    }
+
+    private int toInt(String value) {
+        if (StringUtils.isEmpty(value)) {
+            return 0;
+        }
+        try {
+            return Integer.parseInt(value.trim());
+        } catch (NumberFormatException e) {
+            return 0;
+        }
+    }
+
 
 }

--
Gitblit v1.9.3