From c29a88997b5a21d958ac41bfbe956161ff42842e Mon Sep 17 00:00:00 2001
From: jiazx0107 <jiazx0107@163.com>
Date: 星期六, 17 一月 2026 19:23:38 +0800
Subject: [PATCH] 调整银行工单审批

---
 fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java |  208 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 194 insertions(+), 14 deletions(-)

diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java
index 88f67e1..87eb5cd 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java
@@ -1,15 +1,18 @@
 package com.fzzy.igds.export;
 
 
-import com.fzzy.igds.ReportInDetailPR;
-import com.fzzy.igds.data.InoutParam;
+import com.fzzy.igds.*;
+import com.fzzy.igds.data.*;
+import com.fzzy.igds.domain.Company;
+import com.fzzy.igds.domain.Depot;
 import com.fzzy.igds.domain.Dept;
 import com.fzzy.igds.domain.InoutRecord;
-import com.fzzy.igds.service.InoutRecordService;
-import com.fzzy.igds.service.SysDeptService;
+import com.fzzy.igds.service.*;
 import com.fzzy.igds.utils.ContextUtil;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -17,7 +20,11 @@
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 
 /**
@@ -25,7 +32,6 @@
  *
  * @author sgj
  * @date 2025/12/24
-
  */
 @Controller
 @RequestMapping("export")
@@ -34,27 +40,201 @@
 
     @Resource
     private InoutRecordService inoutReportService;
-
     @Resource
     private SysDeptService sysDeptService;
-
+    @Resource
+    private CoreDeptService coreDeptService;
+    @Resource
+    private DepotService depotService;
+    @Resource
+    private CoreCompanyService coreCompanyService;
     @Autowired
     private ReportInDetailPR reportInDetailPR;
+    @Autowired
+    private ReportOutDetailPR reportOutDetailPR;
+    @Autowired
+    private SuperInventoryReportPR superInventoryReportPR;
 
+    @Autowired
+    private CompanyPR companyPR;
+
+    @Autowired
+    private DeptPR deptPR;
+
+    @Autowired
+    private DepotPR depotPR;
+
+    @Autowired
+    private DicPR dicPR;
 
 
     /**
      * 鍑哄叆搴撴姤琛ㄥ鍑�
+     *
      * @return
      */
-    @RequestMapping("/inReport-excel")
+    @RequestMapping("/inOutReport-excel")
     @ResponseBody
