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

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")
protected String EndCountryCode;
@JsonProperty("EndCountryName")
protected String EndCountryName;
@JsonProperty("RealScheduleNum")
protected String RealScheduleNum;
@JsonProperty("NightCount")
protected String NightCount;
@JsonProperty("RoomCount")
protected String RoomCount;
@JsonProperty("AmountTypeName")
private String amountTypeName;
@JsonProperty("AmountTypeEnName")
@ -136,6 +133,14 @@ public class ScheduleDetail {
private String destinationDescription;
@JsonProperty("EstimatedAmount")
private String estimatedAmount;
@JsonProperty("travelType")
private String travelType;
@JsonProperty("expenseTypeId")
private String expenseTypeId;
@JsonProperty("LocationList")
@Transient
private List<LocationRes> locationList;
@ -150,6 +155,16 @@ public class 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) {
scheduleDetail.setServiceProvider(serviceProvider);
return this;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,19 @@
package com.chint.domain.aggregates.order;
import com.chint.domain.aggregates.base.BaseEvent;
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;
import java.time.LocalDateTime;
import java.util.Map;
import static com.chint.infrastructure.constant.RouteRequestConstant.*;
@Data
@Table("route_request_event")
public class RouteRequestEvent implements Serializable {
public class RouteRequestEvent extends BaseEvent implements Serializable {
@Serial
private static final long serialVersionUID = 5421219887361331990L;
@ -21,10 +24,10 @@ public class RouteRequestEvent implements Serializable {
private Long routeRequestKey;
private Integer eventType;
private String extension;
private LocalDateTime happenTime;
@Override
protected Map<Integer, String> getStatusMappings() {
return Map.of(ROUTE_REQUEST_STATUS_PREPARE, ROUTE_REQUEST_STATUS_PREPARE_NAME,
ROUTE_REQUEST_STATUS_SYNC, ROUTE_REQUEST_STATUS_SYNC_NAME,
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();
}
@Override
public boolean cancelSyncSupplierOrder(RouteOrder order) {
log.info("开始取消协程订单");
@ -79,6 +80,16 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
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) {
ApproveOrderNo approveOrderNo = order.getApproveOrderNo();

View File

@ -51,6 +51,11 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
return flag;
}
@Override
public boolean syncRouteRequest(RouteRequest routeRequest) {
return false;
}
@Override
public boolean cancelSyncSupplierOrder(RouteOrder order) {
//作废状态2
@ -61,6 +66,11 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
return flag;
}
@Override
public boolean cancelRouteRequest(RouteRequest routeRequest) {
return false;
}
//同步同程订单
private Boolean synchronization(RouteOrder order, String tag) {
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.RouteRequest;
import com.chint.domain.factoriy.order.RouteOrderFactory;
public interface SupplierOrderSync {
boolean syncSupplierOrder(RouteOrder order);
boolean syncRouteRequest(RouteRequest routeRequest);
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 = "已取消";
}