Compare commits
7 Commits
89dfea7c3e
...
bc11e0a9c9
Author | SHA1 | Date |
---|---|---|
lulz1 | bc11e0a9c9 | |
lulz1 | fa0cc239d1 | |
lulz1 | 12011f3769 | |
lulz1 | 7adbd25382 | |
lulz1 | b53e66ea6a | |
lulz1 | 7bc7b8852c | |
lulz1 | 65793fcf49 |
|
@ -11,6 +11,5 @@ public class AuthenticationSignDto extends BaseQuery {
|
|||
private String systemType;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
private String sign;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CTripRecordMonthSaveDTO {
|
||||
private String date;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.application.in;
|
||||
|
||||
|
||||
import com.chint.application.dtos.CTripRecordMonthSaveDTO;
|
||||
import com.chint.domain.factoriy.order_record.LyStatementOrder;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
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.transaction.annotation.Transactional;
|
||||
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.RestController;
|
||||
import com.chint.application.commands.OrderRecordGenerateCommand;
|
||||
|
@ -45,6 +47,16 @@ public class AutoWorkController {
|
|||
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
|
||||
@ApiOperation("自动拉取同程上个月的流水号")
|
||||
@PostMapping("/ly/record/save")
|
||||
|
|
|
@ -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.train.TrainDetailResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -91,9 +90,9 @@ public class OrderDetailController {
|
|||
|
||||
@ApiOperation("订单结算查询接口")
|
||||
@PostMapping("/record/query")
|
||||
public Result<PageResult<Object>> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) {
|
||||
public Result<PageResult> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) {
|
||||
if (signCheck(authenticationDto)) {
|
||||
return orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto);
|
||||
return Result.Success(SUCCESS, orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto));
|
||||
} else {
|
||||
return Result.error("签名错误");
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import com.chint.application.dtos.mapper.OrderDetailMapper;
|
|||
import com.chint.application.dtos.response.OrderDetailRes;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.*;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
|
@ -39,76 +39,37 @@ public class OrderDetailQuery {
|
|||
@Autowired
|
||||
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) {
|
||||
Integer productType = authenticationDto.getProductType();
|
||||
|
@ -118,7 +79,6 @@ public class OrderDetailQuery {
|
|||
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);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public Result<PageResult<Object>> orderRecordInfoPageQuery(AuthenticationSignDto authenticationDto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) {
|
||||
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public class OrderQuery {
|
|||
|
||||
//这里按照业务要求,尝试进行自动确认结束行程
|
||||
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());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -72,6 +72,7 @@ public class OrderCarRecord extends OrderBaseRecord {
|
|||
private String payAmount;//支付总金额
|
||||
|
||||
|
||||
|
||||
//添加行程信息
|
||||
public OrderCarRecord loadTravelInfo(String startTime,
|
||||
String arriveTime,
|
||||
|
|
|
@ -72,17 +72,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
|
||||
CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData;
|
||||
String routeOrderNo = cTripCarRecord.getRouteOrderNo();
|
||||
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
|
||||
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
|
||||
OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord)
|
||||
.carRecord();
|
||||
CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase();
|
||||
//携程的打车订单可以直接通过订单号获取对应的订单
|
||||
Optional<OrderDetail> orderDetail = byOrderNo
|
||||
.getOrderDetails()
|
||||
Optional<OrderDetail> orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails()
|
||||
.stream()
|
||||
.filter(it -> it.getOrderNo().equals(String.valueOf(
|
||||
cTripCarRecordBase.getOrderId()
|
||||
))).findFirst();
|
||||
))).findFirst());
|
||||
|
||||
CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo();
|
||||
|
||||
|
@ -147,7 +146,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
}
|
||||
|
||||
// 加载超标信息, 加载订单关联信息 , 加载订单状态 ,单号,创建时间等信息
|
||||
orderDetail.ifPresent(it -> {
|
||||
orderDetail.ifPresentOrElse(it -> {
|
||||
CarOrderDetail carOrderDetail = it.getCarOrderDetail();
|
||||
orderCarRecord.loadComplianceInfo(it)
|
||||
.loadRelatedOrderInfo(it.getOrderId(),
|
||||
|
@ -158,7 +157,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
.loadBasicOrderInfo(carOrderDetail.getOrderNo(),
|
||||
carOrderDetail.getOrderStatus(),
|
||||
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;
|
||||
}
|
||||
|
@ -208,18 +214,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData;
|
||||
CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo();
|
||||
String routeOrderNo = cTripFlightRecord.getRouteOrderNo();
|
||||
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
|
||||
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
|
||||
OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord)
|
||||
.flightRecord();
|
||||
|
||||
CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo();
|
||||
CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase();
|
||||
//携程的打车订单可以直接通过订单号获取对应的订单
|
||||
Optional<OrderDetail> orderDetail = byOrderNo.
|
||||
Optional<OrderDetail> orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder.
|
||||
getOrderDetails()
|
||||
.stream()
|
||||
.filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId()
|
||||
))).findFirst();
|
||||
))).findFirst());
|
||||
|
||||
// 加载航班信息 , 航线
|
||||
orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(),
|
||||
|
@ -273,19 +279,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
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());
|
||||
|
@ -294,6 +287,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
cTripFlightBaseInfo.getDept2(),
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -336,12 +349,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData;
|
||||
CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail();
|
||||
String routeOrderNo = cTripHotelRecord.getRouteOrderNo();
|
||||
RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo);
|
||||
Optional<RouteOrder> byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo));
|
||||
OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord)
|
||||
.hotelRecord();
|
||||
|
||||
CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo();
|
||||
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(),
|
||||
cTripHotelInfo.getHotelName(),
|
||||
|
@ -391,12 +410,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
}
|
||||
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); // 加载违规信息
|
||||
HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail();
|
||||
orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息
|
||||
|
@ -407,7 +422,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac
|
|||
orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息
|
||||
hotelOrderDetail.getOrderStatus(),
|
||||
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(),
|
||||
|
|
|
@ -17,12 +17,6 @@ public class OrderRecordFactory {
|
|||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
|
||||
|
||||
@Autowired
|
||||
private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory;
|
||||
|
||||
public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) {
|
||||
routeOrder.reloadStatus();
|
||||
OrderRecordBasic orderRecordBasic = new OrderRecordBasic();
|
||||
|
@ -71,11 +65,4 @@ public class OrderRecordFactory {
|
|||
return orderRecordBasic;
|
||||
}
|
||||
|
||||
public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) {
|
||||
return switch (supplierName) {
|
||||
case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory;
|
||||
case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
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.Optional;
|
||||
|
||||
|
@ -9,4 +11,6 @@ public interface OrderCarRecordRepository {
|
|||
List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList);
|
||||
|
||||
Optional<OrderCarRecord> findByDetailId(String detailId);
|
||||
|
||||
PageResult<OrderCarRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
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.Optional;
|
||||
|
||||
|
@ -9,4 +11,10 @@ public interface OrderFlightRecordRepository {
|
|||
List<OrderFlightRecord> saveAll(List<OrderFlightRecord> orderFlightRecordList);
|
||||
|
||||
Optional<OrderFlightRecord> findByDetailId(String detailId);
|
||||
|
||||
PageResult<OrderFlightRecord> findByUpdateDataTime(LocalDateTime startTime,
|
||||
LocalDateTime endTime,
|
||||
Integer pageSize,
|
||||
Integer pageNum,
|
||||
String systemType);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
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.infrastructure.util.PageResult;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -9,4 +12,6 @@ public interface OrderHotelRecordRepository {
|
|||
List<OrderHotelRecord> saveAll(List<OrderHotelRecord> orderHotelRecordList);
|
||||
|
||||
Optional<OrderHotelRecord> findByDetailId(String detailId);
|
||||
|
||||
PageResult<OrderHotelRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
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.OrderTrainRecord;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -10,4 +13,6 @@ public interface OrderTrainRecordRepository {
|
|||
List<OrderTrainRecord> saveAll(List<OrderTrainRecord> orderTrainRecordList);
|
||||
|
||||
Optional<OrderTrainRecord> findByDetailId(String detailId);
|
||||
|
||||
PageResult<OrderTrainRecord> findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType);
|
||||
}
|
||||
|
|
|
@ -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.OrderRecordExtensionFactory;
|
||||
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.service.OrderDetailDomainService;
|
||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -31,13 +33,14 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
|||
@Autowired
|
||||
private CTripOrderDetailRepository cTripOrderDetailRepository;
|
||||
@Autowired
|
||||
private OrderRecordFactory orderRecordFactory;
|
||||
private OrderRecordFactorySelector orderRecordFactorySelector;
|
||||
|
||||
|
||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 0)
|
||||
@Override
|
||||
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
|
||||
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();
|
||||
return orderDetailDomainService.saveHotelOrderRecordBatch(list);
|
||||
}
|
||||
|
@ -48,18 +51,20 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService {
|
|||
return null;
|
||||
}
|
||||
|
||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 1)
|
||||
@Override
|
||||
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
|
||||
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();
|
||||
return orderDetailDomainService.saveFlightOrderRecordBatch(list);
|
||||
}
|
||||
|
||||
@ListenTo(command = "OrderRecordGenerateCommand", order = 2)
|
||||
@Override
|
||||
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
|
||||
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();
|
||||
return orderDetailDomainService.saveCarOrderRecordBatch(list);
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
|||
if (res) {
|
||||
return true;
|
||||
} else {
|
||||
// throw new AuthException(JWT_INVALID);
|
||||
return true;
|
||||
throw new AuthException(JWT_INVALID);
|
||||
// return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ public class OrderConstant {
|
|||
public static final String ORDER_EVENT_REFUND_NAME = "退票";
|
||||
public static final int ORDER_EVENT_FINISH = 5;
|
||||
public static final String ORDER_EVENT_FINISH_NAME = "已完成";
|
||||
|
||||
public static final int ORDER_EVENT_CANCEL = -1;
|
||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||
public static final int ORDER_EVENT_ETA = -2;
|
||||
|
|
|
@ -3,9 +3,14 @@ package com.chint.infrastructure.repository;
|
|||
import com.chint.domain.aggregates.order.order_record.OrderCarRecord;
|
||||
import com.chint.domain.repository.OrderCarRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
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 java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -14,6 +19,7 @@ import java.util.Optional;
|
|||
public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
|
||||
@Autowired
|
||||
private JdbcOrderCarRecordRepository orderCarRecordRepository;
|
||||
|
||||
@Override
|
||||
public List<OrderCarRecord> saveAll(List<OrderCarRecord> orderCarRecordList) {
|
||||
List<OrderCarRecord> res = new ArrayList<>();
|
||||
|
@ -25,4 +31,16 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository {
|
|||
public Optional<OrderCarRecord> findByDetailId(String 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,14 @@ package com.chint.infrastructure.repository;
|
|||
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
|
||||
import com.chint.domain.repository.OrderFlightRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
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 java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,4 +33,12 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit
|
|||
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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
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.OrderHotelRecord;
|
||||
import com.chint.domain.repository.OrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
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 java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,4 +34,12 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor
|
|||
public Optional<OrderHotelRecord> findByDetailId(String 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,14 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
|
|||
import com.chint.domain.repository.OrderTrainRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
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 java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -27,4 +32,12 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor
|
|||
public Optional<OrderTrainRecord> findByDetailId(String 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,18 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
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.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface JdbcOrderCarRecordRepository extends CrudRepository<OrderCarRecord, Long> {
|
||||
|
||||
Optional<OrderCarRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderCarRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
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.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface JdbcOrderFlightRecordRepository extends CrudRepository<OrderFlightRecord, Long> {
|
||||
Optional<OrderFlightRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderFlightRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
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.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface JdbcOrderHotelRecordRepository extends CrudRepository<OrderHotelRecord, Long> {
|
||||
|
||||
Optional<OrderHotelRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderHotelRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
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.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface JdbcOrderTrainRecordRepository extends CrudRepository<OrderTrainRecord, Long> {
|
||||
Optional<OrderTrainRecord> findByDetailId(String detailId);
|
||||
|
||||
Page<OrderTrainRecord> findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -65,8 +65,10 @@ public class CTripOrderDetailRequest {
|
|||
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 dateFromNew = substring + "01";
|
||||
|
||||
|
@ -77,13 +79,11 @@ public class CTripOrderDetailRequest {
|
|||
dateTo,
|
||||
batchNo
|
||||
);
|
||||
|
||||
orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket()));
|
||||
orderFlightParam.setAppKey(C_TRIP_APP_KEY);
|
||||
orderFlightParam.setTicket(ticketRequest.loadTicket());
|
||||
OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam,
|
||||
OrderFlightResponse.class);
|
||||
|
||||
return orderFlightResponse;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
|
@ -30,6 +32,10 @@ public class CTripOrderRecordAutoSave {
|
|||
this.cTripCarRecordAutoSave();
|
||||
}
|
||||
|
||||
public void saveByDate(){
|
||||
|
||||
}
|
||||
|
||||
public void cTripFlightRecordAutoSave() {
|
||||
OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder();
|
||||
List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder
|
||||
|
@ -49,6 +55,13 @@ public class CTripOrderRecordAutoSave {
|
|||
CTripFlightInfo.of(it.getOrderFlightInfo()),
|
||||
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();
|
||||
|
@ -74,13 +87,21 @@ public class CTripOrderRecordAutoSave {
|
|||
record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail),
|
||||
CTripHotelInfo.of(it.getHotelDetail()),
|
||||
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();
|
||||
record.setRecordId(orderDetail.getHotelRelatedJourneyNo());
|
||||
record.setRouteOrderNo(orderDetail.getHotelRelatedJourneyNo());
|
||||
return record;
|
||||
}).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) {
|
||||
record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail),
|
||||
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());
|
||||
|
@ -123,6 +149,14 @@ public class CTripOrderRecordAutoSave {
|
|||
CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()),
|
||||
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();
|
||||
|
|
|
@ -14,8 +14,8 @@ chint:
|
|||
# host: gf-jump.chint.com
|
||||
# port: 30108
|
||||
# database: itinerary_booking
|
||||
# username: 42b24d69-49d0-4085-b8a8-a281d0b66bb2
|
||||
# password: bHFb2HZtUHKIoZ2O
|
||||
# username: fe1ff9fb-6d54-46ab-84ae-e76f00d2d473
|
||||
# password: EpqDr9g6xc3CrQlg
|
||||
|
||||
url: https://trip.chint.com/
|
||||
redis:
|
||||
|
@ -27,8 +27,8 @@ chint:
|
|||
|
||||
logging:
|
||||
level:
|
||||
org.springframework.jdbc.core.JdbcTemplate: info
|
||||
org.springframework.jdbc.core.StatementCreatorUtils: info
|
||||
org.springframework.jdbc.core.JdbcTemplate: debug
|
||||
org.springframework.jdbc.core.StatementCreatorUtils: debug
|
||||
root: info
|
||||
org.springframework.cache: info
|
||||
|
||||
|
|
|
@ -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.in.CTripNoteController;
|
||||
import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest;
|
||||
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -130,6 +131,9 @@ public class CTripTest {
|
|||
@Autowired
|
||||
private CTripOrderDetailImpl cTripOrderDetail;
|
||||
|
||||
@Autowired
|
||||
private CTripOrderRecordAutoSave cTripOrderRecordAutoSave;
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
// @Test
|
||||
void saveFlightRecord(){
|
||||
cTripOrderRecordAutoSave.cTripFlightRecordAutoSave();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ class RouteApplicationTests {
|
|||
|
||||
// @Test
|
||||
void loginSignProd() {
|
||||
String sfno = "231201060";
|
||||
String sfno = "190801115";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000099";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
|
|
Loading…
Reference in New Issue