Compare commits

...

7 Commits

31 changed files with 323 additions and 144 deletions

View File

@ -11,6 +11,5 @@ public class AuthenticationSignDto extends BaseQuery {
private String systemType; private String systemType;
private String startTime; private String startTime;
private String endTime; private String endTime;
private String sign; private String sign;
} }

View File

@ -0,0 +1,8 @@
package com.chint.application.dtos;
import lombok.Data;
@Data
public class CTripRecordMonthSaveDTO {
private String date;
}

View File

@ -1,6 +1,7 @@
package com.chint.application.in; package com.chint.application.in;
import com.chint.application.dtos.CTripRecordMonthSaveDTO;
import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.domain.factoriy.order_record.LyStatementOrder;
import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.application.commands.OrderRecordGenerateCommand;
@ -12,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
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.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.application.commands.OrderRecordGenerateCommand;
@ -45,6 +47,16 @@ public class AutoWorkController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("拉取按月份的携程流水")
@PostMapping("/cTrip/record/save/month")
public Result<String> autoSaveCTripRecordByMonth(@RequestBody CTripRecordMonthSaveDTO cTripRecordMonthSaveDTO) {
cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS);
}
@Transactional @Transactional
@ApiOperation("自动拉取同程上个月的流水号") @ApiOperation("自动拉取同程上个月的流水号")
@PostMapping("/ly/record/save") @PostMapping("/ly/record/save")

View File

@ -25,7 +25,6 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderRespon
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 io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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;
@ -91,9 +90,9 @@ public class OrderDetailController {
@ApiOperation("订单结算查询接口") @ApiOperation("订单结算查询接口")
@PostMapping("/record/query") @PostMapping("/record/query")
public Result<PageResult<Object>> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) { public Result<PageResult> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) {
if (signCheck(authenticationDto)) { if (signCheck(authenticationDto)) {
return orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto); return Result.Success(SUCCESS, orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto));
} else { } else {
return Result.error("签名错误"); return Result.error("签名错误");
} }

View File

