调整退款订单生成逻辑

This commit is contained in:
lulz1 2024-04-15 17:42:24 +08:00
parent cf0986a837
commit 3e46fbeb4a
13 changed files with 369 additions and 332 deletions

View File

@ -38,7 +38,8 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.SupplierNameConstant.*; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
@RestController @RestController
@RequestMapping("/OrderDetail") @RequestMapping("/OrderDetail")
@ -177,52 +178,106 @@ public class OrderDetailController {
@TransitionTo(command = "RefundOrderGenerateCommand", order = 0) @TransitionTo(command = "RefundOrderGenerateCommand", order = 0)
public void generateCTripRefund(RefundOrderGenerateCommand command) { public void generateCTripRefund(RefundOrderGenerateCommand command) {
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> { orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {
String newOrderNo = command.getOrderNo() + "-" + command.getRecordId(); String newOrderNo = generateNewOrderNo(command);
String type = command.getType();
Optional<OrderDetail> byOrderNo = orderDetailRepository.findByOrderNo(newOrderNo);
if (byOrderNo.isPresent()) {
return;
}
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
if (routeOrder.getOrderDetails().stream().map(OrderDetail::getOrderNo).toList().contains(newOrderNo)) { orderDetail = getOrCreateOrderDetail(newOrderNo, orderDetail);
return; Long orderId = orderDetail.getOrderId();
}
Integer productType = orderDetail.getProductType(); orderDetail = findMatchingOrderDetailInRoute(orderId, routeOrder).orElse(orderDetail);
orderDetail.setOrderId(null);
orderDetail.setOrderNo(newOrderNo); orderDetail.setOrderNo(newOrderNo);
addOrderEvent(orderDetail, command.getType(), LocalDateTime.now());
orderDetail.setPrice(command.getAmount());
processProductSpecificDetails(orderDetail, command, newOrderNo);
List<OrderDetail> orderDetails = new ArrayList<>(routeOrder
.getOrderDetails()
.stream()
.filter(it -> !it.getOrderId().equals(orderId))
.toList());
orderDetails.add(orderDetail);
routeOrder.setOrderDetails(orderDetails);
routeRepository.save(routeOrder);
});
}
private String generateNewOrderNo(RefundOrderGenerateCommand command) {
return command.getOrderNo() + "-" + command.getRecordId();
}
private OrderDetail getOrCreateOrderDetail(String newOrderNo, OrderDetail orderDetail) {
return orderDetailRepository.findByOrderNo(newOrderNo).orElseGet(() -> {
orderDetail.setOrderId(null);
return orderDetail;
});
}
private Optional<OrderDetail> findMatchingOrderDetailInRoute(Long orderId, RouteOrder routeOrder) {
return routeOrder.getOrderDetails().stream()
.filter(detail -> detail.getOrderId().equals(orderId))
.findFirst();
}
private void addOrderEvent(OrderDetail orderDetail, String type, LocalDateTime happenTime) {
OrderEvent orderEvent = new OrderEvent(); OrderEvent orderEvent = new OrderEvent();
orderEvent.setEventType(Integer.valueOf(type)); orderEvent.setEventType(Integer.valueOf(type));
orderEvent.setHappenTime(LocalDateTime.now()); orderEvent.setHappenTime(happenTime);
orderEvent.setOutStatus(orderEvent.translateOrderEvent(Integer.parseInt(type))); orderEvent.setOutStatus(orderEvent.translateOrderEvent(Integer.parseInt(type)));
orderDetail.setOrderEventList(List.of(orderEvent)); orderDetail.setOrderEventList(List.of(orderEvent));
orderDetail.setPrice(command.getAmount()); }
if (productType == 0) {
private void processProductSpecificDetails(OrderDetail orderDetail, RefundOrderGenerateCommand command, String newOrderNo) {
Integer productType = orderDetail.getProductType();
switch (productType) {
case 0:
updateTrainOrderDetail(orderDetail, command, newOrderNo);
break;
case 1:
updateFlightOrderDetail(orderDetail, command, newOrderNo);
break;
case 2:
updateHotelOrderDetail(orderDetail, command, newOrderNo);
break;
case 3:
updateCarOrderDetail(orderDetail, command, newOrderNo);
break;
}
}
private void updateTrainOrderDetail(OrderDetail orderDetail, RefundOrderGenerateCommand command, String newOrderNo) {
TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail(); TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
trainOrderDetail.setOrderAmount(command.getAmount()); trainOrderDetail.setOrderAmount(command.getAmount());
trainOrderDetail.setOrderStatus(type); trainOrderDetail.setOrderStatus(command.getType());
trainOrderDetail.setOrderNo(newOrderNo); trainOrderDetail.setOrderNo(newOrderNo);
trainOrderDetail.setDetailId(newOrderNo); trainOrderDetail.setDetailId(newOrderNo);
trainOrderDetail.setCreateTime(command.getCreateTime()); trainOrderDetail.setCreateTime(command.getCreateTime());
trainOrderDetail.setId(null); trainOrderDetail.setId(null);
if (trainOrderDetail.getSupplier().equals(SUPPLIER_L_Y_EXTENSION_NAME)) { if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) {
orderExtensionCreator.of(SUPPLIER_L_Y).updateTrainOrderDetailData(trainOrderDetail, command.getOrderInfo()); trainOrderDetail = orderExtensionCreator.of(SUPPLIER_L_Y).updateTrainOrderDetailData(trainOrderDetail, command.getOrderInfo());
} }
orderDetail.setTrainOrderDetail(trainOrderDetail);
} }
if (productType == 1) {
private void updateFlightOrderDetail(OrderDetail orderDetail, RefundOrderGenerateCommand command, String newOrderNo) {
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail(); FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
flightOrderDetail.setOrderAmount(command.getAmount()); flightOrderDetail.setOrderAmount(command.getAmount());
flightOrderDetail.setOrderStatus(type); flightOrderDetail.setOrderStatus(command.getType());
flightOrderDetail.setOrderNo(newOrderNo); flightOrderDetail.setOrderNo(newOrderNo);
flightOrderDetail.setDetailId(newOrderNo); flightOrderDetail.setDetailId(newOrderNo);
flightOrderDetail.setCreateTime(command.getCreateTime()); flightOrderDetail.setCreateTime(command.getCreateTime());
flightOrderDetail.setId(null); flightOrderDetail.setId(null);
if (flightOrderDetail.getSupplier().equals(SUPPLIER_C_TRIP_CN_NAME)) { if (orderDetail.getSupplierName().equals(SUPPLIER_C_TRIP)) {
orderExtensionCreator.of(SUPPLIER_C_TRIP).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo()); flightOrderDetail = orderExtensionCreator.of(SUPPLIER_C_TRIP).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo());
} else { } else {
orderExtensionCreator.of(SUPPLIER_L_Y).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo()); flightOrderDetail = orderExtensionCreator.of(SUPPLIER_L_Y).updateFlightOrderDetailData(flightOrderDetail, command.getOrderInfo());
} }
orderDetail.setFlightOrderDetail(flightOrderDetail);
} }
if (productType == 2) {
private void updateHotelOrderDetail(OrderDetail orderDetail, RefundOrderGenerateCommand command, String newOrderNo) {
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
hotelOrderDetail.setOrderAmount(command.getAmount()); hotelOrderDetail.setOrderAmount(command.getAmount());
hotelOrderDetail.setOrderStatus("3"); hotelOrderDetail.setOrderStatus("3");
@ -237,11 +292,13 @@ public class OrderDetailController {
newCustomers.add(customer); newCustomers.add(customer);
} }
hotelOrderDetail.setCustomers(newCustomers); hotelOrderDetail.setCustomers(newCustomers);
if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y_CN_NAME) && hotelOrderDetail.getSupplier().equals(SUPPLIER_L_Y_EXTENSION_NAME)) { if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) {
orderExtensionCreator.of(SUPPLIER_L_Y).updateHotelOrderDetailData(hotelOrderDetail, command.getOrderInfo()); hotelOrderDetail = orderExtensionCreator.of(SUPPLIER_L_Y).updateHotelOrderDetailData(hotelOrderDetail, command.getOrderInfo());
orderDetail.setHotelOrderDetail(hotelOrderDetail);
} }
} }
if (productType == 3) {
private void updateCarOrderDetail(OrderDetail orderDetail, RefundOrderGenerateCommand command, String newOrderNo) {
CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail(); CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail();
carOrderDetail.setOrderAmount(command.getAmount()); carOrderDetail.setOrderAmount(command.getAmount());
carOrderDetail.setOrderStatus("3"); carOrderDetail.setOrderStatus("3");
@ -249,10 +306,6 @@ public class OrderDetailController {
carOrderDetail.setDetailId(newOrderNo); carOrderDetail.setDetailId(newOrderNo);
carOrderDetail.setCreateTime(command.getCreateTime()); carOrderDetail.setCreateTime(command.getCreateTime());
carOrderDetail.setId(null); carOrderDetail.setId(null);
orderDetail.setCarOrderDetail(carOrderDetail);
} }
routeOrder.addOrderDetail(orderDetail);
routeRepository.save(routeOrder);
});
}
} }

