测试携程结算代码

This commit is contained in:
Superdandan 2024-04-01 11:11:39 +08:00
parent 16f4a64fd5
commit 89dfea7c3e
8 changed files with 103 additions and 17 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
import static com.chint.infrastructure.constant.BelongSystemConstant.*; import static com.chint.infrastructure.constant.BelongSystemConstant.*;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
@Component @Component
public class OrderRecordFactory { public class OrderRecordFactory {
@ -16,6 +17,12 @@ 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();
@ -63,4 +70,12 @@ 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

@ -2,6 +2,7 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -37,14 +38,32 @@ public interface CTripOrderDetailRepository {
void saveAllCarRecord(List<CTripCarRecordBase> ctripCarOrderDetailList); void saveAllCarRecord(List<CTripCarRecordBase> ctripCarOrderDetailList);
CTripCarRecordBase findCarByRecordId(Long id); CTripCarRecordBase findCarByRecordId(Long id);
void saveAllCTripFlightRecord(List<CTripFlightRecord> cTripFlightRecordList); void saveAllCTripFlightRecord(List<CTripFlightRecord> cTripFlightRecordList);
CTripFlightRecord findFlightRecordById(Long id); CTripFlightRecord findFlightRecordById(Long id);
CTripFlightRecord findFlightRecordByRecordId(String recordId); CTripFlightRecord findFlightRecordByRecordId(String recordId);
void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList); void saveAllCTripHotelRecord(List<CTripHotelRecord> cTripHotelRecordList);
CTripHotelRecord findHotelRecordById(Long id); CTripHotelRecord findHotelRecordById(Long id);
CTripHotelRecord findHotelRecordByRecordId(String recordId); CTripHotelRecord findHotelRecordByRecordId(String recordId);
void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList); void saveAllCTripTrainRecord(List<CTripTrainRecord> cTripTrainRecordList);
CTripTrainRecord findTrainRecordByRecordId(String recordId); CTripTrainRecord findTrainRecordByRecordId(String recordId);
void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList); void saveAllCTripCarRecord(List<CTripCarRecord> cTripCarRecordList);
CTripCarRecord findCarRecordByRecordId(String recordId); CTripCarRecord findCarRecordByRecordId(String recordId);
List<CTripHotelRecord> findHotelRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime);
List<CTripFlightRecord> findFlightRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime);
List<CTripCarRecord> findCarRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime);
List<CTripTrainRecord> findTrainRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime);
} }

View File

@ -5,15 +5,21 @@ 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.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
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.OrderRecordFactory;
import com.chint.domain.repository.CTripOrderDetailRepository;
import com.chint.domain.service.OrderDetailDomainService; import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Component @Component
public class CTripOrderRecordDomainService implements OrderRecordDomainService { public class CTripOrderRecordDomainService implements OrderRecordDomainService {
@ -22,12 +28,18 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService{
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
@Autowired @Autowired
private OrderDetailDomainService orderDetailDomainService; private OrderDetailDomainService orderDetailDomainService;
@Autowired
private CTripOrderDetailRepository cTripOrderDetailRepository;
@Autowired
private OrderRecordFactory orderRecordFactory;
@Override @Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) { public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
List<CTripHotelRecord> records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime());
return null; OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderHotelRecord> list = records.stream().map(orderRecordExtensionFactory::createHotelOrderRecord).toList();
return orderDetailDomainService.saveHotelOrderRecordBatch(list);
} }
@Override @Override
@ -38,13 +50,17 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService{
@Override @Override
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) { public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
List<CTripFlightRecord> records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime());
return null; OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderFlightRecord> list = records.stream().map(orderRecordExtensionFactory::createFlightOrderRecord).toList();
return orderDetailDomainService.saveFlightOrderRecordBatch(list);
} }
@Override @Override
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) { public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
List<CTripCarRecord> records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime());
return null; OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP);
List<OrderCarRecord> list = records.stream().map(orderRecordExtensionFactory::createCarOrderRecord).toList();
return orderDetailDomainService.saveCarOrderRecordBatch(list);
} }
} }

View File

@ -6,6 +6,7 @@ import com.chint.infrastructure.repository.jdbc.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -163,11 +164,25 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository {
public CTripCarRecord findCarRecordByRecordId(String recordId) { public CTripCarRecord findCarRecordByRecordId(String recordId) {
return jdbcCTripCarRecordRepository.findByRecordId(recordId); return jdbcCTripCarRecordRepository.findByRecordId(recordId);
} }
//
// @Override
// public Client findByClientId(String clientId){
// return jdbcClientRepository.findByClientId(clientId);
// }
@Override
public List<CTripHotelRecord> findHotelRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) {
return jdbcCTripHotelRecordRepository.findByCreateTimeBetween(startTime, endTime);
}
@Override
public List<CTripFlightRecord> findFlightRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) {
return jdbcCTripFlightRecordRepository.findByCreateTimeBetween(startTime, endTime);
}
@Override
public List<CTripCarRecord> findCarRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) {
return jdbcCTripCarRecordRepository.findByCreateTimeBetween(startTime, endTime);
}
@Override
public List<CTripTrainRecord> findTrainRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) {
return jdbcCTripTrainRecordRepository.findByCreateTimeBetween(startTime, endTime);
}
} }

View File

@ -3,10 +3,16 @@ package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecordBase; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripCarRecordBase;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecordBase; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecordBase;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
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.List;
@Repository @Repository
public interface JdbcCTripCarRecordRepository extends CrudRepository<CTripCarRecord,Long> { public interface JdbcCTripCarRecordRepository extends CrudRepository<CTripCarRecord,Long> {
CTripCarRecord findByRecordId(String recordId); CTripCarRecord findByRecordId(String recordId);
List<CTripCarRecord> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
} }

View File

@ -1,11 +1,16 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecord; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripFlightRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
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.List;
@Repository @Repository
public interface JdbcCTripFlightRecordRepository extends CrudRepository<CTripFlightRecord,Long> { public interface JdbcCTripFlightRecordRepository extends CrudRepository<CTripFlightRecord,Long> {
CTripFlightRecord findByRecordId(String recordId); CTripFlightRecord findByRecordId(String recordId);
List<CTripFlightRecord> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
} }

View File

@ -5,7 +5,12 @@ import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHo
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.List;
@Repository @Repository
public interface JdbcCTripHotelRecordRepository extends CrudRepository<CTripHotelRecord,Long> { public interface JdbcCTripHotelRecordRepository extends CrudRepository<CTripHotelRecord,Long> {
CTripHotelRecord findByRecordId(String recordId); CTripHotelRecord findByRecordId(String recordId);
List<CTripHotelRecord> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
} }

View File

@ -5,7 +5,12 @@ import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripTr
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.List;
@Repository @Repository
public interface JdbcCTripTrainRecordRepository extends CrudRepository<CTripTrainRecord,Long> { public interface JdbcCTripTrainRecordRepository extends CrudRepository<CTripTrainRecord,Long> {
CTripTrainRecord findByRecordId(String recordId); CTripTrainRecord findByRecordId(String recordId);
List<CTripTrainRecord> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
} }