Sfoglia il codice sorgente

整改数据保存

wangming 1 anno fa
parent
commit
a90590fb7a

+ 8 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectDeviceNumberService.java

@@ -22,4 +22,12 @@ public interface ZhcxProjectDeviceNumberService extends IService<ZhcxProjectDevi
      * @return
      */
     List<String> getDeviceNumberByProjectId(String projectId);
+
+    /**
+     * 获取机号对象
+     *
+     * @param projectId
+     * @return
+     */
+    List<ZhcxProjectDeviceNumberDo> getByProjectId(String projectId);
 }

+ 8 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectManageService.java

@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service;
 import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.rongwei.bsentity.dto.project.ProjectSummaryParamExcelDto;
+import com.rongwei.bsentity.dto.project.SavePorjectSummaryDto;
 import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 
 /**
@@ -29,4 +30,11 @@ public interface ZhcxProjectManageService extends IService<ZhcxProjectManageDo>
      * @return
      */
     ProjectSummaryParamExcelDto assembleProjectSummaryParam(ZhcxProjectManageDo manageDo);
+
+    /**
+     * 保存汇总数据
+     *
+     * @param dto
+     */
+    void saveSummaryData(SavePorjectSummaryDto dto);
 }

+ 6 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectRectifyService.java

@@ -13,4 +13,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ZhcxProjectRectifyService extends IService<ZhcxProjectRectifyDo> {
 
+    /**
+     * 通过项目id删除历史数据
+     *
+     * @param prjId
+     */
+    void delByPrjId(String prjId);
 }

+ 13 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectDeviceNumberServiceImpl.java

@@ -32,6 +32,18 @@ public class ZhcxProjectDeviceNumberServiceImpl extends ServiceImpl<ZhcxProjectD
      */
     @Override
     public List<String> getDeviceNumberByProjectId(String projectId) {
+        List<ZhcxProjectDeviceNumberDo> list = getByProjectId(projectId);
+        return list.stream().map(item -> item.getDeviceNumber()).collect(Collectors.toList());
+    }
+
+    /**
+     * 获取机号对象
+     *
+     * @param projectId
+     * @return
+     */
+    @Override
+    public List<ZhcxProjectDeviceNumberDo> getByProjectId(String projectId) {
         LambdaQueryWrapper<ZhcxProjectDeviceNumberDo> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(ZhcxProjectDeviceNumberDo::getPid, projectId).eq(ZhcxProjectDeviceNumberDo::getDeleted, "0");
         List<ZhcxProjectDeviceNumberDo> list = list(queryWrapper);
@@ -43,6 +55,6 @@ public class ZhcxProjectDeviceNumberServiceImpl extends ServiceImpl<ZhcxProjectD
             int sort2Int = Integer.parseInt(sort2.getDeviceNumber().replace("#", ""));
             return sort1Int - sort2Int;
         });
-        return list.stream().map(item -> item.getDeviceNumber()).collect(Collectors.toList());
+        return list;
     }
 }

+ 429 - 9
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectManageServiceImpl.java

@@ -1,28 +1,36 @@
 package com.rongwei.bscommon.sys.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aspose.cells.*;
 import com.rongwei.bscommon.sys.dao.LuckysheetDao;
-import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodesService;
-import com.rongwei.bscommon.sys.service.ZhcxProjectDeviceNumberService;
+import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ProjectSummaryExcelHelp;
+import com.rongwei.bsentity.domain.ZhcxProjectDeviceNumberDo;
 import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
 import com.rongwei.bscommon.sys.dao.ZhcxProjectManageDao;
-import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.rongwei.bsentity.dto.project.CellChangeInfoDto;
-import com.rongwei.bsentity.dto.project.ProjectSummaryParamExcelDto;
-import com.rongwei.bsentity.dto.project.WorksheetSummaryDto;
+import com.rongwei.bsentity.domain.ZhcxProjectRectifyDo;
+import com.rongwei.bsentity.domain.ZhcxProjectRectifyMachineDo;
+import com.rongwei.bsentity.dto.project.*;
 import com.rongwei.rwcommon.base.exception.CustomException;
+import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommoncomponent.excel.aspose.ExcelUtils;
 import com.rongwei.rwcommoncomponent.file.dto.SysFileItemParamDto;
 import com.rongwei.rwcommoncomponent.file.service.SysFileItemService;
 import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -33,6 +41,7 @@ import java.util.List;
  * @since 2024-06-28
  */
 @Service