View File

@ -117,7 +117,7 @@ public class OrderOutController {
@ApiOperation("查询行程规划订单自定义字段") @ApiOperation("查询行程规划订单自定义字段")
@PostMapping("/query/custom/fields") @PostMapping("/query/custom/fields")
public Result<List<ApproveCustomField>> queryLeg(@RequestBody OrderQueryData queryData) { public Result<List<ApproveCustomField>> queryCustomFields(@RequestBody OrderQueryData queryData) {
RouteOrder routeOrder = routeRepository RouteOrder routeOrder = routeRepository
.findByActualOrderNoAndSysCode(queryData.getActualOrderNo(), queryData.getSysCode()); .findByActualOrderNoAndSysCode(queryData.getActualOrderNo(), queryData.getSysCode());
List<ApproveCustomField> approveCustomFieldList = routeOrder.getRouteCustomExtensionFieldList() List<ApproveCustomField> approveCustomFieldList = routeOrder.getRouteCustomExtensionFieldList()

View File

@ -8,6 +8,7 @@ import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.RouteRequestRepository; import com.chint.domain.repository.RouteRequestRepository;
import com.chint.domain.repository.UserRepository; import com.chint.domain.repository.UserRepository;
import com.chint.infrastructure.util.BigDecimalCalculator;
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail; import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail;
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident;
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
@ -417,7 +418,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderInfo; HotelDetailResponse.Data data = (HotelDetailResponse.Data) hotelOrderInfo;
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo(); HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
List<HotelDetailResponse.RefundInfo> refundInfoList = data.getRefundInfoList();
if (hotelInfo != null && orderInfo != null) { if (hotelInfo != null && orderInfo != null) {
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo()) hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo())
.setDetailId(orderInfo.getOrderSerialNo()) .setDetailId(orderInfo.getOrderSerialNo())
@ -437,23 +438,16 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
.setRefundAmount(String.valueOf(orderInfo.getRefundPrice())) .setRefundAmount(String.valueOf(orderInfo.getRefundPrice()))
.setAgreementHotel(orderInfo.getProtocolType() == 0 ? "" : ""); .setAgreementHotel(orderInfo.getProtocolType() == 0 ? "" : "");
//下单成功的总金额要和退款状态的总金额区分开
if (hotelOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
hotelOrderDetail.setOrderAmount(String.valueOf(orderInfo.getTotalPrice()));
}
//配置付款类型 //配置付款类型
if (orderInfo.getPaymentType() == 1) { if (orderInfo.getPaymentType() == 1) {
hotelOrderDetail.setPaymentType("0"); hotelOrderDetail.setPaymentType("0");
hotelOrderDetail.setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice()));
hotelOrderDetail.setPersonalAmount(KEEP_TWO_DECIMAL_ZERO);
} else { } else {
hotelOrderDetail.setPaymentType("1"); hotelOrderDetail.setPaymentType("1");
hotelOrderDetail.setCompanyAmount(KEEP_TWO_DECIMAL_ZERO);
hotelOrderDetail.setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice()));
} }
List<HotelDetailResponse.RefundInfo> refundInfoList = data.getRefundInfoList();
//如果是退款状态的话要进入这里进行更新 //如果是退款状态的话要进入这里进行更新
if (refundInfoList != null && if (refundInfoList != null &&
!refundInfoList.isEmpty() && !refundInfoList.isEmpty() &&
@ -497,11 +491,29 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
if (!list.isEmpty()) { if (!list.isEmpty()) {
hotelOrderDetail.setStandardItems(list.get(0)); hotelOrderDetail.setStandardItems(list.get(0));
} }
//下单成功的总金额要和退款状态的总金额区分开
if (hotelOrderDetail.getOrderStatus().equals(FSSC_FLIGHT_STATUS_SUCCESS)) {
String totalPrice = String.valueOf(room.getSalesPrice());
hotelOrderDetail.setOrderAmount(totalPrice);
}
hotelOrderDetail.setCompanyAmount(String.valueOf(room.getCompanyPrice()));
hotelOrderDetail.setPersonalAmount(String.valueOf(room.getPersonalPrice()));
} }
return hotelOrderDetail; return hotelOrderDetail;
} }
private String checkAndAddRefundPrice(List<HotelDetailResponse.RefundInfo> refundInfoList, String totalPrice) {
if (refundInfoList != null && !refundInfoList.isEmpty()) {
for (HotelDetailResponse.RefundInfo refundInfo : refundInfoList) {
totalPrice = BigDecimalCalculator.add(totalPrice, String.valueOf(refundInfo.getRefundPrice()));
}
}
return totalPrice;
}
@Override @Override
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) { public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
return null; return null;

View File

@ -33,7 +33,4 @@ public class ApproveRouteData {
private String endTime; private String endTime;
@ApiModelProperty("自定义字段") @ApiModelProperty("自定义字段")
private List<ApproveCustomField> approveCustomFieldList; private List<ApproveCustomField> approveCustomFieldList;
} }