-    public AjaxResult inReportExcel(InoutParam param) {
-        //鏌ヨ鏁版嵁
-        List<InoutRecord> list = reportInDetailPR.listRecord(param);
-
+    public AjaxResult inOutReport(InoutParam param) {
         //璁剧疆鏍囬
-        String sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+        String sheetName = "鎶ヨ〃鏁版嵁";
+        //鏌ヨ鏁版嵁
+        List<InoutRecord> list = new ArrayList<>();
+        //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
+        String deptName = "";
+        SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
+        if (null != subDept) {
+            deptName = subDept.getDeptName();
+        }
+        //鍒涘缓鏀跺偍鍏徃ID鍒板悕绉扮殑鏄犲皠
+        Map<String, String> companyMap = Optional.ofNullable(companyPR.getData())
+                .orElse(new ArrayList<>())
+                .stream()
+                .collect(Collectors.toMap(Company::getId, Company::getDwmc, (key1, key2) -> key2));
+        //鍒涘缓鎵�鍦ㄥ簱鍖篒D鍒板悕绉扮殑鏄犲皠
+        Map<String, String> deptMap = Optional.ofNullable(deptPR.getAllData())
+                .orElse(new ArrayList<>())
+                .stream()
+                .collect(Collectors.toMap(Dept::getId, Dept::getKqmc, (key1, key2) -> key2));
+        // 鍒涘缓浠撳簱ID鍒板悕绉扮殑鏄犲皠
+        Map<String, String> depotMap = Optional.ofNullable(depotPR.getData(null))
+                .orElse(new ArrayList<>())
+                .stream()
+                .collect(Collectors.toMap(Depot::getId, Depot::getName, (key1, key2) -> key2));
+        //鍒涘缓绮鍝佺ID鍒板悕绉扮殑鏄犲皠
+        Map<String, String> foodVarietyMap = Optional.ofNullable(dicPR.sysDictData("FOOD_VARIETY_"))
+                .orElse(new ArrayList<>())
+                .stream()
+                .collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (key1, key2) -> key2));
+
+        //缁勮瀹為檯瀵煎嚭鏁版嵁
+        if (StringUtils.isNotEmpty(param.getType()) && "IN".equals(param.getType())) {
+            sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+            list = reportInDetailPR.listRecord(param);
+            List<InoutRecordInExport> exportList = new ArrayList<>();
+            for (InoutRecord record : list) {
+                InoutRecordInExport export = new InoutRecordInExport();
+                export.setId(record.getId());
+                export.setPlateNum(record.getPlateNum());
+                // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
+                String depotNameValue = depotMap.get(record.getDepotId());
+                export.setDepotId(depotNameValue != null ? depotNameValue : "");
+                //绮鍝佺鏄犲皠
+                String foodVarietyNameValue = foodVarietyMap.get(record.getFoodVariety());
+                export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
+                export.setFullWeight(record.getFullWeight());
+                export.setEmptyWeight(record.getEmptyWeight());
+                export.setNetWeight(record.getNetWeight());
+                export.setSettleWeight(record.getSettleWeight());
+                export.setRecordWeight(record.getRecordWeight());
+                export.setCompleteTime(record.getCompleteTime());
+                export.setDeOther(record.getDeOther());
+                exportList.add(export);
+            }
+            ExcelUtil<InoutRecordInExport> util = new ExcelUtil<InoutRecordInExport>(InoutRecordInExport.class);
+            return util.exportExcel(exportList, sheetName, deptName);
+        }
+
+        if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) {
+            sheetName = "鍑哄簱鎶ヨ〃鏁版嵁";
+            list = reportOutDetailPR.listRecord(param);
+            List<InoutRecordOutExport> exportList = new ArrayList<>();
+            for (InoutRecord record : list) {
+                InoutRecordOutExport export = new InoutRecordOutExport();
+                export.setId(record.getId());
+                export.setPlateNum(record.getPlateNum());
+                // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
+                String depotNameValue = depotMap.get(record.getDepotId());
+                export.setDepotId(depotNameValue != null ? depotNameValue : "");
+                //绮鍝佺鏄犲皠
+                String foodVarietyNameValue = foodVarietyMap.get(record.getFoodVariety());
+                export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
+                export.setFullWeight(record.getFullWeight());
+                export.setEmptyWeight(record.getEmptyWeight());
+                export.setNetWeight(record.getNetWeight());
+                export.setSettleWeight(record.getSettleWeight());
+                export.setRecordWeight(record.getRecordWeight());
+                export.setCompleteTime(record.getCompleteTime());
+                export.setDeOther(record.getDeOther());
+                exportList.add(export);
+            }
+            ExcelUtil<InoutRecordOutExport> util = new ExcelUtil<InoutRecordOutExport>(InoutRecordOutExport.class);
+            return util.exportExcel(exportList, sheetName, deptName);
+        }
+
+        if (StringUtils.isNotEmpty(param.getType()) && "IN_DETAIL".equals(param.getType())) {
+            sheetName = "鍏ュ簱鏄庣粏鎶ヨ〃鏁版嵁";
+            list = reportInDetailPR.listRecord(param);
+            List<InoutRecordDetailInExport> exportList = new ArrayList<>();
+            for (InoutRecord record : list) {
+                InoutRecordDetailInExport export = new InoutRecordDetailInExport();
+                //鏀跺偍鍏徃鏄犲皠
+                String companyNameValue = companyMap.get(record.getCompanyId());
+                export.setCompanyId(companyNameValue != null ? companyNameValue : "");
+                //搴撳尯鏄犲皠
+                String deptNameValue = deptMap.get(record.getDeptId());
+                export.setDeptId(deptNameValue != null ? deptNameValue : "");
+                export.setId(record.getId());
+                export.setPlateNum(record.getPlateNum());
+                // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
+                String depotNameValue = depotMap.get(record.getDepotId());
+                export.setDepotId(depotNameValue != null ? depotNameValue : "");
+                //绮鍝佺鏄犲皠
+                String foodVarietyNameValue = foodVarietyMap.get(record.getFoodVariety());
+                export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
+                export.setSettleWeight(record.getSettleWeight());
+                export.setRecordWeight(record.getRecordWeight());
+                export.setCompleteTime(record.getCompleteTime());
+                exportList.add(export);
+            }
+            ExcelUtil<InoutRecordDetailInExport> util = new ExcelUtil<InoutRecordDetailInExport>(InoutRecordDetailInExport.class);
+            return util.exportExcel(exportList, sheetName, deptName);
+        }
+
+        if (StringUtils.isNotEmpty(param.getType()) && "OUT_DETAIL".equals(param.getType())) {
+            sheetName = "鍑哄簱鏄庣粏鎶ヨ〃鏁版嵁";
+            list = reportOutDetailPR.listRecord(param);
+            List<InoutRecordDetailOutExport> exportList = new ArrayList<>();
+            for (InoutRecord record : list) {
+                InoutRecordDetailOutExport export = new InoutRecordDetailOutExport();
+                //鏀跺偍鍏徃鏄犲皠
+                String companyNameValue = companyMap.get(record.getCompanyId());
+                export.setCompanyId(companyNameValue != null ? companyNameValue : "");
+                //搴撳尯鏄犲皠
+                String deptNameValue = deptMap.get(record.getDeptId());
+                export.setDeptId(deptNameValue != null ? deptNameValue : "");
+                export.setId(record.getId());
+                export.setPlateNum(record.getPlateNum());
+                // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
+                String depotNameValue = depotMap.get(record.getDepotId());
+                export.setDepotId(depotNameValue != null ? depotNameValue : "");
+                //绮鍝佺鏄犲皠
+                String foodVarietyNameValue = foodVarietyMap.get(record.getFoodVariety());
+                export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
+                export.setSettleWeight(record.getSettleWeight());
+                export.setRecordWeight(record.getRecordWeight());
+                export.setCompleteTime(record.getCompleteTime());
+                exportList.add(export);
+            }
+            ExcelUtil<InoutRecordDetailOutExport> util = new ExcelUtil<InoutRecordDetailOutExport>(InoutRecordDetailOutExport.class);
+            return util.exportExcel(exportList, sheetName, deptName);
+        }
+        return AjaxResult.error("鍙傛暟閿欒");
+    }
+
+
+    /**
+     * 搴撳瓨鎶ヨ〃瀵煎嚭
+     *
+     * @return
+     */
+    @RequestMapping("/superInventoryReport-excel")
+    @ResponseBody
+    public AjaxResult superInventoryReport(SuperInventoryReportParam param) {
+        //璁剧疆鏍囬
+        String sheetName = "搴撳瓨鎶ヨ〃鏁版嵁";
+        //鏌ヨ鏁版嵁
+        List<SuperInventoryReportData> list = superInventoryReportPR.getReportData(param);
         //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
         String deptName = "";
         SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
@@ -63,7 +243,7 @@
         }
 
         //瀵煎嚭
-        ExcelUtil<InoutRecord> util = new ExcelUtil<InoutRecord>(InoutRecord.class);
+        ExcelUtil<SuperInventoryReportData> util = new ExcelUtil<SuperInventoryReportData>(SuperInventoryReportData.class);
         return util.exportExcel(list, sheetName, deptName);
     }
 

--
Gitblit v1.9.3