18756
2024-07-31 da95fc314c3e66a817e72694051b2723bc97ef5a
新增合同优化7.31
已修改2个文件
38 ■■■■■ 文件已修改
src/main/java/com/product/contract/service/ContractInfoService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/contract/service/ProjectInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
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++) {