feat: 企标编号生成剔除编号回收逻辑
This commit is contained in:
-1
@@ -288,7 +288,6 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
||||
lambdaQueryWrapper.eq(ProcessEsInitChange::getEnStandardCode, esCodeDictValue);
|
||||
lambdaQueryWrapper.eq(ProcessEsInitChange::getEnNameCode, esNameCodeDictValue);
|
||||
lambdaQueryWrapper.eq(ProcessEsInitChange::getStandardCategoryCode, categoryCodeDictValue);
|
||||
lambdaQueryWrapper.eq(ProcessEsInitChange::getDelFlag, 0);
|
||||
List<ProcessEsInitChange> list = this.list(lambdaQueryWrapper);
|
||||
|
||||
return list.stream().map(ProcessEsInitChange::getNewEnStandardNo)
|
||||
|
||||
-1
@@ -125,7 +125,6 @@ public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseSta
|
||||
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnStandardCode, esCodeDictValue);
|
||||
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getEnNameCode, esNameCodeDictValue);
|
||||
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getStandardCategoryCode, categoryCodeDictValue);
|
||||
lambdaQueryWrapper.eq(EnterpriseStandardPlan::getDelFlag, 0);
|
||||
List<EnterpriseStandardPlan> espList = this.list(lambdaQueryWrapper);
|
||||
|
||||
return espList.stream().map(EnterpriseStandardPlan::getNewEnStandardNo)
|
||||
|
||||
+27
-11
@@ -3,8 +3,12 @@ package com.jero.modules.laws.enterprise.util;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange;
|
||||
import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.enterprise.service.ESSequenceNumberProvider;
|
||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -29,6 +33,12 @@ public class EnterpriseStandardUtil {
|
||||
@Resource
|
||||
private List<ESSequenceNumberProvider> providers;
|
||||
|
||||
@Resource
|
||||
private ILawsEnterpriseStandardService esService;
|
||||
|
||||
@Resource
|
||||
private ProcessEsInitChangeService initChangeService;
|
||||
|
||||
/**
|
||||
* 生成新序列号
|
||||
*
|
||||
@@ -50,12 +60,9 @@ public class EnterpriseStandardUtil {
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int expectedNumber = 1; // 我们期望的最小序列号
|
||||
for (int num : sortedNumbers) {
|
||||
if (num != expectedNumber) {
|
||||
break;
|
||||
}
|
||||
expectedNumber++;
|
||||
int expectedNumber = 0; // 我们期望的最大序列号初始化为0
|
||||
if (!sortedNumbers.isEmpty()) {
|
||||
expectedNumber = sortedNumbers.get(sortedNumbers.size() - 1) + 1; // 获取最大的数字并+1
|
||||
}
|
||||
return String.format("%04d", expectedNumber);
|
||||
}
|
||||
@@ -138,11 +145,6 @@ public class EnterpriseStandardUtil {
|
||||
return standardNo.substring(dashIndex - 4, dashIndex);
|
||||
}
|
||||
|
||||
public boolean verifyEnStandardNumber(String StandardNumber) {
|
||||
// TODO 校验企标编号是否有效
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Map<String, String> splitStandardNumber(String standardNumber) {
|
||||
// 使用正则表达式匹配所需的各个部分
|
||||
Pattern pattern = Pattern.compile("([A-Za-z]{1,2})\\/([A-Za-z]{1,2}) (\\d)(\\d{4})-(\\d{4})");
|
||||
@@ -165,4 +167,18 @@ public class EnterpriseStandardUtil {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验企标编号是否不重复
|
||||
* @param StandardNumber
|
||||
* @return
|
||||
*/
|
||||
public boolean verifyEnStandardNumber(String StandardNumber) {
|
||||
List<String> numList = new ArrayList<>();
|
||||
// 判断是否和企标库中重复
|
||||
numList.addAll(esService.list().stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList()));
|
||||
// 判断是否和立项流程中重复
|
||||
numList.addAll(initChangeService.list().stream().map(ProcessEsInitChange::getNewEnStandardNo).collect(Collectors.toList()));
|
||||
return !numList.contains(StandardNumber);
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -174,7 +174,6 @@ public class LawsEnterpriseStandardServiceImpl extends ServiceImpl<LawsEnterpris
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getStandardCode, esCodeDictValue);
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getNameCode, esNameCodeDictValue);
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getCategoryCode, categoryCodeDictValue);
|
||||
lambdaQueryWrapper.eq(LawsEnterpriseStandard::getDelFlag, 0);
|
||||
List<LawsEnterpriseStandard> esList = this.list(lambdaQueryWrapper);
|
||||
|
||||
return esList.stream().map(LawsEnterpriseStandard::getStandardNumber)
|
||||
|
||||
Reference in New Issue
Block a user