Jelajahi Sumber

项目批次整改

wangming 1 tahun lalu
induk
melakukan
30531a0d0c

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

@@ -13,4 +13,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ZhcxProjectManageRectifyBatchService extends IService<ZhcxProjectManageRectifyBatchDo> {
 
+    /**
+     * 生成批次整改清单
+     *
+     * @param batchId
+     * @return
+     */
+    String genProjectSummaryFiles(String batchId);
 }

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

@@ -1,9 +1,14 @@
 package com.rongwei.bscommon.sys.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.rongwei.bscommon.sys.feign.LuckySheetService;
+import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.rongwei.bsentity.domain.ZhcxProjectManageRectifyBatchDo;
 import com.rongwei.bscommon.sys.dao.ZhcxProjectManageRectifyBatchDao;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageRectifyBatchService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bsentity.dto.project.ProjectSummaryParamExcelDto;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +22,33 @@ import org.springframework.stereotype.Service;
 @Service
 public class ZhcxProjectManageRectifyBatchServiceImpl extends ServiceImpl<ZhcxProjectManageRectifyBatchDao, ZhcxProjectManageRectifyBatchDo> implements ZhcxProjectManageRectifyBatchService {
 
+    @Autowired
+    private LuckySheetService luckySheetService;
+
+    @Autowired
+    private ZhcxProjectManageService projectManageService;
+
+    /**
+     * 生成批次整改清单
+     *
+     * @param batchId
+     * @return
+     */
+    @Override
+    public String genProjectSummaryFiles(String batchId) {
+
+        ZhcxProjectManageRectifyBatchDo batchDo = getById(batchId);
+
+        //组装汇总文件参数
+        ProjectSummaryParamExcelDto paramExcelDto = projectManageService.assembleProjectSummaryParam(batchDo.getProjectid());
+        JSONObject lssResult = luckySheetService.genLuckysheetExcel(paramExcelDto);
+        String listId = lssResult.getString("data");
+
+        ZhcxProjectManageRectifyBatchDo entity = new ZhcxProjectManageRectifyBatchDo();
+        entity.setId(batchId);
+        entity.setSummaryfiles(listId);
+        updateById(entity);
+
+        return listId;
+    }
 }

+ 20 - 11
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxProjectManageController.java

@@ -1,12 +1,11 @@
 package com.rongwei.bsserver.controller;
 
 
-import cn.hutool.core.util.ObjectUtil;
-import com.rongwei.bscommon.sys.config.api.ResponseVO;
-import com.rongwei.bscommon.sys.feign.LuckySheetService;
 import com.rongwei.bscommon.sys.service.LuckysheetService;
+import com.rongwei.bscommon.sys.service.ZhcxProjectManageRectifyBatchService;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
+import com.rongwei.bsentity.domain.ZhcxProjectManageRectifyBatchDo;
 import com.rongwei.bsentity.dto.project.ExportProjectSummaryDto;
 import com.rongwei.bsentity.dto.project.SavePorjectSummaryDto;
 import com.rongwei.bsentity.dto.project.UpdateDataVerificationRequest;
@@ -43,21 +42,31 @@ public class ZhcxProjectManageController {
 
     @Autowired
     private LuckysheetService luckysheetService;
+
+    @Autowired
+    private ZhcxProjectManageRectifyBatchService projectManageRectifyBatchService;
     /**
-     * 复制新增
+     * 生成整改清单
      * @param projectManageDo
      * @return
      */
     @PostMapping("/genSummaryFiles")
     @ApiOperation("生成汇总文件")
     public R genSummaryFiles(@RequestBody ZhcxProjectManageDo projectManageDo){
-        try {
-            String files = luckysheetService.genProjectSummaryFiles(projectManageDo.getId());
-            return R.ok(files);
-        } catch (Exception e) {
-            log.error("生成异常, {}", e);
-            return R.error("生成异常!");
-        }
+        String files = luckysheetService.genProjectSummaryFiles(projectManageDo.getId());
+        return R.ok(files);
+    }
+
+    /**
+     * 生成整改清单
+     * @param batch
+     * @return
+     */
+    @PostMapping("/genBatchSummaryFiles")
+    @ApiOperation("生成批次汇总文件")
+    public R genBatchSummaryFiles(@RequestBody ZhcxProjectManageRectifyBatchDo batch){
+        String files = projectManageRectifyBatchService.genProjectSummaryFiles(batch.getId());
+        return R.ok(files);
     }
 
     /**