【update】行程单查询返回格式修改

This commit is contained in:
nixj 2024-05-27 13:38:29 +08:00
parent bd97a78306
commit 1c73039ac7
2 changed files with 12 additions and 16 deletions

View File

@ -14,9 +14,9 @@ public class ItineraryPageDto {
private Long routeId; private Long routeId;
//差旅订单单号 //差旅订单单号
private String routeOrderNo; 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; 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 LocalDateTime endTime;
private String userId; private String userId;
private String userName; private String userName;
@ -25,18 +25,16 @@ public class ItineraryPageDto {
//申请说明 //申请说明
private String instructions; private String instructions;
private String actualOrderNo; private String actualOrderNo;
private List<ApprovalEvent> approveEvents; // private List<ApprovalEvent> approveEvents;
private String approvalStatus; private String approvalStatus;
private List<Leg> legItems;
//差旅订单总价值 //差旅订单总价值
private List<LocationRes> locationResList; private List<LocationRes> locationResList;
public String getApprovalStatus() { public String getApprovalStatus(List<ApprovalEvent> approveEvents) {
if (this.approveEvents != null && !this.approveEvents.isEmpty()) { if (approveEvents != null && !approveEvents.isEmpty()) {
ApprovalEvent lastApprovalEvent = getLastApprovalEvent(); ApprovalEvent lastApprovalEvent = getLastApprovalEvent(approveEvents);
if (lastApprovalEvent != null) { if (lastApprovalEvent != null) {
lastApprovalEvent.reloadStatus(); lastApprovalEvent.reloadStatus();
this.approvalStatus = lastApprovalEvent.getEventName(); this.approvalStatus = lastApprovalEvent.getEventName();
@ -44,7 +42,7 @@ public class ItineraryPageDto {
} }
return approvalStatus; return approvalStatus;
} }
private ApprovalEvent getLastApprovalEvent() { private ApprovalEvent getLastApprovalEvent(List<ApprovalEvent> approveEvents) {
return this.approveEvents.isEmpty() ? null : this.approveEvents.get(this.approveEvents.size() - 1); return approveEvents.isEmpty() ? null : approveEvents.get(approveEvents.size() - 1);
} }
} }

View File

@ -108,11 +108,10 @@ public class ManageServiceImpl implements ManageService {
.stream() .stream()
.map(routeOrder -> { .map(routeOrder -> {
RouteOrder order=routeOrders.stream().filter(s->s.getRouteId().equals(routeOrder.getRouteId())).toList().get(0); RouteOrder order=routeOrders.stream().filter(s->s.getRouteId().equals(routeOrder.getRouteId())).toList().get(0);
routeOrder.setApproveEvents(order.getApproveEvents()); legDomainService.queryLocation(order.getLegItems());
routeOrder.setLegItems(order.getLegItems()); routeOrder.setApprovalStatus(routeOrder.getApprovalStatus(order.getApproveEvents()));
legDomainService.queryLocation(routeOrder.getLegItems());
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
return getRouteOrderPageRes(routeOrder, user); return getRouteOrderPageRes(routeOrder, user,order.getLegItems());
}) })
.toList(); .toList();
return PageResult.totalPageNum(page.getTotalElements(), orders); return PageResult.totalPageNum(page.getTotalElements(), orders);
@ -148,8 +147,7 @@ public class ManageServiceImpl implements ManageService {
return excelList; return excelList;
} }
private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user) { private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user,List<Leg> legItems) {
List<Leg> legItems=res.getLegItems();
List<LocationRes> locationRes = legItems List<LocationRes> locationRes = legItems
.stream() .stream()
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))