Pārlūkot izejas kodu

luckeysheet集成

wangming 1 gadu atpakaļ
vecāks
revīzija
0e200b7a99

+ 20 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/feign/LuckySheetService.java

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.feign;
+
+import com.alibaba.fastjson.JSONObject;
+import com.rongwei.bsentity.dto.project.ProjectSummaryParamExcelDto;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient(name = "luckySheetService", url = "${luckysheet-provider.url}")
+public interface LuckySheetService {
+
+    /**
+     * 推送外部报验数据
+     *
+     * @param excelDto
+     * @return
+     */
+    @PostMapping("luckysheet/api/genLuckysheetExcel")
+    JSONObject genLuckysheetExcel(@RequestBody ProjectSummaryParamExcelDto excelDto);
+}

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

@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.rongwei.bscommon.sys.feign.LuckySheetService;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.rongwei.bscommon.sys.utils.LuckySheet4SummaryHelp;
 import com.rongwei.bsentity.domain.LuckysheetDo;
@@ -42,6 +43,9 @@ public class LuckysheetServiceImpl extends ServiceImpl<LuckysheetDao, Luckysheet
     @Resource(name = "snowFlake")
     protected SnowFlake snowFlake;
 
+    @Autowired
+    private LuckySheetService luckySheetService;
+
     /**
      * 生成项目汇总文件
      *
@@ -58,7 +62,10 @@ public class LuckysheetServiceImpl extends ServiceImpl<LuckysheetDao, Luckysheet
         ProjectSummaryParamExcelDto paramExcelDto = projectManageService.assembleProjectSummaryParam(project);
 
         //生成excel
-        String listId = genLuckysheetObj(paramExcelDto);
+//        String listId = genLuckysheetObj(paramExcelDto);
+
+        JSONObject lssResult = luckySheetService.genLuckysheetExcel(paramExcelDto);
+        String listId = lssResult.getString("data");
 
         ZhcxProjectManageDo projectEntity = new ZhcxProjectManageDo();
         projectEntity.setId(projectId);

+ 12 - 1
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxProjectManageController.java

@@ -6,8 +6,10 @@ 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.rwcommon.base.exception.CustomException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -27,6 +29,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/zhcxProjectManage")
 @Api(tags = "项目管理")
+@Slf4j
 public class ZhcxProjectManageController {
 
     @Autowired
@@ -55,7 +58,15 @@ public class ZhcxProjectManageController {
     @PostMapping("/saveSummaryData")
     @ApiOperation("保存汇总文件数据")
     public R saveSummaryData(@RequestBody SavePorjectSummaryDto dto) {
-        service.saveSummaryData(dto);
+        try {
+            service.saveSummaryData(dto);
+        } catch (CustomException e) {
+            log.error("保存自定义异常", e);
+            R.error("保存异常");
+        } catch (Exception e) {
+            log.error("保存异常", e);
+            return R.error("保存异常");
+        }
         return R.ok();
     }
 

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

@@ -107,6 +107,11 @@ wz-provider:
   url: http://61.177.40.178:5500/api
   syncWzDataUrl: ${wz-provider.url}//PersistentDisease/detailedList/syncByData
 
+#luckysheet
+luckysheet-provider:
+  url: http://127.0.0.1:9004
+
+
 sso:
   appid: ZPMCZLBY
   grantType: authorization_code