+@Slf4j
 public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageDao, ZhcxProjectManageDo> implements ZhcxProjectManageService {
 
     @Autowired
@@ -46,7 +55,13 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
     private ZhcxItpProjectNodesService itpProjectNodesService;
 
     @Autowired
-    private LuckysheetDao dao;
+    private LuckysheetDao luckysheetDao;
+
+    @Autowired
+    private ZhcxProjectRectifyService projectRectifyService;
+
+    @Autowired
+    private ZhcxProjectRectifyMachineService projectRectifyMachineService;
 
     /**
      * 生成汇总文件
@@ -99,6 +114,411 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
         return excelDto;
     }
 
+    /**
+     * 保存汇总数据
+     *
+     * @param dto
+     */
+    @Override
+    public void saveSummaryData(SavePorjectSummaryDto dto) {
+
+        //单元格数据
+        JSONArray celldatas = dto.getSheetList().get(0).getJSONArray("celldata");
+        //标题
+        JSONObject prjTitle = getPrjTitle(celldatas);
+
+        //保存参数
+        SaveSummaryDataBo summaryDataBo = assembleSaveSummaryDataParam(dto);
+
+        //持久化
+        saveSummaryData2Db(prjTitle, celldatas, summaryDataBo);
+    }
+
+    /**
+     * 持久化数据
+     *
+     * @param prjTitle
+     * @param celldatas
+     * @param summaryDataBo
+     */
+    private void saveSummaryData2Db(JSONObject prjTitle, JSONArray celldatas, SaveSummaryDataBo summaryDataBo) {
+
+        //1、删除已存在数据
+        projectRectifyService.delByPrjId(summaryDataBo.getProject().getId());
+
+        //2、组装数据并保存
+        //解析数据
+        Map<String, JSONObject> rowMap = cellMerge2Row(prjTitle, celldatas);
+        //保存
+        saveSummaryDataByRow(rowMap, summaryDataBo);
+
+    }
+
+    /**
+     * 保存
+     *
+     * @param rowMap
+     * @param summaryDataBo
+     */
+    private void saveSummaryDataByRow(Map<String, JSONObject> rowMap, SaveSummaryDataBo summaryDataBo) {
+
+        List<ZhcxProjectRectifyDo> mainList = new ArrayList<>();
+        List<ZhcxProjectRectifyMachineDo> slaveList = new ArrayList<>();
+        for (String rowIndex : rowMap.keySet()) {
+            JSONObject row = rowMap.get(rowIndex);
+            //主表
+            ZhcxProjectRectifyDo main = new ZhcxProjectRectifyDo();
+            main.setId(SecurityUtil.getUUID());
+            main.setDeleted("0");
+            //项目
+            main.setPrjid(summaryDataBo.getProject().getId());
+            main.setPrjcode(summaryDataBo.getProject().getProjectCode());
+            main.setPrjname(summaryDataBo.getProject().getProjectEname());
+
+            main.setSeqsort(row.getString("总序号"));
+            main.setSupervisorcode(row.getString("监理编号"));
+            main.setArcposition(row.getString("部位"));
+            main.setArccontent(row.getString("内容"));
+            main.setMainstatus(row.getString("总状态"));
+            main.setReqdate(row.getDate("提出日期"));
+            main.setRequser(row.getString("提出者"));
+            main.setRectifydate(row.getDate("整改日期"));
+            main.setRemark1(row.getString("备注1"));
+            main.setRemark2(row.getString("备注2"));
+
+            mainList.add(main);
+
+            JSONObject children = row.getJSONObject("children");
+            if(ObjectUtil.isNull(children)) {
+                continue;
+            }
+
+            //从表
+            for(String machineNo : children.keySet()) {
+
+                JSONObject machineObj = children.getJSONObject(machineNo);
+
+                ZhcxProjectRectifyMachineDo machine = new ZhcxProjectRectifyMachineDo();
+                machine.setPrjid(main.getPrjid());
+                machine.setRectifyid(main.getId());
+                machine.setDeleted("0");
+
+                machine.setMachineno(machineNo);
+                ZhcxProjectDeviceNumberDo numberDo = summaryDataBo.getPrjDeviceNumMap().get(machineNo);
+                machine.setMachineid(numberDo.getId());
+
+                machine.setFinishdate(machineObj.getDate("完成日期"));
+                machine.setStatus(machineObj.getString("状态"));
+
+                Map<String, JSONObject> orgMap = summaryDataBo.getOrgMap();
+
+                //责任部门
+                String departName = machineObj.getString("施工部门");
+                if(ObjectUtil.isNotEmpty(departName)
+                        && (departName.contains(",") || departName.contains(",") || departName.contains("、"))) {
+                    String[] departNames = null;
+                    if(departName.contains(",")) {
+                        departNames = departName.split(",");
+                    } else if(departName.contains(",")) {
+                        departNames = departName.split(",");
+                    } else if(departName.contains("、")) {
+                        departNames = departName.split("、");
+                    }
+
+                    for(String departNameTemp : departNames) {
+
+                        ZhcxProjectRectifyMachineDo machineEntity = new ZhcxProjectRectifyMachineDo();
+                        BeanUtil.copyProperties(machine, machineEntity);
+
+                        JSONObject org = orgMap.get(departNameTemp);
+                        machineEntity.setDeptid(org.getString("ID"));
+                        machineEntity.setDeptname(departNameTemp);
+
+                        machineEntity.setFirstdeptid(org.getString("PID"));
+                        machineEntity.setFirstdeptname(org.getString("pshortName"));
+
+                        machineEntity.setDutydeptid(org.getString("ID"));
+                        machineEntity.setDutydeptname(departNameTemp);
+
+                        machineEntity.setId(SecurityUtil.getUUID());
+                        slaveList.add(machineEntity);
+                    }
+
+                } else {
+                    //施工部门
+                    if(ObjectUtil.isNotEmpty(departName)) {
+                        JSONObject org = orgMap.get(departName);
+                        machine.setDeptid(org.getString("ID"));
+                        machine.setDeptname(departName);
+
+                        machine.setFirstdeptid(org.getString("PID"));
+                        machine.setFirstdeptname(org.getString("pshortName"));
+                    }
+
+                    //责任部门
+                    String dutyDepartName = machineObj.getString("责任部门");
+                    if(ObjectUtil.isNotEmpty(dutyDepartName)) {
+                        JSONObject org = orgMap.get(dutyDepartName);
+                        machine.setDutydeptid(org.getString("ID"));
+                        machine.setDutydeptname(dutyDepartName);
+                    }
+
+                    machine.setId(SecurityUtil.getUUID());
+                    slaveList.add(machine);
+                }
+            }
+
+        }
+
+        if(ObjectUtil.isNotEmpty(mainList)) {
+            projectRectifyService.saveBatch(mainList);
+        }
+
+        if(ObjectUtil.isNotEmpty(slaveList)) {
+            projectRectifyMachineService.saveBatch(slaveList);
+        }
+    }
+
+    /**
+     * 解析数据
+     * {
+     * 	总序号:'6'
+     * 	部位: ''
+     * 	children: {
+     * 	   1#: {
+     * 			状态: ''
+     *              },
+     * 	   2#{
+     * 			状态: ''
+     *       }
+     * 	}
+     * }
+     *
+     * @param prjTitle
+     * @param celldatas
+     * @return
+     */
+    private Map<String, JSONObject> cellMerge2Row(JSONObject prjTitle, JSONArray celldatas) {
+        /**
+         * {
+         * 	总序号:'6'
+         * 	部位: ''
+         * 	children: {
+         * 	   1#: {
+         * 			状态: ''
+         *              },
+         * 	   2#{
+         * 			状态: ''
+         *       }
+         * 	}
+         * }
+         *
+         */
+        Map<String, JSONObject> rows = new HashMap<>();
+        //遍历数据
+        for(int m = 0, n = celldatas.size(); m < n; m++) {
+            JSONObject cellData = celldatas.getJSONObject(m);
+
+            //从第4行开始为数据行
+            //行下标
+            int rowIdnex = cellData.getIntValue("r");
+            if(rowIdnex < 3) {
+                continue;
+            }
+
+            //无值单元格不做任何处理
+            JSONObject v = cellData.getJSONObject("v");
+            if(ObjectUtil.isNull(v)) {
+                continue;
+            }
+
+            JSONObject row = rows.get(String.valueOf(rowIdnex));
+            if(ObjectUtil.isNull(row)) {
+                rows.put(String.valueOf(rowIdnex), new JSONObject());
+                row = rows.get(String.valueOf(rowIdnex));
+            }
+
+            //显示值
+            String m1 = v.getString("m");
+
+            //列下标
+            String colIndex = cellData.getString("c");
+            JSONObject titleInfo = prjTitle.getJSONObject(colIndex);
+            if("-1".equals(titleInfo.getString("parent"))) {
+                row.put(titleInfo.getString("value"), m1);
+                continue;
+            }
+
+            //机号下列表
+            JSONObject childrenRow = row.getJSONObject("children");
+            JSONObject deviceNumRow;
+            if(ObjectUtil.isNull(childrenRow)) {
+                row.put("children", new JSONObject());
+                childrenRow = row.getJSONObject("children");
+                childrenRow.put(titleInfo.getString("parent"), new JSONObject());
+            }
+
+            deviceNumRow = childrenRow.getJSONObject(titleInfo.getString("parent"));
+            if(ObjectUtil.isNull(deviceNumRow)) {
+                childrenRow.put(titleInfo.getString("parent"), new JSONObject());
+                deviceNumRow = childrenRow.getJSONObject(titleInfo.getString("parent"));
+            }
+
+            deviceNumRow.put(titleInfo.getString("value"), m1);
+        }
+
+        return rows;
+    }
+
+    /**
+     * 保存数据封装
+     *
+     * @param dto
+     * @return
+     */
+    private SaveSummaryDataBo assembleSaveSummaryDataParam(SavePorjectSummaryDto dto) {
+        //机号列表
+        List<ZhcxProjectDeviceNumberDo> deviceNumList = projectDeviceNumberService.getByProjectId(dto.getProjectId());
+        Map<String, ZhcxProjectDeviceNumberDo> deviceNumMap = new HashMap<>();
+        deviceNumList.forEach(item -> deviceNumMap.put(item.getDeviceNumber(), item));
+
+        //组织机构
+        List<JSONObject> workshopList = getWorkshop();
+        Map<String, JSONObject> workshopMap = new HashMap<>();
+        workshopList.forEach(item -> workshopMap.put(item.getString("SHORTNAME"), item));
+
+        //项目
+        ZhcxProjectManageDo project = getById(dto.getProjectId());
+
+        return SaveSummaryDataBo.builder()
+                .prjDeviceNumMap(deviceNumMap)
+                .orgMap(workshopMap)
+                .project(project)
+                .build();
+    }
+
+    /**
+     * 获取项目标题
+     * 主要遍历前三行
+     *
+     * {
+      *     单元格列下标1: {
+      *         parent: '-1',
+      *         value: '总序号'
+      *     },
+      *     单元格列下标2: {
+      *         parent: '1#',
+      *         value: '1#'
+      *     }
+      *     单元格列下标3: {
+      *         parent: '1#'
+      *     }
+      * }
+     *
+     * @param celldatas
+     * @return
+     */
+    private JSONObject getPrjTitle(JSONArray celldatas) {
+        //项目
+        JSONObject prjTitle = new JSONObject();
+
+        String[] mainCols = { "总状态","提出日期","整改期限","提出者","备注1","备注2" };
+
+        //每个单元格
+        for(int m = 0, n = celldatas.size(); m < n; m++) {
+            //单元格
+            JSONObject celdata = celldatas.getJSONObject(m);
+
+            //行下标
+            int rowIndex = celdata.getIntValue("r"); //单元格列表
+
+            //第一行为数据标题,大于3行的为数据行,其他位置处理
+            if(rowIndex > 2 || rowIndex == 0) {
+                continue;
+            }
+            //列下标
+            String colIndex = celdata.getString("c");
+            //值
+            JSONObject v = celdata.getJSONObject("v");
+
+            //第二行
+            /**
+             * 第一行封装结构
+             * {
+             *     单元格列下标1: {
+             *         parent: '-1',
+             *         value: '总序号'
+             *     },
+             *     单元格列下标2: {
+             *         parent: '1#',
+             *         value: '1#'
+             *     }
+             *     单元格列下标3: {
+             *         parent: '1#'
+             *     }
+             * }
+             *
+             */
+            if(rowIndex == 1) {
+                //显示值
+                String m1 = v.getString("m");
+                JSONObject mc = v.getJSONObject("mc");
+
+                if(ObjectUtil.isNull(m1) && ObjectUtil.isNull(mc)) {
+                    continue;
+                }
+
+                String mcc = mc.getString("c");
+                int mccs = mc.getIntValue("cs");
+
+                JSONObject titleValue = new JSONObject();
+                if(ObjectUtil.isNotEmpty(m1)) {
+                    if(mccs > 1) {
+                        titleValue.put("parent", m1);
+                    } else {
+                        titleValue.put("parent", "-1");
+                    }
+                    titleValue.put("value", m1);
+                } else {
+                    String parent = prjTitle.getJSONObject(mcc).getString("value");
+                    titleValue.put("parent", parent);
+                }
+                prjTitle.put(colIndex, titleValue);
+                continue;
+            }
+
+            //第三行标题
+            if(rowIndex == 2) {
+                //合并行
+                JSONObject mc = v.getJSONObject("mc");
+                if(ObjectUtil.isNotNull(mc)) {
+                    int mcrInt = mc.getIntValue("r");
+                    //合并行下标和当前行下标不一致,不做处理
+                    if(mcrInt != rowIndex) {
+                        continue;
+                    }
+                }
+                //显示值
+                String m1 = v.getString("m");
+
+                //最后几个主表字段处理
+                //跟第一行主表字段处理方式一致
+                if(ArrayUtil.contains(mainCols, m1)) {
+                    JSONObject titleValue = new JSONObject();
+                    titleValue.put("parent", "-1");
+                    titleValue.put("value", m1);
+
+                    prjTitle.put(colIndex, titleValue);
+                } else {
+                    //单元格数据处理
+                    prjTitle.getJSONObject(colIndex).put("value", m1);
+                }
+            }
+        }
+
+        return prjTitle;
+    }
+
     /**
      * 获取车间列表
      *
@@ -107,10 +527,10 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
     private List<JSONObject> getWorkshop() {
 
         //正常组织结构
-        List<JSONObject> workshopList = dao.getWorkshop();
+        List<JSONObject> workshopList = luckysheetDao.getWorkshop();
 
         //额外数据字典中配置
-        List<JSONObject> workshopDictList = dao.getWorkshopDict();
+        List<JSONObject> workshopDictList = luckysheetDao.getWorkshopDict();
 
         workshopList.addAll(workshopDictList);
 

+ 27 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectRectifyServiceImpl.java

@@ -1,9 +1,14 @@
 package com.rongwei.bscommon.sys.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.rongwei.bscommon.sys.service.ZhcxProjectRectifyMachineService;
 import com.rongwei.bsentity.domain.ZhcxProjectRectifyDo;
 import com.rongwei.bscommon.sys.dao.ZhcxProjectRectifyDao;
 import com.rongwei.bscommon.sys.service.ZhcxProjectRectifyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bsentity.domain.ZhcxProjectRectifyMachineDo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +22,26 @@ import org.springframework.stereotype.Service;
 @Service
 public class ZhcxProjectRectifyServiceImpl extends ServiceImpl<ZhcxProjectRectifyDao, ZhcxProjectRectifyDo> implements ZhcxProjectRectifyService {
 
+    @Autowired
+    private ZhcxProjectRectifyMachineService rectifyMachineService;
+
+    /**
+     * 通过项目id删除历史数据
+     *
+     * @param prjId
+     */
+    @Override
+    public void delByPrjId(String prjId) {
+
+        //删除明细
+        LambdaQueryWrapper<ZhcxProjectRectifyMachineDo> delWrapper = Wrappers.lambdaQuery();
+        delWrapper.eq(ZhcxProjectRectifyMachineDo::getPrjid, prjId)
+                .eq(ZhcxProjectRectifyMachineDo::getDeleted,"0");
+        rectifyMachineService.remove(delWrapper);
+
+        LambdaQueryWrapper<ZhcxProjectRectifyDo> delWrapper2 = Wrappers.lambdaQuery();
+        delWrapper2.eq(ZhcxProjectRectifyDo::getPrjid, prjId)
+                .eq(ZhcxProjectRectifyDo::getDeleted, "0");
+        remove(delWrapper2);
+    }
 }

