sgj
2026-02-25 23ba8d87f56be44209687ee03c8bda3e351412d1
fzzy-igdss-web/src/main/java/com/fzzy/common/ExportController.java
@@ -21,6 +21,7 @@
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -130,7 +131,7 @@
                .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 = "入库报表数据";
@@ -147,13 +148,13 @@
                //粮食品种映射
                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);
            }
@@ -176,13 +177,13 @@
                //粮食品种映射
                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);
            }
@@ -192,6 +193,7 @@
        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;
@@ -211,8 +213,8 @@
                //粮食品种映射
                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);
@@ -223,6 +225,7 @@
        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;
@@ -242,8 +245,8 @@
                //粮食品种映射
                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);
@@ -271,10 +274,27 @@
        if (null != subDept) {
            deptName = subDept.getDeptName();
        }
        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);
    }
}