From 1c73039ac77092b4aacb3b76b84ff805b740ab1e Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 27 May 2024 13:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=E8=A1=8C=E7=A8=8B?= =?UTF-8?q?=E5=8D=95=E6=9F=A5=E8=AF=A2=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/entity/dto/ItineraryPageDto.java | 18 ++++++++---------- .../manage/service/impl/ManageServiceImpl.java | 10 ++++------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java index 85d034ed..94ec51e1 100644 --- a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java +++ b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java @@ -14,9 +14,9 @@ public class ItineraryPageDto { private Long routeId; //差旅订单单号 private String routeOrderNo; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime startTime; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private LocalDateTime endTime; private String userId; private String userName; @@ -25,18 +25,16 @@ public class ItineraryPageDto { //申请说明 private String instructions; private String actualOrderNo; - private List approveEvents; +// private List approveEvents; private String approvalStatus; - private List legItems; - //差旅订单总价值 private List locationResList; - public String getApprovalStatus() { - if (this.approveEvents != null && !this.approveEvents.isEmpty()) { - ApprovalEvent lastApprovalEvent = getLastApprovalEvent(); + public String getApprovalStatus(List approveEvents) { + if (approveEvents != null && !approveEvents.isEmpty()) { + ApprovalEvent lastApprovalEvent = getLastApprovalEvent(approveEvents); if (lastApprovalEvent != null) { lastApprovalEvent.reloadStatus(); this.approvalStatus = lastApprovalEvent.getEventName(); @@ -44,7 +42,7 @@ public class ItineraryPageDto { } return approvalStatus; } - private ApprovalEvent getLastApprovalEvent() { - return this.approveEvents.isEmpty() ? null : this.approveEvents.get(this.approveEvents.size() - 1); + private ApprovalEvent getLastApprovalEvent(List approveEvents) { + return approveEvents.isEmpty() ? null : approveEvents.get(approveEvents.size() - 1); } } diff --git a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java index d3eefd9e..062a557e 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -108,11 +108,10 @@ public class ManageServiceImpl implements ManageService { .stream() .map(routeOrder -> { RouteOrder order=routeOrders.stream().filter(s->s.getRouteId().equals(routeOrder.getRouteId())).toList().get(0); - routeOrder.setApproveEvents(order.getApproveEvents()); - routeOrder.setLegItems(order.getLegItems()); - legDomainService.queryLocation(routeOrder.getLegItems()); + legDomainService.queryLocation(order.getLegItems()); + routeOrder.setApprovalStatus(routeOrder.getApprovalStatus(order.getApproveEvents())); User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); - return getRouteOrderPageRes(routeOrder, user); + return getRouteOrderPageRes(routeOrder, user,order.getLegItems()); }) .toList(); return PageResult.totalPageNum(page.getTotalElements(), orders); @@ -148,8 +147,7 @@ public class ManageServiceImpl implements ManageService { return excelList; } - private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user) { - List legItems=res.getLegItems(); + private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user,List legItems) { List locationRes = legItems .stream() .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))