@ -7,8 +7,8 @@ import com.chint.application.dtos.mapper.OrderDetailMapper;
import com.chint.application.dtos.response.OrderDetailRes; import com.chint.application.dtos.response.OrderDetailRes;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.*;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
@ -39,76 +39,37 @@ public class OrderDetailQuery {
@Autowired @Autowired
private RouteRepository routeRepository; private RouteRepository routeRepository;
@Autowired
private OrderCarRecordRepository orderCarRecordRepository;
@Autowired
private OrderHotelRecordRepository orderHotelRecordRepository;
@Autowired
private OrderFlightRecordRepository orderFlightRecordRepository;
@Autowired
private OrderTrainRecordRepository orderTrainRecordRepository;
public PageResult<?> orderRecordInfoPageQuery(AuthenticationSignDto authenticationDto) {
Integer productType = authenticationDto.getProductType();
String systemType = authenticationDto.getSystemType();
Integer pageSize = authenticationDto.getPageSize();
Integer pageNum = authenticationDto.getPageNum();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter);
LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter);
return switch (productType) {
case 1 -> orderFlightRecordRepository.findByUpdateDataTime(targetTimeBegin,
targetTimeEnd, pageSize, pageNum, systemType);
case 2 -> orderHotelRecordRepository.findByUpdateDataTime(targetTimeBegin,
targetTimeEnd, pageSize, pageNum, systemType);
case 3 -> orderTrainRecordRepository.findByUpdateDataTime(targetTimeBegin,
targetTimeEnd, pageSize, pageNum, systemType);
case 4 -> orderCarRecordRepository.findByUpdateDataTime(targetTimeBegin,
targetTimeEnd, pageSize, pageNum, systemType);
default -> throw new NotFoundException("错误产品类型");
};
}
// public Result<PageResult<Object>> orderDetailInfoPageQuery(AuthenticationSignDto authenticationDto) {
// Integer productType = authenticationDto.getProductType();
// String systemType = authenticationDto.getSystemType();
// Integer pageSize = authenticationDto.getPageSize();
// Integer pageNum = authenticationDto.getPageNum();
//
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter);
// LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter);
// List<OrderDetail> orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd);
// List<Object> orderDetailResList = new ArrayList<>();
// for (OrderDetail orderDetail : orderDetailList) {
// if (productType == 1) {
// FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
//
// if (flightOrderDetail != null) {
// String receiptsNum = flightOrderDetail.getReceiptsNum();
// if (receiptsNum != null) {
// flightOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
// }
// if (flightOrderDetail.getOrderStatus() != null && flightOrderDetail.getBelongSysType() != null && flightOrderDetail.getBelongSysType().equals(systemType)) {
// orderDetailResList.add(flightOrderDetail);
// }
// }
// }
// if (productType == 2) {
// HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
// if (hotelOrderDetail != null) {
// String receiptsNum = hotelOrderDetail.getReceiptsNum();
// if (receiptsNum != null) {
// hotelOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
// }
// if (hotelOrderDetail.getBelongSysType() != null && hotelOrderDetail.getBelongSysType().equals(systemType)) {
// //这里添加过滤逻辑 如果该订单为同程酒店订单 并且金额为0 判断为 临时订单数据
// if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y) && Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0)
// continue;
// orderDetailResList.add(hotelOrderDetail);
// }
// }
// }
// if (productType == 3) {
// TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
// if (trainOrderDetail != null) {
// String receiptsNum = trainOrderDetail.getReceiptsNum();
// if (receiptsNum != null) {
// trainOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
// }
// if (trainOrderDetail.getOrderStatus() != null && trainOrderDetail.getBelongSysType() != null && trainOrderDetail.getBelongSysType().equals(systemType)) {
// orderDetailResList.add(trainOrderDetail);
// }
// }
// }
// if (productType == 4) {
// CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail();
// if (carOrderDetail != null) {
// String receiptsNum = carOrderDetail.getReceiptsNum();
// if (receiptsNum != null) {
// carOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
// }
// if (carOrderDetail.getOrderStatus() != null && carOrderDetail.getBelongSysType() != null && carOrderDetail.getBelongSysType().equals(systemType)) {
// orderDetailResList.add(carOrderDetail);
// }
// }
// }
// }
// List<Object> newres2 = orderDetailResList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).toList();
//
// return Result.Success(SUCCESS, PageResult.totalPageNum(Long.parseLong(String.valueOf(orderDetailResList.size())), newres2));
// }
public Result<PageResult<Object>> orderDetailInfoPageQuery(AuthenticationSignDto authenticationDto) { public Result<PageResult<Object>> orderDetailInfoPageQuery(AuthenticationSignDto authenticationDto) {
Integer productType = authenticationDto.getProductType(); Integer productType = authenticationDto.getProductType();
@ -118,7 +79,6 @@ public class OrderDetailQuery {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter);
LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter);
List<OrderDetail> orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd); List<OrderDetail> orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd);
Stream<Object> orderDetailStream = orderDetailList.stream().map(orderDetail -> switch (productType) { Stream<Object> orderDetailStream = orderDetailList.stream().map(orderDetail -> switch (productType) {
@ -139,10 +99,6 @@ public class OrderDetailQuery {
return Result.Success(SUCCESS, PageResult.totalPageNum(res.size(), paginatedResults)); return Result.Success(SUCCESS, PageResult.totalPageNum(res.size(), paginatedResults));
} }
public Result<PageResult<Object>> orderRecordInfoPageQuery(AuthenticationSignDto authenticationDto) {
return null;
}
private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) { private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) {
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();

View File

@ -154,7 +154,7 @@ public class OrderQuery {
//这里按照业务要求尝试进行自动确认结束行程 //这里按照业务要求尝试进行自动确认结束行程
orders.forEach(it->{ orders.forEach(it->{
if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_EVENT_FINISH)){ if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_STATUS_FINISH)){
orderDomainService.finishOrder(it.getRouteId()); orderDomainService.finishOrder(it.getRouteId());
} }
}); });

View File

