Преглед изворни кода

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

dongxin пре 1 година
родитељ
комит
c0538e734a

+ 31 - 2
src/main/java/com/ydtech/modules/fnc/service/contract/impl/contractServiceImpl.java

@@ -77,6 +77,14 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
             contractEntity.setContractCode(contractCode);
 //           添加关联表  供应商与合同
             List<String> supplierIdList = contractDto.getSupplierIdList();
+            //甲方名称
+            String name = this.getNameInv(contractDto.getExternalCompaniesId());
+            contractEntity.setExternalCompaniesName(name);
+
+            //乙方名称
+            String interName = this.getNameInv(contractDto.getInternalCompanyId());
+            contractEntity.setInternalCompanyName(interName);
+
             contractEntity.setContractStatus("0");
             baseMapper.insert(contractEntity);
             if (contractDto.getSupplierIdList() != null) {
@@ -90,6 +98,13 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
             BeanUtils.copyProperties(contractDto, contractEntity);
             String contractCode = this.generateCode(contractDto);
             contractEntity.setContractCode(contractCode);
+            //甲方名称
+            String name = this.getNameInv(contractDto.getExternalCompaniesId());
+            contractEntity.setExternalCompaniesName(name);
+
+            //乙方名称
+            String interName = this.getNameInv(contractDto.getInternalCompanyId());
+            contractEntity.setInternalCompanyName(interName);
             baseMapper.updateById(contractEntity);
             if (!contractDto.getSupplierIdList().isEmpty()) {
                 contractSupplierService.saveAndUpdate(contractDto.getSupplierIdList(), contractEntity.getId());
@@ -101,6 +116,13 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         }
     }
 
+    private String getNameInv(String externalCompaniesId) {
+        QueryWrapper<InvAccount> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", externalCompaniesId);
+        InvAccount exinvAccount = invAccountMapper.selectOne(queryWrapper);
+        return exinvAccount.getAccountName();
+    }
+
     /**
      * @param contractDto
      * @return 合同编码规则   甲方简称 首字母 大写 +  当前年份 + 000
@@ -262,6 +284,13 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         contractEntity.setId(null);
         contractEntity.setParentId(contractDto.getId());
 
+        //甲方名称
+        String name = this.getNameInv(contractDto.getExternalCompaniesId());
+        contractEntity.setExternalCompaniesName(name);
+
+        //乙方名称
+        String interName = this.getNameInv(contractDto.getInternalCompanyId());
+        contractEntity.setInternalCompanyName(interName);
         baseMapper.insert(contractEntity);
         if (contractDto.getSupplierIdList() != null) {
             contractSupplierService.saveAndUpdate(supplierIdList, contractEntity.getId());
@@ -277,8 +306,8 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
             return contractCode + "-1";
         } else {
             int i = Integer.parseInt(contractCodeCopy.get("contractCode").toString());
-            i=i+1;
-            return contractCode+i;
+            i = i + 1;
+            return contractCode + i;
 
         }
     }