From 71fe4f1f6a75c86640a726b9c230e8aaae2a28e7 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期二, 07 四月 2026 16:19:00 +0800
Subject: [PATCH] 告警批复实体类,service

---
 fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java |  143 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 108 insertions(+), 35 deletions(-)

diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java b/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
index ac171c2..6258190 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
@@ -1,7 +1,10 @@
 package com.fzzy.common;
 
 import com.fzzy.common.manager.ExportManager;
-import com.fzzy.igds.*;
+import com.fzzy.igds.CompanyPR;
+import com.fzzy.igds.DepotPR;
+import com.fzzy.igds.DeptPR;
+import com.fzzy.igds.ReportInoutPR;
 import com.fzzy.igds.constant.FoodVariety;
 import com.fzzy.igds.data.*;
 import com.fzzy.igds.domain.Company;
@@ -19,16 +22,15 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
+import java.text.DecimalFormat;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- * @Description  鏁版嵁瀵煎嚭鍏ュ彛
+ * @Description 鏁版嵁瀵煎嚭鍏ュ彛
  * @Author CZT
  * @Date 2025/12/29 10:32
  */
@@ -69,6 +71,17 @@
     }
 
     /**
+     * 瀵煎嚭word骞朵笅杞�
+     *
+     * @param response
+     */
+    @RequestMapping("/download-inout-excel")
+    public void downloadInoutExcel(HttpServletResponse response) {
+
+        exportManager.downloadInoutExcel(response);
+    }
+
+    /**
      * PDF鍦ㄧ嚎棰勮
      *
      * @param response
@@ -89,6 +102,7 @@
 
     /**
      * 鍑哄叆搴撴姤琛ㄥ鍑�
+     *
      * @return
      */
     @RequestMapping("/inout-excel")
@@ -100,10 +114,29 @@
         List<InoutRecord> list = new ArrayList<>();
         //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
         String deptName = "";
-        SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
+        String deptId= ContextUtil.subDeptId(null);
+        if (StringUtils.isNotBlank(param.getDeptId())){
+            deptId=param.getDeptId();
+        }
+        SysDept subDept = sysDeptService.getCacheDept(null,deptId);
         if (null != subDept) {
             deptName = subDept.getDeptName();
         }
+
+
+        String exportTimeDesc = "";
+        String exportCreateUser = "";
+        Date exportCreateTime = new Date();
+        if (StringUtils.isNotEmpty(param.getTimeDesc())) {
+            exportTimeDesc = param.getTimeDesc();
+        }
+        if (StringUtils.isNotEmpty(param.getCreateUser())) {
+            exportCreateUser = param.getCreateUser();
+        }
+        if (param.getCreateTime() != null) {
+            exportCreateTime = param.getCreateTime();
+        }
+
         //鍒涘缓鏀跺偍鍏徃ID鍒板悕绉扮殑鏄犲皠
         Map<String, String> companyMap = Optional.ofNullable(companyPR.getData())
                 .orElse(new ArrayList<>())
@@ -115,18 +148,19 @@
                 .stream()
                 .collect(Collectors.toMap(Dept::getId, Dept::getKqmc, (key1, key2) -> key2));
         // 鍒涘缓浠撳簱ID鍒板悕绉扮殑鏄犲皠
-        Map<String, String> depotMap = Optional.ofNullable(depotPR.getData(null))
+        Map<String, String> depotMap = Optional.ofNullable(depotPR.getData(ContextUtil.getCompanyId()))
                 .orElse(new ArrayList<>())
                 .stream()
                 .collect(Collectors.toMap(Depot::getId, Depot::getName, (key1, key2) -> key2));
