fix: 严格校验日计划领取版本
This commit is contained in:
@@ -180,6 +180,10 @@ public class DailyPlanScheduleServiceImpl implements DailyPlanScheduleService {
|
|||||||
if (plan == null) {
|
if (plan == null) {
|
||||||
throw exception(DAILY_PLAN_NOT_EXISTS);
|
throw exception(DAILY_PLAN_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
if (!plan.getVersion().equals(claim.getPlanVersion())) {
|
||||||
|
// 领取后的任何计划变更都会使旧领取失效;不确认 claim,调用方可处理冲突后主动释放或续租。
|
||||||
|
throw exception(DAILY_PLAN_VERSION_CONFLICT);
|
||||||
|
}
|
||||||
Integer workStatus = type == DailyPlanStrategyTypeEnum.STOCKING
|
Integer workStatus = type == DailyPlanStrategyTypeEnum.STOCKING
|
||||||
? plan.getStockingStatus() : plan.getSleevingStatus();
|
? plan.getStockingStatus() : plan.getSleevingStatus();
|
||||||
if (!DailyPlanOrderStatusEnum.IN_PROGRESS.getCode().equals(plan.getOrderStatus())
|
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);
|
throw exception(DAILY_PLAN_COMPLETED_QTY_EXCEEDS_TOTAL);
|
||||||
}
|
}
|
||||||
int affected = type == DailyPlanStrategyTypeEnum.STOCKING
|
int affected = type == DailyPlanStrategyTypeEnum.STOCKING
|
||||||
? dailyPlanMapper.increaseStockedQuantity(dailyPlanId, quantity, plan.getVersion(), normalizedOperator(operator))
|
? dailyPlanMapper.increaseStockedQuantity(dailyPlanId, quantity, version, normalizedOperator(operator))
|
||||||
: dailyPlanMapper.increaseSleevedQuantity(dailyPlanId, quantity, plan.getVersion(), normalizedOperator(operator));
|
: dailyPlanMapper.increaseSleevedQuantity(dailyPlanId, quantity, version, normalizedOperator(operator));
|
||||||
if (affected != 1) {
|
if (affected != 1) {
|
||||||
throw exception(DAILY_PLAN_VERSION_CONFLICT);
|
throw exception(DAILY_PLAN_VERSION_CONFLICT);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user