Browse Source

生成21位项目编号

tags/24080901
CMM 1 year ago
parent
commit
78360528f9
14 changed files with 107 additions and 25 deletions
  1. +9
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java
  2. +10
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java
  3. +7
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java
  4. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  5. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java
  7. +54
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java
  8. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java
  9. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  10. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  11. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java
  12. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  13. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/PdfGenerateDTO.java
  14. +1
    -1
      pmapi/src/main/resources/template/预审申请单.html

+ 9
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/DeclaredProjectContant.java
File diff suppressed because it is too large
View File


+ 10
- 10
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/DeclaredProjectController.java View File

@@ -1,31 +1,31 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import java.util.Iterator;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.manage.ProjectAdjustmentManage;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectListParamDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectDraftSaveDTO;
import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO;
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.req.ProjectRenewalListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

/**
* @Classname DeclaredProjectController


+ 7
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/PrequalificationDeclaredController.java View File

@@ -1,23 +1,21 @@
package com.ningdatech.pmapi.projectdeclared.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
* @Classname PrequalificationDeclaredController


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -24,6 +24,7 @@ import com.ningdatech.pmapi.projectdeclared.model.dto.*;
import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft;
import com.ningdatech.pmapi.projectdeclared.model.vo.ProjectDraftVO;
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
@@ -99,6 +100,7 @@ public class DeclaredProjectManage {
private final UserInfoHelper userInfoHelper;

private final RegionCacheHelper regionCacheHelper;
private final GenerateProjectCodeUtil generateProjectCodeUtil;

/**
* 新项目 启动实例
@@ -266,6 +268,8 @@ public class DeclaredProjectManage {
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
project.setInstCode(instanceId);
project.setSponsor(employeeCode);
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
projectService.saveOrUpdate(project);
//保存项目应用
if (CollUtil.isNotEmpty(projectDto.getApplicationList())) {


+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ProjectAdjustmentManage.java View File

@@ -16,6 +16,7 @@ import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectAdjustmentExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.AdjustmentListReq;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.projectdeclared.utils.ReStartProcessMapUtil;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
@@ -71,6 +72,7 @@ public class ProjectAdjustmentManage {
private final ProjectLibManage projectLibManage;

private final UserInfoHelper userInfoHelper;
private final GenerateProjectCodeUtil generateProjectCodeUtil;

/**
* 项目内容调整
@@ -110,6 +112,8 @@ public class ProjectAdjustmentManage {
//先修改项目信息
Project project = new Project();
BeanUtils.copyProperties(projectDto,project);
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto);
project.setProjectCode(projectCode);
project.setUpdateOn(LocalDateTime.now());
if(!projectService.updateById(project)){
throw new BusinessException("项目调整失败");


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java View File

@@ -300,6 +300,9 @@ public class ProjectDraftVO implements Serializable {
@ApiModelProperty("用户id")
private String userId;

@ApiModelProperty("21位项目编号")
private String projectCode;


private Long createBy;
private Long updateBy;


+ 54
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -0,0 +1,54 @@
package com.ningdatech.pmapi.projectdeclared.utils;

import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode;
import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService;
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
* 生成项目编号工具类
*
* @author CMM
* @since 2023/04/04 14:13
*/
@Component
public class GenerateProjectCodeUtil {
@Autowired
private ICompanyFiscalCodeService companyFiscalCodeService;

public String generateProjectCode(ProjectDTO projectInfo){
// 获取所属行政区划代码(6位)
String areaCode = projectInfo.getAreaCode();
// 获取建设年度后两位
Integer projectYear = projectInfo.getProjectYear();
String year = String.valueOf(projectYear)
.substring(DeclaredProjectContant.Project.YEAR_THREE, DeclaredProjectContant.Project.YEAR_FOUR);
// 9-12位固定
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER;
// 获取公司的财政编码
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(projectInfo.getBuildOrgCode());
if (Objects.isNull(companyFiscalCode)){
throw new BizException("申报单位未配置财政编码!");
}
String fiscalCode = companyFiscalCode.getFiscalCode();
// 获取项目编号
String projectIdStr;
Long projectId = projectInfo.getId();
if (projectId > DeclaredProjectContant.Project.PROJECT_ID){
// 超过999的项目号从1开始
Long newProjectId = projectId - DeclaredProjectContant.Project.PROJECT_ID;
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, newProjectId);
}else {
projectIdStr = String.format(StrPool.FORMAT_NUMBER_THREE, projectId);
}
// 生成21位的项目编号
return areaCode + year + fixedNumber + fiscalCode + projectIdStr;
}
}

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/helper/ProjectHelper.java View File

@@ -1,12 +1,14 @@
package com.ningdatech.pmapi.projectlib.helper;

import cn.hutool.core.collection.CollUtil;
import org.springframework.beans.BeanUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO;
import org.springframework.beans.BeanUtils;

import cn.hutool.core.collection.CollUtil;

/**
* <p>


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java View File

@@ -315,4 +315,6 @@ public class Project implements Serializable {
@ApiModelProperty("项目预审申请单文件名")
private String pretrialFileName;

@ApiModelProperty("21位项目编号")
private String projectCode;
}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java View File

@@ -300,6 +300,9 @@ public class ProjectDetailVO {
@ApiModelProperty("项目预审申请单文件名")
private String pretrialFileName;

@ApiModelProperty("21位项目编号")
private String projectCode;

public String getProjectTypeName() {
if (Objects.nonNull(this.projectType)) {
Optional.ofNullable(ProjectTypeEnum.getDesc(this.projectType))


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectLibListItemVO.java View File

@@ -92,4 +92,7 @@ public class ProjectLibListItemVO {

@ApiModelProperty("能否被预审申报")
private Boolean canPreDeclared = Boolean.FALSE;

@ApiModelProperty("21位项目编号")
private String projectCode;
}

+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -1005,7 +1005,6 @@ public class TodoCenterManage {
// 设置title
String title = "【" + project.getProjectName() + "】" + fileName;
paramsMap.put("title",title);
paramsMap.put("projectNo", projectId);
// 获取预审申报的开始时间
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, projectId)


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/PdfGenerateDTO.java View File

@@ -143,4 +143,7 @@ public class PdfGenerateDTO {

@ApiModelProperty("年度计划投资")
private BigDecimal yearPlanInvest;

@ApiModelProperty("21位项目编号")
private String projectCode;
}

+ 1
- 1
pmapi/src/main/resources/template/预审申请单.html View File

@@ -90,7 +90,7 @@
<p class="projectId">
<span>
项目编号:
<span>#projectNo#</span>
<span>#projectCode#</span>
</span>
<span class="time">#time#</span>
</p>


Loading…
Cancel
Save