From 8eb0c2dfc27c0bb568cc4126231f098a2a906e55 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 28 Mar 2024 17:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=90=BA=E7=A8=8B=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E6=95=B0=E6=8D=AE=E4=BF=9D=E5=AD=98=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/in/AutoWorkController.java | 2 +- .../ctrip_order_record/CTripCarRecord.java | 5 ++ .../CTripCarRecordBase.java | 4 +- .../ctrip_order_record/CTripFlightRecord.java | 6 ++ .../ctrip_order_record/CTripHotelInfo.java | 7 +- .../ctrip_order_record/CTripHotelRecord.java | 8 +- .../CTripHotelRecordBase.java | 45 ++++++----- .../ctrip_order_record/CTripTrainRecord.java | 5 ++ .../CTripOrderRecordExtensionFactory.java | 3 +- .../factoriy/ranks/RanksFactoryImpl.java | 8 +- .../CTripOrderDetailRepository.java | 6 ++ .../CompanyBlackListRepository.java | 2 + .../OrderFlightRecordRepository.java | 2 + .../domain/service/OrderDomainService.java | 13 +++- .../service/leg_event/LegEventHandler.java | 1 + .../order_sync/CTripOrderSyncAdapter.java | 9 ++- .../infrastructure/constant/RankConstant.java | 6 ++ .../repository/CTripOrderDetailImpl.java | 30 ++++++++ .../CompanyBlackListRepositoryImpl.java | 9 +++ .../OrderFlightRecordRepositoryImpl.java | 2 + .../jdbc/JdbcCTripCarRecordRepository.java | 1 + .../jdbc/JdbcCTripFlightRecordRepository.java | 2 + .../jdbc/JdbcCTripHotelRecordRepository.java | 1 + .../jdbc/JdbcCTripTrainRecordRepository.java | 1 + .../infrastructure/util/DateTimeUtil.java | 17 ++++- .../ctrip/dto/order/OrderCarResponse.java | 7 +- .../ctrip/order/CTripOrderRecordAutoSave.java | 76 ++++++++++++++----- 27 files changed, 215 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 0e84d69e..7b4fb30f 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -41,7 +41,7 @@ public class AutoWorkController { public Result autoSaveCTripRecord() { cTripOrderRecordAutoSave.saveAll(); //将昨天的结算数据生成为财务共享需要的数据 - Command.of(OrderRecordGenerateCommand.class).sendToQueue(); +// Command.of(OrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java index 27f60b4f..e252843a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecord.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; +import com.chint.infrastructure.util.DateTimeUtil; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; @@ -7,6 +8,7 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; +import java.time.LocalDateTime; @Data @Table("c_trip_car_record") @@ -16,6 +18,8 @@ public class CTripCarRecord implements Serializable { @Id private Long id; private String recordId; + private LocalDateTime createTime; + private String routeOrderNo; @MappedCollection(idColumn = "c_trip_car_record_id") private CTripCarRecordBase cTripCarRecordBase; @MappedCollection(idColumn = "c_trip_car_record_id") @@ -26,6 +30,7 @@ public class CTripCarRecord implements Serializable { cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo); cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase); cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId())); + cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime())); return cTripCarRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java index 112885a6..6d458785 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarRecordBase.java @@ -43,7 +43,7 @@ public class CTripCarRecordBase implements Serializable { private Double expressFee; private Integer orderType; private String subAccCheckBatchNo; - private Long tripId; + private String tripId; private String settlementCurrency; private Double postServiceFee; private Double realAmountHasPost; @@ -94,7 +94,7 @@ public class CTripCarRecordBase implements Serializable { ctripCarOrderDetail.setExpressFee(carOrderSettlementBaseInfo.getExpressFee()); ctripCarOrderDetail.setOrderType(carOrderSettlementBaseInfo.getOrderType()); ctripCarOrderDetail.setSubAccCheckBatchNo(carOrderSettlementBaseInfo.getSubAccCheckBatchNo()); - ctripCarOrderDetail.setTripId(carOrderSettlementBaseInfo.getTripID()); + ctripCarOrderDetail.setTripId( carOrderSettlementBaseInfo.getTripID()); ctripCarOrderDetail.setSettlementCurrency(carOrderSettlementBaseInfo.getSettlementCurrency()); ctripCarOrderDetail.setPostServiceFee(carOrderSettlementBaseInfo.getPostServiceFee()); ctripCarOrderDetail.setRealAmountHasPost(carOrderSettlementBaseInfo.getRealAmountHasPost()); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java index 5597e65d..b52fbef5 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightRecord.java @@ -1,16 +1,21 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; +import com.chint.infrastructure.util.DateTimeUtil; 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; +import java.time.LocalDateTime; + @Data @Table("c_trip_flight_record") public class CTripFlightRecord { @Id private Long id; private String recordId; + public LocalDateTime createTime; + private String routeOrderNo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightRecordBase cTripFlightRecordBase; @MappedCollection(idColumn = "c_trip_flight_record_id") @@ -21,6 +26,7 @@ public class CTripFlightRecord { cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); + cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java index 32822a7f..8944747b 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelInfo.java @@ -1,7 +1,6 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; import cn.hutool.core.bean.BeanUtil; -import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; import lombok.Data; import org.springframework.data.annotation.Id; @@ -23,7 +22,7 @@ public class CTripHotelInfo implements Serializable { private String CityName; private String CityNameEN; private Integer Star; - private boolean IsDomestic; + private Integer IsDomestic; private String ISCU; private Integer CityID; private String DistrictCode; @@ -37,6 +36,8 @@ public class CTripHotelInfo implements Serializable { private String HotelGroupName; public static CTripHotelInfo of(OrderHotelResponse.SettlementHotelDetail data) { - return BeanUtil.copyProperties(data, CTripHotelInfo.class); + CTripHotelInfo cTripHotelInfo = BeanUtil.copyProperties(data, CTripHotelInfo.class); + cTripHotelInfo.setIsDomestic(data.isIsDomestic() ? 1 : 0); + return cTripHotelInfo; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java index 25e081d4..3a668234 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecord.java @@ -1,16 +1,21 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; +import com.chint.infrastructure.util.DateTimeUtil; 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; +import java.time.LocalDateTime; + @Data -@Table("c_trip_flight_record") +@Table("c_trip_hotel_record") public class CTripHotelRecord { @Id private Long id; private String recordId; + private LocalDateTime createTime; + private String routeOrderNo; @MappedCollection(idColumn = "c_trip_hotel_record_id") private CTripHotelRecordBase cTripHotelRecordBase; @MappedCollection(idColumn = "c_trip_hotel_record_id") @@ -21,6 +26,7 @@ public class CTripHotelRecord { cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId())); cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase); cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo); + cTripHotelRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripHotelRecordBase.getCreateTime())); return cTripHotelRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java index 18040ffc..e9e1052b 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRecordBase.java @@ -7,7 +7,6 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; -import java.math.BigDecimal; /** * @author wanglf3 @@ -41,7 +40,7 @@ public class CTripHotelRecordBase implements Serializable { private String subAccCheckBatchNo; private Long tripId; private String settlementCurrency; - private Boolean isChecked; + private Integer isChecked; private String dailyAvgPriceInfo; private String invoiceIds; private String batchStartDate; @@ -58,16 +57,16 @@ public class CTripHotelRecordBase implements Serializable { private String employeeId; private Double insuranceAmount; private Double personAmount; - private BigDecimal channelFee; - private BigDecimal personalChannelFee; - private BigDecimal paidAmount; - private BigDecimal personalTotalAmount; - private BigDecimal personalRemittedTax; - private BigDecimal bookServiceFee; - private BigDecimal modifyServiceFee; - private BigDecimal cancelServiceFee; - private BigDecimal payDiscountAmount; - private BigDecimal averageRoomPrice; + private String channelFee; + private String personalChannelFee; + private String paidAmount; + private String personalTotalAmount; + private String personalRemittedTax; + private String bookServiceFee; + private String modifyServiceFee; + private String cancelServiceFee; + private String payDiscountAmount; + private String averageRoomPrice; public static CTripHotelRecordBase changeInfo(OrderHotelResponse.SettlementDetail SettlementDetail) { @@ -91,7 +90,7 @@ public class CTripHotelRecordBase implements Serializable { ctripHotelOrderDetail.setSubAccCheckBatchNo(SettlementDetail.getSubAccCheckBatchNo()); ctripHotelOrderDetail.setTripId(SettlementDetail.getTripID()); ctripHotelOrderDetail.setSettlementCurrency(SettlementDetail.getSettlementCurrency()); - ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked()); + ctripHotelOrderDetail.setIsChecked(SettlementDetail.isIsChecked() ? 1 : 0); // ctripHotelOrderDetailis.setDailyAvgPriceInfo(SettlementDetail.getDailyAvgPriceInfo()); // ctripHotelOrderDetailis.setInvoiceIds(SettlementDetail.getInvoiceIds()); ctripHotelOrderDetail.setBatchStartDate(SettlementDetail.getBatchStartDate()); @@ -108,16 +107,16 @@ public class CTripHotelRecordBase implements Serializable { ctripHotelOrderDetail.setEmployeeId(SettlementDetail.getEmployeeID()); ctripHotelOrderDetail.setInsuranceAmount(SettlementDetail.getInsuranceAmount()); ctripHotelOrderDetail.setPersonAmount(SettlementDetail.getPersonAmount()); - ctripHotelOrderDetail.setChannelFee(SettlementDetail.getChannelFee()); - ctripHotelOrderDetail.setPersonalChannelFee(SettlementDetail.getPersonalChannelFee()); - ctripHotelOrderDetail.setPaidAmount(SettlementDetail.getPaidAmount()); - ctripHotelOrderDetail.setPersonalTotalAmount(SettlementDetail.getPersonalTotalAmount()); - ctripHotelOrderDetail.setPersonalRemittedTax(SettlementDetail.getPersonalRemittedTax()); - ctripHotelOrderDetail.setBookServiceFee(SettlementDetail.getBookServiceFee()); - ctripHotelOrderDetail.setModifyServiceFee(SettlementDetail.getModifyServiceFee()); - ctripHotelOrderDetail.setCancelServiceFee(SettlementDetail.getCancelServiceFee()); - ctripHotelOrderDetail.setPayDiscountAmount(SettlementDetail.getPayDiscountAmount()); - ctripHotelOrderDetail.setAverageRoomPrice(SettlementDetail.getAverageRoomPrice()); + ctripHotelOrderDetail.setChannelFee(String.valueOf(SettlementDetail.getChannelFee())); + ctripHotelOrderDetail.setPersonalChannelFee(String.valueOf(SettlementDetail.getPersonalChannelFee())); + ctripHotelOrderDetail.setPaidAmount(String.valueOf(SettlementDetail.getPaidAmount())); + ctripHotelOrderDetail.setPersonalTotalAmount(String.valueOf(SettlementDetail.getPersonalTotalAmount())); + ctripHotelOrderDetail.setPersonalRemittedTax(String.valueOf(SettlementDetail.getPersonalRemittedTax())); + ctripHotelOrderDetail.setBookServiceFee(String.valueOf(SettlementDetail.getBookServiceFee())); + ctripHotelOrderDetail.setModifyServiceFee(String.valueOf(SettlementDetail.getModifyServiceFee())); + ctripHotelOrderDetail.setCancelServiceFee(String.valueOf(SettlementDetail.getCancelServiceFee())); + ctripHotelOrderDetail.setPayDiscountAmount(String.valueOf(SettlementDetail.getPayDiscountAmount())); + ctripHotelOrderDetail.setAverageRoomPrice(String.valueOf(SettlementDetail.getAverageRoomPrice())); return ctripHotelOrderDetail; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java index 51394228..2db57c72 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripTrainRecord.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record.ctrip_order_record; +import com.chint.infrastructure.util.DateTimeUtil; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; @@ -7,6 +8,7 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; +import java.time.LocalDateTime; @Data @Table("c_trip_train_record") @@ -16,6 +18,8 @@ public class CTripTrainRecord implements Serializable { @Id private Long id; private String recordId; + private LocalDateTime createTime; + private String routeOrderNo; @MappedCollection(idColumn = "c_trip_train_record_id") private CTripTrainRecordBase cTripTrainRecordBase; @MappedCollection(idColumn = "c_trip_train_record_id") @@ -26,6 +30,7 @@ public class CTripTrainRecord implements Serializable { cTripTrainRecord.setRecordId(String.valueOf(cTripTrainRecordBase.getRecordId())); cTripTrainRecord.setCTripTrainRecordBase(cTripTrainRecordBase); cTripTrainRecord.setCTripTrainInfo(cTripTrainInfo); + cTripTrainRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripTrainRecordBase.getCreateTime())); return cTripTrainRecord; } } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index f5127470..a11d292f 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -8,6 +8,7 @@ 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.aggregates.order.order_record.ctrip_order_record.CTripCarRecord; import com.chint.domain.service.OrderDetailDomainService; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +24,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFa @Override public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { - + CTripCarRecord orderCarRecord = (CTripCarRecord) orderCarRecordData; return null; } diff --git a/src/main/java/com/chint/domain/factoriy/ranks/RanksFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/ranks/RanksFactoryImpl.java index 489133ba..d558edcc 100644 --- a/src/main/java/com/chint/domain/factoriy/ranks/RanksFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/ranks/RanksFactoryImpl.java @@ -35,10 +35,10 @@ public class RanksFactoryImpl implements RanksFactory { Integer level = ranksData.getLevel(); ranks.setStandardLevel( switch (level) { - case 1 -> prefix + RankConstant.STANDARD_LEVEL_ONE; - case 2 -> prefix + RankConstant.STANDARD_LEVEL_TWO; - case 3 -> prefix + RankConstant.STANDARD_LEVEL_THREE; - case 4 -> prefix + RankConstant.STANDARD_LEVEL_FOUR; + case 1 -> prefix + STANDARD_LEVEL_ONE_COMMON; + case 2 -> prefix + STANDARD_LEVEL_TWO_COMMON; + case 3 -> prefix + STANDARD_LEVEL_THREE_COMMON; + case 4 -> prefix + STANDARD_LEVEL_FOUR_COMMON; default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND); } ); diff --git a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java index 69c40f5d..b43d66f5 100644 --- a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java +++ b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java @@ -38,7 +38,13 @@ public interface CTripOrderDetailRepository { CTripCarRecordBase findCarByRecordId(Long id); void saveAllCTripFlightRecord(List cTripFlightRecordList); + CTripFlightRecord findFlightRecordById(Long id); + CTripFlightRecord findFlightRecordByRecordId(String recordId); void saveAllCTripHotelRecord(List cTripHotelRecordList); + CTripHotelRecord findHotelRecordById(Long id); + CTripHotelRecord findHotelRecordByRecordId(String recordId); void saveAllCTripTrainRecord(List cTripTrainRecordList); + CTripTrainRecord findTrainRecordByRecordId(String recordId); void saveAllCTripCarRecord(List cTripCarRecordList); + CTripCarRecord findCarRecordByRecordId(String recordId); } diff --git a/src/main/java/com/chint/domain/repository/CompanyBlackListRepository.java b/src/main/java/com/chint/domain/repository/CompanyBlackListRepository.java index 92004f61..09e11be5 100644 --- a/src/main/java/com/chint/domain/repository/CompanyBlackListRepository.java +++ b/src/main/java/com/chint/domain/repository/CompanyBlackListRepository.java @@ -9,4 +9,6 @@ public interface CompanyBlackListRepository { CompanyBlackList findByCompanyName(String companyName); List findAll(); + + Boolean ifInCompanyList(String companyName); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index f73dd606..c7d47ebd 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -6,4 +6,6 @@ import java.util.List; public interface OrderFlightRecordRepository { List saveAll(List orderFlightRecordList); + + } diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index 07fe8b27..6836149d 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -113,7 +113,6 @@ public class OrderDomainService { @Autowired private JdbcLegRepository jdbcLegRepository; - private Set companyBlackList = new HashSet<>(); public RouteOrder saveOrder(RouteOrder routeOrder) { @@ -130,7 +129,7 @@ public class OrderDomainService { } public boolean checkCompanyNameIfBlack(String companyName) { - if (companyBlackList.contains(companyName)) { + if (companyBlackListRepository.ifInCompanyList(companyName)) { throw new OrderException(COMPANY_NAME_IN_BLACK_LIST); } else { return true; @@ -197,6 +196,16 @@ public class OrderDomainService { ApprovalSimpleData data = command.getData(); Optional.ofNullable(routeRepository.findByActualOrderNoAndSysCode(data.getActualOrderNo(), data.getSysCode())) .ifPresentOrElse(route -> { + //保存提交审批所提供的资料 + ApproveOrderNo approveOrderNo = route.getApproveOrderNo(); + approveOrderNo.setActualOrderNo(data.getActualOrderNo()); + approveOrderNo.setInstructions(data.getInstructions()); + approveOrderNo.setCreator(data.getCreator()); + approveOrderNo.setAccountCompanyName(data.getAccountCompany()); + approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode()); + approveOrderNo.setProjectName(data.getProjectName()); + approveOrderNo.setCostCenter(data.getCostCenter()); + LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType()); route.getLegItems().forEach(leg -> leg.addEvent(legEvent)); ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_ING); diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index 1a5b145c..87148a89 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -114,6 +114,7 @@ public class LegEventHandler implements LegEventService { approveOrderNo.setActualOrderNo(data.getActualOrderNo()); approveOrderNo.setInstructions(data.getInstructions()); approveOrderNo.setCreator(data.getCreator()); + approveOrderNo.setAccountCompanyName(data.getAccountCompany()); approveOrderNo.setAccountCompanyCode(data.getAccountCompanyCode()); approveOrderNo.setProjectName(data.getProjectName()); approveOrderNo.setCostCenter(data.getCostCenter()); diff --git a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java index 6279ed80..5eb285f2 100644 --- a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java @@ -28,6 +28,7 @@ import java.util.stream.Collectors; import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY; +import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_DISTRICT; @Slf4j @Component @@ -198,7 +199,13 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { } locationRepository.saveAll(List.of(location)); } + //这里的逻辑需要修改 , + // 如果是县级市的话 ,取CItyId , + // 如果是区的话 ,要查找地级市, 取地级市的Id , + // 如果是地级市的话 ,直接取地级市的ID + if (location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) { + return locationRepository.findById(location.getParentLocationId()); + } return location; } - } diff --git a/src/main/java/com/chint/infrastructure/constant/RankConstant.java b/src/main/java/com/chint/infrastructure/constant/RankConstant.java index a44aa63d..fd073534 100644 --- a/src/main/java/com/chint/infrastructure/constant/RankConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/RankConstant.java @@ -29,6 +29,12 @@ public class RankConstant { public static final String ALTER_APPLY = "3";//变更 + //集团差标等级 + public static final String STANDARD_LEVEL_ONE_COMMON = "STANDARD_LEVEL_ONE";//差标1 + public static final String STANDARD_LEVEL_TWO_COMMON = "STANDARD_LEVEL_TWO";//差标2 + public static final String STANDARD_LEVEL_THREE_COMMON = "STANDARD_LEVEL_THREE";//差标3 + public static final String STANDARD_LEVEL_FOUR_COMMON = "STANDARD_LEVEL_FOUR";//差标4 + //集团差标等级 public static final String STANDARD_LEVEL_ONE = "JT_STANDARD_LEVEL_ONE";//差标1 public static final String STANDARD_LEVEL_TWO = "JT_STANDARD_LEVEL_TWO";//差标2 diff --git a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java index a9aa924f..ab6568e1 100644 --- a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java @@ -119,20 +119,50 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { jdbcCTripFlightRecordRepository.saveAll(cTripFlightRecordList); } + @Override + public CTripFlightRecord findFlightRecordById(Long id) { + return jdbcCTripFlightRecordRepository.findById(id).get(); + } + + @Override + public CTripFlightRecord findFlightRecordByRecordId(String recordId) { + return jdbcCTripFlightRecordRepository.findByRecordId(recordId); + } + @Override public void saveAllCTripHotelRecord(List cTripHotelRecordList) { jdbcCTripHotelRecordRepository.saveAll(cTripHotelRecordList); } + @Override + public CTripHotelRecord findHotelRecordById(Long id) { + return jdbcCTripHotelRecordRepository.findById(id).get(); + } + + @Override + public CTripHotelRecord findHotelRecordByRecordId(String recordId) { + return jdbcCTripHotelRecordRepository.findByRecordId(recordId); + } + @Override public void saveAllCTripTrainRecord(List cTripTrainRecordList) { jdbcCTripTrainRecordRepository.saveAll(cTripTrainRecordList); } + @Override + public CTripTrainRecord findTrainRecordByRecordId(String recordId) { + return jdbcCTripTrainRecordRepository.findByRecordId(recordId); + } + @Override public void saveAllCTripCarRecord(List cTripCarRecordList) { jdbcCTripCarRecordRepository.saveAll(cTripCarRecordList); } + + @Override + public CTripCarRecord findCarRecordByRecordId(String recordId) { + return jdbcCTripCarRecordRepository.findByRecordId(recordId); + } // // @Override // public Client findByClientId(String clientId){ diff --git a/src/main/java/com/chint/infrastructure/repository/CompanyBlackListRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/CompanyBlackListRepositoryImpl.java index 21e5209f..2d618803 100644 --- a/src/main/java/com/chint/infrastructure/repository/CompanyBlackListRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/CompanyBlackListRepositoryImpl.java @@ -4,6 +4,7 @@ import com.chint.domain.aggregates.system.CompanyBlackList; import com.chint.domain.repository.CompanyBlackListRepository; import com.chint.infrastructure.repository.jdbc.JdbcCompanyBlackListRepository; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; import java.util.ArrayList; @@ -20,6 +21,7 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor return jdbcCompanyBlackListRepository.findByCompanyName(companyName); } + @Cacheable(value = "CompanyBlack") @Override public List findAll() { List all = new ArrayList<>(); @@ -28,4 +30,11 @@ public class CompanyBlackListRepositoryImpl implements CompanyBlackListRepositor ); return all; } + + @Cacheable(value = "CompanyBlack", key = "#companyName") + @Override + public Boolean ifInCompanyList(String companyName) { + CompanyBlackList byCompanyName = jdbcCompanyBlackListRepository.findByCompanyName(companyName); + return byCompanyName != null; + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index a1afff6e..92e4b59b 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -21,4 +21,6 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit jdbcOrderFlightRecordRepository.saveAll(orderFlightRecordList).forEach(res::add); return res; } + + } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java index abd3cb0d..6f2da842 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java @@ -8,4 +8,5 @@ import org.springframework.stereotype.Repository; @Repository public interface JdbcCTripCarRecordRepository extends CrudRepository { + CTripCarRecord findByRecordId(String recordId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java index 242a5121..8669cf7e 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java @@ -6,4 +6,6 @@ import org.springframework.stereotype.Repository; @Repository public interface JdbcCTripFlightRecordRepository extends CrudRepository { + + CTripFlightRecord findByRecordId(String recordId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java index 58a4c3ef..c844e383 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java @@ -7,4 +7,5 @@ import org.springframework.stereotype.Repository; @Repository public interface JdbcCTripHotelRecordRepository extends CrudRepository { + CTripHotelRecord findByRecordId(String recordId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java index 5f64ecd0..2dabe052 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java @@ -7,4 +7,5 @@ import org.springframework.stereotype.Repository; @Repository public interface JdbcCTripTrainRecordRepository extends CrudRepository { + CTripTrainRecord findByRecordId(String recordId); } diff --git a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java index 8c984e4a..ab1037a8 100644 --- a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java +++ b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java @@ -5,8 +5,21 @@ import java.time.format.DateTimeFormatter; public class DateTimeUtil { + + + private final static DateTimeFormatter formatterMM = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); + private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + private final static DateTimeFormatter formatterDate = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + public static String timeToStr(LocalDateTime input) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - return input.format(formatter); + return input.format(formatterDate); + } + + public static LocalDateTime strToTime(String input) { + return LocalDateTime.parse(input.substring(0, 19), formatter); + } + + public static LocalDateTime strToTimeMM(String input) { + return LocalDateTime.parse(input.substring(0, 23), formatterMM); } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderCarResponse.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderCarResponse.java index 3c6b450b..f4c979e6 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderCarResponse.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderCarResponse.java @@ -30,6 +30,7 @@ public class OrderCarResponse { public static class ResponseStatus { private String Message; private Boolean Success; + private Integer ErrorCode; } @@ -57,7 +58,7 @@ public class OrderCarResponse { private double ExpressFee; private int OrderType; private String SubAccCheckBatchNo; - private long TripID; + private String TripID; private String SettlementCurrency; private double PostServiceFee; private double RealAmountHasPost; @@ -122,7 +123,7 @@ public class OrderCarResponse { private String ReachTravel; private String ServerFrom; private double ServiceFee; - private long TripID; + private String TripID; private String Uid; private String UserName; private String PreEmployeeID; @@ -142,7 +143,7 @@ public class OrderCarResponse { } @Data public static class CarOrderCorpInfo { - private long CorpId; + private String CorpId; private String CorpName; private int AccountId; private int SubAccountId; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java index 486e495f..1151d4cf 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderRecordAutoSave.java @@ -38,12 +38,23 @@ public class CTripOrderRecordAutoSave { List cTripFlightRecords = flightOrderAccountSettlementList .stream() .flatMap(it -> it.getOrderSettlementList().stream()) - .map(it -> CTripFlightRecord.of( - CTripFlightRecordBase.changeInfo( - it.getOrderSettlementBaseInfo() - ), CTripFlightInfo.of(it.getOrderFlightInfo()) - )) - .toList(); + .map(it -> { + //对数据库进行查找 ,如果发现已经存在 , 就使用查找出来的 + OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo(); + CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId( + String.valueOf(orderSettlementBaseInfo.getRecordID())); + if (record == null) { + record = CTripFlightRecord.of( + CTripFlightRecordBase.changeInfo( + orderSettlementBaseInfo + ), CTripFlightInfo.of(it.getOrderFlightInfo()) + ); + } + //补充额外的字段 + OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); + record.setRouteOrderNo(orderBaseInfo.getJourneyID()); + return record; + }).toList(); cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords); } } @@ -55,11 +66,19 @@ public class CTripOrderRecordAutoSave { if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) { List list = lstHtlSettlement.stream() .flatMap(it -> it.getLstHotelSettlementDetail().stream()) - .map(it -> - CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(it.getSettlementDetail()), - CTripHotelInfo.of(it.getHotelDetail())) - ) - .toList(); + .map(it -> { + OrderHotelResponse.SettlementDetail settlementDetail = it.getSettlementDetail(); + CTripHotelRecord record = cTripOrderDetailRepository.findHotelRecordByRecordId( + String.valueOf(settlementDetail.getRecordId())); + if (record == null) { + record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), + CTripHotelInfo.of(it.getHotelDetail())); + } + //补充额外的字段 + OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail(); + record.setRecordId(orderDetail.getHotelRelatedJourneyNo()); + return record; + }).toList(); cTripOrderDetailRepository.saveAllCTripHotelRecord(list); } } @@ -71,11 +90,18 @@ public class CTripOrderRecordAutoSave { if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) { List list = lstTrainSettlement.stream() .flatMap(it -> it.getLstTrainSettlementDetail().stream()) - .map(it -> - CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(it.getTrainSettlementDetail()), - CTripTrainInfo.of(it.getTrainSettlementTicket())) - ) - .toList(); + .map(it -> { + OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail = it.getTrainSettlementDetail(); + CTripTrainRecord record = cTripOrderDetailRepository.findTrainRecordByRecordId( + String.valueOf(trainSettlementDetail.getRecordID())); + if (record == null) { + record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail), + CTripTrainInfo.of(it.getTrainSettlementTicket())); + } + //补充额外的字段 + record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID()); + return record; + }).toList(); cTripOrderDetailRepository.saveAllCTripTrainRecord(list); } } @@ -86,10 +112,20 @@ public class CTripOrderRecordAutoSave { if (settlementList != null && !settlementList.isEmpty()) { List list = settlementList.stream() .flatMap(it -> it.getCarSettlementDetailList().stream()) - .map(it -> CTripCarRecord.of( - CTripCarRecordBase.changeInfo(it.getSettlementBaseInfo()), - CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()))) - .toList(); + .map(it -> { + OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = it.getSettlementBaseInfo(); + CTripCarRecord record = cTripOrderDetailRepository.findCarRecordByRecordId( + String.valueOf(settlementBaseInfo.getRecordId())); + if (record == null) { + record = CTripCarRecord.of( + CTripCarRecordBase.changeInfo(settlementBaseInfo), + CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo())); + } + //补充额外的字段 + OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo(); + record.setRouteOrderNo(corpInfo.getJouneryId()); + return record; + }).toList(); cTripOrderDetailRepository.saveAllCTripCarRecord(list); } }