diff --git a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/dailyplan/DailyPlanScheduleServiceImpl.java b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/dailyplan/DailyPlanScheduleServiceImpl.java index 6253fd8a..5f126a5f 100644 --- a/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/dailyplan/DailyPlanScheduleServiceImpl.java +++ b/nl-module-lms/nl-module-lms-server/src/main/java/cn/code/nl/module/lms/service/dailyplan/DailyPlanScheduleServiceImpl.java @@ -180,6 +180,10 @@ public class DailyPlanScheduleServiceImpl implements DailyPlanScheduleService { if (plan == null) { throw exception(DAILY_PLAN_NOT_EXISTS); } + if (!plan.getVersion().equals(claim.getPlanVersion())) { + // 领取后的任何计划变更都会使旧领取失效;不确认 claim,调用方可处理冲突后主动释放或续租。 + throw exception(DAILY_PLAN_VERSION_CONFLICT); + } Integer workStatus = type == DailyPlanStrategyTypeEnum.STOCKING ? plan.getStockingStatus() : plan.getSleevingStatus(); if (!DailyPlanOrderStatusEnum.IN_PROGRESS.getCode().equals(plan.getOrderStatus()) @@ -193,8 +197,8 @@ public class DailyPlanScheduleServiceImpl implements DailyPlanScheduleService { throw exception(DAILY_PLAN_COMPLETED_QTY_EXCEEDS_TOTAL); } int affected = type == DailyPlanStrategyTypeEnum.STOCKING - ? dailyPlanMapper.increaseStockedQuantity(dailyPlanId, quantity, plan.getVersion(), normalizedOperator(operator)) - : dailyPlanMapper.increaseSleevedQuantity(dailyPlanId, quantity, plan.getVersion(), normalizedOperator(operator)); + ? dailyPlanMapper.increaseStockedQuantity(dailyPlanId, quantity, version, normalizedOperator(operator)) + : dailyPlanMapper.increaseSleevedQuantity(dailyPlanId, quantity, version, normalizedOperator(operator)); if (affected != 1) { throw exception(DAILY_PLAN_VERSION_CONFLICT); }