同步代码

This commit is contained in:
lulz1 2024-03-02 15:54:07 +08:00
parent 25ce2b3b9c
commit 5fc2d46236
10 changed files with 48 additions and 15 deletions

View File

@ -3,6 +3,7 @@ package com.chint.application.dtos.response;
import com.chint.domain.aggregates.order.ApproveOrderNo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Column;
@ -41,5 +42,6 @@ public class RouteOrderPageRes {
private String endTime;
private String supplierName;
private String supplierCNName;
@ApiModelProperty("是否为有火车的订单0无1有")
private String ifHaveTrainLeg;
}

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.CommonMessageConstant.SYNC_FAILURE_TRAIN;
@RestController
@RequestMapping("/order")
@ -82,7 +83,7 @@ public class OrderController {
@Transactional
@ApiOperation("修改行程节点")
@PostMapping("/leg/change/")
@PostMapping("/leg/change")
public Result<String> changeLeg(@RequestBody AddLegData addLegData) {
orderApplicationService.changeLeg(addLegData);
return Result.Success(SUCCESS);
@ -101,7 +102,10 @@ public class OrderController {
@ApiOperation("同步行程规划单的订单状态")
@PostMapping("/sync/order")
public Result<String> reloadOrderDetail(@RequestBody SyncLegData syncLegData) {
orderDetailDomainService.syncOrderDetailStatusByRouteId(syncLegData.getRouteId());
return Result.Success(SUCCESS);
if (orderDetailDomainService.syncOrderDetailStatusByRouteId(syncLegData.getRouteId())) {
return Result.Success(SUCCESS);
} else {
return Result.error(SYNC_FAILURE_TRAIN);
}
}
}

View File

@ -25,6 +25,7 @@ public class FSSCController {
public Result<LoginResponse> loginToFSSC() {
User currentUser = BaseContext.getCurrentUser();
String companyCode = currentUser.getCompanyCode();//公司编号
//这里需要根据companyCode进行匹配到正确的申请单网址

View File

@ -151,6 +151,13 @@ public class OrderQuery {
User currentUser = BaseContext.getCurrentUser();
RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class);
List<Leg> legItems = routeOrder.getLegItems();
if (routeOrder.checkIfHaveTrainLeg()) {
res.setIfHaveTrainLeg("1");
} else {
res.setIfHaveTrainLeg("0");
}
List<LocationRes> locationRes = legItems
.stream()
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))

View File

@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Data
@ -197,7 +198,6 @@ public class RouteOrder extends BaseEntity {
}
public RouteOrder reloadStatus(OrderSaveData orderSaveData) {
// 重新加载所有Leg的状态
List<Leg> legs = this.getLegItems();
@ -390,4 +390,9 @@ public class RouteOrder extends BaseEntity {
// 返回综合评分
return timeScore;
}
public boolean checkIfHaveTrainLeg() {
return legItems.stream()
.anyMatch(leg -> leg.getLegType().equals(LEG_TYPE_TRAIN));
}
}

View File

@ -10,4 +10,6 @@ public class SystemCode {
private String systemName;
private String systemCode;
private String bpmCode;
private String redirectPath;
// private List<String>
}

View File

@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.List;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Service
public class OrderDetailDomainService {
@ -49,9 +50,12 @@ public class OrderDetailDomainService {
}
}
public void syncOrderDetailStatusByRouteId(Long RouteId) {
public boolean syncOrderDetailStatusByRouteId(Long RouteId) {
RouteOrder routeOrder = routeRepository.queryById(RouteId);
String supplierName = routeOrder.getSupplierName();
if (routeOrder.checkIfHaveTrainLeg() && supplierName.equals(SUPPLIER_C_TRIP)) {
return false;
}
List<OrderLegData> orderLegDataList = new ArrayList<>();
List<String> list = routeOrder.getOrderDetails().stream()
.filter(it -> it.getLastEvent().getEventType() != ORDER_EVENT_CANCEL)
@ -61,5 +65,6 @@ public class OrderDetailDomainService {
orderDataAdapterSelector.of(supplierName).adapt(supplierCallbackData).ifPresent(orderLegDataList::add);
}
syncOrderDetailStatus(orderLegDataList);
return true;
}
}

View File

@ -66,10 +66,13 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
aosPeople.add(aosPerson);
//4.前置差旅政策
List<AOSPreTravelPolicy> aosPreTravelPolicies = new ArrayList<>();
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
aosPreTravelPolicy.setPolicyCode("");//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setProductTypeId(0);//产品ID 1国内机票2国际机票3国内酒店4海外酒店5火车票6用车
aosPreTravelPolicies.add(aosPreTravelPolicy);
;
for (int i = 1; i < 7; i++) {
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
aosPreTravelPolicy.setPolicyCode(order.getStandardLevel());//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setProductTypeId(i);//产品ID 1国内机票2国际机票3国内酒店4海外酒店5火车票6用车
aosPreTravelPolicies.add(aosPreTravelPolicy);
}
param.setItemList(aosItems); // 同程节点内容
param.setPersonList(aosPeople);// 同程信息实际出行人
@ -122,10 +125,12 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
aosPeople.add(aosPerson);
//4.前置差旅政策
List<AOSPreTravelPolicy> aosPreTravelPolicies = new ArrayList<>();
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
aosPreTravelPolicy.setPolicyCode("");//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setProductTypeId(0);//产品ID 1国内机票2国际机票3国内酒店4海外酒店5火车票6用车
aosPreTravelPolicies.add(aosPreTravelPolicy);
for (int i = 1; i < 7; i++) {
AOSPreTravelPolicy aosPreTravelPolicy = new AOSPreTravelPolicy();
aosPreTravelPolicy.setPolicyCode(order.getStandardLevel());//一般指客户经理提供的差旅政策标题
aosPreTravelPolicy.setProductTypeId(i);//产品ID 1国内机票2国际机票3国内酒店4海外酒店5火车票6用车
aosPreTravelPolicies.add(aosPreTravelPolicy);
}
param.setItemList(aosItems); // 同程节点内容
param.setPersonList(aosPeople);// 同程信息实际出行人

View File

@ -1,5 +1,6 @@
package com.chint.domain.value_object;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ -8,7 +9,7 @@ public class LegData {
public final Long legId;
public final Integer legType;
@ApiModelProperty("变更理由")
private final String changeReason;
public final String startTime;

View File

@ -4,6 +4,7 @@ public class CommonMessageConstant {
// 通用消息
public static final String SUCCESS = "操作成功";
public static final String FAILURE = "操作失败";
public static final String SYNC_FAILURE_TRAIN = "携程暂不支持火车票预订";
public static final String DUPLICATE_ERROR = "数据重复";
public static final String NOT_FOUND = "未找到相关数据";
public static final String INVALID_REQUEST = "无效的请求";