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 |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 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 acebb14..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
@@ -84,5 +84,46 @@
         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