+ 12 - 6
business-common/src/main/java/com/rongwei/bscommon/sys/utils/LuckySheet4SummaryHelp.java

@@ -182,7 +182,7 @@ public class LuckySheet4SummaryHelp {
      * @return
      */
     public static JSONArray assembleCommonCol2(int startColPosition) {
-        String[] cols = {"状态","提出日期","整改期限","提出者","备注1","备注2"};
+        String[] cols = {"状态","提出日期","整改期限","提出者","备注1","备注2"};
         return assembleSingleTitle(startColPosition, 2, cols);
     }
 
@@ -612,9 +612,9 @@ public class LuckySheet4SummaryHelp {
                 .collect(Collectors.toList());
         String departChose = StringUtils.join(departList, ",");
 
-        for(int m = 0,  n = paramExcelDto.getDeviceNumberList().size(); m <= n; m++) {
+        for(int m = 0,  n = paramExcelDto.getDeviceNumberList().size() - 1; m <= n; m++) {
             int colPos = 4 + m * 4;
-            int departColPos = 5 + 4 * m;
+//            int departColPos = 4 + 4 * m;
             for(int startRows = 3, endRows = 200; startRows < endRows; startRows++) {
 
                 //状态
@@ -631,7 +631,6 @@ public class LuckySheet4SummaryHelp {
                  * }
                  */
                 JSONObject statusObj = getNewDataVerification("OK,X,√");
-
                 result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos)), statusObj);
 
                 //部门
@@ -649,14 +648,21 @@ public class LuckySheet4SummaryHelp {
                  */
                 //施工部门
                 JSONObject departObj = getNewDataVerification(departChose);
-                result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(departColPos)), departObj);
+                result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos + 1)), departObj);
 
                 //责任部门
                 JSONObject depart2Obj = getNewDataVerification(departChose);
