|
|
@@ -52,7 +52,7 @@ public class MealApplicationsController {
|
|
|
}
|
|
|
QueryWrapper<MealApplications> eq = new QueryWrapper<MealApplications>().eq("user_id", userId).eq("meal_type_id", mealType).eq("factory_id", factory).eq("application_date", LocalDate.now());
|
|
|
List<MealApplications> list = mealApplicationsService.list(eq);
|
|
|
- Optional<MealApplications> first = list.stream().filter(mealApplications -> mealApplications.getStatus().equals("0")).findFirst();
|
|
|
+ Optional<MealApplications> first = list.stream().filter(mealApplications -> mealApplications.getStatus()==0).findFirst();
|
|
|
if (first.isPresent()){
|
|
|
return msg.fail("已申报过");
|
|
|
}
|
|
|
@@ -108,8 +108,8 @@ public class MealApplicationsController {
|
|
|
public HttpRespMsg cancelMeal(HttpServletRequest request,String mealType, String factory,String reason){
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
// LocalDateTime now = LocalDateTime.now();
|
|
|
- UpdateWrapper<MealApplications> eq = new UpdateWrapper<MealApplications>().set("status", "2").set("cancelled_at",LocalDateTime.now()).set("cancel_reason", reason)
|
|
|
- .eq("user_id", request.getHeader("token")).eq("meal_type_id", mealType).eq("factory_id", factory).eq("application_date", LocalDate.now()).eq("status", "0")
|
|
|
+ UpdateWrapper<MealApplications> eq = new UpdateWrapper<MealApplications>().set("status", 2).set("cancelled_at",LocalDateTime.now()).set("cancel_reason", reason)
|
|
|
+ .eq("user_id", request.getHeader("token")).eq("meal_type_id", mealType).eq("factory_id", factory).eq("application_date", LocalDate.now()).eq("status", 0)
|
|
|
.orderByDesc("applied_at").last("limit 1");
|
|
|
boolean update = mealApplicationsService.update(eq);
|
|
|
if(update){
|