View File

@ -99,7 +99,7 @@ public class CTripUserSaveRequest {
userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it -> authenticationEntity.setName(it.getIdName()), userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it -> authenticationEntity.setName(it.getIdName()),
() -> authenticationEntity.setName(user.getName())); () -> authenticationEntity.setName(user.getName()));
authenticationEntity.setEmployeeID(user.getEmployeeNo()); authenticationEntity.setEmployeeID(user.getEmployeeNo());
authenticationEntity.setValid(user.getWorkStatus()); authenticationEntity.setValid(user.getWorkStatus().charAt(0));
authenticationEntity.setSubAccountName(subAccountName); authenticationEntity.setSubAccountName(subAccountName);
return authenticationEntity; return authenticationEntity;
} }

View File

@ -6,7 +6,7 @@ import lombok.Data;
public class AuthenticationEntity { public class AuthenticationEntity {
private String EmployeeID; private String EmployeeID;
private String Name; private String Name;
private String Valid; //在职情况 A-在职业务操作为新建卡或者更新卡I-离职业务操作为关卡 private char Valid; //在职情况 A-在职业务操作为新建卡或者更新卡I-离职业务操作为关卡
private String RankName; // 职级名称中文职级的中文名跟英文名只能传递其中一个如果需要使用该字段需提前联系实施经理在携程后台进行配置 private String RankName; // 职级名称中文职级的中文名跟英文名只能传递其中一个如果需要使用该字段需提前联系实施经理在携程后台进行配置
private String SubAccountName; //子账户即确定该人员信息落在那个结算主体中用于确定后续订单费用归属 private String SubAccountName; //子账户即确定该人员信息落在那个结算主体中用于确定后续订单费用归属
} }

