禅道#1094问题修复:api导入自定义板编号累加失效

This commit is contained in:
gaoqr
2025-02-11 12:36:13 +08:00
parent 7240049661
commit e8a4f89378
@@ -166,15 +166,17 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByYear(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) { private int resetByYear(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的年 // 上一次的年
Integer lastYear = orgCustomPlateNoSeqRespDTO.getLastYear(); Integer lastYear = orgCustomPlateNoSeqRespDTO.getLastYear();
// 初始值
Integer initValue = plateNoRule.getInitValue();
String nowYearFormat = plateNoRule.getNow().format(YEAR_FORMATTER); String nowYearFormat = plateNoRule.getNow().format(YEAR_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastYear), nowYearFormat)) { if (ObjectUtil.notEqual(String.valueOf(lastYear), nowYearFormat)) {
int nowDayNum = Integer.parseInt(nowYearFormat); int nowDayNum = Integer.parseInt(nowYearFormat);
// 跨年,把上一次的年设成当前年,后续不再跨年 // 跨年,把上一次的年设成当前年,后续不再跨年
orgCustomPlateNoSeqRespDTO.setLastYear(nowDayNum); orgCustomPlateNoSeqRespDTO.setLastYear(nowDayNum);
// 复位 // 复位
return nowDayNum; return initValue;
} }
return curr; return curr + plateNoRule.getIncrementStep();
} }
/** /**
@@ -188,15 +190,17 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByMonth(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) { private int resetByMonth(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的月 // 上一次的月
Integer lastMonth = orgCustomPlateNoSeqRespDTO.getLastMonth(); Integer lastMonth = orgCustomPlateNoSeqRespDTO.getLastMonth();
// 初始值
Integer initValue = plateNoRule.getInitValue();
String nowMonthFormat = plateNoRule.getNow().format(MONTH_FORMATTER); String nowMonthFormat = plateNoRule.getNow().format(MONTH_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastMonth), nowMonthFormat)) { if (ObjectUtil.notEqual(String.valueOf(lastMonth), nowMonthFormat)) {
int nowDayNum = Integer.parseInt(nowMonthFormat); int nowDayNum = Integer.parseInt(nowMonthFormat);
// 跨月,把上一次的月设成当前月,后续不再跨月 // 跨月,把上一次的月设成当前月,后续不再跨月
orgCustomPlateNoSeqRespDTO.setLastMonth(nowDayNum); orgCustomPlateNoSeqRespDTO.setLastMonth(nowDayNum);
// 复位 // 复位
return nowDayNum; return initValue;
} }
return curr; return curr + plateNoRule.getIncrementStep();
} }
/** /**
@@ -210,14 +214,16 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule
private int resetByDay(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) { private int resetByDay(int curr, CustomPlateNoSeqDTO orgCustomPlateNoSeqRespDTO, CustomPlateNoRuleVO plateNoRule) {
// 上一次的天 // 上一次的天
Integer lastDay = orgCustomPlateNoSeqRespDTO.getLastDay(); Integer lastDay = orgCustomPlateNoSeqRespDTO.getLastDay();
// 初始值
Integer initValue = plateNoRule.getInitValue();
String nowDayFormat = plateNoRule.getNow().format(DAY_FORMATTER); String nowDayFormat = plateNoRule.getNow().format(DAY_FORMATTER);
if (ObjectUtil.notEqual(String.valueOf(lastDay), nowDayFormat)) { if (ObjectUtil.notEqual(String.valueOf(lastDay), nowDayFormat)) {
int nowDayNum = Integer.parseInt(nowDayFormat); int nowDayNum = Integer.parseInt(nowDayFormat);
// 跨月,把上一次的月设成当前月,后续不再跨月 // 跨月,把上一次的月设成当前月,后续不再跨月
orgCustomPlateNoSeqRespDTO.setLastDay(nowDayNum); orgCustomPlateNoSeqRespDTO.setLastDay(nowDayNum);
// 复位 // 复位
return nowDayNum; return initValue;
} }
return curr; return curr + plateNoRule.getIncrementStep();
} }
} }