-
+        DecimalFormat df = new DecimalFormat("0.00");
         //缁勮瀹為檯瀵煎嚭鏁版嵁
         if (StringUtils.isNotEmpty(param.getType()) && "IN".equals(param.getType())) {
             sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
             list = reportInoutPR.listRecord(param);
             List<InoutRecordInExport> exportList = new ArrayList<>();
+            InoutRecordInExport export;
             for (InoutRecord record : list) {
-                InoutRecordInExport export = new InoutRecordInExport();
+                export = new InoutRecordInExport();
                 export.setId(record.getId());
                 export.setPlateNum(record.getPlateNum());
                 // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
@@ -135,25 +169,27 @@
                 //绮鍝佺鏄犲皠
                 String foodVarietyNameValue = FoodVariety.getMsg(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.setFullWeight(df.format(record.getFullWeight()) + "KG");
+                export.setEmptyWeight(df.format(record.getEmptyWeight()) + "KG");
+                export.setNetWeight(df.format(record.getNetWeight()) + "KG");
+                export.setSettleWeight(df.format(record.getSettleWeight()) + "KG");
+                export.setRecordWeight(df.format(record.getRecordWeight()) + "KG");
                 export.setCompleteTime(record.getCompleteTime());
-                export.setDeOther(record.getDeOther());
+                export.setDeOther(df.format(record.getDeOther()) + "KG");
+                export.setUpdateLog(record.getUpdateLog());
                 exportList.add(export);
             }
             ExcelUtil<InoutRecordInExport> util = new ExcelUtil<InoutRecordInExport>(InoutRecordInExport.class);
-            return util.exportExcel(exportList, sheetName, deptName);
+            return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime);
         }
 
         if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) {
             sheetName = "鍑哄簱鎶ヨ〃鏁版嵁";
             list = reportInoutPR.listRecord(param);
             List<InoutRecordOutExport> exportList = new ArrayList<>();
+            InoutRecordOutExport export;
             for (InoutRecord record : list) {
-                InoutRecordOutExport export = new InoutRecordOutExport();
+                export = new InoutRecordOutExport();
                 export.setId(record.getId());
                 export.setPlateNum(record.getPlateNum());
                 // 灏嗕粨搴揑D鏄犲皠涓轰粨搴撳悕绉�
@@ -162,25 +198,28 @@
                 //绮鍝佺鏄犲皠
                 String foodVarietyNameValue = FoodVariety.getMsg(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.setFullWeight(df.format(record.getFullWeight()) + "KG");
+                export.setEmptyWeight(df.format(record.getEmptyWeight()) + "KG");
+                export.setNetWeight(df.format(record.getNetWeight()) + "KG");
+                export.setSettleWeight(df.format(record.getSettleWeight()) + "KG");
+                export.setRecordWeight(df.format(record.getRecordWeight()) + "KG");
                 export.setCompleteTime(record.getCompleteTime());
-                export.setDeOther(record.getDeOther());
+                export.setDeOther(df.format(record.getDeOther()) + "KG");
+                export.setUpdateLog(record.getUpdateLog());
                 exportList.add(export);
             }
             ExcelUtil<InoutRecordOutExport> util = new ExcelUtil<InoutRecordOutExport>(InoutRecordOutExport.class);
-            return util.exportExcel(exportList, sheetName, deptName);
+            return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime);
         }
 
         if (StringUtils.isNotEmpty(param.getType()) && "IN_DETAIL".equals(param.getType())) {
             sheetName = "鍏ュ簱鏄庣粏鎶ヨ〃鏁版嵁";
+            param.setType("IN");
             list = reportInoutPR.listRecord(param);
             List<InoutRecordDetailInExport> exportList = new ArrayList<>();
+            InoutRecordDetailInExport export;
             for (InoutRecord record : list) {
-                InoutRecordDetailInExport export = new InoutRecordDetailInExport();
+                export = new InoutRecordDetailInExport();
                 //鏀跺偍鍏徃鏄犲皠
                 String companyNameValue = companyMap.get(record.getCompanyId());
                 export.setCompanyId(companyNameValue != null ? companyNameValue : "");
@@ -195,21 +234,24 @@
                 //绮鍝佺鏄犲皠
                 String foodVarietyNameValue = FoodVariety.getMsg(record.getFoodVariety());
                 export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
-                export.setSettleWeight(record.getSettleWeight());
-                export.setRecordWeight(record.getRecordWeight());
+                export.setSettleWeight(df.format(record.getSettleWeight()) + "KG");
+                export.setRecordWeight(df.format(record.getRecordWeight()) + "KG");
                 export.setCompleteTime(record.getCompleteTime());
+                export.setUpdateLog(record.getUpdateLog());
                 exportList.add(export);
             }
             ExcelUtil<InoutRecordDetailInExport> util = new ExcelUtil<InoutRecordDetailInExport>(InoutRecordDetailInExport.class);
-            return util.exportExcel(exportList, sheetName, deptName);
+            return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime);
         }
 
         if (StringUtils.isNotEmpty(param.getType()) && "OUT_DETAIL".equals(param.getType())) {
             sheetName = "鍑哄簱鏄庣粏鎶ヨ〃鏁版嵁";
+            param.setType("OUT");
             list = reportInoutPR.listRecord(param);
             List<InoutRecordDetailOutExport> exportList = new ArrayList<>();
+            InoutRecordDetailOutExport export;
             for (InoutRecord record : list) {
-                InoutRecordDetailOutExport export = new InoutRecordDetailOutExport();
+                export = new InoutRecordDetailOutExport();
                 //鏀跺偍鍏徃鏄犲皠
                 String companyNameValue = companyMap.get(record.getCompanyId());
                 export.setCompanyId(companyNameValue != null ? companyNameValue : "");
@@ -224,19 +266,21 @@
                 //绮鍝佺鏄犲皠
                 String foodVarietyNameValue = FoodVariety.getMsg(record.getFoodVariety());
                 export.setFoodVariety(foodVarietyNameValue != null ? foodVarietyNameValue : "");
-                export.setSettleWeight(record.getSettleWeight());
-                export.setRecordWeight(record.getRecordWeight());
+                export.setSettleWeight(df.format(record.getSettleWeight()) + "KG");
+                export.setRecordWeight(df.format(record.getRecordWeight()) + "KG");
                 export.setCompleteTime(record.getCompleteTime());
+                export.setUpdateLog(record.getUpdateLog());
                 exportList.add(export);
             }
             ExcelUtil<InoutRecordDetailOutExport> util = new ExcelUtil<InoutRecordDetailOutExport>(InoutRecordDetailOutExport.class);
-            return util.exportExcel(exportList, sheetName, deptName);
+            return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime);
         }
         return AjaxResult.error("鍙傛暟閿欒");
     }
 
     /**
      * 搴撳瓨鎶ヨ〃瀵煎嚭
+     *
      * @return
      */
     @RequestMapping("/storage-excel")
