Browse Source

整改清单保存

wangming 8 tháng trước cách đây
mục cha
commit
9bf28aaf90

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

@@ -61,6 +61,13 @@ public interface ZhcxProjectManageService extends IService<ZhcxProjectManageDo>
      */
     void saveSummaryData(String batchId);
 
+    /**
+     * 保存汇总数据
+     *
+     * @param dto
+     */
+    void saveSummaryDataByDto(SavePorjectSummaryDto dto);
+
     R getRectifyReportData(Map<String, Object> map);
 
     int exportRectifyReportData(Map<String, Object> map, HttpServletResponse response);

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

@@ -3,10 +3,14 @@ package com.rongwei.bscommon.sys.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.aspose.cells.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -26,6 +30,7 @@ import com.rongwei.bsentity.vo.ZhcxProjectRectifyMachineVo;
 import com.rongwei.bsentity.vo.ZhcxProjectRectifyVo;
 import com.rongwei.rwcommon.base.R;
 import com.rongwei.rwcommon.base.exception.CustomException;
+import com.rongwei.rwcommon.utils.JSONUtils;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommon.utils.StringUtils;
 import com.rongwei.rwcommoncomponent.excel.aspose.ExcelUtils;
@@ -35,6 +40,7 @@ import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
@@ -91,6 +97,9 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
     @Autowired
     private ZhcxProjectRectifySnapService zhcxProjectRectifySnapService;
 
+    @Value("${file.writeRootPath}")
+    private String writeRootPath;
+
 
     private static final Color[] COLORS = {Color.fromArgb(255, 255, 204),
             Color.fromArgb(210, 242, 210),
@@ -206,6 +215,10 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
 
         ZhcxProjectManageRectifyBatchDo batchDo = projectManageRectifyBatchService.getById(batchId);
 
+//        String fileName = batchId.concat(".json");
+//        String jsonString = FileUtil.readUtf8String(writeRootPath.concat(File.separator).concat(fileName));
+//        List<JSONObject> sheetList = new ArrayList<>();
+//        sheetList.add(JSON.parseObject(jsonString));
         List<JSONObject> sheetList = luckySheetFeignService.getExcelJson(batchDo.getSummaryfiles());
 
         SavePorjectSummaryDto summaryDto = SavePorjectSummaryDto.builder()
@@ -217,6 +230,31 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
         saveSummaryData(summaryDto);
     }
 
+    /**
+     * 保存汇总数据
+     *
+     * @param dto
+     */
+    @Override
+    public void saveSummaryDataByDto(SavePorjectSummaryDto dto) {
+        ZhcxProjectManageRectifyBatchDo batchDo = projectManageRectifyBatchService.getById(dto.getBatchId());
+
+        String fileName = dto.getListId().concat(".json");
+
+        String jsonString = FileUtil.readUtf8String(writeRootPath.concat(File.separator).concat(fileName));
+        List<JSONObject> sheetList = new ArrayList<>();
+        sheetList.add(JSON.parseObject(jsonString));
+//        List<JSONObject> sheetList = luckySheetFeignService.getExcelJson(batchDo.getSummaryfiles());
+
+        SavePorjectSummaryDto summaryDto = SavePorjectSummaryDto.builder()
+                .batchId(dto.getBatchId())
+                .projectId(batchDo.getProjectid())
+                .sheetList(sheetList)
+                .build();
+
+        saveSummaryData(summaryDto);
+    }
+
     @Override
     public R getRectifyReportData(Map<String, Object> map) {
         Object projectIdObj = map.get("projectId");

+ 1 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/utils/XlsSheetUtil.java

@@ -810,7 +810,7 @@ public class XlsSheetUtil {
                     }
                     case "n":{
                         //数值
-                        cell.setCellType(CellType.NUMERIC);
+//                        cell.setCellType(CellType.NUMERIC);
                         if(_i>=0){
                             style.setDataFormat(_i.shortValue());
                         }else{

+ 5 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/SavePorjectSummaryDto.java

@@ -22,6 +22,11 @@ public class SavePorjectSummaryDto {
      */
     private String projectId;
 
+    /**
+     *
+     */
+    private String listId;
+
     /**
      * excel数据
      */

+ 13 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxProjectManageController.java

@@ -98,6 +98,19 @@ public class ZhcxProjectManageController {
         return R.ok();
     }
 
+    /**
+     * 保存汇总文件数据
+     *
+     * @param dto
+     * @return
+     */
+    @PostMapping("/saveSummaryDataByDto")
+    @ApiOperation("保存汇总文件数据")
+    public R saveSummaryDataByDto(@RequestBody SavePorjectSummaryDto dto) {
+        service.saveSummaryDataByDto(dto);
+        return R.ok();
+    }
+
     /**
      * 更新excel下拉框
      *

+ 3 - 1
business-server/src/main/resources/bootstrap.yml

@@ -119,4 +119,6 @@ redis.channel: luckysheet.channel
 row_size: 100
 col_size: 100
 #使用服务器类型
-servertype: tomcat
+servertype: tomcat
+
+file.writeRootPath: D:/rectifyFile