Przeglądaj źródła

1.合同bug调整

wuhp 1 rok temu
rodzic
commit
b06762360b

+ 1 - 1
src/main/java/com/ydtech/modules/fnc/controller/contract/ContractController.java

@@ -86,7 +86,7 @@ public class ContractController extends BaseController {
     @ApiOperation("合同协议新增")
     public HttpResult copyContract(@RequestBody ContractDto contractDto) {
         contractService.copyContract(contractDto);
-        return HttpResult.ok();
+        return HttpResult.ok("新增协议成功");
     }
 
 

+ 9 - 0
src/main/java/com/ydtech/modules/fnc/dto/contract/ContractDto.java

@@ -115,4 +115,13 @@ public class ContractDto implements Serializable {
 
     @ApiModelProperty("合同附件集合")
     private List<ContractFileEntity> contractFileEntityList;
+
+    @ApiModelProperty("顺延年")
+    private String yearTime;
+
+    @ApiModelProperty("顺延月")
+    private String monthTime;
+
+    @ApiModelProperty("顺延日")
+    private String dayTime;
 }

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

@@ -38,6 +38,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -90,6 +91,11 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
             contractEntity.setInternalCompanyName(interName);
 
             contractEntity.setContractStatus("0");
+            if(contractDto.getExpiringDate() !=null){
+                LocalDateTime shouldPostponedDate =this.saveShouldPostponedDate(contractDto);
+                contractEntity.setShouldPostponedDate(shouldPostponedDate);
+            }
+
             baseMapper.insert(contractEntity);
             if (contractDto.getSupplierIdList() != null) {
                 contractSupplierService.saveAndUpdate(supplierIdList, contractEntity.getId());
@@ -112,6 +118,12 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
                 String interName = this.getNameInv(contractDto.getInternalCompanyId());
                 contractEntity.setInternalCompanyName(interName);
             }
+
+            if(contractDto.getExpiringDate() !=null){
+                LocalDateTime shouldPostponedDate =this.saveShouldPostponedDate(contractDto);
+                contractEntity.setShouldPostponedDate(shouldPostponedDate);
+            }
+
             baseMapper.updateById(contractEntity);
             if (contractDto.getSupplierIdList() != null && !contractDto.getSupplierIdList().isEmpty()) {
                 contractSupplierService.saveAndUpdate(contractDto.getSupplierIdList(), contractEntity.getId());
@@ -123,6 +135,30 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         }
     }
 
+    private LocalDateTime saveShouldPostponedDate(ContractDto contractDto) {
+        LocalDateTime expiringDateNew =null;
+        String yearTime = contractDto.getYearTime();
+        String monthTime = contractDto.getMonthTime();
+        String dayTime = contractDto.getDayTime();
+
+
+
+        LocalDateTime expiringDate = contractDto.getExpiringDate();
+        if(StringUtils.isNotEmpty(yearTime)){
+            expiringDateNew=expiringDate.plusYears(Integer.parseInt(yearTime));
+        }
+        if(StringUtils.isNotEmpty(monthTime)){
+
+            expiringDateNew=expiringDate.plusMonths(Integer.parseInt(monthTime));
+        }
+
+        if(StringUtils.isNotEmpty(dayTime)){
+            expiringDateNew=expiringDate.plusDays(Integer.parseInt(dayTime));
+
+        }
+        return expiringDateNew;
+    }
+
     private String getNameInv(String externalCompaniesId) {
         QueryWrapper<InvAccount> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", externalCompaniesId);
@@ -395,7 +431,7 @@ public class contractServiceImpl extends ServiceImpl<ContractMapper, ContractEnt
         } else {
             int i = Integer.parseInt(contractCodeCopy.get("contractCode").toString());
             i = i + 1;
-            return contractCode + i;
+            return contractCode + "-"+i;
 
         }
     }