提交回推数据

This commit is contained in:
Superdandan 2024-02-24 20:35:15 +08:00
parent 4ca03517c9
commit 55f2ae28dd
34 changed files with 1104 additions and 174 deletions

View File

@ -9,4 +9,121 @@ import org.springframework.data.relational.core.mapping.Table;
public class CarOrderDetail { public class CarOrderDetail {
@Id @Id
private Long id; private Long id;
// 订单号
private String orderNo;
// 是否超标
private String overStandard;
// 父级订单号
private String parentOrderNo;
// 原始订单号
private String originalOrderNo;
// 订单状态
private String orderStatus;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 申请单号
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 预订人Code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 订单创建时间 格式2023-04-26 13:15:17
private String createTime;
// 出发时间 格式2023-04-26 13:15:17
private String startTime;
// 到达时间 格式2023-04-26 13:15:17
private String arriveTime;
// 出发地
private String fromStationName;
// 到达地
private String toStationName;
// 车型
private String carModel;
// 出发城市
private String fromCity;
// 到达城市
private String toCity;
// 运行时长 01:08 表示 1小时8分钟
private String runTime;
// 里程数
private String mileage;
// 订单总额(含前收服务费)
private String orderAmount;
// 取消费
private String cancellationFee;
// 差标
private String standardItems;
// 用车人姓名
private String userName;
// 用车人code
private String userCode;
// 用车人手机号
private String phone;
// 资源供应商
private String supplier;
// 个人支付金额
private String personalPaymentAmount;
// 公司统付金额
private String companyPaymentAmount;
// 超标原因
private String overStandardReason;
// 用车人组织架构信息1
private String BOOK_ORG_STRUCT_1;
// 用车人组织架构信息2
private String BOOK_ORG_STRUCT_2;
// 用车人组织架构信息3
private String BOOK_ORG_STRUCT_3;
// 付款方式 0公司统付 1个人付 2混付
private String paymentType;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String costCenter;
// 高速费
private String tollFee;
} }

View File

@ -9,4 +9,187 @@ import org.springframework.data.relational.core.mapping.Table;
public class FlightOrderDetail { public class FlightOrderDetail {
@Id @Id
private Long id; private Long id;
// 订单号
private String orderNo;
// 是否超标
private String overStandard;
// 父级订单号
private String parentOrderNo;
// 原始订单号
private String originalOrderNo;
// 订单状态1-出票成功2-改签成功3-退票成功
private String orderStatus;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 差旅申请单
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 改签后行程编号
private String changedScheduleNum;
// 预订人code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 订单创建时间 格式2023-04-26 13:15:17
private String createTime;
// 起飞时间 格式2023-04-26 13:15:17
private String startTime;
// 到达时间 格式2023-04-26 13:15:17
private String arriveTime;
// 起飞城市名称
private String startCityName;
// 起飞城市编码
private String startCityCode;
// 起飞机场名称
private String startAirportName;
// 起飞机场三字码
private String startAirportCode;
// 起飞航站楼
private String startTerminal;
// 到达城市名称
private String endCityName;
// 到达城市编码
private String endCityCode;
// 到达机场名称
private String endAirportName;
// 到达机场三字码
private String endAirportCode;
// 到达航站楼
private String endTerminal;
// 航程公里数
private String distance;
// 航空公司名称
private String flightCompName;
// 航班号
private String flightNum;
// 舱位
private String seatPoint;
// 舱位名称
private String seatPointName;
// 订单总额
private String orderAmount;
// 前收服务费
private String preServiceFee;
// 后收服务费
private String postServiceFee;
// 退款总额
private String refundAmount;
// 机票信息
private String tickets;
// 燃油费
private String fuelTax;
// 机建费
private String airportTax;
// 票面价
private String facePrice;
// 改签费
private String changeFee;
// 退票手续费
private String refundFee;
// 升舱费
private String upFee;
// 舱位及折扣
private String standard;
// 票号
private String ticketNo;
// 改签后票号
private String changedTicketNo;
// 出行人姓名
private String userName;
// 出行人code
private String userCode;
// 是否超标
private String isOverStandard;
// 出行人手机号
private String phone;
// 付款方式 0公司统付 1个人付 2混付
private String paymentType;
// 未预订最低价原因
private String notBookedLowestPriceReason;
// 资源供应商
private String supplier;
// 个人支付金额
private String personalPaymentAmount;
// 公司统付金额
private String companyPaymentAmount;
// 超标原因
private String overStandardReason;
// 出行人组织架构信息1
private String BOOK_ORG_STRUCT_1;
// 出行人组织架构信息2
private String BOOK_ORG_STRUCT_2;
// 出行人组织架构信息3
private String BOOK_ORG_STRUCT_3;
// 保险费
private String insuranceFee;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String costCenter;
} }

View File