@ -72,6 +72,7 @@ public class OrderCarRecord extends OrderBaseRecord {
private String payAmount;//支付总金额 private String payAmount;//支付总金额
//添加行程信息 //添加行程信息
public OrderCarRecord loadTravelInfo(String startTime, public OrderCarRecord loadTravelInfo(String startTime,
String arriveTime, String arriveTime,

View File

@ -72,17 +72,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData;
String routeOrderNo = cTripCarRecord.getRouteOrderNo(); String routeOrderNo = cTripCarRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord)
.carRecord(); .carRecord();
CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase();
//携程的打车订单可以直接通过订单号获取对应的订单 //携程的打车订单可以直接通过订单号获取对应的订单
Optional<OrderDetail> orderDetail = byOrderNo Optional<OrderDetail> orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails()
.getOrderDetails()
.stream() .stream()
.filter(it -> it.getOrderNo().equals(String.valueOf( .filter(it -> it.getOrderNo().equals(String.valueOf(
cTripCarRecordBase.getOrderId() cTripCarRecordBase.getOrderId()
))).findFirst(); ))).findFirst());
CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo(); CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo();
@ -147,7 +146,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
} }
// 加载超标信息, 加载订单关联信息 加载订单状态 单号创建时间等信息 // 加载超标信息, 加载订单关联信息 加载订单状态 单号创建时间等信息
orderDetail.ifPresent(it -> { orderDetail.ifPresentOrElse(it -> {
CarOrderDetail carOrderDetail = it.getCarOrderDetail(); CarOrderDetail carOrderDetail = it.getCarOrderDetail();
orderCarRecord.loadComplianceInfo(it) orderCarRecord.loadComplianceInfo(it)
.loadRelatedOrderInfo(it.getOrderId(), .loadRelatedOrderInfo(it.getOrderId(),
@ -158,7 +157,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
.loadBasicOrderInfo(carOrderDetail.getOrderNo(), .loadBasicOrderInfo(carOrderDetail.getOrderNo(),
carOrderDetail.getOrderStatus(), carOrderDetail.getOrderStatus(),
carOrderDetail.getCreateTime()); carOrderDetail.getCreateTime());
}); }, () -> orderCarRecord.loadRelatedOrderInfo(cTripCarRecordBase.getOrderId(),
cTripCarRecord.getRecordId(),
cTripCarRecord.getRouteOrderNo(),
String.valueOf(cTripCarRecordBase.getOrderId()),
String.valueOf(cTripCarRecordBase.getOrderId()))
.loadBasicOrderInfo( String.valueOf(cTripCarRecordBase.getOrderId()),
"",
cTripCarRecordBase.getCreateTime()));
return orderCarRecord; return orderCarRecord;
} }
@ -208,18 +214,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData;
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord)
.flightRecord(); .flightRecord();
CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo();
CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase(); CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase();
//携程的打车订单可以直接通过订单号获取对应的订单 //携程的打车订单可以直接通过订单号获取对应的订单
Optional<OrderDetail> orderDetail = byOrderNo. Optional<OrderDetail> orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder.
getOrderDetails() getOrderDetails()
.stream() .stream()
.filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId() .filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId()
))).findFirst(); ))).findFirst());
// 加载航班信息 , 航线 // 加载航班信息 , 航线
orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(), orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(),
@ -273,19 +279,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
orderFlightRecord.loadSourceInfo("Y"); orderFlightRecord.loadSourceInfo("Y");
} }
// 加载关联票价原因
orderDetail.ifPresent(it -> {
FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail();
orderFlightRecord.loadComplianceInfo(it)
.loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()),
flightOrderDetail.getOrderStatus(),
cTripFlightRecordBase.getCreateTime())
.loadRelatedOrderInfo(it.getOrderId(),
String.valueOf(cTripFlightRecordBase.getRecordId()),
flightOrderDetail.getReceiptsNum(),
flightOrderDetail.getParentOrderNo(),
it.getOrderNo());
});
// 加载未预订最低价原因 // 加载未预订最低价原因
orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc());
@ -294,6 +287,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
cTripFlightBaseInfo.getDept2(), cTripFlightBaseInfo.getDept2(),
cTripFlightBaseInfo.getDept3()); cTripFlightBaseInfo.getDept3());
// 加载关联票价原因
orderDetail.ifPresentOrElse(it -> {
FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail();
orderFlightRecord.loadComplianceInfo(it)
.loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()),
flightOrderDetail.getOrderStatus(),
cTripFlightRecordBase.getCreateTime())
.loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(),
String.valueOf(cTripFlightRecordBase.getRecordId()),
flightOrderDetail.getReceiptsNum(),
flightOrderDetail.getParentOrderNo(),
it.getOrderNo());
}, () -> orderFlightRecord.loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), //兼容测试环境没有申请单的情况
String.valueOf(cTripFlightRecordBase.getRecordId()),
cTripFlightBaseInfo.getJourneyID(),
String.valueOf(cTripFlightRecordBase.getOrderId()),
String.valueOf(cTripFlightRecordBase.getOrderId()))
.loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()),
"",
cTripFlightRecordBase.getCreateTime()));
return orderFlightRecord; return orderFlightRecord;
} }
@ -336,12 +349,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData;
CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail();
String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo();
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord)
.hotelRecord(); .hotelRecord();
CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo();
CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase(); CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase();
Optional<OrderDetail> orderDetailOptional = byOrderNo.flatMap(it -> it.getOrderDetails()
.stream()
.filter(orderDetail -> orderDetail.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId())))
.findFirst());
// 加载酒店和入住信息 // 加载酒店和入住信息
orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(),
cTripHotelInfo.getHotelName(), cTripHotelInfo.getHotelName(),
@ -391,12 +410,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
} }
orderHotelRecord.loadSourceInfo(sourceInfo); orderHotelRecord.loadSourceInfo(sourceInfo);
Optional<OrderDetail> orderDetailOptional = byOrderNo.getOrderDetails()
.stream()
.filter(it -> it.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId())))
.findFirst();
orderDetailOptional.ifPresent(it -> { orderDetailOptional.ifPresentOrElse(it -> {
orderHotelRecord.loadComplianceInfo(it); // 加载违规信息 orderHotelRecord.loadComplianceInfo(it); // 加载违规信息
HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail(); HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail();
orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息 orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息
@ -407,7 +422,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息
hotelOrderDetail.getOrderStatus(), hotelOrderDetail.getOrderStatus(),
cTripHotelRecordBase.getCreateTime()); cTripHotelRecordBase.getCreateTime());
}); }, () -> orderHotelRecord.loadOrderNoInfo(cTripHotelRecordBase.getOrderId(), //兼容测试环境不存在行程规划单的情况 // 加载订单关联号信息
cTripHotelRecord.getRecordId(),
cTripHotelRecord.getRouteOrderNo(),
String.valueOf(cTripHotelRecordBase.getOrderId()),
String.valueOf(cTripHotelRecordBase.getOrderId()))
.loadBasicOrderInfo(String.valueOf(cTripHotelRecordBase.getOrderId()), // 加载基础订单信息
"",
cTripHotelRecordBase.getCreateTime()));
// 加载财务信息 // 加载财务信息
orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(), orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(),

