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

1.合同修改合同类型改变供应商清空

wuhp пре 1 година
родитељ
комит
08829abda6

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/service/contract/ContractSupplierService.java

@@ -9,7 +9,7 @@ import com.ydtech.modules.fnc.vo.ContractVo;
 import java.util.List;
 
 public interface ContractSupplierService {
-    void saveAndUpdate(List<String> supplierIdList, String id);
+    void saveAndUpdate(String contractType,List<String> supplierIdList, String id);
 
     /**
      *

+ 4 - 1
src/main/java/com/ydtech/modules/fnc/service/contract/impl/ContractSupplierServiceImpl.java

@@ -35,7 +35,10 @@ public class ContractSupplierServiceImpl extends ServiceImpl<ContractSupplierMap
      */
     @Override
     @Transactional
-    public void saveAndUpdate(List<String> supplierIdList, String id) {
+    public void saveAndUpdate(String contractType,List<String> supplierIdList, String id) {
+        if(!("1".equals(contractType) || "2".equals(contractType))){
+            supplierIdList=new ArrayList<>();
+        }
         baseMapper.deleteBySupplierIds(id);
         List<ContractSupplierEntity> inserList = new ArrayList<>();
         String deptId = BaseController.getDeptId();

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

@@ -98,7 +98,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
 
             baseMapper.insert(contractEntity);
             if (contractDto.getSupplierIdList() != null) {
-                contractSupplierService.saveAndUpdate(supplierIdList, contractEntity.getId());
+                contractSupplierService.saveAndUpdate(contractDto.getContractType(),supplierIdList, contractEntity.getId());
             }
             if (contractDto.getFilePathIdList() != null) {
                 contractFileService.saveAndUpdate(contractDto.getFilePathIdList(), contractEntity.getId());
@@ -125,7 +125,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
 //            }
 
             baseMapper.updateById(contractEntity);
-            contractSupplierService.saveAndUpdate(contractDto.getSupplierIdList(), contractEntity.getId());
+            contractSupplierService.saveAndUpdate(contractDto.getContractType(),contractDto.getSupplierIdList(), contractEntity.getId());
 
             contractFileService.saveAndUpdate(contractDto.getFilePathIdList(), contractEntity.getId());
         }
@@ -335,7 +335,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         contractEntity.setInternalCompanyName(interName);
         baseMapper.insert(contractEntity);
         if (contractDto.getSupplierIdList() != null) {
-            contractSupplierService.saveAndUpdate(supplierIdList, contractEntity.getId());
+            contractSupplierService.saveAndUpdate(contractDto.getContractType(),supplierIdList, contractEntity.getId());
         }
         if (contractDto.getFilePathIdList() != null) {
             contractFileService.saveAndUpdate(contractDto.getFilePathIdList(), contractEntity.getId());