@ -10,4 +10,145 @@ import org.springframework.data.relational.core.mapping.Table;
public class HotelOrderDetail { public class HotelOrderDetail {
@Id @Id
private Long id; private Long id;
// 订单号
private String orderNo;
// 是否超标
private String overStandard;
// 订单状态1-预订成功3-全部退订成功4-部分退订成功
private String orderStatus;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 申请单号
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 预订人Code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 订单创建时间 格式2023-04-26 13:15:17
private String createTime;
// 入住城市
private String checkInCity;
// 酒店名称
private String hotelName;
// 酒店电话
private String contactPhone;
// 酒店地址
private String hotelAddress;
// 星级
private String starRate;
// 入住日期 格式2022-09-10
private String checkInDate;
// 离店日期 格式2022-09-10
private String departureDate;
// 夜晚数
private String nightCount;
// 房间数
private String roomCount;
// 退订夜间数
private String refundRoomNightCount;
// 房型
private String roomTypeName;
// 付款方式 0公司统付 1个人付 2混付
private String paymentType;
// 企业统付总额
private String companyAmount;
// 个人支付总额
private String personalAmount;
// 企业退款金额
private String companyRefundAmount;
// 个人退款金额
private String personalRefundAmount;
// 订单总额
private String orderAmount;
// 前收服务费
private String preServiceFee;
// 后收服务费
private String postServiceFee;
// 退款总额
private String refundAmount;
// 入住人信息
private String customers;
// 入住人性别
private String gender;
// 入住人姓名
private String userName;
// 入住人code
private String userCode;
// 入住人手机号
private String phone;
// 入离日期内差标
private String standardItems;
// 间夜信息
private String nightRates;
// 资源供应商
private String supplier;
// 涉及金额字段都要取回
private String amountFields;
// 超标原因
private String overStandardReason;
// 是否协议酒店
private String agreementHotel;
// 入住人组织架构信息1
private String BOOK_ORG_STRUCT_1;
// 入住人组织架构信息2
private String BOOK_ORG_STRUCT_2;
// 入住人组织架构信息3
private String BOOK_ORG_STRUCT_3;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String costCenter;
} }

View File

@ -10,4 +10,148 @@ import org.springframework.data.relational.core.mapping.Table;
public class TrainOrderDetail { public class TrainOrderDetail {
@Id @Id
private Long id; private Long id;
// 订单号
private String orderNo;
// 是否超标
private String overStandard;
// 父级订单号
private String parentOrderNo;
// 原始订单号
private String originalOrderNo;
// 订单状态1-出票成功2-改签成功3-退票成功
private String orderStatus;
// 核算企业id
private String accountCompanyId;
// 核算企业名称
private String accountCompanyName;
// 申请单号
private String receiptsNum;
// 行程编号
private String scheduleNum;
// 预订人Code
private String bookingUserCode;
// 预订人姓名
private String bookingName;
// 预订人电话
private String bookingUserPhone;
// 订单创建时间 格式2023-04-26 13:15:17
private String createTime;
// 出发时间 格式2023-04-26 13:15:17
private String startTime;
// 到达时间 格式2023-04-26 13:15:17
private String arriveTime;
// 出发站
private String fromStationName;
// 到达站
private String toStationName;
// 车次
private String trainNo;
// 出发城市
private String fromCity;
// 到达城市
private String toCity;
// 运行时长 01:08 表示 1小时8分钟
private String runTime;
// 订单总额(含前收服务费)
private String orderAmount;
// 前收服务费
private String preServiceFee;
// 后收服务费
private String postServiceFee;
// 退款总额
private String refundAmount;
// 改签差额 高改低时为负数平改时为0低改高为正数
private String changeDifference;
// 改签手续费
private String changeCost;
// 火车票信息
private String tickets;
// 座位等级
private String seatType;
// 座位
private String seatName;
// 票价
private String ticketPrice;
// 退款手续费
private String refundCost;
// 退款金额
private String refundPrice;
// 差标
private String standardItems;
// 出行人姓名
private String userName;
// 出行人code
private String userCode;
// 出行人手机号
private String phone;
// 资源供应商
private String supplier;
// 个人支付金额
private String personalAmount;
// 公司统付金额
private String companyAmount;
// 超标原因
private String overStandardReason;
// 出行人组织架构信息1
private String BOOK_ORG_STRUCT_1;
// 出行人组织架构信息2
private String BOOK_ORG_STRUCT_2;
// 出行人组织架构信息3
private String BOOK_ORG_STRUCT_3;
// 付款方式 0公司统付 1个人付 2混付
private String paymentType;
// 保险费
private String insuranceFee;
// 项目订单号
private String projectOrderNo;
// 成本中心
private String costCenter;
} }

View File

@ -18,23 +18,23 @@ public class Ranks {
private String companyCode; private String companyCode;
private String standardLevel; private String standardLevel;
private String uniqueWord; private String uniqueWord;
@MappedCollection(idColumn = "rank_id", keyColumn = "rank_key") // @MappedCollection(idColumn = "rank_id", keyColumn = "rank_key")
private List<DifferenceStandards> differenceStandardsList; // private List<DifferenceStandards> differenceStandardsList;
// 构造函数getter和setter方法省略 // 构造函数getter和setter方法省略
public Ranks addStandards(DifferenceStandards differenceStandards) { // public Ranks addStandards(DifferenceStandards differenceStandards) {
if (this.differenceStandardsList == null) { // if (this.differenceStandardsList == null) {
this.differenceStandardsList = new ArrayList<>(); // this.differenceStandardsList = new ArrayList<>();
} // }
//
// 查找并移除具有相同 productType DifferenceStandards 对象 // // 查找并移除具有相同 productType DifferenceStandards 对象
// 移除相同 productType 的对象 // // 移除相同 productType 的对象
this.differenceStandardsList // this.differenceStandardsList
.removeIf(existingStandards -> existingStandards.getProductType() // .removeIf(existingStandards -> existingStandards.getProductType()
.equals(differenceStandards.getProductType())); // .equals(differenceStandards.getProductType()));
//
// 添加新的 DifferenceStandards 对象 // // 添加新的 DifferenceStandards 对象
this.differenceStandardsList.add(differenceStandards); // this.differenceStandardsList.add(differenceStandards);
return this; // return this;
} // }
} }