View File

@ -99,8 +99,6 @@ public class CommonController {
case 3 -> getOrderHotel(notification); case 3 -> getOrderHotel(notification);
case 5 -> getOrderTrain(notification); case 5 -> getOrderTrain(notification);
case 6 -> getOrderCar(notification); case 6 -> getOrderCar(notification);
//50进行行程数据回推
case 50 -> getOrderType(notification);
default -> new LYNoteResponse("100", "OK"); default -> new LYNoteResponse("100", "OK");
}; };
} }
@ -113,17 +111,11 @@ public class CommonController {
*/ */
private LYNoteResponse getOrderCar(Notification notification) { private LYNoteResponse getOrderCar(Notification notification) {
Object notifyData = notification.notifyData; Object notifyData = notification.notifyData;
int subNotifyType = notification.getSubNotifyType();
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class); ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class);
String orderSerialNo = orderCar.getOrder().getOrderSerialNo(); String orderSerialNo = orderCar.getOrder().getOrderSerialNo();
String travelApplyNo = orderCar.getTravelData().getTravelApplyNo(); lyCallBackDataHandler.carCallBackData(orderSerialNo);
OrderTravel orderTravel = new OrderTravel();
orderTravel.setOrderNo(orderSerialNo);
orderTravel.setTravelNo(travelApplyNo);
saveOrderTravel(orderTravel);
lyCallBackDataHandler.carCallBackData(orderSerialNo, 0);
} }
return new LYNoteResponse("100", "OK"); return new LYNoteResponse("100", "OK");
} }
@ -136,19 +128,10 @@ public class CommonController {
*/ */
public LYNoteResponse getOrderTrain(Notification notification) { public LYNoteResponse getOrderTrain(Notification notification) {
Object notifyData = notification.notifyData; Object notifyData = notification.notifyData;
int subNotifyType = notification.getSubNotifyType();
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class); ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class);
int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0; lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo());
if (subNotifyType == 16) {
changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo());
}
String foulReason = orderTrain.getFoulReason();//超标原因
lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo(), Integer.valueOf(ruleViolate), foulReason, subNotifyType);
if (subNotifyType == 2 || subNotifyType == 3 || subNotifyType == 1) {
sendMsg(orderTrain.getTravelData().getTravelApplyNo());
}
} }
return new LYNoteResponse("100", "OK"); return new LYNoteResponse("100", "OK");
} }
@ -168,8 +151,7 @@ public class CommonController {
ResultBackHotel.DataObject dataObject = resultBackHotel.getData(); ResultBackHotel.DataObject dataObject = resultBackHotel.getData();
int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0; int ruleViolate = dataObject.getOrderInfo().getRuleViolate() ? 1 : 0;
String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo(); String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo();
String foulReason = dataObject.getOrderInfo().getFoulReason();//超标原因 lyCallBackDataHandler.hotelCallBackData(orderSerialNo);
lyCallBackDataHandler.hotelCallBackData(orderSerialNo, ruleViolate, foulReason);
if (ruleViolate == 0) { if (ruleViolate == 0) {
sendMsg(dataObject.getTravelData().getTravelApplyNo()); sendMsg(dataObject.getTravelData().getTravelApplyNo());
} }
@ -185,29 +167,13 @@ public class CommonController {
*/ */
public LYNoteResponse getOrderFlight(Notification notification) { public LYNoteResponse getOrderFlight(Notification notification) {
Object notifyData = notification.notifyData; Object notifyData = notification.notifyData;
int subNotifyType = notification.getSubNotifyType();
if (Objects.nonNull(notifyData)) { if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString()); JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class); ResultBackFly resultBackFly = jsonObj.toJavaObject(ResultBackFly.class);
ResultBackFly.DataObject dataObject = resultBackFly.getData(); ResultBackFly.DataObject dataObject = resultBackFly.getData();
// OrderTravel orderTravel = new OrderTravel();
// orderTravel.setOrderNo(dataObject.getOrderDetails().getOrderSerialNo());
// orderTravel.setTravelNo(dataObject.getOrderDetails().getTravelOrderNo());
// saveOrderTravel(orderTravel);
int ruleViolate = dataObject.getOrderDetails().getRuleViolate() ? 1 : 0;
String orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo(); String orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo();
//改签
if (subNotifyType == 9) {
changeFlight(ruleViolate, subNotifyType, orderSerialNo);
}
String foulReason = dataObject.getOrderDetails().getFoulReason();//超标原因
//正常流程 //正常流程
lyCallBackDataHandler.flightCallBackData(orderSerialNo, ruleViolate, foulReason, subNotifyType); lyCallBackDataHandler.flightCallBackData(orderSerialNo);
if (subNotifyType == 2 || subNotifyType == 3 || subNotifyType == 1) {
sendMsg(dataObject.getOrderDetails().getTravelOrderNo());
}
} }
return new LYNoteResponse("100", "OK"); return new LYNoteResponse("100", "OK");
} }
@ -218,61 +184,61 @@ public class CommonController {
* @param notification * @param notification
* @return * @return
*/ */
public LYNoteResponse getOrderType(Notification notification) { // public LYNoteResponse getOrderType(Notification notification) {
int subNotifyType = notification.getSubNotifyType(); // int subNotifyType = notification.getSubNotifyType();
Class<?> objClass = notification.getClass(); // Class<?> objClass = notification.getClass();
Object object = GetObjectNature.getObject(objClass, "notifyData", notification); // Object object = GetObjectNature.getObject(objClass, "notifyData", notification);
Gson gson = new Gson(); // Gson gson = new Gson();
NotifyData common = gson.fromJson(object.toString(), NotifyData.class); // NotifyData common = gson.fromJson(object.toString(), NotifyData.class);
boolean emptyHotel = Objects.nonNull(common.getTravelBizOrderList().getHotelOrderList()); // boolean emptyHotel = Objects.nonNull(common.getTravelBizOrderList().getHotelOrderList());
boolean emptyFly = Objects.nonNull(common.getTravelBizOrderList().getFlightOrderList()); // boolean emptyFly = Objects.nonNull(common.getTravelBizOrderList().getFlightOrderList());
boolean emptyCar = Objects.nonNull(common.getTravelBizOrderList().getCarOrderList()); // boolean emptyCar = Objects.nonNull(common.getTravelBizOrderList().getCarOrderList());
boolean emptyTrain = Objects.nonNull(common.getTravelBizOrderList().getTrainOrderList()); // boolean emptyTrain = Objects.nonNull(common.getTravelBizOrderList().getTrainOrderList());
if (emptyHotel) {//酒店 // if (emptyHotel) {//酒店
NotifyData.HotelOrder hotelOrder = common.getTravelBizOrderList().getHotelOrderList().get(0); // NotifyData.HotelOrder hotelOrder = common.getTravelBizOrderList().getHotelOrderList().get(0);
OrderTravel orderTravel = new OrderTravel(); // OrderTravel orderTravel = new OrderTravel();
orderTravel.setOrderNo(hotelOrder.getOrderInfo().getOrderSerialNo()); // orderTravel.setOrderNo(hotelOrder.getOrderInfo().getOrderSerialNo());
orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo()); // orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
saveOrderTravel(orderTravel); // saveOrderTravel(orderTravel);
String foulReason = hotelOrder.getOrderInfo().getFoulReason();//超标原因 // String foulReason = hotelOrder.getOrderInfo().getFoulReason();//超标原因
return lyCallBackDataHandler.hotelCallBackData(hotelOrder.getOrderInfo().getOrderSerialNo(), hotelOrder.getOrderInfo().getRuleViolate() ? 1 : 0, foulReason); // return lyCallBackDataHandler.hotelCallBackData(hotelOrder.getOrderInfo().getOrderSerialNo(), hotelOrder.getOrderInfo().getRuleViolate() ? 1 : 0, foulReason);
} else if (emptyFly) {//机票originalOrderNo // } else if (emptyFly) {//机票originalOrderNo
NotifyData.OrderDetails flyOrder = common.getTravelBizOrderList().getFlightOrderList().get(0).getOrderDetails(); // NotifyData.OrderDetails flyOrder = common.getTravelBizOrderList().getFlightOrderList().get(0).getOrderDetails();
OrderTravel orderTravel = new OrderTravel(); // OrderTravel orderTravel = new OrderTravel();
orderTravel.setOrderNo(flyOrder.getOrderSerialNo()); // orderTravel.setOrderNo(flyOrder.getOrderSerialNo());
orderTravel.setTravelNo(flyOrder.getTravelOrderNo()); // orderTravel.setTravelNo(flyOrder.getTravelOrderNo());
saveOrderTravel(orderTravel); // saveOrderTravel(orderTravel);
int ruleViolate = flyOrder.getRuleViolate() ? 1 : 0; // int ruleViolate = flyOrder.getRuleViolate() ? 1 : 0;
//改签 // //改签
if (subNotifyType == 9) { // if (subNotifyType == 9) {
changeFlight(ruleViolate, subNotifyType, flyOrder.getOrderSerialNo()); // changeFlight(ruleViolate, subNotifyType, flyOrder.getOrderSerialNo());
} // }
String foulReason = flyOrder.getFoulReason();//超标原因 // String foulReason = flyOrder.getFoulReason();//超标原因
return lyCallBackDataHandler.flightCallBackData(flyOrder.getOrderSerialNo(), flyOrder.getRuleViolate() ? 1 : 0, foulReason, subNotifyType); // return lyCallBackDataHandler.flightCallBackData(flyOrder.getOrderSerialNo(), flyOrder.getRuleViolate() ? 1 : 0, foulReason, subNotifyType);
//
} else if (emptyTrain) {//火车票 // } else if (emptyTrain) {//火车票
NotifyData.TrainOrderList.OrderTrain orderTrain = common.getTravelBizOrderList().getTrainOrderList().get(0); // NotifyData.TrainOrderList.OrderTrain orderTrain = common.getTravelBizOrderList().getTrainOrderList().get(0);
OrderTravel orderTravel = new OrderTravel(); // OrderTravel orderTravel = new OrderTravel();
orderTravel.setOrderNo(orderTrain.getOrderNo()); // orderTravel.setOrderNo(orderTrain.getOrderNo());
orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo()); // orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
saveOrderTravel(orderTravel); // saveOrderTravel(orderTravel);
int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0; // int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0;
if (subNotifyType == 16) { // if (subNotifyType == 16) {
changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo()); // changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo());
} // }
String foulReason = orderTrain.getFoulReason();//超标原因 // String foulReason = orderTrain.getFoulReason();//超标原因
return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo(), orderTrain.getRuleViolate() ? 1 : 0, foulReason, subNotifyType); // return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo(), orderTrain.getRuleViolate() ? 1 : 0, foulReason, subNotifyType);
} else if (emptyCar) { // } else if (emptyCar) {
NotifyData.CarOrderList.Order orderCar = common.getTravelBizOrderList().getCarOrderList().get(0).getOrder(); // NotifyData.CarOrderList.Order orderCar = common.getTravelBizOrderList().getCarOrderList().get(0).getOrder();
OrderTravel orderTravel = new OrderTravel(); // OrderTravel orderTravel = new OrderTravel();
orderTravel.setOrderNo(orderCar.getOrderSerialNo()); // orderTravel.setOrderNo(orderCar.getOrderSerialNo());
orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo()); // orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
saveOrderTravel(orderTravel); // saveOrderTravel(orderTravel);
return lyCallBackDataHandler.carCallBackData(orderCar.getOrderSerialNo(), 0); // return lyCallBackDataHandler.carCallBackData(orderCar.getOrderSerialNo(), 0);
} else { // } else {
return new LYNoteResponse("100", "OK"); // return new LYNoteResponse("100", "OK");
} // }
} // }
public void sendMsg(String travelApplyNo) { public void sendMsg(String travelApplyNo) {

View File

@ -2,8 +2,6 @@ package com.chint.interfaces.rest.ly.in;
import com.chint.application.commands.OrderStatusChangeCommand; import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.OrderEvent;
import com.chint.domain.aggregates.order.OrderTravel;
import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.RouteRepository;
import com.chint.domain.service.RouteRequestDomainService; import com.chint.domain.service.RouteRequestDomainService;
@ -18,9 +16,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.dto.strokepush.Param;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController; import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO;
import com.chint.interfaces.rest.ly.tools.LYOrderUtil; import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -29,7 +25,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.LYConstant.*; import static com.chint.infrastructure.constant.LYConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.*; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_REFUND;
@Component @Component
public class LYCallBackDataHandler { public class LYCallBackDataHandler {
@ -54,7 +50,7 @@ public class LYCallBackDataHandler {
private RouteRequestDomainService routeRequestDomainService; private RouteRequestDomainService routeRequestDomainService;
public LYNoteResponse trainCallBackData(String orderNo, Integer isRuleViolate, String foulReason, int subNotifyType) { public LYNoteResponse trainCallBackData(String orderNo) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo); TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData(); TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData();
TrainDetailResponse.TravelData travelData = data.getTravelData(); TrainDetailResponse.TravelData travelData = data.getTravelData();
@ -62,11 +58,11 @@ public class LYCallBackDataHandler {
Integer productType = L_Y_PRODUCT_TYPE_TRAIN; Integer productType = L_Y_PRODUCT_TYPE_TRAIN;
String travelNo = travelData.getTravelApplyNo(); String travelNo = travelData.getTravelApplyNo();
Integer evenType = LYOrderUtil.mapTrainStatus(data.getOrderStatus()); Integer evenType = LYOrderUtil.mapTrainStatus(data.getOrderStatus());
return dataHandler(orderNo, isRuleViolate, travelNo, data, productType, outStatus, evenType, foulReason, subNotifyType); return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
} }
public LYNoteResponse flightCallBackData(String orderNo, Integer isRuleViolate, String foulReason, int subNotifyType) { public LYNoteResponse flightCallBackData(String orderNo) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo); FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
FlightOrderResponse.Data data = flightOrderDetail.getData(); FlightOrderResponse.Data data = flightOrderDetail.getData();
FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails(); FlightOrderResponse.OrderDetails orderDetails = data.getOrderDetails();
@ -74,10 +70,10 @@ public class LYCallBackDataHandler {
String outStatus = orderDetails.getOrderStatusText(); String outStatus = orderDetails.getOrderStatusText();
Integer evenType = LYOrderUtil.mapFlightStatus(orderDetails.getOrderStatus().toString()); Integer evenType = LYOrderUtil.mapFlightStatus(orderDetails.getOrderStatus().toString());
Integer productType = L_Y_PRODUCT_TYPE_FLY; Integer productType = L_Y_PRODUCT_TYPE_FLY;
return dataHandler(orderNo, isRuleViolate, travelNo, data, productType, outStatus, evenType, foulReason, subNotifyType); return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
} }
public LYNoteResponse hotelCallBackData(String orderNo, Integer isRuleViolate, String foulReason) { public LYNoteResponse hotelCallBackData(String orderNo) {
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderNo); HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderNo);
HotelDetailResponse.Data data = hotelOrderDetail.getData(); HotelDetailResponse.Data data = hotelOrderDetail.getData();
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo(); HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
@ -87,10 +83,18 @@ public class LYCallBackDataHandler {
orderInfo.getOrderStatus() orderInfo.getOrderStatus()
)); ));
Integer productType = L_Y_PRODUCT_TYPE_HOTEL; Integer productType = L_Y_PRODUCT_TYPE_HOTEL;
return dataHandler(orderNo, isRuleViolate, travelNo, data, productType, outStatus, evenType, foulReason, 0);
if (!evenType.equals(ORDER_EVENT_REFUND)) {
//如果订单信息里面没有退款的那么就在进行一次检查
List<HotelDetailResponse.RefundInfo> refundInfoList = data.getRefundInfoList();
if (refundInfoList != null && !refundInfoList.isEmpty()) {
return dataHandler(orderNo, travelNo, data, productType, "提前离店", ORDER_EVENT_REFUND);
}
}
return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
} }
public LYNoteResponse carCallBackData(String orderNo, Integer isRuleViolate) { public LYNoteResponse carCallBackData(String orderNo) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo); CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
CarDetailResponse.DataWrapper data = carDetailResponse.getData(); CarDetailResponse.DataWrapper data = carDetailResponse.getData();
@ -100,49 +104,31 @@ public class LYCallBackDataHandler {
Integer evenType = LYOrderUtil.mapCarStatus(orderDetailInfo.getOrderStatus() Integer evenType = LYOrderUtil.mapCarStatus(orderDetailInfo.getOrderStatus()
); );
Integer productType = L_Y_PRODUCT_TYPE_CAR; Integer productType = L_Y_PRODUCT_TYPE_CAR;
return dataHandler(orderNo, isRuleViolate, travelNo, data, productType, outStatus, evenType, "其它", 0); return dataHandler(orderNo, travelNo, data, productType, outStatus, evenType);
} }
private LYNoteResponse dataHandler(String orderNo, Integer isRuleViolate, String travelNo, private LYNoteResponse dataHandler(String orderNo, String travelNo,
Object data, Integer productType, Object data, Integer productType,
String outStatus, Integer evenType, String foulReason, int subNotifyType) { String outStatus, Integer evenType) {
RouteOrder byOrderNo = routeRequestDomainService.getRouteOrder(travelNo); OrderDetail orderDetail = getOrderDetail(travelNo, data, productType);
SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_L_Y, byOrderNo.getUserId())
.data(data)
.productType(productType);
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
if (orderDetail.getOrderEventList() == null) { if (orderDetail.getOrderEventList() == null) {
orderDetail.setOrderEventList(new ArrayList<>()); orderDetail.setOrderEventList(new ArrayList<>());
} }
List<Integer> list = orderDetail
.getOrderEventList()
.stream()
.map(OrderEvent::getEventType)
.toList();
if (isRuleViolate.equals(L_Y_IS_RULE_VIOLATE) && !list.contains(ORDER_EVENT_ETA)) {
Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail)
.orderNo(orderNo)
.outStatus(outStatus)
.eventType(ORDER_EVENT_ETA)
.extension(foulReason)//超标原因
.sendToQueue();
} else if (isRuleViolate.equals(L_Y_IS_RULE_VIOLATE) &&
!(subNotifyType == 16 || subNotifyType == 9 || ORDER_EVENT_CHANGE == evenType || ORDER_EVENT_REFUND == evenType)
) {
//已经推送过的超标
return new LYNoteResponse("100", "OK");
} else {
Command.of(OrderStatusChangeCommand.class) Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail) .orderDetail(orderDetail)
.orderNo(orderNo) .orderNo(orderNo)
.outStatus(outStatus) .outStatus(outStatus)
.eventType(evenType) .eventType(evenType)
.sendToQueue(); .sendToQueue();
}
return new LYNoteResponse("100", "OK"); return new LYNoteResponse("100", "OK");
} }
private OrderDetail getOrderDetail(String travelNo, Object data, Integer productType) {
RouteOrder byOrderNo = routeRequestDomainService.getRouteOrder(travelNo);
SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_L_Y, byOrderNo.getUserId())
.data(data)
.productType(productType);
return supplierService.handleSupplierCallback(supplierCallbackData);
}
} }

View File

@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.SFConstant.*; import static com.chint.infrastructure.constant.SFConstant.*;
@ -79,46 +80,82 @@ public class PushUser {
} }
public List<User> getUserSFDataFromOpenApiBatch() { public List<User> getUserSFDataFromOpenApiBatch() {
int start;
int pageSize = 1000; int pageSize = 1000;
int page = 1; int page = 1;
List<User> list = new ArrayList<>(); List<User> list = new ArrayList<>();
while (true) { boolean shouldContinue = true;
log.info("Pull user. page={}", page);
start = (page - 1) * 1000; while (shouldContinue) {
Gson gson = new Gson(); int start = (page - 1) * pageSize;
log.info("Pulling user data. Page={}", page);
try {
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>();
map.put("start", start);
map.put("pageSize", pageSize);
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
LinkedHashMap<String, Object> parameters = new LinkedHashMap<>();
parameters.put("start", start);
parameters.put("orgs", List.of("A70000021"));
parameters.put("pageSize", pageSize);
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, parameters);
if (!result.getSuccess()) { if (!result.getSuccess()) {
log.error("Get user error. statusCode={}", result.getCode()); log.error("Failed to get user data. StatusCode={}", result.getCode());
continue; continue;
} }
List<UserDataDTO> userDataDTOs = parseUserData(result);
if (userDataDTOs.isEmpty()) {
shouldContinue = false;
continue;
}
List<User> users = transformUsers(userDataDTOs);
if (users.isEmpty()) {
shouldContinue = false;
continue;
}
if (page % 10 == 0) {
log.info("Pausing after 10 pages...");
Thread.sleep(1000);
}
users.forEach(this::loadAndSaveUser);
page++;
list.addAll(users);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Thread was interrupted", e);
} catch (Exception e) {
log.error("An error occurred: {}", e.getMessage(), e);
shouldContinue = false;
}
}
return list.stream()
.filter(user -> user.getEmployeeNo() != null)
.collect(Collectors.toList());
}
private List<UserDataDTO> parseUserData(DataCenterResult result) {
Type type = new TypeToken<List<UserDataDTO>>() { Type type = new TypeToken<List<UserDataDTO>>() {
}.getType(); }.getType();
return new Gson().fromJson(result.getData().toString(), type);
if (result.getData() == null) {
continue;
} }
List<UserDataDTO> userDataDTOs = gson.fromJson(result.getData().toString(), type); private List<User> transformUsers(List<UserDataDTO> userDataDTOs) {
return userDataDTOs.stream()
.filter(it -> it.getStatus().equals("A"))
.filter(it -> it.getLoginUsername() != null && it.getCompany() != null)
.map(this::mapToUser)
.toList();
}
List<User> users = userDataDTOs.stream() private User mapToUser(UserDataDTO userData) {
.filter(it-> !it.getStatus().equals("A"))
.filter(it -> it.getLoginUsername() != null)
.filter(it -> it.getCompany() != null)
.filter(it -> jtCompanyDomainService.ifCompanyInJT(null, it.getCompany())
|| it.getCompany().equals("A70000056"))
.map(userData -> {
User user = new User(); User user = new User();
user.setCompanyCode(userData.getCompany()); user.setCompanyCode(userData.getCompany());
user.setWorkStatus(userData.getStatus()); user.setWorkStatus(userData.getStatus());
@ -131,42 +168,25 @@ public class PushUser {
user.setQualityLevel(userData.getCust_qualityLevel()); user.setQualityLevel(userData.getCust_qualityLevel());
user.setEmployeeNo(userData.getLoginUsername()); user.setEmployeeNo(userData.getLoginUsername());
return user; return user;
})
.toList();
if (isNullOrEmpty(users)) {
break;
}
if (page % 10 == 0) {
log.info("Pull user wating...");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} }
// if(page == 4){ private void loadAndSaveUser(User user) {
// break; userHttpRequest.loadRankCode(user);
// } Optional.ofNullable(userRepository.findByUserEmployeeNo(user.getEmployeeNo()))
.ifPresentOrElse(
users.forEach(user -> userHttpRequest.loadRankCode(user)); it -> {
page++; // user.setUserId(it.getUserId());
if (it.checkSyncTime()) {
list.addAll(users); it.setWorkStatus(user.getWorkStatus());
asyncUser(it);
} }
},
list = list.stream().filter(user -> user.getEmployeeNo() != null).toList(); () -> {
if (user.checkSyncTime()) {
for (User user : list) {
Optional.ofNullable(userRepository.findByUserEmployeeNo(user.getEmployeeNo())).ifPresentOrElse(
this::asyncUser,()->{
userRepository.save(user);
asyncUser(user); asyncUser(user);
} }
);
} }
);
return list;
} }
public void asyncUser(User user) { public void asyncUser(User user) {

View File

@ -75,10 +75,10 @@ public class UserSFRequest {
} }
public List<UserDataDTO> getUserSFDataFromOpenApiBycompanyName(String companyName) {
// public List<UserDataDTO> getUserSFDataFromOpenApiBycompanyName(String companyName) { return null;
// }
// }
public DataCenterResult requestToDataCenter(LinkedHashMap<String, Object> map) { public DataCenterResult requestToDataCenter(LinkedHashMap<String, Object> map) {
AccessKeyDTO akSkLoad = akSkLoad(); AccessKeyDTO akSkLoad = akSkLoad();

View File

@ -1,5 +1,8 @@
package com.chint.interfaces.rest.user.dto; package com.chint.interfaces.rest.user.dto;
import lombok.Data;
@Data
public class AccessKeyDTO { public class AccessKeyDTO {
public String ak; public String ak;
public String sk; public String sk;

View File

@ -829,9 +829,9 @@ public class LYTest {
System.out.println(json); System.out.println(json);
} }
// @Test @Test
void searchHotel() { void searchHotel() {
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240325155100629867"); HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240317122300088705");
Gson gson = new Gson(); Gson gson = new Gson();
String json = gson.toJson(hotelOrderDetail); String json = gson.toJson(hotelOrderDetail);
System.out.println(json); System.out.println(json);

View File

@ -323,9 +323,10 @@ class RouteApplicationTests {
routeRepository.deleteById(875L); routeRepository.deleteById(875L);
} }
// @Test @Test
void deleteOrderDetail() { void deleteOrderDetail() {
orderDetailRepository.deleteById(2609L); orderDetailRepository.deleteById(2977L);
// orderDetailRepository.deleteById(2975L);
} }
// @Test // @Test
@ -1195,7 +1196,6 @@ class RouteApplicationTests {
} }
@Test @Test
void addRanks() { void addRanks() {