From 7b94273155be711e170e3d7d191a6ee28c742b14 Mon Sep 17 00:00:00 2001 From: dengwc Date: Fri, 29 Mar 2024 14:42:35 +0800 Subject: [PATCH 01/33] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=8F=91=E8=B5=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../echo_framework/manager/EventManager.java | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java index 4908733e..f73aab18 100644 --- a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java +++ b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java @@ -8,6 +8,8 @@ import com.chint.infrastructure.echo_framework.command.EmptyCommand; import com.chint.infrastructure.echo_framework.dispatch.ResultContainer; import com.chint.infrastructure.echo_framework.queue.SimpleMessageQueue; import lombok.Data; +import org.springframework.aop.framework.AopProxyUtils; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; @@ -59,23 +61,36 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini String[] allBeanNames = context.getBeanDefinitionNames(); for (String beanName : allBeanNames) { if (this.beanName.equals(beanName)) continue; - Object bean = context.getBean(beanName); + Object bean = context.getBean(beanName);//获取的可能是动态代理的类 scanAndRegister(bean); } } private void scanAndRegister(Object bean) { - Method[] methods = bean.getClass().getDeclaredMethods(); - for (Method method : methods) { - if (method.isAnnotationPresent(ListenTo.class)) { - ListenTo listenTo = method.getAnnotation(ListenTo.class); - MethodContainer container = new MethodContainer(bean, listenTo.order(), method); - listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); + Method[] methods = null; + //判断是何种类型的代理,使得动态代理的自定义注解不会失效 + if (AopUtils.isJdkDynamicProxy(bean)) { + Object singletonTarget = AopProxyUtils.getSingletonTarget(bean); + if (singletonTarget != null) { + methods = singletonTarget.getClass().getDeclaredMethods(); } - if (method.isAnnotationPresent(TransitionTo.class)) { - TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); - MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); - transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); + } else if (AopUtils.isCglibProxy(bean)) { + methods = bean.getClass().getSuperclass().getDeclaredMethods(); + } else { + methods = bean.getClass().getDeclaredMethods(); + } + if (methods != null) { + for (Method method : methods) { + if (method.isAnnotationPresent(ListenTo.class)) { + ListenTo listenTo = method.getAnnotation(ListenTo.class); + MethodContainer container = new MethodContainer(bean, listenTo.order(), method); + listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); + } + if (method.isAnnotationPresent(TransitionTo.class)) { + TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); + MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); + transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); + } } } } From 73f747fca9f123ee7878e1051028f917812f5482 Mon Sep 17 00:00:00 2001 From: dengwc Date: Fri, 29 Mar 2024 16:49:18 +0800 Subject: [PATCH 02/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LyOrderRecordExtensionFactory.java | 27 ++++++++-- .../echo_framework/manager/EventManager.java | 49 ++++++++++--------- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index b0bb8193..61e9debb 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -131,6 +131,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2 .setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3 .setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心 + /* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ ; } @@ -187,6 +192,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2("") //入住人组织架构信息2 .setBookOrgCode3("") //入住人组织架构信息3 .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心 +/* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ ; } @@ -234,14 +244,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode2("")//出行人组织架构信息2 .setBookOrgCode3("")//出行人组织架构信息3 .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心 - .setTravelUserBirthday("")//生日 +/* .setOrderStatus() //结算状态 + .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount() //支付金额 +*/ + +/* .setTravelUserBirthday("")//生日 .setTravelUserPhone("") //出行人手机号 .setTravelUserSex("")//"性别:0保密不展示 1男 2女" .setTravelUserType("") //"乘客类型:成人(ADULT) 儿童(CHILDREN) 婴儿(BABY)" .setPassportNo("")//乘客证件号 .setPassportType("")//乘客证件类型 .setTrainTime("")//发车时间 yyyy - MM - dd HH:mm:ss - .setYxId("")//影像比对ID + .setYxId("")//影像比对ID*/ ; } @@ -288,9 +304,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付" .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心 .setOrderSource(lyOrderCarRecord.getBookingPlat()) //预订来源:线上/线下 -// .setORDER_AMOUNT() //订单金额 -// .setSETTLE_ORDER_FLAG() //订单对账状态 -// .setpayAmount()// 支付金额 +/* .setExpenseOrderAmount() //订单金额 + .setSettleOrderFlag() //订单对账状态 + .setPayAmount()// 支付金额*/ + ; } diff --git a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java index f73aab18..7f993e35 100644 --- a/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java +++ b/src/main/java/com/chint/infrastructure/echo_framework/manager/EventManager.java @@ -66,31 +66,36 @@ public class EventManager implements ApplicationContextAware, BeanNameAware, Ini } } + private void scanAndRegister(Object bean) { - Method[] methods = null; - //判断是何种类型的代理,使得动态代理的自定义注解不会失效 - if (AopUtils.isJdkDynamicProxy(bean)) { - Object singletonTarget = AopProxyUtils.getSingletonTarget(bean); - if (singletonTarget != null) { - methods = singletonTarget.getClass().getDeclaredMethods(); + Method[] methods = getTargetClassMethods(bean); + processAnnotation(methods, bean); + } + + private Method[] getTargetClassMethods(Object bean) { + //判断是何种类型的代理,获取动态代理后的原类的自定义注解,使其不会失效。 + if (AopUtils.isCglibProxy(bean)) { + return bean.getClass().getSuperclass().getDeclaredMethods(); + } else if (AopUtils.isJdkDynamicProxy(bean)) { + Object target = AopProxyUtils.getSingletonTarget(bean); + if (target != null) { + return target.getClass().getDeclaredMethods(); } - } else if (AopUtils.isCglibProxy(bean)) { - methods = bean.getClass().getSuperclass().getDeclaredMethods(); - } else { - methods = bean.getClass().getDeclaredMethods(); } - if (methods != null) { - for (Method method : methods) { - if (method.isAnnotationPresent(ListenTo.class)) { - ListenTo listenTo = method.getAnnotation(ListenTo.class); - MethodContainer container = new MethodContainer(bean, listenTo.order(), method); - listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); - } - if (method.isAnnotationPresent(TransitionTo.class)) { - TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); - MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); - transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); - } + return bean.getClass().getDeclaredMethods(); + } + + private void processAnnotation(Method[] methods, Object bean) { + for (Method method : methods) { + if (method.isAnnotationPresent(ListenTo.class)) { + ListenTo listenTo = method.getAnnotation(ListenTo.class); + MethodContainer container = new MethodContainer(bean, listenTo.order(), method); + listenerMethods.computeIfAbsent(listenTo.command(), k -> new ArrayList<>()).add(container); + } + if (method.isAnnotationPresent(TransitionTo.class)) { + TransitionTo transitionTo = method.getAnnotation(TransitionTo.class); + MethodContainer container = new MethodContainer(bean, transitionTo.order(), method); + transitionMethods.computeIfAbsent(transitionTo.command(), k -> new ArrayList<>()).add(container); } } } From fdad2e2becb5d0716f3dbd7c94a041c46df45680 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Fri, 29 Mar 2024 21:08:18 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/aggregates/order/OrderDetail.java | 13 ++- .../order/order_record/OrderCarRecord.java | 24 +++- .../order/order_record/OrderHotelRecord.java | 12 +- .../CTripHotelOrderDetail.java | 107 ++++++++++++++++++ .../ctrip_order_record/CTripHotelRecord.java | 5 +- .../CTripOrderRecordExtensionFactory.java | 76 +++++++++++-- .../domain/repository/LocationRepository.java | 2 +- .../service/JTCompanyDomainService.java | 4 + .../repository/JTCompanyRepositoryImpl.java | 2 + .../repository/LocationRepositoryImpl.java | 5 + .../jdbc/JdbcLocationRepository.java | 1 + .../ctrip/order/CTripOrderRecordAutoSave.java | 2 +- src/test/java/com/chint/LYTest.java | 4 +- .../java/com/chint/RouteApplicationTests.java | 6 + 14 files changed, 237 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index 24530cae..e18d02ea 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -22,6 +22,7 @@ import java.util.Optional; import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND; import static com.chint.infrastructure.constant.LegConstant.*; +import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME; @Data @@ -134,7 +135,7 @@ public class OrderDetail implements Serializable { } public OrderEvent getLastEvent() { - if(this.orderEventList == null){ + if (this.orderEventList == null) { return null; } return this.orderEventList.isEmpty() ? null : this.orderEventList.get(this.orderEventList.size() - 1); @@ -143,6 +144,16 @@ public class OrderDetail implements Serializable { // .orElseThrow(() -> new NotFoundException(NOT_FOUND)); } + public Optional getETAEvent() { + if (this.orderEventList == null) { + return Optional.empty(); + } + return this.orderEventList + .stream() + .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) + .findFirst(); + } + public OrderDetail price(String price) { this.price = price; return this; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 5eec9928..69eba259 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -1,5 +1,7 @@ package com.chint.domain.aggregates.order.order_record; +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.aggregates.order.OrderEvent; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -7,6 +9,11 @@ import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; +import java.util.List; +import java.util.Optional; + +import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; + @Data @Table("order_car_record") @NoArgsConstructor @@ -62,6 +69,7 @@ public class OrderCarRecord extends OrderBaseRecord { private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 private String orderSource; // 预订来源:线上/线下 + private String payAmount;//支付总金额 //添加行程信息 @@ -101,10 +109,12 @@ public class OrderCarRecord extends OrderBaseRecord { // 加载财务信息 public OrderCarRecord loadFinancialInfo(String accountPeriod, String billNo, - String orderAmount) { + String orderAmount, + String payAmount) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); + this.setPayAmount(payAmount); return this; } @@ -151,10 +161,14 @@ public class OrderCarRecord extends OrderBaseRecord { } // 加载超标信息 - public OrderCarRecord loadComplianceInfo(String overStandard, - String overStandardReason) { - this.setOverStandard(overStandard); - this.setOverStandardReason(overStandardReason); + public OrderCarRecord loadComplianceInfo(OrderDetail orderDetail) { + orderDetail.getETAEvent().ifPresentOrElse(it->{ + this.setOverStandard("是"); + this.setOverStandardReason(overStandardReason); + },()->{ + this.setOverStandard("否"); + this.setOverStandardReason(""); + }); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index 0af6af59..f693ed26 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -12,7 +12,7 @@ import org.springframework.data.relational.core.mapping.Table; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -public class OrderHotelRecord extends OrderBaseRecord{ +public class OrderHotelRecord extends OrderBaseRecord { @Id private Long id; private Long orderDetailId; @@ -83,14 +83,19 @@ public class OrderHotelRecord extends OrderBaseRecord{ } // 加载酒店和入住信息 - public OrderHotelRecord loadHotelAndStayInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, - int roomCount, String roomTypeName, String country, String province, String checkInCity) { + public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, + int roomCount, String roomTypeName) { this.setHotelName(hotelName); this.setHotelAddress(hotelAddress); this.setCheckInDate(checkInDate); this.setDepartureDate(departureDate); this.setRoomCount(roomCount); this.setRoomTypeName(roomTypeName); + return this; + } + + // 加载地理信息位置 + public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity) { this.setCountry(country); this.setProvince(province); this.setCheckInCity(checkInCity); @@ -199,5 +204,4 @@ public class OrderHotelRecord extends OrderBaseRecord{ } - } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java new file mode 100644 index 00000000..96b8da25 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java @@ -0,0 +1,107 @@ +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.OrderHotelResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +@Table("c_trip_hotel_order_detail") +public class CTripHotelOrderDetail implements Serializable { + @Serial + private static final long serialVersionUID = 1027124557206346513L; + @Id + private Long id; + private Long cTripHotelRecordId; + private Long OrderId; + private String EmployeeName; + private String EmployeeID; + private String WorkCity; + private String OrderDate; + private String RoomName; + private String RoomNameEN; + private Integer RoomQuantity; + private String ClientName; + private String StartTime; + private String EndTime; + private Double PostAmount; + private String IsHasSpecialInvoice; + private String ServerFrom; + private String LowPriceRC; + private String LowPriceRC_VV; + private String LowPriceRCInfo; + private String LowPriceRCInfoEN; + private String AgreementRC; + private String AgreementRC_VV; + private String AgreementRCInfo; + private String AgreementRCInfoEN; + private String CostCenter; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String CostCenter5; + private String CostCenter6; + private String JourneyReason; + private String Project; + private String DefineTitleContent; + private String DefineTitleContent2; + private String HotelRelatedJourneyNo; + private String Remarks; + private String PayType; + private String BalanceType; + private String IsMixPayment; + private Double SettlementACCNTAmt; + private Double SettlementPersonAmt; + private Double CouponAmount; + private String Dept1; + private String Dept2; + private String Dept3; + private String Dept4; + private String Dept5; + private String Dept6; + private String Dept7; + private String Dept8; + private String Dept9; + private String Dept10; + private String MinPriceRC; + private String MinPriceRC_VV; + private String RankName; + private String RankNameEn; + private String ConfirmType; + private String ConfirmType2; + private String ConfirmPerson; + private String ConfirmPerson2; + private String ConfirmPersonCC; + private String ConfirmPersonCC2; + private String ConfirmPersonName; + private String ConfirmPersonName2; + private String ConfirmPersonCCName; + private String ConfirmPersonCCName2; + private Double TPMaxPrice; + private String RoomType; + private Integer MealType; + private String ProjectCode; + private String CancelReason; + private String CancelReasonDesc; + private String ContractRoomExistedFlag; + private String RefundTime; + private String RepeatBookingRC; + private String RepeatBookingDesc; + private String RepeatBookingRC_VV; + private String UserNamePinyin; + private String ConfigCurrency; + private Double ConfigExchangeToSettlement; + private Double TPConfigMinPrice; + private Double TPConfigMaxPrice; + private String ReservationType; + private String PreEmail; + public static CTripHotelOrderDetail of(OrderHotelResponse.SettlementOrderDetail data) { + return BeanUtil.copyProperties(data, CTripHotelOrderDetail.class); + } + +} 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 3a668234..fb7eede3 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 @@ -20,12 +20,15 @@ public class CTripHotelRecord { private CTripHotelRecordBase cTripHotelRecordBase; @MappedCollection(idColumn = "c_trip_hotel_record_id") private CTripHotelInfo cTripHotelInfo; + @MappedCollection(idColumn = "c_trip_hotel_record_id") + private CTripHotelOrderDetail cTripHotelOrderDetail; - public static CTripHotelRecord of(CTripHotelRecordBase cTripHotelRecordBase, CTripHotelInfo cTripHotelInfo) { + public static CTripHotelRecord of(CTripHotelRecordBase cTripHotelRecordBase, CTripHotelInfo cTripHotelInfo, CTripHotelOrderDetail cTripHotelOrderDetail) { CTripHotelRecord cTripHotelRecord = new CTripHotelRecord(); cTripHotelRecord.setRecordId(String.valueOf(cTripHotelRecordBase.getRecordId())); cTripHotelRecord.setCTripHotelRecordBase(cTripHotelRecordBase); cTripHotelRecord.setCTripHotelInfo(cTripHotelInfo); + cTripHotelRecord.setCTripHotelOrderDetail(cTripHotelOrderDetail); cTripHotelRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripHotelRecordBase.getCreateTime())); return cTripHotelRecord; } 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 12ca6a8b..3c95a733 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 @@ -1,19 +1,25 @@ package com.chint.domain.factoriy.order_record; +import com.chint.application.dtos.response.LocationRes; +import com.chint.domain.aggregates.order.CarOrderDetail; +import com.chint.domain.aggregates.order.Location; +import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.RouteOrder; 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.CTripCarQuickInfo; -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.*; +import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.RouteRepository; 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.util.List; +import java.util.Optional; + @Component public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFactory { @@ -23,21 +29,25 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac private JdbcCtripHotelOrderDetailRepository jdbcCtripHotelOrderDetailRepository; @Autowired private OrderRecordFactory orderRecordFactory; - @Autowired private RouteRepository routeRepository; + @Autowired + private LocationRepository locationRepository; @Override public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; String routeOrderNo = cTripCarRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderCarRecord orderCarRecord = orderRecordFactory .buildWithRouteOrder(byOrderNo) .carRecord(); - CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); + //携程的打车订单可以直接通过订单号获取对应的订单 + Optional orderDetail = byOrderNo.getOrderDetails().stream().filter(it -> it.getOrderNo().equals(String.valueOf( + cTripCarRecordBase.getOrderId() + ))).findFirst(); + CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo(); //添加行程信息 @@ -62,7 +72,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String batchNo = cTripCarRecordBase.getBatchNoStartDate().substring(0, 6); orderCarRecord.loadFinancialInfo(batchNo, cTripCarRecordBase.getSubAccCheckBatchNo(), - String.valueOf(cTripCarRecordBase.getAmount())); + String.valueOf(cTripCarRecordBase.getAmount()), + String.valueOf(cTripCarRecordBase.getRealAmountHasPost())); // 加载费用细节, 未税金额,税费,服务费,取消费,额外费用,额外费用名称 , 携程马上用车产品没有税费和额外费用字段 orderCarRecord.loadFeeDetails(String.valueOf(cTripCarRecordBase.getAmount()), @@ -91,16 +102,27 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderCarRecord.loadPayment(paymentType, String.valueOf(realAmountHasPost - personAmount), String.valueOf(personAmount)); - - if(cTripCarRecord.getRouteOrderNo() == null || + if (cTripCarRecord.getRouteOrderNo() == null || cTripCarRecord.getRouteOrderNo().isEmpty() || - cTripCarRecord.getRouteOrderNo().isBlank()){ + cTripCarRecord.getRouteOrderNo().isBlank()) { orderCarRecord.loadSource("N"); } else { orderCarRecord.loadSource("Y"); } - + // 加载超标信息, 加载订单关联信息 , 加载订单状态 ,单号,创建时间等信息 + orderDetail.ifPresent(it -> { + CarOrderDetail carOrderDetail = it.getCarOrderDetail(); + orderCarRecord.loadComplianceInfo(it) + .loadRelatedOrderInfo(it.getOrderId(), + carOrderDetail.getDetailId(), + carOrderDetail.getReceiptsNum(), + carOrderDetail.getParentOrderNo(), + carOrderDetail.getOriginalOrderNo()) + .loadBasicOrderInfo(carOrderDetail.getOrderNo(), + carOrderDetail.getOrderStatus(), + carOrderDetail.getCreateTime()); + }); return orderCarRecord; } @@ -119,6 +141,38 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Override public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { + CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; + CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); + String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); + RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + OrderHotelRecord orderHotelRecord = orderRecordFactory + .buildWithRouteOrder(byOrderNo) + .hotelRecord(); + + CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); + // 加载酒店和入住信息 + orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), + cTripHotelInfo.getHotelName(), + cTripHotelOrderDetail.getStartTime(), + cTripHotelOrderDetail.getEndTime(), + cTripHotelOrderDetail.getRoomQuantity(), + cTripHotelOrderDetail.getRoomName()); + + // 加载地理信息位置 + Integer cityID = cTripHotelInfo.getCityID(); + List locations = locationRepository.findByCityId(Long.valueOf(cityID)); + if (locations != null && !locations.isEmpty()) { + Location location = locations.get(0); + LocationRes locationRes = LocationRes.copyFrom(location); + orderHotelRecord.loadLocationInfo(locationRes.getCountry(), locationRes.getProvince(), cTripHotelInfo.getCityName()); + } else { + //如果找不到该地区,那么只能先用空的 + orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName()); + } + + // 加载酒店品牌和星级信息 +// orderHotelRecord.loadBrandAndStarRateInfo() + return null; } diff --git a/src/main/java/com/chint/domain/repository/LocationRepository.java b/src/main/java/com/chint/domain/repository/LocationRepository.java index 1bac30ee..96ac9b13 100644 --- a/src/main/java/com/chint/domain/repository/LocationRepository.java +++ b/src/main/java/com/chint/domain/repository/LocationRepository.java @@ -21,6 +21,7 @@ public interface LocationRepository { Location findByCityIdAndLevelFour(Long cityId); List findByCityIdAndLocationType(Long cityId , Integer LocationType); + List findByCityId(Long cityId); List findByLocationType(Integer LocationType); List findAllLevelThreeAndFour(); @@ -56,7 +57,6 @@ public interface LocationRepository { List findChinaCityByLevel(String locationNames, Integer level); - List findNotChintCityByLevel(String locationNames, Integer level); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/JTCompanyDomainService.java b/src/main/java/com/chint/domain/service/JTCompanyDomainService.java index f0d5427d..a55b2b45 100644 --- a/src/main/java/com/chint/domain/service/JTCompanyDomainService.java +++ b/src/main/java/com/chint/domain/service/JTCompanyDomainService.java @@ -2,6 +2,7 @@ package com.chint.domain.service; import com.chint.domain.aggregates.system.JTCompany; +import com.chint.domain.exceptions.AuthException; import com.chint.domain.repository.JTCompanyRepository; import com.chint.domain.repository.SystemCodeRepository; import jakarta.annotation.PostConstruct; @@ -57,6 +58,9 @@ public class JTCompanyDomainService { public String findSystemCodeByCompanyCode(String companyCode) { JTCompany byCompanyCode = jtCompanyRepository.findByCompanyCode(companyCode); + if(byCompanyCode == null){ + throw new AuthException("用户所在公司不在实施范围内"); + } return systemCodeRepository.findById(byCompanyCode.getSystemCodeId()).getSystemCode(); } } diff --git a/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java index e7581c26..6dcaa0fe 100644 --- a/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java @@ -4,6 +4,7 @@ import com.chint.domain.aggregates.system.JTCompany; import com.chint.domain.repository.JTCompanyRepository; import com.chint.infrastructure.repository.jdbc.JdbcJTCompanyRepositoryImpl; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Repository; import java.util.ArrayList; @@ -23,6 +24,7 @@ public class JTCompanyRepositoryImpl implements JTCompanyRepository { return all; } + @Cacheable(value = "JTCompanyByCompanyCode" , key = "#companyCode") @Override public JTCompany findByCompanyCode(String companyCode) { return jdbcJTCompanyRepository.findByCompanyCode(companyCode); diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index ae743cb7..33f158dc 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -80,6 +80,11 @@ public class LocationRepositoryImpl implements LocationRepository { return jdbcLocationRepository.findByCityIdAndLocationType(cityId, LocationType); } + @Override + public List findByCityId(Long cityId) { + return jdbcLocationRepository.findByCityId(cityId); + } + @Override public List findByLocationType(Integer LocationType) { return jdbcLocationRepository.findByLocationType(LocationType); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java index 2b65a35a..282bd334 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java @@ -16,6 +16,7 @@ public interface JdbcLocationRepository extends CrudRepository { List findByLocationType(Integer locationType); List findByCityIdAndLocationType(Long cityId, Integer locationType); + List findByCityId(Long cityId); Location findByLocationId(Long locationId); 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 1151d4cf..1c5545df 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 @@ -72,7 +72,7 @@ public class CTripOrderRecordAutoSave { String.valueOf(settlementDetail.getRecordId())); if (record == null) { record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), - CTripHotelInfo.of(it.getHotelDetail())); + CTripHotelInfo.of(it.getHotelDetail()),CTripHotelOrderDetail.of(it.getOrderDetail())); } //补充额外的字段 OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail(); diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 5c4a4f74..a5b44e85 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -811,9 +811,9 @@ public class LYTest { System.out.println(json); } -// @Test + @Test void searchTrain() { - TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032167537614664"); + TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24032868398852849"); Gson gson = new Gson(); String json = gson.toJson(trainOrderDetail); System.out.println(json); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 6e7064d8..3e948ad8 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -1248,4 +1248,10 @@ class RouteApplicationTests { void testInBlackList(){ orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司"); } + +// @Test + void testSplid(){ + String str = "20240301"; + System.out.println(str.substring(0, 5)); + } } From 65793fcf49f83b30267e45ce6eda9e4d97afbc64 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sun, 31 Mar 2024 12:58:29 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E4=BA=8B=E4=BB=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/chint/application/queryies/OrderQuery.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index dc83f287..c5d1ace5 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -154,7 +154,7 @@ public class OrderQuery { //这里按照业务要求,尝试进行自动确认结束行程 orders.forEach(it->{ - if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_EVENT_FINISH)){ + if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_STATUS_FINISH)){ orderDomainService.finishOrder(it.getRouteId()); } }); From ed3c0484f9cf8174ecb2ddd0c98caeaa565f5aa4 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 1 Apr 2024 09:26:22 +0800 Subject: [PATCH 05/33] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E7=AE=97=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 +- .../application/queryies/OrderQuery.java | 1 - .../order/order_record/OrderCarRecord.java | 2 +- .../order/order_record/OrderFlightRecord.java | 164 ++++++++++------ .../order/order_record/OrderHotelRecord.java | 83 +++++--- .../CTripFlightBaseInfo.java | 73 +++++++ .../ctrip_order_record/CTripFlightRecord.java | 5 +- .../chint/domain/aggregates/user/User.java | 7 + .../aggregates/user/UserDepartmentInfo.java | 36 ++++ .../CTripOrderRecordExtensionFactory.java | 183 +++++++++++++++++- .../repository/OrderCarRecordRepository.java | 3 + .../OrderFlightRecordRepository.java | 3 +- .../OrderHotelRecordRepository.java | 3 + .../OrderTrainRecordRepository.java | 3 + .../service/OrderDetailDomainService.java | 18 ++ .../CTripOrderRecordDomainService.java | 8 +- .../OrderCarRecordRepositoryImpl.java | 6 + .../OrderFlightRecordRepositoryImpl.java | 5 + .../OrderHotelRecordRepositoryImpl.java | 6 + .../OrderTrainRecordRepositoryImpl.java | 6 + .../jdbc/JdbcOrderCarRecordRepository.java | 4 + .../jdbc/JdbcOrderFlightRecordRepository.java | 3 + .../jdbc/JdbcOrderHotelRecordRepository.java | 4 + .../jdbc/JdbcOrderTrainRecordRepository.java | 3 + .../ctrip/order/CTripOrderRecordAutoSave.java | 9 +- 25 files changed, 535 insertions(+), 105 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 7b4fb30f..0e84d69e 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/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index dc83f287..0d015383 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -521,7 +521,6 @@ public class OrderQuery { if (legItems != null && !legItems.isEmpty()) { //这里使用领域事件进行检查leg的订单状态 ,用户每次想要查看行程都会进行一次检查 legItems.forEach(leg -> legDomainService.legCheckOrder(leg)); - orderDomainService.queryLocation(legItems); List list = legItems.stream().map(LegRes::copyFrom).toList(); routeOrderRes.setLegResList(list); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 69eba259..4c8bac06 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -164,7 +164,7 @@ public class OrderCarRecord extends OrderBaseRecord { public OrderCarRecord loadComplianceInfo(OrderDetail orderDetail) { orderDetail.getETAEvent().ifPresentOrElse(it->{ this.setOverStandard("是"); - this.setOverStandardReason(overStandardReason); + this.setOverStandardReason(it.getExtension()); },()->{ this.setOverStandard("否"); this.setOverStandardReason(""); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 02b2fde8..872349fc 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record; +import com.chint.domain.aggregates.order.OrderDetail; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,7 +13,7 @@ import org.springframework.data.relational.core.mapping.Table; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -public class OrderFlightRecord extends OrderBaseRecord{ +public class OrderFlightRecord extends OrderBaseRecord { @Id private Long id; private Long orderDetailId; @@ -75,31 +76,71 @@ public class OrderFlightRecord extends OrderBaseRecord{ private String bookOrgCode3; // 出行人组织架构信息3 private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 + private String orderStatus; + private String createTime; // 加载基础订单信息 - public OrderFlightRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { - this.setId(id); + public OrderFlightRecord loadBasicOrderInfo(String orderNo, + String orderStatus, + String createTime) { this.setOrderNo(orderNo); -// this.setOrderStatus(orderStatus); -// this.setCreateTime(createTime); + this.setOrderStatus(orderStatus); + this.setCreateTime(createTime); return this; } - // 加载航班信息 - public OrderFlightRecord loadFlightInfo(String flightNum, String startAirportName, String endAirportName, - String startCityName, String endCityName, String startTime, String endTime) { + // 加载航班信息 , 航线 + public OrderFlightRecord loadFlightInfo(String flightNum, + String flightCompName, + String startAirportName, + String endAirportName, + String startCityName, + String endCityName, + String startTime, + String endTime, + String distance, + String endAirportCode, + String endTerminal) { + this.setDistance(distance); this.setFlightNum(flightNum); + this.setFlightCompName(flightCompName); this.setStartAirportName(startAirportName); - this.setEndAirportName(endAirportName); this.setStartCityName(startCityName); - this.setEndCityName(endCityName); this.setStartTime(startTime); + this.setEndAirportName(endAirportName); + this.setEndCityName(endCityName); this.setEndTime(endTime); + this.setEndAirportCode(endAirportCode); + this.setEndTerminal(endTerminal); + return this; + } + + // 加载机票信息 + public OrderFlightRecord loadTicketInfo(String issueTicketTime, + String facePrice, + String useStatus) { + this.setIssueTicketTime(issueTicketTime); + this.setFacePrice(facePrice); + this.setUseStatus(useStatus); + return this; + } + + // 加载座位细节 + public OrderFlightRecord loadSeatInfo(String seatPoint, + String seatPointName, + + String seatDiscount) { + this.setSeatDiscount(seatDiscount); + this.setSeatPoint(seatPoint); + this.setSeatPointName(seatPointName); return this; } // 加载预订与乘机人信息 - public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode, String bookingName, String userName, String userCode) { + public OrderFlightRecord loadBookingAndPassengerInfo(String bookingUserCode, + String bookingName, + String userName, + String userCode) { this.setBookingUserCode(bookingUserCode); this.setBookingName(bookingName); this.setUserName(userName); @@ -108,86 +149,95 @@ public class OrderFlightRecord extends OrderBaseRecord{ } // 加载财务与价格信息 - public OrderFlightRecord loadFinancialAndPricingInfo(String accountCompanyId, String accountCompanyName, - String accountPeriod, String billNo, String orderAmount, - String facePrice, String noTaxAmt, String taxAmt) { - this.setAccountCompanyId(accountCompanyId); - this.setAccountCompanyName(accountCompanyName); + public OrderFlightRecord loadFinancialAndPricingInfo(String accountPeriod, + String billNo, + String orderAmount, + + String ycabinFullPrice, + String policyLowestPrice, + String flightLowestPrice) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); - this.setFacePrice(facePrice); + this.setYcabinFullPrice(ycabinFullPrice); //经济舱全价 + this.setPolicyLowestPrice(policyLowestPrice); // 比价范围最低价 + this.setFlightLowestPrice(flightLowestPrice); // 航班最低价 + return this; + } + + // 加载税务信息 + public OrderFlightRecord loadTaxInfo(String noTaxAmt, + String taxAmt, + String airportTax, + String fuelTax) { this.setNoTaxAmt(noTaxAmt); this.setTaxAmt(taxAmt); - return this; - } - - // 加载额外费用信息 - public OrderFlightRecord loadExtraFeeInfo(String serviceFee, String airportTax, String fuelTax, - String changeFee, String refundFee) { - this.setPreServiceFee(serviceFee); this.setAirportTax(airportTax); this.setFuelTax(fuelTax); + return this; + } + + // 加载费用信息, 服务费, 改签费, 退票费 , 升舱费 + public OrderFlightRecord loadExtraFeeInfo(String preServiceFee, + String changeFee, + String refundFee, + String upFee, + String postServiceFee) { + this.setPreServiceFee(preServiceFee); this.setChangeFee(changeFee); this.setRefundFee(refundFee); - return this; - } - - // 加载航班额外细节 - public OrderFlightRecord loadFlightExtraDetails(String ycabinFullPrice, String seatDiscount, String policyLowestPrice, - String issueTicketTime, String flightLowestPrice, String useStatus, - String upFee, String postServiceFee, String endAirportCode, String endTerminal) { - this.setYcabinFullPrice(ycabinFullPrice); - this.setSeatDiscount(seatDiscount); - this.setPolicyLowestPrice(policyLowestPrice); - this.setIssueTicketTime(issueTicketTime); - this.setFlightLowestPrice(flightLowestPrice); - this.setUseStatus(useStatus); this.setUpFee(upFee); this.setPostServiceFee(postServiceFee); - this.setEndAirportCode(endAirportCode); - this.setEndTerminal(endTerminal); return this; } + // 加载组织架构与项目信息 - public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3, - String projectOrderNo, String offlineCcomyCode) { + public OrderFlightRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, + String bookOrgCode2, + String bookOrgCode3) { this.setBookOrgCode1(bookOrgCode1); this.setBookOrgCode2(bookOrgCode2); this.setBookOrgCode3(bookOrgCode3); - this.setProjectOrderNo(projectOrderNo); - this.setOfflineCcomyCode(offlineCcomyCode); return this; } // 加载来源和系统归属信息 - public OrderFlightRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) { - this.setTrvaleSysType(trvaleSysType); - this.setBelongSysType(belongSysType); + public OrderFlightRecord loadSourceInfo(String orderSource) { this.setOrderSource(orderSource); return this; } // 加载违规信息 - public OrderFlightRecord loadComplianceInfo(String overStandard, String overStandardReason) { - this.setOverStandard(overStandard); - this.setOverStandardReason(overStandardReason); + public OrderFlightRecord loadComplianceInfo(OrderDetail orderDetail) { + orderDetail.getETAEvent().ifPresentOrElse(it->{ + this.setOverStandard("是"); + this.setOverStandardReason(it.getExtension()); + },()->{ + this.setOverStandard("否"); + this.setOverStandardReason(""); + }); return this; } - // 加载航班细节 - public OrderFlightRecord loadFlightDetails(String seatPoint, String seatPointName, String distance, String flightCompName) { - this.setSeatPoint(seatPoint); - this.setSeatPointName(seatPointName); - this.setDistance(distance); - this.setFlightCompName(flightCompName); - return this; - } // 加载未预订最低价原因 public OrderFlightRecord loadNotLowReason(String notLowReason) { this.setNotLowReason(notLowReason); return this; } + + // 加载关联订单信息 + public OrderFlightRecord loadRelatedOrderInfo(Long orderDetailId, + String detailId, + String receiptsNum, + String parentOrderNo, + String originalOrderNo) { + this.setOrderDetailId(orderDetailId); + this.setDetailId(detailId); + this.setReceiptsNum(receiptsNum); + this.setParentOrderNo(parentOrderNo); + this.setOriginalOrderNo(originalOrderNo); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index f693ed26..4e4c8113 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order.order_record; +import com.chint.domain.aggregates.order.OrderDetail; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -72,19 +73,23 @@ public class OrderHotelRecord extends OrderBaseRecord { private String bookOrgCode3; // 入住人组织架构信息3 private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 + private String payAmount; // 支付总金额 + private String orderStatus; + private String createTime; // 加载基础订单信息 - public OrderHotelRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { - this.setId(id); + public OrderHotelRecord loadBasicOrderInfo(String orderNo, + String orderStatus, + String createTime) { this.setOrderNo(orderNo); -// this.setOrderStatus(orderStatus); -// this.setCreateTime(createTime); + this.setOrderStatus(orderStatus); + this.setCreateTime(createTime); return this; } // 加载酒店和入住信息 public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, - int roomCount, String roomTypeName) { + int roomCount, String roomTypeName) { this.setHotelName(hotelName); this.setHotelAddress(hotelAddress); this.setCheckInDate(checkInDate); @@ -112,22 +117,36 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载财务信息 - public OrderHotelRecord loadFinancialInfo(String accountCompanyId, String accountCompanyName, String accountPeriod, String billNo, - String orderAmount, String noTaxAmt, String taxAmt, String companyAmount, String personalAmount) { - this.setAccountCompanyId(accountCompanyId); - this.setAccountCompanyName(accountCompanyName); + public OrderHotelRecord loadFinancialInfo(String accountPeriod, + String billNo, + String orderAmount, + String ticketClerk, + String payAmount + ) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); + this.setPayAmount(payAmount); + this.setTicketClerk(ticketClerk); + return this; + } + + // 加载税类信息 + public OrderHotelRecord loadTaxInfo(String noTaxAmt, + String taxAmt) { this.setNoTaxAmt(noTaxAmt); this.setTaxAmt(taxAmt); - this.setCompanyAmount(companyAmount); - this.setPersonalAmount(personalAmount); return this; } // 加载支付和服务费信息 - public OrderHotelRecord loadPaymentAndServiceFeeInfo(int paymentType, String unifiedPayAmt, String personalPayAmt) { + public OrderHotelRecord loadPaymentInfo(Integer paymentType, + String unifiedPayAmt, + String personalPayAmt, + String companyAmount, + String personalAmount) { + this.setCompanyAmount(companyAmount); + this.setPersonalAmount(personalAmount); this.setPaymentType(paymentType); this.setUnifiedPayAmt(unifiedPayAmt); this.setPersonalPayAmt(personalPayAmt); @@ -143,37 +162,41 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载订单来源和系统归属信息 - public OrderHotelRecord loadSourceAndSystemInfo(String trvaleSysType, String belongSysType, String orderSource) { - this.setTrvaleSysType(trvaleSysType); - this.setBelongSysType(belongSysType); + public OrderHotelRecord loadSourceInfo(String orderSource) { this.setOrderSource(orderSource); return this; } // 加载违规信息 - public OrderHotelRecord loadComplianceInfo(int overStandard, String overStandardReason) { - this.setOverStandard(overStandard); - this.setOverStandardReason(overStandardReason); + public OrderHotelRecord loadComplianceInfo(OrderDetail orderDetail) { + orderDetail.getETAEvent().ifPresentOrElse(it -> { + this.setOverStandard(1); + this.setOverStandardReason(it.getExtension()); + }, () -> { + this.setOverStandard(0); + this.setOverStandardReason(""); + }); return this; } // 加载组织架构和项目信息 - public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, String bookOrgCode2, String bookOrgCode3, - String projectOrderNo, String offlineCcomyCode) { + public OrderHotelRecord loadOrganizationalAndProjectInfo(String bookOrgCode1, + String bookOrgCode2, + String bookOrgCode3) { this.setBookOrgCode1(bookOrgCode1); this.setBookOrgCode2(bookOrgCode2); this.setBookOrgCode3(bookOrgCode3); - this.setProjectOrderNo(projectOrderNo); - this.setOfflineCcomyCode(offlineCcomyCode); return this; } - // 加载订单详情和结算信息 - public OrderHotelRecord loadOrderDetailAndSettlementInfo(Long orderDetailId, String detailId, String ticketClerk, - String receiptsNum, String parentOrderNo, String originalOrderNo) { + // 加载订单关联号信息 + public OrderHotelRecord loadOrderNoInfo(Long orderDetailId, + String detailId, + String receiptsNum, + String parentOrderNo, + String originalOrderNo) { this.setOrderDetailId(orderDetailId); this.setDetailId(detailId); - this.setTicketClerk(ticketClerk); this.setReceiptsNum(receiptsNum); this.setParentOrderNo(parentOrderNo); this.setOriginalOrderNo(originalOrderNo); @@ -181,8 +204,12 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载房间和早餐信息 - public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, int isAgreement, int roomNightCount, - int nightCount, String roomPrice, String roomRate) { + public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, + int isAgreement, + int roomNightCount, + int nightCount, + String roomPrice, + String roomRate) { this.setIncludeAmount(includeAmount); this.setIsAgreement(isAgreement); this.setRoomNightCount(roomNightCount); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java new file mode 100644 index 00000000..29d46cb9 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java @@ -0,0 +1,73 @@ +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.OrderFlightResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + + +@Data +@Table("c_trip_flight_base_info") +public class CTripFlightBaseInfo { + @Id + private Long id; + private Long cTripFlightRecordId; + private String Uid; + private String Rank; + private String ConfirmType; + private String ConfirmType2; + private String ConfirmPerson; + private String ConfirmPerson2; + private String ConfirmPersonCC; + private String ConfirmPersonCC2; + private String ConfirmPersonName; + private String ConfirmPersonName2; + private String ConfirmPersonCCName; + private String ConfirmPersonCCName2; + private String CostCenter; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String CostCenter5; + private String CostCenter6; + private String JourneyReason; + private String Project; + private String DefineFlag; + private String DefineFlag2; + private String EmployeeID; + private String WorkCity; + private String Dept1; + private String Dept2; + private String Dept3; + private String Dept4; + private String Dept5; + private String Dept6; + private String Dept7; + private String Dept8; + private String Dept9; + private String Dept10; + private String CtripCardNo; + private String Name; + private String FlightClass; + private String IsOnline; + private String NickName; + private String JourneyID; + private String PrintTicketTime; + private String OrderDate; + private String PreEmployeeID; + private long RebookOrderID; + private String RankName; + private String RankNameEn; + private String ConfirmPersonEID; + private String ConfirmPerson2EID; + private String OrderStatus; + private String ProjectCode; + private String PrepayType; + private String ReservationType; + private String PreEmail; + + public static CTripFlightBaseInfo of(OrderFlightResponse.FlightOrderBaseInfo flightOrderBaseInfo) { + return BeanUtil.copyProperties(flightOrderBaseInfo, CTripFlightBaseInfo.class); + } +} 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 b52fbef5..76097dbe 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 @@ -20,13 +20,16 @@ public class CTripFlightRecord { private CTripFlightRecordBase cTripFlightRecordBase; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightInfo cTripFlightInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightBaseInfo cTripOrderBaseInfo; - public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo) { + public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); + cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index edc6462d..a99fead0 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -13,6 +13,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; +import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; @@ -44,6 +45,8 @@ public class User implements Serializable { private String phoneNumber; private String password; private LocalDateTime syncTime; + @MappedCollection(idColumn = "user_id", keyColumn = "user_key") + private List userDepartmentInfo; @Transient private List fsscSystemList; @Transient @@ -68,6 +71,10 @@ public class User implements Serializable { this.employeeNo = employeeNo; } +// public User addDeptInfo(){ +// +// } + public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) { this.userId = userId; this.employeeNo = employeeNo; diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java new file mode 100644 index 00000000..34a47136 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -0,0 +1,36 @@ +package com.chint.domain.aggregates.user; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("user_department_info") +public class UserDepartmentInfo implements Serializable { + @Serial + private static final long serialVersionUID = 5602115854952241146L; + @Id + private Long id; + private Long userId; + private Integer userKey; + private String companyCode; + private String companyName; + private String departmentCodeOne; + private String departmentNameOne; + private String departmentCodeTwo; + private String departmentNameTwo; + private String departmentCodeThree; + private String departmentNameThree; + private String departmentCodeFour; + private String departmentNameFour; + private String departmentCodeFive; + private String departmentNameFive; + private String departmentCodeSix; + private String departmentNameSix; + private String departmentCodeSeven; + private String departmentNameSeven; + private Integer ifPrimary; +} 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 3c95a733..d5ff7381 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 @@ -1,10 +1,7 @@ package com.chint.domain.factoriy.order_record; import com.chint.application.dtos.response.LocationRes; -import com.chint.domain.aggregates.order.CarOrderDetail; -import com.chint.domain.aggregates.order.Location; -import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.*; 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; @@ -20,6 +17,8 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; +import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; + @Component public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFactory { @@ -44,7 +43,10 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 - Optional orderDetail = byOrderNo.getOrderDetails().stream().filter(it -> it.getOrderNo().equals(String.valueOf( + Optional orderDetail = byOrderNo + .getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf( cTripCarRecordBase.getOrderId() ))).findFirst(); @@ -115,7 +117,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CarOrderDetail carOrderDetail = it.getCarOrderDetail(); orderCarRecord.loadComplianceInfo(it) .loadRelatedOrderInfo(it.getOrderId(), - carOrderDetail.getDetailId(), + cTripCarRecord.getRecordId(), carOrderDetail.getReceiptsNum(), carOrderDetail.getParentOrderNo(), carOrderDetail.getOriginalOrderNo()) @@ -135,8 +137,91 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Override public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { + CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; + String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); + RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo) + .flightRecord(); - return null; + CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); + CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase(); + //携程的打车订单可以直接通过订单号获取对应的订单 + Optional orderDetail = byOrderNo. + getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId() + ))).findFirst(); + + // 加载航班信息 , 航线 + orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(), + cTripFlightInfo.getAirLineName(), + cTripFlightInfo.getDPortName(), + cTripFlightInfo.getAPortName(), + cTripFlightInfo.getDCityName(), + cTripFlightInfo.getACityName(), + cTripFlightInfo.getTakeOffTime(), + cTripFlightInfo.getArrivalTime(), + "", + cTripFlightInfo.getACityCode(), + "") + .loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + "") + .loadSeatInfo(cTripFlightInfo.getClassName(), + cTripFlightInfo.getClassName(), + String.valueOf(cTripFlightInfo.getPriceRate())); + + + // 加载财务与价格信息 + String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6); + orderFlightRecord.loadFinancialAndPricingInfo(batchNo, + cTripFlightRecordBase.getSubAccCheckBatchNo(), + String.valueOf(cTripFlightRecordBase.getPrice()), + String.valueOf(cTripFlightInfo.getEClassStandardPrice()), + String.valueOf(cTripFlightInfo.getLowPrice()), + String.valueOf(cTripFlightInfo.getLowPrice())); + + + // 加载税务信息 + orderFlightRecord.loadTaxInfo(String.valueOf(cTripFlightRecordBase.getNonDeductibleTax()), + String.valueOf(cTripFlightRecordBase.getDeductibleTax()), + String.valueOf(cTripFlightRecordBase.getTax()), + String.valueOf(cTripFlightRecordBase.getOilFee())); + + // 加载费用信息, 服务费, 改签费, 退票费 , 升舱费 + orderFlightRecord.loadExtraFeeInfo(String.valueOf(cTripFlightRecordBase.getPostServiceFee()), + String.valueOf(cTripFlightRecordBase.getRebookQueryFee()), + String.valueOf(cTripFlightRecordBase.getRefund()), + String.valueOf(cTripFlightRecordBase.getAmount()), + String.valueOf(cTripFlightRecordBase.getSettItineraryFee())); + + // 加载来源 + if (cTripFlightRecord.getRouteOrderNo() == null || + cTripFlightRecord.getRouteOrderNo().isEmpty() || + cTripFlightRecord.getRouteOrderNo().isBlank()) { + orderFlightRecord.loadSourceInfo("N"); + } else { + orderFlightRecord.loadSourceInfo("Y"); + } + + // 加载关联票价原因 + orderDetail.ifPresent(it -> { + FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); + orderFlightRecord.loadComplianceInfo(it) + .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), + flightOrderDetail.getOrderStatus(), + cTripFlightRecordBase.getCreateTime()) + .loadRelatedOrderInfo(it.getOrderId(), + String.valueOf(cTripFlightRecordBase.getRecordId()), + flightOrderDetail.getReceiptsNum(), + flightOrderDetail.getParentOrderNo(), + it.getOrderNo()); + }); + + // 加载未预订最低价原因 + orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); + + return orderFlightRecord; } @Override @@ -150,6 +235,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .hotelRecord(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); + CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase(); // 加载酒店和入住信息 orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), cTripHotelInfo.getHotelName(), @@ -158,6 +244,21 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelOrderDetail.getRoomQuantity(), cTripHotelOrderDetail.getRoomName()); + // 加载房间和早餐信息 , 含早分数先为空 + String isAgreement; + if (cTripHotelRecordBase.getOrderType().equals(4) || cTripHotelRecordBase.getOrderType().equals(6)) { + isAgreement = "1"; + } else { + isAgreement = "0"; + } + orderHotelRecord.loadRoomAndBreakfastInfo("", + Integer.parseInt(isAgreement), + cTripHotelRecordBase.getQuantity(), + cTripHotelRecordBase.getQuantity(), + String.valueOf(cTripHotelRecordBase.getPrice()), + String.valueOf(cTripHotelRecordBase.getAmount())); + + // 加载地理信息位置 Integer cityID = cTripHotelInfo.getCityID(); List locations = locationRepository.findByCityId(Long.valueOf(cityID)); @@ -171,9 +272,73 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } // 加载酒店品牌和星级信息 -// orderHotelRecord.loadBrandAndStarRateInfo() + orderHotelRecord.loadBrandAndStarRateInfo(cTripHotelInfo.getHotelGroupName(), + cTripHotelInfo.getBrandName(), + String.valueOf(cTripHotelInfo.getStar())); + + // 加载订单来源和系统归属信息 + String sourceInfo; + if (cTripHotelRecord.getRouteOrderNo() == null) { + sourceInfo = "N"; + } else { + sourceInfo = "Y"; + } + orderHotelRecord.loadSourceInfo(sourceInfo); + + Optional orderDetailOptional = byOrderNo.getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId()))) + .findFirst(); + + orderDetailOptional.ifPresent(it -> { + orderHotelRecord.loadComplianceInfo(it); // 加载违规信息 + HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail(); + orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息 + cTripHotelRecord.getRecordId(), + hotelOrderDetail.getReceiptsNum(), + hotelOrderDetail.getOrderNo(), + hotelOrderDetail.getOrderNo()); + orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 + hotelOrderDetail.getOrderStatus(), + cTripHotelRecordBase.getCreateTime()); + }); + + // 加载财务信息 + orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(), + cTripHotelRecordBase.getBatchStartDate().substring(0, 6), + String.valueOf(cTripHotelRecordBase.getAmount()), + "", + cTripHotelRecordBase.getPaidAmount()); - return null; + // 加载付款 付款方式,公司付款金额, 个人付款金额 + String paymentType; + Double personAmount = cTripHotelRecordBase.getPersonAmount(); + Double paidAmount = Double.parseDouble(cTripHotelRecordBase.getPaidAmount()); + if (personAmount > 0 && personAmount < paidAmount) { + paymentType = "2"; + } else if (personAmount.equals(paidAmount)) { + paymentType = "1"; + } else { + paymentType = "0"; + } + orderHotelRecord.loadPaymentInfo(Integer.parseInt(paymentType), + cTripHotelRecordBase.getBookServiceFee(), + KEEP_TWO_DECIMAL_ZERO, + String.valueOf(paidAmount - personAmount), + String.valueOf(personAmount)); + + // 加载预订人和入住人信息 + orderHotelRecord.loadBookerAndGuestInfo(cTripHotelOrderDetail.getEmployeeID(), + cTripHotelOrderDetail.getEmployeeName(), + cTripHotelOrderDetail.getEmployeeID(), + cTripHotelOrderDetail.getEmployeeName()); + + // 加载组织架构 + orderHotelRecord.loadOrganizationalAndProjectInfo(cTripHotelOrderDetail.getDept1(), + cTripHotelOrderDetail.getDept2(), + cTripHotelOrderDetail.getDept3()); + + return orderHotelRecord; } } diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 62642c15..1bd7acab 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -3,7 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import java.util.List; +import java.util.Optional; public interface OrderCarRecordRepository { List saveAll(List orderCarRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index c7d47ebd..5a11f804 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -3,9 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import java.util.List; +import java.util.Optional; public interface OrderFlightRecordRepository { List saveAll(List orderFlightRecordList); - + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index 6f2d18f4..b7b51daa 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -3,7 +3,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import java.util.List; +import java.util.Optional; public interface OrderHotelRecordRepository { List saveAll(List orderHotelRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 35dfdca9..110ab308 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -4,7 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import java.util.List; +import java.util.Optional; public interface OrderTrainRecordRepository { List saveAll(List orderTrainRecordList); + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/domain/service/OrderDetailDomainService.java b/src/main/java/com/chint/domain/service/OrderDetailDomainService.java index 190c8df3..64050c49 100644 --- a/src/main/java/com/chint/domain/service/OrderDetailDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDetailDomainService.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; @@ -85,15 +86,32 @@ public class OrderDetailDomainService { } public List saveCarOrderRecordBatch(List orderCarRecordList) { + //如果发现唯一键已经存在, 那么就做更新处理 + orderCarRecordList.forEach(needSave-> orderCarRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderCarRecordRepository.saveAll(orderCarRecordList); } public List saveFlightOrderRecordBatch(List orderFlightRecordList) { + orderFlightRecordList.forEach(needSave-> orderFlightRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderFlightRecordRepository.saveAll(orderFlightRecordList); } public List saveTrainOrderRecordBatch(List orderTrainRecordList) { + orderTrainRecordList.forEach(needSave-> orderTrainRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderTrainRecordRepository.saveAll(orderTrainRecordList); } public List saveHotelOrderRecordBatch(List orderHotelRecordList) { + orderHotelRecordList.forEach(needSave-> orderHotelRecordRepository + .findByDetailId(needSave.getDetailId()) + .ifPresent(it-> + needSave.setId(it.getId()))); return orderHotelRecordRepository.saveAll(orderHotelRecordList); } diff --git a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java index c323e9a4..38906319 100644 --- a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java @@ -17,30 +17,34 @@ 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 generateHotelRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateTrainRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateFlightRecord(OrderRecordGenerateCommand command) { + return null; } @Override public List generateCarRecord(OrderRecordGenerateCommand command) { + return null; } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index f76fe4ad..3d9018b9 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { @@ -19,4 +20,9 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { orderCarRecordRepository.saveAll(orderCarRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return orderCarRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 92e4b59b..0d28efee 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordRepository { @@ -22,5 +23,9 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return res; } + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderFlightRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index e7a4cf8a..fced6b8c 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepository { @@ -22,4 +23,9 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor jdbcOrderHotelRecordRepository.saveAll(orderHotelRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderHotelRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 71aac4f9..9581a020 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Repository; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Repository public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository { @@ -21,4 +22,9 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor jdbcOrderTrainRecordRepository.saveAll(orderTrainRecordList).forEach(res::add); return res; } + + @Override + public Optional findByDetailId(String detailId) { + return jdbcOrderTrainRecordRepository.findByDetailId(detailId); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index 43f5f58a..70b21aa6 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderCarRecordRepository extends CrudRepository { + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index cfc7e5f2..88a5ce4a 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderFlightRecordRepository extends CrudRepository { + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index 03d806dc..919524e5 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -4,6 +4,10 @@ import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderHotelRecordRepository extends CrudRepository { + + Optional findByDetailId(String detailId); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index bc274d54..36457a1d 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -4,6 +4,9 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.Optional; + @Repository public interface JdbcOrderTrainRecordRepository extends CrudRepository { + Optional findByDetailId(String detailId); } 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 1c5545df..92b38c3f 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 @@ -45,9 +45,9 @@ public class CTripOrderRecordAutoSave { String.valueOf(orderSettlementBaseInfo.getRecordID())); if (record == null) { record = CTripFlightRecord.of( - CTripFlightRecordBase.changeInfo( - orderSettlementBaseInfo - ), CTripFlightInfo.of(it.getOrderFlightInfo()) + CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), + CTripFlightInfo.of(it.getOrderFlightInfo()), + CTripFlightBaseInfo.of(it.getOrderBaseInfo()) ); } //补充额外的字段 @@ -72,7 +72,8 @@ public class CTripOrderRecordAutoSave { String.valueOf(settlementDetail.getRecordId())); if (record == null) { record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), - CTripHotelInfo.of(it.getHotelDetail()),CTripHotelOrderDetail.of(it.getOrderDetail())); + CTripHotelInfo.of(it.getHotelDetail()), + CTripHotelOrderDetail.of(it.getOrderDetail())); } //补充额外的字段 OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail(); From 16f4a64fd505fbf98841ef8ceff8505174e5f409 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 1 Apr 2024 10:42:08 +0800 Subject: [PATCH 06/33] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CTripCarPassengerInfo.java | 52 ++++++++ .../ctrip_order_record/CTripCarRecord.java | 5 +- .../CTripFlightBaseInfo.java | 7 +- .../ctrip_order_record/CTripFlightInfo.java | 7 +- .../ctrip_order_record/CTripFlightRecord.java | 10 +- .../ctrip_order_record/CTripHotelRecord.java | 6 +- .../CTripOrderRecordExtensionFactory.java | 120 +++++++++++++++++- .../ctrip/order/CTripOrderRecordAutoSave.java | 4 +- 8 files changed, 196 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java new file mode 100644 index 00000000..84b40c87 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripCarPassengerInfo.java @@ -0,0 +1,52 @@ +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 lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_car_passenger_info") +public class CTripCarPassengerInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2343214623512376645L; + @Id + private Long id; + private Long cTripCarRecordId; + private String PassengerName; + private String PassengerPhone; + private String PassengerType; + private String UserProperties; + private String EmployeeID; + private String CorpUserID; + private String IdNumber; + private String IdType; + private String DistrictCode; + private String CityName; + private String CostCenter1; + private String CostCenter2; + private String CostCenter3; + private String CostCenter4; + private String CostCenter5; + private String CostCenter6; + private int CurrentStatus; + private String Dept1; + private String Dept2; + private String Dept3; + private String Dept4; + private String Dept5; + private String Dept6; + private String Dept7; + private String Dept8; + private String Dept9; + private String Dept10; + private String PassengerNamePinYin; + + public static CTripCarPassengerInfo of(OrderCarResponse.CarOrderPassengerInfo carOrderPassengerInfo) { + return BeanUtil.copyProperties(carOrderPassengerInfo, CTripCarPassengerInfo.class); + } +} 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 e252843a..aad7ebd4 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 @@ -24,13 +24,16 @@ public class CTripCarRecord implements Serializable { private CTripCarRecordBase cTripCarRecordBase; @MappedCollection(idColumn = "c_trip_car_record_id") private CTripCarQuickInfo cTripCarQuickInfo; + @MappedCollection(idColumn = "c_trip_car_record_id") + private CTripCarPassengerInfo cTripCarPassengerInfo; - public static CTripCarRecord of(CTripCarRecordBase cTripCarRecordBase, CTripCarQuickInfo cTripCarQuickInfo) { + public static CTripCarRecord of(CTripCarRecordBase cTripCarRecordBase, CTripCarQuickInfo cTripCarQuickInfo , CTripCarPassengerInfo cTripCarPassengerInfo) { CTripCarRecord cTripCarRecord = new CTripCarRecord(); cTripCarRecord.setCTripCarQuickInfo(cTripCarQuickInfo); cTripCarRecord.setCTripCarRecordBase(cTripCarRecordBase); cTripCarRecord.setRecordId(String.valueOf(cTripCarRecordBase.getRecordId())); cTripCarRecord.setCreateTime(DateTimeUtil.strToTime(cTripCarRecordBase.getCreateTime())); + cTripCarRecord.setCTripCarPassengerInfo(cTripCarPassengerInfo); return cTripCarRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java index 29d46cb9..19bb283a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightBaseInfo.java @@ -6,10 +6,15 @@ import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; +import java.io.Serial; +import java.io.Serializable; + @Data @Table("c_trip_flight_base_info") -public class CTripFlightBaseInfo { +public class CTripFlightBaseInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2742278923464870145L; @Id private Long id; private Long cTripFlightRecordId; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java index 955e2486..3f634d95 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightInfo.java @@ -6,9 +6,14 @@ import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; +import java.io.Serial; +import java.io.Serializable; + @Data @Table("c_trip_flight_info") -public class CTripFlightInfo { +public class CTripFlightInfo implements Serializable { + @Serial + private static final long serialVersionUID = 2423124551558870145L; @Id private Long id; private Long cTripFlightRecordId; 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 76097dbe..98ea8dc8 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 @@ -6,11 +6,15 @@ import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; +import java.io.Serial; +import java.io.Serializable; import java.time.LocalDateTime; @Data @Table("c_trip_flight_record") -public class CTripFlightRecord { +public class CTripFlightRecord implements Serializable { + @Serial + private static final long serialVersionUID = 2423112324154456545L; @Id private Long id; private String recordId; @@ -21,7 +25,7 @@ public class CTripFlightRecord { @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightInfo cTripFlightInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") - private CTripFlightBaseInfo cTripOrderBaseInfo; + private CTripFlightBaseInfo cTripFlightBaseInfo; public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); @@ -29,7 +33,7 @@ public class CTripFlightRecord { cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); - cTripFlightRecord.setCTripOrderBaseInfo(cTripOrderBaseInfo); + cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo); return cTripFlightRecord; } } 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 fb7eede3..3d48c646 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 @@ -6,11 +6,15 @@ import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.Table; +import java.io.Serial; +import java.io.Serializable; import java.time.LocalDateTime; @Data @Table("c_trip_hotel_record") -public class CTripHotelRecord { +public class CTripHotelRecord implements Serializable { + @Serial + private static final long serialVersionUID = 3024566789331464513L; @Id private Long id; private String recordId; 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 d5ff7381..783ef50f 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 @@ -17,6 +17,7 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Optional; +import static com.chint.infrastructure.constant.BelongSystemConstant.*; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; @Component @@ -33,13 +34,46 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Autowired private LocationRepository locationRepository; + private OrderRecordBasic buildWithRecord(CTripCarRecord cTripCarRecord) { + OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); + CTripCarPassengerInfo cTripCarPassengerInfo = cTripCarRecord.getCTripCarPassengerInfo(); + orderRecordBasic.loadBookingInfo(cTripCarPassengerInfo.getEmployeeID(), + cTripCarPassengerInfo.getPassengerName(), + "", + cTripCarPassengerInfo.getPassengerName(), + cTripCarPassengerInfo.getEmployeeID()); + + orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); + orderRecordBasic.setAccountCompanyId(cTripCarPassengerInfo.getCostCenter1()); + orderRecordBasic.setAccountCompanyName(cTripCarPassengerInfo.getCostCenter2()); + orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5()); + String sysCode = cTripCarPassengerInfo.getCostCenter3(); + if (sysCode != null) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); + } + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); + } + } else { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); + } + + return orderRecordBasic; + } + @Override public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; String routeOrderNo = cTripCarRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderCarRecord orderCarRecord = orderRecordFactory - .buildWithRouteOrder(byOrderNo) + OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 @@ -47,8 +81,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .getOrderDetails() .stream() .filter(it -> it.getOrderNo().equals(String.valueOf( - cTripCarRecordBase.getOrderId() - ))).findFirst(); + cTripCarRecordBase.getOrderId() + ))).findFirst(); CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo(); @@ -135,12 +169,47 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac return null; } + private OrderRecordBasic buildWithRecord(CTripFlightRecord cTripFlightRecord) { + OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); + CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); + orderRecordBasic.loadBookingInfo(cTripFlightBaseInfo.getEmployeeID(), + cTripFlightBaseInfo.getName(), + "", + cTripFlightBaseInfo.getName(), + cTripFlightBaseInfo.getEmployeeID()); + + orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); + orderRecordBasic.setAccountCompanyId(cTripFlightBaseInfo.getCostCenter()); + orderRecordBasic.setAccountCompanyName(cTripFlightBaseInfo.getCostCenter2()); + orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5()); + String sysCode = cTripFlightBaseInfo.getCostCenter3(); + if (sysCode != null) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); + } + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); + } + } else { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); + } + + return orderRecordBasic; + } + @Override public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; + CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderFlightRecord orderFlightRecord = orderRecordFactory.buildWithRouteOrder(byOrderNo) + OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) .flightRecord(); CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); @@ -220,18 +289,55 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载未预订最低价原因 orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); + // 加载组织架构与项目信息 + orderFlightRecord.loadOrganizationalAndProjectInfo(cTripFlightBaseInfo.getDept1(), + cTripFlightBaseInfo.getDept2(), + cTripFlightBaseInfo.getDept3()); return orderFlightRecord; } + + private OrderRecordBasic buildWithRecord(CTripHotelRecord cTripHotelRecord) { + OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); + CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); + orderRecordBasic.loadBookingInfo(cTripHotelOrderDetail.getEmployeeID(), + cTripHotelOrderDetail.getEmployeeName(), + "", + cTripHotelOrderDetail.getEmployeeName(), + cTripHotelOrderDetail.getEmployeeID()); + + orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); + orderRecordBasic.setAccountCompanyId(cTripHotelOrderDetail.getCostCenter()); + orderRecordBasic.setAccountCompanyName(cTripHotelOrderDetail.getCostCenter2()); + orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5()); + String sysCode = cTripHotelOrderDetail.getCostCenter3(); + if (sysCode != null) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); + } + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); + } + } else { + orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); + } + return orderRecordBasic; + } + @Override public OrderHotelRecord createHotelOrderRecord(Object orderHotelRecordData) { CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); - OrderHotelRecord orderHotelRecord = orderRecordFactory - .buildWithRouteOrder(byOrderNo) + OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) .hotelRecord(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); 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 92b38c3f..764e569c 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 @@ -120,7 +120,9 @@ public class CTripOrderRecordAutoSave { if (record == null) { record = CTripCarRecord.of( CTripCarRecordBase.changeInfo(settlementBaseInfo), - CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo())); + CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()), + CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0)) + ); } //补充额外的字段 OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo(); From 89dfea7c3e002d55bbf9ccdf595cb5e1c3514c8d Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 1 Apr 2024 11:11:39 +0800 Subject: [PATCH 07/33] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order_record/OrderRecordFactory.java | 15 ++++++++ .../CTripOrderDetailRepository.java | 23 +++++++++++-- .../CTripOrderRecordDomainService.java | 34 ++++++++++++++----- .../repository/CTripOrderDetailImpl.java | 27 +++++++++++---- .../jdbc/JdbcCTripCarRecordRepository.java | 6 ++++ .../jdbc/JdbcCTripFlightRecordRepository.java | 5 +++ .../jdbc/JdbcCTripHotelRecordRepository.java | 5 +++ .../jdbc/JdbcCTripTrainRecordRepository.java | 5 +++ 8 files changed, 103 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java index 384192a1..2064d583 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; 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_L_Y; @Component public class OrderRecordFactory { @@ -16,6 +17,12 @@ public class OrderRecordFactory { @Autowired private UserRepository userRepository; + @Autowired + private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; + + @Autowired + private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory; + public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) { routeOrder.reloadStatus(); OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); @@ -63,4 +70,12 @@ public class OrderRecordFactory { } return orderRecordBasic; } + + public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) { + return switch (supplierName) { + case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory; + case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory; + default -> null; + }; + } } diff --git a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java index b43d66f5..11503043 100644 --- a/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java +++ b/src/main/java/com/chint/domain/repository/CTripOrderDetailRepository.java @@ -2,6 +2,7 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*; +import java.time.LocalDateTime; import java.util.List; /** @@ -37,14 +38,32 @@ public interface CTripOrderDetailRepository { void saveAllCarRecord(List ctripCarOrderDetailList); CTripCarRecordBase findCarByRecordId(Long id); + void saveAllCTripFlightRecord(List cTripFlightRecordList); - CTripFlightRecord findFlightRecordById(Long id); + + CTripFlightRecord findFlightRecordById(Long id); + CTripFlightRecord findFlightRecordByRecordId(String recordId); + void saveAllCTripHotelRecord(List cTripHotelRecordList); - CTripHotelRecord findHotelRecordById(Long id); + + CTripHotelRecord findHotelRecordById(Long id); + CTripHotelRecord findHotelRecordByRecordId(String recordId); + void saveAllCTripTrainRecord(List cTripTrainRecordList); + CTripTrainRecord findTrainRecordByRecordId(String recordId); + void saveAllCTripCarRecord(List cTripCarRecordList); + CTripCarRecord findCarRecordByRecordId(String recordId); + + List findHotelRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime); + + List findFlightRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime); + + List findCarRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime); + + List findTrainRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime); } diff --git a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java index 38906319..522ceedc 100644 --- a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java @@ -5,29 +5,41 @@ 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.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.OrderRecordExtensionFactory; +import com.chint.domain.factoriy.order_record.OrderRecordFactory; +import com.chint.domain.repository.CTripOrderDetailRepository; 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; +import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; + @Component -public class CTripOrderRecordDomainService implements OrderRecordDomainService{ +public class CTripOrderRecordDomainService implements OrderRecordDomainService { @Autowired private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; @Autowired private OrderDetailDomainService orderDetailDomainService; + @Autowired + private CTripOrderDetailRepository cTripOrderDetailRepository; + @Autowired + private OrderRecordFactory orderRecordFactory; @Override public List generateHotelRecord(OrderRecordGenerateCommand command) { - - return null; + List records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime()); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + List list = records.stream().map(orderRecordExtensionFactory::createHotelOrderRecord).toList(); + return orderDetailDomainService.saveHotelOrderRecordBatch(list); } @Override @@ -38,13 +50,17 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService{ @Override public List generateFlightRecord(OrderRecordGenerateCommand command) { - - return null; + List records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime()); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + List list = records.stream().map(orderRecordExtensionFactory::createFlightOrderRecord).toList(); + return orderDetailDomainService.saveFlightOrderRecordBatch(list); } @Override public List generateCarRecord(OrderRecordGenerateCommand command) { - - return null; + List records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime()); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + List list = records.stream().map(orderRecordExtensionFactory::createCarOrderRecord).toList(); + return orderDetailDomainService.saveCarOrderRecordBatch(list); } } diff --git a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java index ab6568e1..14bce675 100644 --- a/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/CTripOrderDetailImpl.java @@ -6,6 +6,7 @@ import com.chint.infrastructure.repository.jdbc.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.List; /** @@ -120,7 +121,7 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { } @Override - public CTripFlightRecord findFlightRecordById(Long id) { + public CTripFlightRecord findFlightRecordById(Long id) { return jdbcCTripFlightRecordRepository.findById(id).get(); } @@ -163,11 +164,25 @@ public class CTripOrderDetailImpl implements CTripOrderDetailRepository { public CTripCarRecord findCarRecordByRecordId(String recordId) { return jdbcCTripCarRecordRepository.findByRecordId(recordId); } -// -// @Override -// public Client findByClientId(String clientId){ -// return jdbcClientRepository.findByClientId(clientId); -// } + @Override + public List findHotelRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) { + return jdbcCTripHotelRecordRepository.findByCreateTimeBetween(startTime, endTime); + } + + @Override + public List findFlightRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) { + return jdbcCTripFlightRecordRepository.findByCreateTimeBetween(startTime, endTime); + } + + @Override + public List findCarRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) { + return jdbcCTripCarRecordRepository.findByCreateTimeBetween(startTime, endTime); + } + + @Override + public List findTrainRecordByCreateTime(LocalDateTime startTime, LocalDateTime endTime) { + return jdbcCTripTrainRecordRepository.findByCreateTimeBetween(startTime, endTime); + } } 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 6f2da842..29d4f727 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripCarRecordRepository.java @@ -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.CTripCarRecordBase; 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.stereotype.Repository; +import java.time.LocalDateTime; +import java.util.List; + @Repository public interface JdbcCTripCarRecordRepository extends CrudRepository { CTripCarRecord findByRecordId(String recordId); + + List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); } 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 8669cf7e..774a7a3e 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripFlightRecordRepository.java @@ -1,11 +1,16 @@ 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.CTripHotelRecord; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; +import java.util.List; + @Repository public interface JdbcCTripFlightRecordRepository extends CrudRepository { CTripFlightRecord findByRecordId(String recordId); + List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); } 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 c844e383..897c6a8f 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripHotelRecordRepository.java @@ -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.stereotype.Repository; +import java.time.LocalDateTime; +import java.util.List; + @Repository public interface JdbcCTripHotelRecordRepository extends CrudRepository { CTripHotelRecord findByRecordId(String recordId); + + List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); } 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 2dabe052..7ce1e3fe 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcCTripTrainRecordRepository.java @@ -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.stereotype.Repository; +import java.time.LocalDateTime; +import java.util.List; + @Repository public interface JdbcCTripTrainRecordRepository extends CrudRepository { CTripTrainRecord findByRecordId(String recordId); + + List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); } From 12011f37698da13f6ca676ff5114fcf3e0d38772 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 1 Apr 2024 16:19:41 +0800 Subject: [PATCH 08/33] =?UTF-8?q?=E6=90=BA=E7=A8=8B=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dtos/AuthenticationSignDto.java | 1 - .../out/OrderDetailController.java | 5 +- .../queryies/OrderDetailQuery.java | 108 ++++++------------ .../order/order_record/OrderCarRecord.java | 1 + .../CTripOrderRecordExtensionFactory.java | 80 ++++++++----- .../order_record/OrderRecordFactory.java | 13 --- .../OrderRecordFactorySelector.java | 24 ++++ .../repository/OrderCarRecordRepository.java | 6 +- .../OrderFlightRecordRepository.java | 8 ++ .../OrderHotelRecordRepository.java | 5 + .../OrderTrainRecordRepository.java | 5 + .../CTripOrderRecordDomainService.java | 13 ++- .../constant/OrderConstant.java | 1 + .../OrderCarRecordRepositoryImpl.java | 18 +++ .../OrderFlightRecordRepositoryImpl.java | 13 +++ .../OrderHotelRecordRepositoryImpl.java | 14 +++ .../OrderTrainRecordRepositoryImpl.java | 13 +++ .../config/OrderRecordCallbackImpl.java | 22 ++++ .../jdbc/JdbcOrderCarRecordRepository.java | 7 +- .../jdbc/JdbcOrderFlightRecordRepository.java | 7 +- .../jdbc/JdbcOrderHotelRecordRepository.java | 7 +- .../jdbc/JdbcOrderTrainRecordRepository.java | 7 +- .../ctrip/order/CTripOrderRecordAutoSave.java | 34 +++++- src/main/resources/application-prod.yml | 8 +- src/test/java/com/chint/CTripTest.java | 9 ++ .../java/com/chint/RouteApplicationTests.java | 2 +- 26 files changed, 293 insertions(+), 138 deletions(-) create mode 100644 src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java create mode 100644 src/main/java/com/chint/infrastructure/repository/config/OrderRecordCallbackImpl.java diff --git a/src/main/java/com/chint/application/dtos/AuthenticationSignDto.java b/src/main/java/com/chint/application/dtos/AuthenticationSignDto.java index 9e9d01a3..05678cc0 100644 --- a/src/main/java/com/chint/application/dtos/AuthenticationSignDto.java +++ b/src/main/java/com/chint/application/dtos/AuthenticationSignDto.java @@ -11,6 +11,5 @@ public class AuthenticationSignDto extends BaseQuery { private String systemType; private String startTime; private String endTime; - private String sign; } diff --git a/src/main/java/com/chint/application/out/OrderDetailController.java b/src/main/java/com/chint/application/out/OrderDetailController.java index efd43a88..bf4d9851 100644 --- a/src/main/java/com/chint/application/out/OrderDetailController.java +++ b/src/main/java/com/chint/application/out/OrderDetailController.java @@ -25,7 +25,6 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderRespon import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -91,9 +90,9 @@ public class OrderDetailController { @ApiOperation("订单结算查询接口") @PostMapping("/record/query") - public Result> queryRecord(@RequestBody AuthenticationSignDto authenticationDto) { + public Result queryRecord(@RequestBody AuthenticationSignDto authenticationDto) { if (signCheck(authenticationDto)) { - return orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto); + return Result.Success(SUCCESS, orderDetailPageQuery.orderRecordInfoPageQuery(authenticationDto)); } else { return Result.error("签名错误"); } diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index ec23d125..f701e7b1 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -7,8 +7,8 @@ import com.chint.application.dtos.mapper.OrderDetailMapper; import com.chint.application.dtos.response.OrderDetailRes; import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; -import com.chint.domain.repository.OrderDetailRepository; -import com.chint.domain.repository.RouteRepository; +import com.chint.domain.exceptions.NotFoundException; +import com.chint.domain.repository.*; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.Result; @@ -39,76 +39,37 @@ public class OrderDetailQuery { @Autowired private RouteRepository routeRepository; + @Autowired + private OrderCarRecordRepository orderCarRecordRepository; + @Autowired + private OrderHotelRecordRepository orderHotelRecordRepository; + @Autowired + private OrderFlightRecordRepository orderFlightRecordRepository; + @Autowired + private OrderTrainRecordRepository orderTrainRecordRepository; + + + public PageResult orderRecordInfoPageQuery(AuthenticationSignDto authenticationDto) { + Integer productType = authenticationDto.getProductType(); + String systemType = authenticationDto.getSystemType(); + Integer pageSize = authenticationDto.getPageSize(); + Integer pageNum = authenticationDto.getPageNum(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); + LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); + return switch (productType) { + case 1 -> orderFlightRecordRepository.findByUpdateDataTime(targetTimeBegin, + targetTimeEnd, pageSize, pageNum, systemType); + case 2 -> orderHotelRecordRepository.findByUpdateDataTime(targetTimeBegin, + targetTimeEnd, pageSize, pageNum, systemType); + case 3 -> orderTrainRecordRepository.findByUpdateDataTime(targetTimeBegin, + targetTimeEnd, pageSize, pageNum, systemType); + case 4 -> orderCarRecordRepository.findByUpdateDataTime(targetTimeBegin, + targetTimeEnd, pageSize, pageNum, systemType); + default -> throw new NotFoundException("错误产品类型"); + }; + } -// public Result> orderDetailInfoPageQuery(AuthenticationSignDto authenticationDto) { -// Integer productType = authenticationDto.getProductType(); -// String systemType = authenticationDto.getSystemType(); -// Integer pageSize = authenticationDto.getPageSize(); -// Integer pageNum = authenticationDto.getPageNum(); -// -// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); -// LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); -// LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); -// List orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd); -// List orderDetailResList = new ArrayList<>(); -// for (OrderDetail orderDetail : orderDetailList) { -// if (productType == 1) { -// FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail(); -// -// if (flightOrderDetail != null) { -// String receiptsNum = flightOrderDetail.getReceiptsNum(); -// if (receiptsNum != null) { -// flightOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum)); -// } -// if (flightOrderDetail.getOrderStatus() != null && flightOrderDetail.getBelongSysType() != null && flightOrderDetail.getBelongSysType().equals(systemType)) { -// orderDetailResList.add(flightOrderDetail); -// } -// } -// } -// if (productType == 2) { -// HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); -// if (hotelOrderDetail != null) { -// String receiptsNum = hotelOrderDetail.getReceiptsNum(); -// if (receiptsNum != null) { -// hotelOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum)); -// } -// if (hotelOrderDetail.getBelongSysType() != null && hotelOrderDetail.getBelongSysType().equals(systemType)) { -// //这里添加过滤逻辑 ,如果该订单为同程酒店订单 , 并且金额为0 判断为 临时订单数据 -// if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y) && Double.parseDouble(hotelOrderDetail.getOrderAmount()) == 0) -// continue; -// orderDetailResList.add(hotelOrderDetail); -// } -// } -// } -// if (productType == 3) { -// TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail(); -// if (trainOrderDetail != null) { -// String receiptsNum = trainOrderDetail.getReceiptsNum(); -// if (receiptsNum != null) { -// trainOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum)); -// } -// if (trainOrderDetail.getOrderStatus() != null && trainOrderDetail.getBelongSysType() != null && trainOrderDetail.getBelongSysType().equals(systemType)) { -// orderDetailResList.add(trainOrderDetail); -// } -// } -// } -// if (productType == 4) { -// CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail(); -// if (carOrderDetail != null) { -// String receiptsNum = carOrderDetail.getReceiptsNum(); -// if (receiptsNum != null) { -// carOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum)); -// } -// if (carOrderDetail.getOrderStatus() != null && carOrderDetail.getBelongSysType() != null && carOrderDetail.getBelongSysType().equals(systemType)) { -// orderDetailResList.add(carOrderDetail); -// } -// } -// } -// } -// List newres2 = orderDetailResList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).toList(); -// -// return Result.Success(SUCCESS, PageResult.totalPageNum(Long.parseLong(String.valueOf(orderDetailResList.size())), newres2)); -// } public Result> orderDetailInfoPageQuery(AuthenticationSignDto authenticationDto) { Integer productType = authenticationDto.getProductType(); @@ -118,7 +79,6 @@ public class OrderDetailQuery { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); - List orderDetailList = orderDetailRepository.findByUpdateTimeBetween(targetTimeBegin, targetTimeEnd); Stream orderDetailStream = orderDetailList.stream().map(orderDetail -> switch (productType) { @@ -139,10 +99,6 @@ public class OrderDetailQuery { return Result.Success(SUCCESS, PageResult.totalPageNum(res.size(), paginatedResults)); } - public Result> orderRecordInfoPageQuery(AuthenticationSignDto authenticationDto) { - return null; - } - private Object processHotelOrderDetail(OrderDetail orderDetail, String systemType) { HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 4c8bac06..19513612 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -72,6 +72,7 @@ public class OrderCarRecord extends OrderBaseRecord { private String payAmount;//支付总金额 + //添加行程信息 public OrderCarRecord loadTravelInfo(String startTime, String arriveTime, 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 783ef50f..d0582cd9 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 @@ -72,17 +72,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac public OrderCarRecord createCarOrderRecord(Object orderCarRecordData) { CTripCarRecord cTripCarRecord = (CTripCarRecord) orderCarRecordData; String routeOrderNo = cTripCarRecord.getRouteOrderNo(); - RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); OrderCarRecord orderCarRecord = buildWithRecord(cTripCarRecord) .carRecord(); CTripCarRecordBase cTripCarRecordBase = cTripCarRecord.getCTripCarRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 - Optional orderDetail = byOrderNo - .getOrderDetails() + Optional orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails() .stream() .filter(it -> it.getOrderNo().equals(String.valueOf( cTripCarRecordBase.getOrderId() - ))).findFirst(); + ))).findFirst()); CTripCarQuickInfo cTripCarQuickInfo = cTripCarRecord.getCTripCarQuickInfo(); @@ -147,7 +146,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } // 加载超标信息, 加载订单关联信息 , 加载订单状态 ,单号,创建时间等信息 - orderDetail.ifPresent(it -> { + orderDetail.ifPresentOrElse(it -> { CarOrderDetail carOrderDetail = it.getCarOrderDetail(); orderCarRecord.loadComplianceInfo(it) .loadRelatedOrderInfo(it.getOrderId(), @@ -158,7 +157,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .loadBasicOrderInfo(carOrderDetail.getOrderNo(), carOrderDetail.getOrderStatus(), carOrderDetail.getCreateTime()); - }); + }, () -> orderCarRecord.loadRelatedOrderInfo(cTripCarRecordBase.getOrderId(), + cTripCarRecord.getRecordId(), + cTripCarRecord.getRouteOrderNo(), + String.valueOf(cTripCarRecordBase.getOrderId()), + String.valueOf(cTripCarRecordBase.getOrderId())) + .loadBasicOrderInfo( String.valueOf(cTripCarRecordBase.getOrderId()), + "", + cTripCarRecordBase.getCreateTime())); return orderCarRecord; } @@ -208,18 +214,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); - RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) .flightRecord(); CTripFlightInfo cTripFlightInfo = cTripFlightRecord.getCTripFlightInfo(); CTripFlightRecordBase cTripFlightRecordBase = cTripFlightRecord.getCTripFlightRecordBase(); //携程的打车订单可以直接通过订单号获取对应的订单 - Optional orderDetail = byOrderNo. + Optional orderDetail = byOrderNo.flatMap(routeOrder -> routeOrder. getOrderDetails() .stream() .filter(it -> it.getOrderNo().equals(String.valueOf(cTripFlightRecordBase.getOrderId() - ))).findFirst(); + ))).findFirst()); // 加载航班信息 , 航线 orderFlightRecord.loadFlightInfo(cTripFlightInfo.getFlight(), @@ -273,19 +279,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderFlightRecord.loadSourceInfo("Y"); } - // 加载关联票价原因 - orderDetail.ifPresent(it -> { - FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); - orderFlightRecord.loadComplianceInfo(it) - .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), - flightOrderDetail.getOrderStatus(), - cTripFlightRecordBase.getCreateTime()) - .loadRelatedOrderInfo(it.getOrderId(), - String.valueOf(cTripFlightRecordBase.getRecordId()), - flightOrderDetail.getReceiptsNum(), - flightOrderDetail.getParentOrderNo(), - it.getOrderNo()); - }); // 加载未预订最低价原因 orderFlightRecord.loadNotLowReason(cTripFlightInfo.getReasonDesc()); @@ -294,6 +287,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripFlightBaseInfo.getDept2(), cTripFlightBaseInfo.getDept3()); + // 加载关联票价原因 + orderDetail.ifPresentOrElse(it -> { + FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); + orderFlightRecord.loadComplianceInfo(it) + .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), + flightOrderDetail.getOrderStatus(), + cTripFlightRecordBase.getCreateTime()) + .loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), + String.valueOf(cTripFlightRecordBase.getRecordId()), + flightOrderDetail.getReceiptsNum(), + flightOrderDetail.getParentOrderNo(), + it.getOrderNo()); + }, () -> orderFlightRecord.loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), //兼容测试环境没有申请单的情况 + String.valueOf(cTripFlightRecordBase.getRecordId()), + cTripFlightBaseInfo.getJourneyID(), + String.valueOf(cTripFlightRecordBase.getOrderId()), + String.valueOf(cTripFlightRecordBase.getOrderId())) + .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), + "", + cTripFlightRecordBase.getCreateTime())); return orderFlightRecord; } @@ -336,12 +349,18 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac CTripHotelRecord cTripHotelRecord = (CTripHotelRecord) orderHotelRecordData; CTripHotelOrderDetail cTripHotelOrderDetail = cTripHotelRecord.getCTripHotelOrderDetail(); String routeOrderNo = cTripHotelRecord.getRouteOrderNo(); - RouteOrder byOrderNo = routeRepository.findByOrderNo(routeOrderNo); + Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); OrderHotelRecord orderHotelRecord = buildWithRecord(cTripHotelRecord) .hotelRecord(); CTripHotelInfo cTripHotelInfo = cTripHotelRecord.getCTripHotelInfo(); CTripHotelRecordBase cTripHotelRecordBase = cTripHotelRecord.getCTripHotelRecordBase(); + + Optional orderDetailOptional = byOrderNo.flatMap(it -> it.getOrderDetails() + .stream() + .filter(orderDetail -> orderDetail.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId()))) + .findFirst()); + // 加载酒店和入住信息 orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), cTripHotelInfo.getHotelName(), @@ -391,12 +410,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } orderHotelRecord.loadSourceInfo(sourceInfo); - Optional orderDetailOptional = byOrderNo.getOrderDetails() - .stream() - .filter(it -> it.getOrderNo().equals(String.valueOf(cTripHotelRecordBase.getOrderId()))) - .findFirst(); - orderDetailOptional.ifPresent(it -> { + orderDetailOptional.ifPresentOrElse(it -> { orderHotelRecord.loadComplianceInfo(it); // 加载违规信息 HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail(); orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息 @@ -407,7 +422,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 hotelOrderDetail.getOrderStatus(), cTripHotelRecordBase.getCreateTime()); - }); + }, () -> orderHotelRecord.loadOrderNoInfo(cTripHotelRecordBase.getOrderId(), //兼容测试环境不存在行程规划单的情况 // 加载订单关联号信息 + cTripHotelRecord.getRecordId(), + cTripHotelRecord.getRouteOrderNo(), + String.valueOf(cTripHotelRecordBase.getOrderId()), + String.valueOf(cTripHotelRecordBase.getOrderId())) + .loadBasicOrderInfo(String.valueOf(cTripHotelRecordBase.getOrderId()), // 加载基础订单信息 + "", + cTripHotelRecordBase.getCreateTime())); // 加载财务信息 orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(), diff --git a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java index 2064d583..83f99b58 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactory.java @@ -17,12 +17,6 @@ public class OrderRecordFactory { @Autowired private UserRepository userRepository; - @Autowired - private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; - - @Autowired - private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory; - public OrderRecordBasic buildWithRouteOrder(RouteOrder routeOrder) { routeOrder.reloadStatus(); OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); @@ -71,11 +65,4 @@ public class OrderRecordFactory { return orderRecordBasic; } - public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) { - return switch (supplierName) { - case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory; - case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory; - default -> null; - }; - } } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java new file mode 100644 index 00000000..88aa0973 --- /dev/null +++ b/src/main/java/com/chint/domain/factoriy/order_record/OrderRecordFactorySelector.java @@ -0,0 +1,24 @@ +package com.chint.domain.factoriy.order_record; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP; +import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y; + +@Component +public class OrderRecordFactorySelector { + @Autowired + private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; + + @Autowired + private LyOrderRecordExtensionFactory lyOrderRecordExtensionFactory; + + public OrderRecordExtensionFactory extensionFactoryOfSupplierName(String supplierName) { + return switch (supplierName) { + case SUPPLIER_C_TRIP -> cTripOrderRecordExtensionFactory; + case SUPPLIER_L_Y -> lyOrderRecordExtensionFactory; + default -> null; + }; + } +} diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 1bd7acab..435ed60c 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -1,12 +1,16 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.infrastructure.util.PageResult; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; public interface OrderCarRecordRepository { List saveAll(List orderCarRecordList); - Optional findByDetailId(String detailId); + Optional findByDetailId(String detailId); + + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index 5a11f804..26776622 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -1,7 +1,9 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.infrastructure.util.PageResult; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -9,4 +11,10 @@ public interface OrderFlightRecordRepository { List saveAll(List orderFlightRecordList); Optional findByDetailId(String detailId); + + PageResult findByUpdateDataTime(LocalDateTime startTime, + LocalDateTime endTime, + Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index b7b51daa..be2cc0fd 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -1,7 +1,10 @@ package com.chint.domain.repository; +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.infrastructure.util.PageResult; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -9,4 +12,6 @@ public interface OrderHotelRecordRepository { List saveAll(List orderHotelRecordList); Optional findByDetailId(String detailId); + + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 110ab308..3a50a491 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -1,8 +1,11 @@ package com.chint.domain.repository; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; +import com.chint.infrastructure.util.PageResult; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -10,4 +13,6 @@ public interface OrderTrainRecordRepository { List saveAll(List orderTrainRecordList); Optional findByDetailId(String detailId); + + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); } diff --git a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java index 522ceedc..06a0d451 100644 --- a/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/CTripOrderRecordDomainService.java @@ -11,8 +11,10 @@ import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHo import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory; import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory; import com.chint.domain.factoriy.order_record.OrderRecordFactory; +import com.chint.domain.factoriy.order_record.OrderRecordFactorySelector; import com.chint.domain.repository.CTripOrderDetailRepository; import com.chint.domain.service.OrderDetailDomainService; +import com.chint.infrastructure.echo_framework.annotation.ListenTo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -31,13 +33,14 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService { @Autowired private CTripOrderDetailRepository cTripOrderDetailRepository; @Autowired - private OrderRecordFactory orderRecordFactory; + private OrderRecordFactorySelector orderRecordFactorySelector; + @ListenTo(command = "OrderRecordGenerateCommand", order = 0) @Override public List generateHotelRecord(OrderRecordGenerateCommand command) { List records = cTripOrderDetailRepository.findHotelRecordByCreateTime(command.getStartTime(), command.getEndTime()); - OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); List list = records.stream().map(orderRecordExtensionFactory::createHotelOrderRecord).toList(); return orderDetailDomainService.saveHotelOrderRecordBatch(list); } @@ -48,18 +51,20 @@ public class CTripOrderRecordDomainService implements OrderRecordDomainService { return null; } + @ListenTo(command = "OrderRecordGenerateCommand", order = 1) @Override public List generateFlightRecord(OrderRecordGenerateCommand command) { List records = cTripOrderDetailRepository.findFlightRecordByCreateTime(command.getStartTime(), command.getEndTime()); - OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); List list = records.stream().map(orderRecordExtensionFactory::createFlightOrderRecord).toList(); return orderDetailDomainService.saveFlightOrderRecordBatch(list); } + @ListenTo(command = "OrderRecordGenerateCommand", order = 2) @Override public List generateCarRecord(OrderRecordGenerateCommand command) { List records = cTripOrderDetailRepository.findCarRecordByCreateTime(command.getStartTime(), command.getEndTime()); - OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactory.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); List list = records.stream().map(orderRecordExtensionFactory::createCarOrderRecord).toList(); return orderDetailDomainService.saveCarOrderRecordBatch(list); } diff --git a/src/main/java/com/chint/infrastructure/constant/OrderConstant.java b/src/main/java/com/chint/infrastructure/constant/OrderConstant.java index 3b11952c..f5494b1c 100644 --- a/src/main/java/com/chint/infrastructure/constant/OrderConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/OrderConstant.java @@ -14,6 +14,7 @@ public class OrderConstant { public static final String ORDER_EVENT_REFUND_NAME = "退票"; public static final int ORDER_EVENT_FINISH = 5; public static final String ORDER_EVENT_FINISH_NAME = "已完成"; + public static final int ORDER_EVENT_CANCEL = -1; public static final String ORDER_EVENT_CANCEL_NAME = "取消"; public static final int ORDER_EVENT_ETA = -2; diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index 3d9018b9..bd675e95 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -3,9 +3,14 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.repository.OrderCarRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository; +import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -14,6 +19,7 @@ import java.util.Optional; public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { @Autowired private JdbcOrderCarRecordRepository orderCarRecordRepository; + @Override public List saveAll(List orderCarRecordList) { List res = new ArrayList<>(); @@ -25,4 +31,16 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { public Optional findByDetailId(String detailId) { return orderCarRecordRepository.findByDetailId(detailId); } + + @Override + public PageResult findByUpdateDataTime(LocalDateTime startTime, + LocalDateTime endTime, + Integer pageSize, + Integer pageNum, + String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + Page byUpdateDataTimeBetween = orderCarRecordRepository + .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 0d28efee..87e8436d 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -3,9 +3,14 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.repository.OrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; +import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -28,4 +33,12 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return jdbcOrderFlightRecordRepository.findByDetailId(detailId); } + @Override + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + Page byUpdateDataTimeBetween = jdbcOrderFlightRecordRepository + .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); + } + } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index fced6b8c..50b7e88c 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -1,13 +1,19 @@ package com.chint.infrastructure.repository; +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.repository.OrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; +import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -28,4 +34,12 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor public Optional findByDetailId(String detailId) { return jdbcOrderHotelRecordRepository.findByDetailId(detailId); } + + @Override + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + Page byUpdateDataTimeBetween = jdbcOrderHotelRecordRepository + .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 9581a020..e9a8df6d 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -5,9 +5,14 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderTrainRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; +import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -27,4 +32,12 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor public Optional findByDetailId(String detailId) { return jdbcOrderTrainRecordRepository.findByDetailId(detailId); } + + @Override + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + Page byUpdateDataTimeBetween = jdbcOrderTrainRecordRepository + .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/config/OrderRecordCallbackImpl.java b/src/main/java/com/chint/infrastructure/repository/config/OrderRecordCallbackImpl.java new file mode 100644 index 00000000..68ad7379 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/config/OrderRecordCallbackImpl.java @@ -0,0 +1,22 @@ +package com.chint.infrastructure.repository.config; + +import com.chint.domain.aggregates.base.BaseEntity; +import com.chint.domain.aggregates.order.order_record.OrderBaseRecord; +import com.chint.infrastructure.util.BaseContext; +import org.springframework.data.relational.core.conversion.MutableAggregateChange; +import org.springframework.data.relational.core.mapping.event.BeforeSaveCallback; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +@Component +public class OrderRecordCallbackImpl implements BeforeSaveCallback { + @Override + public OrderBaseRecord onBeforeSave(OrderBaseRecord entity, MutableAggregateChange aggregateChange) { + if (entity.getCreateDataTime() == null) { + entity.setCreateDataTime(LocalDateTime.now()); + } + entity.setUpdateDataTime(LocalDateTime.now()); + return entity; + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index 70b21aa6..bf1fac92 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -1,13 +1,18 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.Optional; @Repository -public interface JdbcOrderCarRecordRepository extends CrudRepository { +public interface JdbcOrderCarRecordRepository extends CrudRepository { Optional findByDetailId(String detailId); + + Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index 88a5ce4a..a6d053d7 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -1,12 +1,17 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.Optional; @Repository -public interface JdbcOrderFlightRecordRepository extends CrudRepository { +public interface JdbcOrderFlightRecordRepository extends CrudRepository { Optional findByDetailId(String detailId); + + Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index 919524e5..4bf5cd9a 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -1,13 +1,18 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.Optional; @Repository -public interface JdbcOrderHotelRecordRepository extends CrudRepository { +public interface JdbcOrderHotelRecordRepository extends CrudRepository { Optional findByDetailId(String detailId); + + Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index 36457a1d..ee634c0a 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -1,12 +1,17 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.time.LocalDateTime; import java.util.Optional; @Repository -public interface JdbcOrderTrainRecordRepository extends CrudRepository { +public interface JdbcOrderTrainRecordRepository extends CrudRepository { Optional findByDetailId(String detailId); + + Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); } 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 764e569c..6793cf08 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 @@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Component @Slf4j @@ -49,6 +51,13 @@ public class CTripOrderRecordAutoSave { CTripFlightInfo.of(it.getOrderFlightInfo()), CTripFlightBaseInfo.of(it.getOrderBaseInfo()) ); + } else { + Long originId = record.getId(); + record = CTripFlightRecord.of( + CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), + CTripFlightInfo.of(it.getOrderFlightInfo()), + CTripFlightBaseInfo.of(it.getOrderBaseInfo())); + record.setId(originId); } //补充额外的字段 OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); @@ -74,13 +83,21 @@ public class CTripOrderRecordAutoSave { record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), CTripHotelInfo.of(it.getHotelDetail()), CTripHotelOrderDetail.of(it.getOrderDetail())); + } else { + Long originId = record.getId(); + record = CTripHotelRecord.of(CTripHotelRecordBase.changeInfo(settlementDetail), + CTripHotelInfo.of(it.getHotelDetail()), + CTripHotelOrderDetail.of(it.getOrderDetail())); + record.setId(originId); } //补充额外的字段 OrderHotelResponse.SettlementOrderDetail orderDetail = it.getOrderDetail(); - record.setRecordId(orderDetail.getHotelRelatedJourneyNo()); + record.setRouteOrderNo(orderDetail.getHotelRelatedJourneyNo()); return record; }).toList(); - cTripOrderDetailRepository.saveAllCTripHotelRecord(list); + Map> collect = list.stream() + .collect(Collectors.groupingBy(record -> record.getId() != null)); + collect.values().forEach(it -> cTripOrderDetailRepository.saveAllCTripHotelRecord(it)); } } @@ -98,6 +115,11 @@ public class CTripOrderRecordAutoSave { if (record == null) { record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail), CTripTrainInfo.of(it.getTrainSettlementTicket())); + } else { + Long originId = record.getId(); + record = CTripTrainRecord.of(CTripTrainRecordBase.changeInfo(trainSettlementDetail), + CTripTrainInfo.of(it.getTrainSettlementTicket())); + record.setId(originId); } //补充额外的字段 record.setRouteOrderNo(it.getTrainSettlementOrder().getJouneryID()); @@ -123,6 +145,14 @@ public class CTripOrderRecordAutoSave { CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()), CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0)) ); + } else { + Long originId = record.getId(); + record = CTripCarRecord.of( + CTripCarRecordBase.changeInfo(settlementBaseInfo), + CTripCarQuickInfo.of(it.getOrderDetail().getQuickProductInfo()), + CTripCarPassengerInfo.of(it.getOrderDetail().getPassengerInfoList().get(0)) + ); + record.setId(originId); } //补充额外的字段 OrderCarResponse.CarOrderCorpInfo corpInfo = it.getOrderDetail().getCorpInfo(); diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index e3af2944..70ba7b84 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -14,8 +14,8 @@ chint: # host: gf-jump.chint.com # port: 30108 # database: itinerary_booking -# username: 42b24d69-49d0-4085-b8a8-a281d0b66bb2 -# password: bHFb2HZtUHKIoZ2O +# username: fe1ff9fb-6d54-46ab-84ae-e76f00d2d473 +# password: EpqDr9g6xc3CrQlg url: https://trip.chint.com/ redis: @@ -27,8 +27,8 @@ chint: logging: level: - org.springframework.jdbc.core.JdbcTemplate: info - org.springframework.jdbc.core.StatementCreatorUtils: info + org.springframework.jdbc.core.JdbcTemplate: debug + org.springframework.jdbc.core.StatementCreatorUtils: debug root: info org.springframework.cache: info diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index de2b5abe..2ee1855b 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -40,6 +40,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.in.CTripNoteController; import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest; +import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; import com.google.gson.Gson; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -130,6 +131,9 @@ public class CTripTest { @Autowired private CTripOrderDetailImpl cTripOrderDetail; + @Autowired + private CTripOrderRecordAutoSave cTripOrderRecordAutoSave; + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); @@ -613,4 +617,9 @@ public class CTripTest { System.out.println(gson.toJson(byId)); } + +// @Test + void saveFlightRecord(){ + cTripOrderRecordAutoSave.cTripFlightRecordAutoSave(); + } } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 3e948ad8..0a70fb33 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -279,7 +279,7 @@ class RouteApplicationTests { // @Test void loginSignProd() { - String sfno = "231201060"; + String sfno = "190801115"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; From fa0cc239d1a923d3a37d39f4a006a0be4b1ddfac Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 1 Apr 2024 16:58:22 +0800 Subject: [PATCH 09/33] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0client=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/webconfig/JwtTokenAdminInterceptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/chint/infrastructure/config/webconfig/JwtTokenAdminInterceptor.java b/src/main/java/com/chint/infrastructure/config/webconfig/JwtTokenAdminInterceptor.java index 20a0a8b1..902f78be 100644 --- a/src/main/java/com/chint/infrastructure/config/webconfig/JwtTokenAdminInterceptor.java +++ b/src/main/java/com/chint/infrastructure/config/webconfig/JwtTokenAdminInterceptor.java @@ -67,8 +67,8 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor { if (res) { return true; } else { -// throw new AuthException(JWT_INVALID); - return true; + throw new AuthException(JWT_INVALID); +// return true; } } } \ No newline at end of file From ba25eed951ee8a2bfcb8e0f30020d54ffbba5fdb Mon Sep 17 00:00:00 2001 From: dengwc Date: Mon, 1 Apr 2024 17:14:24 +0800 Subject: [PATCH 10/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LyOrderRecordExtensionFactory.java | 118 +++++++++++------- 1 file changed, 72 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index 61e9debb..9f2f5ff7 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -1,7 +1,6 @@ package com.chint.domain.factoriy.order_record; -import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.*; 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; @@ -19,7 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigDecimal; +import java.util.List; import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; /** * 同程数据转换 @@ -37,6 +39,9 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor @Autowired private OrderRecordFactory orderRecordFactory; + @Autowired + private JdbcOrderTravelRepository orderTravelRepository; + @Override public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { OrderFlightRecord orderFlightRecord = new OrderFlightRecord(); @@ -77,35 +82,44 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createFlightOrder(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) { String orderSerialNo = lyOrderFlightRecord.getOrderSerialNo();//订单号 - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo); + AtomicReference orderDetailRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); BeanUtils.copyProperties(orderRecordBasic, orderFlightRecord); + OrderDetail orderDetail = orderDetailRef.get();//获取订单明细 + FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail() == null ? new FlightOrderDetail() : orderDetail.getFlightOrderDetail();//机票订单明细 + //公共字段校验 + + orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员 .setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号 .setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号 .setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号 - .setParentOrderNo("")//父级订单号 + .setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号 .setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号 - .setTicketNo(lyOrderFlightRecord.getTicketNo())//票号 - .setScheduleNum("")//行程单号 + .setTicketNo(lyOrderFlightRecord.getTicketNo());//票号 + //行程单号 + List byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo); + String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo(); + orderFlightRecord.setScheduleNum(travelNo)//行程单号 .setReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo())//关联申请单号 .setUserName(lyOrderFlightRecord.getPassengerName())//出行人姓名 .setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码 .setOverStandard("是".equals(lyOrderFlightRecord.getOverStandardStatus()) ? "1" : "0")//"是否违规(超标):0否 ,1是" .setOverStandardReason(lyOrderFlightRecord.getViolationReason())//违规原因(超标原因) - .setStartAirportName("")//起飞机场名称 - .setStartCityCode("")//起飞城市编码 - .setStartCityName("")//起飞城市名称 + .setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称 + .setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码 + .setStartCityName(flightOrderDetail.getStartCityName())//起飞城市名称 .setStartTime(lyOrderFlightRecord.getPlanBeginDate())//起飞时间 yyyy-MM-dd HH:mm:ss - .setEndAirportCode("")//到达机场三字码 - .setEndAirportName("")//到达机场名称 - .setEndCityCode("")//到达城市编码 - .setEndCityName("")//到达城市名称 - .setEndTerminal("")//到达航站楼 + .setEndAirportCode(flightOrderDetail.getEndAirportCode())//到达机场三字码 + .setEndAirportName(flightOrderDetail.getEndAirportName())//到达机场名称 + .setEndCityCode(flightOrderDetail.getEndCityCode())//到达城市编码 + .setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称 + .setEndTerminal(flightOrderDetail.getEndTerminal())//到达航站楼 .setEndTime(lyOrderFlightRecord.getPlanEndDate())//到达时间 yyyy-MM-dd HH:mm:ss .setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称 .setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价 - .setFlightNum(lyOrderFlightRecord.getFligthNo())// + .setFlightNum(lyOrderFlightRecord.getFligthNo())//航班号 .setOrderAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount())) //结算总额 .setFacePrice(String.valueOf(lyOrderFlightRecord.getTicketOutAmount())) //票面价 .setNoTaxAmt(String.valueOf(BigDecimal.valueOf(lyOrderFlightRecord.getTicketTotalAmount() == null ? 0 : lyOrderFlightRecord.getTicketTotalAmount()) @@ -125,24 +139,26 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setSeatPoint(lyOrderFlightRecord.getSeatClass())//舱位 .setSeatPointName(lyOrderFlightRecord.getSeatClass())//舱位名称 .setUseStatus(lyOrderFlightRecord.getTicketStatus()) //机票使用情况 - .setOrderSource("") //预订来源:线上/线下 + .setOrderSource(lyOrderFlightRecord.getBookingPlat()) //预订来源:线上/线下 .setNotLowReason("正泰机票无超标") //未预订最低价原因 .setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1 .setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2 .setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3 .setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心 - /* .setOrderStatus() //结算状态 - .setExpenseOrderAmount() //订单金额 + .setOrderStatus("") //结算状态 +/* .setExpenseOrderAmount("") //订单金额 .setSettleOrderFlag() //订单对账状态 - .setPayAmount() //支付金额 -*/ + .setPayAmount() //支付金额*/ ; } private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) { String orderSerialNo = lyOrderHotelRecord.getOrderSerialNo();//订单号 - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo); + AtomicReference orderDetailRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); BeanUtils.copyProperties(orderRecordBasic, orderHotelRecord); + OrderDetail orderDetail = orderDetailRef.get();//订单明细 + HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail() == null ? new HotelOrderDetail() : orderDetail.getHotelOrderDetail();//酒店订单明细 orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号 @@ -162,10 +178,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setCountry(lyOrderHotelRecord.getCountryName()) //国家 .setCustomerServiceName("") //客服处理人 .setDepartureDate(lyOrderHotelRecord.getLeaveTime()) //离店日期yyyy - MM - dd - .setHotelAddress("") //酒店地址 + .setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址 .setHotelName(lyOrderHotelRecord.getHotelName()) //酒店名称 .setIncludeAmount("") //含早情况:XX份 - .setIsAgreement(0) //是否协议酒店:0否1是 + .setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? 1 : 0) //是否协议酒店:0否1是 .setPaymentType(getPaymentType(lyOrderHotelRecord.getPayType()))//"付款方式:0-公司统付 1-个人付 2-混付" .setOrderAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //结算总额 .setCompanyAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //企业统付总额 @@ -173,9 +189,9 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费 .setPersonalPayAmt("") //个人服务费 .setProvince("") //省份 - .setRoomCount(1) //房间数 + .setRoomCount(Integer.parseInt(hotelOrderDetail.getRoomCount())) //房间数 .setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数 - .setNightCount(1) //间夜数 + .setNightCount(lyOrderHotelRecord.getHotelNights()) //间夜数 .setRoomPrice("") //房价(房间单价不包含服务费) .setRoomRate(String.valueOf(lyOrderHotelRecord.getTotalRoomPrice())) //房费(订单总额减总服务费) .setNoTaxAmt("") //不含税价 @@ -186,11 +202,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setNoTaxCusFee("") //托管费不含税 .setTaxCusFee("") //托管费税费 .setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型 - .setStarRate("") //星级 + .setStarRate(hotelOrderDetail.getStarRate()) //星级 .setOrderSource(lyOrderHotelRecord.getBookingPlat()) //预订来源:线上/线下 .setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1 - .setBookOrgCode2("") //入住人组织架构信息2 - .setBookOrgCode3("") //入住人组织架构信息3 + .setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2 + .setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()) //入住人组织架构信息3 .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心 /* .setOrderStatus() //结算状态 .setExpenseOrderAmount() //订单金额 @@ -202,14 +218,17 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) { String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号 - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo); + AtomicReference orderDetailRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); BeanUtils.copyProperties(orderRecordBasic, orderTrainRecord); + OrderDetail orderDetail = orderDetailRef.get();//订单明细 + TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail() == null ? new TrainOrderDetail() : orderDetail.getTrainOrderDetail();//火车订单明细 orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号 .setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号 .setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号 - .setParentOrderNo("") //父级订单号 + .setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号 .setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo()) //原始订单号 .setReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo()) //关联申请单号 .setStartDate(lyOrderTrainRecord.getPlanBeginDate()) //出发日期 @@ -234,15 +253,15 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setToCity(lyOrderTrainRecord.getTripName()) //到达城市 .setToStationName(lyOrderTrainRecord.getTripName()) //到达站 .setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss - .setRunTime("") //时长 - .setSeatType("")// 座位等级 + .setRunTime(trainOrderDetail.getRunTime()) //时长 + .setSeatType(trainOrderDetail.getSeatType())// 座位等级 .setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次 .setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码 .setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名 .setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源:线上 / 线下 .setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1 - .setBookOrgCode2("")//出行人组织架构信息2 - .setBookOrgCode3("")//出行人组织架构信息3 + .setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2 + .setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3())//出行人组织架构信息3 .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心 /* .setOrderStatus() //结算状态 .setExpenseOrderAmount() //订单金额 @@ -263,8 +282,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) { String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号 - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo); + AtomicReference orderDetailRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); BeanUtils.copyProperties(orderRecordBasic, orderCarRecord); + OrderDetail orderDetail = orderDetailRef.get();//订单明细 + CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail() == null ? new CarOrderDetail() : orderDetail.getCarOrderDetail();//用车订单明细 orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号 @@ -273,19 +295,19 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setOverStandard("0") //"是否违规(超标):0否 1是" .setOverStandardReason("无")//违规原因(超标原因) .setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号 - .setParentOrderNo("")//父级订单号 + .setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号 .setOriginalOrderNo(lyOrderCarRecord.getOriginOrderSerialNo())//原始订单号 .setOrderStatus("") //"结算状态" .setCreateTime(lyOrderCarRecord.getBookingDate()) //"订单创建时间格式:2023-04-26 13:15:17" .setStartTime(lyOrderCarRecord.getPlanBeginDate()) //"出发时间格式:2023-04-26 13:15:17" - .setArriveTime("") //"到达时间格式:2023-04-26 13:15:17" + .setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17" .setFromStationName(lyOrderCarRecord.getCarStartPlaceActual()) //出发地 .setToStationName(lyOrderCarRecord.getCarEndPlaceActual()) //到达地 - .setCarType("") //车型 + .setCarType(carOrderDetail.getCarModel()) //车型 .setFromCity(lyOrderCarRecord.getStartCityName()) //出发城市 - .setToCity("") //到达城市 - .setRunTime("") //运行时长 - .setMiles("") //里程数 + .setToCity(carOrderDetail.getToCity()) //到达城市 + .setRunTime(carOrderDetail.getRunTime()) //运行时长 + .setMiles(carOrderDetail.getMileage()) //里程数 .setNoTaxAmt("") //未税金额 .setTaxAmt("") //税费 .setOrderAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //结算总额(含前收服务费) @@ -296,11 +318,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setCancelCost(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //取消费 .setUserName(String.valueOf(lyOrderCarRecord.getPassengerName())) //用车人姓名 .setUserCode(lyOrderCarRecord.getPassengerNo()) //用车人code -// .setOwnPayAmt() //个人支付金额 + .setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额 .setComyPayAmt(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //公司统付金额 .setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //用车人组织架构信息1 - .setBookOrgCode2("") //用车人组织架构信息2 - .setBookOrgCode3("") //用车人组织架构信息3 + .setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2 + .setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()) //用车人组织架构信息3 .setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付" .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心 .setOrderSource(lyOrderCarRecord.getBookingPlat()) //预订来源:线上/线下 @@ -312,9 +334,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } //获取公共对象 - public OrderRecordBasic getOrderRecordBasic(String orderSerialNo) { + public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer consumer) { OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo); - Long routeId = orderDetail == null ? 0L : orderDetail.getRouteId(); + consumer.accept(orderDetail == null ? new OrderDetail() : orderDetail);//设置订单明细数据 + if (Objects.isNull(orderDetail)) { + return new OrderRecordBasic(); + } + Long routeId = orderDetail.getRouteId(); RouteOrder routeOrder = jdbcRouteRepository.findByRouteId(routeId); if (Objects.isNull(routeOrder)) { return new OrderRecordBasic(); From bc11e0a9c9b0b014dd2fc44baf527988980386ff Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 1 Apr 2024 17:16:32 +0800 Subject: [PATCH 11/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E6=8C=89=E6=9C=88=E8=8E=B7=E5=8F=96=E7=BB=93=E7=AE=97=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dtos/CTripRecordMonthSaveDTO.java | 8 ++++++++ .../com/chint/application/in/AutoWorkController.java | 12 ++++++++++++ .../rest/ctrip/order/CTripOrderDetailRequest.java | 6 +++--- .../rest/ctrip/order/CTripOrderRecordAutoSave.java | 4 ++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/chint/application/dtos/CTripRecordMonthSaveDTO.java diff --git a/src/main/java/com/chint/application/dtos/CTripRecordMonthSaveDTO.java b/src/main/java/com/chint/application/dtos/CTripRecordMonthSaveDTO.java new file mode 100644 index 00000000..562571d4 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/CTripRecordMonthSaveDTO.java @@ -0,0 +1,8 @@ +package com.chint.application.dtos; + +import lombok.Data; + +@Data +public class CTripRecordMonthSaveDTO { + private String date; +} diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 0e84d69e..7761a317 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -1,6 +1,7 @@ package com.chint.application.in; +import com.chint.application.dtos.CTripRecordMonthSaveDTO; import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.infrastructure.echo_framework.command.Command; import com.chint.application.commands.OrderRecordGenerateCommand; @@ -12,6 +13,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.chint.application.commands.OrderRecordGenerateCommand; @@ -45,6 +47,16 @@ public class AutoWorkController { return Result.Success(SUCCESS); } + @Transactional + @ApiOperation("拉取按月份的携程流水") + @PostMapping("/cTrip/record/save/month") + public Result autoSaveCTripRecordByMonth(@RequestBody CTripRecordMonthSaveDTO cTripRecordMonthSaveDTO) { + cTripOrderRecordAutoSave.saveAll(); + //将昨天的结算数据生成为财务共享需要的数据 + Command.of(OrderRecordGenerateCommand.class).sendToQueue(); + return Result.Success(SUCCESS); + } + @Transactional @ApiOperation("自动拉取同程上个月的流水号") @PostMapping("/ly/record/save") diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java index 0032ea64..5e613686 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java @@ -65,8 +65,10 @@ public class CTripOrderDetailRequest { return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime)); } - public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){ + + + public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){ String substring = dateFrom.substring(0, 6); String dateFromNew = substring + "01"; @@ -77,13 +79,11 @@ public class CTripOrderDetailRequest { dateTo, batchNo ); - orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); orderFlightParam.setAppKey(C_TRIP_APP_KEY); orderFlightParam.setTicket(ticketRequest.loadTicket()); OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam, OrderFlightResponse.class); - return orderFlightResponse; } 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 6793cf08..cef780fd 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 @@ -32,6 +32,10 @@ public class CTripOrderRecordAutoSave { this.cTripCarRecordAutoSave(); } + public void saveByDate(){ + + } + public void cTripFlightRecordAutoSave() { OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder(); List flightOrderAccountSettlementList = flightOrder From 814064918ef24f3cf87a43feb4b3067fb6e7ba2e Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Mon, 1 Apr 2024 22:13:31 +0800 Subject: [PATCH 12/33] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E6=8C=89=E6=9C=88=E6=8B=89=E5=8E=BB=E7=BB=93=E7=AE=97=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/OrderRecordGenerateCommand.java | 12 +- .../application/in/AutoWorkController.java | 9 +- .../infrastructure/util/DateTimeUtil.java | 35 +++++- ...FlightParam.java => OrderRecordParam.java} | 36 +++--- .../ctrip/order/CTripOrderDetailRequest.java | 111 ++++++------------ .../ctrip/order/CTripOrderRecordAutoSave.java | 47 +++++--- 6 files changed, 136 insertions(+), 114 deletions(-) rename src/main/java/com/chint/interfaces/rest/ctrip/dto/order/{OrderFlightParam.java => OrderRecordParam.java} (75%) diff --git a/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java b/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java index b93f456b..7d7b0390 100644 --- a/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java +++ b/src/main/java/com/chint/application/commands/OrderRecordGenerateCommand.java @@ -1,10 +1,7 @@ package com.chint.application.commands; import com.chint.infrastructure.echo_framework.command.Command; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import java.time.LocalDate; import java.time.LocalDateTime; @@ -15,4 +12,13 @@ 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); + + public OrderRecordGenerateCommand startTime(LocalDateTime startTime) { + this.setStartTime(startTime); + return this; + } + public OrderRecordGenerateCommand endTime(LocalDateTime endTime) { + this.setEndTime(endTime); + return this; + } } diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 7761a317..26a9da28 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -7,6 +7,7 @@ import com.chint.infrastructure.echo_framework.command.Command; import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.infrastructure.echo_framework.command.Command; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; import io.swagger.annotations.ApiOperation; @@ -51,9 +52,13 @@ public class AutoWorkController { @ApiOperation("拉取按月份的携程流水") @PostMapping("/cTrip/record/save/month") public Result autoSaveCTripRecordByMonth(@RequestBody CTripRecordMonthSaveDTO cTripRecordMonthSaveDTO) { - cTripOrderRecordAutoSave.saveAll(); + String date = cTripRecordMonthSaveDTO.getDate(); + cTripOrderRecordAutoSave.saveAllByDate(date); //将昨天的结算数据生成为财务共享需要的数据 - Command.of(OrderRecordGenerateCommand.class).sendToQueue(); + Command.of(OrderRecordGenerateCommand.class) + .startTime(DateTimeUtil.firstDayOfMonth(date)) + .endTime(DateTimeUtil.endDayOfMonth(date)) + .sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java index ab1037a8..347d89c2 100644 --- a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java +++ b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java @@ -1,20 +1,35 @@ package com.chint.infrastructure.util; import java.time.LocalDateTime; +import java.time.YearMonth; 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"); + private final static DateTimeFormatter formatterDate = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + private final static DateTimeFormatter formatterDateYYYYMM = DateTimeFormatter.ofPattern("yyyyMM"); + private final static DateTimeFormatter formatterDateYYYYMMDD = DateTimeFormatter.ofPattern("yyyyMMdd"); + public static String timeToStr(LocalDateTime input) { return input.format(formatterDate); } + public static String timeToStrYYYYMM(LocalDateTime input) { + return input.format(formatterDateYYYYMM); + } + + public static DateTimeFormatter formatterDateYYYYMM() { + return formatterDateYYYYMM; + } + + public static String timeToStrYYYYMMDD(LocalDateTime input) { + return input.format(formatterDateYYYYMMDD); + } + public static LocalDateTime strToTime(String input) { return LocalDateTime.parse(input.substring(0, 19), formatter); } @@ -22,4 +37,20 @@ public class DateTimeUtil { public static LocalDateTime strToTimeMM(String input) { return LocalDateTime.parse(input.substring(0, 23), formatterMM); } + + public static LocalDateTime firstDayOfMonth(String input) { + // 解析年份和月份 + YearMonth yearMonth = YearMonth.parse(input, formatterDateYYYYMM); + // 获取月份的第一天和最后一天 + return yearMonth.atDay(1).atStartOfDay(); + } + + + public static LocalDateTime endDayOfMonth(String input) { + // 解析年份和月份 + YearMonth yearMonth = YearMonth.parse(input, formatterDateYYYYMM); + // 获取月份的第一天和最后一天 + return yearMonth.atEndOfMonth().atTime(23, 59, 59); + } + } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderFlightParam.java b/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderRecordParam.java similarity index 75% rename from src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderFlightParam.java rename to src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderRecordParam.java index 278b5648..64de9e80 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderFlightParam.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/dto/order/OrderRecordParam.java @@ -4,7 +4,7 @@ import com.chint.interfaces.rest.ctrip.dto.Authentification; import lombok.Data; @Data -public class OrderFlightParam { +public class OrderRecordParam { private String AppKey; private String Ticket; @@ -25,18 +25,18 @@ public class OrderFlightParam { private Integer pageSize; private String[] subBatchNoList; -// public static OrderFlightParam of(String requestId, String locale) { -// OrderFlightParam countryParam = new OrderFlightParam(); +// public static OrderRecordParam of(String requestId, String locale) { +// OrderRecordParam countryParam = new OrderRecordParam(); // countryParam.requestId = requestId; // countryParam.locale = locale; // return countryParam; // } - public static OrderFlightParam of (String accountId, + public static OrderRecordParam of (String accountId, String dateFrom, String dateTo, String batchNo) { - OrderFlightParam countryParam = new OrderFlightParam(); + OrderRecordParam countryParam = new OrderRecordParam(); countryParam.accountid = accountId; countryParam.datefrom = dateFrom; @@ -54,7 +54,7 @@ public class OrderFlightParam { return countryParam; } - public OrderFlightParam auth(Authentification authentification) { + public OrderRecordParam auth(Authentification authentification) { this.auth = authentification; return this; } @@ -64,7 +64,7 @@ public class OrderFlightParam { return accountid; } - public OrderFlightParam setAccountId(String accountId) { + public OrderRecordParam setAccountId(String accountId) { this.accountid = accountId; return this; } @@ -73,7 +73,7 @@ public class OrderFlightParam { return datefrom; } - public OrderFlightParam setDateFrom(String dateFrom) { + public OrderRecordParam setDateFrom(String dateFrom) { this.datefrom = dateFrom; return this; } @@ -82,7 +82,7 @@ public class OrderFlightParam { return dateto; } - public OrderFlightParam setDateTo(String dateTo) { + public OrderRecordParam setDateTo(String dateTo) { this.dateto = dateTo; return this; } @@ -91,7 +91,7 @@ public class OrderFlightParam { return batchno; } - public OrderFlightParam setBatchNo(String batchNo) { + public OrderRecordParam setBatchNo(String batchNo) { this.batchno = batchNo; return this; } @@ -100,7 +100,7 @@ public class OrderFlightParam { return recordId; } - public OrderFlightParam setRecordId(String recordId) { + public OrderRecordParam setRecordId(String recordId) { this.recordId = recordId; return this; } @@ -109,7 +109,7 @@ public class OrderFlightParam { return orderId; } - public OrderFlightParam setOrderId(String orderId) { + public OrderRecordParam setOrderId(String orderId) { this.orderId = orderId; return this; } @@ -118,7 +118,7 @@ public class OrderFlightParam { return isCompensation; } - public OrderFlightParam setCompensation(Boolean compensation) { + public OrderRecordParam setCompensation(Boolean compensation) { isCompensation = compensation; return this; } @@ -127,7 +127,7 @@ public class OrderFlightParam { return payType; } - public OrderFlightParam setPayType(String payType) { + public OrderRecordParam setPayType(String payType) { this.payType = payType; return this; } @@ -136,7 +136,7 @@ public class OrderFlightParam { return pageIndex; } - public OrderFlightParam setPageIndex(Integer pageIndex) { + public OrderRecordParam setPageIndex(Integer pageIndex) { this.pageIndex = pageIndex; return this; } @@ -145,7 +145,7 @@ public class OrderFlightParam { return pageSize; } - public OrderFlightParam setPageSize(Integer pageSize) { + public OrderRecordParam setPageSize(Integer pageSize) { this.pageSize = pageSize; return this; } @@ -154,7 +154,7 @@ public class OrderFlightParam { return subBatchNoList; } - public OrderFlightParam setSubBatchNoList(String[] subBatchNoList) { + public OrderRecordParam setSubBatchNoList(String[] subBatchNoList) { this.subBatchNoList = subBatchNoList; return this; } @@ -163,7 +163,7 @@ public class OrderFlightParam { return journeyNoList; } - public OrderFlightParam setJourneyNoList(String[] journeyNoList) { + public OrderRecordParam setJourneyNoList(String[] journeyNoList) { this.journeyNoList = journeyNoList; return this; } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java index 5e613686..7f5ae56f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java @@ -1,5 +1,6 @@ package com.chint.interfaces.rest.ctrip.order; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.CTripTicketRequest; import com.chint.interfaces.rest.ctrip.dto.Authentification; @@ -8,10 +9,8 @@ import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -49,6 +48,8 @@ public class CTripOrderDetailRequest { private String carOrderUrl; + private DateTimeFormatter formatter = + @PostConstruct private void init() { this.flightOrderUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_FLIGHT_PATH; @@ -58,67 +59,43 @@ public class CTripOrderDetailRequest { } - public OrderFlightResponse getFlightOrder() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDateTime localDateTime = LocalDateTime.now().minusDays(1L); return getFlightOrder(formatter.format(localDateTime), formatter.format(localDateTime)); } - - - - public OrderFlightResponse getFlightOrder(String dateFrom,String dateTo){ - String substring = dateFrom.substring(0, 6); - String dateFromNew = substring + "01"; - - String batchNo = C_TRIP_CORP_ID + "_" + C_TRIP_ACCOUNT_ID + "_" + dateFromNew; - OrderFlightParam orderFlightParam = OrderFlightParam.of( - C_TRIP_ACCOUNT_ID, - dateFrom, - dateTo, - batchNo - ); - orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); - orderFlightParam.setAppKey(C_TRIP_APP_KEY); - orderFlightParam.setTicket(ticketRequest.loadTicket()); - OrderFlightResponse orderFlightResponse = postRequest.post(flightOrderUrl, orderFlightParam, - OrderFlightResponse.class); - return orderFlightResponse; + public OrderFlightResponse getFlightOrderByDate(String date) { + return getFlightOrder(DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date)), + DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date))); } + public OrderFlightResponse getFlightOrder(String dateFrom, String dateTo) { + return postRequest.post(flightOrderUrl, getParamByDateFromAndDateTo(dateFrom, dateTo), + OrderFlightResponse.class); + } + + public OrderHotelResponse getHotelOrderByDate(String date) { + return getHotelOrder(DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date)), + DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date))); + } + public OrderHotelResponse getHotelOrder() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDateTime localDateTime = LocalDateTime.now().minusDays(1L); return getHotelOrder(formatter.format(localDateTime), formatter.format(localDateTime)); } - public OrderHotelResponse getHotelOrder( String dateFrom, String dateTo){ - - String substring = dateFrom.substring(0, 6); - String dateFromNew = substring + "01"; - - String batchNo = C_TRIP_CORP_ID + "_" + C_TRIP_ACCOUNT_ID + "_" + dateFromNew; - OrderFlightParam orderFlightParam = OrderFlightParam.of( - C_TRIP_ACCOUNT_ID, - dateFrom, - dateTo, - batchNo - ); - - orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); - - orderFlightParam.setAppKey(C_TRIP_APP_KEY); - orderFlightParam.setTicket(ticketRequest.loadTicket()); - OrderHotelResponse orderFlightResponse = postRequest.post(hotelOrderUrl, orderFlightParam, + public OrderHotelResponse getHotelOrder(String dateFrom, String dateTo) { + return postRequest.post(hotelOrderUrl, getParamByDateFromAndDateTo(dateFrom, dateTo), OrderHotelResponse.class); - - return orderFlightResponse; } - - + public OrderTrainResponse getTrainOrderByDate(String date) { + return getTrainOrder(DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date)), + DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date))); + } public OrderTrainResponse getTrainOrder() { @@ -126,57 +103,41 @@ public class CTripOrderDetailRequest { LocalDateTime localDateTime = LocalDateTime.now().minusDays(1L); return getTrainOrder(formatter.format(localDateTime), formatter.format(localDateTime)); } - public OrderTrainResponse getTrainOrder(String dateFrom, String dateTo){ - String substring = dateFrom.substring(0, 6); - String dateFromNew = substring + "01"; - - String batchNo = C_TRIP_CORP_ID + "_" + C_TRIP_ACCOUNT_ID + "_" + dateFromNew; - OrderFlightParam orderFlightParam = OrderFlightParam.of( - C_TRIP_ACCOUNT_ID, - dateFrom, - dateTo, - batchNo - ); - - orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); - - orderFlightParam.setAppKey(C_TRIP_APP_KEY); - orderFlightParam.setTicket(ticketRequest.loadTicket()); - OrderTrainResponse orderTrainResponse = postRequest.post(trainOrderUrl, orderFlightParam, + public OrderTrainResponse getTrainOrder(String dateFrom, String dateTo) { + return postRequest.post(trainOrderUrl, getParamByDateFromAndDateTo(dateFrom, dateTo), OrderTrainResponse.class); - - return orderTrainResponse; } - - + public OrderCarResponse getCarOrderByDate(String date) { + return getCarOrder(DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.firstDayOfMonth(date)), + DateTimeUtil.timeToStrYYYYMMDD(DateTimeUtil.endDayOfMonth(date))); + } public OrderCarResponse getCarOrder() { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDateTime localDateTime = LocalDateTime.now().minusDays(1L); return getCarOrder(formatter.format(localDateTime), formatter.format(localDateTime)); } - public OrderCarResponse getCarOrder(String dateFrom, String dateTo){ + public OrderCarResponse getCarOrder(String dateFrom, String dateTo) { + return postRequest.post(carOrderUrl, getParamByDateFromAndDateTo(dateFrom, dateTo), + OrderCarResponse.class); + } + + private OrderRecordParam getParamByDateFromAndDateTo(String dateFrom, String dateTo) { String substring = dateFrom.substring(0, 6); String dateFromNew = substring + "01"; - String batchNo = C_TRIP_CORP_ID + "_" + C_TRIP_ACCOUNT_ID + "_" + dateFromNew; - OrderFlightParam orderFlightParam = OrderFlightParam.of( + OrderRecordParam orderFlightParam = OrderRecordParam.of( C_TRIP_ACCOUNT_ID, dateFrom, dateTo, batchNo ); - orderFlightParam.auth(Authentification.midOf(C_TRIP_APP_KEY, ticketRequest.loadTicket())); - orderFlightParam.setAppKey(C_TRIP_APP_KEY); orderFlightParam.setTicket(ticketRequest.loadTicket()); - OrderCarResponse orderCarResponse = postRequest.post(carOrderUrl, orderFlightParam, - OrderCarResponse.class); - - return orderCarResponse; + return orderFlightParam; } } 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 cef780fd..8b588697 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 @@ -12,6 +12,7 @@ import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; @Component @@ -26,18 +27,25 @@ public class CTripOrderRecordAutoSave { public void saveAll() { - this.cTripFlightRecordAutoSave(); - this.cTripHotelRecordAutoSave(); - this.cTripTrainRecordAutoSave(); - this.cTripCarRecordAutoSave(); + this.cTripFlightRecordAutoSave(Optional.empty()); + this.cTripHotelRecordAutoSave(Optional.empty()); + this.cTripTrainRecordAutoSave(Optional.empty()); + this.cTripCarRecordAutoSave(Optional.empty()); } - public void saveByDate(){ - + public void saveAllByDate(String date) { + this.cTripFlightRecordAutoSave(Optional.of(date)); + this.cTripHotelRecordAutoSave(Optional.of(date)); + this.cTripTrainRecordAutoSave(Optional.of(date)); + this.cTripCarRecordAutoSave(Optional.of(date)); } - public void cTripFlightRecordAutoSave() { - OrderFlightResponse flightOrder = cTripOrderDetailRequest.getFlightOrder(); + public void cTripFlightRecordAutoSave(Optional date) { + + OrderFlightResponse flightOrder = date + .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getFlightOrderByDate(it))) + .orElseGet(() -> cTripOrderDetailRequest.getFlightOrder()); + List flightOrderAccountSettlementList = flightOrder .getFlightOrderAccountSettlementList(); if (flightOrderAccountSettlementList != null && !flightOrderAccountSettlementList.isEmpty()) { @@ -73,8 +81,12 @@ public class CTripOrderRecordAutoSave { } - public void cTripHotelRecordAutoSave() { - OrderHotelResponse hotelOrder = cTripOrderDetailRequest.getHotelOrder(); + public void cTripHotelRecordAutoSave(Optional date) { + + OrderHotelResponse hotelOrder = date + .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getHotelOrderByDate(it))) + .orElseGet(() -> cTripOrderDetailRequest.getHotelOrder()); + List lstHtlSettlement = hotelOrder.getLstHtlSettlement(); if (lstHtlSettlement != null && !lstHtlSettlement.isEmpty()) { List list = lstHtlSettlement.stream() @@ -106,8 +118,12 @@ public class CTripOrderRecordAutoSave { } - public void cTripTrainRecordAutoSave() { - OrderTrainResponse trainOrder = cTripOrderDetailRequest.getTrainOrder(); + public void cTripTrainRecordAutoSave(Optional date) { + + OrderTrainResponse trainOrder = date + .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getTrainOrderByDate(it))) + .orElseGet(() -> cTripOrderDetailRequest.getTrainOrder()); + List lstTrainSettlement = trainOrder.getLstTrainSettlement(); if (lstTrainSettlement != null && !lstTrainSettlement.isEmpty()) { List list = lstTrainSettlement.stream() @@ -133,8 +149,11 @@ public class CTripOrderRecordAutoSave { } } - public void cTripCarRecordAutoSave() { - OrderCarResponse carOrder = cTripOrderDetailRequest.getCarOrder(); + public void cTripCarRecordAutoSave(Optional date) { + OrderCarResponse carOrder = date + .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getCarOrderByDate(it))) + .orElseGet(() -> cTripOrderDetailRequest.getCarOrder()); + List settlementList = carOrder.getCarOrderAccountSettlementList(); if (settlementList != null && !settlementList.isEmpty()) { List list = settlementList.stream() From ca0c50bec5affa1cedc8ddd033c4c925ecdc65a0 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 09:57:53 +0800 Subject: [PATCH 13/33] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E6=8C=89=E6=9C=88=E8=8E=B7=E5=8F=96=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interfaces/rest/ctrip/order/CTripOrderDetailRequest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java index 7f5ae56f..c99d85ae 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/order/CTripOrderDetailRequest.java @@ -48,8 +48,6 @@ public class CTripOrderDetailRequest { private String carOrderUrl; - private DateTimeFormatter formatter = - @PostConstruct private void init() { this.flightOrderUrl = C_TRIP_BASE_URL + C_TRIP_ORDER_FLIGHT_PATH; From 8677651456d097b5eccf101494262ea22a1647e4 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 10:19:30 +0800 Subject: [PATCH 14/33] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E6=8C=89=E6=9C=88=E8=8E=B7=E5=8F=96=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/com/chint/CTripTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 2ee1855b..aadac166 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -618,8 +618,4 @@ public class CTripTest { } -// @Test - void saveFlightRecord(){ - cTripOrderRecordAutoSave.cTripFlightRecordAutoSave(); - } } From ff18fd425fe8eec7686ab66742950e4a74439de7 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 13:37:58 +0800 Subject: [PATCH 15/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=B4=A2=E5=8A=A1=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E5=8D=95=E5=8F=B7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderCarRecord.java | 10 +++- .../order/order_record/OrderFlightRecord.java | 25 ++++++--- .../order/order_record/OrderHotelRecord.java | 33 +++++++----- .../order/order_record/OrderTrainRecord.java | 2 +- .../ly_order_record/TripSubmitItemList.java | 1 + .../chint/domain/aggregates/user/User.java | 9 ++++ .../aggregates/user/UserDepartmentInfo.java | 3 ++ .../CTripOrderRecordExtensionFactory.java | 51 ++++++++++++++----- .../LyOrderRecordExtensionFactory.java | 4 +- 9 files changed, 100 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 19513612..c0df4fcf 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -70,7 +70,7 @@ public class OrderCarRecord extends OrderBaseRecord { private String offlineCcomyCode; // 成本中心 private String orderSource; // 预订来源:线上/线下 private String payAmount;//支付总金额 - + private String receiptsNumOrigin;//支付总金额 //添加行程信息 @@ -173,10 +173,17 @@ public class OrderCarRecord extends OrderBaseRecord { return this; } + public OrderCarRecord loadComplianceInfoNot() { + this.setOverStandard("否"); + this.setOverStandardReason(""); + return this; + } + // 加载关联订单信息 public OrderCarRecord loadRelatedOrderInfo(Long orderDetailId, String detailId, String receiptsNum, + String receiptsNumOrigin, String parentOrderNo, String originalOrderNo) { this.setOrderDetailId(orderDetailId); @@ -184,6 +191,7 @@ public class OrderCarRecord extends OrderBaseRecord { this.setReceiptsNum(receiptsNum); this.setParentOrderNo(parentOrderNo); this.setOriginalOrderNo(originalOrderNo); + this.setReceiptsNumOrigin(receiptsNumOrigin); return this; } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 872349fc..ab0360bb 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -78,6 +78,7 @@ public class OrderFlightRecord extends OrderBaseRecord { private String offlineCcomyCode; // 成本中心 private String orderStatus; private String createTime; + private String receiptsNumOrigin;//原差旅申请单单号 // 加载基础订单信息 public OrderFlightRecord loadBasicOrderInfo(String orderNo, @@ -127,9 +128,9 @@ public class OrderFlightRecord extends OrderBaseRecord { // 加载座位细节 public OrderFlightRecord loadSeatInfo(String seatPoint, - String seatPointName, + String seatPointName, - String seatDiscount) { + String seatDiscount) { this.setSeatDiscount(seatDiscount); this.setSeatPoint(seatPoint); this.setSeatPointName(seatPointName); @@ -210,16 +211,22 @@ public class OrderFlightRecord extends OrderBaseRecord { // 加载违规信息 public OrderFlightRecord loadComplianceInfo(OrderDetail orderDetail) { - orderDetail.getETAEvent().ifPresentOrElse(it->{ + orderDetail.getETAEvent().ifPresentOrElse(it -> { this.setOverStandard("是"); this.setOverStandardReason(it.getExtension()); - },()->{ + }, () -> { this.setOverStandard("否"); this.setOverStandardReason(""); }); return this; } + public OrderFlightRecord loadComplianceInfoNot() { + this.setOverStandard("否"); + this.setOverStandardReason(""); + return this; + } + // 加载未预订最低价原因 public OrderFlightRecord loadNotLowReason(String notLowReason) { @@ -229,15 +236,17 @@ public class OrderFlightRecord extends OrderBaseRecord { // 加载关联订单信息 public OrderFlightRecord loadRelatedOrderInfo(Long orderDetailId, - String detailId, - String receiptsNum, - String parentOrderNo, - String originalOrderNo) { + String detailId, + String receiptsNum, + String receiptsNumOrigin, + String parentOrderNo, + String originalOrderNo) { this.setOrderDetailId(orderDetailId); this.setDetailId(detailId); this.setReceiptsNum(receiptsNum); this.setParentOrderNo(parentOrderNo); this.setOriginalOrderNo(originalOrderNo); + this.setReceiptsNumOrigin(receiptsNumOrigin); return this; } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index 4e4c8113..f40ebcd6 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -8,6 +8,8 @@ import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; +import java.util.Optional; + @Data @Table("order_hotel_record") @NoArgsConstructor @@ -30,7 +32,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String originalOrderNo; // 原始订单号 private String brandGroup; // 酒店品牌集团 private String brandName; // 酒店品牌 - private int overStandard; // 是否违规(超标): 0否 1是 + private String overStandard; // 是否违规(超标): 0否 1是 private String overStandardReason; // 违规原因(超标原因) private String receiptsNum; // 关联申请单号 private String bookingName; // 预订人姓名 @@ -45,7 +47,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String hotelAddress; // 酒店地址 private String hotelName; // 酒店名称 private String includeAmount; // 含早情况:XX份 - private int isAgreement; // 是否协议酒店:0否1是 + private String isAgreement; // 是否协议酒店:0否1是 private int paymentType; // 付款方式: 0-公司统付 1-个人付 2-混付 private String orderAmount; // 订单总额 private String companyAmount; // 企业统付总额 @@ -76,7 +78,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String payAmount; // 支付总金额 private String orderStatus; private String createTime; - + private String receiptsNumOrigin;//支付总金额 // 加载基础订单信息 public OrderHotelRecord loadBasicOrderInfo(String orderNo, String orderStatus, @@ -141,10 +143,10 @@ public class OrderHotelRecord extends OrderBaseRecord { // 加载支付和服务费信息 public OrderHotelRecord loadPaymentInfo(Integer paymentType, - String unifiedPayAmt, - String personalPayAmt, - String companyAmount, - String personalAmount) { + String unifiedPayAmt, + String personalPayAmt, + String companyAmount, + String personalAmount) { this.setCompanyAmount(companyAmount); this.setPersonalAmount(personalAmount); this.setPaymentType(paymentType); @@ -168,12 +170,15 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载违规信息 - public OrderHotelRecord loadComplianceInfo(OrderDetail orderDetail) { - orderDetail.getETAEvent().ifPresentOrElse(it -> { - this.setOverStandard(1); - this.setOverStandardReason(it.getExtension()); + public OrderHotelRecord loadComplianceInfo(Optional orderDetail) { + orderDetail.ifPresentOrElse(it -> it.getETAEvent().ifPresentOrElse(orderEvent -> { + this.setOverStandard("是"); + this.setOverStandardReason(orderEvent.getExtension()); }, () -> { - this.setOverStandard(0); + this.setOverStandard("否"); + this.setOverStandardReason(""); + }), () -> { + this.setOverStandard("否"); this.setOverStandardReason(""); }); return this; @@ -193,6 +198,7 @@ public class OrderHotelRecord extends OrderBaseRecord { public OrderHotelRecord loadOrderNoInfo(Long orderDetailId, String detailId, String receiptsNum, + String receiptsNumOrigin, String parentOrderNo, String originalOrderNo) { this.setOrderDetailId(orderDetailId); @@ -200,12 +206,13 @@ public class OrderHotelRecord extends OrderBaseRecord { this.setReceiptsNum(receiptsNum); this.setParentOrderNo(parentOrderNo); this.setOriginalOrderNo(originalOrderNo); + this.setReceiptsNumOrigin(receiptsNumOrigin); return this; } // 加载房间和早餐信息 public OrderHotelRecord loadRoomAndBreakfastInfo(String includeAmount, - int isAgreement, + String isAgreement, int roomNightCount, int nightCount, String roomPrice, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index 3e68a3c7..51f1c664 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -71,7 +71,7 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String passportType; // 乘客证件类型 private String trainTime; // 发车时间 yyyy-MM-dd HH:‌mm:ss private String yxId; // 影像比对ID - + private String receiptsNumOrigin;//原差旅申请单单号 // 加载基础订单信息 public OrderTrainRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { this.setId(id); diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java index ac7f8234..2f4f451f 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java @@ -35,6 +35,7 @@ public class TripSubmitItemList implements Serializable { //父id private Integer lyRecordId; + private Integer lyRecordKey; //编码 private String code; diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index a99fead0..2f6f8f50 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -6,6 +6,7 @@ import com.chint.domain.aggregates.system.FsscSystem; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.constant.AuthMessageConstant; import com.chint.interfaces.rest.base.PostRequest; +import com.chint.interfaces.rest.user.PushUser; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.AllArgsConstructor; @@ -71,6 +72,7 @@ public class User implements Serializable { this.employeeNo = employeeNo; } + // public User addDeptInfo(){ // // } @@ -106,6 +108,8 @@ public class User implements Serializable { this.companyCode = companyCode; } + + public User addFssc(String CompanyName, String sysCode) { FsscSystem fsscSystem = new FsscSystem(CompanyName, sysCode); this.addFsscSystemToList(fsscSystem); @@ -184,4 +188,9 @@ public class User implements Serializable { public String generateXNFsscUrlPath() { return XN_FSSC_REDIRECT_PATH_APPROVAL_ONE + employeeNo + FSSC_REDIRECT_PATH_APPROVAL_TWO; } + +// public User startAddDept(){ +// +// +// } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java index 34a47136..138a3c24 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -33,4 +33,7 @@ public class UserDepartmentInfo implements Serializable { private String departmentCodeSeven; private String departmentNameSeven; private Integer ifPrimary; + + // Builder static inner class + } 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 d0582cd9..5b8fc581 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 @@ -146,29 +146,47 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } // 加载超标信息, 加载订单关联信息 , 加载订单状态 ,单号,创建时间等信息 + // 当测试环境没有行程规划单 , 只能去回传的差旅申请单 + String orderNo = getOrderNoForCTrip(cTripCarRecord.getRouteOrderNo()); orderDetail.ifPresentOrElse(it -> { CarOrderDetail carOrderDetail = it.getCarOrderDetail(); orderCarRecord.loadComplianceInfo(it) .loadRelatedOrderInfo(it.getOrderId(), cTripCarRecord.getRecordId(), + byOrderNo.isPresent() ? byOrderNo.get().getApproveOrderNo().getActualOrderNo() : orderNo, //兼容测试环境和正式环境的数据 carOrderDetail.getReceiptsNum(), carOrderDetail.getParentOrderNo(), carOrderDetail.getOriginalOrderNo()) .loadBasicOrderInfo(carOrderDetail.getOrderNo(), carOrderDetail.getOrderStatus(), carOrderDetail.getCreateTime()); - }, () -> orderCarRecord.loadRelatedOrderInfo(cTripCarRecordBase.getOrderId(), + }, () -> orderCarRecord.loadComplianceInfoNot() + .loadRelatedOrderInfo(cTripCarRecordBase.getOrderId(), cTripCarRecord.getRecordId(), + orderNo, cTripCarRecord.getRouteOrderNo(), String.valueOf(cTripCarRecordBase.getOrderId()), String.valueOf(cTripCarRecordBase.getOrderId())) - .loadBasicOrderInfo( String.valueOf(cTripCarRecordBase.getOrderId()), + .loadBasicOrderInfo(String.valueOf(cTripCarRecordBase.getOrderId()), "", cTripCarRecordBase.getCreateTime())); return orderCarRecord; } + + private String getOrderNoForCTrip(String inputOrderNo) { + // 当测试环境没有行程规划单 , 只能去回传的差旅申请单 + String orderNo; + if (inputOrderNo.contains("-")) { + String[] split = inputOrderNo.split("-"); + orderNo = split[1]; + } else { + orderNo = inputOrderNo; + } + return orderNo; + } + @Override public OrderTrainRecord createTrainOrderRecord(Object orderTrainRecordData) { @@ -288,6 +306,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripFlightBaseInfo.getDept3()); // 加载关联票价原因 + String orderNo = getOrderNoForCTrip(cTripFlightRecord.getRouteOrderNo()); orderDetail.ifPresentOrElse(it -> { FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); orderFlightRecord.loadComplianceInfo(it) @@ -296,11 +315,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripFlightRecordBase.getCreateTime()) .loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), String.valueOf(cTripFlightRecordBase.getRecordId()), + byOrderNo.isPresent() ? byOrderNo.get().getApproveOrderNo().getActualOrderNo() : orderNo, //兼容测试环境和正式环境的数据 flightOrderDetail.getReceiptsNum(), flightOrderDetail.getParentOrderNo(), it.getOrderNo()); - }, () -> orderFlightRecord.loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), //兼容测试环境没有申请单的情况 + }, () -> orderFlightRecord.loadComplianceInfoNot() + .loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), //兼容测试环境没有申请单的情况 String.valueOf(cTripFlightRecordBase.getRecordId()), + orderNo, cTripFlightBaseInfo.getJourneyID(), String.valueOf(cTripFlightRecordBase.getOrderId()), String.valueOf(cTripFlightRecordBase.getOrderId())) @@ -372,12 +394,12 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载房间和早餐信息 , 含早分数先为空 String isAgreement; if (cTripHotelRecordBase.getOrderType().equals(4) || cTripHotelRecordBase.getOrderType().equals(6)) { - isAgreement = "1"; + isAgreement = "是"; } else { - isAgreement = "0"; + isAgreement = "否"; } orderHotelRecord.loadRoomAndBreakfastInfo("", - Integer.parseInt(isAgreement), + isAgreement, cTripHotelRecordBase.getQuantity(), cTripHotelRecordBase.getQuantity(), String.valueOf(cTripHotelRecordBase.getPrice()), @@ -410,20 +432,23 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } orderHotelRecord.loadSourceInfo(sourceInfo); - + String orderNo = getOrderNoForCTrip(cTripHotelRecord.getRouteOrderNo()); orderDetailOptional.ifPresentOrElse(it -> { - orderHotelRecord.loadComplianceInfo(it); // 加载违规信息 + orderHotelRecord.loadComplianceInfo(Optional.of(it)); // 加载违规信息 HotelOrderDetail hotelOrderDetail = it.getHotelOrderDetail(); orderHotelRecord.loadOrderNoInfo(it.getOrderId(), // 加载订单关联号信息 cTripHotelRecord.getRecordId(), + byOrderNo.isPresent() ? byOrderNo.get().getApproveOrderNo().getActualOrderNo() : orderNo, //兼容测试环境和正式环境的数据 hotelOrderDetail.getReceiptsNum(), hotelOrderDetail.getOrderNo(), hotelOrderDetail.getOrderNo()); orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 hotelOrderDetail.getOrderStatus(), cTripHotelRecordBase.getCreateTime()); - }, () -> orderHotelRecord.loadOrderNoInfo(cTripHotelRecordBase.getOrderId(), //兼容测试环境不存在行程规划单的情况 // 加载订单关联号信息 + }, () -> orderHotelRecord.loadComplianceInfo(Optional.empty()) + .loadOrderNoInfo(cTripHotelRecordBase.getOrderId(), //兼容测试环境不存在行程规划单的情况 // 加载订单关联号信息 cTripHotelRecord.getRecordId(), + orderNo, cTripHotelRecord.getRouteOrderNo(), String.valueOf(cTripHotelRecordBase.getOrderId()), String.valueOf(cTripHotelRecordBase.getOrderId())) @@ -432,8 +457,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelRecordBase.getCreateTime())); // 加载财务信息 - orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getSubAccCheckBatchNo(), - cTripHotelRecordBase.getBatchStartDate().substring(0, 6), + orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getBatchStartDate().substring(0, 6), + cTripHotelRecordBase.getSubAccCheckBatchNo(), String.valueOf(cTripHotelRecordBase.getAmount()), "", cTripHotelRecordBase.getPaidAmount()); @@ -459,8 +484,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载预订人和入住人信息 orderHotelRecord.loadBookerAndGuestInfo(cTripHotelOrderDetail.getEmployeeID(), cTripHotelOrderDetail.getEmployeeName(), - cTripHotelOrderDetail.getEmployeeID(), - cTripHotelOrderDetail.getEmployeeName()); + cTripHotelOrderDetail.getEmployeeName(), + cTripHotelOrderDetail.getEmployeeID()); // 加载组织架构 orderHotelRecord.loadOrganizationalAndProjectInfo(cTripHotelOrderDetail.getDept1(), diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index 9f2f5ff7..a3d0f1cd 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -168,7 +168,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setOriginalOrderNo(lyOrderHotelRecord.getOriginOrderSerialNo())//原始订单号 .setBrandGroup("") //酒店品牌集团 .setBrandName("") //酒店品牌 - .setOverStandard("是".equals(lyOrderHotelRecord.getOverStandardStatus()) ? 1 : 0) //"是否违规(超标) 0否,1是" + .setOverStandard("是".equals(lyOrderHotelRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标) 0否,1是" .setOverStandardReason(lyOrderHotelRecord.getViolationReason()) //违规原因(超标原因) .setReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo()) //关联申请单号 .setUserName(lyOrderHotelRecord.getPassengerName()) //入住人姓名 @@ -181,7 +181,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址 .setHotelName(lyOrderHotelRecord.getHotelName()) //酒店名称 .setIncludeAmount("") //含早情况:XX份 - .setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? 1 : 0) //是否协议酒店:0否1是 + .setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店:0否1是 .setPaymentType(getPaymentType(lyOrderHotelRecord.getPayType()))//"付款方式:0-公司统付 1-个人付 2-混付" .setOrderAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //结算总额 .setCompanyAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //企业统付总额 From 040dbacfa2054563a763ee0ad667b7e0ca744a04 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 14:19:32 +0800 Subject: [PATCH 16/33] =?UTF-8?q?=E6=9C=BA=E7=A5=A8=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=80=BB=E4=BB=98=E6=AC=BE=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aggregates/order/order_record/OrderFlightRecord.java | 4 +++- .../order_record/CTripOrderRecordExtensionFactory.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index ab0360bb..795e137c 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -79,6 +79,7 @@ public class OrderFlightRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//原差旅申请单单号 + private String payAmount; // 加载基础订单信息 public OrderFlightRecord loadBasicOrderInfo(String orderNo, @@ -153,13 +154,14 @@ public class OrderFlightRecord extends OrderBaseRecord { public OrderFlightRecord loadFinancialAndPricingInfo(String accountPeriod, String billNo, String orderAmount, - + String payAmount, String ycabinFullPrice, String policyLowestPrice, String flightLowestPrice) { this.setAccountPeriod(accountPeriod); this.setBillNo(billNo); this.setOrderAmount(orderAmount); + this.setPayAmount(payAmount); this.setYcabinFullPrice(ycabinFullPrice); //经济舱全价 this.setPolicyLowestPrice(policyLowestPrice); // 比价范围最低价 this.setFlightLowestPrice(flightLowestPrice); // 航班最低价 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 5b8fc581..06fe0202 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 @@ -269,7 +269,8 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6); orderFlightRecord.loadFinancialAndPricingInfo(batchNo, cTripFlightRecordBase.getSubAccCheckBatchNo(), - String.valueOf(cTripFlightRecordBase.getPrice()), + String.valueOf(cTripFlightRecordBase.getAmount()), + String.valueOf(cTripFlightRecordBase.getRealAmountWithPostServiceFee()), String.valueOf(cTripFlightInfo.getEClassStandardPrice()), String.valueOf(cTripFlightInfo.getLowPrice()), String.valueOf(cTripFlightInfo.getLowPrice())); @@ -285,7 +286,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderFlightRecord.loadExtraFeeInfo(String.valueOf(cTripFlightRecordBase.getPostServiceFee()), String.valueOf(cTripFlightRecordBase.getRebookQueryFee()), String.valueOf(cTripFlightRecordBase.getRefund()), - String.valueOf(cTripFlightRecordBase.getAmount()), + cTripFlightRecordBase.getOrderDetailType().equals("改签") ? String.valueOf(cTripFlightRecordBase.getAmount()) : KEEP_TWO_DECIMAL_ZERO, String.valueOf(cTripFlightRecordBase.getSettItineraryFee())); // 加载来源 From 5bb2c31ddc182ed72ab2faea29dfe0699958b621 Mon Sep 17 00:00:00 2001 From: dengwc Date: Tue, 2 Apr 2024 14:57:44 +0800 Subject: [PATCH 17/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LYOrderRecordGenerateCommand.java | 12 + .../application/in/AutoWorkController.java | 3 +- .../ly_order_record/LyOrderCarRecord.java | 2 +- .../ly_order_record/LyOrderFlightRecord.java | 2 +- .../ly_order_record/LyOrderHotelRecord.java | 2 +- .../ly_order_record/LyOrderTrainRecord.java | 2 +- .../TripSubmitItemCarList.java | 45 ++++ .../TripSubmitItemFlightList.java | 46 ++++ .../TripSubmitItemHotelList.java | 45 ++++ .../ly_order_record/TripSubmitItemList.java | 23 +- .../TripSubmitItemTrainList.java | 45 ++++ .../LyOrderRecordExtensionFactory.java | 230 ++++++++++++++++-- .../LYOrderRecordDomainService.java | 24 +- .../constant/OrderRecordConstant.java | 14 ++ .../dto/DetailResponse/CarStatement.java | 4 +- .../dto/DetailResponse/FlightStatement.java | 4 +- .../dto/DetailResponse/HotelStatement.java | 5 +- .../dto/DetailResponse/TrainStatement.java | 5 +- 18 files changed, 453 insertions(+), 60 deletions(-) create mode 100644 src/main/java/com/chint/application/commands/LYOrderRecordGenerateCommand.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemCarList.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemFlightList.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemHotelList.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemTrainList.java create mode 100644 src/main/java/com/chint/infrastructure/constant/OrderRecordConstant.java diff --git a/src/main/java/com/chint/application/commands/LYOrderRecordGenerateCommand.java b/src/main/java/com/chint/application/commands/LYOrderRecordGenerateCommand.java new file mode 100644 index 00000000..beaf49e7 --- /dev/null +++ b/src/main/java/com/chint/application/commands/LYOrderRecordGenerateCommand.java @@ -0,0 +1,12 @@ +package com.chint.application.commands; + +import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; + + + +//将上月的结算数据生成为财务共享需要的数据 +@Data +public class LYOrderRecordGenerateCommand extends Command { + +} diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index 26a9da28..f67aa207 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -1,6 +1,7 @@ package com.chint.application.in; +import com.chint.application.commands.LYOrderRecordGenerateCommand; import com.chint.application.dtos.CTripRecordMonthSaveDTO; import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.infrastructure.echo_framework.command.Command; @@ -69,7 +70,7 @@ public class AutoWorkController { //同步拉取上月数据 lyStatementOrder.saveAll(); //将上月的结算数据生成为财务共享需要的数据 - Command.of(OrderRecordGenerateCommand.class).sendToQueue(); + Command.of(LYOrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java index 398dc579..5d79ca87 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderCarRecord.java @@ -52,7 +52,7 @@ public class LyOrderCarRecord implements Serializable { private String subjectRemark; @MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key") - private List tripSubmitItemList; + private List tripSubmitItemList; //出行人职级 private String passengerPositionLevelName; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java index 026901ce..88d09c13 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderFlightRecord.java @@ -92,7 +92,7 @@ public class LyOrderFlightRecord implements Serializable { private String overStandardStatus; @MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key") - private List tripSubmitItemList; + private List tripSubmitItemList; //出行人职级 private String passengerPositionLevelName; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java index 6897503c..d5635153 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderHotelRecord.java @@ -64,7 +64,7 @@ public class LyOrderHotelRecord implements Serializable { private String overStandardStatus; @MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key") - private List tripSubmitItemList; + private List tripSubmitItemList; //出行人职级 private String passengerPositionLevelName; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java index f266be19..ce4eb780 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/LyOrderTrainRecord.java @@ -58,7 +58,7 @@ public class LyOrderTrainRecord implements Serializable { private String overStandardStatus; @MappedCollection(idColumn = "ly_record_id", keyColumn = "ly_record_key") - private List tripSubmitItemList; + private List tripSubmitItemList; //出行人职级 private String passengerPositionLevelName; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemCarList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemCarList.java new file mode 100644 index 00000000..57ebfd94 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemCarList.java @@ -0,0 +1,45 @@ +package com.chint.domain.aggregates.order.order_record.ly_order_record; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 行程提交项目(TripSubmitItem)表实体类 + * + * @author dengweichao + * @since 2024-03-27 10:17:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Table("trip_submit_item_car_list") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TripSubmitItemCarList implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Id + private Integer id; + + //父id + private Integer lyRecordId; + + private Integer lyRecordKey; + //编码 + private String code; + //名称 + private String name; + //内容 + private String content; + +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemFlightList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemFlightList.java new file mode 100644 index 00000000..067a050d --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemFlightList.java @@ -0,0 +1,46 @@ +package com.chint.domain.aggregates.order.order_record.ly_order_record; + + +import java.io.Serial; +import java.io.Serializable; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +/** + * 行程提交项目(TripSubmitItem)表实体类 + * + * @author dengweichao + * @since 2024-03-27 10:17:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Table("trip_submit_item_flight_list") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TripSubmitItemFlightList implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Id + private Integer id; + + //父id + private Integer lyRecordId; + + private Integer lyRecordKey; + //编码 + private String code; + //名称 + private String name; + //内容 + private String content; + +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemHotelList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemHotelList.java new file mode 100644 index 00000000..a7e9d896 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemHotelList.java @@ -0,0 +1,45 @@ +package com.chint.domain.aggregates.order.order_record.ly_order_record; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 行程提交项目(TripSubmitItem)表实体类 + * + * @author dengweichao + * @since 2024-03-27 10:17:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Table("trip_submit_item_hotel_list") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TripSubmitItemHotelList implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Id + private Integer id; + + //父id + private Integer lyRecordId; + + private Integer lyRecordKey; + //编码 + private String code; + //名称 + private String name; + //内容 + private String content; + +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java index 2f4f451f..9c7f87e4 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemList.java @@ -1,19 +1,18 @@ package com.chint.domain.aggregates.order.order_record.ly_order_record; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + import java.io.Serial; import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import com.fasterxml.jackson.annotation.JsonInclude; -import org.springframework.data.annotation.Id; -import org.springframework.data.relational.core.mapping.Table; - /** - * 行程提交项目(TripSubmitItem)表实体类 + * 行程提交项目 * * @author dengweichao * @since 2024-03-27 10:17:58 @@ -21,15 +20,9 @@ import org.springframework.data.relational.core.mapping.Table; @Data @AllArgsConstructor @NoArgsConstructor -@Table("trip_submit_item_list") @JsonInclude(JsonInclude.Include.NON_NULL) public class TripSubmitItemList implements Serializable { - @Serial - private static final long serialVersionUID = 1L; - - - @Id private Integer id; //父id diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemTrainList.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemTrainList.java new file mode 100644 index 00000000..108617fc --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ly_order_record/TripSubmitItemTrainList.java @@ -0,0 +1,45 @@ +package com.chint.domain.aggregates.order.order_record.ly_order_record; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 行程提交项目(TripSubmitItem)表实体类 + * + * @author dengweichao + * @since 2024-03-27 10:17:58 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Table("trip_submit_item_train_list") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TripSubmitItemTrainList implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + + @Id + private Integer id; + + //父id + private Integer lyRecordId; + + private Integer lyRecordKey; + //编码 + private String code; + //名称 + private String name; + //内容 + private String content; + +} diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index a3d0f1cd..fdda0234 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -5,14 +5,10 @@ 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.ly_order_record.LyOrderCarRecord; -import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; -import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord; -import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord; -import com.chint.domain.repository.UserRepository; -import com.chint.domain.service.OrderDetailDomainService; +import com.chint.domain.aggregates.order.order_record.ly_order_record.*; import com.chint.infrastructure.repository.jdbc.*; import com.chint.infrastructure.util.BeanCopyUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -20,9 +16,13 @@ import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; +import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_LY; +import static com.chint.infrastructure.constant.OrderRecordConstant.*; + /** * 同程数据转换 */ @@ -83,13 +83,15 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createFlightOrder(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) { String orderSerialNo = lyOrderFlightRecord.getOrderSerialNo();//订单号 AtomicReference orderDetailRef = new AtomicReference<>(); - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); + AtomicReference routeOrderRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set); BeanUtils.copyProperties(orderRecordBasic, orderFlightRecord); OrderDetail orderDetail = orderDetailRef.get();//获取订单明细 + RouteOrder routeOrder = routeOrderRef.get();//获取财务共享订单 FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail() == null ? new FlightOrderDetail() : orderDetail.getFlightOrderDetail();//机票订单明细 + orderFlightRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId()); //公共字段校验 - - + flightFieldCheck(orderFlightRecord, lyOrderFlightRecord); orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员 .setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号 @@ -101,8 +103,9 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor //行程单号 List byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo); String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo(); - orderFlightRecord.setScheduleNum(travelNo)//行程单号 - .setReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo())//关联申请单号 + orderFlightRecord.setScheduleNum(travelNo);//行程单号 + orderFlightRecord.setReceiptsNum(getReceiptsNum(lyOrderFlightRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 + .setReceiptsNumOrigin(lyOrderFlightRecord.getOutApplayOrderNo())//原关联申请单号 .setUserName(lyOrderFlightRecord.getPassengerName())//出行人姓名 .setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码 .setOverStandard("是".equals(lyOrderFlightRecord.getOverStandardStatus()) ? "1" : "0")//"是否违规(超标):0否 ,1是" @@ -152,13 +155,19 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor ; } + private void createHotelOrder(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) { String orderSerialNo = lyOrderHotelRecord.getOrderSerialNo();//订单号 AtomicReference orderDetailRef = new AtomicReference<>(); - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); + AtomicReference routeOrderRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set); BeanUtils.copyProperties(orderRecordBasic, orderHotelRecord); OrderDetail orderDetail = orderDetailRef.get();//订单明细 + RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据 HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail() == null ? new HotelOrderDetail() : orderDetail.getHotelOrderDetail();//酒店订单明细 + orderHotelRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id + //公共字段校验 + hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord); orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号 @@ -169,8 +178,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBrandGroup("") //酒店品牌集团 .setBrandName("") //酒店品牌 .setOverStandard("是".equals(lyOrderHotelRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标) 0否,1是" - .setOverStandardReason(lyOrderHotelRecord.getViolationReason()) //违规原因(超标原因) - .setReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo()) //关联申请单号 + .setOverStandardReason(lyOrderHotelRecord.getViolationReason());//违规原因(超标原因) + + orderHotelRecord.setReceiptsNum(getReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 + .setReceiptsNumOrigin(lyOrderHotelRecord.getOutApplayOrderNo()) //原关联申请单号 .setUserName(lyOrderHotelRecord.getPassengerName()) //入住人姓名 .setUserCode(lyOrderHotelRecord.getPassengerNo()) //入住人编码 .setCheckInCity(lyOrderHotelRecord.getCityName()) //入住城市 @@ -189,7 +200,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费 .setPersonalPayAmt("") //个人服务费 .setProvince("") //省份 - .setRoomCount(Integer.parseInt(hotelOrderDetail.getRoomCount())) //房间数 + .setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数 .setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数 .setNightCount(lyOrderHotelRecord.getHotelNights()) //间夜数 .setRoomPrice("") //房价(房间单价不包含服务费) @@ -219,18 +230,24 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) { String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号 AtomicReference orderDetailRef = new AtomicReference<>(); - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); + AtomicReference routeOrderRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set); BeanUtils.copyProperties(orderRecordBasic, orderTrainRecord); OrderDetail orderDetail = orderDetailRef.get();//订单明细 + RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据 TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail() == null ? new TrainOrderDetail() : orderDetail.getTrainOrderDetail();//火车订单明细 + orderTrainRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id + //公共字段校验 + trainFieldCheck(orderTrainRecord, lyOrderTrainRecord); orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号 .setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号 .setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号 .setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号 - .setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo()) //原始订单号 - .setReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo()) //关联申请单号 + .setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo());//原始订单号 + orderTrainRecord.setReceiptsNum(getReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 + .setReceiptsNumOrigin(lyOrderTrainRecord.getOutApplayOrderNo()) //原关联申请单号 .setStartDate(lyOrderTrainRecord.getPlanBeginDate()) //出发日期 .setArriveDate(lyOrderTrainRecord.getPlanEndDate()) //到达日期 .setOverStandard("是".equals(lyOrderTrainRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标):0否 1是" @@ -283,15 +300,21 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) { String orderSerialNo = lyOrderCarRecord.getOrderSerialNo();//订单号 AtomicReference orderDetailRef = new AtomicReference<>(); - OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set); + AtomicReference routeOrderRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic(orderSerialNo, orderDetailRef::set, routeOrderRef::set); BeanUtils.copyProperties(orderRecordBasic, orderCarRecord); OrderDetail orderDetail = orderDetailRef.get();//订单明细 + RouteOrder routeOrder = routeOrderRef.get();//财务共享订单数据 CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail() == null ? new CarOrderDetail() : orderDetail.getCarOrderDetail();//用车订单明细 + orderCarRecord.setOrderDetailId(orderDetail.getOrderId() == null ? -1L : orderDetail.getOrderId());//订单明细id + //公共字段校验 + carFieldCheck(orderCarRecord, lyOrderCarRecord); orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员 .setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号 - .setBillNo(lyOrderCarRecord.getBillOrderNo()) //账单号 - .setReceiptsNum(lyOrderCarRecord.getOrderSerialNo()) //关联申请单号 + .setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号 + orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 + .setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号 .setOverStandard("0") //"是否违规(超标):0否 1是" .setOverStandardReason("无")//违规原因(超标原因) .setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号 @@ -334,20 +357,181 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } //获取公共对象 - public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer consumer) { + public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer consumerOrderDetail, Consumer consumerRouteOrder) { OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo); - consumer.accept(orderDetail == null ? new OrderDetail() : orderDetail);//设置订单明细数据 + consumerOrderDetail.accept(orderDetail == null ? new OrderDetail() : orderDetail);//设置订单明细数据 if (Objects.isNull(orderDetail)) { + consumerRouteOrder.accept(new RouteOrder()); return new OrderRecordBasic(); } Long routeId = orderDetail.getRouteId(); RouteOrder routeOrder = jdbcRouteRepository.findByRouteId(routeId); + consumerRouteOrder.accept(routeOrder == null ? new RouteOrder() : routeOrder); if (Objects.isNull(routeOrder)) { return new OrderRecordBasic(); } return orderRecordFactory.buildWithRouteOrder(routeOrder); } + public void flightFieldCheck(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) { + orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程 + .setBookingName(lyOrderFlightRecord.getReserveManName()) //预订人姓名 + .setBookingUserCode(lyOrderFlightRecord.getReserveManNo()); //预订人编码 + List tripSubmitItemFlightList = lyOrderFlightRecord.getTripSubmitItemList(); + List tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemFlightList, TripSubmitItemList.class); + if (StringUtils.isBlank(orderFlightRecord.getBelongSysType())) { + String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderFlightRecord.getOutApplayOrderNo()); + orderFlightRecord.setBelongSysType(belongSysType);//对应所属系统 + } + if (StringUtils.isBlank(orderFlightRecord.getAccountCompanyId())) { + findAccountCompanyId(tripSubmitItemList).ifPresent(orderFlightRecord::setAccountCompanyId);//核算企业code + } + if (StringUtils.isBlank(orderFlightRecord.getAccountCompanyName())) { + findAccountCompanyName(tripSubmitItemList).ifPresent(orderFlightRecord::setAccountCompanyName);//核算企业名称 + + } + if (StringUtils.isBlank(orderFlightRecord.getProjectOrderNo())) { + findProjectOrderNo(tripSubmitItemList).ifPresent(orderFlightRecord::setProjectOrderNo);//项目订单号 + } + + } + + public void hotelFieldCheck(OrderHotelRecord orderHotelRecord, LyOrderHotelRecord lyOrderHotelRecord) { + orderHotelRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程 + .setBookingName(lyOrderHotelRecord.getReserveManName()) //预订人姓名 + .setBookingUserCode(lyOrderHotelRecord.getReserveManNo()); //预订人编码 + List tripSubmitItemHotelList = lyOrderHotelRecord.getTripSubmitItemList(); + List tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemHotelList, TripSubmitItemList.class); + if (StringUtils.isBlank(orderHotelRecord.getBelongSysType())) { + String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderHotelRecord.getOutApplayOrderNo()); + orderHotelRecord.setBelongSysType(belongSysType);//对应所属系统 + } + if (StringUtils.isBlank(orderHotelRecord.getAccountCompanyId())) { + findAccountCompanyId(tripSubmitItemList).ifPresent(orderHotelRecord::setAccountCompanyId);//核算企业code + } + if (StringUtils.isBlank(orderHotelRecord.getAccountCompanyName())) { + findAccountCompanyName(tripSubmitItemList).ifPresent(orderHotelRecord::setAccountCompanyName);//核算企业名称 + + } + if (StringUtils.isBlank(orderHotelRecord.getProjectOrderNo())) { + findProjectOrderNo(tripSubmitItemList).ifPresent(orderHotelRecord::setProjectOrderNo);//项目订单号 + } + + } + + public void trainFieldCheck(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) { + orderTrainRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程 + .setBookingName(lyOrderTrainRecord.getReserveManName()) //预订人姓名 + .setBookingUserCode(lyOrderTrainRecord.getReserveManNo()); //预订人编码 + List tripSubmitItemTrainList = lyOrderTrainRecord.getTripSubmitItemList(); + List tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemTrainList, TripSubmitItemList.class); + if (StringUtils.isBlank(orderTrainRecord.getBelongSysType())) { + String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderTrainRecord.getOutApplayOrderNo()); + orderTrainRecord.setBelongSysType(belongSysType);//对应所属系统 + } + if (StringUtils.isBlank(orderTrainRecord.getAccountCompanyId())) { + findAccountCompanyId(tripSubmitItemList).ifPresent(orderTrainRecord::setAccountCompanyId);//核算企业code + } + if (StringUtils.isBlank(orderTrainRecord.getAccountCompanyName())) { + findAccountCompanyName(tripSubmitItemList).ifPresent(orderTrainRecord::setAccountCompanyName);//核算企业名称 + + } + if (StringUtils.isBlank(orderTrainRecord.getProjectOrderNo())) { + findProjectOrderNo(tripSubmitItemList).ifPresent(orderTrainRecord::setProjectOrderNo);//项目订单号 + } + + } + + public void carFieldCheck(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) { + orderCarRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程 + .setBookingName(lyOrderCarRecord.getReserveManName()) //预订人姓名 + .setBookingUserCode(lyOrderCarRecord.getReserveManNo()); //预订人编码 + List tripSubmitItemCarList = lyOrderCarRecord.getTripSubmitItemList(); + List tripSubmitItemList = BeanCopyUtils.copyBeanList(tripSubmitItemCarList, TripSubmitItemList.class); + if (StringUtils.isBlank(orderCarRecord.getBelongSysType())) { + String belongSysType = findBelongSysType(tripSubmitItemList, lyOrderCarRecord.getOutApplayOrderNo()); + orderCarRecord.setBelongSysType(belongSysType);//对应所属系统 + } + if (StringUtils.isBlank(orderCarRecord.getAccountCompanyId())) { + findAccountCompanyId(tripSubmitItemList).ifPresent(orderCarRecord::setAccountCompanyId);//核算企业code + } + if (StringUtils.isBlank(orderCarRecord.getAccountCompanyName())) { + findAccountCompanyName(tripSubmitItemList).ifPresent(orderCarRecord::setAccountCompanyName);//核算企业名称 + + } + if (StringUtils.isBlank(orderCarRecord.getProjectOrderNo())) { + findProjectOrderNo(tripSubmitItemList).ifPresent(orderCarRecord::setProjectOrderNo);//项目订单号 + } + + } + + //对应所属系统 + private static String findBelongSysType(List itemList, String outApplayOrderNo) { + return itemList.stream() + .filter(item -> LY_CUSTOM1.equals(item.getCode())) + .findFirst() + .map(TripSubmitItemList::getContent) + .orElseGet(() -> Optional.ofNullable(outApplayOrderNo) + .map(no -> no.split("-")[0]) + .orElse("")); + } + + //核算企业code + private static Optional findAccountCompanyId(List tripSubmitItemList) { + return tripSubmitItemList.stream() + .filter(item -> LY_CUSTOM2.equals(item.getCode())) + .findFirst() + .map(TripSubmitItemList::getContent); + } + + ////核算企业名称 + private static Optional findAccountCompanyName(List tripSubmitItemList) { + return tripSubmitItemList.stream() + .filter(item -> LY_CUSTOM3.equals(item.getCode())) + .findFirst() + .map(TripSubmitItemList::getContent); + } + + //项目订单号 + private static Optional findProjectOrderNo(List tripSubmitItemList) { + return tripSubmitItemList.stream() + .filter(item -> LY_CUSTOM4.equals(item.getCode())) + .findFirst() + .map(TripSubmitItemList::getContent); + } + + + private void flightReceiptsNum(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord, RouteOrder routeOrder) { + ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); + String outApplayOrderNo = lyOrderFlightRecord.getOutApplayOrderNo(); + String receiptsNum = ""; + if (Objects.isNull(approveOrderNo) && StringUtils.isNotBlank(outApplayOrderNo)) { + String[] receiptsNums = outApplayOrderNo.split("-"); + if (receiptsNums.length > 1) { + receiptsNum = receiptsNums[1]; + } + } else { + receiptsNum = approveOrderNo.getActualOrderNo(); + } + orderFlightRecord.setReceiptsNum(receiptsNum); + } + + //获取财务共享单号 + private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) { + ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); + if (Objects.isNull(approveOrderNo)) { + if (StringUtils.isNotBlank(outApplayOrderNo)) { + String[] receiptsNums = outApplayOrderNo.split("-"); + if (receiptsNums.length > 1) { + return receiptsNums[1]; + } + } + return ""; + } + return approveOrderNo.getActualOrderNo(); + } + + //映射付款方式 //支付类型(1:企业授信 / 2:个人支付 / 3:组合支付) public int getPaymentType(String payType) { diff --git a/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java b/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java index 1089a02f..df93f4db 100644 --- a/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/order_record/LYOrderRecordDomainService.java @@ -1,5 +1,6 @@ package com.chint.domain.service.order_record; +import com.chint.application.commands.LYOrderRecordGenerateCommand; import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; @@ -12,6 +13,7 @@ import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTra import com.chint.domain.factoriy.order_record.CTripOrderRecordExtensionFactory; import com.chint.domain.factoriy.order_record.LyOrderRecordExtensionFactory; import com.chint.domain.service.OrderDetailDomainService; +import com.chint.infrastructure.echo_framework.annotation.ListenTo; import com.chint.infrastructure.repository.jdbc.*; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; @@ -25,7 +27,7 @@ import java.util.ArrayList; import java.util.List; @Component -public class LYOrderRecordDomainService implements OrderRecordDomainService { +public class LYOrderRecordDomainService { @Autowired private JdbcLyOrderFlightRecord jdbcLyOrderFlightRecord; @@ -46,9 +48,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService { @Autowired private OrderDetailDomainService orderDetailDomainService; - @Override + @Transactional - public List generateFlightRecord(OrderRecordGenerateCommand command) { + @ListenTo(command = "LYOrderRecordGenerateCommand", order = 0) + public List generateFlightRecord(LYOrderRecordGenerateCommand command) { ArrayList orderFlightRecordList = new ArrayList<>(); int count = 0;//初始化变量 int pageSize = 100; // 假设每页大小为10 @@ -75,9 +78,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService { return orderFlightRecordList; } - @Override + @Transactional - public List generateHotelRecord(OrderRecordGenerateCommand command) { + @ListenTo(command = "LYOrderRecordGenerateCommand", order = 1) + public List generateHotelRecord(LYOrderRecordGenerateCommand command) { ArrayList orderHotelRecordList = new ArrayList<>(); int count = 0;//初始化变量 int pageSize = 100; // 假设每页大小为10 @@ -104,9 +108,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService { return orderHotelRecordList; } - @Override + @Transactional - public List generateTrainRecord(OrderRecordGenerateCommand command) { + @ListenTo(command = "LYOrderRecordGenerateCommand", order = 2) + public List generateTrainRecord(LYOrderRecordGenerateCommand command) { ArrayList orderTrainRecordsList = new ArrayList<>(); int count = 0;//初始化变量 int pageSize = 100; // 假设每页大小为10 @@ -134,9 +139,10 @@ public class LYOrderRecordDomainService implements OrderRecordDomainService { } - @Override + @Transactional - public List generateCarRecord(OrderRecordGenerateCommand command) { + @ListenTo(command = "LYOrderRecordGenerateCommand", order = 3) + public List generateCarRecord(LYOrderRecordGenerateCommand command) { ArrayList orderCarRecordsList = new ArrayList<>(); int count = 0;//初始化变量 int pageSize = 100; // 假设每页大小为10 diff --git a/src/main/java/com/chint/infrastructure/constant/OrderRecordConstant.java b/src/main/java/com/chint/infrastructure/constant/OrderRecordConstant.java new file mode 100644 index 00000000..38c40762 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/constant/OrderRecordConstant.java @@ -0,0 +1,14 @@ +package com.chint.infrastructure.constant; + +public class OrderRecordConstant { + + // 对应所属系统 + public static final String LY_CUSTOM1 = "Custom1"; + //核算企业code + public static final String LY_CUSTOM2 = "Custom2"; + //核算企业名称 + public static final String LY_CUSTOM3 = "Custom3"; + //项目订单号 + public static final String LY_CUSTOM4 = "Custom4"; + +} diff --git a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/CarStatement.java b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/CarStatement.java index 684e48b7..fa775fe6 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/CarStatement.java +++ b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/CarStatement.java @@ -1,6 +1,6 @@ package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse; -import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList; +import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemCarList; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse; import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; import lombok.AllArgsConstructor; @@ -71,7 +71,7 @@ public class CarStatement extends BaseResponse { private Double ticketOutAmount;//票面 private Double serviceAmount;//服务费 private Double insuranceAmount;//保险 - private List tripSubmitItemList;//行程提交项 + private List tripSubmitItemList;//行程提交项 private String orderOperType;//类型 预订/变更/退票 private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3:组合支付) private Double totalShouldPay;//总计应付 diff --git a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/FlightStatement.java b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/FlightStatement.java index 370017da..5cc89d1d 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/FlightStatement.java +++ b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/FlightStatement.java @@ -1,6 +1,6 @@ package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse; -import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList; +import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemFlightList; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse; import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; import lombok.AllArgsConstructor; @@ -93,7 +93,7 @@ public class FlightStatement extends BaseResponse { private Double ticketOutAmount;//票面 private Double serviceAmount;//服务费 private Double insuranceAmount;//保险 - private List tripSubmitItemList;//行程提交项 + private List tripSubmitItemList;//行程提交项 private String orderOperType;//类型 预订/变更/退票 private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3:组合支付) private Double totalShouldPay;//总计应付 diff --git a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/HotelStatement.java b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/HotelStatement.java index 0b839992..c80b1b0d 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/HotelStatement.java +++ b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/HotelStatement.java @@ -1,6 +1,7 @@ package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse; -import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList; + +import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemHotelList; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse; import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; import lombok.AllArgsConstructor; @@ -79,7 +80,7 @@ public class HotelStatement extends BaseResponse { private Double ticketOutAmount;//票面 private Double serviceAmount;//服务费 private Double insuranceAmount;//保险 - private List tripSubmitItemList;//行程提交项 + private List tripSubmitItemList;//行程提交项 private String orderOperType;//类型 预订/变更/退票 private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3:组合支付) private Double totalShouldPay;//总计应付 diff --git a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/TrainStatement.java b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/TrainStatement.java index 5fa91036..219f079e 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/TrainStatement.java +++ b/src/main/java/com/chint/interfaces/rest/ly/reconciliation/dto/DetailResponse/TrainStatement.java @@ -1,6 +1,7 @@ package com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse; -import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemList; + +import com.chint.domain.aggregates.order.order_record.ly_order_record.TripSubmitItemTrainList; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseResponse; import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; import lombok.AllArgsConstructor; @@ -77,7 +78,7 @@ public class TrainStatement extends BaseResponse { private Double ticketOutAmount;//票面 private Double serviceAmount;//服务费 private Double insuranceAmount;//保险 - private List tripSubmitItemList;//行程提交项 + private List tripSubmitItemList;//行程提交项 private String orderOperType;//类型 预订/变更/退票 private String payType;//支付类型(1:企业授信 / 2:个人支付 / 3:组合支付) private Double totalShouldPay;//总计应付 From dfa1248fe04b0b2895f3fb5fbf8943a4daebe12d Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 2 Apr 2024 17:06:27 +0800 Subject: [PATCH 18/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/chint/domain/aggregates/order/OrderEvent.java | 4 ++-- .../aggregates/order/order_record/OrderHotelRecord.java | 7 +++++-- src/main/resources/application-test.yml | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java index ba689c23..aabf860f 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java @@ -112,10 +112,10 @@ public class OrderEvent implements Serializable { public static String mapToHotelOrderDetailStatus(Integer eventType){ return switch (eventType) { - case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_REFUND; //未下单 改成3 + case ORDER_EVENT_PREPARE -> FSSC_HOTEL_STATUS_SUCCESS; //未下单 改成3 case ORDER_EVENT_PAYED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_CHANGE -> FSSC_HOTEL_STATUS_SUCCESS; - case ORDER_EVENT_CANCEL -> FSSC_HOTEL_STATUS_SUCCESS; //e额外生成的单子为3 退票虽然是3 返回为1 + case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL; //e额外生成的单子为3 退票虽然是3 返回为1 case ORDER_EVENT_ORDERED -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_REFUND -> FSSC_HOTEL_STATUS_SUCCESS; case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index f40ebcd6..b6280dc8 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -227,8 +227,11 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载发票和费用信息 - public OrderHotelRecord loadInvoiceAndFeeInfo(String invoiceType, String invoiceFee, String custodayFee, - String noTaxCusFee, String taxCusFee) { + public OrderHotelRecord loadInvoiceAndFeeInfo(String invoiceType, + String invoiceFee, + String custodayFee, + String noTaxCusFee, + String taxCusFee) { this.setInvoiceType(invoiceType); this.setInvoiceFee(invoiceFee); this.setCustodayFee(custodayFee); diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index f4381294..0e552aab 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -48,10 +48,10 @@ logging: #正式 ly: appId: zhengtai - account: 4f9cb1080b564dd0a94aa95f7a19c8b5 - password: 1fD3SutgzfS48qznYQiq - secret: WOHzCMvHd823iHgH - baseUrl: https://api.qa.dttrip.cn/openapi + account: ab9fe0c19dd64a99b936fded72c3bb94 + password: glHRJJ9JMUwNfQ8OwAQi + secret: MnghmYJpM1U2RaLx + baseUrl: https://api.dttrip.cn/openapi ifForwardRequest: false forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz From 616ac891825c1fea069493533c57c0b4eca0c1d6 Mon Sep 17 00:00:00 2001 From: dengwc Date: Tue, 2 Apr 2024 17:09:45 +0800 Subject: [PATCH 19/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderTrainRecord.java | 1 + .../LyOrderRecordExtensionFactory.java | 49 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index 51f1c664..7387fd4b 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -63,6 +63,7 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String bookOrgCode3; // 出行人组织架构信息3 private String projectOrderNo; // 项目订单号 private String offlineCcomyCode; // 成本中心 + private String payAmount;//支付总金额 private String travelUserBirthday; // 生日 private String travelUserPhone; // 出行人手机号 private String travelUserSex; // 性别: 0保密不展示 1男 2女 diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index fdda0234..f24d3d74 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -108,7 +108,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setReceiptsNumOrigin(lyOrderFlightRecord.getOutApplayOrderNo())//原关联申请单号 .setUserName(lyOrderFlightRecord.getPassengerName())//出行人姓名 .setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码 - .setOverStandard("是".equals(lyOrderFlightRecord.getOverStandardStatus()) ? "1" : "0")//"是否违规(超标):0否 ,1是" + .setOverStandard(lyOrderFlightRecord.getOverStandardStatus())//"是否违规(超标):0否 ,1是" .setOverStandardReason(lyOrderFlightRecord.getViolationReason())//违规原因(超标原因) .setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称 .setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码 @@ -141,17 +141,17 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setSeatDiscount(lyOrderFlightRecord.getDiscount())//折扣率 .setSeatPoint(lyOrderFlightRecord.getSeatClass())//舱位 .setSeatPointName(lyOrderFlightRecord.getSeatClass())//舱位名称 - .setUseStatus(lyOrderFlightRecord.getTicketStatus()) //机票使用情况 - .setOrderSource(lyOrderFlightRecord.getBookingPlat()) //预订来源:线上/线下 + .setUseStatus(lyOrderFlightRecord.getTicketStatus())//机票使用情况 + .setOrderSource(StringUtils.isNotBlank(lyOrderFlightRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下 .setNotLowReason("正泰机票无超标") //未预订最低价原因 .setBookOrgCode1(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息1 .setBookOrgCode2(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息2 .setBookOrgCode3(lyOrderFlightRecord.getPassengerDepartment()) //出行人组织架构信息3 .setOfflineCcomyCode(lyOrderFlightRecord.getPassengerCostCenter()) //成本中心 .setOrderStatus("") //结算状态 -/* .setExpenseOrderAmount("") //订单金额 - .setSettleOrderFlag() //订单对账状态 - .setPayAmount() //支付金额*/ +// .setExpenseOrderAmount("") //订单金额 +// .setSettleOrderFlag() //订单对账状态 + .setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount() + lyOrderFlightRecord.getServiceAmount()))//支付金额 ; } @@ -177,7 +177,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setOriginalOrderNo(lyOrderHotelRecord.getOriginOrderSerialNo())//原始订单号 .setBrandGroup("") //酒店品牌集团 .setBrandName("") //酒店品牌 - .setOverStandard("是".equals(lyOrderHotelRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标) 0否,1是" + .setOverStandard(lyOrderHotelRecord.getOverStandardStatus()) //"是否违规(超标) 0否,1是" .setOverStandardReason(lyOrderHotelRecord.getViolationReason());//违规原因(超标原因) orderHotelRecord.setReceiptsNum(getReceiptsNum(lyOrderHotelRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 @@ -214,16 +214,15 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setTaxCusFee("") //托管费税费 .setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型 .setStarRate(hotelOrderDetail.getStarRate()) //星级 - .setOrderSource(lyOrderHotelRecord.getBookingPlat()) //预订来源:线上/线下 + .setOrderSource(StringUtils.isNotBlank(lyOrderHotelRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下 .setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1 .setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2 .setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()) //入住人组织架构信息3 .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心 -/* .setOrderStatus() //结算状态 - .setExpenseOrderAmount() //订单金额 - .setSettleOrderFlag() //订单对账状态 - .setPayAmount() //支付金额 -*/ + .setOrderStatus("") //结算状态 +// .setExpenseOrderAmount("") //订单金额 +// .setSettleOrderFlag() //订单对账状态 + .setPayAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount() + lyOrderHotelRecord.getServiceAmount())) //支付金额 ; } @@ -250,7 +249,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setReceiptsNumOrigin(lyOrderTrainRecord.getOutApplayOrderNo()) //原关联申请单号 .setStartDate(lyOrderTrainRecord.getPlanBeginDate()) //出发日期 .setArriveDate(lyOrderTrainRecord.getPlanEndDate()) //到达日期 - .setOverStandard("是".equals(lyOrderTrainRecord.getOverStandardStatus()) ? "1" : "0") //"是否违规(超标):0否 1是" + .setOverStandard(lyOrderTrainRecord.getOverStandardStatus()) //"是否违规(超标):0否 1是" .setOverStandardReason(lyOrderTrainRecord.getViolationReason()) //违规原因(超标原因) .setChangeAddAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount())) //改签收款 .setChangeCost(String.valueOf(lyOrderTrainRecord.getChangeFee())) //改签手续费 @@ -275,16 +274,16 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次 .setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码 .setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名 - .setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源:线上 / 线下 + .setOrderSource(StringUtils.isNotBlank(lyOrderTrainRecord.getOutApplayOrderNo()) ? "Y" : "N")//预订来源:线上 / 线下 +// .setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源:线上 / 线下 .setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1 .setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2 .setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3())//出行人组织架构信息3 .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心 -/* .setOrderStatus() //结算状态 - .setExpenseOrderAmount() //订单金额 - .setSettleOrderFlag() //订单对账状态 - .setPayAmount() //支付金额 -*/ +// .setOrderStatus() //结算状态 +// .setExpenseOrderAmount() //订单金额 +// .setSettleOrderFlag() //订单对账状态 + .setPayAmount(String.valueOf(lyOrderTrainRecord.getToBePayAmount() + lyOrderTrainRecord.getServiceAmount())) //支付金额 /* .setTravelUserBirthday("")//生日 .setTravelUserPhone("") //出行人手机号 @@ -315,7 +314,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号 orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 .setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号 - .setOverStandard("0") //"是否违规(超标):0否 1是" + .setOverStandard("否") //"是否违规(超标):0否 1是" .setOverStandardReason("无")//违规原因(超标原因) .setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号 .setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号 @@ -348,10 +347,10 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()) //用车人组织架构信息3 .setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付" .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心 - .setOrderSource(lyOrderCarRecord.getBookingPlat()) //预订来源:线上/线下 -/* .setExpenseOrderAmount() //订单金额 - .setSettleOrderFlag() //订单对账状态 - .setPayAmount()// 支付金额*/ + .setOrderSource(StringUtils.isNotBlank(lyOrderCarRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下 +// .setExpenseOrderAmount() //订单金额 +// .setSettleOrderFlag() //订单对账状态 + .setPayAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount() + lyOrderCarRecord.getServiceAmount()))// 支付金额 ; } From 5ad1e6f6f453cbff471108907403fabe75594a76 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 10:27:14 +0800 Subject: [PATCH 20/33] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=90=BA=E7=A8=8B?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderFlightRecord.java | 2 + .../order/order_record/OrderHotelRecord.java | 9 +- .../ctrip_order_record/CTripFlightRecord.java | 8 +- .../CTripFlightTripInfo.java | 90 +++++++++++++++++++ .../CTripHotelOrderDetail.java | 10 ++- .../CTripHotelRoomDetail.java | 35 ++++++++ .../CTripOrderRecordExtensionFactory.java | 78 +++++++++++----- .../OrderCarRecordRepositoryImpl.java | 3 +- .../OrderFlightRecordRepositoryImpl.java | 3 +- .../OrderHotelRecordRepositoryImpl.java | 9 +- .../OrderTrainRecordRepositoryImpl.java | 8 +- .../jdbc/JdbcOrderCarRecordRepository.java | 1 + .../jdbc/JdbcOrderFlightRecordRepository.java | 1 + .../jdbc/JdbcOrderHotelRecordRepository.java | 2 + .../jdbc/JdbcOrderTrainRecordRepository.java | 2 + .../ctrip/order/CTripOrderRecordAutoSave.java | 11 ++- 16 files changed, 227 insertions(+), 45 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 795e137c..7d5ced56 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -119,9 +119,11 @@ public class OrderFlightRecord extends OrderBaseRecord { // 加载机票信息 public OrderFlightRecord loadTicketInfo(String issueTicketTime, + String ticketNo, String facePrice, String useStatus) { this.setIssueTicketTime(issueTicketTime); + this.setTicketNo(ticketNo); this.setFacePrice(facePrice); this.setUseStatus(useStatus); return this; diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index b6280dc8..befe93e2 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -79,6 +79,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//支付总金额 + // 加载基础订单信息 public OrderHotelRecord loadBasicOrderInfo(String orderNo, String orderStatus, @@ -90,10 +91,9 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载酒店和入住信息 - public OrderHotelRecord loadHotelInfo(String hotelName, String hotelAddress, String checkInDate, String departureDate, + public OrderHotelRecord loadHotelInfo(String hotelName, String checkInDate, String departureDate, int roomCount, String roomTypeName) { this.setHotelName(hotelName); - this.setHotelAddress(hotelAddress); this.setCheckInDate(checkInDate); this.setDepartureDate(departureDate); this.setRoomCount(roomCount); @@ -102,10 +102,11 @@ public class OrderHotelRecord extends OrderBaseRecord { } // 加载地理信息位置 - public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity) { + public OrderHotelRecord loadLocationInfo(String country, String province, String checkInCity, String hotelAddress) { this.setCountry(country); this.setProvince(province); this.setCheckInCity(checkInCity); + this.setHotelAddress(hotelAddress); return this; } @@ -239,6 +240,4 @@ public class OrderHotelRecord extends OrderBaseRecord { this.setTaxCusFee(taxCusFee); return this; } - - } \ No newline at end of file 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 98ea8dc8..4eb90c4a 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 @@ -26,14 +26,20 @@ public class CTripFlightRecord implements Serializable { private CTripFlightInfo cTripFlightInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightBaseInfo cTripFlightBaseInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightTripInfo cTripFlightTripInfo; - public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo,CTripFlightBaseInfo cTripOrderBaseInfo) { + public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, + CTripFlightInfo cTripFlightInfo, + CTripFlightBaseInfo cTripOrderBaseInfo, + CTripFlightTripInfo cTripFlightTripInfo) { CTripFlightRecord cTripFlightRecord = new CTripFlightRecord(); cTripFlightRecord.setCTripFlightRecordBase(cTripFlightRecordBase); cTripFlightRecord.setCTripFlightInfo(cTripFlightInfo); cTripFlightRecord.setRecordId(String.valueOf(cTripFlightRecordBase.getRecordId())); cTripFlightRecord.setCreateTime(DateTimeUtil.strToTimeMM(cTripFlightRecordBase.getCreateTime())); cTripFlightRecord.setCTripFlightBaseInfo(cTripOrderBaseInfo); + cTripFlightRecord.setCTripFlightTripInfo(cTripFlightTripInfo); return cTripFlightRecord; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java new file mode 100644 index 00000000..304f9744 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightTripInfo.java @@ -0,0 +1,90 @@ +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.OrderFlightResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_flight_trip_info") +public class CTripFlightTripInfo implements Serializable { + @Serial + private static final long serialVersionUID = -2541232534673683466L; + @Id + private Long id; + private Long cTripFlightRecordId; + private Long TripId; + private Integer SectorId; + private String PassengerName; + private String RecordStatus; + private Integer ValidFlag;// + private String FlightClass; + private String Flight; + private String ClassGrade; + private String SubClass; + private String TakeOffTime; + private String ArrivalTime; + private Integer DCity; + private String DepartureDistrictCode; + private String DPort; + private String DPortBuilding; + private Integer DPortBuildingId; + private Integer ACity; + private String ArrivalDistrictCode; + private String APort; + private String APortBuilding; + private Integer APortBuildingId; + private Integer OpenTranFlag;// + private Double PrintPrice; + private Double Oil; + private Double Tax; + private String RecordNo; + private String AirlineRecordNo; + private Integer SharedFlag;// + private String SharedFlight; + private Integer SurfaceFlag; // + private String AirLineCode; + private String TicketNo; + private Integer TicketNoStatus; + private String TicketNoStatusName; + private String DCityName; + private String DPortName; + private String ACityName; + private String APortName; + // private OrderFlightResponse.StandardGeoInfo StandardGeoInfo; + private String ClassTypeName; + private String AirlineName; + + public static CTripFlightTripInfo of(OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo) { + CTripFlightTripInfo cTripFlightTripInfo = BeanUtil.copyProperties(flightTripRecordInfo, CTripFlightTripInfo.class); + cTripFlightTripInfo.setValidFlag(flightTripRecordInfo.isValidFlag() ? 1 : 0); + cTripFlightTripInfo.setOpenTranFlag(flightTripRecordInfo.isOpenTranFlag() ? 1 : 0); + cTripFlightTripInfo.setSharedFlag(flightTripRecordInfo.isSharedFlag() ? 1 : 0); + cTripFlightTripInfo.setSurfaceFlag(flightTripRecordInfo.isSurfaceFlag() ? 1 : 0); + cTripFlightTripInfo.setTicketNoStatusName(translateTicketStatus(flightTripRecordInfo.getTicketNoStatus())); + return cTripFlightTripInfo; + } + + private static String translateTicketStatus(Integer ticketNoStatus) { + return switch (ticketNoStatus) { + case -2 -> "未知"; + case -1 -> "未知"; + case 1 -> "待使用"; + case 2 -> "已使用"; + case 3 -> "已经办理登记"; + case 4 -> "已离港"; + case 5 -> "已作废"; + case 6 -> "已退票"; + case 7 -> "换开"; + case 8 -> "挂起"; + case 9 -> "机场控制"; + case 10 -> "机场控制"; + case 11 -> "未查到"; + default -> "未知"; + }; + } +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java index 96b8da25..1bbfa1ba 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelOrderDetail.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; 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.io.Serial; @@ -19,6 +20,8 @@ public class CTripHotelOrderDetail implements Serializable { private Long id; private Long cTripHotelRecordId; private Long OrderId; + @MappedCollection(idColumn = "c_trip_hotel_order_detail_id", keyColumn = "c_trip_hotel_order_detail_key") + private List cTripHotelRoomDetailList; private String EmployeeName; private String EmployeeID; private String WorkCity; @@ -100,8 +103,13 @@ public class CTripHotelOrderDetail implements Serializable { private Double TPConfigMaxPrice; private String ReservationType; private String PreEmail; + public static CTripHotelOrderDetail of(OrderHotelResponse.SettlementOrderDetail data) { - return BeanUtil.copyProperties(data, CTripHotelOrderDetail.class); + CTripHotelOrderDetail cTripHotelOrderDetail = BeanUtil.copyProperties(data, CTripHotelOrderDetail.class); + List roomDetailList = data.getRoomDetailList(); + List res = roomDetailList.stream().map(CTripHotelRoomDetail::of).toList(); + cTripHotelOrderDetail.setCTripHotelRoomDetailList(res); + return cTripHotelOrderDetail; } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java new file mode 100644 index 00000000..91d65f3d --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripHotelRoomDetail.java @@ -0,0 +1,35 @@ +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.OrderHotelResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_hotel_room_detail") +public class CTripHotelRoomDetail implements Serializable { + @Serial + private static final long serialVersionUID = 1027124557206346513L; + @Id + private Long id; + private Long cTripHotelOrderDetailId; + private Integer cTripHotelOrderDetailKey; + private String BasicRoomTypeName; + private String BasicRoomTypeEnName; + private Integer Breakfast; + private Integer AddBreakfast; + private Integer Meals; + private String ETA; + private String ETD; + private Double Price; + private Integer remainQuantity; + private Integer refundQuantity; + + public static CTripHotelRoomDetail of(OrderHotelResponse.SettlementRoomDetail roomDetail) { + return BeanUtil.copyProperties(roomDetail, CTripHotelRoomDetail.class); + } +} 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 06fe0202..98eba36d 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 @@ -49,16 +49,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5()); String sysCode = cTripCarPassengerInfo.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -208,16 +208,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5()); String sysCode = cTripFlightBaseInfo.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -231,6 +231,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { CTripFlightRecord cTripFlightRecord = (CTripFlightRecord) orderFlightRecordData; CTripFlightBaseInfo cTripFlightBaseInfo = cTripFlightRecord.getCTripFlightBaseInfo(); + CTripFlightTripInfo cTripFlightTripInfo = cTripFlightRecord.getCTripFlightTripInfo(); String routeOrderNo = cTripFlightRecord.getRouteOrderNo(); Optional byOrderNo = Optional.ofNullable(routeRepository.findByOrderNo(routeOrderNo)); OrderFlightRecord orderFlightRecord = buildWithRecord(cTripFlightRecord) @@ -257,13 +258,22 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac "", cTripFlightInfo.getACityCode(), "") - .loadTicketInfo(cTripFlightRecordBase.getCreateTime(), - String.valueOf(cTripFlightRecordBase.getPrice()), - "") .loadSeatInfo(cTripFlightInfo.getClassName(), cTripFlightInfo.getClassName(), String.valueOf(cTripFlightInfo.getPriceRate())); + if (cTripFlightTripInfo != null) { + orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + cTripFlightTripInfo.getTicketNo(), + cTripFlightTripInfo.getTicketNoStatusName()); + } else { + orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + String.valueOf(cTripFlightRecordBase.getPrice()), + "", + "无机票信息"); + } + // 加载财务与价格信息 String batchNo = cTripFlightRecordBase.getBatchStartDate().substring(0, 6); @@ -349,16 +359,16 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5()); String sysCode = cTripHotelOrderDetail.getCostCenter3(); if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_FSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_FSSC); } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + if (sysCode.contains(BELONG_SYS_CODE_H3BPM)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_H3BPM); } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_XNFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + if (sysCode.contains(BELONG_SYS_CODE_ANFSSC)) { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); } } else { @@ -386,7 +396,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载酒店和入住信息 orderHotelRecord.loadHotelInfo(cTripHotelInfo.getHotelName(), - cTripHotelInfo.getHotelName(), cTripHotelOrderDetail.getStartTime(), cTripHotelOrderDetail.getEndTime(), cTripHotelOrderDetail.getRoomQuantity(), @@ -399,7 +408,15 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } else { isAgreement = "否"; } - orderHotelRecord.loadRoomAndBreakfastInfo("", + List roomDetails = cTripHotelOrderDetail.getCTripHotelRoomDetailList(); + Integer averageMeals; + if (roomDetails != null && !roomDetails.isEmpty()) { + averageMeals = roomDetails.stream().map(CTripHotelRoomDetail::getBreakfast).reduce(Integer::sum).get(); + + } else { + averageMeals = 0; + } + orderHotelRecord.loadRoomAndBreakfastInfo(String.valueOf(averageMeals), isAgreement, cTripHotelRecordBase.getQuantity(), cTripHotelRecordBase.getQuantity(), @@ -413,10 +430,19 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac if (locations != null && !locations.isEmpty()) { Location location = locations.get(0); LocationRes locationRes = LocationRes.copyFrom(location); - orderHotelRecord.loadLocationInfo(locationRes.getCountry(), locationRes.getProvince(), cTripHotelInfo.getCityName()); + String address = locationRes.getCountry() + locationRes.getProvince() + cTripHotelInfo.getCityName(); + if (cTripHotelInfo.getDistrictName() != null) { + address = address + cTripHotelInfo.getDistrictName(); + } + address = address + cTripHotelInfo.getHotelName(); + orderHotelRecord.loadLocationInfo( + address, + locationRes.getCountry(), + locationRes.getProvince(), + cTripHotelInfo.getCityName()); } else { //如果找不到该地区,那么只能先用空的 - orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName()); + orderHotelRecord.loadLocationInfo("", "", cTripHotelInfo.getCityName(), cTripHotelInfo.getHotelName()); } // 加载酒店品牌和星级信息 @@ -458,11 +484,17 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelRecordBase.getCreateTime())); // 加载财务信息 + String invoiceType = cTripHotelOrderDetail.getIsHasSpecialInvoice().equals("T") ? "增值税专用发票" : "增值税普通发票"; //发票类型 orderHotelRecord.loadFinancialInfo(cTripHotelRecordBase.getBatchStartDate().substring(0, 6), - cTripHotelRecordBase.getSubAccCheckBatchNo(), - String.valueOf(cTripHotelRecordBase.getAmount()), - "", - cTripHotelRecordBase.getPaidAmount()); + cTripHotelRecordBase.getSubAccCheckBatchNo(), + String.valueOf(cTripHotelRecordBase.getAmount()), + "", + cTripHotelRecordBase.getPaidAmount()) + .loadInvoiceAndFeeInfo(invoiceType, + String.valueOf(cTripHotelRecordBase.getExtraCharge()), + String.valueOf(cTripHotelRecordBase.getServiceFee()), + "", + ""); // 加载付款 付款方式,公司付款金额, 个人付款金额 diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index bd675e95..26d0ae29 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -40,7 +40,8 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = orderCarRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 87e8436d..68268d29 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -37,7 +37,8 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderFlightRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index 50b7e88c..23c216ef 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -1,10 +1,7 @@ package com.chint.infrastructure.repository; -import com.chint.domain.aggregates.order.order_record.OrderCarRecord; -import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.repository.OrderHotelRecordRepository; -import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; @@ -23,6 +20,7 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor @Autowired private JdbcOrderHotelRecordRepository jdbcOrderHotelRecordRepository; + @Override public List saveAll(List orderHotelRecordList) { List res = new ArrayList<>(); @@ -36,10 +34,11 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor } @Override - public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderHotelRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index e9a8df6d..64041ced 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -1,9 +1,7 @@ package com.chint.infrastructure.repository; -import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderTrainRecordRepository; -import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +19,7 @@ import java.util.Optional; public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepository { @Autowired private JdbcOrderTrainRecordRepository jdbcOrderTrainRecordRepository; + @Override public List saveAll(List orderTrainRecordList) { List res = new ArrayList<>(); @@ -34,10 +33,11 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor } @Override - public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType) { + public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); Page byUpdateDataTimeBetween = jdbcOrderTrainRecordRepository - .findByBelongSysTypeAndUpdateDataTimeBetween(systemType, startTime, endTime, pageRequest); + .findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(systemType, + startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index bf1fac92..6e0a4bdc 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -15,4 +15,5 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index a6d053d7..e6dd5c8d 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -14,4 +14,5 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index 4bf5cd9a..658e713c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -1,5 +1,6 @@ package com.chint.infrastructure.repository.jdbc; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -15,4 +16,5 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index ee634c0a..690dc56c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -14,4 +14,6 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } 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 8b588697..97ca04d3 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 @@ -55,20 +55,23 @@ public class CTripOrderRecordAutoSave { .map(it -> { //对数据库进行查找 ,如果发现已经存在 , 就使用查找出来的 OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = it.getOrderSettlementBaseInfo(); + OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo = it.getFlightTripRecordInfo(); CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId( String.valueOf(orderSettlementBaseInfo.getRecordID())); if (record == null) { record = CTripFlightRecord.of( CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), CTripFlightInfo.of(it.getOrderFlightInfo()), - CTripFlightBaseInfo.of(it.getOrderBaseInfo()) + CTripFlightBaseInfo.of(it.getOrderBaseInfo()), + CTripFlightTripInfo.of(flightTripRecordInfo) ); } else { Long originId = record.getId(); record = CTripFlightRecord.of( CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), CTripFlightInfo.of(it.getOrderFlightInfo()), - CTripFlightBaseInfo.of(it.getOrderBaseInfo())); + CTripFlightBaseInfo.of(it.getOrderBaseInfo()), + CTripFlightTripInfo.of(flightTripRecordInfo)); record.setId(originId); } //补充额外的字段 @@ -120,7 +123,7 @@ public class CTripOrderRecordAutoSave { public void cTripTrainRecordAutoSave(Optional date) { - OrderTrainResponse trainOrder = date + OrderTrainResponse trainOrder = date .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getTrainOrderByDate(it))) .orElseGet(() -> cTripOrderDetailRequest.getTrainOrder()); @@ -150,7 +153,7 @@ public class CTripOrderRecordAutoSave { } public void cTripCarRecordAutoSave(Optional date) { - OrderCarResponse carOrder = date + OrderCarResponse carOrder = date .flatMap(it -> Optional.ofNullable(cTripOrderDetailRequest.getCarOrderByDate(it))) .orElseGet(() -> cTripOrderDetailRequest.getCarOrder()); From 346ea697dae737c10e16983f4e34c1f8b6873060 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 13:13:58 +0800 Subject: [PATCH 21/33] =?UTF-8?q?=E6=90=BA=E7=A8=8B=E6=9C=BA=E7=A5=A8?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8A=A0=E5=85=A5=E8=A1=8C=E7=A8=8B=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderFlightRecord.java | 5 +++ .../CTripFlightPrintInfo.java | 37 +++++++++++++++++++ .../ctrip_order_record/CTripFlightRecord.java | 7 ++++ .../CTripFlightSegmentPrint.java | 35 ++++++++++++++++++ .../CTripOrderRecordExtensionFactory.java | 22 ++++++++++- .../ctrip/order/CTripOrderRecordAutoSave.java | 7 +++- 6 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java create mode 100644 src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 7d5ced56..49b3c18a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -129,6 +129,11 @@ public class OrderFlightRecord extends OrderBaseRecord { return this; } + public OrderFlightRecord loadScheduleNum(String scheduleNum){ + this.setScheduleNum(scheduleNum); + return this; + } + // 加载座位细节 public OrderFlightRecord loadSeatInfo(String seatPoint, String seatPointName, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java new file mode 100644 index 00000000..dd53805a --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightPrintInfo.java @@ -0,0 +1,37 @@ +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.OrderFlightResponse; +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.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +@Table("c_trip_flight_print_info") +public class CTripFlightPrintInfo implements Serializable { + @Serial + private static final long serialVersionUID = 8423142133557758145L; + @Id + private Long id; + private Long cTripFlightRecordId; + private long OrderID; + private String CorpID; + @MappedCollection(idColumn = "c_trip_flight_print_info_id", keyColumn = "c_trip_flight_print_info_key") + private List FlightOrderSegmentPrintInfoList; + // private List RegularExpressInfoListFieldList; + private String TicketNoSignCode; + + public static CTripFlightPrintInfo of(OrderFlightResponse.FlightOrderPrintDetailInfo printDetailInfo) { + List list = printDetailInfo + .getFlightOrderSegmentPrintInfoList().stream() + .map(CTripFlightSegmentPrint::of).toList(); + CTripFlightPrintInfo cTripFlightPrintInfo = BeanUtil.copyProperties(printDetailInfo, CTripFlightPrintInfo.class); + cTripFlightPrintInfo.setFlightOrderSegmentPrintInfoList(list); + return cTripFlightPrintInfo; + } +} 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 4eb90c4a..77175a55 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 @@ -28,6 +28,8 @@ public class CTripFlightRecord implements Serializable { private CTripFlightBaseInfo cTripFlightBaseInfo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightTripInfo cTripFlightTripInfo; + @MappedCollection(idColumn = "c_trip_flight_record_id") + private CTripFlightPrintInfo cTripFlightPrintInfo; public static CTripFlightRecord of(CTripFlightRecordBase cTripFlightRecordBase, CTripFlightInfo cTripFlightInfo, @@ -42,4 +44,9 @@ public class CTripFlightRecord implements Serializable { cTripFlightRecord.setCTripFlightTripInfo(cTripFlightTripInfo); return cTripFlightRecord; } + + public CTripFlightRecord printInfo(CTripFlightPrintInfo cTripFlightPrintInfo) { + this.setCTripFlightPrintInfo(cTripFlightPrintInfo); + return this; + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java new file mode 100644 index 00000000..5f239e0b --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/ctrip_order_record/CTripFlightSegmentPrint.java @@ -0,0 +1,35 @@ +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.OrderFlightResponse; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + +@Data +@Table("c_trip_flight_segment_print") +public class CTripFlightSegmentPrint implements Serializable { + @Serial + private static final long serialVersionUID = 8454314678965758235L; + @Id + private Long id; + private Long cTripFlightPrintInfoId; + private Integer cTripFlightPrintInfoKey; + private Long OrderID; + private String ExpressNo; + private String CorpId; + private Integer PrintType; + private String PassengerName; + private String TicketNo; + private String PrintNo; + private Double SegmentPrintPrice; + private Long PrintTime; + private String AirLineCode; + + public static CTripFlightSegmentPrint of(OrderFlightResponse.FlightOrderSegmentPrintInfo printInfo) { + return BeanUtil.copyProperties(printInfo, CTripFlightSegmentPrint.class); + } +} 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 98eba36d..7f88235a 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 @@ -111,7 +111,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(cTripCarRecordBase.getRealAmountHasPost())); // 加载费用细节, 未税金额,税费,服务费,取消费,额外费用,额外费用名称 , 携程马上用车产品没有税费和额外费用字段 - orderCarRecord.loadFeeDetails(String.valueOf(cTripCarRecordBase.getAmount()), + orderCarRecord.loadFeeDetails("", "", String.valueOf(cTripCarRecordBase.getServerFee()), String.valueOf(cTripCarRecordBase.getPenaltyFee()), @@ -262,6 +262,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripFlightInfo.getClassName(), String.valueOf(cTripFlightInfo.getPriceRate())); + + CTripFlightPrintInfo cTripFlightPrintInfo = cTripFlightRecord.getCTripFlightPrintInfo(); + if (cTripFlightPrintInfo != null && + cTripFlightPrintInfo.getFlightOrderSegmentPrintInfoList() != null && + !cTripFlightPrintInfo.getFlightOrderSegmentPrintInfoList().isEmpty()) { + //获取最新的行程号 + Optional print = cTripFlightRecord + .getCTripFlightPrintInfo() + .getFlightOrderSegmentPrintInfoList() + .stream() + .reduce((a, b) -> { + if (a.getPrintTime() > b.getPrintTime()) { + return a; + } else { + return b; + } + }); + orderFlightRecord.loadScheduleNum(print.isPresent() ? print.get().getPrintNo() : ""); + } + if (cTripFlightTripInfo != null) { orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), String.valueOf(cTripFlightRecordBase.getPrice()), 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 97ca04d3..29e8a489 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 @@ -58,13 +58,13 @@ public class CTripOrderRecordAutoSave { OrderFlightResponse.FlightTripRecordInfo flightTripRecordInfo = it.getFlightTripRecordInfo(); CTripFlightRecord record = cTripOrderDetailRepository.findFlightRecordByRecordId( String.valueOf(orderSettlementBaseInfo.getRecordID())); + if (record == null) { record = CTripFlightRecord.of( CTripFlightRecordBase.changeInfo(orderSettlementBaseInfo), CTripFlightInfo.of(it.getOrderFlightInfo()), CTripFlightBaseInfo.of(it.getOrderBaseInfo()), - CTripFlightTripInfo.of(flightTripRecordInfo) - ); + CTripFlightTripInfo.of(flightTripRecordInfo)); } else { Long originId = record.getId(); record = CTripFlightRecord.of( @@ -74,6 +74,9 @@ public class CTripOrderRecordAutoSave { CTripFlightTripInfo.of(flightTripRecordInfo)); record.setId(originId); } + if (it.getOrderPrintDetailInfo() != null) { + record.printInfo(CTripFlightPrintInfo.of(it.getOrderPrintDetailInfo())); + } //补充额外的字段 OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); record.setRouteOrderNo(orderBaseInfo.getJourneyID()); From 00b61fd55bb7e04f337a81b38ecf22782f322cf9 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 14:20:16 +0800 Subject: [PATCH 22/33] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=8F=AA?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B8=8A=E4=B8=AA=E6=9C=88=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/OrderDetailQuery.java | 13 ++++------- .../order/order_record/OrderFlightRecord.java | 7 +++--- .../CTripOrderRecordExtensionFactory.java | 14 +++++++---- .../repository/OrderCarRecordRepository.java | 7 +++++- .../OrderFlightRecordRepository.java | 4 ++++ .../OrderHotelRecordRepository.java | 8 ++++++- .../OrderTrainRecordRepository.java | 7 +++++- .../service/OrderRecordDomainService.java | 23 +++++++++++++++++++ .../OrderCarRecordRepositoryImpl.java | 10 ++++++++ .../OrderFlightRecordRepositoryImpl.java | 9 ++++++++ .../OrderHotelRecordRepositoryImpl.java | 11 +++++++++ .../OrderTrainRecordRepositoryImpl.java | 10 ++++++++ .../jdbc/JdbcOrderCarRecordRepository.java | 3 +++ .../jdbc/JdbcOrderFlightRecordRepository.java | 2 ++ .../jdbc/JdbcOrderHotelRecordRepository.java | 4 +++- .../jdbc/JdbcOrderTrainRecordRepository.java | 1 + .../infrastructure/util/DateTimeUtil.java | 16 +++++++++++++ .../java/com/chint/RouteApplicationTests.java | 4 +++- 18 files changed, 132 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/chint/domain/service/OrderRecordDomainService.java diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index f701e7b1..13a943e3 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -57,15 +57,12 @@ public class OrderDetailQuery { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime targetTimeBegin = LocalDateTime.parse(authenticationDto.getStartTime(), formatter); LocalDateTime targetTimeEnd = LocalDateTime.parse(authenticationDto.getEndTime(), formatter); + //只获取账期号为上个月的结算数据 return switch (productType) { - case 1 -> orderFlightRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 2 -> orderHotelRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 3 -> orderTrainRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); - case 4 -> orderCarRecordRepository.findByUpdateDataTime(targetTimeBegin, - targetTimeEnd, pageSize, pageNum, systemType); + case 1 -> orderFlightRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 2 -> orderHotelRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 3 -> orderTrainRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); + case 4 -> orderCarRecordRepository.findBySystemTypeAndLastMonth(pageSize, pageNum, systemType); default -> throw new NotFoundException("错误产品类型"); }; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 49b3c18a..5967781b 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -118,19 +118,20 @@ public class OrderFlightRecord extends OrderBaseRecord { } // 加载机票信息 - public OrderFlightRecord loadTicketInfo(String issueTicketTime, + public OrderFlightRecord loadTicketInfo( String ticketNo, String facePrice, String useStatus) { - this.setIssueTicketTime(issueTicketTime); + this.setTicketNo(ticketNo); this.setFacePrice(facePrice); this.setUseStatus(useStatus); return this; } - public OrderFlightRecord loadScheduleNum(String scheduleNum){ + public OrderFlightRecord loadScheduleNum(String issueTicketTime,String scheduleNum){ this.setScheduleNum(scheduleNum); + this.setIssueTicketTime(issueTicketTime); return this; } 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 7f88235a..3d2897b2 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 @@ -11,6 +11,7 @@ import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.RouteRepository; import com.chint.domain.service.OrderDetailDomainService; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; +import com.chint.infrastructure.util.DateTimeUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,6 +47,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripCarPassengerInfo.getCostCenter1()); orderRecordBasic.setAccountCompanyName(cTripCarPassengerInfo.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripCarPassengerInfo.getCostCenter1()); orderRecordBasic.setProjectOrderNo(cTripCarPassengerInfo.getCostCenter5()); String sysCode = cTripCarPassengerInfo.getCostCenter3(); if (sysCode != null) { @@ -205,6 +207,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripFlightBaseInfo.getCostCenter()); orderRecordBasic.setAccountCompanyName(cTripFlightBaseInfo.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripFlightBaseInfo.getCostCenter()); orderRecordBasic.setProjectOrderNo(cTripFlightBaseInfo.getCostCenter5()); String sysCode = cTripFlightBaseInfo.getCostCenter3(); if (sysCode != null) { @@ -279,17 +282,17 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac return b; } }); - orderFlightRecord.loadScheduleNum(print.isPresent() ? print.get().getPrintNo() : ""); + orderFlightRecord.loadScheduleNum(print.map(cTripFlightSegmentPrint -> DateTimeUtil.timeFromInstant(cTripFlightSegmentPrint.getPrintTime())).orElse(""), + print.isPresent() ? print.get().getPrintNo() : ""); } + // 加载机票信息 if (cTripFlightTripInfo != null) { - orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), + orderFlightRecord.loadTicketInfo(cTripFlightTripInfo.getTicketNo(), String.valueOf(cTripFlightRecordBase.getPrice()), - cTripFlightTripInfo.getTicketNo(), cTripFlightTripInfo.getTicketNoStatusName()); } else { - orderFlightRecord.loadTicketInfo(cTripFlightRecordBase.getCreateTime(), - String.valueOf(cTripFlightRecordBase.getPrice()), + orderFlightRecord.loadTicketInfo(String.valueOf(cTripFlightRecordBase.getPrice()), "", "无机票信息"); } @@ -376,6 +379,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac orderRecordBasic.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); orderRecordBasic.setAccountCompanyId(cTripHotelOrderDetail.getCostCenter()); orderRecordBasic.setAccountCompanyName(cTripHotelOrderDetail.getCostCenter2()); + orderRecordBasic.setOfflineCcomyCode(cTripHotelOrderDetail.getCostCenter()); orderRecordBasic.setProjectOrderNo(cTripHotelOrderDetail.getCostCenter5()); String sysCode = cTripHotelOrderDetail.getCostCenter3(); if (sysCode != null) { diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 435ed60c..edfed599 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -1,6 +1,7 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.infrastructure.util.PageResult; import java.time.LocalDateTime; @@ -12,5 +13,9 @@ public interface OrderCarRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index 26776622..6312ebcf 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -17,4 +17,8 @@ public interface OrderFlightRecordRepository { Integer pageSize, Integer pageNum, String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index be2cc0fd..2bc09547 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -1,6 +1,7 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.infrastructure.util.PageResult; @@ -13,5 +14,10 @@ public interface OrderHotelRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 3a50a491..7b136f16 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -14,5 +14,10 @@ public interface OrderTrainRecordRepository { Optional findByDetailId(String detailId); - PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); + PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, + Integer pageSize, Integer pageNum ,String systemType); + + PageResult findBySystemTypeAndLastMonth(Integer pageSize, + Integer pageNum, + String systemType); } diff --git a/src/main/java/com/chint/domain/service/OrderRecordDomainService.java b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java new file mode 100644 index 00000000..6b257d55 --- /dev/null +++ b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java @@ -0,0 +1,23 @@ +package com.chint.domain.service; + +import com.chint.domain.repository.OrderCarRecordRepository; +import com.chint.domain.repository.OrderFlightRecordRepository; +import com.chint.domain.repository.OrderHotelRecordRepository; +import com.chint.domain.repository.OrderTrainRecordRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class OrderRecordDomainService { + + @Autowired + private OrderCarRecordRepository orderCarRecordRepository; + @Autowired + private OrderHotelRecordRepository orderHotelRecordRepository; + @Autowired + private OrderFlightRecordRepository orderFlightRecordRepository; + @Autowired + private OrderTrainRecordRepository orderTrainRecordRepository; + + +} diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index 26d0ae29..edfdd80a 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderCarRecord; import com.chint.domain.repository.OrderCarRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderCarRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -44,4 +45,13 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = orderCarRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 68268d29..5c49ae4d 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.repository.OrderFlightRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderFlightRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -42,4 +43,12 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderFlightRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index 23c216ef..8c13259b 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -1,8 +1,10 @@ package com.chint.infrastructure.repository; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.repository.OrderHotelRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderHotelRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -41,4 +43,13 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderHotelRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 64041ced..e098a800 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -3,6 +3,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderTrainRecordRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderTrainRecordRepository; +import com.chint.infrastructure.util.DateTimeUtil; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -40,4 +41,13 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor startTime, endTime, startTime, endTime, pageRequest); return PageResult.totalPageNum(byUpdateDataTimeBetween.getTotalElements(), byUpdateDataTimeBetween.getContent()); } + + @Override + public PageResult findBySystemTypeAndLastMonth(Integer pageSize, Integer pageNum, String systemType) { + PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); + String lastMonth = DateTimeUtil.lastMonthStr(); + Page res = jdbcOrderTrainRecordRepository. + findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(systemType, lastMonth, lastMonth, pageRequest); + return PageResult.totalPageNum(res.getTotalElements(), res.getContent()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index 6e0a4bdc..d8ec2073 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -15,5 +15,8 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index e6dd5c8d..81b3fe7c 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -14,5 +14,7 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index 658e713c..f3059438 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -1,6 +1,5 @@ package com.chint.infrastructure.repository.jdbc; -import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -16,5 +15,8 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); + Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index 690dc56c..64736afc 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -14,6 +14,7 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository findByDetailId(String detailId); Page findByBelongSysTypeAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, Pageable pageable); + Page findByBelongSysTypeAndAccountPeriodOrBelongSysTypeIsNullAndAccountPeriod(String belongSysType, String accountPeriod, String accountPeriod2, Pageable pageable); Page findByBelongSysTypeAndUpdateDataTimeBetweenOrBelongSysTypeIsNullAndUpdateDataTimeBetween(String belongSysType, LocalDateTime updateDataTime, LocalDateTime updateDataTime2, LocalDateTime updateDataTime3, LocalDateTime updateDataTime4, Pageable pageable); } diff --git a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java index 347d89c2..a9b50110 100644 --- a/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java +++ b/src/main/java/com/chint/infrastructure/util/DateTimeUtil.java @@ -1,7 +1,9 @@ package com.chint.infrastructure.util; +import java.time.Instant; import java.time.LocalDateTime; import java.time.YearMonth; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; public class DateTimeUtil { @@ -14,6 +16,11 @@ public class DateTimeUtil { private final static DateTimeFormatter formatterDateYYYYMMDD = DateTimeFormatter.ofPattern("yyyyMMdd"); + public static String timeFromInstant(Long instant) { + LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(instant), ZoneId.systemDefault()); + return formatter.format(localDateTime); + } + public static String timeToStr(LocalDateTime input) { return input.format(formatterDate); } @@ -53,4 +60,13 @@ public class DateTimeUtil { return yearMonth.atEndOfMonth().atTime(23, 59, 59); } + public static String lastMonthStr() { + // 获取当前日期和时间 + LocalDateTime currentDateTime = LocalDateTime.now(); + // 获取上个月的同一时间 + LocalDateTime lastMonthDateTime = currentDateTime.minusMonths(1); + // 指定所需格式 + // 格式化日期时间 + return lastMonthDateTime.format(formatterDateYYYYMM); + } } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 0a70fb33..fcb90b91 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -55,6 +55,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.chint.infrastructure.constant.LocationConstant.*; +import static com.chint.infrastructure.util.DateTimeUtil.lastMonthStr; @Slf4j @SpringBootTest @@ -1249,9 +1250,10 @@ class RouteApplicationTests { orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司"); } -// @Test + @Test void testSplid(){ String str = "20240301"; System.out.println(str.substring(0, 5)); + System.out.println(lastMonthStr()); } } From 8895835e4a84d193c2708cbb0c3c51e6b441895d Mon Sep 17 00:00:00 2001 From: dengwc Date: Wed, 3 Apr 2024 14:34:03 +0800 Subject: [PATCH 23/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/in/AutoWorkController.java | 2 +- .../LyOrderRecordExtensionFactory.java | 52 ++++++++++--------- .../order_record/LyStatementOrder.java | 41 +++++++++++++++ 3 files changed, 70 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index f67aa207..f6bca781 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -69,7 +69,7 @@ public class AutoWorkController { public Result autoSaveLYRecord() { //同步拉取上月数据 lyStatementOrder.saveAll(); - //将上月的结算数据生成为财务共享需要的数据 + //将未转换的结算数据生成为财务共享需要的数据 Command.of(LYOrderRecordGenerateCommand.class).sendToQueue(); return Result.Success(SUCCESS); } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index f24d3d74..ce9160f7 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -94,12 +96,12 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor flightFieldCheck(orderFlightRecord, lyOrderFlightRecord); orderFlightRecord.setDetailId(lyOrderFlightRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderFlightRecord.getReserveManName())//票务员 - .setAccountPeriod(lyOrderFlightRecord.getStatementCode())//账期号 + .setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号 .setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号 .setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号 .setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号 .setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号 - .setTicketNo(lyOrderFlightRecord.getTicketNo());//票号 + .setTicketNo(StringUtils.isBlank(lyOrderFlightRecord.getTicketNo()) ? null : lyOrderFlightRecord.getTicketNo().replace("-", ""));//票号 //行程单号 List byOrderNo = orderTravelRepository.findByOrderNo(orderSerialNo); String travelNo = byOrderNo.isEmpty() ? "" : byOrderNo.get(0).getTravelNo(); @@ -170,7 +172,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor hotelFieldCheck(orderHotelRecord, lyOrderHotelRecord); orderHotelRecord.setDetailId(lyOrderHotelRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderHotelRecord.getReserveManName()) //票务员 - .setAccountPeriod(lyOrderHotelRecord.getStatementCode()) //账期号 + .setAccountPeriod(getAccountPeriod(lyOrderHotelRecord.getStatementCode())) //账期号 .setBillNo(lyOrderHotelRecord.getBillOrderNo()) //账单号(结算单号) .setOrderNo(lyOrderHotelRecord.getOrderSerialNo()) //订单号 .setParentOrderNo("") //父级订单号 @@ -240,7 +242,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor trainFieldCheck(orderTrainRecord, lyOrderTrainRecord); orderTrainRecord.setDetailId(lyOrderTrainRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderTrainRecord.getReserveManName()) //票务员 - .setAccountPeriod(lyOrderTrainRecord.getStatementCode()) //账期号 + .setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号 .setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号 .setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号 .setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号 @@ -310,7 +312,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor carFieldCheck(orderCarRecord, lyOrderCarRecord); orderCarRecord.setDetailId(lyOrderCarRecord.getBillOrderNo())//防重标识 .setTicketClerk(lyOrderCarRecord.getReserveManName()) //票务员 - .setAccountPeriod(lyOrderCarRecord.getStatementCode()) //账期号 + .setAccountPeriod(getAccountPeriod(lyOrderCarRecord.getStatementCode())) //账期号 .setBillNo(lyOrderCarRecord.getBillOrderNo()); //账单号 orderCarRecord.setReceiptsNum(getReceiptsNum(lyOrderCarRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 .setReceiptsNumOrigin(lyOrderCarRecord.getOutApplayOrderNo()) //原关联申请单号 @@ -372,6 +374,23 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor return orderRecordFactory.buildWithRouteOrder(routeOrder); } + //获取账期号 202403 + public String getAccountPeriod(String statementCode) { + LocalDate currentDate = LocalDate.now(); + String nowDate = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")); + if (StringUtils.isBlank(statementCode)) { + //如果为空,获取上月赋值 + LocalDate lastMonthDate = currentDate.minusMonths(1); + return lastMonthDate.format(DateTimeFormatter.ofPattern("yyyyMM")); + } + String dateSuffix = statementCode.substring(2, 6); + + String datePrefix = nowDate.substring(0, 2); + System.out.println(datePrefix + dateSuffix); + return datePrefix + dateSuffix; + } + + public void flightFieldCheck(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord) { orderFlightRecord.setTrvaleSysType(TRAVAL_SYS_TYPE_LY)//数据来源商旅平台 XC:携程 TC:同程 .setBookingName(lyOrderFlightRecord.getReserveManName()) //预订人姓名 @@ -465,7 +484,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } //对应所属系统 - private static String findBelongSysType(List itemList, String outApplayOrderNo) { + public String findBelongSysType(List itemList, String outApplayOrderNo) { return itemList.stream() .filter(item -> LY_CUSTOM1.equals(item.getCode())) .findFirst() @@ -476,7 +495,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } //核算企业code - private static Optional findAccountCompanyId(List tripSubmitItemList) { + public Optional findAccountCompanyId(List tripSubmitItemList) { return tripSubmitItemList.stream() .filter(item -> LY_CUSTOM2.equals(item.getCode())) .findFirst() @@ -484,7 +503,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } ////核算企业名称 - private static Optional findAccountCompanyName(List tripSubmitItemList) { + public Optional findAccountCompanyName(List tripSubmitItemList) { return tripSubmitItemList.stream() .filter(item -> LY_CUSTOM3.equals(item.getCode())) .findFirst() @@ -492,7 +511,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } //项目订单号 - private static Optional findProjectOrderNo(List tripSubmitItemList) { + public Optional findProjectOrderNo(List tripSubmitItemList) { return tripSubmitItemList.stream() .filter(item -> LY_CUSTOM4.equals(item.getCode())) .findFirst() @@ -500,21 +519,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor } - private void flightReceiptsNum(OrderFlightRecord orderFlightRecord, LyOrderFlightRecord lyOrderFlightRecord, RouteOrder routeOrder) { - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - String outApplayOrderNo = lyOrderFlightRecord.getOutApplayOrderNo(); - String receiptsNum = ""; - if (Objects.isNull(approveOrderNo) && StringUtils.isNotBlank(outApplayOrderNo)) { - String[] receiptsNums = outApplayOrderNo.split("-"); - if (receiptsNums.length > 1) { - receiptsNum = receiptsNums[1]; - } - } else { - receiptsNum = approveOrderNo.getActualOrderNo(); - } - orderFlightRecord.setReceiptsNum(receiptsNum); - } - //获取财务共享单号 private String getReceiptsNum(String outApplayOrderNo, RouteOrder routeOrder) { ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java index 3866ade9..4c50986d 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java @@ -9,6 +9,7 @@ import com.chint.infrastructure.repository.jdbc.JdbcLyOrderFlightRecord; import com.chint.infrastructure.repository.jdbc.JdbcLyOrderHotelRecord; import com.chint.infrastructure.repository.jdbc.JdbcLyOrderTrainRecord; import com.chint.infrastructure.util.BeanCopyUtils; +import com.chint.interfaces.rest.ly.LYSearchRequest; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseDetailParam; import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.CarStatement; import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement; @@ -47,6 +48,8 @@ public class LyStatementOrder { @Autowired private JdbcLyOrderCarRecord jdbcLyOrderCarRecord; + @Autowired + private LYSearchRequest lySearchRequest; /** * 拉取保存数据 @@ -117,6 +120,7 @@ public class LyStatementOrder { !orderSerialNoList.contains(o.getBillOrderNo()) ).toList(); List lyOrderFlightRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderFlightRecord.class); + //保存结算明细数据 jdbcLyOrderFlightRecord.saveAll(lyOrderFlightRecords); flightCount++; } while (flightCount < flightPageCount); @@ -141,11 +145,13 @@ public class LyStatementOrder { !orderSerialNoList.contains(o.getBillOrderNo()) ).toList(); List lyOrderHotelRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderHotelRecord.class); + //保存结算明细数据 jdbcLyOrderHotelRecord.saveAll(lyOrderHotelRecords); hotelCount++; } while (hotelCount < hotelPageCount); } + /** * 火车账单同步 */ @@ -165,6 +171,7 @@ public class LyStatementOrder { !orderSerialNoList.contains(o.getBillOrderNo()) ).toList(); List lyOrderTrainRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderTrainRecord.class); + //保存结算明细数据 jdbcLyOrderTrainRecord.saveAll(lyOrderTrainRecords); trainCount++; } while (trainCount < trainPageCount); @@ -190,10 +197,44 @@ public class LyStatementOrder { !orderSerialNoList.contains(o.getBillOrderNo()) ).toList(); List lyOrderCarRecords = BeanCopyUtils.copyBeanList(statementOrderListNew, LyOrderCarRecord.class); + //保存结算明细数据 jdbcLyOrderCarRecord.saveAll(lyOrderCarRecords); + carCount++; } while (carCount < carPageCount); } +/* //保存需要的机票订单明细字段 + private void saveLyOrderFlightDetail(List lyOrderFlightRecords) { + lyOrderFlightRecords.forEach(lyOrderFlightRecord -> { + lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo()); + }); + + } + + + //保存需要的酒店订单明细字段 + private void saveLyOrderHotelDetail(List lyOrderHotelRecords) { + lyOrderHotelRecords.forEach(lyOrderHotelRecord -> { + lySearchRequest.getHotelOrderDetail(lyOrderHotelRecord.getOrderSerialNo()); + }); + + } + + //保存需要的火车订单明细字段 + private void saveLyOrderTrainDetail(List lyOrderTrainRecords) { + lyOrderTrainRecords.forEach(lyOrderTrainRecord -> { + lySearchRequest.getTrainOrderDetail(lyOrderTrainRecord.getOrderSerialNo()); + }); + + } + + //保存需要的用车订单明细字段 + private void saveLyOrderCarDetail(List lyOrderCarRecords) { + lyOrderCarRecords.forEach(lyOrderCarRecord -> { + lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo()); + }); + + }*/ } From d7a607571b93bfc906b11c80503db87e6b8fc454 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 15:55:59 +0800 Subject: [PATCH 24/33] =?UTF-8?q?h3bpm=E5=AE=9E=E7=94=A8=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E6=9D=A5=E6=9B=B4=E6=96=B0=E8=A1=8C=E7=A8=8B?= =?UTF-8?q?=E8=A7=84=E5=88=92=E5=8D=95=E5=8F=B7=20=EF=BC=8C=20=E6=90=BA?= =?UTF-8?q?=E7=A8=8B=E6=9C=BA=E7=A5=A8=E7=BB=93=E7=AE=97=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=94=B9=E7=AD=BE=E8=B4=B9=E5=92=8C=E6=94=B9=E7=AD=BE=E5=B7=AE?= =?UTF-8?q?=E4=BB=B7=E8=B4=B9=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ctrip_order_record/CTripFlightRecord.java | 1 + .../CTripOrderRecordExtensionFactory.java | 10 +++++----- .../service/leg_event/LegEventHandler.java | 16 ++++++++++++++++ .../ctrip/order/CTripOrderRecordAutoSave.java | 4 ++++ 4 files changed, 26 insertions(+), 5 deletions(-) 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 77175a55..8fe8346c 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 @@ -20,6 +20,7 @@ public class CTripFlightRecord implements Serializable { private String recordId; public LocalDateTime createTime; private String routeOrderNo; + private String ticketNo; @MappedCollection(idColumn = "c_trip_flight_record_id") private CTripFlightRecordBase cTripFlightRecordBase; @MappedCollection(idColumn = "c_trip_flight_record_id") 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 3d2897b2..c1c44246 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 @@ -288,12 +288,12 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载机票信息 if (cTripFlightTripInfo != null) { - orderFlightRecord.loadTicketInfo(cTripFlightTripInfo.getTicketNo(), + orderFlightRecord.loadTicketInfo(cTripFlightRecord.getTicketNo(), String.valueOf(cTripFlightRecordBase.getPrice()), cTripFlightTripInfo.getTicketNoStatusName()); } else { - orderFlightRecord.loadTicketInfo(String.valueOf(cTripFlightRecordBase.getPrice()), - "", + orderFlightRecord.loadTicketInfo(cTripFlightRecord.getTicketNo(), + String.valueOf(cTripFlightRecordBase.getPrice()), "无机票信息"); } @@ -317,9 +317,9 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载费用信息, 服务费, 改签费, 退票费 , 升舱费 orderFlightRecord.loadExtraFeeInfo(String.valueOf(cTripFlightRecordBase.getPostServiceFee()), - String.valueOf(cTripFlightRecordBase.getRebookQueryFee()), + String.valueOf(cTripFlightRecordBase.getDateChangeFee()), String.valueOf(cTripFlightRecordBase.getRefund()), - cTripFlightRecordBase.getOrderDetailType().equals("改签") ? String.valueOf(cTripFlightRecordBase.getAmount()) : KEEP_TWO_DECIMAL_ZERO, + String.valueOf(cTripFlightRecordBase.getPriceDifferential()), String.valueOf(cTripFlightRecordBase.getSettItineraryFee())); // 加载来源 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 53539e4d..f6b272b6 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 @@ -23,11 +23,13 @@ import com.chint.infrastructure.constant.LegConstant; import com.chint.infrastructure.constant.RouteConstant; import com.chint.infrastructure.echo_framework.dispatch.ResultContainer; import com.chint.infrastructure.util.BaseContext; +import com.chint.infrastructure.util.OrderNo; import com.chint.interfaces.rest.bpm.BPMRequest; import com.chint.interfaces.rest.bpm.dto.JTH3ChangeDto; import com.chint.interfaces.rest.bpm.dto.XNChangeDto; import com.chint.interfaces.rest.bpm.dto.ZWChangeDto; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -86,6 +88,10 @@ public class LegEventHandler implements LegEventService { @Autowired private OrderDomainService orderDomainService; + @Value("${chint.envMark}") + private String envMark; + + private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); private DateTimeFormatter formatterWithT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'hh:mm"); @@ -130,6 +136,16 @@ public class LegEventHandler implements LegEventService { String startTime = data.getStartTime(); String endTime = data.getEndTime(); + //当sysCode为H3BPM的时候 ,实用单号更新行程规划单的单号 + if (data.getSysCode().equals(H3_BPM)) { + String generate = OrderNo.generate(H3_BPM, data.getActualOrderNo()); + if (!envMark.equals("prod")) { + routeOrder.setRouteOrderNo(generate + envMark); + } else { + routeOrder.setRouteOrderNo(generate); + } + } + if (startTime != null && endTime != null) { if (startTime.contains("T") && endTime.contains("T")) { //如果包含T,就截取时间信息前10位 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 29e8a489..ece19103 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 @@ -80,6 +80,10 @@ public class CTripOrderRecordAutoSave { //补充额外的字段 OrderFlightResponse.FlightOrderBaseInfo orderBaseInfo = it.getOrderBaseInfo(); record.setRouteOrderNo(orderBaseInfo.getJourneyID()); + OrderFlightResponse.FlightOrderPassenger orderPassengerInfo = it.getOrderPassengerInfo(); + if(orderPassengerInfo != null){ + record.setTicketNo(orderPassengerInfo.getTicketNo()); + } return record; }).toList(); cTripOrderDetailRepository.saveAllCTripFlightRecord(cTripFlightRecords); From 41e0ee390680cdef901f0e3bcce2851c4c545b15 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 3 Apr 2024 17:14:36 +0800 Subject: [PATCH 25/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chint/domain/aggregates/user/User.java | 17 ++- .../aggregates/user/UserDepartmentInfo.java | 133 +++++++++++++++++- .../CTripOrderRecordExtensionFactory.java | 6 +- 3 files changed, 148 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index 2f6f8f50..f18560d3 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -6,7 +6,6 @@ import com.chint.domain.aggregates.system.FsscSystem; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.constant.AuthMessageConstant; import com.chint.interfaces.rest.base.PostRequest; -import com.chint.interfaces.rest.user.PushUser; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.AllArgsConstructor; @@ -47,7 +46,7 @@ public class User implements Serializable { private String password; private LocalDateTime syncTime; @MappedCollection(idColumn = "user_id", keyColumn = "user_key") - private List userDepartmentInfo; + private List userDepartmentInfoList; @Transient private List fsscSystemList; @Transient @@ -73,9 +72,16 @@ public class User implements Serializable { } -// public User addDeptInfo(){ -// -// } + public User addDeptInfo(UserDepartmentInfo userDepartmentInfo) { + if (this.userDepartmentInfoList == null) { + this.userDepartmentInfoList = new ArrayList<>(); + } + if (userDepartmentInfo.getIfPrimary().equals(1) && !this.userDepartmentInfoList.isEmpty()) { + this.userDepartmentInfoList.forEach(it -> it.setIfPrimary(0)); + } + this.userDepartmentInfoList.add(userDepartmentInfo); + return this; + } public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) { this.userId = userId; @@ -109,7 +115,6 @@ public class User implements Serializable { } - public User addFssc(String CompanyName, String sysCode) { FsscSystem fsscSystem = new FsscSystem(CompanyName, sysCode); this.addFsscSystemToList(fsscSystem); diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java index 138a3c24..51ab774e 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -34,6 +34,137 @@ public class UserDepartmentInfo implements Serializable { private String departmentNameSeven; private Integer ifPrimary; - // Builder static inner class + public Builder start(User user) { + return new Builder(user); + } + + public UserDepartmentInfo(String companyCode, String companyName, String departmentCodeOne, + String departmentNameOne, String departmentCodeTwo, String departmentNameTwo, + String departmentCodeThree, String departmentNameThree, String departmentCodeFour, + String departmentNameFour, String departmentCodeFive, String departmentNameFive, + String departmentCodeSix, String departmentNameSix, String departmentCodeSeven, + String departmentNameSeven, Integer ifPrimary) { + this.companyCode = companyCode; + this.companyName = companyName; + this.departmentCodeOne = departmentCodeOne; + this.departmentNameOne = departmentNameOne; + this.departmentCodeTwo = departmentCodeTwo; + this.departmentNameTwo = departmentNameTwo; + this.departmentCodeThree = departmentCodeThree; + this.departmentNameThree = departmentNameThree; + this.departmentCodeFour = departmentCodeFour; + this.departmentNameFour = departmentNameFour; + this.departmentCodeFive = departmentCodeFive; + this.departmentNameFive = departmentNameFive; + this.departmentCodeSix = departmentCodeSix; + this.departmentNameSix = departmentNameSix; + this.departmentCodeSeven = departmentCodeSeven; + this.departmentNameSeven = departmentNameSeven; + this.ifPrimary = ifPrimary; + } + + @Data + public static class Builder { + private User user; + private String companyCode; + private String companyName; + private String departmentCodeOne; + private String departmentNameOne; + private String departmentCodeTwo; + private String departmentNameTwo; + private String departmentCodeThree; + private String departmentNameThree; + private String departmentCodeFour; + private String departmentNameFour; + private String departmentCodeFive; + private String departmentNameFive; + private String departmentCodeSix; + private String departmentNameSix; + private String departmentCodeSeven; + private String departmentNameSeven; + private Integer ifPrimary; + + public Builder(User user) { + this.user = user; + } + + public Builder companyInfo(String companyCode, String companyName) { + this.companyCode = companyCode; + this.companyName = companyName; + return this; + } + + public Builder deptOne(String departmentCodeOne, String departmentNameOne) { + this.departmentCodeOne = departmentCodeOne; + this.departmentNameOne = departmentNameOne; + return this; + } + + public Builder deptTwo(String departmentCodeTwo, String departmentNameTwo) { + this.departmentCodeTwo = departmentCodeTwo; + this.departmentNameTwo = departmentNameTwo; + return this; + } + + public Builder deptThree(String departmentCodeThree, String departmentNameThree) { + this.departmentCodeThree = departmentCodeThree; + this.departmentNameThree = departmentNameThree; + return this; + } + + public Builder deptFour(String departmentCodeFour, String departmentNameFour) { + this.departmentCodeFour = departmentCodeFour; + this.departmentNameFour = departmentNameFour; + return this; + } + + public Builder deptFive(String departmentCodeFive, String departmentNameFive) { + this.departmentCodeFive = departmentCodeFive; + this.departmentNameFive = departmentNameFive; + return this; + } + + public Builder deptSix(String departmentCodeSix, String departmentNameSix) { + this.departmentCodeSix = departmentCodeSix; + this.departmentNameSix = departmentNameSix; + return this; + } + + public Builder primary() { + this.ifPrimary = 1; + return this; + } + + public Builder deptSeven(String departmentCodeSeven, String departmentNameSeven) { + this.departmentCodeSeven = departmentCodeSeven; + this.departmentNameSeven = departmentNameSeven; + return this; + } + + public UserDepartmentInfo addToUser() { + UserDepartmentInfo userDepartmentInfo = new UserDepartmentInfo(companyCode, + companyName, + departmentCodeOne, + departmentNameOne, + departmentCodeTwo, + departmentNameTwo, + departmentCodeThree, + departmentNameThree, + departmentCodeFour, + departmentNameFour, + departmentCodeFive, + departmentNameFive, + departmentCodeSix, + departmentNameSix, + departmentCodeSeven, + departmentNameSeven, + ifPrimary); + if (userDepartmentInfo.getIfPrimary() == null || userDepartmentInfo.getIfPrimary() != 1) { + userDepartmentInfo.setIfPrimary(0); + } + user.addDeptInfo(userDepartmentInfo); + return userDepartmentInfo; + } + } } 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 c1c44246..f11cd154 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 @@ -288,7 +288,11 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac // 加载机票信息 if (cTripFlightTripInfo != null) { - orderFlightRecord.loadTicketInfo(cTripFlightRecord.getTicketNo(), + String ticketNo = cTripFlightRecord.getTicketNo(); + if (ticketNo != null) { + ticketNo = ticketNo.replace("-", ""); + } + orderFlightRecord.loadTicketInfo(ticketNo, String.valueOf(cTripFlightRecordBase.getPrice()), cTripFlightTripInfo.getTicketNoStatusName()); } else { From 2dfc9e0490b1a75344493bbf689381d82d0cd4ab Mon Sep 17 00:00:00 2001 From: dengwc Date: Wed, 3 Apr 2024 17:32:53 +0800 Subject: [PATCH 26/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LyOrderRecordExtensionFactory.java | 22 ++++++++---- .../order_record/LyStatementOrder.java | 35 +++++++++++-------- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index ce9160f7..712940f1 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -8,6 +8,7 @@ import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.*; import com.chint.infrastructure.repository.jdbc.*; import com.chint.infrastructure.util.BeanCopyUtils; +import com.chint.interfaces.rest.bpm.dto.BPMResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -22,8 +23,9 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; -import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_LY; +import static com.chint.infrastructure.constant.BelongSystemConstant.*; import static com.chint.infrastructure.constant.OrderRecordConstant.*; +import static com.chint.infrastructure.constant.RankConstant.OUT_OF_STANDARD; /** * 同程数据转换 @@ -133,7 +135,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setPreServiceFee(String.valueOf(lyOrderFlightRecord.getServiceAmount())) //服务费 .setPostServiceFee("") //配送服务费 .setAirportTax(String.valueOf(lyOrderFlightRecord.getCapitalCost())) //机建费 - .setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee())) //改签手续费 + .setChangeFee(String.valueOf(lyOrderFlightRecord.getChangeFee() - lyOrderFlightRecord.getUpgradeFee())) //改签手续费 .setFuelTax(String.valueOf(lyOrderFlightRecord.getFuelCost())) //燃油费 .setRefundFee(String.valueOf(lyOrderFlightRecord.getRefundFee())) //退票手续费 .setUpFee(String.valueOf(lyOrderFlightRecord.getUpgradeFee())) //改签差价 @@ -371,7 +373,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor if (Objects.isNull(routeOrder)) { return new OrderRecordBasic(); } - return orderRecordFactory.buildWithRouteOrder(routeOrder); +// return orderRecordFactory.buildWithRouteOrder(routeOrder); + return new OrderRecordBasic(); } //获取账期号 202403 @@ -485,13 +488,20 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor //对应所属系统 public String findBelongSysType(List itemList, String outApplayOrderNo) { - return itemList.stream() + String sysCode = itemList.stream() .filter(item -> LY_CUSTOM1.equals(item.getCode())) .findFirst() - .map(TripSubmitItemList::getContent) + .map(item -> StringUtils.isBlank(item.getContent()) ? null : item.getContent()) .orElseGet(() -> Optional.ofNullable(outApplayOrderNo) .map(no -> no.split("-")[0]) - .orElse("")); + .orElse("NOT")); + return switch (sysCode) { + case BELONG_SYS_CODE_FSSC -> BELONG_SYS_TYPE_FSSC; + case BELONG_SYS_CODE_H3BPM -> BELONG_SYS_TYPE_H3BPM; + case BELONG_SYS_CODE_XNFSSC -> BELONG_SYS_TYPE_XNFSSC; + case BELONG_SYS_CODE_ANFSSC -> BELONG_SYS_TYPE_ANFSSC; + default -> "NOT"; + }; } //核算企业code diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java index 4c50986d..cf86ff09 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyStatementOrder.java @@ -25,6 +25,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; @@ -85,16 +86,22 @@ public class LyStatementOrder { ResStatementList resStatementList = reqStatement.queryStatementList(statementList); log.info("resStatementList: {}", resStatementList); ArrayList onlineStatementList = resStatementList.getData().getOnlineStatementList(); + // 获取当前时间 + LocalDate now = LocalDate.now(); + LocalDate startDate = now.minusMonths(2).withDayOfMonth(1); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String startTime = startDate.atStartOfDay().format(formatter); + String endTime = LocalDateTime.now().format(formatter); for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) { String statementCode = onlineStatement.getStatementCode();//对账单编码 //1.查询机票账单详情 - flightStatement(statementCode, beginDate, endDate); + flightStatement(statementCode, startTime, endTime); //2.查询酒店账单详情 - hotelStatement(statementCode, beginDate, endDate); + hotelStatement(statementCode, startTime, endTime); //3.查询火车票账单详情 - trainStatement(statementCode, beginDate, endDate); + trainStatement(statementCode, startTime, endTime); //4.查询用车账单详情 - carStatement(statementCode, beginDate, endDate); + carStatement(statementCode, startTime, endTime); } log.info("保存成功!"); @@ -103,7 +110,7 @@ public class LyStatementOrder { /** * 飞机账单同步 */ - public void flightStatement(String statementCode, String beginDate, String endDate) { + public void flightStatement(String statementCode, String startTime, String endTime) { int flightCount = 0;//初始化变量 int flightPageCount;//飞机总分页数 do { @@ -114,7 +121,7 @@ public class LyStatementOrder { //保存数据 List statementOrderList = flightStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -129,7 +136,7 @@ public class LyStatementOrder { /** * 酒店账单同步 */ - public void hotelStatement(String statementCode, String beginDate, String endDate) { + public void hotelStatement(String statementCode, String startTime, String endTime) { int hotelCount = 0;//初始化变量 int hotelPageCount;//酒店总分页数 do { @@ -139,7 +146,7 @@ public class LyStatementOrder { //保存数据 List statementOrderList = hotelStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -155,7 +162,7 @@ public class LyStatementOrder { /** * 火车账单同步 */ - public void trainStatement(String statementCode, String beginDate, String endDate) { + public void trainStatement(String statementCode, String startTime, String endTime) { int trainCount = 0;//初始化变量 int trainPageCount;//酒店总分页数 do { @@ -165,7 +172,7 @@ public class LyStatementOrder { //保存数据 List statementOrderList = trainStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -181,7 +188,7 @@ public class LyStatementOrder { /** * 用车账单同步 */ - public void carStatement(String statementCode, String beginDate, String endDate) { + public void carStatement(String statementCode, String startTime, String endTime) { int carCount = 0;//初始化变量 int carPageCount;//酒店总分页数 do { @@ -191,7 +198,7 @@ public class LyStatementOrder { //保存数据 List statementOrderList = carStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(beginDate, endDate); + List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -205,7 +212,7 @@ public class LyStatementOrder { } -/* //保存需要的机票订单明细字段 + //保存需要的机票订单明细字段 private void saveLyOrderFlightDetail(List lyOrderFlightRecords) { lyOrderFlightRecords.forEach(lyOrderFlightRecord -> { lySearchRequest.getFlightOrderDetail(lyOrderFlightRecord.getOrderSerialNo()); @@ -236,5 +243,5 @@ public class LyStatementOrder { lySearchRequest.getCarDetailResponse(lyOrderCarRecord.getOrderSerialNo()); }); - }*/ + } } From d500c7e701b27dbed2352ad2814ffa0552c9966f Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Thu, 4 Apr 2024 16:20:51 +0800 Subject: [PATCH 27/33] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=BD=BD=E5=85=A5=E9=83=A8=E9=97=A8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/out/LoginController.java | 19 +---- .../domain/aggregates/order/RouteOrder.java | 2 + .../order/RouterOrderExtensionField.java | 26 ++++++ .../order/order_record/OrderCarRecord.java | 8 ++ .../order/order_record/OrderFlightRecord.java | 8 ++ .../order/order_record/OrderHotelRecord.java | 8 ++ .../order/order_record/OrderTrainRecord.java | 8 ++ .../chint/domain/aggregates/user/User.java | 62 ++++++++++++++ .../aggregates/user/UserDepartmentInfo.java | 2 +- .../CTripOrderRecordExtensionFactory.java | 48 ++++++++++- .../interfaces/rest/user/UserHttpRequest.java | 2 + .../rest/user/UserHttpRequestImpl.java | 80 ++++++++++++------- 12 files changed, 223 insertions(+), 50 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/order/RouterOrderExtensionField.java diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java index d09f78bf..aa1efbde 100644 --- a/src/main/java/com/chint/application/out/LoginController.java +++ b/src/main/java/com/chint/application/out/LoginController.java @@ -30,13 +30,9 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; -import java.time.Duration; import java.time.LocalDateTime; import java.util.concurrent.CompletableFuture; -import static com.chint.infrastructure.constant.BPMConstant.AN_FSSC; -import static com.chint.infrastructure.constant.BPMConstant.FSSC; - @Slf4j @RestController @RequestMapping("/public") @@ -200,20 +196,7 @@ public class LoginController { private void syncUserInfoToSupplier(User user) { // 给定的 LocalDateTime 实例,示例中为2024年3月1日15:00 - LocalDateTime lastSyncTime = user.getSyncTime(); - - if (lastSyncTime == null) { - asyncUser(user); - return; - } - // 获取当前时间 - LocalDateTime now = LocalDateTime.now(); - - // 计算当前时间与给定时间之间的持续时间 - Duration duration = Duration.between(lastSyncTime, now); - - // 判断是否超过一天 - if (duration.toDays() >= 1) { + if (user.checkSyncTime()) { asyncUser(user); } else { log.info("未超过一天,不执行同步。"); diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index 83abd914..3e88d7c7 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -78,6 +78,8 @@ public class RouteOrder implements Serializable { @Transient private String supplierCNName; + @MappedCollection(idColumn = "route_id") + private RouterOrderExtensionField routerOrderExtensionField; @MappedCollection(idColumn = "route_id", keyColumn = "route_order_key") private List legItems; diff --git a/src/main/java/com/chint/domain/aggregates/order/RouterOrderExtensionField.java b/src/main/java/com/chint/domain/aggregates/order/RouterOrderExtensionField.java new file mode 100644 index 00000000..29dfb26f --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/order/RouterOrderExtensionField.java @@ -0,0 +1,26 @@ +package com.chint.domain.aggregates.order; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Column; +import org.springframework.data.relational.core.mapping.Table; + +import java.io.Serial; +import java.io.Serializable; + + +@Data +@Table("route_order_extension_field") +public class RouterOrderExtensionField implements Serializable { + + @Serial + private static final long serialVersionUID = 2212312435311609990L; + @Id + private Long id; + @Column("route_id") + private Long routeId; + + private String belongDeptCode; + + +} diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index c0df4fcf..6c76a6be 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -71,8 +71,16 @@ public class OrderCarRecord extends OrderBaseRecord { private String orderSource; // 预订来源:线上/线下 private String payAmount;//支付总金额 private String receiptsNumOrigin;//支付总金额 + private String belongDeport; //归属部门 + public OrderCarRecord loadBelongDeport(String belongDeport + ) { + // 行程信息 + this.setBelongDeport(belongDeport); + return this; + } + //添加行程信息 public OrderCarRecord loadTravelInfo(String startTime, String arriveTime, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 5967781b..b27dc60d 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -80,6 +80,14 @@ public class OrderFlightRecord extends OrderBaseRecord { private String createTime; private String receiptsNumOrigin;//原差旅申请单单号 private String payAmount; + private String belongDeport; //归属部门 + + public OrderFlightRecord loadBelongDeport(String belongDeport + ) { + // 行程信息 + this.setBelongDeport(belongDeport); + return this; + } // 加载基础订单信息 public OrderFlightRecord loadBasicOrderInfo(String orderNo, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index befe93e2..52acf941 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -79,6 +79,14 @@ public class OrderHotelRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//支付总金额 + private String belongDeport; //归属部门 + + public OrderHotelRecord loadBelongDeport(String belongDeport + ) { + // 行程信息 + this.setBelongDeport(belongDeport); + return this; + } // 加载基础订单信息 public OrderHotelRecord loadBasicOrderInfo(String orderNo, diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index 7387fd4b..d9a30807 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -73,6 +73,14 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String trainTime; // 发车时间 yyyy-MM-dd HH:‌mm:ss private String yxId; // 影像比对ID private String receiptsNumOrigin;//原差旅申请单单号 + private String belongDeport; //归属部门 + + public OrderTrainRecord loadBelongDeport(String belongDeport + ) { + // 行程信息 + this.setBelongDeport(belongDeport); + return this; + } // 加载基础订单信息 public OrderTrainRecord loadBasicOrderInfo(Long id, String orderNo, String orderStatus, String createTime) { this.setId(id); diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index f18560d3..09050fda 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -19,10 +19,12 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; import java.lang.reflect.Type; +import java.time.Duration; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; import static com.chint.infrastructure.constant.AuthMessageConstant.USER_FSSC_SYSTEM_LIST; import static com.chint.infrastructure.constant.BPMConstant.*; @@ -72,6 +74,66 @@ public class User implements Serializable { } + public UserDepartmentInfo.Builder addDeptInfo() { + return new UserDepartmentInfo.Builder(this); + } + + public String lowestDeptCode() { + Optional first = this.userDepartmentInfoList + .stream() + .filter(it -> it.getIfPrimary() == 1) + .findFirst(); + return first.map(this::lowestDept).orElse(null); + } + + public String lowestDeptCode(String companyName) { + Optional first = this.userDepartmentInfoList + .stream() + .filter(it -> it.getCompanyName().equals(companyName)) + .findFirst(); + return first.map(this::lowestDept).orElse(null); + } + + private String lowestDept(UserDepartmentInfo userDepartmentInfo) { + if (userDepartmentInfo.getDepartmentCodeSeven() != null) { + return userDepartmentInfo.getDepartmentCodeSeven(); + } + if (userDepartmentInfo.getDepartmentCodeSix() != null) { + return userDepartmentInfo.getDepartmentCodeSix(); + } + if (userDepartmentInfo.getDepartmentCodeFive() != null) { + return userDepartmentInfo.getDepartmentCodeFive(); + } + if (userDepartmentInfo.getDepartmentCodeFour() != null) { + return userDepartmentInfo.getDepartmentCodeFour(); + } + if (userDepartmentInfo.getDepartmentCodeThree() != null) { + return userDepartmentInfo.getDepartmentCodeThree(); + } + if (userDepartmentInfo.getDepartmentCodeTwo() != null) { + return userDepartmentInfo.getDepartmentCodeTwo(); + } + if (userDepartmentInfo.getDepartmentCodeOne() != null) { + return userDepartmentInfo.getDepartmentCodeOne(); + } + if (userDepartmentInfo.getCompanyCode() != null) { + return userDepartmentInfo.getCompanyCode(); + } + return null; + } + + public Boolean checkSyncTime() { + if (this.syncTime == null) { + return true; + } + // 获取当前时间 + LocalDateTime now = LocalDateTime.now(); + // 计算当前时间与给定时间之间的持续时间 + Duration duration = Duration.between(syncTime, now); + // 判断是否超过一天 + return duration.toDays() >= 1; + } + public User addDeptInfo(UserDepartmentInfo userDepartmentInfo) { if (this.userDepartmentInfoList == null) { this.userDepartmentInfoList = new ArrayList<>(); diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java index 51ab774e..6127bfd3 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -63,7 +63,7 @@ public class UserDepartmentInfo implements Serializable { this.ifPrimary = ifPrimary; } - @Data + public static class Builder { private User user; private String companyCode; 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 f11cd154..4f3c246e 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 @@ -7,11 +7,14 @@ 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.*; +import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.RouteRepository; +import com.chint.domain.repository.UserRepository; import com.chint.domain.service.OrderDetailDomainService; import com.chint.infrastructure.repository.jdbc.JdbcCtripHotelOrderDetailRepository; import com.chint.infrastructure.util.DateTimeUtil; +import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -35,6 +38,11 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac @Autowired private LocationRepository locationRepository; + @Autowired + private UserRepository userRepository; + @Autowired + private UserHttpRequest userHttpRequest; + private OrderRecordBasic buildWithRecord(CTripCarRecord cTripCarRecord) { OrderRecordBasic orderRecordBasic = new OrderRecordBasic(); CTripCarPassengerInfo cTripCarPassengerInfo = cTripCarRecord.getCTripCarPassengerInfo(); @@ -66,7 +74,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac } else { orderRecordBasic.setBelongSysType(BELONG_SYS_TYPE_NOT); } - return orderRecordBasic; } @@ -173,6 +180,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac "", cTripCarRecordBase.getCreateTime())); + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = byOrderNo + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderCarRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderCarRecord.loadBelongDeport( + belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName()) + )); + return orderCarRecord; } @@ -367,6 +382,15 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), "", cTripFlightRecordBase.getCreateTime())); + + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = byOrderNo + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderFlightRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderFlightRecord.loadBelongDeport( + belongDeport(orderFlightRecord.getBookingUserCode(), orderFlightRecord.getAccountCompanyName()) + )); return orderFlightRecord; } @@ -553,6 +577,28 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac cTripHotelOrderDetail.getDept2(), cTripHotelOrderDetail.getDept3()); + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = byOrderNo + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderHotelRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderHotelRecord.loadBelongDeport( + belongDeport(orderHotelRecord.getBookingUserCode(), orderHotelRecord.getAccountCompanyName()) + )); return orderHotelRecord; } + + private String belongDeport(String accountCompanyName, String employeeNo) { + User user = userRepository.findByUserEmployeeNo(employeeNo); + if (user.getUserDepartmentInfoList() == null || user.getUserDepartmentInfoList().isEmpty()) { + userHttpRequest.loadUserDeptInfo(user); + } + String deptCode = user.lowestDeptCode(accountCompanyName); + if (deptCode == null) { + //根据入账公司没有找到部门编码的话,直接获取主岗编码 + deptCode = user.lowestDeptCode(); + } + //清除部门编码里面的字母 + return deptCode.replaceAll("\\D", ""); + } } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java index 9566c07f..41092f5e 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java @@ -4,4 +4,6 @@ import com.chint.domain.aggregates.user.User; public interface UserHttpRequest { User loadUserInfo(User user); + + User loadUserDeptInfo(User user); } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index da97aaa0..fd72becd 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -4,8 +4,10 @@ package com.chint.interfaces.rest.user; import com.chint.domain.aggregates.standards.Ranks; import com.chint.domain.aggregates.standards.StaffRank; import com.chint.domain.aggregates.user.User; +import com.chint.domain.aggregates.user.UserDepartmentInfo; import com.chint.domain.repository.JTCompanyRepository; import com.chint.domain.repository.StaffRankRepository; +import com.chint.domain.repository.UserRepository; import com.chint.domain.service.JTCompanyDomainService; import com.chint.domain.service.RankDomainService; import com.chint.infrastructure.constant.SFConstant; @@ -57,10 +59,12 @@ public class UserHttpRequestImpl implements UserHttpRequest { @Autowired private JTCompanyRepository jtCompanyRepository; - @Value("${sf.systemId}") private String systemId; + @Autowired + private UserRepository userRepository; + @Override public User loadUserInfo(User user) { loadSFInfo(user); @@ -115,20 +119,13 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private User loadSingleSF(UserDataDTO userData, User user) { - getDataFromUserSFData(user, userData); - String sysCode = jtCompanyDomainService.findSystemCodeByCompanyCode(user.getCompanyCode()); - user.addFssc(userData.getCompany_cn(), sysCode); -// if (user.getCompanyCode().equals(XN_COMPANY_CODE)) { -// user.addXNFssc(FSSC_LOAD_URL, postRequest); -// } -// //如果用户的公司编码属于集团 ,那么加入集团财务共享跳转地址 -// if (jtCompanyDomainService.ifCompanyInJT(null, userData.getCompany())) { -// user.addJTFssc(userData.getCompany_cn(), FSSC_LOAD_URL, postRequest); -// } - + //根据同步时间来决定是否要同步部门信息 + if (user.checkSyncTime()) { + addDeptInfo(userData, user, true); + } return user; } @@ -153,6 +150,30 @@ public class UserHttpRequestImpl implements UserHttpRequest { // 检查并处理JT公司和XN公司的特殊情况 processSpecialCompanies(userDataDTOS, user); + for (UserDataDTO userDataDTO : userDataDTOS) { + if (userDataDTO.getPersonIdExternal().equals(userDataDTO.getLoginUsername())) { + addDeptInfo(userDataDTO, user, true); + } else { + addDeptInfo(userDataDTO, user, false); + } + } + return user; + } + + private User addDeptInfo(UserDataDTO userData, User user, Boolean ifPrimary) { + UserDepartmentInfo.Builder builder = user.addDeptInfo() + .companyInfo(userData.getCompany(), userData.getCompany_cn()) + .deptOne(userData.getUnit1(), userData.getUnit1_cn()) + .deptTwo(userData.getUnit2(), userData.getUnit2_cn()) + .deptThree(userData.getUnit3(), userData.getUnit3_cn()) + .deptFour(userData.getUnit4(), userData.getUnit4_cn()) + .deptFive(userData.getUnit5(), userData.getUnit5_cn()) + .deptSix(null, null) + .deptSeven(null, null); + if (ifPrimary) { + builder.primary(); + } + builder.addToUser(); return user; } @@ -172,24 +193,6 @@ public class UserHttpRequestImpl implements UserHttpRequest { list.forEach(it -> user.addFssc(it.getCompany_cn(), jtCompanyDomainService.findSystemCodeByCompanyCode(it.getCompany()))); -// Set companyCodes = userDataDTOS.stream() -// .map(UserDataDTO::getCompany) -// .collect(Collectors.toSet()); -// -// -// List inJtCompanyCodes = companyCodes -// .stream() -// .filter(code -> jtCompanyDomainService.ifCompanyInJT(null, code)) -// .toList(); -// -// for (String inJtCompanyCode : inJtCompanyCodes) { -// JTCompany byCompanyCode = jtCompanyRepository.findByCompanyCode(inJtCompanyCode); -// user.addJTFssc(byCompanyCode.getCompanyName(), FSSC_LOAD_URL, postRequest); -// } -// -// if (companyCodes.contains(XN_COMPANY_CODE)) { -// user.addXNFssc(FSSC_LOAD_URL, postRequest); -// } } private User getDataFromUserSFData(User user, UserDataDTO userData) { @@ -205,4 +208,21 @@ public class UserHttpRequestImpl implements UserHttpRequest { return user; } + public User loadUserDeptInfo(User user) { + List userDataDTOList = userSFRequest.getUserSFDataFromOpenApi(user); + if (userDataDTOList != null && userDataDTOList.size() == 1) { + addDeptInfo(userDataDTOList.get(0), user, true); + } + + if (userDataDTOList != null && userDataDTOList.size() > 1) { + for (UserDataDTO userDataDTO : userDataDTOList) { + if (userDataDTO.getPersonIdExternal().equals(userDataDTO.getLoginUsername())) { + addDeptInfo(userDataDTO, user, true); + } else { + addDeptInfo(userDataDTO, user, false); + } + } + } + return userRepository.save(user); + } } \ No newline at end of file From 276c05ee72aae59121e06beaedf2c1a05f8d658d Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 4 Apr 2024 16:55:43 +0800 Subject: [PATCH 28/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CTripOrderRecordExtensionFactory.java | 8 +++++++- .../rest/user/UserHttpRequestImpl.java | 19 ++++++++++++++----- .../interfaces/rest/user/UserSFRequest.java | 3 +++ 3 files changed, 24 insertions(+), 6 deletions(-) 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 4f3c246e..48ef9945 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 @@ -588,8 +588,14 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac return orderHotelRecord; } - private String belongDeport(String accountCompanyName, String employeeNo) { + private String belongDeport(String employeeNo, String accountCompanyName) { User user = userRepository.findByUserEmployeeNo(employeeNo); + if (user == null) { + user = userHttpRequest.loadUserInfo(User.withEmployeeNo(employeeNo)); + if (user == null) { + return null; + } + } if (user.getUserDepartmentInfoList() == null || user.getUserDepartmentInfoList().isEmpty()) { userHttpRequest.loadUserDeptInfo(user); } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index fd72becd..407f7828 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -68,6 +68,9 @@ public class UserHttpRequestImpl implements UserHttpRequest { @Override public User loadUserInfo(User user) { loadSFInfo(user); + if (user == null) { + return null; + } return loadRankCode(user); } @@ -104,8 +107,12 @@ public class UserHttpRequestImpl implements UserHttpRequest { } private User loadSFInfo(User user) { - List fromJson = userSFRequest - .getUserSFDataFromOpenApi(user) + List userSFDataFromOpenApi = userSFRequest + .getUserSFDataFromOpenApi(user); + if (userSFDataFromOpenApi == null) { + return null; + } + List fromJson = userSFDataFromOpenApi .stream() .filter(userDataDTO -> userDataDTO.getStatus().equals("A")) .toList(); @@ -210,11 +217,13 @@ public class UserHttpRequestImpl implements UserHttpRequest { public User loadUserDeptInfo(User user) { List userDataDTOList = userSFRequest.getUserSFDataFromOpenApi(user); - if (userDataDTOList != null && userDataDTOList.size() == 1) { + if (userDataDTOList == null) { + return null; + } + if (userDataDTOList.size() == 1) { addDeptInfo(userDataDTOList.get(0), user, true); } - - if (userDataDTOList != null && userDataDTOList.size() > 1) { + if (userDataDTOList.size() > 1) { for (UserDataDTO userDataDTO : userDataDTOList) { if (userDataDTO.getPersonIdExternal().equals(userDataDTO.getLoginUsername())) { addDeptInfo(userDataDTO, user, true); diff --git a/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java b/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java index 6745b4d9..5faacc02 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserSFRequest.java @@ -69,6 +69,9 @@ public class UserSFRequest { DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); Type type = new TypeToken>() { }.getType(); + if(result.getData() == null){ + return null; + } List userDataDTOs = gson.fromJson(result.getData().toString(), type); if (result.getData() != null) { return userDataDTOs; From 293a090d8b5c1a532f2d8aee0cec027d46e8cc80 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Thu, 4 Apr 2024 17:06:12 +0800 Subject: [PATCH 29/33] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=83=A8=E9=97=A8=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/user/UserHttpRequestImpl.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 407f7828..1a61eaf9 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -139,7 +139,22 @@ public class UserHttpRequestImpl implements UserHttpRequest { private User loadBatchSF(List userDataDTOS, User user) { // 获取公司代码,优先从用户获取,若为空则从登录参数中获取 String companyCode = Optional.ofNullable(user.getCompanyCode()) - .orElseGet(() -> BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode()); + .orElseGet(() -> + { + User currentUser = BaseContext.getCurrentUser(); + if (currentUser != null && + currentUser.getUserLoginParam() != null && + currentUser.getUserLoginParam().getCompanyCode() != null) { + return currentUser.getUserLoginParam().getCompanyCode(); + } else { + //如果不存在登录信息,那么获取用户的主岗信息 + Optional userDataDTO = userDataDTOS + .stream() + .filter(it -> it.getPersonIdExternal().equals(it.getLoginUsername())) + .findFirst(); + return userDataDTO.map(UserDataDTO::getCompany).orElse(null); + } + }); // 根据公司代码获取对应的UserDataDTO Predicate matchCompanyCode = StringCheck.isFirstCharacterChinese(companyCode) ? From 8084bda3c0a84cc47079944216341e2db06eec0b Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sat, 6 Apr 2024 13:03:55 +0800 Subject: [PATCH 30/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=86=8D=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=83=A8=E9=97=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infrastructure/repository/JTCompanyRepositoryImpl.java | 6 +----- .../repository/jdbc/JdbcJTCompanyRepositoryImpl.java | 4 ++++ .../com/chint/interfaces/rest/user/UserHttpRequestImpl.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java index 6dcaa0fe..53952109 100644 --- a/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/JTCompanyRepositoryImpl.java @@ -17,11 +17,7 @@ public class JTCompanyRepositoryImpl implements JTCompanyRepository { @Override public List findAll() { - List all = new ArrayList<>(); - jdbcJTCompanyRepository.findAll().forEach( - all::add - ); - return all; + return jdbcJTCompanyRepository.findBySystemCodeId(1L); } @Cacheable(value = "JTCompanyByCompanyCode" , key = "#companyCode") diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcJTCompanyRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcJTCompanyRepositoryImpl.java index 9e796893..47f0ca96 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcJTCompanyRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcJTCompanyRepositoryImpl.java @@ -4,9 +4,13 @@ import com.chint.domain.aggregates.system.CompanyBlackList; import com.chint.domain.aggregates.system.JTCompany; import org.springframework.data.repository.CrudRepository; +import java.util.List; + public interface JdbcJTCompanyRepositoryImpl extends CrudRepository { CompanyBlackList findByCompanyName(String companyName); JTCompany findByCompanyCode(String companyCode); + + List findBySystemCodeId(Long systemCodeId); } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 1a61eaf9..241ed3fe 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -67,7 +67,7 @@ public class UserHttpRequestImpl implements UserHttpRequest { @Override public User loadUserInfo(User user) { - loadSFInfo(user); + user = loadSFInfo(user); if (user == null) { return null; } From 199ca54ad688bf3b41dccb9515c294c56278d139 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sun, 7 Apr 2024 09:25:55 +0800 Subject: [PATCH 31/33] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=86=8D=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=83=A8=E9=97=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order_record/OrderCarRecord.java | 10 ++------ .../order/order_record/OrderFlightRecord.java | 4 ++-- .../order/order_record/OrderHotelRecord.java | 4 ++-- .../order/order_record/OrderTrainRecord.java | 4 ++-- .../CTripOrderRecordExtensionFactory.java | 2 +- .../interfaces/rest/user/UserHttpRequest.java | 2 ++ .../rest/user/UserHttpRequestImpl.java | 24 +++++++++++++++++++ 7 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 6c76a6be..3d169756 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -1,7 +1,6 @@ package com.chint.domain.aggregates.order.order_record; import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.aggregates.order.OrderEvent; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -9,11 +8,6 @@ import lombok.experimental.Accessors; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table; -import java.util.List; -import java.util.Optional; - -import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; - @Data @Table("order_car_record") @NoArgsConstructor @@ -71,13 +65,13 @@ public class OrderCarRecord extends OrderBaseRecord { private String orderSource; // 预订来源:线上/线下 private String payAmount;//支付总金额 private String receiptsNumOrigin;//支付总金额 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderCarRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index b27dc60d..c68ee69a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -80,12 +80,12 @@ public class OrderFlightRecord extends OrderBaseRecord { private String createTime; private String receiptsNumOrigin;//原差旅申请单单号 private String payAmount; - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderFlightRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index 52acf941..f078d6ec 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -79,12 +79,12 @@ public class OrderHotelRecord extends OrderBaseRecord { private String orderStatus; private String createTime; private String receiptsNumOrigin;//支付总金额 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderHotelRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index d9a30807..3036f338 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -73,12 +73,12 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String trainTime; // 发车时间 yyyy-MM-dd HH:‌mm:ss private String yxId; // 影像比对ID private String receiptsNumOrigin;//原差旅申请单单号 - private String belongDeport; //归属部门 + private String belongDepart; //归属部门 public OrderTrainRecord loadBelongDeport(String belongDeport ) { // 行程信息 - this.setBelongDeport(belongDeport); + this.setBelongDepart(belongDeport); return this; } // 加载基础订单信息 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 48ef9945..59958d3e 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 @@ -591,7 +591,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac private String belongDeport(String employeeNo, String accountCompanyName) { User user = userRepository.findByUserEmployeeNo(employeeNo); if (user == null) { - user = userHttpRequest.loadUserInfo(User.withEmployeeNo(employeeNo)); + user = userHttpRequest.loadUserBaseInfo(User.withEmployeeNo(employeeNo)); if (user == null) { return null; } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java index 41092f5e..4d1a3393 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequest.java @@ -5,5 +5,7 @@ import com.chint.domain.aggregates.user.User; public interface UserHttpRequest { User loadUserInfo(User user); + User loadUserBaseInfo(User user); + User loadUserDeptInfo(User user); } \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 241ed3fe..0f48476c 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -182,6 +182,30 @@ public class UserHttpRequestImpl implements UserHttpRequest { return user; } + //这个方法只保存从sf取来的信息 + public User loadUserBaseInfo(User user) { + List userDataDTOList = userSFRequest + .getUserSFDataFromOpenApi(user); + + if (userDataDTOList == null || userDataDTOList.isEmpty()) { + return null; + } + userDataDTOList + .stream() + .filter(it -> it.getPersonIdExternal().equals(it.getLoginUsername())) + .findFirst() + .ifPresent(it -> { + User byUserEmployeeNo = userRepository.findByUserEmployeeNo(user.getEmployeeNo()); + if(byUserEmployeeNo == null){ + userRepository.save( + getDataFromUserSFData(user, it) + ); + } + }); + return user; + } + + private User addDeptInfo(UserDataDTO userData, User user, Boolean ifPrimary) { UserDepartmentInfo.Builder builder = user.addDeptInfo() .companyInfo(userData.getCompany(), userData.getCompany_cn()) From 08b303b9a79027ef524a857ebcf22f2263005ad6 Mon Sep 17 00:00:00 2001 From: dengwc Date: Sun, 7 Apr 2024 09:29:48 +0800 Subject: [PATCH 32/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/in/AutoWorkController.java | 31 +++ .../application/in/RouteOrderPageDto.java | 16 ++ .../chint/domain/aggregates/order/Leg.java | 7 +- .../aggregates/order/LegExtensionField.java | 21 +- .../config/webconfig/WebConfig.java | 3 +- .../config/RouteOrderCallBackImpl.java | 4 +- .../repository/jdbc/JdbcRouteRepository.java | 3 + .../interfaces/rest/base/PostRequest.java | 20 ++ src/test/java/com/chint/CTripTest.java | 65 ++--- src/test/java/com/chint/ExcelTest.java | 225 ++++++++++++++++-- src/test/java/com/chint/LYTest.java | 6 +- 11 files changed, 317 insertions(+), 84 deletions(-) create mode 100644 src/main/java/com/chint/application/in/RouteOrderPageDto.java diff --git a/src/main/java/com/chint/application/in/AutoWorkController.java b/src/main/java/com/chint/application/in/AutoWorkController.java index f6bca781..990d6118 100644 --- a/src/main/java/com/chint/application/in/AutoWorkController.java +++ b/src/main/java/com/chint/application/in/AutoWorkController.java @@ -1,18 +1,32 @@ package com.chint.application.in; +import com.alibaba.fastjson.JSON; import com.chint.application.commands.LYOrderRecordGenerateCommand; +import com.chint.application.dtos.AuthenticationSignDto; import com.chint.application.dtos.CTripRecordMonthSaveDTO; +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.factoriy.order_record.LyStatementOrder; +import com.chint.infrastructure.config.LogConfig.Dto.LogPageDto; +import com.chint.infrastructure.config.LogConfig.SystemLog; +import com.chint.infrastructure.constant.CommonMessageConstant; import com.chint.infrastructure.echo_framework.command.Command; import com.chint.application.commands.OrderRecordGenerateCommand; import com.chint.domain.factoriy.order_record.LyStatementOrder; import com.chint.infrastructure.echo_framework.command.Command; +import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository; +import com.chint.infrastructure.util.BeanCopyUtils; import com.chint.infrastructure.util.DateTimeUtil; +import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; +import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; +import com.google.gson.Gson; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -74,4 +88,21 @@ public class AutoWorkController { return Result.Success(SUCCESS); } + + @Autowired + private JdbcRouteRepository jdbcRouteRepository; + + @Transactional + @ApiOperation("临时接口查询订单数据") + @PostMapping("/routeOrder/pageQuery") + public Result> routeOrderPageQuery(@RequestBody PageInfo pageInfo) { + PageRequest pageResult = PageRequest.of( + pageInfo.getPageIndex() - 1, + pageInfo.getPageSize() + ); + Page res = jdbcRouteRepository.findAllBy(pageResult); + PageResult routeOrderPageResult = PageResult.totalPageNum(res.getTotalElements(), res.toList()); + return Result.Success(SUCCESS, routeOrderPageResult); + } + } diff --git a/src/main/java/com/chint/application/in/RouteOrderPageDto.java b/src/main/java/com/chint/application/in/RouteOrderPageDto.java new file mode 100644 index 00000000..170899bd --- /dev/null +++ b/src/main/java/com/chint/application/in/RouteOrderPageDto.java @@ -0,0 +1,16 @@ +package com.chint.application.in; + +import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.infrastructure.util.PageResult; +import lombok.Data; +import org.apache.poi.ss.formula.functions.T; + +@Data +public class RouteOrderPageDto { + + private String msg; + + private String code; + + private PageResult data; +} diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java index 405e2d56..3208dc55 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Leg.java +++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java @@ -103,7 +103,11 @@ public class Leg implements Serializable { return this.eventList.isEmpty() ? null : this.eventList.get(this.eventList.size() - 1); } + public OrderDetail getLastOrderDetail() { + if (this.orderDetails == null) { + return null; + } return this.orderDetails.stream() .max(Comparator.comparingLong(OrderDetail::getOrderId)) .orElse(null); @@ -209,7 +213,7 @@ public class Leg implements Serializable { exists = lastLegEvent.getEventType().equals(newEventType); //这里如果发现最后的时间是结束时间 , 那么禁止往该行程节点添加新的事件 - if(lastLegEvent.getEventType().equals(LEG_EVENT_FINISH)){ + if (lastLegEvent.getEventType().equals(LEG_EVENT_FINISH)) { log.info("This leg was finished."); return this; } @@ -222,7 +226,6 @@ public class Leg implements Serializable { } - // 如果列表为空,且新事件不是准备事件,抛出异常 // if (eventList.isEmpty() && newEventType != LegConstant.LEG_EVENT_PREPARE) { // throw new LegEventException("The first event must be a prepare event."); diff --git a/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java b/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java index 5b4ed3fa..6b6d43fa 100644 --- a/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java +++ b/src/main/java/com/chint/domain/aggregates/order/LegExtensionField.java @@ -34,7 +34,6 @@ public class LegExtensionField implements Serializable { private String estimatedAmount; - public LegExtensionField addLocationIdsAsString(List locationIds) { this.locationIds = Arrays.toString(locationIds.toArray()); return this; @@ -42,6 +41,9 @@ public class LegExtensionField implements Serializable { public List getLocationIdsAsLong() { // 去除字符串开头和结尾的方括号 + if (this.locationIds == null) { + return null; + } // this.locationIds = this.locationIds.substring(1, this.locationIds.length() - 1); // 根据逗号分割字符串 String[] items = this.locationIds.split(","); @@ -49,21 +51,32 @@ public class LegExtensionField implements Serializable { List result = new ArrayList<>(); // 将每个分割后的字符串转换为Long并添加到列表中 for (String item : items) { - result.add(Long.parseLong(item.trim())); + if (!item.trim().isEmpty()) { + result.add(Long.parseLong(item.trim())); + } } return result; } public List getLocationIdsAsLongFromArray() { // 去除字符串开头和结尾的方括号 - this.locationIds = this.locationIds.substring(1, this.locationIds.length() - 1); + if (this.locationIds == null) { + return null; + } + + if (this.locationIds.length() >= 2) { + this.locationIds = this.locationIds.substring(1, this.locationIds.length() - 1); + } // 根据逗号分割字符串 String[] items = this.locationIds.split(","); // 创建一个Long类型的列表 List result = new ArrayList<>(); // 将每个分割后的字符串转换为Long并添加到列表中 for (String item : items) { - result.add(Long.parseLong(item.trim())); + // 检查字符串是否为空或只包含空格 + if (!item.trim().isEmpty()) { + result.add(Long.parseLong(item.trim())); + } } return result; } diff --git a/src/main/java/com/chint/infrastructure/config/webconfig/WebConfig.java b/src/main/java/com/chint/infrastructure/config/webconfig/WebConfig.java index 073d2334..45ac2f73 100644 --- a/src/main/java/com/chint/infrastructure/config/webconfig/WebConfig.java +++ b/src/main/java/com/chint/infrastructure/config/webconfig/WebConfig.java @@ -34,7 +34,8 @@ public class WebConfig implements WebMvcConfigurer { //调用bean registry.addInterceptor(getMyRequestLoggingInterceptor()) .addPathPatterns("/**") - .excludePathPatterns("/public/log/pageQuery", "/order/pageQuery", "/OrderDetail/query/**", "/order/query/**", "/location/**"); + .excludePathPatterns("/public/**/pageQuery", "/order/pageQuery", "/OrderDetail/query/**", + "/order/query/**", "/location/**", "/OrderDetail/record/query"); } diff --git a/src/main/java/com/chint/infrastructure/repository/config/RouteOrderCallBackImpl.java b/src/main/java/com/chint/infrastructure/repository/config/RouteOrderCallBackImpl.java index 271f04dd..cca03772 100644 --- a/src/main/java/com/chint/infrastructure/repository/config/RouteOrderCallBackImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/config/RouteOrderCallBackImpl.java @@ -17,11 +17,11 @@ public class RouteOrderCallBackImpl implements BeforeSaveCallback { entity.setCreateTime(LocalDateTime.now()); } if (entity.getCreateUser() == null) { - entity.setCreateUser(BaseContext.getCurrentUser().getUserId().toString()); + entity.setCreateUser(BaseContext.getCurrentUser() != null ? BaseContext.getCurrentUser().getUserId().toString() : ""); } entity.setUpdateTime(LocalDateTime.now()); if (BaseContext.getCurrentUser() != null) { - entity.setUpdateUser(BaseContext.getCurrentUser().getUserId().toString()); + entity.setUpdateUser(BaseContext.getCurrentUser() != null ? BaseContext.getCurrentUser().getUserId().toString() : ""); } return entity; } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java index 060ce3b0..5902c033 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -2,6 +2,7 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.RouteOrder; import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @@ -39,4 +40,6 @@ public interface JdbcRouteRepository extends CrudRepository { List findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(String userId, String approveOrderNo_creator); List findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); + + Page findAllBy(PageRequest pageResult); } diff --git a/src/main/java/com/chint/interfaces/rest/base/PostRequest.java b/src/main/java/com/chint/interfaces/rest/base/PostRequest.java index b74adfaa..c66b8d16 100644 --- a/src/main/java/com/chint/interfaces/rest/base/PostRequest.java +++ b/src/main/java/com/chint/interfaces/rest/base/PostRequest.java @@ -122,6 +122,26 @@ public class PostRequest { return gson.fromJson(responseBody, responseType); } + + public T postJSON(String url, Object jsonRequest, Class responseType) { + HttpPost post = new HttpPost(url); + String json = JSON.toJSONString(jsonRequest); + log.info(json); + post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); + String responseBody = null; + HttpEntity responseEntity = null; + HttpResponse response = null; + try { + response = client.execute(post); + responseEntity = response.getEntity(); + responseBody = EntityUtils.toString(responseEntity, "UTF-8"); + log.info(responseBody); + } catch (IOException e) { + throw new RuntimeException(e); + } + return JSON.parseObject(responseBody, responseType); + } + public Gson gson() { return gson; } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index aadac166..34ff9409 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -5,15 +5,12 @@ import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity; import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; -import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*; + import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.*; import com.chint.domain.service.order_sync.CTripOrderSyncAdapter; import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.value_object.SupplierCallbackData; -import com.chint.infrastructure.repository.CTripOrderDetailImpl; -import com.chint.infrastructure.repository.OrderFlightRecordRepositoryImpl; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.PinyinUtil; @@ -40,7 +37,6 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.in.CTripNoteController; import com.chint.interfaces.rest.ctrip.order.CTripOrderDetailRequest; -import com.chint.interfaces.rest.ctrip.order.CTripOrderRecordAutoSave; import com.google.gson.Gson; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -125,15 +121,6 @@ public class CTripTest { @Value("${cTrip.requestSecret}") private String C_TRIP_REQUEST_SECRET; - @Autowired - private OrderFlightRecordRepository orderFlightRecordRepository; - - @Autowired - private CTripOrderDetailImpl cTripOrderDetail; - - @Autowired - private CTripOrderRecordAutoSave cTripOrderRecordAutoSave; - private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); @@ -246,10 +233,10 @@ public class CTripTest { System.out.println(gson.toJson(estimate)); } -// @Test + @Test void search() { BaseContext.setCurrentUser(user); - SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31288249965"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31108053999"); System.out.println(response); } @@ -497,11 +484,11 @@ public class CTripTest { OrderFlightResponse.FlightOrderSettlementInfo flightOrderSettlementInfo = orderSettlementList.get(0); OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo = flightOrderSettlementInfo.getOrderSettlementBaseInfo(); - if (orderSettlementBaseInfo != null) { - CTripFlightRecordBase ctripFlightOrderDetail = new CTripFlightRecordBase(); + /*if (orderSettlementBaseInfo != null) { + CtripFlightOrderDetail ctripFlightOrderDetail = new CtripFlightOrderDetail(); ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(orderSettlementBaseInfo); ctripOrderDetailRepository.save(ctripFlightOrderDetail); - } + }*/ } } } @@ -519,11 +506,11 @@ public class CTripTest { OrderTrainResponse.CorpTrainSettlementInfo corpTrainSettlementInfo = lstTrainSettlementDetail.get(0); OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail = corpTrainSettlementInfo.getTrainSettlementDetail(); - if (trainSettlementDetail != null) { - CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase(); + /*if (trainSettlementDetail != null) { + CtripTrainOrderDetail ctripTrainOrderDetail = new CtripTrainOrderDetail(); ctripTrainOrderDetail = ctripTrainOrderDetail.changeInfo(trainSettlementDetail); ctripOrderDetailRepository.save(ctripTrainOrderDetail); - } + }*/ } } } @@ -540,11 +527,11 @@ public class CTripTest { if (!LstHotelSettlementDetail.isEmpty()) { OrderHotelResponse.LstHotelSettlementDetail hotelSettlementDetail = LstHotelSettlementDetail.get(0); OrderHotelResponse.SettlementDetail settlementDetail = hotelSettlementDetail.getSettlementDetail(); - if (settlementDetail != null) { - CTripHotelRecordBase ctripFlightOrderDetail = new CTripHotelRecordBase(); + /*if (settlementDetail != null) { + CtripHotelOrderDetail ctripFlightOrderDetail = new CtripHotelOrderDetail(); ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(settlementDetail); ctripOrderDetailRepository.save(ctripFlightOrderDetail); - } + }*/ } } } @@ -562,11 +549,11 @@ public class CTripTest { if (!carSettlementDetailList.isEmpty()) { OrderCarResponse.CarOrderSettlementDetail carOrderSettlementDetail = carSettlementDetailList.get(0); OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = carOrderSettlementDetail.getSettlementBaseInfo(); - if (settlementBaseInfo != null) { - CTripCarRecordBase ctripCarOrderDetail = new CTripCarRecordBase(); + /*if (settlementBaseInfo != null) { + CtripCarOrderDetail ctripCarOrderDetail = new CtripCarOrderDetail(); ctripCarOrderDetail = ctripCarOrderDetail.changeInfo(settlementBaseInfo); ctripOrderDetailRepository.save(ctripCarOrderDetail); - } + }*/ } } } @@ -596,26 +583,4 @@ public class CTripTest { } -// @Test - void findRecord(){ - CTripFlightRecord byId = cTripOrderDetail.findFlightRecordById(14513L); - Gson gson = new Gson(); - System.out.println(gson.toJson(byId)); - } - -// @Test - void findHotelRecord(){ - CTripHotelRecord byId = cTripOrderDetail.findHotelRecordByRecordId("97211839"); - Gson gson = new Gson(); - System.out.println(gson.toJson(byId)); - } - -// @Test - void findCarRecord(){ - CTripCarRecord byId = cTripOrderDetail.findCarRecordByRecordId("50597248"); - Gson gson = new Gson(); - System.out.println(gson.toJson(byId)); - } - - } diff --git a/src/test/java/com/chint/ExcelTest.java b/src/test/java/com/chint/ExcelTest.java index 8ff9b578..710d1e26 100644 --- a/src/test/java/com/chint/ExcelTest.java +++ b/src/test/java/com/chint/ExcelTest.java @@ -10,23 +10,25 @@ import com.authine.cloudpivot.opensdk.config.CloudpivotEnvConfig; import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest; import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse; import com.chint.application.commands.RefundOrderGenerateCommand; +import com.chint.application.in.AutoWorkController; +import com.chint.application.in.RouteOrderPageDto; import com.chint.application.services.login.strategy.ANFeiShuLoginStrategy; -import com.chint.application.services.login.strategy.FeishuLoginStrategy; -import com.chint.domain.aggregates.order.Leg; -import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.aggregates.order.*; +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderCarRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderFlightRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderHotelRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderTrainRecord; import com.chint.domain.aggregates.standards.StaffRank; import com.chint.domain.aggregates.standards.XNStaffRank; +import com.chint.domain.factoriy.order_record.OrderRecordBasic; import com.chint.infrastructure.config.LogConfig.LogController; import com.chint.infrastructure.config.LogConfig.RedisCache; import com.chint.infrastructure.config.LogConfig.SystemLog; import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.repository.jdbc.*; -import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BeanCopyUtils; +import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.bpm.XNBPM.YSTokenDto; @@ -41,6 +43,7 @@ import com.chint.interfaces.rest.ctrip.dto.search.car.OrderFee; import com.chint.interfaces.rest.ctrip.dto.search.flight.ChangeInfo; import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightOrderInfoEntity; import com.chint.interfaces.rest.ly.LYSearchRequest; +import com.chint.interfaces.rest.ly.dto.LYBaseRequest; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; import com.chint.interfaces.rest.ly.reconciliation.dto.BaseDetailParam; @@ -48,16 +51,22 @@ import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.CarStateme import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.FlightStatement; import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.HotelStatement; import com.chint.interfaces.rest.ly.reconciliation.dto.DetailResponse.TrainStatement; +import com.chint.interfaces.rest.ly.reconciliation.dto.PageInfo; import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.ResStatementList; import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.StatementList; import com.chint.interfaces.rest.ly.reconciliation.dto.statementList.StatementPageList; import com.chint.interfaces.rest.ly.reconciliation.request.ReqStatement; +import com.fasterxml.jackson.core.JsonProcessingException; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.lang.reflect.Type; @@ -67,12 +76,11 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import static com.chint.infrastructure.constant.BPMConstant.AN_FSSC; import static com.chint.infrastructure.constant.BPMConstant.YSBPM_TOKEN_URL; @Slf4j @@ -470,7 +478,7 @@ public class ExcelTest { @Autowired private ANFeiShuLoginStrategy anFeiShuLoginStrategy; - @Test + // @Test void ssoLogin() { String login = anFeiShuLoginStrategy.login("b28o253524f34b25bd4da9ed3a224548"); System.out.println(login); @@ -503,6 +511,12 @@ public class ExcelTest { ResStatementList resStatementList = reqStatement.queryStatementList(statementList); log.info("resStatementList: {}", resStatementList); ArrayList onlineStatementList = resStatementList.getData().getOnlineStatementList(); + // 获取当前时间 + LocalDate now = LocalDate.now(); + LocalDate startDate = now.minusMonths(2).withDayOfMonth(1); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + String startTime = startDate.atStartOfDay().format(formatter); + String endTime = LocalDateTime.now().format(formatter); for (ResStatementList.OnlineStatementList onlineStatement : onlineStatementList) { String statementCode = onlineStatement.getStatementCode();//对账单编码 @@ -517,7 +531,7 @@ public class ExcelTest { //保存数据 List statementOrderList = flightStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo("2024-03-01 00:00:00", "2024-03-26 23:00:00"); + List orderSerialNoList = jdbcLyOrderFlightRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -537,7 +551,7 @@ public class ExcelTest { //保存数据 List statementOrderList = hotelStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo("2024-03-01 00:00:00", "2024-03-26 23:00:00"); + List orderSerialNoList = jdbcLyOrderHotelRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -557,7 +571,7 @@ public class ExcelTest { //保存数据 List statementOrderList = trainStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo("2024-03-01 00:00:00", "2024-03-26 23:00:00"); + List orderSerialNoList = jdbcLyOrderTrainRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -578,7 +592,7 @@ public class ExcelTest { //保存数据 List statementOrderList = carStatement.getData().getStatementOrderList(); //查询已经保存的数据 - List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo("2024-03-01 00:00:00", "2024-03-26 23:00:00"); + List orderSerialNoList = jdbcLyOrderCarRecord.queryBillOrderNo(startTime, endTime); //过滤出已经保存的数据 List statementOrderListNew = statementOrderList.stream().filter(o -> !orderSerialNoList.contains(o.getBillOrderNo()) @@ -593,19 +607,186 @@ public class ExcelTest { } -// @Test + // @Test void awwe1() { + int count = 0;//初始化变量 + int pageSize = 10; // 假设每页大小为10 + int LoopNum;//需要的循环数 + do { + PageRequest pageResult = PageRequest.of(count, pageSize); + Page lyOrderFlightRecordPage = jdbcLyOrderFlightRecord.findAllByStatusIsNull(pageResult); + long totalElements = lyOrderFlightRecordPage.getTotalElements();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //数据 + List lyOrderFlightRecordPageList = lyOrderFlightRecordPage.toList(); + + count++; + } while (count < LoopNum); + //修改数据,将状态为null的设置为1 + jdbcLyOrderFlightRecord.updateStatusByNullStatus(); + } + + @Autowired + private ApplicationContext applicationContext; + + // @Test + public void hauwsdhauh() { + String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames(); + String jsonString = JSON.toJSONString(beanDefinitionNames); + System.out.println("beanDefinitionNames = " + jsonString); + Object bean = applicationContext.getBean("orderDomainService"); + System.out.println("bean = " + bean); + } + + @Test + public void testDto() { + AtomicReference orderDetailRef = new AtomicReference<>(); + OrderRecordBasic orderRecordBasic = getOrderRecordBasic("123", orderDetailRef::set); + OrderDetail orderDetail = orderDetailRef.get(); + String orderNo = orderDetail.getOrderNo(); + System.out.println("orderNo = " + orderNo); + System.out.println("orderNo = " + orderDetail); + + OrderRecordBasic orderRecordBasic22 = getOrderRecordBasic22("123", orderDetailRef::set); + OrderDetail orderDetail22 = orderDetailRef.get(); + String orderNo22 = orderDetail22.getOrderNo(); + System.out.println("orderNo = " + orderNo22); + System.out.println("orderNo = " + orderDetail); + if (orderDetail22.equals(orderDetail) || orderDetail == orderDetail22) { + System.out.println("orderNo22 = " + orderNo22); + } + } + + public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer consumer) { + OrderDetail orderDetail = new OrderDetail(); + orderDetail.setOrderNo("1234561"); + consumer.accept(orderDetail); + return null; + } + + public OrderRecordBasic getOrderRecordBasic22(String orderSerialNo, Consumer consumer) { + OrderDetail orderDetail = new OrderDetail(); + orderDetail.setOrderNo("123456122"); + consumer.accept(orderDetail); + return null; + } + + @Test + public void testStrDto() { + String ab = "dadasd"; + String[] split = ab.split("-"); + System.out.println("split[0] = " + split[0]); + } + + //获取账期号 + @Test + public void getAccountPeriod() { + // 获取当前时间 + LocalDate now = LocalDate.now(); + LocalDate startDate = now.minusMonths(2).withDayOfMonth(1); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - LocalDate parse = LocalDate.parse("2024-01-04 00:00:00",formatter); - LocalDate firstDayOfLastMonth = parse.minusMonths(1).withDayOfMonth(1); - LocalDate lastDayOfLastMonth = parse.withDayOfMonth(1).minusDays(1); - - String beginDate = firstDayOfLastMonth.atStartOfDay().format(formatter); - System.out.println("beginDate = " + beginDate); - String endDate = lastDayOfLastMonth.atTime(23, 59, 59).format(formatter); - System.out.println("endDate = " + endDate); - + String startTime = startDate.atStartOfDay().format(formatter); + System.out.println("startTime = " + startTime); + String endTime = LocalDateTime.now().format(formatter); + System.out.println("endTime = " + endTime); } + + @Autowired + private JdbcRouteRepository repository; + +// @Test + @Transactional + public void getRouteOrder() throws Exception { + int count = 0;//初始化变量 + int pageSize = 100; // 假设每页大小为100 + int LoopNum;//需要的循环数 + PageInfo pageInfo = new PageInfo(); + pageInfo.setPageSize(pageSize); + String url = "http://127.0.0.1:8081/public/routeOrder/pageQuery"; + do { + pageInfo.setPageIndex(count + 1); + RouteOrderPageDto routeOrderPageDto = postRequest.postJSON(url, pageInfo, RouteOrderPageDto.class); + PageResult pageResult = routeOrderPageDto.getData(); + long totalElements = pageResult.getTotal();//总数 + LoopNum = (int) Math.ceil((double) totalElements / pageSize); // 计算总页数并向上取整 + //保存数据 + List records = pageResult.getRecords(); + for (RouteOrder record : records) { + record.setRouteId(null); + List legItems = record.getLegItems(); + for (Leg legItem : legItems) { + legItem.setLegId(null); + legItem.setRouteId(null); + + List eventList = legItem.getEventList(); + for (LegEvent legEvent : eventList) { + legEvent.setLegEventId(null); + legEvent.setLegId(null); + } + + LegExtensionField legExtensionField = legItem.getLegExtensionField(); + if (legExtensionField != null) { + legExtensionField.setId(null); + legExtensionField.setLegId(null); + } + } + + List orderDetails = record.getOrderDetails(); + for (OrderDetail orderDetail : orderDetails) { + orderDetail.setOrderId(null); + orderDetail.setRouteId(null); + orderDetail.setLegId(null); + List orderEventList = orderDetail.getOrderEventList(); + for (OrderEvent orderEvent : orderEventList) { + orderEvent.setOrderEventId(null); + orderEvent.setOrderId(null); + } + CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail(); + if (carOrderDetail != null) { + carOrderDetail.setId(null); + } + FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail(); + if (flightOrderDetail != null) { + flightOrderDetail.setId(null); + } + HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); + if (hotelOrderDetail != null) { + hotelOrderDetail.setId(null); + List customers = hotelOrderDetail.getCustomers(); + for (HotelOrderDetailCustomer customer : customers) { + customer.setId(null); + } + + } + TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail(); + if (trainOrderDetail != null) { + trainOrderDetail.setId(null); + } + OtherOrderDetail otherOrderDetail = orderDetail.getOtherOrderDetail(); + if (otherOrderDetail != null) { + otherOrderDetail.setId(null); + } + } + List approveEvents = record.getApproveEvents(); + for (ApprovalEvent approveEvent : approveEvents) { + approveEvent.setRouteId(null); + approveEvent.setApprovalEventId(null); + } + + } + log.info(JSON.toJSONString(records)); + repository.saveAll(pageResult.getRecords()); + + + count++; + } while (count < LoopNum); + log.info("成功"); + if (true) { + log.info("成功"); + throw new Exception(); + } + } + } diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index a5b44e85..0f88f3c0 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -811,7 +811,7 @@ public class LYTest { System.out.println(json); } - @Test +// @Test void searchTrain() { TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24032868398852849"); Gson gson = new Gson(); @@ -921,14 +921,14 @@ public class LYTest { } - @Test +// @Test void syncToSupplierOne(){ RouteOrder routeOrder = routeRepository.queryById(665L); lyOrderSyncAdapter.syncSupplierOrder(routeOrder); } - @Test +// @Test void queryHotelCustom(){ OrderDetail byId = orderDetailRepository.findById(2569L); HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail()); From edb6072433113cd3d135cddb5090d55db9350dbe Mon Sep 17 00:00:00 2001 From: dengwc Date: Sun, 7 Apr 2024 14:15:29 +0800 Subject: [PATCH 33/33] =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BD=92=E5=B1=9E=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CTripOrderRecordExtensionFactory.java | 2 +- .../LyOrderRecordExtensionFactory.java | 139 +++++++++++++----- .../config/LogConfig/LogService.java | 8 +- src/test/java/com/chint/ExcelTest.java | 9 +- 4 files changed, 112 insertions(+), 46 deletions(-) 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 59958d3e..ff15886c 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 @@ -588,7 +588,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac return orderHotelRecord; } - private String belongDeport(String employeeNo, String accountCompanyName) { + public String belongDeport(String employeeNo, String accountCompanyName) { User user = userRepository.findByUserEmployeeNo(employeeNo); if (user == null) { user = userHttpRequest.loadUserBaseInfo(User.withEmployeeNo(employeeNo)); diff --git a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java index 712940f1..fc4069c7 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/LyOrderRecordExtensionFactory.java @@ -6,6 +6,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.OrderTrainRecord; import com.chint.domain.aggregates.order.order_record.ly_order_record.*; +import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.repository.jdbc.*; import com.chint.infrastructure.util.BeanCopyUtils; import com.chint.interfaces.rest.bpm.dto.BPMResponse; @@ -40,12 +41,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor @Autowired private JdbcRouteRepository jdbcRouteRepository; - @Autowired - private OrderRecordFactory orderRecordFactory; @Autowired private JdbcOrderTravelRepository orderTravelRepository; + @Autowired + private CTripOrderRecordExtensionFactory cTripOrderRecordExtensionFactory; + @Override public OrderFlightRecord createFlightOrderRecord(Object orderFlightRecordData) { OrderFlightRecord orderFlightRecord = new OrderFlightRecord(); @@ -101,7 +103,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setAccountPeriod(getAccountPeriod(lyOrderFlightRecord.getStatementCode()))//账期号 .setBillNo(lyOrderFlightRecord.getBillOrderNo())//账单号 .setOrderNo(lyOrderFlightRecord.getOrderSerialNo())//订单号 - .setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号 .setOriginalOrderNo(lyOrderFlightRecord.getOriginOrderSerialNo())//原始订单号 .setTicketNo(StringUtils.isBlank(lyOrderFlightRecord.getTicketNo()) ? null : lyOrderFlightRecord.getTicketNo().replace("-", ""));//票号 //行程单号 @@ -114,15 +115,7 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setUserCode(lyOrderFlightRecord.getPassengerExternalId())//出行人编码 .setOverStandard(lyOrderFlightRecord.getOverStandardStatus())//"是否违规(超标):0否 ,1是" .setOverStandardReason(lyOrderFlightRecord.getViolationReason())//违规原因(超标原因) - .setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称 - .setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码 - .setStartCityName(flightOrderDetail.getStartCityName())//起飞城市名称 .setStartTime(lyOrderFlightRecord.getPlanBeginDate())//起飞时间 yyyy-MM-dd HH:mm:ss - .setEndAirportCode(flightOrderDetail.getEndAirportCode())//到达机场三字码 - .setEndAirportName(flightOrderDetail.getEndAirportName())//到达机场名称 - .setEndCityCode(flightOrderDetail.getEndCityCode())//到达城市编码 - .setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称 - .setEndTerminal(flightOrderDetail.getEndTerminal())//到达航站楼 .setEndTime(lyOrderFlightRecord.getPlanEndDate())//到达时间 yyyy-MM-dd HH:mm:ss .setFlightCompName(lyOrderFlightRecord.getAirlineCompanyName())//航空公司名称 .setFlightLowestPrice(String.valueOf(lyOrderFlightRecord.getFligthMinPrice()))//航班最低价 @@ -157,6 +150,29 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor // .setSettleOrderFlag() //订单对账状态 .setPayAmount(String.valueOf(lyOrderFlightRecord.getToBePayAmount() + lyOrderFlightRecord.getServiceAmount()))//支付金额 ; + //订单明细字段赋值 + setFlightRecordDetail(orderFlightRecord, flightOrderDetail); + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = Optional.of(routeOrder) + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderFlightRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderFlightRecord.loadBelongDeport( + cTripOrderRecordExtensionFactory.belongDeport(orderFlightRecord.getBookingUserCode(), orderFlightRecord.getAccountCompanyName()) + )); + } + + //订单明细字段赋值 + private void setFlightRecordDetail(OrderFlightRecord orderFlightRecord, FlightOrderDetail flightOrderDetail) { + orderFlightRecord.setParentOrderNo(flightOrderDetail.getParentOrderNo())//父级订单号 + .setStartAirportName(flightOrderDetail.getStartAirportName())//起飞机场名称 + .setStartCityCode(flightOrderDetail.getStartCityCode())//起飞城市编码 + .setStartCityName(flightOrderDetail.getStartCityName())//起飞城市名称 + .setEndAirportCode(flightOrderDetail.getEndAirportCode())//到达机场三字码 + .setEndAirportName(flightOrderDetail.getEndAirportName())//到达机场名称 + .setEndCityCode(flightOrderDetail.getEndCityCode())//到达城市编码 + .setEndCityName(flightOrderDetail.getEndCityName())//到达城市名称 + .setEndTerminal(flightOrderDetail.getEndTerminal());//到达航站楼 } @@ -193,10 +209,8 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setCountry(lyOrderHotelRecord.getCountryName()) //国家 .setCustomerServiceName("") //客服处理人 .setDepartureDate(lyOrderHotelRecord.getLeaveTime()) //离店日期yyyy - MM - dd - .setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址 .setHotelName(lyOrderHotelRecord.getHotelName()) //酒店名称 .setIncludeAmount("") //含早情况:XX份 - .setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店:0否1是 .setPaymentType(getPaymentType(lyOrderHotelRecord.getPayType()))//"付款方式:0-公司统付 1-个人付 2-混付" .setOrderAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //结算总额 .setCompanyAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount())) //企业统付总额 @@ -204,7 +218,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setUnifiedPayAmt(String.valueOf(lyOrderHotelRecord.getServiceAmount())) //统付服务费 .setPersonalPayAmt("") //个人服务费 .setProvince("") //省份 - .setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数 .setRoomNightCount(lyOrderHotelRecord.getHotelNights()) //夜间数 .setNightCount(lyOrderHotelRecord.getHotelNights()) //间夜数 .setRoomPrice("") //房价(房间单价不包含服务费) @@ -217,19 +230,37 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setNoTaxCusFee("") //托管费不含税 .setTaxCusFee("") //托管费税费 .setRoomTypeName(lyOrderHotelRecord.getBedType()) //房型 - .setStarRate(hotelOrderDetail.getStarRate()) //星级 .setOrderSource(StringUtils.isNotBlank(lyOrderHotelRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下 .setBookOrgCode1(lyOrderHotelRecord.getPassengerDepartment()) //入住人组织架构信息1 - .setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2 - .setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()) //入住人组织架构信息3 .setOfflineCcomyCode(lyOrderHotelRecord.getPassengerCostCenter()) //成本中心 .setOrderStatus("") //结算状态 // .setExpenseOrderAmount("") //订单金额 // .setSettleOrderFlag() //订单对账状态 .setPayAmount(String.valueOf(lyOrderHotelRecord.getToBePayAmount() + lyOrderHotelRecord.getServiceAmount())) //支付金额 ; + //订单明细字段赋值 + setHotelRecordDetail(orderHotelRecord, hotelOrderDetail); + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = Optional.of(routeOrder) + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderHotelRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderHotelRecord.loadBelongDeport( + cTripOrderRecordExtensionFactory.belongDeport(orderHotelRecord.getBookingUserCode(), orderHotelRecord.getAccountCompanyName()) + )); } + //酒店订单明细字段赋值 + private void setHotelRecordDetail(OrderHotelRecord orderHotelRecord, HotelOrderDetail hotelOrderDetail) { + orderHotelRecord.setHotelAddress(hotelOrderDetail.getHotelAddress()) //酒店地址 + .setIsAgreement("是".equals(hotelOrderDetail.getAgreementHotel()) ? "1" : "0") //是否协议酒店:0否1是 + .setRoomCount(Integer.parseInt(StringUtils.isBlank(hotelOrderDetail.getRoomCount()) ? "1" : hotelOrderDetail.getRoomCount())) //房间数 + .setStarRate(hotelOrderDetail.getStarRate()) //星级 + .setBookOrgCode2(hotelOrderDetail.getBOOK_ORG_STRUCT_2()) //入住人组织架构信息2 + .setBookOrgCode3(hotelOrderDetail.getBOOK_ORG_STRUCT_3()); //入住人组织架构信息3 + } + + private void createTrainOrder(OrderTrainRecord orderTrainRecord, LyOrderTrainRecord lyOrderTrainRecord) { String orderSerialNo = lyOrderTrainRecord.getOrderSerialNo();//订单号 AtomicReference orderDetailRef = new AtomicReference<>(); @@ -247,7 +278,6 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setAccountPeriod(getAccountPeriod(lyOrderTrainRecord.getStatementCode())) //账期号 .setBillNo(lyOrderTrainRecord.getBillOrderNo()) //账单号 .setOrderNo(lyOrderTrainRecord.getOrderSerialNo()) //订单号 - .setParentOrderNo(trainOrderDetail.getParentOrderNo()) //父级订单号 .setOriginalOrderNo(lyOrderTrainRecord.getOriginOrderSerialNo());//原始订单号 orderTrainRecord.setReceiptsNum(getReceiptsNum(lyOrderTrainRecord.getOutApplayOrderNo(), routeOrder))//关联申请单号 .setReceiptsNumOrigin(lyOrderTrainRecord.getOutApplayOrderNo()) //原关联申请单号 @@ -273,16 +303,11 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setToCity(lyOrderTrainRecord.getTripName()) //到达城市 .setToStationName(lyOrderTrainRecord.getTripName()) //到达站 .setIssueTicketTime(lyOrderTrainRecord.getEnterAccount()) //出票时间 yyyy-MM-dd HH:mm:ss - .setRunTime(trainOrderDetail.getRunTime()) //时长 - .setSeatType(trainOrderDetail.getSeatType())// 座位等级 .setTrainNo(lyOrderTrainRecord.getTrainNo()) //车次 .setUserCode(lyOrderTrainRecord.getPassengerNo())//出行人编码 .setUserName(lyOrderTrainRecord.getPassengerName())//出行人姓名 .setOrderSource(StringUtils.isNotBlank(lyOrderTrainRecord.getOutApplayOrderNo()) ? "Y" : "N")//预订来源:线上 / 线下 -// .setOrderSource(lyOrderTrainRecord.getBookingPlat())//预订来源:线上 / 线下 .setBookOrgCode1(lyOrderTrainRecord.getPassengerDepartment())//出行人组织架构信息1 - .setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2 - .setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3())//出行人组织架构信息3 .setOfflineCcomyCode(lyOrderTrainRecord.getPassengerCostCenter())//成本中心 // .setOrderStatus() //结算状态 // .setExpenseOrderAmount() //订单金额 @@ -298,6 +323,25 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setTrainTime("")//发车时间 yyyy - MM - dd HH:mm:ss .setYxId("")//影像比对ID*/ ; + //订单明细字段赋值 + setTrainRecordDetail(orderTrainRecord, trainOrderDetail); + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = Optional.of(routeOrder) + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderTrainRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderTrainRecord.loadBelongDeport( + cTripOrderRecordExtensionFactory.belongDeport(orderTrainRecord.getBookingUserCode(), orderTrainRecord.getAccountCompanyName()) + )); + } + + //火车订单明细字段赋值 + private void setTrainRecordDetail(OrderTrainRecord orderTrainRecord, TrainOrderDetail trainOrderDetail) { + orderTrainRecord.setParentOrderNo(trainOrderDetail.getParentOrderNo())//父级订单号 + .setRunTime(trainOrderDetail.getRunTime()) //时长 + .setSeatType(trainOrderDetail.getSeatType())// 座位等级 + .setBookOrgCode2(trainOrderDetail.getBOOK_ORG_STRUCT_2())//出行人组织架构信息2 + .setBookOrgCode3(trainOrderDetail.getBOOK_ORG_STRUCT_3());//出行人组织架构信息3 } private void createCarOrder(OrderCarRecord orderCarRecord, LyOrderCarRecord lyOrderCarRecord) { @@ -321,19 +365,13 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setOverStandard("否") //"是否违规(超标):0否 1是" .setOverStandardReason("无")//违规原因(超标原因) .setOrderNo(lyOrderCarRecord.getOrderSerialNo()) //订单号 - .setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号 .setOriginalOrderNo(lyOrderCarRecord.getOriginOrderSerialNo())//原始订单号 .setOrderStatus("") //"结算状态" .setCreateTime(lyOrderCarRecord.getBookingDate()) //"订单创建时间格式:2023-04-26 13:15:17" .setStartTime(lyOrderCarRecord.getPlanBeginDate()) //"出发时间格式:2023-04-26 13:15:17" - .setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17" .setFromStationName(lyOrderCarRecord.getCarStartPlaceActual()) //出发地 .setToStationName(lyOrderCarRecord.getCarEndPlaceActual()) //到达地 - .setCarType(carOrderDetail.getCarModel()) //车型 .setFromCity(lyOrderCarRecord.getStartCityName()) //出发城市 - .setToCity(carOrderDetail.getToCity()) //到达城市 - .setRunTime(carOrderDetail.getRunTime()) //运行时长 - .setMiles(carOrderDetail.getMileage()) //里程数 .setNoTaxAmt("") //未税金额 .setTaxAmt("") //税费 .setOrderAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //结算总额(含前收服务费) @@ -344,21 +382,41 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor .setCancelCost(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //取消费 .setUserName(String.valueOf(lyOrderCarRecord.getPassengerName())) //用车人姓名 .setUserCode(lyOrderCarRecord.getPassengerNo()) //用车人code - .setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额 .setComyPayAmt(String.valueOf(lyOrderCarRecord.getToBePayAmount())) //公司统付金额 .setBookOrgCode1(lyOrderCarRecord.getPassengerDepartment()) //用车人组织架构信息1 - .setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2 - .setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()) //用车人组织架构信息3 .setPaymentType(String.valueOf(getPaymentType(lyOrderCarRecord.getPayType()))) //"付款方式0:公司统付 1:个人付 2:混付" .setOfflineCcomyCode(lyOrderCarRecord.getPassengerDepartment()) //成本中心 .setOrderSource(StringUtils.isNotBlank(lyOrderCarRecord.getOutApplayOrderNo()) ? "Y" : "N") //预订来源:线上/线下 // .setExpenseOrderAmount() //订单金额 // .setSettleOrderFlag() //订单对账状态 .setPayAmount(String.valueOf(lyOrderCarRecord.getToBePayAmount() + lyOrderCarRecord.getServiceAmount()))// 支付金额 - ; + //订单明细字段赋值 + setCarRecordDetail(orderCarRecord, carOrderDetail); + + //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 + Optional routerOrderExtensionField = Optional.of(routeOrder) + .flatMap(it -> Optional.ofNullable(it.getRouterOrderExtensionField())); + routerOrderExtensionField.ifPresentOrElse(it -> orderCarRecord.loadBelongDeport(it.getBelongDeptCode()), + () -> orderCarRecord.loadBelongDeport( + cTripOrderRecordExtensionFactory.belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName()) + )); } + //用车订单明细字段赋值 + private void setCarRecordDetail(OrderCarRecord orderCarRecord, CarOrderDetail carOrderDetail) { + orderCarRecord.setParentOrderNo(carOrderDetail.getParentOrderNo())//父级订单号 + .setArriveTime(carOrderDetail.getArriveTime()) //"到达时间格式:2023-04-26 13:15:17" + .setCarType(carOrderDetail.getCarModel()) //车型 + .setToCity(carOrderDetail.getToCity()) //到达城市 + .setRunTime(carOrderDetail.getRunTime()) //运行时长 + .setMiles(carOrderDetail.getMileage()) //里程数 + .setOwnPayAmt(carOrderDetail.getPersonalPaymentAmount()) //个人支付金额 + .setBookOrgCode2(carOrderDetail.getBOOK_ORG_STRUCT_2()) //用车人组织架构信息2 + .setBookOrgCode3(carOrderDetail.getBOOK_ORG_STRUCT_3()); //用车人组织架构信息3 + } + + //获取公共对象 public OrderRecordBasic getOrderRecordBasic(String orderSerialNo, Consumer consumerOrderDetail, Consumer consumerRouteOrder) { OrderDetail orderDetail = jdbcOrderDetailRepository.findByOrderNo(orderSerialNo); @@ -380,17 +438,24 @@ public class LyOrderRecordExtensionFactory implements OrderRecordExtensionFactor //获取账期号 202403 public String getAccountPeriod(String statementCode) { LocalDate currentDate = LocalDate.now(); - String nowDate = currentDate.format(DateTimeFormatter.ofPattern("yyyyMMdd")); + DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyyMM"); + DateTimeFormatter formatDay = DateTimeFormatter.ofPattern("yyyyMMdd"); + String nowDate = currentDate.format(formatDay); if (StringUtils.isBlank(statementCode)) { //如果为空,获取上月赋值 LocalDate lastMonthDate = currentDate.minusMonths(1); return lastMonthDate.format(DateTimeFormatter.ofPattern("yyyyMM")); } String dateSuffix = statementCode.substring(2, 6); - String datePrefix = nowDate.substring(0, 2); - System.out.println(datePrefix + dateSuffix); - return datePrefix + dateSuffix; + String dateString = datePrefix + dateSuffix; + // 补全日期信息,假设为每月的第一天 + String completeDateString = dateString + "01"; + // 解析为 LocalDate 对象 + LocalDate localDate = LocalDate.parse(completeDateString, formatDay); + // 减去一个月的时间间隔 + LocalDate lastMonthDate = localDate.minusMonths(1); + return lastMonthDate.format(format); } diff --git a/src/main/java/com/chint/infrastructure/config/LogConfig/LogService.java b/src/main/java/com/chint/infrastructure/config/LogConfig/LogService.java index 10050839..e19fadf3 100644 --- a/src/main/java/com/chint/infrastructure/config/LogConfig/LogService.java +++ b/src/main/java/com/chint/infrastructure/config/LogConfig/LogService.java @@ -86,13 +86,13 @@ public class LogService { @Async @Scheduled(cron = "0 0 4 * * 1") // 每周一凌晨4点执行一次 public void timedClearLog() { - //清空日志前一周的数据 - Integer count = jdbcSystemLogRepository.deleteLogsOlderThanOneMonth(7); + //清空日志前30天的数据 + Integer count = jdbcSystemLogRepository.deleteLogsOlderThanOneMonth(30); log.info("日志删除成功:{}条", count); //获取目前的日志总数量 long nums = jdbcSystemLogRepository.count(); - long maxLogCount = 1000000L; - //如果删除一个月前的日志数量后,表中数量还是大于100万条 + long maxLogCount = 3000000L; + //如果删除一个月前的日志数量后,表中数量还是大于300万条 if (nums > maxLogCount) { // 计算需要删除的记录数 long deleteCount = nums - maxLogCount; diff --git a/src/test/java/com/chint/ExcelTest.java b/src/test/java/com/chint/ExcelTest.java index 710d1e26..b4cedb15 100644 --- a/src/test/java/com/chint/ExcelTest.java +++ b/src/test/java/com/chint/ExcelTest.java @@ -60,6 +60,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -638,7 +639,7 @@ public class ExcelTest { System.out.println("bean = " + bean); } - @Test +// @Test public void testDto() { AtomicReference orderDetailRef = new AtomicReference<>(); OrderRecordBasic orderRecordBasic = getOrderRecordBasic("123", orderDetailRef::set); @@ -671,7 +672,7 @@ public class ExcelTest { return null; } - @Test +// @Test public void testStrDto() { String ab = "dadasd"; String[] split = ab.split("-"); @@ -679,7 +680,7 @@ public class ExcelTest { } //获取账期号 - @Test +// @Test public void getAccountPeriod() { // 获取当前时间 LocalDate now = LocalDate.now(); @@ -696,7 +697,7 @@ public class ExcelTest { @Autowired private JdbcRouteRepository repository; -// @Test + // @Test @Transactional public void getRouteOrder() throws Exception { int count = 0;//初始化变量