自定义板编号配置:1、前端入参自定义类型、时间类型value字段名调整;2、时间类型复位问题修复;

This commit is contained in:
gaoqr
2025-01-20 19:39:14 +08:00
parent 59083285de
commit 494cb02f28
4 changed files with 23 additions and 18 deletions
@@ -123,10 +123,10 @@ public class CustomPlateNoGenerateServiceImpl implements CustomPlateNoGenerateSe
// 遍历规则列表
for (CustomPlateNoRuleVO plateNoRule : orgCustomPlateNoRuleVOList) {
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.CUSTOM.getRuleCode(), plateNoRule.getRuleCode())) {
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getValue());
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getStrValue());
}
if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.DATE.getRuleCode(), plateNoRule.getRuleCode())) {
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getNow().format(DateTimeFormatter.ofPattern(plateNoRule.getValue())));
plateDO.getCustomPlateNoBuilder().append(plateNoRule.getNow().format(DateTimeFormatter.ofPattern(plateNoRule.getDateValue())));
}
// 遍历规则生成服务列表,获取对应的规则服务
for (CustomPlateNoGenerateRuleService ruleService : ruleServices) {
@@ -21,9 +21,14 @@ public class CustomPlateNoRuleVO implements Serializable {
private String ruleCode;
/**
* 规则值
* 自定义类型字符串规则值
*/
private String value;
private String strValue;
/**
* 时间类型字符串规则值
*/
private String dateValue;
/**
* 初始值
@@ -166,15 +166,15 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByYear(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的年
Integer lastYear = orgCustomPlateNoSeqRespDTO.getLastYear();
Integer initValue = plateNoRule.getInitValue();
String nowYearFormat = plateNoRule.getNow().format(YEAR_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastYear), nowYearFormat)) {
int nowDayNum = Integer.parseInt(nowYearFormat);
// 跨年,把上一次的年设成当前年,后续不再跨年
orgCustomPlateNoSeqRespDTO.setLastYear(Integer.parseInt(nowYearFormat));
orgCustomPlateNoSeqRespDTO.setLastYear(nowDayNum);
// 复位
return initValue;
return nowDayNum;
}
return curr + plateNoRule.getIncrementStep();
return curr;
}
/**
@@ -188,15 +188,15 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByMonth(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的月
Integer lastMonth = orgCustomPlateNoSeqRespDTO.getLastMonth();
Integer initValue = plateNoRule.getInitValue();
String nowMonthFormat = plateNoRule.getNow().format(MONTH_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastMonth), nowMonthFormat)) {
int nowDayNum = Integer.parseInt(nowMonthFormat);
// 跨月,把上一次的月设成当前月,后续不再跨月
orgCustomPlateNoSeqRespDTO.setLastMonth(Integer.parseInt(nowMonthFormat));
orgCustomPlateNoSeqRespDTO.setLastMonth(nowDayNum);
// 复位
return initValue;
return nowDayNum;
}
return curr + plateNoRule.getIncrementStep();
return curr;
}
/**
@@ -210,14 +210,14 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByDay(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的天
Integer lastDay = orgCustomPlateNoSeqRespDTO.getLastDay();
Integer initValue = plateNoRule.getInitValue();
String nowDayFormat = plateNoRule.getNow().format(DAY_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastDay), nowDayFormat)) {
int nowDayNum = Integer.parseInt(nowDayFormat);
// 跨月,把上一次的月设成当前月,后续不再跨月
orgCustomPlateNoSeqRespDTO.setLastDay(Integer.parseInt(nowDayFormat));
orgCustomPlateNoSeqRespDTO.setLastDay(nowDayNum);
// 复位
return initValue;
return nowDayNum;
}
return curr + plateNoRule.getIncrementStep();
return curr;
}
}