From cbe17bf5dbf2748873e51f08737a66f3b83d58ad Mon Sep 17 00:00:00 2001 From: lulz1 Date: Sat, 23 Mar 2024 09:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=A7=93=E5=90=8D=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../queryies/OrderDetailQuery.java | 7 - .../queryies/estimate/CTripEstimatePrice.java | 2 +- .../login/strategy/ANFeiShuLoginStrategy.java | 2 - .../domain/aggregates/order/OrderEvent.java | 2 +- .../domain/aggregates/user/UserName.java | 22 ++ .../CTripOrderExtensionFactoryImpl.java | 125 ++----- .../LYOrderExtensionFactoryImpl.java | 354 ++++++++++-------- .../order_detail/OrderDetailFactory.java | 1 + .../order_detail/OrderDetailFactoryImpl.java | 32 ++ .../order_detail/OrderExtensionFactory.java | 1 + .../repository/TravelStandardsRepository.java | 1 - .../domain/repository/UserNameRepository.java | 9 + .../TrainStandardsService.java | 23 +- .../infrastructure/constant/FSSCConstant.java | 2 + .../repository/UserNameRepositoryImpl.java | 20 + .../jdbc/JdbcUserNameRepository.java | 12 + .../dto/orderdetail/CarOrderDetailDto.java | 6 + .../rest/ctrip/CTripAllPOIInfoRequest.java | 29 +- .../rest/ctrip/CTripUserSaveRequest.java | 13 +- .../interfaces/rest/ly/LYUserRequest.java | 16 +- src/test/java/com/chint/CTripTest.java | 53 ++- src/test/java/com/chint/LYTest.java | 92 +++-- .../java/com/chint/RouteApplicationTests.java | 50 ++- 23 files changed, 542 insertions(+), 332 deletions(-) create mode 100644 src/main/java/com/chint/domain/aggregates/user/UserName.java create mode 100644 src/main/java/com/chint/domain/repository/UserNameRepository.java rename src/main/java/com/chint/domain/{aggregates/standards => service}/TrainStandardsService.java (54%) create mode 100644 src/main/java/com/chint/infrastructure/repository/UserNameRepositoryImpl.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserNameRepository.java diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index 0c945738..ffe7b34e 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -161,9 +161,6 @@ public class OrderDetailQuery { return null; } - - - HotelOrderDetailDto orderDetailDto = HotelOrderDetailDto.copyFrom(hotelOrderDetail); RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); orderDetailDto.setApplicantId(routeOrder.getUserId()); @@ -272,10 +269,6 @@ public class OrderDetailQuery { details = details.filter(it -> it.getStartTime() != null).filter(it -> it.getStartTime().isAfter(LocalDateTime.now())); } -// if(ifStart != null && ifStart.equals(1)){ -// details = details.filter(it->it.getStartTime().isBefore(LocalDateTime.now())); -// } - List res = details.toList(); Integer total = res.size(); List OrderDetailResList = res.stream().sorted(Comparator.comparing(OrderDetail::getUpdateTime).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(OrderDetailMapper::copyFromExtension).toList(); diff --git a/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java b/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java index c3d04362..8f2c620e 100644 --- a/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java +++ b/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java @@ -5,7 +5,7 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.standards.CityTag; -import com.chint.domain.aggregates.standards.TrainStandardsService; +import com.chint.domain.service.TrainStandardsService; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.LocationException; import com.chint.domain.repository.*; diff --git a/src/main/java/com/chint/application/services/login/strategy/ANFeiShuLoginStrategy.java b/src/main/java/com/chint/application/services/login/strategy/ANFeiShuLoginStrategy.java index 066ec62b..1bdf8776 100644 --- a/src/main/java/com/chint/application/services/login/strategy/ANFeiShuLoginStrategy.java +++ b/src/main/java/com/chint/application/services/login/strategy/ANFeiShuLoginStrategy.java @@ -40,8 +40,6 @@ public class ANFeiShuLoginStrategy implements LoginStrategy { log.info("开始执行飞书登录"); String appAccessTokenPath = "/open-apis/auth/v3/app_access_token/internal"; String userAccessTokenPath = "/open-apis/authen/v1/access_token"; - - // 获取 appAccessToken String appAccessTokenUrl = null; try { 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 1c76c580..e7bffcdd 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java @@ -162,7 +162,7 @@ public class OrderEvent implements Serializable { case ORDER_EVENT_PREPARE -> FSSC_CAR_STATUS_SUCCESS; case ORDER_EVENT_PAYED -> FSSC_CAR_STATUS_SUCCESS; case ORDER_EVENT_CHANGE -> FSSC_CAR_STATUS_SUCCESS; - case ORDER_EVENT_CANCEL -> FSSC_CAR_STATUS_SUCCESS; + case ORDER_EVENT_CANCEL -> FSSC_ORDER_STATUS_CANCEL; case ORDER_EVENT_ORDERED -> FSSC_CAR_STATUS_SUCCESS; case ORDER_EVENT_REFUND -> FSSC_CAR_STATUS_SUCCESS; case ORDER_EVENT_UNKNOWN -> FSSC_ORDER_STATUS_CANCEL; diff --git a/src/main/java/com/chint/domain/aggregates/user/UserName.java b/src/main/java/com/chint/domain/aggregates/user/UserName.java new file mode 100644 index 00000000..0b797e59 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/UserName.java @@ -0,0 +1,22 @@ +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_name") +public class UserName implements Serializable { + @Serial + private static final long serialVersionUID = 5602115854141241146L; + @Id + private Long id; + private String employeeNo; + private String sfName; + private String enName; + private String idName; + private String extension; +} diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java index f83d353a..92380b24 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -13,8 +13,6 @@ import com.chint.interfaces.rest.ctrip.dto.search.flight.*; import com.chint.interfaces.rest.ctrip.dto.search.hotel.ClientInfo; import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity; import com.chint.interfaces.rest.ctrip.dto.search.hotel.PaymentReceived; -import com.chint.interfaces.rest.ctrip.tools.CTripUtils; -import com.chint.interfaces.rest.ly.tools.LYOrderUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -50,66 +48,45 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { @Override public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { - + //获取基础信息数据 CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData; - CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo(); String orderNo = carBasicInfo.getOrderId(); String journeyNo = carBasicInfo.getJourneyID(); RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo); - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - Optional first = routeOrder.getOrderDetails() + OrderDetail orderDetail = routeOrder.getOrderDetails() .stream() - .filter(orderDetail -> orderDetail.getOrderNo().equals(orderNo)) - .findFirst(); + .filter(it -> it.getOrderNo().equals(orderNo)) + .findFirst() + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - CarOrderDetail carOrderDetail; - if (first.isPresent()) { - if (first.get().getCarOrderDetail() == null) { - carOrderDetail = new CarOrderDetail(); - } else { - carOrderDetail = first.get().getCarOrderDetail(); - } + CarOrderDetail carOrderDetail = orderDetailFactory.buildCarWithRouteOrderAndOrderDetail(routeOrder, orderDetail); + + //这里要更新用车的状态 + OrderEvent lastEvent = orderDetail.getLastEvent(); + if (lastEvent != null) { + carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus()); } else { - carOrderDetail = new CarOrderDetail(); + carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS); } - carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_CTRIP); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } + //这里根据用车费用是否有无的情况进行判断 , 如果有取消费 ,那么就为部分退订 + List orderFeeList = carQuickOrderInfoEntity.getOrderFeeList(); + if (orderFeeList != null && !orderFeeList.isEmpty()) { + orderFeeList.forEach(it-> { + if(it.getFeeName().equals("取消费")){ + carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND); + carOrderDetail.setCancellationFee(it.getAmount().toString()); + } + }); } - carOrderDetail.setOrderNo(orderNo); - carOrderDetail.setDetailId(orderNo); - - first.ifPresent(orderDetail -> { - OrderEvent lastEvent = orderDetail.getLastEvent(); - if (lastEvent != null) { - carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus()); - } else { - carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS); - } - }); - String employeeNo = routeOrder.getUserId(); - - User user = userRepository.findByUserEmployeeNo(employeeNo); - if (user != null) { - carOrderDetail.setBookingUserCode(user.getEmployeeNo()); - carOrderDetail.setBookingName(user.getName()); - carOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - } + return updateCarOrderDetailData(carOrderDetail, carOrderDetailData); + } + @Override + public CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail, Object carOrderDetailData) { + CarQuickOrderInfoEntity carQuickOrderInfoEntity = (CarQuickOrderInfoEntity) carOrderDetailData; CarPassengerInfo passengerInfo = carQuickOrderInfoEntity.getPassengerInfo(); if (passengerInfo != null) { @@ -120,7 +97,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { carOrderDetail.setBOOK_ORG_STRUCT_2(passengerInfo.getDept2()); carOrderDetail.setBOOK_ORG_STRUCT_3(passengerInfo.getDept3()); } - carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); + + CarBasicInfo carBasicInfo = carQuickOrderInfoEntity.getBasicInfo(); carOrderDetail.setCreateTime(carBasicInfo.getCreateTime()); carOrderDetail.setOrderAmount(String.valueOf(carBasicInfo.getOrderAmount())); carOrderDetail.setCompanyPaymentAmount(String.valueOf(carBasicInfo.getAccntAmount())); @@ -131,18 +109,17 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { carOrderDetail.setPaymentType("1"); } - if (!carQuickOrderInfoEntity.getOrderFeeList().isEmpty()) { - OrderFee orderFee = carQuickOrderInfoEntity.getOrderFeeList().get(0); - if (orderFee.getFeeName().equals("取消费")) { - carOrderDetail.setCancellationFee(orderFee.getAmount().toString()); - } else { - } - } OrderProduct orderProduct = carQuickOrderInfoEntity.getOrderProduct(); if (orderProduct != null) { - carOrderDetail.setStartTime(orderProduct.getServiceBeginTime()); - carOrderDetail.setArriveTime(orderProduct.getServiceEndTime()); + //这里判断用车成功的加入服务开始时间和结束时间,失败的话使用订单的创建时间 + if(carOrderDetail.getOrderStatus().equals(FSSC_CAR_STATUS_SUCCESS)){ + carOrderDetail.setStartTime(orderProduct.getServiceBeginTime()); + carOrderDetail.setArriveTime(orderProduct.getServiceEndTime()); + } else { + carOrderDetail.setStartTime(carOrderDetail.getCreateTime()); + carOrderDetail.setArriveTime(carOrderDetail.getCreateTime()); + } carOrderDetail.setMileage(orderProduct.getNormalDistance()); carOrderDetail.setRunTime(orderProduct.getNormalTime()); Address depAddress = orderProduct.getDepartAddress(); @@ -154,34 +131,6 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { Vehicle vehicle = orderProduct.getVehicle(); carOrderDetail.setCarModel(vehicle.getVehicleName()); } - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - if (approveOrderNo != null) { - carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); - carOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); - carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); - } - OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carBasicInfo.getOrderId()) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - Optional firstOrderEvent = orderDetail.getOrderEventList() - .stream() - .map(OrderEvent::getEventType) - .filter(it -> it.equals(ORDER_EVENT_ETA)) - .findFirst(); - - if (firstOrderEvent.isEmpty()) { - carOrderDetail.setOverStandard("否"); //无 - } else { - carOrderDetail.setOverStandard("是"); //无 - } - Optional first1 = orderDetail.getOrderEventList() - .stream() - .findFirst(); - first1.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension())); - - // derDetail.setTollFee(tollFee);// 无 - return carOrderDetail; } @@ -222,7 +171,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); } //携程创建的飞机订单只有 - if(!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)){ + if (!flightOrderDetail.getOrderStatus().equals(FSSC_ORDER_STATUS_CANCEL)) { flightOrderDetail.setOrderStatus(FSSC_FLIGHT_STATUS_SUCCESS); } }); diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java index 9c51e474..50b84acb 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/LYOrderExtensionFactoryImpl.java @@ -7,6 +7,7 @@ import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.UserRepository; +import com.chint.interfaces.rest.ly.dto.carorderdatapushback.PriceDetail; import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident; import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; @@ -27,6 +28,7 @@ import java.util.stream.Collectors; import static com.chint.infrastructure.constant.BelongSystemConstant.*; import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND; import static com.chint.infrastructure.constant.FSSCConstant.*; +import static com.chint.infrastructure.constant.LYConstant.L_Y_CAR_FEE_TYPE_CANCEL; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_CN_NAME; @@ -59,7 +61,200 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { @Override public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData; - CarOrderDetail carOrderDetail = convertCarOrderDetail(data); + CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo(); + String orderSerialNo = carOrderDetailInfo.getOrderSerialNo(); + + OrderDetail orderDetail = orderDetailRepository.findByOrderNo(orderSerialNo) + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId()); + CarOrderDetail carOrderDetail = orderDetailFactory.buildCarWithRouteOrderAndOrderDetail(routeOrder, orderDetail); + + //这里要更新用车的状态 + OrderEvent lastEvent = orderDetail.getLastEvent(); + if (lastEvent != null) { + carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus()); + } else { + carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS); + } + + List priceDetailList = data.getPriceDetailList(); + if (priceDetailList != null && !priceDetailList.isEmpty()) { + priceDetailList.forEach(it -> { + if (it.getType().equals(L_Y_CAR_FEE_TYPE_CANCEL)) { + carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND); + carOrderDetail.setCancellationFee(it.getDisplayValue()); + } + }); + } + return carOrderDetail; + } + + @Override + public CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail, Object carOrderDetailData) { + CarDetailResponse.DataWrapper data = (CarDetailResponse.DataWrapper) carOrderDetailData; + CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo(); + CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo(); + + carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime()); + carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice())); + carOrderDetail.setUserName(carOrderDetailInfo.getContactName()); + carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId()); + carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone()); + + carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice())); + carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice())); + + if (carOrderDetailInfo.getPayType() == 1) { + carOrderDetail.setPaymentType("0"); //无 + } else { + carOrderDetail.setPaymentType("1"); //无 + } + + if (orderExtendInfo != null) { + carOrderDetail.setStartTime(orderExtendInfo.getChargeTime()); + carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime()); + carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress()); + carOrderDetail.setToStationName(orderExtendInfo.getEndAddress()); + carOrderDetail.setFromCity(orderExtendInfo.getStartCityName()); + carOrderDetail.setToCity(orderExtendInfo.getEndCityName()); + String duration = orderExtendInfo.getDuration(); + String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); + carOrderDetail.setRunTime(durationNumbers); + String mileage = orderExtendInfo.getMileage(); + String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); + carOrderDetail.setMileage(mileageNumbers); + carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName())); + } + return carOrderDetail; + } + + private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) { + CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo(); + CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo(); + CarDetailResponse.OrderDriverInfo orderDriverInfo = data.getOrderDriverInfo(); + CarOrderDetail carOrderDetail = new CarOrderDetail(); + RouteOrder routeOrder = null; + if (carOrderDetailInfo != null) { + OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo()) + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + routeOrder = routeRepository.queryById(orderDetail.getRouteId()); + String sysCode = routeOrder.getApproveOrderNo().getSysCode(); + + carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); + if (sysCode != null) { + if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { + carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { + carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); + + } + if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { + carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); + } + if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { + carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); + } + } + + carOrderDetail.setOrderNo(carOrderDetailInfo.getOrderSerialNo()); + carOrderDetail.setDetailId(carOrderDetailInfo.getOrderSerialNo()); + Optional firstOrderDetail = routeOrder + .getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().equals(carOrderDetail.getOrderNo())) + .findFirst(); + + firstOrderDetail.ifPresent(it -> { + OrderEvent lastEvent = it.getLastEvent(); + if (lastEvent != null) { + carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus()); + } else { + //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 + Integer orderStatus = carOrderDetailInfo.getOrderStatus(); + carOrderDetail.setOrderStatus( + OrderEvent.mapToCarOrderDetailStatus( + LYOrderUtil.mapCarStatus(orderStatus) + ) + ); + } + } + ); + + String EmployeeNo = routeOrder.getUserId(); + User user = userRepository.findByUserEmployeeNo(EmployeeNo); + + if (user != null) { + carOrderDetail.setBookingUserCode(user.getEmployeeNo()); + carOrderDetail.setBookingName(user.getName()); + carOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + } + carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime()); + carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice())); + carOrderDetail.setUserName(carOrderDetailInfo.getContactName()); + carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId()); + carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone()); + + carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice())); + carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice())); + + if (Double.valueOf(carOrderDetail.getCompanyPaymentAmount()) > 0) { + carOrderDetail.setPaymentType("0"); //无 + } else { + carOrderDetail.setPaymentType("1"); //无 + } + } + + carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); + + if (orderExtendInfo != null) { + carOrderDetail.setStartTime(orderExtendInfo.getChargeTime()); + carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime()); + carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress()); + carOrderDetail.setToStationName(orderExtendInfo.getEndAddress()); + carOrderDetail.setFromCity(orderExtendInfo.getStartCityName()); + carOrderDetail.setToCity(orderExtendInfo.getEndCityName()); + + String duration = orderExtendInfo.getDuration(); + String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); + carOrderDetail.setRunTime(durationNumbers); + + String mileage = orderExtendInfo.getMileage(); + String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); + carOrderDetail.setMileage(mileageNumbers); + carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName())); + } + + + List submitItemList = + data.getTravelDataInfo().getSubmitItemList(); + + ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); + if (approveOrderNo != null) { + carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); + carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); + carOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); + carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); + } + + OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo()) + .orElseThrow(() -> new NotFoundException(NOT_FOUND)); + Optional firstOrderEvent = orderDetail.getOrderEventList() + .stream() + .map(OrderEvent::getEventType) + .filter(it -> it.equals(ORDER_EVENT_ETA)) + .findFirst(); + + if (firstOrderEvent.isEmpty()) { + carOrderDetail.setOverStandard("否"); //无 + } else { + carOrderDetail.setOverStandard("是"); //无 + } + + Optional first2 = orderDetail.getOrderEventList() + .stream() + .findFirst(); + first2.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension())); return carOrderDetail; } @@ -487,7 +682,6 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { TrainDetailResponse.TravelData travelData = trainDetailData.getTravelData(); String travelApplyNo = travelData.getTravelApplyNo(); - //这里对火车的进行信息进行录入 trainOrderDetail.setReceiptsNum(travelApplyNo); trainOrderDetail.setCreateTime(formatter.format(LocalDateTime.now())); @@ -753,161 +947,17 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory { case "secondseat" -> "二等座"; case "businessseat" -> "商务座"; case "hardseat" -> "二等座"; - case "softsleeperup" -> "软卧"; - case "hardsleeperup" -> "硬卧"; + case "softsleeperup" -> "软卧上铺"; + case "hardsleeperup" -> "硬卧上铺"; case "firstseat" -> "一等座"; + case "softsleeperdown" -> "软卧下铺"; + case "hardsleeperdown" -> "硬卧下铺"; + case "softsleepermid" -> "软卧中铺"; + case "hardsleepermid" -> "硬卧中铺"; default -> "未知类型座位"; }; } - private CarOrderDetail convertCarOrderDetail(CarDetailResponse.DataWrapper data) { - - CarDetailResponse.CarOrderDetailInfo carOrderDetailInfo = data.getCarOrderDetailInfo(); - CarDetailResponse.OrderExtendInfo orderExtendInfo = data.getOrderExtendInfo(); - - CarDetailResponse.OrderDriverInfo orderDriverInfo = data.getOrderDriverInfo(); - - CarOrderDetail carOrderDetail = new CarOrderDetail(); - RouteOrder routeOrder = null; - if (carOrderDetailInfo != null) { - OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo()) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - routeOrder = routeRepository.queryById(orderDetail.getRouteId()); - String sysCode = routeOrder.getApproveOrderNo().getSysCode(); - - carOrderDetail.setTrvaleSysType(TRAVAL_SYS_TYPE_LY); - if (sysCode != null) { - if (sysCode.equals(BELONG_SYS_CODE_FSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_FSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_H3BPM)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_H3BPM); - - } - if (sysCode.equals(BELONG_SYS_CODE_XNFSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_XNFSSC); - } - if (sysCode.equals(BELONG_SYS_CODE_ANFSSC)) { - carOrderDetail.setBelongSysType(BELONG_SYS_TYPE_ANFSSC); - } - } - - carOrderDetail.setOrderNo(carOrderDetailInfo.getOrderSerialNo()); - carOrderDetail.setDetailId(carOrderDetailInfo.getOrderSerialNo()); - Optional firstOrderDetail = routeOrder - .getOrderDetails() - .stream() - .filter(it -> it.getOrderNo().equals(carOrderDetail.getOrderNo())) - .findFirst(); - - firstOrderDetail.ifPresent(it -> { - OrderEvent lastEvent = it.getLastEvent(); - if (lastEvent != null) { - carOrderDetail.setOrderStatus(lastEvent.mapToCarOrderDetailStatus()); - } else { - //如果订单事件为空,那么就需要重新根据查询到的订单信息重新进行映射 - Integer orderStatus = carOrderDetailInfo.getOrderStatus(); - carOrderDetail.setOrderStatus( - OrderEvent.mapToCarOrderDetailStatus( - LYOrderUtil.mapCarStatus(orderStatus) - ) - ); - } - } - ); - - String EmployeeNo = routeOrder.getUserId(); - User user = userRepository.findByUserEmployeeNo(EmployeeNo); - - if (user != null) { - carOrderDetail.setBookingUserCode(user.getEmployeeNo()); - carOrderDetail.setBookingName(user.getName()); - carOrderDetail.setBookingUserPhone(user.getPhoneNumber()); - } - carOrderDetail.setCreateTime(carOrderDetailInfo.getCreateTime()); - carOrderDetail.setOrderAmount(String.valueOf(carOrderDetailInfo.getTotalPrice())); - carOrderDetail.setUserName(carOrderDetailInfo.getContactName()); - carOrderDetail.setUserCode(carOrderDetailInfo.getOutEmployeeId()); - carOrderDetail.setPhone(carOrderDetailInfo.getContactPhone()); - - carOrderDetail.setPersonalPaymentAmount(String.valueOf(carOrderDetailInfo.getPersonalPrice())); - carOrderDetail.setCompanyPaymentAmount(String.valueOf(carOrderDetailInfo.getCompanyPrice())); - - if (Double.valueOf(carOrderDetail.getCompanyPaymentAmount()) > 0) { - carOrderDetail.setPaymentType("0"); //无 - } else { - carOrderDetail.setPaymentType("1"); //无 - } - } - - carOrderDetail.setReceiptsNum(routeOrder.getRouteOrderNo()); - - if (orderExtendInfo != null) { - carOrderDetail.setStartTime(orderExtendInfo.getChargeTime()); - carOrderDetail.setArriveTime(orderExtendInfo.getFinishTime()); - carOrderDetail.setFromStationName(orderExtendInfo.getStartAddress()); - carOrderDetail.setToStationName(orderExtendInfo.getEndAddress()); - carOrderDetail.setFromCity(orderExtendInfo.getStartCityName()); - carOrderDetail.setToCity(orderExtendInfo.getEndCityName()); - - String duration = orderExtendInfo.getDuration(); - String durationNumbers = duration.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); - carOrderDetail.setRunTime(durationNumbers); - - String mileage = orderExtendInfo.getMileage(); - String mileageNumbers = mileage.replaceAll("[^\\u0000-\\u007F\\p{P}]", ""); - carOrderDetail.setMileage(mileageNumbers); - carOrderDetail.setCarModel(String.valueOf(orderExtendInfo.getCarTypeName())); - } - - - List submitItemList = - data.getTravelDataInfo().getSubmitItemList(); - - ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); - if (approveOrderNo != null) { - carOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompanyCode()); - carOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName()); - carOrderDetail.setCostCenter(approveOrderNo.getCostCenter()); - carOrderDetail.setProjectOrderNo(approveOrderNo.getProjectName()); - } - - OrderDetail orderDetail = orderDetailRepository.findByOrderNo(carOrderDetailInfo.getOrderSerialNo()) - .orElseThrow(() -> new NotFoundException(NOT_FOUND)); - Optional firstOrderEvent = orderDetail.getOrderEventList() - .stream() - .map(OrderEvent::getEventType) - .filter(it -> it.equals(ORDER_EVENT_ETA)) - .findFirst(); - - if (firstOrderEvent.isEmpty()) { - carOrderDetail.setOverStandard("否"); //无 - } else { - carOrderDetail.setOverStandard("是"); //无 - } - - Optional first2 = orderDetail.getOrderEventList() - .stream() - .findFirst(); - first2.ifPresent(orderEvent -> carOrderDetail.setOverStandardReason(orderEvent.getExtension())); - - - // carOrderDetail.setParentOrderNo(parentOrderNo); //无 - // carOrderDetail.setOriginalOrderNo(originalOrderNo); //无 - - // carOrderDetail.setScheduleNum(scheduleNum); //无 - - // carOrderDetail.setCancellationFee(cancellationFee); //无 - // carOrderDetail.setStandardItems(standardItems); //无 - - // carOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); //无 - // carOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); //无 - // carOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); //无 - // carOrderDetail.setTollFee(tollFee); //无 - - - return carOrderDetail; - } private List getCustomers(List residentList) { diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java index 7cf32a8a..a6acf881 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactory.java @@ -17,4 +17,5 @@ public interface OrderDetailFactory { TrainOrderDetail buildTrainWithRouteOrderAndOrderDetail(RouteOrder routeOrder, Optional orderDetail); HotelOrderDetail buildHotelWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); + CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail); } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java index ace0abe6..2b80e82b 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderDetailFactoryImpl.java @@ -198,4 +198,36 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { return hotelOrderDetail; } + + @Override + public CarOrderDetail buildCarWithRouteOrderAndOrderDetail(RouteOrder routeOrder, OrderDetail orderDetail) { + //获取飞机订单明细 + CarOrderDetail carOrderDetail; + if (orderDetail.getCarOrderDetail() == null) { + carOrderDetail = BeanUtil.copyProperties(buildWithRouteOrder(routeOrder), CarOrderDetail.class); + } else { + //如果已经存在的话 ,那么这些基础字段就不用重新构建了 + return orderDetail.getCarOrderDetail(); + } + + //如果订单存在,直接配置该订单的超标信息和原因 + if(orderDetail.getOrderEventList() != null){ + orderDetail.getOrderEventList() + .stream() + .filter(it -> it.getEventType().equals(ORDER_EVENT_ETA)) + .findFirst() + .ifPresentOrElse(it -> { + carOrderDetail.setOverStandard("是"); + carOrderDetail.setOverStandardReason(it.getExtension()); + }, () -> carOrderDetail.setOverStandard("否")); + carOrderDetail.setOrderNo(orderDetail.getOrderNo()); + carOrderDetail.setDetailId(orderDetail.getOrderNo()); + + User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); + carOrderDetail.setBookingUserCode(user.getEmployeeNo()); + carOrderDetail.setBookingName(user.getName()); + carOrderDetail.setBookingUserPhone(user.getPhoneNumber()); + } + return carOrderDetail; + } } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java index 00f4e721..6e4acc2f 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/OrderExtensionFactory.java @@ -5,6 +5,7 @@ import com.chint.domain.aggregates.order.*; public interface OrderExtensionFactory { CarOrderDetail createCarOrderDetail(Object carOrderDetailData); + CarOrderDetail updateCarOrderDetailData(CarOrderDetail carOrderDetail ,Object carOrderDetailData); TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData); diff --git a/src/main/java/com/chint/domain/repository/TravelStandardsRepository.java b/src/main/java/com/chint/domain/repository/TravelStandardsRepository.java index b0844ad6..de10a169 100644 --- a/src/main/java/com/chint/domain/repository/TravelStandardsRepository.java +++ b/src/main/java/com/chint/domain/repository/TravelStandardsRepository.java @@ -14,7 +14,6 @@ public interface TravelStandardsRepository { List findAllTrain(); List findByStandardLevel(String standardLevel); List findByStandardLevelAndProductType(String standardLevel, String productType); - List findByTravelStandards(TravelStandards travelStandards); } diff --git a/src/main/java/com/chint/domain/repository/UserNameRepository.java b/src/main/java/com/chint/domain/repository/UserNameRepository.java new file mode 100644 index 00000000..bf2c3638 --- /dev/null +++ b/src/main/java/com/chint/domain/repository/UserNameRepository.java @@ -0,0 +1,9 @@ +package com.chint.domain.repository; + +import com.chint.domain.aggregates.user.UserName; + +import java.util.Optional; + +public interface UserNameRepository { + Optional findByEmployeeNo(String employeeNo); +} diff --git a/src/main/java/com/chint/domain/aggregates/standards/TrainStandardsService.java b/src/main/java/com/chint/domain/service/TrainStandardsService.java similarity index 54% rename from src/main/java/com/chint/domain/aggregates/standards/TrainStandardsService.java rename to src/main/java/com/chint/domain/service/TrainStandardsService.java index ec1c51b7..b9bb9fd7 100644 --- a/src/main/java/com/chint/domain/aggregates/standards/TrainStandardsService.java +++ b/src/main/java/com/chint/domain/service/TrainStandardsService.java @@ -1,6 +1,7 @@ -package com.chint.domain.aggregates.standards; +package com.chint.domain.service; +import com.chint.domain.aggregates.standards.TravelStandards; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.TravelStandardsRepository; import jakarta.annotation.PostConstruct; @@ -21,15 +22,8 @@ public class TrainStandardsService { @Autowired private TravelStandardsRepository travelStandardsRepository; -// @PostConstruct -// private void init() { -// List allTrain = travelStandardsRepository.findAllTrain(); -// allTrain.forEach(it -> trainStandardsMap.put(it.getStandardLevel(), it.getPrice())); -// } - @Cacheable(value = "TrainStandards" , key = "#standardLevel") public String priceTrainStandards(String standardLevel) { - List byStandardLevelAndProductType = travelStandardsRepository. findByStandardLevelAndProductType(standardLevel, String.valueOf(LEG_TYPE_TRAIN)); if (byStandardLevelAndProductType.isEmpty()) { @@ -37,18 +31,5 @@ public class TrainStandardsService { } TravelStandards travelStandards = byStandardLevelAndProductType.get(0); return travelStandards.getPrice(); - -// if (trainStandardsMap.containsKey(standardLevel)) { -// return trainStandardsMap.get(standardLevel); -// } else { -// List byStandardLevelAndProductType = travelStandardsRepository. -// findByStandardLevelAndProductType(standardLevel, String.valueOf(LEG_TYPE_TRAIN)); -// if (byStandardLevelAndProductType.isEmpty()) { -// throw new NotFoundException("火车相关差标未配置,请联系管理员"); -// } -// TravelStandards travelStandards = byStandardLevelAndProductType.get(0); -// trainStandardsMap.put(travelStandards.getStandardLevel(), travelStandards.getPrice()); -// return travelStandards.getPrice(); -// } } } diff --git a/src/main/java/com/chint/infrastructure/constant/FSSCConstant.java b/src/main/java/com/chint/infrastructure/constant/FSSCConstant.java index cae4c81c..7ce6e6cd 100644 --- a/src/main/java/com/chint/infrastructure/constant/FSSCConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/FSSCConstant.java @@ -29,6 +29,8 @@ public class FSSCConstant { public static final String FSSC_TRAIN_STATUS_REFUND = "3";//申请单类型 public static final String FSSC_CAR_STATUS_SUCCESS = "1";//申请单类型 + public static final String FSSC_CAR_STATUS_REFUND = "3";//申请单类型 + public static final String FSSC_CAR_STATUS_HALF_REFUND = "4";//申请单类型 diff --git a/src/main/java/com/chint/infrastructure/repository/UserNameRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/UserNameRepositoryImpl.java new file mode 100644 index 00000000..1d5d7fbb --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/UserNameRepositoryImpl.java @@ -0,0 +1,20 @@ +package com.chint.infrastructure.repository; + + +import com.chint.domain.aggregates.user.UserName; +import com.chint.domain.repository.UserNameRepository; +import com.chint.infrastructure.repository.jdbc.JdbcUserNameRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public class UserNameRepositoryImpl implements UserNameRepository { + @Autowired + private JdbcUserNameRepository jdbcUserNameRepository; + @Override + public Optional findByEmployeeNo(String employeeNo) { + return jdbcUserNameRepository.findByEmployeeNo(employeeNo); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserNameRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserNameRepository.java new file mode 100644 index 00000000..02199eaa --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserNameRepository.java @@ -0,0 +1,12 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.user.UserName; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface JdbcUserNameRepository extends CrudRepository { + Optional findByEmployeeNo(String employeeNo); +} diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java index e9b84915..875a7201 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/orderdetail/CarOrderDetailDto.java @@ -96,6 +96,8 @@ public class CarOrderDetailDto implements Serializable { // 取消费 private String cancellationFee; + // 取消费 + private String cancelFee; // 差标 private String standardItems; @@ -153,6 +155,10 @@ public class CarOrderDetailDto implements Serializable { } CarOrderDetailDto carOrderDetailDto = BeanUtil.copyProperties(carOrderDetail, CarOrderDetailDto.class); carOrderDetailDto.setCarType(carOrderDetail.getCarModel()); + String cancellationFee = carOrderDetailDto.getCancellationFee(); + if(cancellationFee != null){ + carOrderDetailDto.setCancelFee(cancellationFee); + } return carOrderDetailDto; } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripAllPOIInfoRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripAllPOIInfoRequest.java index ace33236..f46cee3c 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripAllPOIInfoRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripAllPOIInfoRequest.java @@ -42,9 +42,7 @@ public class CTripAllPOIInfoRequest { public QueryAllPOIInfoResponseType getAllPOIInfoQuery(Long countryId) { - Authentification authentification = new Authentification(C_TRIP_APP_KEY, ticketRequest.loadTicket()); - QueryAllPOIInfoRequestType request = QueryAllPOIInfoRequestType.builder() .setAuth(authentification) .setCountryId(countryId) @@ -64,12 +62,35 @@ public class CTripAllPOIInfoRequest { .setReturnBusStation(false) .done() // returns to QueryAllPOIInfoRequestType.Builder .build(); - QueryAllPOIInfoResponseType allPOIInfoResponseType = postRequest.post(allPOIInfoUrl, request, QueryAllPOIInfoResponseType.class); - return allPOIInfoResponseType; + } + public QueryAllPOIInfoResponseType getAirPortInfoByCityInfo(){ + Authentification authentification = new Authentification(C_TRIP_APP_KEY, ticketRequest.loadTicket()); + QueryAllPOIInfoRequestType request = QueryAllPOIInfoRequestType.builder() + .setAuth(authentification) + .setCountryId(336L) + .provinceConditions() + .setProvinceIds("16") + .setProvinceNames("") + .prefectureLevelCityConditions() + .setPrefectureLevelCityIds("") + .setPrefectureLevelCityNames("") + .setReturnDistrict(true) + .setReturnCounty(true) + .done() // returns to ProvinceCondition.Builder + .done() // returns to QueryAllPOIInfoRequestType.Builder + .poiConditions() + .setReturnAirport(true) + .setReturnTrainStation(true) + .setReturnBusStation(true) + .done() // returns to QueryAllPOIInfoRequestType.Builder + .build(); + QueryAllPOIInfoResponseType allPOIInfoResponseType = postRequest.post(allPOIInfoUrl, request, + QueryAllPOIInfoResponseType.class); + return allPOIInfoResponseType; } } diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java index 321c6a76..4a86bb52 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripUserSaveRequest.java @@ -1,6 +1,7 @@ package com.chint.interfaces.rest.ctrip; import com.chint.domain.aggregates.user.User; +import com.chint.domain.repository.UserNameRepository; import com.chint.infrastructure.constant.CTripConstant; import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.base.PostRequest; @@ -27,6 +28,9 @@ public class CTripUserSaveRequest { @Autowired private CTripTicketRequest ticketRequest; + @Autowired + private UserNameRepository userNameRepository; + @Value("${cTrip.baseUrl}") public String C_TRIP_BASE_URL; @@ -37,7 +41,8 @@ public class CTripUserSaveRequest { @Value("${cTrip.subAccountName}") private String subAccountName; - private String userUrl; + private String userUrl; + @Autowired public CTripUserSaveRequest(PostRequest postRequest, UserHttpRequest userHttpRequest, @@ -91,9 +96,9 @@ public class CTripUserSaveRequest { public AuthenticationEntity buildAuthenticationEntityWithUser(User user) { AuthenticationEntity authenticationEntity = new AuthenticationEntity(); - authenticationEntity.setName(user.getName()); - authenticationEntity.setEmployeeID(user.getEmployeeNo().toString()); -// authenticationEntity.setRankName(user.getStandardLevel()); + userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it -> authenticationEntity.setName(it.getIdName()), + () -> authenticationEntity.setName(user.getName())); + authenticationEntity.setEmployeeID(user.getEmployeeNo()); authenticationEntity.setValid(user.getWorkStatus()); authenticationEntity.setSubAccountName(subAccountName); return authenticationEntity; diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java index 2a8d169d..bad63bfd 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYUserRequest.java @@ -1,6 +1,7 @@ package com.chint.interfaces.rest.ly; import com.chint.domain.aggregates.user.User; +import com.chint.domain.repository.UserNameRepository; import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.ly.dto.user.EmployeeEntity; import com.chint.interfaces.rest.ly.dto.user.EmployeeRequest; @@ -31,6 +32,9 @@ public class LYUserRequest { @Autowired private UserHttpRequest userHttpRequest; + @Autowired + private UserNameRepository userNameRepository; + private String userUrl; @PostConstruct @@ -82,21 +86,13 @@ public class LYUserRequest { private EmployeeEntity user2LYEmployee(User user) { EmployeeEntity employeeEntity = new EmployeeEntity(); employeeEntity.setOutEmployeeId(String.valueOf(user.getEmployeeNo())); - employeeEntity.setSurName(user.getName()); + userNameRepository.findByEmployeeNo(user.getEmployeeNo()).ifPresentOrElse(it->employeeEntity.setSurName(it.getIdName()), + ()-> employeeEntity.setSurName(user.getName())); employeeEntity.setGender(translateGender(user.getGender())); employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus())); employeeEntity.setReservationType(0); String standardLevel = user.getStandardLevel(); employeeEntity.setPositionLevelName(standardLevel); -// List preTravelPolicyList = List.of( -// new PreTravelPolicy(standardLevel, 1), -// new PreTravelPolicy(standardLevel, 2), -// new PreTravelPolicy(standardLevel, 3), -// new PreTravelPolicy(standardLevel, 4), -// new PreTravelPolicy(standardLevel, 5), -// new PreTravelPolicy(standardLevel, 6) -// ); -// employeeEntity.setPreTravelPolicyList(preTravelPolicyList); return employeeEntity; } } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index f0bb5fe7..ec07c912 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -4,16 +4,20 @@ import com.chint.domain.aggregates.location.basedata.CountryInfoEntity; 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.ctrip.CtripCarOrderDetail; import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail; import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail; import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail; import com.chint.domain.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.util.BaseContext; +import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.PinyinUtil; +import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.*; import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse; import com.chint.interfaces.rest.ctrip.dto.country.CountryResponse; @@ -31,12 +35,15 @@ import com.chint.interfaces.rest.ctrip.dto.order.OrderCarResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderFlightResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderHotelResponse; import com.chint.interfaces.rest.ctrip.dto.order.OrderTrainResponse; +import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse; +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.google.gson.Gson; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import java.util.*; @@ -104,8 +111,27 @@ public class CTripTest { @Autowired private DistrictInfoRepository districtInfoRepository; + @Autowired + private CTripOrderSyncAdapter cTripOrderSyncAdapter; + + @Autowired + private RouteRepository routeRepository; + + @Autowired + private PostRequest postRequest; + + + @Value("${cTrip.requestSecret}") + private String C_TRIP_REQUEST_SECRET; + + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); + @Test + void syncOrder(){ + RouteOrder routeOrder = routeRepository.queryById(3892L); + cTripOrderSyncAdapter.syncSupplierOrder(routeOrder); + } //@Test void locationCountry() { @@ -213,7 +239,7 @@ public class CTripTest { // @Test void search() { BaseContext.setCurrentUser(user); - SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30410372171"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31115593644"); System.out.println(response); } @@ -535,4 +561,29 @@ public class CTripTest { } } +// @Test + void batchPush(){ + + List strings = List.of( + "31060889641"); + for (String string : strings) { + CTripStatusNotification item = new CTripStatusNotification(); + item.setApproveScenario(""); + item.setCorpId("zhengtai2024"); + item.setOrderId(string); + item.setOrderStatus("Dealt"); + item.setProductType("HotelContract"); + item.setRefundType(null); + item.setStatusIDs(null); + String putCTripSign = Digest.getPutCTripStatusSign(item.getCorpId(), item.getProductType(), item.getOrderStatus(), item.getOrderId(), C_TRIP_REQUEST_SECRET); + item.setSign(putCTripSign); + + CTripNoteResponse post = postRequest.post("https://trip.chint.com/api/public/CTrip/status", item, CTripNoteResponse.class); + System.out.println(post.getErrorCode()); + System.out.println(post.getErrorMessage()); + } + + + } + } diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index d65b6ceb..97d34546 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -8,9 +8,11 @@ import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowRespo import com.chint.application.commands.RefundOrderGenerateCommand; import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderTravel; +import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.RouteRepository; +import com.chint.domain.service.order_sync.LYOrderSyncAdapter; import com.chint.infrastructure.constant.LYConstant; import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; @@ -22,6 +24,7 @@ import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; import com.chint.interfaces.rest.bpm.XNBPM.YSTokenDto; import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse; import com.chint.interfaces.rest.bpm.dto.*; +import com.chint.interfaces.rest.bpm.dto.orderdetail.HotelOrderDetailDto; import com.chint.interfaces.rest.ly.*; import com.chint.interfaces.rest.ly.dto.applyordersync.*; import com.chint.interfaces.rest.ly.dto.commonresult.Result; @@ -30,12 +33,7 @@ import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; -import com.chint.interfaces.rest.ly.dto.strokepush.Param; - -import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController; -import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO; import com.chint.interfaces.rest.ly.in.CommonController; - import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -52,7 +50,6 @@ import java.util.*; import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL; import static com.chint.infrastructure.constant.BPMConstant.YSBPM_TOKEN_URL; -import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y_BPM_NAME; @SpringBootTest public class LYTest { @@ -89,6 +86,10 @@ public class LYTest { @Value("${ly.baseUrl}") private String lyBaseUrl; + + @Autowired + private LYOrderSyncAdapter lyOrderSyncAdapter; + @Autowired private BPMRequest bpmRequest; @@ -801,41 +802,42 @@ public class LYTest { String join = String.join(",", set); System.out.println("join = " + join); } -// @Test + @Test void searchFlight() { - FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24031967216947447"); + FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24032167509129714"); Gson gson = new Gson(); String json = gson.toJson(flightOrderDetail); System.out.println(json); } -// @Test + @Test void searchTrain() { - TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767013846252"); + TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24032167537614664"); Gson gson = new Gson(); String json = gson.toJson(trainOrderDetail); System.out.println(json); } -// @Test + @Test void searchHotel() { - HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240317101300570508"); + HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail("HO20240320223900768299"); Gson gson = new Gson(); String json = gson.toJson(hotelOrderDetail); System.out.println(json); } -// @Test + @Test void searchCar() { - CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24031466726324898"); + CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse("DC24032067374218877"); Gson gson = new Gson(); String json = gson.toJson(carDetailResponse); System.out.println(json); } -// @Test + @Test void deleteOrderDetailById(){ - orderDetailRepository.deleteById(1433L); + orderDetailRepository.deleteById(1725L); + orderDetailRepository.deleteById(1716L); } // @Test @@ -847,7 +849,7 @@ public class LYTest { // System.out.println(json); - TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail("DTC24031767013846252"); + TrainDetailResponse trainDetailResponse = lySearchRequest.getTrainOrderDetail(" DTC24031767013846252"); Gson gson = new Gson(); String json = gson.toJson(trainDetailResponse); System.out.println(json); @@ -865,21 +867,30 @@ public class LYTest { // System.out.println(json); } -// @Test + @Test + void testRoomStandard(){ + String dayStandardPrice = "300.00"; + String[] split = dayStandardPrice.split(","); + List list = Arrays.asList(split); + if (!list.isEmpty()) { + System.out.println(list.get(0)); + } + } + + @Test void conform() { commonController.changeFlight(1, 9, "DFC24031767042246246"); } -// @Test + @Test void sendMsg() { - commonController.sendMsg("T24031867123861097"); + commonController.sendMsg("T24032167509127504"); } - // DTC24031466757493927 -// DTC24031466757493927 -// @Test + + @Test void generateLyTrain() { - TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031466757493927"); + TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DTC24031767004591541"); TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData(); if (data != null && data.getOrderStatus().equals("T") && data.getItems() != null && !data.getItems().isEmpty()) { TrainDetailResponse.Item item = data.getItems().get(0); @@ -894,17 +905,30 @@ public class LYTest { } System.out.println(trainOrderDetail); } - @Autowired - private StrokeController strokeController; -// @Test - public void aaaa() { - StrokePushDTO strokePushDTO = new StrokePushDTO(); - Param param = new Param(); - param.setTravelBizOrderNo("T24031967219916513")//同程行程单号 - .setApprovalStatus(2);//1驳回 2通过 - strokePushDTO.setParam(param); - strokeController.strokePush(strokePushDTO); +// @Test + void syncToSupplierLy(){ + List integers = List.of(3, 5, 19, 20, 31, 34, 36, 63, 73, 76, 86, 102, 104, 109, 110, 143, 147, 150, 155, 172, 182, 196, 200, 204, 212, 214, 230, 301, 314, 343, 365, 379, 382, 399, 402, 438, 446, 448, 487, 551, 563, 580, 588, 595, 599, 607, 612, 613, 622, 664, 665, 669, 672, 673, 674, 676, 680, 700, 702, 703, 755, 759, 764, 790, 801, 808, 855, 876, 925, 941, 963, 990, 1012, 1028, 1038, 1044, 1125, 1131, 1173, 1194, 1198, 1217, 1238, 1240, 1241, 1242, 1248, 1250, 1275, 1280, 1284, 1308, 1313, 1317, 1324, 1354, 1363, 1368, 1375, 1383, 1405, 1414, 1418, 1441, 1444, 1452, 1461, 1463, 1464, 1467, 1469, 1470, 1472, 1478, 1481, 1487, 1509, 1515, 1526, 1536, 1541, 1547, 1558, 1576, 1584, 1587, 1594, 1596, 1601, 1603, 1626, 1627, 1630, 1631, 1633, 1641, 1646, 1651, 1656, 1658, 1666, 1675, 1683, 1689, 1691, 1705, 1725, 1735, 1755, 1759, 1771, 1775, 1780, 1781, 1797, 1814, 1837, 1841, 1859, 1860, 1876, 1895, 1896, 1917, 1918, 1922, 1940, 1953, 1958, 1959, 1963, 1991, 1999, 2012, 2023, 2040, 2050, 2055, 2075, 2078, 2082, 2089, 2097, 2105, 2108, 2121, 2122, 2125, 2131, 2146, 2147, 2153, 2154, 2156, 2161, 2174, 2177, 2178, 2184, 2194, 2201, 2222, 2226, 2231, 2237, 2238, 2239, 2241, 2256, 2268, 2275, 2280, 2292, 2293, 2298, 2299, 2301, 2306, 2311, 2313, 2316, 2333, 2342, 2355, 2381, 2399, 2405, 2408, 2416, 2424, 2434, 2435, 2437, 2441, 2450, 2470, 2505, 2555, 2561, 2566, 2567, 2571, 2586, 2591, 2612, 2613, 2615, 2623, 2624, 2626, 2632, 2642, 2646, 2680, 2687, 2703, 2735, 2791, 2793, 2797, 2802, 2812, 2819, 2827, 2838, 2847, 2849, 2856, 2868, 2872, 2882, 2892, 2895, 2900, 2912, 2915, 2921, 2924, 2927, 2928, 2929, 2932, 2935, 2937, 2943, 2947, 2959, 2962, 2984, 2985, 3017, 3022, 3029, 3044, 3049, 3052, 3053, 3055, 3056, 3068, 3077, 3080, 3083, 3088, 3106, 3108, 3113, 3114, 3124, 3125, 3159, 3168, 3174, 3178, 3179, 3190, 3204, 3209, 3213, 3220, 3225, 3229, 3234, 3290, 3297, 3312, 3327, 3329, 3408, 3417, 3419, 3456, 3462, 3467, 3468, 3470, 3474, 3477, 3479, 3481, 3484, 3490, 3495, 3498, 3504, 3522, 3532, 3537, 3539, 3540, 3542, 3555, 3561, 3563, 3566, 3570, 3571, 3576, 3590, 3601, 3607, 3613, 3627, 3709, 3710, 3714, 3719, 3723, 3728, 3731, 3733, 3743, 3753, 3794, 3804, 3805, 3807, 3842, 3843, 3851, 3854, 3858, 3865, 3875, 3893, 3896, 3901, 3902, 3908, 3926 + ); + + for (Integer integer : integers) { + RouteOrder routeOrder = routeRepository.queryById(Long.valueOf(integer)); + lyOrderSyncAdapter.syncSupplierOrder(routeOrder); + } } + + @Test + void syncToSupplierOne(){ + RouteOrder routeOrder = routeRepository.queryById(665L); + lyOrderSyncAdapter.syncSupplierOrder(routeOrder); + } + + + @Test + void queryHotelCustom(){ + OrderDetail byId = orderDetailRepository.findById(2569L); + HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail()); + System.out.println(hotelOrderDetailDto); + } } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 22cc9850..0505ac9d 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -3,6 +3,7 @@ package com.chint; import cn.hutool.extra.pinyin.PinyinUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.chint.application.in.RankController; import com.chint.application.out.LoginController; import com.chint.application.services.login.strategy.PailaLoginStrategy; import com.chint.domain.aggregates.location.basedata.CountryLevelInfoEntity; @@ -13,7 +14,10 @@ import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.*; import com.chint.domain.service.JTCompanyDomainService; +import com.chint.domain.service.order_sync.LYOrderSyncAdapter; +import com.chint.domain.value_object.RanksData; import com.chint.infrastructure.util.Digest; +import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest; import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification; @@ -84,6 +88,7 @@ class RouteApplicationTests { @Autowired private JTCompanyDomainService jtCompanyDomainService; + @Value("${FSSC.jt-baseUrl}") private String jtFSSCUrl; @@ -125,6 +130,9 @@ class RouteApplicationTests { @Autowired private DistrictInfoRepository districtInfoRepository; + @Autowired + private RankController rankController; + void test3() { FlyOkDTO freightDTO = new FlyOkDTO(); ParamFly param = new ParamFly(); @@ -152,7 +160,6 @@ class RouteApplicationTests { user.setName("陈光金"); user.setCompanyName("正泰集团股份有限公司"); user.setEmployeeNo("605403"); - lyUserRequest.saveCurrentUser(user); cTripUserSaveRequest.saveUserToCTrip(user); } @@ -300,9 +307,13 @@ class RouteApplicationTests { routeRepository.deleteById(875L); } -// @Test + @Test void deleteOrderDetail() { - orderDetailRepository.deleteById(1497L); + + orderDetailRepository.deleteById(2563L); + + + } // @Test @@ -988,10 +999,11 @@ class RouteApplicationTests { pushUser.getUserSFDataFromOpenApiBatch(); } -// @Test + @Test void deleteByOrderId() { - orderDetailRepository.deleteById(1488L); - orderDetailRepository.deleteById(1489L); + orderDetailRepository.deleteById(1647L); + orderDetailRepository.deleteById(1648L); + } // @Test @@ -1070,4 +1082,30 @@ class RouteApplicationTests { cTripStatusNotification.setStatusIDs(null); } + @Test + void addRanks(){ + + RanksData ranksData = new RanksData(); + ranksData.setIndustry("浙江正泰物联技术有限公司"); + ranksData.setCompanyCode("A70000059"); + for (int i = 1; i < 13; i++) { + if(i<= 2){ + ranksData.setLevel(4); + } else if(i<=4){ + ranksData.setLevel(3); + }else if(i<=7){ + ranksData.setLevel(2); + }else { + ranksData.setLevel(1); + } + ranksData.setRankName("P" + i); + rankController.saveRanks(ranksData); + ranksData.setRankName("M" + i); + rankController.saveRanks(ranksData); + ranksData.setRankName("L" + i); + rankController.saveRanks(ranksData); + } + + } + }