From 494cb02f28d0c14eefd4162aab7efad1b810cd95 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Mon, 20 Jan 2025 19:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=9D=BF=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=E9=85=8D=E7=BD=AE=EF=BC=9A1=E3=80=81=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E5=85=A5=E5=8F=82=E8=87=AA=E5=AE=9A=E4=B9=89=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=81=E6=97=B6=E9=97=B4=E7=B1=BB=E5=9E=8Bvalue?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E8=B0=83=E6=95=B4=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E6=97=B6=E9=97=B4=E7=B1=BB=E5=9E=8B=E5=A4=8D=E4=BD=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomPlateNoGenerateServiceImpl.java | 4 ++-- .../customplateno/vo/CustomPlateNoRuleVO.java | 9 +++++-- .../OrderNoGenerateRuleServiceImpl.java | 24 +++++++++---------- .../impl/CustomPlateNoServiceHandler.java | 4 ++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/CustomPlateNoGenerateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/CustomPlateNoGenerateServiceImpl.java index 2c9dd981e..f40529648 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/CustomPlateNoGenerateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/CustomPlateNoGenerateServiceImpl.java @@ -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) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/vo/CustomPlateNoRuleVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/vo/CustomPlateNoRuleVO.java index 47c8713d3..ea2517df3 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/vo/CustomPlateNoRuleVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplateno/vo/CustomPlateNoRuleVO.java @@ -21,9 +21,14 @@ public class CustomPlateNoRuleVO implements Serializable { private String ruleCode; /** - * 规则值 + * 自定义类型字符串规则值 */ - private String value; + private String strValue; + + /** + * 时间类型字符串规则值 + */ + private String dateValue; /** * 初始值 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java index a62b981b4..620bd8ff9 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java @@ -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; } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java index 58fd5b583..c93a127ed 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java @@ -113,7 +113,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand checkCustom(custBoardRuleCodeEnum, jsonObject); // 3.时间格式校验 - checkDateFormat(custBoardRuleCodeEnum, jsonObject.getString("value"), dateTypeFormatDictList); + checkDateFormat(custBoardRuleCodeEnum, jsonObject.getString("dateValue"), dateTypeFormatDictList); // 4.序号类型校验数字和布尔类型 checkNoType(custBoardRuleCodeEnum, jsonObject); @@ -169,7 +169,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand */ private void checkCustom(CustomPlateNoRuleCodeEnum custBoardRuleCodeEnum, JSONObject jsonObject) { if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.CUSTOM, custBoardRuleCodeEnum)) { - if (ObjectUtil.isEmpty(jsonObject.get("value"))) { + if (ObjectUtil.isEmpty(jsonObject.get("strValue"))) { throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR, jsonObject.get("ruleCode")); } }