提交结算明细部分代码

This commit is contained in:
lulz1 2024-03-27 16:13:24 +08:00
parent 216a41b1fd
commit 1586d398e5
25 changed files with 328 additions and 151 deletions

View File

@ -0,0 +1,15 @@
package com.chint.application.commands;
import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@Data
public class OrderRecordGenerateCommand extends Command {
//将昨天的结算数据生成为财务共享需要的数据
private LocalDateTime startTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MIDNIGHT);
private LocalDateTime endTime = LocalDateTime.of(LocalDate.now().minusDays(1), LocalTime.MAX);
}

View File

@ -1,6 +1,8 @@
package com.chint.application.in; package com.chint.application.in;
import com.chint.application.commands.OrderRecordGenerateCommand;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -22,10 +24,12 @@ public class AutoWorkController {
@Transactional @Transactional
@ApiOperation("自动拉取携程昨天的流水号每天晚上8点执行") @ApiOperation("自动拉取昨天的流水号每天晚上8点执行")
@PostMapping("/cTrip/record/save") @PostMapping("/cTrip/record/save")
public Result<String> autoSaveCTripRecord(){ public Result<String> autoSaveCTripRecord(){
cTripOrderRecordAutoSave.saveAll(); cTripOrderRecordAutoSave.saveAll();
//将昨天的结算数据生成为财务共享需要的数据
Command.of(OrderRecordGenerateCommand.class).sendToQueue();
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }

View File

@ -93,7 +93,7 @@ public class OrderDetailController {
@PostMapping("/record/query") @PostMapping("/record/query")
public Result<PageResult<Object>> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) { public Result<PageResult<Object>> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) {
if (signCheck(authenticationDto)) { if (signCheck(authenticationDto)) {
return orderDetailPageQuery.orderDetailInfoPageQuery(authenticationDto); return orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto);
} else { } else {
return Result.error("签名错误"); return Result.error("签名错误");
} }
@ -153,7 +153,6 @@ public class OrderDetailController {
return Result.Success(SUCCESS, flightOrderDetail); return Result.Success(SUCCESS, flightOrderDetail);
} }
@TransitionTo(command = "RefundOrderGenerateCommand", order = 0) @TransitionTo(command = "RefundOrderGenerateCommand", order = 0)
public void generateCTripRefund(RefundOrderGenerateCommand command) { public void generateCTripRefund(RefundOrderGenerateCommand command) {
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> { orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {

View File

@ -0,0 +1,17 @@
package com.chint.domain.aggregates.order.ctrip;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
@Table("c_trip_car_record")
public class CTripCarRecord {
@Id
private Long id;
@MappedCollection(idColumn = "id")
private CTripCarRecordBase cTripCarRecordBase;
}

View File

@ -16,7 +16,7 @@ import java.io.Serializable;
**/ **/
@Data @Data
@Table("c_trip_order_car_settlement_base_info") @Table("c_trip_order_car_settlement_base_info")
public class CtripCarOrderDetail implements Serializable { public class CTripCarRecordBase implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 4583214623558870145L; private static final long serialVersionUID = 4583214623558870145L;
@ -67,9 +67,9 @@ public class CtripCarOrderDetail implements Serializable {
private String payMixFlag; private String payMixFlag;
private Double personAmount; private Double personAmount;
public static CtripCarOrderDetail changeInfo(OrderCarResponse.CarOrderSettlementBaseInfo carOrderSettlementBaseInfo) { public static CTripCarRecordBase changeInfo(OrderCarResponse.CarOrderSettlementBaseInfo carOrderSettlementBaseInfo) {
CtripCarOrderDetail ctripCarOrderDetail = new CtripCarOrderDetail(); CTripCarRecordBase ctripCarOrderDetail = new CTripCarRecordBase();
if (carOrderSettlementBaseInfo != null) { if (carOrderSettlementBaseInfo != null) {

View File

@ -0,0 +1,64 @@
package com.chint.domain.aggregates.order.ctrip;
import cn.hutool.core.bean.BeanUtil;
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("c_trip_flight_info")
public class CTripFlightInfo {
@Id
private Long id;
private Long cTripFlightRecordId;
private int Sequence;
private String Reason;
private String ReasonDesc;
private String LowFlight;
private String LowClass;
private String LowDTime;
private double LowRate;
private double LowPrice;
private String PreBookReason;
private String PreBookReasonDesc;
private String StraightType;
private String TakeOffTime;
private String ArrivalTime;
private String DCityName;
private String ACityName;
private String DPortName;
private String APortName;
private String Flight;
private String ClassNameNew;
private String ClassName;
private String SubClass;
private String BfReturn;
private String CustomerID;
private double StandardPrice;
private double EClassStandardPrice;
private double PriceRate;
private int FlightTime;
private String ClassReason;
private String ClassReasonDesc;
private String AgreementReason;
private String AgreementReasonDesc;
private String CraftType;
private String DCityCode;
private String ACityCode;
private double AgreementRate;
private String AirLineName;
private int DCityID;
private String DepartureDistrictCode;
private int ACityID;
private String ArrivalDistrictCode;
private String DiscountReasonCode;
private String CustomDiscountReason;
private String DiscountReasonDesc;
private String RoundTripType;
private String TimeReasonDesc;
public static CTripFlightInfo of(OrderFlightResponse.OrderFlightInfo OrderFlightInfo){
return BeanUtil.copyProperties(OrderFlightInfo,CTripFlightInfo.class);
}
}

View File

@ -0,0 +1,24 @@
package com.chint.domain.aggregates.order.ctrip;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("c_trip_flight_record")
public class CTripFlightRecord {
@Id
private Long id;
@MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightRecordBase cTripFlightRecordBase;
@MappedCollection(idColumn = "c_trip_flight_record_id")
private CTripFlightInfo cTripFlightInfo;
public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo) {
CTripFlightRecord cTripFlightRecord = new CTripFlightRecord();
cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase);
cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo);
return cTripFlightRecord;
}
}

View File

@ -1,8 +1,5 @@
package com.chint.domain.aggregates.order.ctrip; package com.chint.domain.aggregates.order.ctrip;
import cn.hutool.core.bean.BeanUtil;
import com.chint.domain.aggregates.order.HotelOrderDetail;
import com.chint.domain.aggregates.order.HotelOrderDetailCustomer;
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
@ -10,7 +7,6 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
/** /**
* @author wanglf3 * @author wanglf3
@ -19,12 +15,12 @@ import java.util.ArrayList;
**/ **/
@Data @Data
@Table("c_trip_order_flight_settlement_base_info") @Table("c_trip_order_flight_settlement_base_info")
public class CtripFlightOrderDetail implements Serializable { public class CTripFlightRecordBase implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -2563945926793686074L; private static final long serialVersionUID = -2563945926793686074L;
@Id @Id
private Long id; private Long id;
private Long cTripFlightRecordId;
private Long recordId; private Long recordId;
private Long orderId; private Long orderId;
private Integer sequence; private Integer sequence;
@ -89,11 +85,9 @@ public class CtripFlightOrderDetail implements Serializable {
private Double obFee; private Double obFee;
public static CtripFlightOrderDetail changeInfo(OrderFlightResponse.FlightOrderSettlementBaseInfo flightOrderSettlementBaseInfo) { public static CTripFlightRecordBase changeInfo(OrderFlightResponse.FlightOrderSettlementBaseInfo flightOrderSettlementBaseInfo) {
CtripFlightOrderDetail ctripFlightOrderDetail = new CtripFlightOrderDetail(); CTripFlightRecordBase ctripFlightOrderDetail = new CTripFlightRecordBase();
if (flightOrderSettlementBaseInfo != null){ if (flightOrderSettlementBaseInfo != null){
ctripFlightOrderDetail.setRecordId(flightOrderSettlementBaseInfo.getRecordID()); ctripFlightOrderDetail.setRecordId(flightOrderSettlementBaseInfo.getRecordID());
ctripFlightOrderDetail.setOrderId(flightOrderSettlementBaseInfo.getOrderID()); ctripFlightOrderDetail.setOrderId(flightOrderSettlementBaseInfo.getOrderID());
ctripFlightOrderDetail.setSequence(flightOrderSettlementBaseInfo.getSequence()); ctripFlightOrderDetail.setSequence(flightOrderSettlementBaseInfo.getSequence());

View File

@ -1,6 +1,5 @@
package com.chint.domain.aggregates.order.ctrip; package com.chint.domain.aggregates.order.ctrip;
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
@ -9,8 +8,6 @@ import org.springframework.data.relational.core.mapping.Table;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/** /**
* @author wanglf3 * @author wanglf3
@ -19,7 +16,7 @@ import java.util.Date;
**/ **/
@Data @Data
@Table("c_trip_order_hotel_settlement_base_info") @Table("c_trip_order_hotel_settlement_base_info")
public class CtripHotelOrderDetail implements Serializable { public class CTripHotelRecordBase implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 3087333171110684513L; private static final long serialVersionUID = 3087333171110684513L;
@Id @Id
@ -73,8 +70,8 @@ public class CtripHotelOrderDetail implements Serializable {
public static CtripHotelOrderDetail changeInfo(OrderHotelResponse.SettlementDetail SettlementDetail) { public static CTripHotelRecordBase changeInfo(OrderHotelResponse.SettlementDetail SettlementDetail) {
CtripHotelOrderDetail ctripHotelOrderDetail = new CtripHotelOrderDetail(); CTripHotelRecordBase ctripHotelOrderDetail = new CTripHotelRecordBase();
if (SettlementDetail != null){ if (SettlementDetail != null){
ctripHotelOrderDetail.setRecordId(SettlementDetail.getRecordId()); ctripHotelOrderDetail.setRecordId(SettlementDetail.getRecordId());
ctripHotelOrderDetail.setOrderId(SettlementDetail.getOrderID()); ctripHotelOrderDetail.setOrderId(SettlementDetail.getOrderID());

View File

@ -1,6 +1,5 @@
package com.chint.domain.aggregates.order.ctrip; package com.chint.domain.aggregates.order.ctrip;
import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderTrainResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderTrainResponse;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
@ -17,7 +16,7 @@ import java.io.Serializable;
**/ **/
@Data @Data
@Table("c_trip_order_train_settlement_base_info") @Table("c_trip_order_train_settlement_base_info")
public class CtripTrainOrderDetail implements Serializable { public class CTripTrainRecordBase implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1642492804808714974L; private static final long serialVersionUID = 1642492804808714974L;
@Id @Id
@ -76,9 +75,9 @@ public class CtripTrainOrderDetail implements Serializable {
private Double ticketPrice; private Double ticketPrice;
private Double refundTicketServiceFee; private Double refundTicketServiceFee;
public static CtripTrainOrderDetail changeInfo(OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail) { public static CTripTrainRecordBase changeInfo(OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail) {
CtripTrainOrderDetail ctripTrainOrderDetail = new CtripTrainOrderDetail(); CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase();
if (trainSettlementDetail != null){ if (trainSettlementDetail != null){
ctripTrainOrderDetail.setRecordId(trainSettlementDetail.getRecordID()); ctripTrainOrderDetail.setRecordId(trainSettlementDetail.getRecordID());
ctripTrainOrderDetail.setOrderId(trainSettlementDetail.getOrderID()); ctripTrainOrderDetail.setOrderId(trainSettlementDetail.getOrderID());

View File

@ -8,7 +8,6 @@ import com.chint.domain.value_object.OrderSaveData;
public interface OrderFactory { public interface OrderFactory {
RouteOrder createRoute(OrderSaveData orderData); RouteOrder createRoute(OrderSaveData orderData);
RouteOrder createRoute(OrderCreateCommand command); RouteOrder createRoute(OrderCreateCommand command);
ApprovalEvent createApprovalEvent(Integer eventType); ApprovalEvent createApprovalEvent(Integer eventType);
} }

View File

@ -9,6 +9,7 @@ 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.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;
@ -17,6 +18,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFa
@Autowired @Autowired
private OrderDetailDomainService orderDetailDomainService; private OrderDetailDomainService orderDetailDomainService;
@Autowired
private JdbcCtripHotelOrderDetailRepository jdbcCtripHotelOrderDetailRepository;
@Override @Override
public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) {
@ -27,16 +30,19 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFa
@Override @Override
public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) { public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) {
return null; return null;
} }
@Override @Override
public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) {
return null; return null;
} }
@Override @Override
public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) {
return null; return null;
} }
} }

View File

@ -23,6 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -45,13 +48,14 @@ public class LyStatementOrder {
@Autowired @Autowired
private JdbcLyOrderCarRecord jdbcLyOrderCarRecord; private JdbcLyOrderCarRecord jdbcLyOrderCarRecord;
/** /**
* 同程账单数据拉取 * 同程账单数据拉取
* *
* @param beginDate 2024-03-01 00:00:00 * @param beginDate 2024-03-01 00:00:00
* @param endDate 2024-03-26 00:00:00 * @param endDate 2024-03-26 00:00:00
*/ */
@Transactional @Transactional
public void statementOrder(String beginDate, String endDate) { public void statementOrder(String beginDate, String endDate) {
StatementPageList param = new StatementPageList(); StatementPageList param = new StatementPageList();

View File

@ -1,9 +1,6 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail; import com.chint.domain.aggregates.order.ctrip.*;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail;
import java.util.List; import java.util.List;
@ -14,27 +11,31 @@ import java.util.List;
**/ **/
public interface CTripOrderDetailRepository { public interface CTripOrderDetailRepository {
CtripFlightOrderDetail save(CtripFlightOrderDetail ctripFlightOrderDetail); CTripFlightRecordBase save(CTripFlightRecordBase ctripFlightOrderDetail);
void saveAllFlightRecord(List<CtripFlightOrderDetail> cTripFlightOrderDetailList); void saveAllFlightRecord(List<CTripFlightRecordBase> cTripFlightOrderDetailList);
CtripFlightOrderDetail findFlightByRecordId(Long id); CTripFlightRecord save(CTripFlightRecord cTripFlightRecord);
CtripHotelOrderDetail save(CtripHotelOrderDetail cTripHotelOrderDetailList); void saveAll(List<CTripFlightRecord> cTripFlightRecordList);
void saveAllHotelRecord(List<CtripHotelOrderDetail> ctripHotelOrderDetailList); CTripFlightRecordBase findFlightByRecordId(Long id);
CtripHotelOrderDetail findHotelByRecordId(Long id); CTripHotelRecordBase save(CTripHotelRecordBase cTripHotelOrderDetailList);
CtripTrainOrderDetail save(CtripTrainOrderDetail ctripTrainOrderDetail); void saveAllHotelRecord(List<CTripHotelRecordBase> ctripHotelOrderDetailList);
void saveAllTrainRecord(List<CtripTrainOrderDetail> ctripTrainOrderDetailList); CTripHotelRecordBase findHotelByRecordId(Long id);
CtripTrainOrderDetail findTrainByRecordId(Long id); CTripTrainRecordBase save(CTripTrainRecordBase ctripTrainOrderDetail);
CtripCarOrderDetail save(CtripCarOrderDetail ctripCarOrderDetail); void saveAllTrainRecord(List<CTripTrainRecordBase> ctripTrainOrderDetailList);
void saveAllCarRecord(List<CtripCarOrderDetail> ctripCarOrderDetailList); CTripTrainRecordBase findTrainByRecordId(Long id);
CtripCarOrderDetail findCarByRecordId(Long id); CTripCarRecordBase save(CTripCarRecordBase ctripCarOrderDetail);
void saveAllCarRecord(List<CTripCarRecordBase> ctripCarOrderDetailList);
CTripCarRecordBase findCarByRecordId(Long id);
} }

View File

@ -0,0 +1,46 @@
package com.chint.domain.service.order_record;
import com.chint.application.commands.OrderRecordGenerateCommand;
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.aggregates.order.order_record.OrderTrainRecord;
import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
@Component
public class CTripOrderRecordDomainService implements OrderRecordDomainService{
@Autowired
private JdbcCtripHotelOrderDetailRepository jdbcCtripHotelOrderDetailRepository;
@Autowired
private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory;
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
return null;
}
}

View File

@ -0,0 +1,36 @@
package com.chint.domain.service.order_record;
import com.chint.application.commands.OrderRecordGenerateCommand;
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.aggregates.order.order_record.OrderTrainRecord;
import java.time.LocalDateTime;
import java.util.List;
public class LYOrderRecordDomainService implements OrderRecordDomainService{
@Override
public List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command) {
LocalDateTime startTime = command.getStartTime();
return null;
}
@Override
public List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command) {
return null;
}
@Override
public List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command) {
return null;
}
}

View File

@ -0,0 +1,16 @@
package com.chint.domain.service.order_record;
import com.chint.application.commands.OrderRecordGenerateCommand;
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.aggregates.order.order_record.OrderTrainRecord;
import java.util.List;
public interface OrderRecordDomainService {
List<OrderHotelRecord> generateHotelRecord(OrderRecordGenerateCommand command);
List<OrderTrainRecord> generateTrainRecord(OrderRecordGenerateCommand command);
List<OrderFlightRecord> generateFlightRecord(OrderRecordGenerateCommand command);
List<OrderCarRecord> generateCarRecord(OrderRecordGenerateCommand command);
}

View File

@ -1,14 +1,8 @@
package com.chint.infrastructure.repository; package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail; import com.chint.domain.aggregates.order.ctrip.*;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail;
import com.chint.domain.repository.CTripOrderDetailRepository; import com.chint.domain.repository.CTripOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcCtripCarOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.*;
import com.chint.infrastructure.repository.jdbc.JdbcCtripFlightOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcCtripTrainOrderDetailRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -38,66 +32,79 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository {
@Autowired @Autowired
private JdbcCtripCarOrderDetailRepository jdbcCtripCarOrderDetailRepository; private JdbcCtripCarOrderDetailRepository jdbcCtripCarOrderDetailRepository;
@Autowired
private JdbcCTripFlightRecordRepository jdbcCTripFlightRecordRepository;
@Override @Override
public CtripFlightOrderDetail save(CtripFlightOrderDetail ctripFlightOrderDetail) { public CTripFlightRecordBase save(CTripFlightRecordBase ctripFlightOrderDetail) {
return jdbcCtripFlightOrderDetailRepository.save(ctripFlightOrderDetail); return jdbcCtripFlightOrderDetailRepository.save(ctripFlightOrderDetail);
} }
@Override @Override
public void saveAllFlightRecord(List<CtripFlightOrderDetail> cTripFlightOrderDetailList) { public void saveAllFlightRecord(List<CTripFlightRecordBase> cTripFlightOrderDetailList) {
jdbcCtripFlightOrderDetailRepository.saveAll(cTripFlightOrderDetailList); jdbcCtripFlightOrderDetailRepository.saveAll(cTripFlightOrderDetailList);
} }
@Override @Override
public CtripFlightOrderDetail findFlightByRecordId(Long recordId) { public CTripFlightRecord save(CTripFlightRecord cTripFlightRecord) {
return jdbcCTripFlightRecordRepository.save(cTripFlightRecord);
}
@Override
public void saveAll(List<CTripFlightRecord> cTripFlightRecordList) {
jdbcCTripFlightRecordRepository.saveAll(cTripFlightRecordList);
}
@Override
public CTripFlightRecordBase findFlightByRecordId(Long recordId) {
return jdbcCtripFlightOrderDetailRepository.findByRecordId(recordId); return jdbcCtripFlightOrderDetailRepository.findByRecordId(recordId);
} }
@Override @Override
public CtripHotelOrderDetail save(CtripHotelOrderDetail ctripHotelOrderDetail) { public CTripHotelRecordBase save(CTripHotelRecordBase ctripHotelOrderDetail) {
return jdbcCtripHotelOrderDetailRepository.save(ctripHotelOrderDetail); return jdbcCtripHotelOrderDetailRepository.save(ctripHotelOrderDetail);
} }
@Override @Override
public void saveAllHotelRecord(List<CtripHotelOrderDetail> ctripHotelOrderDetailList) { public void saveAllHotelRecord(List<CTripHotelRecordBase> ctripHotelOrderDetailList) {
jdbcCtripHotelOrderDetailRepository.saveAll(ctripHotelOrderDetailList); jdbcCtripHotelOrderDetailRepository.saveAll(ctripHotelOrderDetailList);
} }
@Override @Override
public CtripHotelOrderDetail findHotelByRecordId(Long recordId) { public CTripHotelRecordBase findHotelByRecordId(Long recordId) {
return jdbcCtripHotelOrderDetailRepository.findByRecordId(recordId); return jdbcCtripHotelOrderDetailRepository.findByRecordId(recordId);
} }
@Override @Override
public CtripTrainOrderDetail save(CtripTrainOrderDetail ctripTrainOrderDetail) { public CTripTrainRecordBase save(CTripTrainRecordBase ctripTrainOrderDetail) {
return jdbcCtripTrainOrderDetailRepository.save(ctripTrainOrderDetail); return jdbcCtripTrainOrderDetailRepository.save(ctripTrainOrderDetail);
} }
@Override @Override
public void saveAllTrainRecord(List<CtripTrainOrderDetail> ctripTrainOrderDetailList) { public void saveAllTrainRecord(List<CTripTrainRecordBase> ctripTrainOrderDetailList) {
jdbcCtripTrainOrderDetailRepository.saveAll(ctripTrainOrderDetailList); jdbcCtripTrainOrderDetailRepository.saveAll(ctripTrainOrderDetailList);
} }
@Override @Override
public CtripTrainOrderDetail findTrainByRecordId(Long recordId) { public CTripTrainRecordBase findTrainByRecordId(Long recordId) {
return jdbcCtripTrainOrderDetailRepository.findByRecordId(recordId); return jdbcCtripTrainOrderDetailRepository.findByRecordId(recordId);
} }
@Override @Override
public CtripCarOrderDetail save(CtripCarOrderDetail ctripCarOrderDetail) { public CTripCarRecordBase save(CTripCarRecordBase ctripCarOrderDetail) {
return jdbcCtripCarOrderDetailRepository.save(ctripCarOrderDetail); return jdbcCtripCarOrderDetailRepository.save(ctripCarOrderDetail);
} }
@Override @Override
public void saveAllCarRecord(List<CtripCarOrderDetail> ctripCarOrderDetailList) { public void saveAllCarRecord(List<CTripCarRecordBase> ctripCarOrderDetailList) {
jdbcCtripCarOrderDetailRepository.saveAll(ctripCarOrderDetailList); jdbcCtripCarOrderDetailRepository.saveAll(ctripCarOrderDetailList);
} }
@Override @Override
public CtripCarOrderDetail findCarByRecordId(Long recordId) { public CTripCarRecordBase findCarByRecordId(Long recordId) {
return jdbcCtripCarOrderDetailRepository.findByRecordId(recordId); return jdbcCtripCarOrderDetailRepository.findByRecordId(recordId);
} }
// //

View File

@ -0,0 +1,10 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.ctrip.CTripFlightRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcCTripFlightRecordRepository extends CrudRepository<CTripFlightRecord,Long> {
}

View File

@ -1,12 +1,12 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail; import com.chint.domain.aggregates.order.ctrip.CTripCarRecordBase;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCtripCarOrderDetailRepository extends CrudRepository<CtripCarOrderDetail, Long> { public interface JdbcCtripCarOrderDetailRepository extends CrudRepository<CTripCarRecordBase, Long> {
// CityEntity findByCityName(String cityName); // CityEntity findByCityName(String cityName);
CtripCarOrderDetail findByRecordId(Long recordId); CTripCarRecordBase findByRecordId(Long recordId);
} }

View File

@ -1,13 +1,12 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.location.CityEntity; import com.chint.domain.aggregates.order.ctrip.CTripFlightRecordBase;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCtripFlightOrderDetailRepository extends CrudRepository<CtripFlightOrderDetail,Long> { public interface JdbcCtripFlightOrderDetailRepository extends CrudRepository<CTripFlightRecordBase,Long> {
// CityEntity findByCityName(String cityName); // CityEntity findByCityName(String cityName);
CtripFlightOrderDetail findByRecordId(Long recordId); CTripFlightRecordBase findByRecordId(Long recordId);
} }

View File

@ -1,14 +1,13 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail; import com.chint.domain.aggregates.order.ctrip.CTripHotelRecordBase;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCtripHotelOrderDetailRepository extends CrudRepository<CtripHotelOrderDetail,Long> { public interface JdbcCtripHotelOrderDetailRepository extends CrudRepository<CTripHotelRecordBase,Long> {
// CityEntity findByCityName(String cityName); // CityEntity findByCityName(String cityName);
CtripHotelOrderDetail findByRecordId(Long recordId); CTripHotelRecordBase findByRecordId(Long recordId);
} }

View File

@ -1,12 +1,12 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail; import com.chint.domain.aggregates.order.ctrip.CTripTrainRecordBase;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcCtripTrainOrderDetailRepository extends CrudRepository<CtripTrainOrderDetail, Long> { public interface JdbcCtripTrainOrderDetailRepository extends CrudRepository<CTripTrainRecordBase, Long> {
// CityEntity findByCityName(String cityName); // CityEntity findByCityName(String cityName);
CtripTrainOrderDetail findByRecordId(Long recordId); CTripTrainRecordBase findByRecordId(Long recordId);
} }

View File

@ -26,8 +26,6 @@ public class OrderFlightResponse {
private FlightOrderPrintDetailInfo OrderPrintDetailInfo; //订单打印单信息 private FlightOrderPrintDetailInfo OrderPrintDetailInfo; //订单打印单信息
private FlightOrderChangeInfo FlightChangeInfo; //航变信息 private FlightOrderChangeInfo FlightChangeInfo; //航变信息
private FlightTripRecordInfo FlightTripRecordInfo; //最终航程信息 private FlightTripRecordInfo FlightTripRecordInfo; //最终航程信息
} }
@Data @Data

View File

@ -1,9 +1,6 @@
package com.chint.interfaces.rest.ctrip.order; package com.chint.interfaces.rest.ctrip.order;
import com.chint.domain.aggregates.order.ctrip.CtripCarOrderDetail; import com.chint.domain.aggregates.order.ctrip.*;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail;
import com.chint.domain.repository.CTripOrderDetailRepository; import com.chint.domain.repository.CTripOrderDetailRepository;
import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse;
import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse;
@ -38,25 +35,16 @@ public class CTripOrderRecordAutoSave {
List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder List<OrderFlightResponse.FlightOrderAccountSettlementInfo> flightOrderAccountSettlementList = flightOrder
.getFlightOrderAccountSettlementList(); .getFlightOrderAccountSettlementList();
if (flightOrderAccountSettlementList != null && !flightOrderAccountSettlementList.isEmpty()) { if (flightOrderAccountSettlementList != null && !flightOrderAccountSettlementList.isEmpty()) {
List<CtripFlightOrderDetail> flightRecords = flightOrderAccountSettlementList List<CTripFlightRecord> cTripFlightRecords = flightOrderAccountSettlementList
.stream() .stream()
.flatMap(it -> it.getOrderSettlementList().stream()) .flatMap(it -> it.getOrderSettlementList().stream())
.map(OrderFlightResponse.FlightOrderSettlementInfo::getOrderSettlementBaseInfo) .map(it -> CTripFlightRecord.of(
.map(CtripFlightOrderDetail::changeInfo) CTripFlightRecordBase.changeInfo(
it.getOrderSettlementBaseInfo()
), CTripFlightInfo.of(it.getOrderFlightInfo())
))
.toList(); .toList();
cTripOrderDetailRepository.saveAll(cTripFlightRecords);
//业务需求这里加入是否退款判断
flightRecords.forEach(record -> {
//根据id进行更新
CtripFlightOrderDetail flightByRecordId = cTripOrderDetailRepository.findFlightByRecordId(record.getRecordId());
if (flightByRecordId != null) {
record.setId(flightByRecordId.getId());
}
if (record.getAmount() < 0) {
checkIfRefund(String.valueOf(record.getOrderId()), String.valueOf(record.getAmount()), record.getCreateTime());
}
});
cTripOrderDetailRepository.saveAllFlightRecord(flightRecords);
} }
} }
@ -65,23 +53,11 @@ public class CTripOrderRecordAutoSave {
OrderHotelResponse hotelOrder = cTripOrderDetailRequest.getHotelOrder(); OrderHotelResponse hotelOrder = cTripOrderDetailRequest.getHotelOrder();
List<OrderHotelResponse.HotelAccountSettlementInfo> lstHtlSettlement = hotelOrder.getLstHtlSettlement(); List<OrderHotelResponse.HotelAccountSettlementInfo> lstHtlSettlement = hotelOrder.getLstHtlSettlement();
if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) { if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) {
List<CtripHotelOrderDetail> list = lstHtlSettlement.stream() List<CTripHotelRecordBase> list = lstHtlSettlement.stream()
.flatMap(it -> it.getLstHotelSettlementDetail().stream()) .flatMap(it -> it.getLstHotelSettlementDetail().stream())
.map(OrderHotelResponse.LstHotelSettlementDetail::getSettlementDetail) .map(OrderHotelResponse.LstHotelSettlementDetail::getSettlementDetail)
.map(CtripHotelOrderDetail::changeInfo) .map(CTripHotelRecordBase::changeInfo)
.toList(); .toList();
//业务需求这里加入是否退款判断
list.forEach(record -> {
CtripHotelOrderDetail hotelByRecordId = cTripOrderDetailRepository.findHotelByRecordId(record.getRecordId());
if (hotelByRecordId != null) {
record.setId(hotelByRecordId.getId());
}
if (record.getAmount() < 0) {
checkIfRefund(String.valueOf(record.getOrderId()), String.valueOf(record.getAmount()), record.getCreateTime());
}
});
cTripOrderDetailRepository.saveAllHotelRecord(list); cTripOrderDetailRepository.saveAllHotelRecord(list);
} }
} }
@ -91,27 +67,11 @@ public class CTripOrderRecordAutoSave {
OrderTrainResponse trainOrder = cTripOrderDetailRequest.getTrainOrder(); OrderTrainResponse trainOrder = cTripOrderDetailRequest.getTrainOrder();
List<OrderTrainResponse.CorpTrainAccountSettlement> lstTrainSettlement = trainOrder.getLstTrainSettlement(); List<OrderTrainResponse.CorpTrainAccountSettlement> lstTrainSettlement = trainOrder.getLstTrainSettlement();
if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) { if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) {
List<CtripTrainOrderDetail> list = lstTrainSettlement.stream() List<CTripTrainRecordBase> list = lstTrainSettlement.stream()
.flatMap(it -> it.getLstTrainSettlementDetail().stream()) .flatMap(it -> it.getLstTrainSettlementDetail().stream())
.map(OrderTrainResponse.CorpTrainSettlementInfo::getTrainSettlementDetail) .map(OrderTrainResponse.CorpTrainSettlementInfo::getTrainSettlementDetail)
.map(CtripTrainOrderDetail::changeInfo) .map(CTripTrainRecordBase::changeInfo)
.toList(); .toList();
//业务需求这里加入是否退款判断
list.forEach(record -> {
CtripTrainOrderDetail trainByRecordId = cTripOrderDetailRepository.findTrainByRecordId(record.getRecordId());
if (trainByRecordId != null) {
record.setRecordId(trainByRecordId.getId());
}
if (record.getRealAmount() < 0) {
checkIfRefund(String.valueOf(record.getOrderId()), String.valueOf(record.getRealAmount()), record.getCreateTime());
}
});
cTripOrderDetailRepository.saveAllTrainRecord(list); cTripOrderDetailRepository.saveAllTrainRecord(list);
} }
} }
@ -121,30 +81,13 @@ public class CTripOrderRecordAutoSave {
OrderCarResponse carOrder = cTripOrderDetailRequest.getCarOrder(); OrderCarResponse carOrder = cTripOrderDetailRequest.getCarOrder();
List<OrderCarResponse.CarOrderAccountSettlementDetail> settlementList = carOrder.getCarOrderAccountSettlementList(); List<OrderCarResponse.CarOrderAccountSettlementDetail> settlementList = carOrder.getCarOrderAccountSettlementList();
if (settlementList != null && !settlementList.isEmpty()) { if (settlementList != null && !settlementList.isEmpty()) {
List<CtripCarOrderDetail> list = settlementList.stream() List<CTripCarRecordBase> list = settlementList.stream()
.flatMap(it -> it.getCarSettlementDetailList().stream()) .flatMap(it -> it.getCarSettlementDetailList().stream())
.map(OrderCarResponse.CarOrderSettlementDetail::getSettlementBaseInfo) .map(OrderCarResponse.CarOrderSettlementDetail::getSettlementBaseInfo)
.map(CtripCarOrderDetail::changeInfo) .map(CTripCarRecordBase::changeInfo)
.toList(); .toList();
//业务需求这里加入是否退款判断
list.forEach(record -> {
CtripCarOrderDetail carByRecordId = cTripOrderDetailRepository.findCarByRecordId(record.getRecordId());
if (carByRecordId != null) {
record.setId(carByRecordId.getId());
}
if (record.getRealAmount() < 0) {
checkIfRefund(String.valueOf(record.getOrderId()), String.valueOf(record.getRealAmount()), record.getCreateTime());
}
});
cTripOrderDetailRepository.saveAllCarRecord(list); cTripOrderDetailRepository.saveAllCarRecord(list);
} }
} }
public void checkIfRefund(String orderNo, String amount, String createTime) {
System.out.println("开始触发创建携程退款订单");
// Command.of(CTripOrderRefundCommand.class).Info(orderNo, amount, createTime).sendToQueue();
}
} }