View File

@ -17,12 +17,6 @@ public class OrderRecordFactory {
@Autowired @Autowired
private UserRepository userRepository; private UserRepository userRepository;
@Autowired
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
@Autowired
private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory;
public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) { public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) {
routeOrder.reloadStatus(); routeOrder.reloadStatus();
OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
@ -71,11 +65,4 @@ public class OrderRecordFactory {
return orderRecordBasic; return orderRecordBasic;
} }
public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) {
return switch (supplierName) {
case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory;
case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory;
default -> null;
};
}
} }

View File

@ -0,0 +1,24 @@
package com.chint.domain.factoriy.order_record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
@Component
public class OrderRecordFactorySelector {
@Autowired
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
@Autowired
private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory;
public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) {
return switch (supplierName) {
case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory;
case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory;
default -> null;
};
}
}

View File

@ -1,7 +1,9 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.infrastructure.util.PageResult;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -9,4 +11,6 @@ public interface OrderCarRecordRepository {
List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList); List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList);
Optional<OrderCarRecord> findByDetailId(String detailId); Optional<OrderCarRecord> findByDetailId(String detailId);
PageResult<OrderCarRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
} }

View File

@ -1,7 +1,9 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.infrastructure.util.PageResult;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -9,4 +11,10 @@ public interface OrderFlightRecordRepository {
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList); List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
Optional<OrderFlightRecord> findByDetailId(String detailId); Optional<OrderFlightRecord> findByDetailId(String detailId);
PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime,
LocalDateTime endTime,
Integer pageSize,
Integer pageNum,
String systemType);
} }

