From da95fc314c3e66a817e72694051b2723bc97ef5a Mon Sep 17 00:00:00 2001 From: 18756 <1875631620@qq.com> Date: 星期三, 31 七月 2024 10:32:34 +0800 Subject: [PATCH] 新增合同优化7.31 --- src/main/java/com/product/contract/service/ProjectInfoService.java | 2 +- src/main/java/com/product/contract/service/ContractInfoService.java | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/product/contract/service/ContractInfoService.java b/src/main/java/com/product/contract/service/ContractInfoService.java index d2b6d6e..37806e9 100644 --- a/src/main/java/com/product/contract/service/ContractInfoService.java +++ b/src/main/java/com/product/contract/service/ContractInfoService.java @@ -17,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Date; /** @@ -127,10 +129,42 @@ public FieldSetEntity findContractInfo(FieldSetEntity fs) throws BaseException { FieldSetEntity cfs =baseDao.getFieldSetEntity(CmnConst.LX_PROJECT_CONTRACT_INFO,fs.getUUID(),true); DataTableEntity sub=cfs.getSubDataTable("product_project_contract_info_sub"); - + StringBuilder filter=new StringBuilder(128); + filter.append(" uuid='"+cfs.getValues().get("project_uuid")+"'"); + DataTableEntity product_project_business = baseDao.listTable("product_project_business",filter.toString(),new Object[]{}); + String guarantee_period = product_project_business.getData().get(0).getValues().get("guarantee_period").toString(); + StringBuilder dictFilter=new StringBuilder(128); + dictFilter.append("dict_name='椤圭洰绠$悊椤圭洰绫诲瀷' and dict_value="+product_project_business.getData().get(0).getValues().get("project_type").toString()); + DataTableEntity product_sys_dict = baseDao.listTable("product_sys_dict", dictFilter.toString(), new Object[]{}); + //鍚堝悓鏈夋晥鏈燂細濡傛灉鏄紑鍙戦」鐩�佸疄鏂介」鐩紝浠庨」鐩俊鎭殑璐ㄤ繚鏈熷甫杩囨潵 + String dict_label = product_sys_dict.getData().get(0).getValues().get("dict_label").toString(); + if(dict_label.equals("寮�鍙戦」鐩�") ||dict_label.equals("瀹炴柦椤圭洰")){ + cfs.setValue("guarantee_period",guarantee_period); + cfs.setValue("project_type_now",dict_label); + } + //缁撴潫鏃ユ湡锛� 濡傛灉鏄紑鍙戦」鐩�佸疄鏂介」鐩紝楠屾敹鏃ユ湡+鍚堝悓鏈夋晥鏈燂紝缁存姢鍚堝悓鍒欐槸绛惧畾鏃ユ湡+鍚堝悓鏈夋晥鏈� + if(dict_label.equals("寮�鍙戦」鐩�") || dict_label.equals("瀹炴柦椤圭洰")){ + String carefully_check = product_project_business.getData().get(0).getValues().get("carefully_check").toString(); + String[] dateTime = carefully_check.split(" "); + String time=dateTime[0]; + String date = getDate(time,guarantee_period); + cfs.setValue("end_time",date); + } return cfs; } + + //鏃ユ湡璁$畻鏂瑰紡 + public String getDate(String dateTime,String carefully_time){ + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate date = LocalDate.parse(dateTime, formatter); + // 鍔犱笂鎸囧畾鐨勬湀浠芥暟锛屼緥濡傚姞3涓湀 + LocalDate newDate = date.plusMonths(Integer.parseInt(carefully_time)); + + return newDate.format(formatter); + } + /** * 鏍规嵁鍚堝悓鍚嶆煡璇㈠悎鍚岃鎯� * @param fs diff --git a/src/main/java/com/product/contract/service/ProjectInfoService.java b/src/main/java/com/product/contract/service/ProjectInfoService.java index adef33a..4a0558b 100644 --- a/src/main/java/com/product/contract/service/ProjectInfoService.java +++ b/src/main/java/com/product/contract/service/ProjectInfoService.java @@ -92,7 +92,7 @@ public void saveOrUpdate(FieldSetEntity fse) throws BaseException { String dic_name = fse.getValues().get("dict_name").toString(); - StringBuilder filterSb = new StringBuilder(64);; + StringBuilder filterSb = new StringBuilder(64); filterSb.append( " project_type = "+dic_name); DataTableEntity dataListNew = fse.getSubData().get("product_project_manager_data_list"); for (int i = 0; i < dataListNew.getRows(); i++) { -- Gitblit v1.9.2