Explorar el Código

Merge remote-tracking branch 'origin/master' into master

yangyj hace 2 años
padre
commit
cb50ebfd2a

+ 5 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -5,11 +5,9 @@ import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.tool.api.R;
-import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.service.IWbsTreeContractService;
-import org.springblade.manager.vo.WbsTreeContractVO;
 import org.springblade.manager.vo.WbsTreeContractVO4;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -60,8 +58,11 @@ public class WbsTreeContractController extends BladeController {
             @ApiImplicitParam(name = "isSplicingNumber", value = "是否拼接划分编号", required = true)
     })
     public R<WbsTreeContractVO4> importWbsContract(@RequestPart("file") MultipartFile file, @RequestParam("contractId") String contractId, @RequestParam("type") Integer type, @RequestParam("isSplicingNumber") Integer isSplicingNumber) throws IOException {
-        WbsTreeContractVO4 list = iWbsTreeContractService.importWbsContract(file, contractId, type, isSplicingNumber);
-        return R.data(list);
+        WbsTreeContractVO4 data = iWbsTreeContractService.importWbsContract(file, contractId, type, isSplicingNumber);
+        if (data != null) {
+            return R.data(data);
+        }
+        return R.fail(400, "从excel模板中未能找到对应的工程类别数据,解析失败,请重试!");
     }
 
     @PostMapping("/import-relation")

+ 7 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -386,7 +386,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 if (resultNow.size() <= 0) {
                     throw new ServiceException("请选择一个工程类别进行匹配导入");
                 }
-
                 //匹配对应工程类别修改对应合同段节点名称
                 return this.updateContractNodeNames(resultNow, contractId, isSplicingNumber);
             }
@@ -454,7 +453,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         //获取当前合同段树
         List<WbsTreeContractVO> wbsTreeContractVOS = contractInfoMapper.tree2(null, null, contractId, null, null);
         if (wbsTreeContractVOS.size() <= 0) {
-            throw new ServiceException("请从项目级中分配合同段wbs划分模板");
+            throw new ServiceException("未查询到当前合同段的wbs树,请先配置该合同的合同段wsb树");
         }
 
         //构造resultList
@@ -466,7 +465,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                 String v1 = value1.replaceAll(str, "");
                 map.forEach((k2, value2) -> {
                     String v2 = value2.replaceAll(str, "");
-
                     if ("1".equals(k1) && "2".equals(k2)) {
                         maps.put(1, v1 + ":::" + v2);
                     } else if ("3".equals(k1) && "4".equals(k2)) {
@@ -516,16 +514,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                     } else if ("9".equals(k1) && "10".equals(k2)) {
                         String s4 = "";
-                        if (StringUtils.isNotEmpty(v2)) {
-                            String s = maps.get(4);
-                            if (isSplicingNumber == 1) {
+                        if (isSplicingNumber == 1) {
+                            if (StringUtils.isNotEmpty(v2)) {
+                                String s = maps.get(4);
                                 if (StringUtils.isEmpty(s.replaceAll(":::", ""))) {
                                     s = maps.get(3);
                                     if (StringUtils.isEmpty(s.replaceAll(":::", ""))) {
                                         s = maps.get(2);
-                                    }
-                                    if (StringUtils.isEmpty(s.replaceAll(":::", ""))) {
-                                        s = maps.get(1);
+                                        if (StringUtils.isEmpty(s.replaceAll(":::", ""))) {
+                                            s = maps.get(1);
+                                        }
                                     }
                                 }
                                 if (StringUtils.isNotEmpty(s.replaceAll(":::", ""))) {