View File

@ -1,7 +1,10 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.infrastructure.util.PageResult;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -9,4 +12,6 @@ public interface OrderHotelRecordRepository {
List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList); List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList);
Optional<OrderHotelRecord> findByDetailId(String detailId); Optional<OrderHotelRecord> findByDetailId(String detailId);
PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
} }

View File

@ -1,8 +1,11 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.infrastructure.util.PageResult;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -10,4 +13,6 @@ public interface OrderTrainRecordRepository {
List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList); List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList);
Optional<OrderTrainRecord> findByDetailId(String detailId); Optional<OrderTrainRecord> findByDetailId(String detailId);
PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
} }

View File

@ -11,8 +11,10 @@ import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHo
import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory; import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory;
import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory; import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory;
import com.chint.domain.factoriy.order_record.OrderRecordFactory; import com.chint.domain.factoriy.order_record.OrderRecordFactory;
import com.chint.domain.factoriy.order_record.OrderRecordFactorySelector;
import com.chint.domain.repository.CTripOrderDetailRepository; import com.chint.domain.repository.CTripOrderDetailRepository;
import com.chint.domain.service.OrderDetailDomainService; import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -31,13 +33,14 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
@Autowired @Autowired
private CTripOrderDetailRepository cTripOrderDetailRepository; private CTripOrderDetailRepository cTripOrderDetailRepository;
@Autowired @Autowired
private OrderRecordFactory orderRecordFactory; private OrderRecordFactorySelector orderRecordFactorySelector;
@ListenTo(command = "OrderRecordGenerateCommand", order = 0)
@Override @Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) { public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
List<CTripHotelRecord> records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime()); List<CTripHotelRecord> records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime());
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderHotelRecord> list = records.stream().map(orderRecordExtensionFactory::createHotelOrderRecord).toList(); List<OrderHotelRecord> list = records.stream().map(orderRecordExtensionFactory::createHotelOrderRecord).toList();
return orderDetailDomainService.saveHotelOrderRecordBatch(list); return orderDetailDomainService.saveHotelOrderRecordBatch(list);
} }
@ -48,18 +51,20 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
return null; return null;
} }
@ListenTo(command = "OrderRecordGenerateCommand", order = 1)
@Override @Override
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) { public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
List<CTripFlightRecord> records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime()); List<CTripFlightRecord> records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime());
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderFlightRecord> list = records.stream().map(orderRecordExtensionFactory::createFlightOrderRecord).toList(); List<OrderFlightRecord> list = records.stream().map(orderRecordExtensionFactory::createFlightOrderRecord).toList();
return orderDetailDomainService.saveFlightOrderRecordBatch(list); return orderDetailDomainService.saveFlightOrderRecordBatch(list);
} }
@ListenTo(command = "OrderRecordGenerateCommand", order = 2)
@Override @Override
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) { public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
List<CTripCarRecord> records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime()); List<CTripCarRecord> records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime());
OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderCarRecord> list = records.stream().map(orderRecordExtensionFactory::createCarOrderRecord).toList(); List<OrderCarRecord> list = records.stream().map(orderRecordExtensionFactory::createCarOrderRecord).toList();
return orderDetailDomainService.saveCarOrderRecordBatch(list); return orderDetailDomainService.saveCarOrderRecordBatch(list);
} }

