【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 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<ApprovalEvent> approveEvents;
// private List<ApprovalEvent> approveEvents;
private String approvalStatus;
private List<Leg> legItems;
//差旅订单总价值
private List<LocationRes> locationResList;
public String getApprovalStatus() {
if (this.approveEvents != null && !this.approveEvents.isEmpty()) {
ApprovalEvent lastApprovalEvent = getLastApprovalEvent();
public String getApprovalStatus(List<ApprovalEvent> 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<ApprovalEvent> approveEvents) {
return approveEvents.isEmpty() ? null : approveEvents.get(approveEvents.size() - 1);
}
}

View File

@ -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<Leg> legItems=res.getLegItems();
private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user,List<Leg> legItems) {
List<LocationRes> locationRes = legItems
.stream()
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))