修改签证回传给财务共享的参数

This commit is contained in:
lulz1 2024-04-08 09:10:28 +08:00
parent 35e4a71cfb
commit f891922bee
11 changed files with 140 additions and 40 deletions

View File

@ -113,17 +113,14 @@ public class ScheduleDetail {
@JsonProperty("EndCountryCode") @JsonProperty("EndCountryCode")
protected String EndCountryCode; protected String EndCountryCode;
@JsonProperty("EndCountryName") @JsonProperty("EndCountryName")
protected String EndCountryName; protected String EndCountryName;
@JsonProperty("RealScheduleNum") @JsonProperty("RealScheduleNum")
protected String RealScheduleNum; protected String RealScheduleNum;
@JsonProperty("NightCount") @JsonProperty("NightCount")
protected String NightCount; protected String NightCount;
@JsonProperty("RoomCount") @JsonProperty("RoomCount")
protected String RoomCount; protected String RoomCount;
@JsonProperty("AmountTypeName") @JsonProperty("AmountTypeName")
private String amountTypeName; private String amountTypeName;
@JsonProperty("AmountTypeEnName") @JsonProperty("AmountTypeEnName")
@ -136,6 +133,14 @@ public class ScheduleDetail {
private String destinationDescription; private String destinationDescription;
@JsonProperty("EstimatedAmount") @JsonProperty("EstimatedAmount")
private String estimatedAmount; private String estimatedAmount;
@JsonProperty("travelType")
private String travelType;
@JsonProperty("expenseTypeId")
private String expenseTypeId;
@JsonProperty("LocationList") @JsonProperty("LocationList")
@Transient @Transient
private List<LocationRes> locationList; private List<LocationRes> locationList;
@ -150,6 +155,16 @@ public class ScheduleDetail {
private ScheduleDetail scheduleDetail = new ScheduleDetail(); private ScheduleDetail scheduleDetail = new ScheduleDetail();
public ScheduleDetailBuilder expenseTypeId(String expenseTypeId) {
scheduleDetail.setExpenseTypeId(expenseTypeId);
return this;
}
public ScheduleDetailBuilder travelType(String travelType) {
scheduleDetail.setTravelType(travelType);
return this;
}
public ScheduleDetailBuilder serviceProvider(String serviceProvider) { public ScheduleDetailBuilder serviceProvider(String serviceProvider) {
scheduleDetail.setServiceProvider(serviceProvider); scheduleDetail.setServiceProvider(serviceProvider);
return this; return this;

View File

@ -35,11 +35,11 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.chint.infrastructure.constant.FSSCConstant.*; import static com.chint.infrastructure.constant.FSSCConstant.*;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL; import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_CITY; import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_CITY;
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY; import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
import static com.chint.infrastructure.constant.OrderConstant.*; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME;
import static com.chint.infrastructure.constant.RouteConstant.*; import static com.chint.infrastructure.constant.RouteConstant.*;
@Service @Service
@ -153,8 +153,8 @@ public class OrderQuery {
.toList(); .toList();
//这里按照业务要求尝试进行自动确认结束行程 //这里按照业务要求尝试进行自动确认结束行程
orders.forEach(it->{ orders.forEach(it -> {
if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_STATUS_FINISH)){ if (it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_STATUS_FINISH)) {
orderDomainService.finishOrder(it.getRouteId()); orderDomainService.finishOrder(it.getRouteId());
} }
}); });
@ -377,8 +377,6 @@ public class OrderQuery {
.type(FSSCConstant.TRIP_CALLBACK_TYPE_APPROVE); .type(FSSCConstant.TRIP_CALLBACK_TYPE_APPROVE);
List<Location> locationListAfterNotNull = locationList.stream().filter(Objects::nonNull).toList(); List<Location> locationListAfterNotNull = locationList.stream().filter(Objects::nonNull).toList();
// List<CityEntity> cityEntities = new ArrayList<>();
for (Location location : locationListAfterNotNull) { for (Location location : locationListAfterNotNull) {
if (location.getLocationEnName() == null) { if (location.getLocationEnName() == null) {
@ -398,10 +396,6 @@ public class OrderQuery {
} }
locationRepository.saveAll(List.of(location)); locationRepository.saveAll(List.of(location));
} }
// CityEntity city = cityRepository.findByCityName(location.getLocationName());
// cityEntities.add(city);
callbackDataBuilder.cityList() callbackDataBuilder.cityList()
.cityName(location.getLocationName()) .cityName(location.getLocationName())
.cityEnName(location.getLocationEnName()) .cityEnName(location.getLocationEnName())
@ -411,18 +405,12 @@ public class OrderQuery {
List<ScheduleDetail> scheduleDetails = legItems.stream() List<ScheduleDetail> scheduleDetails = legItems.stream()
.map(leg -> { .map(leg -> {
leg.reloadStatus(); leg.reloadStatus();
// CityEntity originCity;
// CityEntity destinationCity;
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail
.builder() .builder()
.legId(leg.getLegId()); .legId(leg.getLegId());
if (!leg.getLegType().equals(LEG_TYPE_OTHER)) { if (!leg.getLegType().equals(LEG_TYPE_OTHER)) {
Location originLocation = leg.getOriginLocation(); Location originLocation = leg.getOriginLocation();
if (originLocation != null) { if (originLocation != null) {
// originCity = cityEntities.stream().filter(cityEntity -> cityEntity
// .getCityName()
// .equals(leg.getOriginLocation().getLocationName()))
// .findFirst().orElseThrow(() -> new NotFoundException(NOT_FOUND));
scheduleDetailBuilder scheduleDetailBuilder
.startCity(originLocation.getLocationName()) .startCity(originLocation.getLocationName())
.startCityName(originLocation.getLocationName()) .startCityName(originLocation.getLocationName())
@ -444,6 +432,11 @@ public class OrderQuery {
.nightCount(leg.nightCount().toString()); .nightCount(leg.nightCount().toString());
} }
if (leg.getLegType().equals(LEG_TYPE_OTHER) && leg.getLegExtensionField().getAmountType().equals(LEG_OTHER_AMOUNT_TYPE_VISA)) {
scheduleDetailBuilder.expenseTypeId("6770f575013211eabce29fde958f48e4")
.travelType("LOCAL_OTHER");
}
if (leg.getCurrencyType() != null) { if (leg.getCurrencyType() != null) {
scheduleDetailBuilder scheduleDetailBuilder
.currencyName(leg.getCurrencyType().getDescription()) .currencyName(leg.getCurrencyType().getDescription())

View File

@ -2,17 +2,24 @@ package com.chint.domain.aggregates.base;
import lombok.Data; import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@Data @Data
public abstract class BaseEvent { public abstract class BaseEvent implements Serializable {
@Serial
private static final long serialVersionUID = 2131240986128456190L;
private Integer eventType; private Integer eventType;
private transient String eventName; private transient String eventName;
private LocalDateTime happenTime; private LocalDateTime happenTime = LocalDateTime.now();
private String extension;
// 新增抽象方法获取状态码与状态名称的映射表 // 新增抽象方法获取状态码与状态名称的映射表
protected abstract Map<Integer, String> getStatusMappings(); protected abstract Map<Integer, String> getStatusMappings();

View File

@ -1,23 +1,21 @@
package com.chint.domain.aggregates.base; package com.chint.domain.aggregates.base;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException;
public interface EventManageable { public interface EventManageable {
// 抽象方法获取事件列表 // 抽象方法获取事件列表
List<BaseEvent> getEvents(); List<? extends BaseEvent> getEvents();
// 默认方法添加事件 // 默认方法添加事件
default void addEvent(BaseEvent event) { default void addEvent(BaseEvent event) {
getEvents().add(event); List<BaseEvent> events = (List<BaseEvent>) getEvents();
events.add(event);
} }
// 默认方法获取最新的事件 // 默认方法获取最新的事件
default BaseEvent getLastEvent() { default BaseEvent getLastEvent() {
return getEvents().stream() List<? extends BaseEvent> eventList = getEvents();
.max(Comparator.comparing(BaseEvent::getHappenTime)) return eventList.isEmpty() ? null : eventList.get(eventList.size() - 1);
.orElseThrow(() -> new NoSuchElementException("No events found."));
} }
} }

View File

@ -1,7 +1,6 @@
package com.chint.domain.aggregates.order; package com.chint.domain.aggregates.order;
import com.chint.domain.aggregates.base.BaseEntity; import com.chint.domain.aggregates.base.EventManageable;
import com.chint.domain.aggregates.base.BaseTimeEntity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -19,7 +18,7 @@ import java.util.List;
@Data @Data
@Table("route_request") @Table("route_request")
public class RouteRequest implements Serializable { public class RouteRequest implements Serializable, EventManageable {
@Serial @Serial
private static final long serialVersionUID = 7125989663091861990L; private static final long serialVersionUID = 7125989663091861990L;
@ -32,12 +31,15 @@ public class RouteRequest implements Serializable {
private String RouteRequestNo; private String RouteRequestNo;
@MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key") @MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key")
private List<RouteRequestLeg> routeRequestLegList; private List<RouteRequestLeg> routeRequestLegList;
@MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key") @MappedCollection(idColumn = "route_request_id", keyColumn = "route_request_key")
private List<RouteRequestEvent> eventList; private List<RouteRequestEvent> eventList;
@MappedCollection(idColumn = "route_request_id")
private RouteRequestFields routeRequestFields;
@Transient @Transient
private String supplier; private String supplier;
@Transient @Transient
@ -54,4 +56,9 @@ public class RouteRequest implements Serializable {
@ApiModelProperty("最后更新时间") @ApiModelProperty("最后更新时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
public LocalDateTime updateTime; public LocalDateTime updateTime;
@Override
public List<RouteRequestEvent> getEvents() {
return this.eventList;
}
} }

View File

@ -1,16 +1,19 @@
package com.chint.domain.aggregates.order; package com.chint.domain.aggregates.order;
import com.chint.domain.aggregates.base.BaseEvent;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.util.Map;
import static com.chint.infrastructure.constant.RouteRequestConstant.*;
@Data @Data
@Table("route_request_event") @Table("route_request_event")
public class RouteRequestEvent implements Serializable { public class RouteRequestEvent extends BaseEvent implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 5421219887361331990L; private static final long serialVersionUID = 5421219887361331990L;
@ -21,10 +24,10 @@ public class RouteRequestEvent implements Serializable {
private Long routeRequestKey; private Long routeRequestKey;
private Integer eventType; @Override
protected Map<Integer, String> getStatusMappings() {
private String extension; return Map.of(ROUTE_REQUEST_STATUS_PREPARE, ROUTE_REQUEST_STATUS_PREPARE_NAME,
ROUTE_REQUEST_STATUS_SYNC, ROUTE_REQUEST_STATUS_SYNC_NAME,
private LocalDateTime happenTime; ROUTE_REQUEST_STATUS_CANCEL, ROUTE_REQUEST_STATUS_CANCEL_NAME);
}
} }

View File

@ -0,0 +1,42 @@
package com.chint.domain.aggregates.order;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial;
import java.io.Serializable;
@Data
@Table("route_request_fields")
public class RouteRequestFields implements Serializable {
@Serial
private static final long serialVersionUID = 1231256770986228990L;
@Id
private Long id;
private Long routeRequestId;
@ApiModelProperty("差表等级")
private String standardLevel;
@ApiModelProperty("系统标识")
private String sysCode;
@ApiModelProperty("实际单号")
private String actualOrderNo;
@ApiModelProperty("入账公司编码")
private String accountCompany;
@ApiModelProperty("入账公司名称")
private String accountCompanyName;
@ApiModelProperty("入账公司64位编码")
private String accountCompanyCode;
@ApiModelProperty("项目名称")
private String projectName;
@ApiModelProperty("成本中心")
private String costCenter;
@ApiModelProperty("申请说明")
private String instructions;
@ApiModelProperty("财务共享订单创建人")
private String creator;
@ApiModelProperty("申请人")
private String userId;
}

View File

@ -71,6 +71,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
return approval.getSetApprovalResult().getStatus().getSuccess(); return approval.getSetApprovalResult().getStatus().getSuccess();
} }
@Override @Override
public boolean cancelSyncSupplierOrder(RouteOrder order) { public boolean cancelSyncSupplierOrder(RouteOrder order) {
log.info("开始取消协程订单"); log.info("开始取消协程订单");
@ -79,6 +80,16 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
return approval.getSetApprovalResult().getStatus().getSuccess(); return approval.getSetApprovalResult().getStatus().getSuccess();
} }
@Override
public boolean syncRouteRequest(RouteRequest routeRequest) {
return false;
}
@Override
public boolean cancelRouteRequest(RouteRequest routeRequest) {
return false;
}
private ApprovalRequest getApprovalRequestParam(RouteOrder order) { private ApprovalRequest getApprovalRequestParam(RouteOrder order) {
ApproveOrderNo approveOrderNo = order.getApproveOrderNo(); ApproveOrderNo approveOrderNo = order.getApproveOrderNo();

View File

@ -51,6 +51,11 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
return flag; return flag;
} }
@Override
public boolean syncRouteRequest(RouteRequest routeRequest) {
return false;
}
@Override @Override
public boolean cancelSyncSupplierOrder(RouteOrder order) { public boolean cancelSyncSupplierOrder(RouteOrder order) {
//作废状态2 //作废状态2
@ -61,6 +66,11 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
return flag; return flag;
} }
@Override
public boolean cancelRouteRequest(RouteRequest routeRequest) {
return false;
}
//同步同程订单 //同步同程订单
private Boolean synchronization(RouteOrder order, String tag) { private Boolean synchronization(RouteOrder order, String tag) {
String supplierOrderSyncUrl = lyBaseUrl + L_Y_ORDER_PATH;//请求地址 String supplierOrderSyncUrl = lyBaseUrl + L_Y_ORDER_PATH;//请求地址

View File

@ -2,10 +2,14 @@ package com.chint.domain.service.order_sync;
import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.RouteRequest;
import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.factoriy.order.RouteOrderFactory;
public interface SupplierOrderSync { public interface SupplierOrderSync {
boolean syncSupplierOrder(RouteOrder order); boolean syncSupplierOrder(RouteOrder order);
boolean syncRouteRequest(RouteRequest routeRequest);
boolean cancelSyncSupplierOrder(RouteOrder order); boolean cancelSyncSupplierOrder(RouteOrder order);
boolean cancelRouteRequest(RouteRequest routeRequest);
} }

View File

@ -0,0 +1,10 @@
package com.chint.infrastructure.constant;
public class RouteRequestConstant {
public static final int ROUTE_REQUEST_STATUS_PREPARE = 0;
public static final String ROUTE_REQUEST_STATUS_PREPARE_NAME = "未同步";
public static final int ROUTE_REQUEST_STATUS_SYNC = 1;
public static final String ROUTE_REQUEST_STATUS_SYNC_NAME = "已同步";
public static final int ROUTE_REQUEST_STATUS_CANCEL = 2;
public static final String ROUTE_REQUEST_STATUS_CANCEL_NAME = "已取消";
}