View File

@ -25,7 +25,5 @@ public class TravelStandards {
private String standardLevel; private String standardLevel;
//城市类别 //城市类别
private String cityTag;//1直辖市省会特别行政区2其它城市 private String cityTag;//1直辖市省会特别行政区2其它城市
} }

View File

@ -0,0 +1,32 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import org.springframework.stereotype.Component;
@Component
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
return null;
}
@Override
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
return null;
}
@Override
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
return null;
}
@Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
return null;
}
@Override
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
return null;
}
}

View File

@ -0,0 +1,33 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.value_object.*;
import org.springframework.stereotype.Component;
@Component
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
return null;
}
@Override
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
return null;
}
@Override
public FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData) {
return null;
}
@Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
return null;
}
@Override
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
return null;
}
}

View File

@ -8,14 +8,4 @@ public interface OrderDetailFactory {
OrderEvent createEvent(Integer eventType, String outStatus); OrderEvent createEvent(Integer eventType, String outStatus);
CarOrderDetail createCarOrderDetail(CarOrderDetailData carOrderDetailData);
TrainOrderDetail createTrainOrderDetail(TrainOrderDetailData trainOrderDetailData);
FlightOrderDetail createFlightOrderDetail(FlightOrderDetailData flightOrderDetailData);
HotelOrderDetail createHotelOrderDetail(HotelOrderDetailData hotelOrderDetailData);
OtherOrderDetail createOtherOrderDetail(OtherOrderDetailData otherOrderDetailData);
} }

View File

@ -29,29 +29,4 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
orderEvent.setHappenTime(LocalDateTime.now()); orderEvent.setHappenTime(LocalDateTime.now());
return orderEvent; return orderEvent;
} }
@Override
public CarOrderDetail createCarOrderDetail(CarOrderDetailData carOrderDetailData) {
return null;
}
@Override
public TrainOrderDetail createTrainOrderDetail(TrainOrderDetailData trainOrderDetailData) {
return null;
}
@Override
public FlightOrderDetail createFlightOrderDetail(FlightOrderDetailData flightOrderDetailData) {
return null;
}
@Override
public HotelOrderDetail createHotelOrderDetail(HotelOrderDetailData hotelOrderDetailData) {
return null;
}
@Override
public OtherOrderDetail createOtherOrderDetail(OtherOrderDetailData otherOrderDetailData) {
return null;
}
} }

View File

@ -0,0 +1,25 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.service.order_sync.SupplierOrderSync;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.Constant.*;
@Component
public class OrderExtensionCreator {
@Autowired
private LYOrderExtensionFactoryImpl lyOrderExtensionFactory;
@Autowired
private CTripOrderExtensionFactoryImpl cTripOrderExtensionFactory;
public OrderExtensionFactory of(String supplierName) {
return switch (supplierName) {
case SUPPLIER_C_TRIP -> cTripOrderExtensionFactory;
case SUPPLIER_L_Y -> lyOrderExtensionFactory;
default -> throw new NotFoundException(NOT_FOUND);
};
}
}

View File

@ -0,0 +1,18 @@
package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.value_object.*;
public interface OrderExtensionFactory {
CarOrderDetail createCarOrderDetail(Object carOrderDetailData);
TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData);
FlightOrderDetail createFlightOrderDetail(Object flightOrderDetailData);
HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData);
OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData);
}

View File

@ -97,5 +97,7 @@ public class OrderDomainService {
orderDetail.addOrderEvent(event); orderDetail.addOrderEvent(event);
orderDetailRepository.save(orderDetail); orderDetailRepository.save(orderDetail);
}); });
//这里如果发现事件的状态为Approving2 需要根据发送审批给bpm需要先查询订单数据
} }
} }

View File

@ -64,7 +64,6 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
.orderStatus(translateHotelOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus())) .orderStatus(translateHotelOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus()))
.originOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus()) .originOrderStatus(hotelOrderInfoEntity.getOrderDetailStatus())
.price(hotelOrderInfoEntity.getAmount()); .price(hotelOrderInfoEntity.getAmount());
} }
// 处理航班订单 // 处理航班订单

View File

