Showing
1 changed file
with
5 additions
and
2 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,12 +115,16 @@ public class MealOrderServiceImpl implements MealOrderService { | ... | @@ -116,12 +115,16 @@ 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()) { |
| 118 | + // 校验每个订餐日期是否在停餐时间段内 | ||
| 119 | + for (var meal : createMealOrderDTO.getMeals()) { | ||
| 120 | + final long mealDateMs = DateUtil.parseDate(meal.getDate()).getTime(); | ||
| 119 | final boolean inSuspension = intervals.stream() | 121 | final boolean inSuspension = intervals.stream() |
| 120 | - .anyMatch(i -> nowMs >= i.startAt && nowMs <= i.endAt); | 122 | + .anyMatch(i -> mealDateMs >= i.startAt && mealDateMs <= i.endAt); |
| 121 | if (inSuspension) { | 123 | if (inSuspension) { |
| 122 | throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.DINER_MEAL_SUSPENDED); | 124 | throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.DINER_MEAL_SUSPENDED); |
| 123 | } | 125 | } |
| 124 | } | 126 | } |
| 127 | + } | ||
| 125 | 128 | ||
| 126 | // 6. 校验菜单信息 | 129 | // 6. 校验菜单信息 |
| 127 | final var latestMealMenuRecords = mealOrderServiceRpcClient.queryLatestMealMenuRecordsByClientIds(loginInfo.getEnterpriseId(), Collections.singletonList(dinerById.getClientId())); | 130 | final var latestMealMenuRecords = mealOrderServiceRpcClient.queryLatestMealMenuRecordsByClientIds(loginInfo.getEnterpriseId(), Collections.singletonList(dinerById.getClientId())); | ... | ... |
-
Please register or login to post a comment