View File

@ -67,8 +67,8 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor {
if (res) { if (res) {
return true; return true;
} else { } else {
// throw new AuthException(JWT_INVALID); throw new AuthException(JWT_INVALID);
return true; // return true;
} }
} }
} }

View File

@ -14,6 +14,7 @@ public class OrderConstant {
public static final String ORDER_EVENT_REFUND_NAME = "退票"; public static final String ORDER_EVENT_REFUND_NAME = "退票";
public static final int ORDER_EVENT_FINISH = 5; public static final int ORDER_EVENT_FINISH = 5;
public static final String ORDER_EVENT_FINISH_NAME = "已完成"; public static final String ORDER_EVENT_FINISH_NAME = "已完成";
public static final int ORDER_EVENT_CANCEL = -1; public static final int ORDER_EVENT_CANCEL = -1;
public static final String ORDER_EVENT_CANCEL_NAME = "取消"; public static final String ORDER_EVENT_CANCEL_NAME = "取消";
public static final int ORDER_EVENT_ETA = -2; public static final int ORDER_EVENT_ETA = -2;

View File

@ -3,9 +3,14 @@ package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.repository.OrderCarRecordRepository; import com.chint.domain.repository.OrderCarRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -14,6 +19,7 @@ import java.util.Optional;
public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
@Autowired @Autowired
private JdbcOrderCarRecordRepository orderCarRecordRepository; private JdbcOrderCarRecordRepository orderCarRecordRepository;
@Override @Override
public List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList) { public List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList) {
List<OrderCarRecord> res = new ArrayList<>(); List<OrderCarRecord> res = new ArrayList<>();
@ -25,4 +31,16 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
public Optional<OrderCarRecord> findByDetailId(String detailId) { public Optional<OrderCarRecord> findByDetailId(String detailId) {
return orderCarRecordRepository.findByDetailId(detailId); return orderCarRecordRepository.findByDetailId(detailId);
} }
@Override
public PageResult<OrderCarRecord> findByUpdateDataTime(LocalDateTime startTime,
LocalDateTime endTime,
Integer pageSize,
Integer pageNum,
String systemType) {
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
Page<OrderCarRecord> byUpdateDataTimeBetween = orderCarRecordRepository
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
}
} }

View File

@ -3,9 +3,14 @@ package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.repository.OrderFlightRecordRepository; import com.chint.domain.repository.OrderFlightRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -28,4 +33,12 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
return jdbcOrderFlightRecordRepository.findByDetailId(detailId); return jdbcOrderFlightRecordRepository.findByDetailId(detailId);
} }
@Override
public PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) {
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
Page<OrderFlightRecord> byUpdateDataTimeBetween = jdbcOrderFlightRecordRepository
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
}
} }

View File

@ -1,13 +1,19 @@
package com.chint.infrastructure.repository; package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import com.chint.domain.repository.OrderHotelRecordRepository; import com.chint.domain.repository.OrderHotelRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -28,4 +34,12 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
public Optional<OrderHotelRecord> findByDetailId(String detailId) { public Optional<OrderHotelRecord> findByDetailId(String detailId) {
return jdbcOrderHotelRecordRepository.findByDetailId(detailId); return jdbcOrderHotelRecordRepository.findByDetailId(detailId);
} }
@Override
public PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) {
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
Page<OrderHotelRecord> byUpdateDataTimeBetween = jdbcOrderHotelRecordRepository
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
}
} }

View File

@ -5,9 +5,14 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.repository.OrderTrainRecordRepository; import com.chint.domain.repository.OrderTrainRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository;
import com.chint.infrastructure.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -27,4 +32,12 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
public Optional<OrderTrainRecord> findByDetailId(String detailId) { public Optional<OrderTrainRecord> findByDetailId(String detailId) {
return jdbcOrderTrainRecordRepository.findByDetailId(detailId); return jdbcOrderTrainRecordRepository.findByDetailId(detailId);
} }
@Override
public PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) {
PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending());
Page<OrderTrainRecord> byUpdateDataTimeBetween = jdbcOrderTrainRecordRepository
.findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest);
return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent());
}
} }