@ -24,11 +24,13 @@ public class OrderLegData {
private Long destinationId; private Long destinationId;
private String currencyCode; private String currencyCode;
private CarOrderDetailData carOrderDetailData; private Object carOrderDetailData;
private TrainOrderDetailData trainOrderDetailData; private Object trainOrderDetailData;
private HotelOrderDetailData hotelOrderDetailData; private Object hotelOrderDetailData;
private FlightOrderDetailData flightOrderDetailData; private Object flightOrderDetailData;
private OtherOrderDetailData otherOrderDetailData; private Object otherOrderDetailData;
private OrderLegData(Builder builder) { private OrderLegData(Builder builder) {
this.actualOrderNo = builder.actualOrderNo; this.actualOrderNo = builder.actualOrderNo;

View File

@ -198,7 +198,6 @@ public class Constant {
public static final String SUPPLIER_L_Y_CN_NAME = "同程"; public static final String SUPPLIER_L_Y_CN_NAME = "同程";
// 携程 // 携程
public static final String C_TRIP_BASE_URL = "https://ct.ctrip.com";
public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket"; public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket";
public static final String C_TRIP_LOGIN_PATH = "/singlesignon/openapi/saml/login"; public static final String C_TRIP_LOGIN_PATH = "/singlesignon/openapi/saml/login";
public static final String C_TRIP_ENTITY_ID = "/zhengtai"; public static final String C_TRIP_ENTITY_ID = "/zhengtai";
@ -223,8 +222,12 @@ public class Constant {
public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken"; public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken";
public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login"; public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login";
public static final String C_TRIP_SINGLE_LOGIN = "/m/SingleSignOn/H5SignInfo"; public static final String C_TRIP_SINGLE_LOGIN = "/m/SingleSignOn/H5SignInfo";
public static final String C_TRIP_AUDIT_PATH = "/corpservice/AuditService/Audit";
public static final String C_TRIP_REQUEST_SECRET = "zhengtai2024_nEbmKfOo"; public static final String C_TRIP_REQUEST_SECRET = "zhengtai2024_nEbmKfOo";
public static final String C_TRIP_AUDIT_ACTION_SUCCESS = "T";
public static final String C_TRIP_AUDIT_ACTION_FAIL = "F";
//同程 //同程
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi"; public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";

View File

@ -2,6 +2,8 @@ package com.chint.infrastructure.util;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNotification; import com.chint.interfaces.rest.ctrip.dto.put.CTripNotification;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.KeyGenerator; import javax.crypto.KeyGenerator;
@ -13,10 +15,10 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.*; import java.util.*;
import static com.chint.infrastructure.constant.Constant.C_TRIP_REQUEST_SECRET;
public class Digest { public class Digest {
public static String md5(String input) { public static String md5(String input) {
try { try {
MessageDigest md = MessageDigest.getInstance("MD5"); MessageDigest md = MessageDigest.getInstance("MD5");
@ -79,7 +81,8 @@ public class Digest {
public static String getPutCTripStatusSign(String corpId, public static String getPutCTripStatusSign(String corpId,
String productType, String productType,
String orderStatus, String orderStatus,
String orderId) { String orderId,
String C_TRIP_REQUEST_SECRET) {
//构造字典 //构造字典
HashMap<String, String> hashMap = new HashMap<String, String>(); HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("secret", C_TRIP_REQUEST_SECRET); hashMap.put("secret", C_TRIP_REQUEST_SECRET);
@ -102,7 +105,7 @@ public class Digest {
return DigestUtils.sha1Hex(str).toUpperCase(); return DigestUtils.sha1Hex(str).toUpperCase();
} }
public static String getPutCTripEventSign(CTripNotification postRequest) { public static String getPutCTripEventSign(CTripNotification postRequest,String C_TRIP_REQUEST_SECRET) {
//构造字典 //构造字典
HashMap<String, String> hashMap = new HashMap<>(); HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("secret", C_TRIP_REQUEST_SECRET); hashMap.put("secret", C_TRIP_REQUEST_SECRET);

View File

@ -6,6 +6,7 @@ import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequestOut;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult;
import com.chint.interfaces.rest.ctrip.dto.Authentication; import com.chint.interfaces.rest.ctrip.dto.Authentication;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.Constant.*; import static com.chint.infrastructure.constant.Constant.*;
@ -13,14 +14,19 @@ import static com.chint.infrastructure.constant.Constant.*;
@Service @Service
public class CTripApprovalRequest { public class CTripApprovalRequest {
@Value("${cTrip.baseUrl}")
private String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
private String approvalUrl = C_TRIP_BASE_URL + C_TRIP_APPROVAL_PATH; private String approvalUrl = C_TRIP_BASE_URL + C_TRIP_APPROVAL_PATH;
@Autowired @Autowired
private CTripTicketRequest ticketRequest; private CTripTicketRequest ticketRequest;
@Autowired @Autowired
private PostRequest postRequest; private PostRequest postRequest;
public ApprovalResult approval(ApprovalRequest approvalRequest) { public ApprovalResult approval(ApprovalRequest approvalRequest) {
ApprovalRequestOut approvalRequestOut = new ApprovalRequestOut(); ApprovalRequestOut approvalRequestOut = new ApprovalRequestOut();
approvalRequestOut.setRequest(approvalRequest); approvalRequestOut.setRequest(approvalRequest);

View File

@ -0,0 +1,59 @@
package com.chint.interfaces.rest.ctrip;
import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.audit.AuditParam;
import com.chint.interfaces.rest.ctrip.dto.audit.AuditResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.Constant.*;
@Component
public class CTripAuditRequest {
@Value("${cTrip.auditBaseUrl}")
private String auditBaseUrl;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.appSecurity}")
private String C_TRIP_APP_SECURITY;
@Autowired
private PostRequest postRequest;
@Autowired
private CTripTicketRequest cTripTicketRequest;
private final String auditUrl = auditBaseUrl + C_TRIP_AUDIT_PATH;
public AuditResponse auditSuccess(String orderNo, Integer orderType) {
return audit(orderNo, orderType, C_TRIP_AUDIT_ACTION_SUCCESS);
}
public AuditResponse auditFail(String orderNo, Integer orderType) {
return audit(orderNo, orderType, C_TRIP_AUDIT_ACTION_FAIL);
}
private AuditResponse audit(String orderNo, Integer orderType, String auditType) {
String sign = Digest.md5(
orderNo + orderType + auditType +
Digest.md5(C_TRIP_APP_SECURITY)
);
AuditParam auditParam = AuditParam.builder()
.auth()
.ticket(cTripTicketRequest.loadAuditTicket())
.appkey(C_TRIP_APP_KEY)
.build()
.audittype(auditType)
.orderid(orderNo)
.ordertype(orderType)
.signature(sign)
.build();
return postRequest.post(auditUrl, auditParam, AuditResponse.class);
}
}

View File

@ -11,6 +11,7 @@ import com.chint.interfaces.rest.ctrip.dto.estimate.request.TrainProductInfo;
import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse; import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -20,6 +21,14 @@ import static com.chint.infrastructure.constant.Constant.*;
@Component @Component
public class CTripEstimateRequest { public class CTripEstimateRequest {
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.corpId}")
private String C_TRIP_CORP_ID;
private String apiName = "bookingRelatedOpenApi.valuateBudget"; private String apiName = "bookingRelatedOpenApi.valuateBudget";
private String estimateUrl = C_TRIP_BASE_URL + C_TRIP_ESTIMATE_PATH; private String estimateUrl = C_TRIP_BASE_URL + C_TRIP_ESTIMATE_PATH;

View File

@ -4,6 +4,7 @@ import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.Authentification; import com.chint.interfaces.rest.ctrip.dto.Authentification;
import com.chint.interfaces.rest.ctrip.dto.location.*; import com.chint.interfaces.rest.ctrip.dto.location.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -14,14 +15,20 @@ import static com.chint.infrastructure.constant.Constant.*;
public class CTripLocationHttpRequest implements LocationHttpRequest { public class CTripLocationHttpRequest implements LocationHttpRequest {
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Autowired @Autowired
private PostRequest postRequest; private PostRequest postRequest;
@Autowired @Autowired
private CTripTicketRequest ticketRequest; private CTripTicketRequest ticketRequest;
private static final String locationCityUrl = C_TRIP_BASE_URL + HOTEL_CITY_PATH; private final String locationCityUrl = C_TRIP_BASE_URL + HOTEL_CITY_PATH;
private static final String locationCountryUrl = C_TRIP_BASE_URL + HOTEL_COUNTRY_PATH; private final String locationCountryUrl = C_TRIP_BASE_URL + HOTEL_COUNTRY_PATH;
@Override @Override

View File

@ -15,6 +15,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
@ -33,25 +34,36 @@ import static com.chint.infrastructure.constant.Constant.*;
@Component @Component
public class CTripLoginRequest { public class CTripLoginRequest {
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Autowired @Autowired
private PostRequest postRequest; private PostRequest postRequest;
@Autowired @Autowired
private CTripTicketRequest ticketRequest; private CTripTicketRequest ticketRequest;
@Autowired @Autowired
private CTripTokenRequest tokenRequest; private CTripTokenRequest tokenRequest;
private String loginUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_PATH; @Value("${cTrip.appId}")
private String C_TRIP_APP_ID;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.corpId}")
private String C_TRIP_CORP_ID;
@Value("${cTrip.appSecurity}")
private String C_TRIP_APP_SECURITY;
private final String loginUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_PATH;
//PC单点登录 //PC单点登录
private String authLoginUrl = C_TRIP_BASE_URL + C_TRIP_AUTH_LOGIN; private final String authLoginUrl = C_TRIP_BASE_URL + C_TRIP_AUTH_LOGIN;
private String hSinngleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; private final String hSinngleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN;
//H5单点登录 //H5单点登录
private String singleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN; private final String singleLoginUrl = C_TRIP_BASE_URL + C_TRIP_SINGLE_LOGIN;
private String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_TICKET; private final String singleTokenUrl = C_TRIP_BASE_URL + C_TRIP_LOGIN_TICKET;
private String IDPEntityID = C_TRIP_ENTITY_ID; private final String IDPEntityID = C_TRIP_ENTITY_ID;
private String corpId = C_TRIP_CORP_ID; private final String corpId = C_TRIP_CORP_ID;
public String login(CTripLoginParam loginParam) { public String login(CTripLoginParam loginParam) {
loginParam.setCorpID(corpId); loginParam.setCorpID(corpId);
@ -127,7 +139,7 @@ public class CTripLoginRequest {
} }
private String loadLoginToken() { private String loadLoginToken() {
H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(), H5LoginToken.class); H5LoginToken h5TokenResponse = postRequest.post(singleTokenUrl, H5TicketModel.build(C_TRIP_APP_KEY, C_TRIP_APP_SECURITY), H5LoginToken.class);
return h5TokenResponse.getToken(); return h5TokenResponse.getToken();
} }

View File

@ -4,13 +4,19 @@ import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderRequest; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.Constant.*; import static com.chint.infrastructure.constant.Constant.*;
@Service @Service
public class CTripOrderSearchRequest { public class CTripOrderSearchRequest {
private String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH;
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
private final String searchUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_SEARCH_PATH;
@Autowired @Autowired
private PostRequest postRequest; private PostRequest postRequest;

View File

@ -4,6 +4,7 @@ import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.ctrip.dto.ticket.TicketParam; import com.chint.interfaces.rest.ctrip.dto.ticket.TicketParam;
import com.chint.interfaces.rest.ctrip.dto.ticket.TicketResponse; import com.chint.interfaces.rest.ctrip.dto.ticket.TicketResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -16,7 +17,19 @@ public class CTripTicketRequest {
@Autowired @Autowired
private PostRequest postRequest; private PostRequest postRequest;
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.auditBaseUrl}")
public String C_TRIP_AUDIT_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.appSecurity}")
private String C_TRIP_APP_SECURITY;
private final String ticketUrl = C_TRIP_BASE_URL + TICKET_PATH; private final String ticketUrl = C_TRIP_BASE_URL + TICKET_PATH;
private final String AuditTicketUrl = C_TRIP_AUDIT_BASE_URL + TICKET_PATH;
private final TicketParam ticketParam = new TicketParam(C_TRIP_APP_KEY, C_TRIP_APP_SECURITY); private final TicketParam ticketParam = new TicketParam(C_TRIP_APP_KEY, C_TRIP_APP_SECURITY);
// Data class to store ticket and expiry time // Data class to store ticket and expiry time
@ -40,6 +53,7 @@ public class CTripTicketRequest {
// Cached ticket instance // Cached ticket instance
private CachedTicket cachedTicket = null; private CachedTicket cachedTicket = null;
private CachedTicket cachedAuditTicket = null;
public String loadTicket() { public String loadTicket() {
// Check if the cached ticket exists and is valid // Check if the cached ticket exists and is valid
@ -52,4 +66,14 @@ public class CTripTicketRequest {
cachedTicket = new CachedTicket(ticket.getTicket(), LocalDateTime.now().plusHours(2)); cachedTicket = new CachedTicket(ticket.getTicket(), LocalDateTime.now().plusHours(2));
return ticket.getTicket(); return ticket.getTicket();
} }
public String loadAuditTicket() {
if (cachedAuditTicket != null && cachedAuditTicket.getExpiryTime().isAfter(LocalDateTime.now())) {
return cachedAuditTicket.getTicket();
}
System.out.println(ticketParam);
TicketResponse ticket = postRequest.post(AuditTicketUrl, ticketParam, TicketResponse.class);
cachedAuditTicket = new CachedTicket(ticket.getTicket(), LocalDateTime.now().plusHours(2));
return ticket.getTicket();
}
} }

View File

@ -5,6 +5,7 @@ import com.chint.interfaces.rest.ctrip.dto.token.AccessTokenResponse;
import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenRequest; import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenRequest;
import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenResponse; import com.chint.interfaces.rest.ctrip.dto.token.GetUnionAccessTokenResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.Constant.*; import static com.chint.infrastructure.constant.Constant.*;
@ -12,6 +13,13 @@ import static com.chint.infrastructure.constant.Constant.*;
@Service @Service
public class CTripTokenRequest { public class CTripTokenRequest {
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.appSecurity}")
private String C_TRIP_APP_SECURITY;
private String tokenUrl = C_TRIP_BASE_URL + C_TRIP_TOKEN_PATH; private String tokenUrl = C_TRIP_BASE_URL + C_TRIP_TOKEN_PATH;

View File

@ -9,6 +9,7 @@ import com.chint.interfaces.rest.ctrip.dto.user.AuthenticationInfo;
import com.chint.interfaces.rest.ctrip.dto.user.AuthenticationListRequest; import com.chint.interfaces.rest.ctrip.dto.user.AuthenticationListRequest;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -26,6 +27,14 @@ public class CTripUserSaveRequest {
@Autowired @Autowired
private CTripTicketRequest ticketRequest; private CTripTicketRequest ticketRequest;
@Value("${cTrip.baseUrl}")
public String C_TRIP_BASE_URL;
@Value("${cTrip.appKey}")
private String C_TRIP_APP_KEY;
@Value("${cTrip.corpId}")
private String C_TRIP_CORP_ID;
private final String userUrl = C_TRIP_BASE_URL + C_TRIP_USER_SAVE_PATH; private final String userUrl = C_TRIP_BASE_URL + C_TRIP_USER_SAVE_PATH;

View File

@ -0,0 +1,101 @@
package com.chint.interfaces.rest.ctrip.dto.audit;
import lombok.Data;
@Data
public class AuditParam {
private final Auth Auth;
private final String OrderId;
private final int OrderType;
private final String AuditType;
private final String Signature;
public static Builder builder() {
return new Builder();
}
private AuditParam(Builder builder) {
this.Auth = builder.auth;
this.OrderId = builder.orderid;
this.OrderType = builder.ordertype;
this.AuditType = builder.audittype;
this.Signature = builder.signature;
}
// Getters
@Data
public static class Auth {
private final String Ticket;
private final String AppKey;
private Auth(AuthBuilder builder) {
this.Ticket = builder.ticket;
this.AppKey = builder.appkey;
}
// Getters
public static class AuthBuilder {
private Builder parentBuilder;
private String ticket;
private String appkey;
public AuthBuilder(Builder parentBuilder) {
this.parentBuilder = parentBuilder;
}
public AuthBuilder ticket(String ticket) {
this.ticket = ticket;
return this;
}
public AuthBuilder appkey(String appkey) {
this.appkey = appkey;
return this;
}
public Builder build() {
parentBuilder.auth = new Auth(this);
return parentBuilder;
}
}
}
public static class Builder {
private Auth auth;
private String orderid;
private int ordertype;
private String audittype;
private String signature;
public Auth.AuthBuilder auth() {
return new Auth.AuthBuilder(this);
}
public Builder orderid(String orderid) {
this.orderid = orderid;
return this;
}
public Builder ordertype(int ordertype) {
this.ordertype = ordertype;
return this;
}
public Builder audittype(String audittype) {
this.audittype = audittype;
return this;
}
public Builder signature(String signature) {
this.signature = signature;
return this;
}
public AuditParam build() {
return new AuditParam(this);
}
}
}

View File

@ -0,0 +1,11 @@
package com.chint.interfaces.rest.ctrip.dto.audit;
import com.chint.interfaces.rest.ctrip.dto.ResponseStatus;
import lombok.Data;
@Data
public class AuditResponse {
private Long OrderId;
private String AuditType; //订单类型
private ResponseStatus Status;
}

View File

@ -2,15 +2,15 @@ package com.chint.interfaces.rest.ctrip.dto.login;
import lombok.Data; import lombok.Data;
import static com.chint.infrastructure.constant.Constant.C_TRIP_APP_KEY;
import static com.chint.infrastructure.constant.Constant.C_TRIP_APP_SECURITY;
@Data @Data
public class H5TicketModel { public class H5TicketModel {
private String AppKey; private String AppKey;
private String AppSecurity; private String AppSecurity;
public static H5TicketModel build(){ public static H5TicketModel build(String C_TRIP_APP_KEY,String C_TRIP_APP_SECURITY){
H5TicketModel h5TicketModel = new H5TicketModel(); H5TicketModel h5TicketModel = new H5TicketModel();
h5TicketModel.setAppKey(C_TRIP_APP_KEY); h5TicketModel.setAppKey(C_TRIP_APP_KEY);
h5TicketModel.setAppSecurity(C_TRIP_APP_SECURITY); h5TicketModel.setAppSecurity(C_TRIP_APP_SECURITY);

View File

@ -10,6 +10,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse; import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -22,6 +23,9 @@ import static com.chint.infrastructure.constant.Constant.*;
public class CTripNoteController { public class CTripNoteController {
@Value("${cTrip.requestSecret}")
private String C_TRIP_REQUEST_SECRET;
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@ -53,7 +57,7 @@ public class CTripNoteController {
String productType = cTripStatusNotification.getProductType(); String productType = cTripStatusNotification.getProductType();
String orderStatus = cTripStatusNotification.getOrderStatus(); String orderStatus = cTripStatusNotification.getOrderStatus();
String orderId = cTripStatusNotification.getOrderId(); String orderId = cTripStatusNotification.getOrderId();
String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId); String putCTripSign = Digest.getPutCTripStatusSign(cTripStatusNotification.getCorpId(), productType, orderStatus, orderId, C_TRIP_REQUEST_SECRET);
if (!putCTripSign.equals(cTripStatusNotification.getSign())) { if (!putCTripSign.equals(cTripStatusNotification.getSign())) {
return new CTripStatusResponse("1", "sign错误"); return new CTripStatusResponse("1", "sign错误");
} }
@ -64,7 +68,7 @@ public class CTripNoteController {
.searchOrderResponseByOrderId(orderId); .searchOrderResponseByOrderId(orderId);
supplierCallbackData.data(response); supplierCallbackData.data(response);
supplierService.handleSupplierCallback(supplierCallbackData); supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(orderId) .orderNo(orderId)
.outStatus(orderStatus); .outStatus(orderStatus);

View File

@ -5,18 +5,15 @@ package com.chint.interfaces.rest.user;
//import com.chint.dc.api.dto.DataCenterOption; //import com.chint.dc.api.dto.DataCenterOption;
//import com.chint.dc.api.service.DataCenterService; //import com.chint.dc.api.service.DataCenterService;
import com.chint.dc.api.DataCenterResult;
import com.chint.dc.api.dto.DataCenterOption;
import com.chint.dc.api.service.DataCenterService;
import com.chint.domain.aggregates.standards.Ranks; import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.service.RankDomainService; import com.chint.domain.service.RankDomainService;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.user.dto.*; import com.chint.interfaces.rest.user.dto.AccessKeyDTO;
import com.chint.interfaces.rest.user.dto.TravelRankDTO;
import com.chint.interfaces.rest.user.dto.TravelRankParam;
import com.chint.interfaces.rest.user.dto.TravelRankResponseDTO;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
@ -24,11 +21,6 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.Constant.*; import static com.chint.infrastructure.constant.Constant.*;
@Service @Service
@ -79,73 +71,75 @@ public class UserHttpRequestImpl implements UserHttpRequest {
} }
private User loadSFInfo(User user) { private User loadSFInfo(User user) {
Gson gson = new Gson(); // Gson gson = new Gson();
AccessKeyDTO akSkLoad = akSkLoad(); // AccessKeyDTO akSkLoad = akSkLoad();
DataCenterOption option = new DataCenterOption(); // DataCenterOption option = new DataCenterOption();
option.setSk(akSkLoad.sk); // option.setSk(akSkLoad.sk);
option.setAk(akSkLoad.ak); // option.setAk(akSkLoad.ak);
option.setUrl(OPENAI_BASE_URL); // option.setUrl(OPENAI_BASE_URL);
DataCenterService dataCenterService = new DataCenterService(option); // DataCenterService dataCenterService = new DataCenterService(option);
LinkedHashMap map = new LinkedHashMap<String, Object>(); // LinkedHashMap map = new LinkedHashMap<String, Object>();
map.put("LoginUsername", user.getEmployeeNo().toString()); // map.put("LoginUsername", user.getEmployeeNo().toString());
map.put("start", 0); // map.put("start", 0);
map.put("pageSize", 99); // map.put("pageSize", 99);
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); // DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
Type type = new TypeToken<List<UserDataDTO>>() { // Type type = new TypeToken<List<UserDataDTO>>() {
}.getType(); // }.getType();
if (result.getData() != null) { // if (result.getData() != null) {
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type); //// List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
// UserDataDTO userDataDTO = fromJson.get(0); //// UserDataDTO userDataDTO = fromJson.get(0);
String companyCode = user.getCompanyCode(); // String companyCode = user.getCompanyCode();
if (companyCode == null) { // if (companyCode == null) {
companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); // companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
} // }
String newCompanyCode = companyCode; // String newCompanyCode = companyCode;
//
// if (fromJson.size() == 1) {
// UserDataDTO userData = fromJson.get(0);
// user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender());
// user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone());
// user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel());
// } else {
// Optional<UserDataDTO> first;
//
// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
// .findFirst();
//
// } else {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany().equals(newCompanyCode))
// .findFirst();
// }
// first.ifPresent(
// userData -> {
// user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender());
// user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone());
// }
// );
// fromJson.stream()
// .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
// .findFirst()
// .ifPresent(userData -> {
// user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel());
// });
// }
// return user;
// } else {
// throw new RuntimeException("用户数据不存在");
// }
if (fromJson.size() == 1) { return null;
UserDataDTO userData = fromJson.get(0);
user.setCompanyCode(userData.getCompany());
user.setWorkStatus(userData.getStatus());
user.setGender(userData.getGender());
user.setName(userData.getUname());
user.setPhoneNumber(userData.getMobilePhone());
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
} else {
Optional<UserDataDTO> first;
//这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
first = fromJson.stream()
.filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
.findFirst();
} else {
first = fromJson.stream()
.filter(userData -> userData.getCompany().equals(newCompanyCode))
.findFirst();
}
first.ifPresent(
userData -> {
user.setCompanyCode(userData.getCompany());
user.setWorkStatus(userData.getStatus());
user.setGender(userData.getGender());
user.setName(userData.getUname());
user.setPhoneNumber(userData.getMobilePhone());
}
);
fromJson.stream()
.filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
.findFirst()
.ifPresent(userData -> {
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
});
}
return user;
} else {
throw new RuntimeException("用户数据不存在");
}
} }

View File

@ -15,3 +15,12 @@ logging:
level: level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.JdbcTemplate: DEBUG
org.springframework.jdbc.core.StatementCreatorUtils: TRACE org.springframework.jdbc.core.StatementCreatorUtils: TRACE
cTrip:
baseUrl: https://ct.ctrip.com
auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi
appId: zhengtai2024
corpId: zhengtai2024
appKey: obk_zhengtai2024
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
requestSecret: zhengtai2024_nEbmKfOo

View File

@ -11,3 +11,5 @@ chint:
password: 123456 password: 123456
url: https://gxdev03.chint.com/businesstravel/ url: https://gxdev03.chint.com/businesstravel/
cTrip:
baseUrl: https://ct.ctrip.com

View File

@ -1,29 +1,33 @@
server: server:
port: 8081 port: 8081
#chint:
# datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver
# host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
# # host: 10.9.56.48
# port: 3306
# database: itinerary_booking
# username: echo
# password: R3nd0mP@ssw0rd!
# url: https://gxdev03.chint.com/businesstravel/
chint: chint:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
host: 10.10.24.44 host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
# host: 10.9.56.48 # host: 10.9.56.48
port: 6603 port: 3306
database: itinerary_booking database: itinerary_booking
username: tripbook username: echo
password: W@Xgf25d&lRk*L0X# password: R3nd0mP@ssw0rd!
url: https://gxdev03.chint.com/businesstravel/ url: https://gxdev03.chint.com/businesstravel/
#chint:
# datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver
# host: 10.10.24.44
# # host: 10.9.56.48
# port: 6603
# database: itinerary_booking
# username: tripbook
# password: W@Xgf25d&lRk*L0X#
# url: https://gxdev03.chint.com/businesstravel/
logging: logging:
level: level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.JdbcTemplate: DEBUG
org.springframework.jdbc.core.StatementCreatorUtils: TRACE org.springframework.jdbc.core.StatementCreatorUtils: TRACE
cTrip:
baseUrl: https://ct.ctrip.com