diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java index c588d7c..4d4bb91 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/utils/ProjectCodeGenUtil.java @@ -50,6 +50,19 @@ public class ProjectCodeGenUtil { return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); } + public String generateProjectCode(Integer projectYear) { + String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; + // 获取建设年度 (10-13) + String year = projectYear != null ? String.valueOf(projectYear) : String.valueOf(LocalDate.now().getYear()); + // 16-20 项目序号00001 + String currentCode = areaCode + year; + // 16-20 项目序号00001 + //要查询 两边的项目序号 + Long max = getMaxProjectCode(currentCode); + // 生成20位的项目编号 + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); + } + public String generateProjectCode(ProjectCollection project) { // 获取所属行政区划代码(9位) String areaCode = RegionConst.RC_HZ + ProjectCodeContant.REGION_LAST_3; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java index 992a441..bd36115 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/ProcessExecuteChainHandle.java @@ -30,7 +30,6 @@ import java.util.Objects; @RequiredArgsConstructor public class ProcessExecuteChainHandle { - private final IProjectService projectService; private final ProcessModelService processModelService; /** diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java index 847d62a..43e4c84 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java @@ -43,7 +43,9 @@ import com.hz.pm.api.sys.manage.NoticeManage; import com.hz.pm.api.todocenter.constant.WorkNoticeConst; import com.hz.pm.api.user.helper.MhUnitCache; import com.hz.pm.api.user.model.dto.UnitDTO; +import com.hz.pm.api.user.model.entity.MhUnit; import com.hz.pm.api.user.security.model.UserInfoDetails; +import com.hz.pm.api.user.service.IMhUnitService; import com.hz.pm.api.user.util.LoginUserUtil; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; @@ -63,6 +65,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.InputStream; import java.math.BigDecimal; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -86,6 +89,7 @@ public class DeclaredRecordManage { private final IMhProjectSchemaTargetDataService schemaTargetDataService; private final IProjectService projectService; private final MhUnitCache mhUnitCache; + private final IMhUnitService mhUnitService; private final NoticeManage noticeManage; private final IProjectDraftService projectDraftService; private final ProcessModelService processModelService; @@ -385,6 +389,7 @@ public class DeclaredRecordManage { } } + @Transactional(rollbackFor = Exception.class) public void importProjectFinanceInfos(MultipartFile file) { try (InputStream is = file.getInputStream()) { List> rows = ExcelUtil.getReader(is).readAll(); @@ -404,43 +409,49 @@ public class DeclaredRecordManage { financeInfo.setDeclareGovSuperiorFinanceAmount(MapUtil.get(w, "上级补助资金", BigDecimal.class)); return financeInfo; }); - Map> groupByUnit = CollUtils.group(importDataList, ImportProjectFinanceInfosDTO::getUnitName); - List projects = new ArrayList<>(); - for (Map.Entry> entry : groupByUnit.entrySet()) { - if (entry.getValue().size() != 1) { - log.warn("单位存在多个项目:{}", entry.getKey()); - continue; + for (ImportProjectFinanceInfosDTO importData : importDataList) { + String projectName = importData.getProjectName(); + Project project = projectService.getByProjectName(projectName); + if (project == null) { + List units = mhUnitService.listByName(importData.getUnitName()); + if (units.size() != 1) { + continue; + } + MhUnit unit = units.get(0); + MhUnitTypeEnum unitType = MhUnitTypeEnum.getByCode(unit.getType()).get(); + MhProject mhProject = new MhProject(); + mhProject.setUnitStrip(unitType.getStrip().getCode()); + mhProject.setUnitName(unit.getName()); + mhProject.setUnitId(unit.getId()); + mhProject.setCreateTime(LocalDateTime.now()); + mhProject.setProjectName(importData.getProjectName()); + LocalDateTime now = LocalDateTime.now(); + mhProject.setProjectCode(projectCodeGenUtil.generateProjectCode(now.getYear())); + mhProjectService.save(mhProject); + project = new Project(); + project.setProjectCode(mhProject.getProjectCode()); + project.setNewest(Boolean.TRUE); + project.setVersion(1); + project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); + project.setStatus(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode()); + project.setCreateOn(now); + project.setUpdateOn(now); + project.setUnitStrip(mhProject.getUnitStrip()); + project.setBuildOrgName(unit.getName()); + project.setBuildOrgCode(String.valueOf(unit.getId())); } - Collection projectsTmp = listProjectsByUnitName(entry.getKey()); - if (projectsTmp.size() != 1) { - log.warn("单位存在多个项目:{}", entry.getKey()); - continue; - } - Project project = new ArrayList<>(projects).get(0); - ImportProjectFinanceInfosDTO importData = entry.getValue().get(0); project.setApprovalAmount(importData.getDeclareAmount()); project.setApprovalGovOwnFinanceAmount(importData.getDeclareGovOwnFinanceAmount()); project.setApprovalGovSuperiorFinanceAmount(importData.getDeclareGovSuperiorFinanceAmount()); project.setApprovalHaveAmount(importData.getDeclareHaveAmount()); - projects.add(project); + projectService.saveOrUpdate(project); } - if (projects.isEmpty()) { - return; - } - projectService.updateBatchById(projects); } catch (Exception e) { log.info("读取数据失败:", e); throw new BizException(e); } } - private Collection listProjectsByUnitName(String unitName) { - List projects = projectService.list(Wrappers.lambdaQuery(Project.class) - .eq(Project::getBuildOrgName, unitName)); - return BizUtils.groupFirst(projects, Project::getProjectCode, - Comparator.comparing(Project::getCreateOn).reversed()); - } - @Transactional(rollbackFor = Exception.class) public void importReplaceSystemInfos(MultipartFile file) { try (InputStream is = file.getInputStream()) { @@ -457,7 +468,6 @@ public class DeclaredRecordManage { importData.setSourceName(MapUtil.getStr(w, "替代前系统")); importData.setTargetName(MapUtil.getStr(w, "替代后系统")); importData.setUnitName(MapUtil.getStr(w, "单位")); - Assert.notBlank(importData.getUnitName(), "单位名称不能为空"); if (StrUtil.equals(importData.getReplaceType(), "/") || StrUtil.isBlank(importData.getReplaceType())) { importData.setReplaceType(null); @@ -469,16 +479,14 @@ public class DeclaredRecordManage { return importData; }); Map> groupByProject = CollUtils.group(importDataList, - ImportReplaceSystemInfosDTO::getUnitName); + ImportReplaceSystemInfosDTO::getProjectName); List projectIds = new ArrayList<>(); List replaceInfos = new ArrayList<>(); for (Map.Entry> entry : groupByProject.entrySet()) { - Collection projects = listProjectsByUnitName(entry.getKey()); - if (projects.size() != 1) { - log.warn("单位存在多个项目:{}", entry.getKey()); + Project project = projectService.getByProjectName(entry.getKey()); + if (project == null) { continue; } - Project project = new ArrayList<>(projects).get(0); projectIds.add(project.getId()); Map batchNoMap = new HashMap<>(); AtomicInteger integer = new AtomicInteger(1); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java index 1c42e84..017adb0 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectLibManage.java @@ -418,6 +418,7 @@ public class ProjectLibManage { item.setProjectYear(w.getProjectYear()); item.setBuildOrg(w.getBuildOrgName()); item.setBizDomain(w.getBizDomain()); + item.setReviewAmount(w.getReviewAmount()); item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml index cfbfc87..80fda28 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/mapper/ProjectMapper.xml @@ -10,6 +10,7 @@ project_year, build_org_code, build_org_name, + review_amount, project_code, project_type, area, @@ -39,6 +40,7 @@ area_code, declare_amount, approval_amount, + review_amount, stage, status, biz_domain, @@ -121,6 +123,7 @@ (CASE WHEN b.base_area_code IS NOT NULL then substring(b.base_area_code,0,6) end) area_code, apply.base_proj_decl_amount declare_amount, approve.base_initial_review_total_money approval_amount, + NULL review_amount, NULL stage, CAST(b.base_proj_set_prog AS INTEGER) status, NULL annual_plan_amount, @@ -206,6 +209,7 @@ (CASE WHEN b.base_area_code IS NOT NULL then substring(b.base_area_code,0,6) end) area_code, apply.base_proj_decl_amount declare_amount, approve.base_initial_review_total_money approval_amount, + NULL review_amount, NULL stage, CAST(b.base_proj_set_prog AS INTEGER) status, NULL annual_plan_amount, diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java index 27fc4b0..f63f56e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/entity/Project.java @@ -209,6 +209,9 @@ public class Project implements Serializable { @Compare("资金分配情况-第三方服务") private BigDecimal thirdPartyAmount; + @ApiModelProperty("评审金额") + private BigDecimal reviewAmount; + //================================================================================================================== @ApiModelProperty("批复-自有金额(万元)") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java index 572339b..45fb155 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/po/ProjectPO.java @@ -238,6 +238,9 @@ public class ProjectPO implements Serializable { @Compare("立项批复总投资") private BigDecimal approvalAmount; + @ApiModelProperty("评审金额") + private BigDecimal reviewAmount; + @ApiModelProperty("立项批复总预算(万元)") @Compare("立项批复总预算") private BigDecimal approvalBudget; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java index cb8ac22..190f8e8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectDetailVO.java @@ -214,6 +214,9 @@ public class ProjectDetailVO { private LocalDateTime annualPlanAddTime; + @ApiModelProperty("评审金额") + private BigDecimal reviewAmount; + @ApiModelProperty("核心业务-核心业务模块") private String coreBusiness; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java index e07f95d..4d234a5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/model/vo/ProjectLibListItemVO.java @@ -56,6 +56,9 @@ public class ProjectLibListItemVO { @ApiModelProperty("申报金额") private BigDecimal declaredAmount; + @ApiModelProperty("评审金额") + private BigDecimal reviewAmount; + @ApiModelProperty("批复金额") private BigDecimal approvedAmount;