-                result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(departColPos + 1)), depart2Obj);
+                result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos + 2)), depart2Obj);
             }
         }
 
+        //总状态
+        int statusColIndex = 4 + paramExcelDto.getDeviceNumberList().size() * 4;
+        for(int startRows = 3, endRows = 200; startRows < endRows; startRows++) {
+            JSONObject statusObj = getNewDataVerification("OK,X,√");
+            result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(statusColIndex)), statusObj);
+        }
+
         return result;
     }
 

+ 31 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/SaveSummaryDataBo.java

@@ -0,0 +1,31 @@
+package com.rongwei.bsentity.dto.project;
+
+import com.alibaba.fastjson.JSONObject;
+import com.rongwei.bsentity.domain.ZhcxProjectDeviceNumberDo;
+import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
+import lombok.*;
+
+import java.util.Map;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class SaveSummaryDataBo {
+
+    /**
+     * key:机号,value:机号对象
+     */
+    private Map<String, ZhcxProjectDeviceNumberDo> prjDeviceNumMap;
+
+    /**
+     * 组织机构
+     */
+    private Map<String, JSONObject> orgMap;
+
+    /**
+     * 项目id
+     */
+    private ZhcxProjectManageDo project;
+}

+ 14 - 2
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxProjectManageController.java

@@ -4,9 +4,8 @@ package com.rongwei.bsserver.controller;
 import com.rongwei.bscommon.sys.service.LuckysheetService;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
