diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java index 9e9dd42..05e4fc3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -3,6 +3,8 @@ package com.ningdatech.pmapi.projectdeclared.utils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.gov.contants.BizProjectContant; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; @@ -13,6 +15,7 @@ import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectCollection; import com.ningdatech.pmapi.projectlib.service.IProjectService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.time.LocalDateTime; @@ -77,13 +80,14 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - - String areaCode = baseinfo.getBaseAreaCode() + BizConst.NINE_AREA_CODE_LAST; + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode())?baseinfo.getBaseAreaCode(): RegionConst.RC_LS) + + BizConst.NINE_AREA_CODE_LAST; // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); // 14-15 项目类型 - String projectType = baseinfo.getBaseProjType(); + String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : + BizProjectContant.ProjectCollection.IS_EFFECTIVE; // 16-20 项目序号00001 Long max = applyService.count(Wrappers.lambdaQuery(GovBizProjectApply.class) .eq(GovBizProjectApply::getBaseProjSetYear,apply.getBaseProjSetYear()));