@@ -252,10 +296,39 @@
         if (null != subDept) {
             deptName = subDept.getDeptName();
         }
+        String exportTimeDesc = "";
+        String exportCreateUser = "";
+        Date exportCreateTime = new Date();
+        if (StringUtils.isNotEmpty(param.getTimeDesc())) {
+            exportTimeDesc = param.getTimeDesc();
+        }
+        if (StringUtils.isNotEmpty(param.getCreateUser())) {
+            exportCreateUser = param.getCreateUser();
+        }
+        if (param.getCreateTime() != null) {
+            exportCreateTime = param.getCreateTime();
+        }
+        List<SuperInventoryReportExport> exportList = new ArrayList<>();
+        DecimalFormat df = new DecimalFormat("0.00");
+
+        for (SuperInventoryReportData data : list) {
+            SuperInventoryReportExport export = new SuperInventoryReportExport();
+            export.setCustomerName(data.getCustomerName());
+            export.setDeptName(data.getDeptName());
+            export.setDepotName(data.getDepotName());
+            export.setInitialWeight(df.format(data.getInitialWeight()) + "KG");
+            export.setRecordInWeight(df.format(data.getRecordInWeight()) + "KG");
+            export.setChangeInWeight(df.format(data.getChangeInWeight()) + "KG");
+            export.setRecordOutWeight(df.format(data.getRecordOutWeight()) + "KG");
+            export.setChangeOutWeight(df.format(data.getChangeOutWeight()) + "KG");
+            export.setLossWeight(df.format(data.getLossWeight()) + "KG");
+            export.setFinalWeight(df.format(data.getFinalWeight()) + "KG");
+            exportList.add(export);
+        }
 
         //瀵煎嚭
-        ExcelUtil<SuperInventoryReportData> util = new ExcelUtil<SuperInventoryReportData>(SuperInventoryReportData.class);
-        return util.exportExcel(list, sheetName, deptName);
+        ExcelUtil<SuperInventoryReportExport> util = new ExcelUtil<SuperInventoryReportExport>(SuperInventoryReportExport.class);
+        return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime);
     }
 
 }

--
Gitblit v1.9.3