+import com.rongwei.bsentity.dto.project.SavePorjectSummaryDto;
 import com.rongwei.rwcommon.base.R;
-import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
-import com.rongwei.rwcommonentity.commonservers.dto.office.SaveOfficeNotifyReq;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,5 +43,18 @@ public class ZhcxProjectManageController {
         String files = luckysheetService.genProjectSummaryFiles(projectManageDo.getId());
         return R.ok(files);
     }
+
+    /**
+     * 保存汇总文件数据
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("/saveSummaryData")
+    @ApiOperation("保存汇总文件数据")
+    public R saveSummaryData(@RequestBody SavePorjectSummaryDto dto) {
+        service.saveSummaryData(dto);
+        return R.ok();
+    }
 }
 

+ 16 - 0
business-server/src/main/resources/bootstrap.yml

@@ -106,3 +106,19 @@ bs-provider:
 wz-provider:
   url: http://61.177.40.178:5500/api
   syncWzDataUrl: ${wz-provider.url}//PersistentDisease/detailedList/syncByData
+
+sso:
+  appid: ZPMCZLBY
+  grantType: authorization_code
+  appKey: 240607094900F2Krofmj5G1iUJSXBVq
+  getTokenUrl: http://10.28.79.40:9995/websso/open/token
+  getUserInfoUrl: http://10.28.79.40:9995/websso/open/userinfo
+
+
+#redis通道名称
+redis.channel: luckysheet.channel
+#表格中块的大小,新增加时写入每一个sheet的第一个模块中
+row_size: 1500
+col_size: 1500
+#使用服务器类型
+servertype: tomcat