Showing
1 changed file
with
8 additions
and
5 deletions
| ... | @@ -108,7 +108,6 @@ public class MealOrderServiceImpl implements MealOrderService { | ... | @@ -108,7 +108,6 @@ public class MealOrderServiceImpl implements MealOrderService { |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | // 5. 校验停餐记录(学校/班级/学生三个维度最新记录的多段并集区间) | 110 | // 5. 校验停餐记录(学校/班级/学生三个维度最新记录的多段并集区间) |
| 111 | - final long nowMs = System.currentTimeMillis(); | ||
| 112 | final var intervals = suspensionService.getSuspensionIntervalsForDiner( | 111 | final var intervals = suspensionService.getSuspensionIntervalsForDiner( |
| 113 | loginInfo.getEnterpriseId(), | 112 | loginInfo.getEnterpriseId(), |
| 114 | dinerById.getClientId(), | 113 | dinerById.getClientId(), |
| ... | @@ -116,10 +115,14 @@ public class MealOrderServiceImpl implements MealOrderService { | ... | @@ -116,10 +115,14 @@ public class MealOrderServiceImpl implements MealOrderService { |
| 116 | dinerById.getId() | 115 | dinerById.getId() |
| 117 | ); | 116 | ); |
| 118 | if (intervals != null && !intervals.isEmpty()) { | 117 | if (intervals != null && !intervals.isEmpty()) { |
| 119 | - final boolean inSuspension = intervals.stream() | 118 | + // 校验每个订餐日期是否在停餐时间段内 |
| 120 | - .anyMatch(i -> nowMs >= i.startAt && nowMs <= i.endAt); | 119 | + for (var meal : createMealOrderDTO.getMeals()) { |
| 121 | - if (inSuspension) { | 120 | + final long mealDateMs = DateUtil.parseDate(meal.getDate()).getTime(); |
| 122 | - throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.DINER_MEAL_SUSPENDED); | 121 | + final boolean inSuspension = intervals.stream() |
| 122 | + .anyMatch(i -> mealDateMs >= i.startAt && mealDateMs <= i.endAt); | ||
| 123 | + if (inSuspension) { | ||
| 124 | + throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.DINER_MEAL_SUSPENDED); | ||
| 125 | + } | ||
| 123 | } | 126 | } |
| 124 | } | 127 | } |
| 125 | 128 | ... | ... |
-
Please register or login to post a comment