View File

@ -0,0 +1,22 @@
package com.chint.infrastructure.repository.config;
import com.chint.domain.aggregates.base.BaseEntity;
import com.chint.domain.aggregates.order.order_record.OrderBaseRecord;
import com.chint.infrastructure.util.BaseContext;
import org.springframework.data.relational.core.conversion.MutableAggregateChange;
import org.springframework.data.relational.core.mapping.event.BeforeSaveCallback;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@Component
public class OrderRecordCallbackImpl implements BeforeSaveCallback<OrderBaseRecord> {
@Override
public OrderBaseRecord onBeforeSave(OrderBaseRecord entity, MutableAggregateChange<OrderBaseRecord> aggregateChange) {
if (entity.getCreateDataTime() == null) {
entity.setCreateDataTime(LocalDateTime.now());
}
entity.setUpdateDataTime(LocalDateTime.now());
return entity;
}
}

View File

@ -1,13 +1,18 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRecord, Long> { public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRecord, Long> {
Optional<OrderCarRecord> findByDetailId(String detailId); Optional<OrderCarRecord> findByDetailId(String detailId);
Page<OrderCarRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
} }

View File

@ -1,12 +1,17 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFlightRecord, Long> { public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFlightRecord, Long> {
Optional<OrderFlightRecord> findByDetailId(String detailId); Optional<OrderFlightRecord> findByDetailId(String detailId);
Page<OrderFlightRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
} }

View File

@ -1,13 +1,18 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHotelRecord, Long> { public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHotelRecord, Long> {
Optional<OrderHotelRecord> findByDetailId(String detailId); Optional<OrderHotelRecord> findByDetailId(String detailId);
Page<OrderHotelRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
} }

View File

@ -1,12 +1,17 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrainRecord, Long> { public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrainRecord, Long> {
Optional<OrderTrainRecord> findByDetailId(String detailId); Optional<OrderTrainRecord> findByDetailId(String detailId);
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
} }

View File

@ -65,8 +65,10 @@ public class CTripOrderDetailRequest {
return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime)); return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime));
} }
public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){
public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){
String substring = dateFrom.substring(0, 6); String substring = dateFrom.substring(0, 6);
String dateFromNew = substring + "01"; String dateFromNew = substring + "01";
@ -77,13 +79,11 @@ public class CTripOrderDetailRequest {
dateTo, dateTo,
batchNo batchNo
); );
orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket()));
orderFlightParam.setAppKey(C_TRIP_APP_KEY); orderFlightParam.setAppKey(C_TRIP_APP_KEY);
orderFlightParam.setTicket(ticketRequest.loadTicket()); orderFlightParam.setTicket(ticketRequest.loadTicket());
OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam, OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam,
OrderFlightResponse.class); OrderFlightResponse.class);
return orderFlightResponse; return orderFlightResponse;
} }

View File

