修改查询已同步行程节点的接口查询逻辑
This commit is contained in:
parent
7269918196
commit
13678aea14
|
@ -42,6 +42,8 @@ public class LegRes {
|
|||
private String originDescription;
|
||||
@ApiModelProperty("目的地详细")
|
||||
private String destinationDescription;
|
||||
private String supplier;
|
||||
private String supplierName;
|
||||
private Integer legStatus;
|
||||
private String changeReason;
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ public class OrderOutController {
|
|||
List<LegRes> legResList = legDomainService
|
||||
.queryLegsCanSync(routeOrder, queryData.getSupplierName()).stream().map(LegRes::copyFrom).toList();
|
||||
legResList.forEach(it -> it.setUserName(userRepository.findByUserEmployeeNo(routeOrder.getUserId()).getName()));
|
||||
legDomainService.getSupplierName(legResList,routeOrder);
|
||||
return Result.Success(SUCCESS, legResList);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
import com.chint.domain.aggregates.base.BaseEvent;
|
||||
import com.chint.domain.aggregates.base.EventManageable;
|
||||
import com.chint.infrastructure.constant.SupplierNameConstant;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -18,6 +19,8 @@ import java.time.LocalDateTime;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
|
||||
|
||||
@Data
|
||||
@Table("route_request")
|
||||
public class RouteRequest implements Serializable, EventManageable {
|
||||
|
@ -48,6 +51,8 @@ public class RouteRequest implements Serializable, EventManageable {
|
|||
private Integer status;
|
||||
@Transient
|
||||
private String statusName;
|
||||
@Transient
|
||||
private String supplierName;
|
||||
|
||||
@CreatedDate
|
||||
@ApiModelProperty("创建时间")
|
||||
|
@ -71,6 +76,7 @@ public class RouteRequest implements Serializable, EventManageable {
|
|||
BaseEvent lastEvent = this.getLastEvent().reloadStatus();
|
||||
this.status = lastEvent.getEventType();
|
||||
this.statusName = lastEvent.getEventName();
|
||||
this.setSupplierName(translateSupplierName(this.supplier));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -79,4 +85,12 @@ public class RouteRequest implements Serializable, EventManageable {
|
|||
this.setRouteRequestLegList(routeRequestLegs);
|
||||
return this;
|
||||
}
|
||||
|
||||
private String translateSupplierName(String supplier) {
|
||||
return switch (supplier) {
|
||||
case SUPPLIER_L_Y -> SUPPLIER_L_Y_CN_NAME;
|
||||
case SUPPLIER_C_TRIP -> SUPPLIER_C_TRIP_CN_NAME;
|
||||
default -> "未知供应商";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.domain.service;
|
||||
|
||||
import com.chint.application.dtos.response.LegRes;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.exceptions.LegEventException;
|
||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||
|
@ -19,7 +20,6 @@ import static com.chint.infrastructure.constant.OrderConstant.*;
|
|||
import static com.chint.infrastructure.constant.RouteConstant.APPROVAL_EVENT_PREPARE;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
|
||||
import static com.chint.infrastructure.constant.RouteRequestConstant.ROUTE_REQUEST_STATUS_SYNC;
|
||||
import static com.chint.infrastructure.constant.RouteRequestConstant.ROUTE_REQUEST_STATUS_SYNC_NAME;
|
||||
|
||||
@Service
|
||||
public class LegDomainService {
|
||||
|
@ -161,6 +161,7 @@ public class LegDomainService {
|
|||
public List<Leg> queryLegsCanSync(RouteOrder routeOrder, String supplierName) {
|
||||
List<Leg> legItems = routeOrder.getLegItems();
|
||||
legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList();
|
||||
|
||||
if (supplierName.equals("CTrip")) {
|
||||
legItems = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_TRAIN)).toList();
|
||||
}
|
||||
|
@ -193,4 +194,25 @@ public class LegDomainService {
|
|||
queryLocation(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<LegRes> getSupplierName(List<LegRes> legResList, RouteOrder routeOrder) {
|
||||
List<RouteRequest> routeRequestList = routeOrder.getRouteRequestList()
|
||||
.stream()
|
||||
.filter(it -> it.reloadStatus().getStatus().equals(ROUTE_REQUEST_STATUS_SYNC))
|
||||
.toList();
|
||||
for (LegRes legRes : legResList) {
|
||||
for (RouteRequest routeRequest : routeRequestList) {
|
||||
List<Long> legIds = routeRequest
|
||||
.getRouteRequestLegList()
|
||||
.stream()
|
||||
.map(RouteRequestLeg::getLegId)
|
||||
.toList();
|
||||
if (legIds.contains(legRes.getLegId())) {
|
||||
legRes.setSupplier(routeRequest.getSupplier());
|
||||
legRes.setSupplierName(routeRequest.getSupplierName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return legResList;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue