PoffyZhang 1 year ago
parent
commit
98d5e927c6
1 changed files with 8 additions and 13 deletions
  1. +8
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java

+ 8
- 13
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java View File

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.projectdeclared.utils;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService;
import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
@@ -40,12 +39,10 @@ public class GenerateProjectCodeUtil {
// 14-15 项目类型
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001
Project max = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.select(Project::getId)
.orderByDesc(Project::getId)
.last(BizConst.LIMIT_1));
Long maxId = Objects.nonNull(max) ? max.getId() : 0;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxId + 1);
Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear()));
Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号
return areaCode + year + projectType + serialNumber;
}
@@ -59,12 +56,10 @@ public class GenerateProjectCodeUtil {
// 14-15 项目类型
String projectType = ProjectCodeContant.PROJECT_TYPE_PREFIX + project.getProjectType();
// 16-20 项目序号00001
Project max = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.select(Project::getId)
.orderByDesc(Project::getId)
.last(BizConst.LIMIT_1));
Long maxId = Objects.nonNull(max) ? max.getId() : 0;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxId + 1);
Long max = projectService.count(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectYear,project.getProjectYear()));
Long maxCurrent = max + 1;
String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent);
// 生成20位的项目编号
return areaCode + year + projectType + serialNumber;
}


Loading…
Cancel
Save