@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@ -30,6 +32,10 @@ public class CTripOrderRecordAutoSave {
this.cTripCarRecordAutoSave(); this.cTripCarRecordAutoSave();
} }
public void saveByDate(){
}
public void cTripFlightRecordAutoSave() { public void cTripFlightRecordAutoSave() {
OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder(); OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder();
List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder
@ -49,6 +55,13 @@ public class CTripOrderRecordAutoSave {
CTripFlightInfo.of(it.getOrderFlightInfo()), CTripFlightInfo.of(it.getOrderFlightInfo()),
CTripFlightBaseInfo.of(it.getOrderBaseInfo()) CTripFlightBaseInfo.of(it.getOrderBaseInfo())
); );
} else {
Long originId = record.getId();
record = CTripFlightRecord.of(
CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo),
CTripFlightInfo.of(it.getOrderFlightInfo()),
CTripFlightBaseInfo.of(it.getOrderBaseInfo()));
record.setId(originId);
} }
//补充额外的字段 //补充额外的字段
OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo();
@ -74,13 +87,21 @@ public class CTripOrderRecordAutoSave {
record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail),
CTripHotelInfo.of(it.getHotelDetail()), CTripHotelInfo.of(it.getHotelDetail()),
CTripHotelOrderDetail.of(it.getOrderDetail())); CTripHotelOrderDetail.of(it.getOrderDetail()));
} else {
Long originId = record.getId();
record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail),
CTripHotelInfo.of(it.getHotelDetail()),
CTripHotelOrderDetail.of(it.getOrderDetail()));
record.setId(originId);
} }
//补充额外的字段 //补充额外的字段
OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail(); OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail();
record.setRecordId(orderDetail.getHotelRelatedJourneyNo()); record.setRouteOrderNo(orderDetail.getHotelRelatedJourneyNo());
return record; return record;
}).toList(); }).toList();
cTripOrderDetailRepository.saveAllCTripHotelRecord(list); Map<Boolean, List<CTripHotelRecord>> collect = list.stream()
.collect(Collectors.groupingBy(record -> record.getId() != null));
collect.values().forEach(it -> cTripOrderDetailRepository.saveAllCTripHotelRecord(it));
} }
} }
@ -98,6 +119,11 @@ public class CTripOrderRecordAutoSave {
if (record == null) { if (record == null) {
record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail), record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail),
CTripTrainInfo.of(it.getTrainSettlementTicket())); CTripTrainInfo.of(it.getTrainSettlementTicket()));
} else {
Long originId = record.getId();
record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail),
CTripTrainInfo.of(it.getTrainSettlementTicket()));
record.setId(originId);
} }
//补充额外的字段 //补充额外的字段
record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID()); record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID());
@ -123,6 +149,14 @@ public class CTripOrderRecordAutoSave {
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()), CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()),
CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0)) CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0))
); );
} else {
Long originId = record.getId();
record = CTripCarRecord.of(
CTripCarRecordBase.changeInfo(settlementBaseInfo),
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()),
CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0))
);
record.setId(originId);
} }
//补充额外的字段 //补充额外的字段
OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo(); OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo();

View File

@ -14,8 +14,8 @@ chint:
# host: gf-jump.chint.com # host: gf-jump.chint.com
# port: 30108 # port: 30108
# database: itinerary_booking # database: itinerary_booking
# username: 42b24d69-49d0-4085-b8a8-a281d0b66bb2 # username: fe1ff9fb-6d54-46ab-84ae-e76f00d2d473
# password: bHFb2HZtUHKIoZ2O # password: EpqDr9g6xc3CrQlg
url: https://trip.chint.com/ url: https://trip.chint.com/
redis: redis:
@ -27,8 +27,8 @@ chint:
logging: logging:
level: level:
org.springframework.jdbc.core.JdbcTemplate: info org.springframework.jdbc.core.JdbcTemplate: debug
org.springframework.jdbc.core.StatementCreatorUtils: info org.springframework.jdbc.core.StatementCreatorUtils: debug
root: info root: info
org.springframework.cache: info org.springframework.cache: info

View File

@ -40,6 +40,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.in.CTripNoteController; import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest; import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest;
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -130,6 +131,9 @@ public class CTripTest {
@Autowired @Autowired
private CTripOrderDetailImpl cTripOrderDetail; private CTripOrderDetailImpl cTripOrderDetail;
@Autowired
private CTripOrderRecordAutoSave cTripOrderRecordAutoSave;
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
@ -613,4 +617,9 @@ public class CTripTest {
System.out.println(gson.toJson(byId)); System.out.println(gson.toJson(byId));
} }
// @Test
void saveFlightRecord(){
cTripOrderRecordAutoSave.cTripFlightRecordAutoSave();
}
} }

View File

@ -279,7 +279,7 @@ class RouteApplicationTests {
// @Test // @Test
void loginSignProd() { void loginSignProd() {
String sfno = "231201060"; String sfno = "190801115";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ240225000099"; String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";