wang.shanshan

add today

......@@ -21,6 +21,7 @@ public class MealOrderDTO {
@NotNull(message = "status不能为空")
private QueryMealOrderStatusEnum status;
private String today;
}
@Data
......
......@@ -25,6 +25,7 @@ import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
......@@ -50,7 +51,13 @@ public class MealOrderServiceImpl implements MealOrderService {
public List<MealOrderVO> queryMealOrders(MealOrderDTO.QueryMealOrderDTO queryMealOrderDTO) {
final var loginInfo = LoginContextHolder.getLoginInfo();
var mealOrderRpcResponses = mealOrderServiceRpcClient.queryMealOrdersByCondition(loginInfo.getEnterpriseId(), List.of(loginInfo.getId()), null, null);
final var today = LocalDate.now();
LocalDate today = LocalDate.now();
if (queryMealOrderDTO.getToday() != null) {
final var todayDate = DateUtil.parseDate(queryMealOrderDTO.getToday());
if (todayDate != null) {
today = todayDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
}
final var lastWeekStart = today.minusWeeks(1).with(DayOfWeek.MONDAY).atStartOfDay().atZone(DateUtil.CHINA_ZONE).toInstant().toEpochMilli();
final var lastWeekEnd = today.minusWeeks(1).with(DayOfWeek.SUNDAY).atTime(LocalTime.MAX).atZone(DateUtil.CHINA_ZONE).toInstant().toEpochMilli();
final var thisWeekStart = today.with(DayOfWeek.MONDAY).atStartOfDay().atZone(DateUtil.CHINA_ZONE).toInstant().toEpochMilli();
......