From 9ab000791eb78fd832c1460c204acc5e8f81c8d0 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Sun, 25 Feb 2024 18:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=B6=85=E6=A0=87=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=9B=9E=E6=8E=A8bpm=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/commands/BPMAuditCommand.java | 26 +++++++ .../application/dtos/SupplierLoginParam.java | 8 ++ .../chint/application/in/RankController.java | 20 ++--- .../out/SupplierLoginController.java | 17 ++-- .../services/SupplierLoginService.java | 29 ++++--- .../aggregates/order/ApproveOrderNo.java | 2 + .../domain/aggregates/order/OrderDetail.java | 15 +++- .../domain/aggregates/order/OrderEvent.java | 1 + .../repository/OrderDetailRepository.java | 1 + .../domain/repository/RouteRepository.java | 2 - .../domain/service/OrderDomainService.java | 56 ++++++++++--- .../service/leg_event/LegEventHandler.java | 1 + .../domain/value_object/ApprovalLegData.java | 1 + .../domain/value_object/ApproveLegData.java | 1 + .../infrastructure/constant/Constant.java | 13 ++++ .../repository/RouteRepositoryImpl.java | 31 +++++--- .../repository/jdbc/JdbcRouteRepository.java | 21 +++-- .../infrastructure/util/DelayDispatch.java | 26 +++++++ .../interfaces/rest/bpm/BPMParamFactory.java | 78 +++++++++++++++++++ .../rest/{ly => bpm}/BPMRequest.java | 10 +-- .../dto/bpm => bpm/dot}/BPMBaseRequest.java | 2 +- .../{ly/dto/bpm => bpm/dot}/BPMResponse.java | 2 +- .../bpm => bpm/dot}/ExceedStandardDto.java | 2 +- .../dto/bpm => bpm/dot}/RescheduleDto.java | 2 +- .../rest/ctrip/CTripLoginRequest.java | 47 ++++++----- .../interfaces/rest/ly/LYLoginRequest.java | 28 +++---- src/main/resources/application-prod.yml | 9 ++- src/main/resources/application-test.yml | 8 +- src/test/java/com/chint/CTripTest.java | 6 +- src/test/java/com/chint/LYTest.java | 19 ++--- .../java/com/chint/RouteApplicationTests.java | 4 +- 31 files changed, 366 insertions(+), 122 deletions(-) create mode 100644 src/main/java/com/chint/application/commands/BPMAuditCommand.java create mode 100644 src/main/java/com/chint/application/dtos/SupplierLoginParam.java create mode 100644 src/main/java/com/chint/infrastructure/util/DelayDispatch.java create mode 100644 src/main/java/com/chint/interfaces/rest/bpm/BPMParamFactory.java rename src/main/java/com/chint/interfaces/rest/{ly => bpm}/BPMRequest.java (85%) rename src/main/java/com/chint/interfaces/rest/{ly/dto/bpm => bpm/dot}/BPMBaseRequest.java (87%) rename src/main/java/com/chint/interfaces/rest/{ly/dto/bpm => bpm/dot}/BPMResponse.java (80%) rename src/main/java/com/chint/interfaces/rest/{ly/dto/bpm => bpm/dot}/ExceedStandardDto.java (96%) rename src/main/java/com/chint/interfaces/rest/{ly/dto/bpm => bpm/dot}/RescheduleDto.java (95%) diff --git a/src/main/java/com/chint/application/commands/BPMAuditCommand.java b/src/main/java/com/chint/application/commands/BPMAuditCommand.java new file mode 100644 index 00000000..c2e78137 --- /dev/null +++ b/src/main/java/com/chint/application/commands/BPMAuditCommand.java @@ -0,0 +1,26 @@ +package com.chint.application.commands; + +import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; + +@Data +public class BPMAuditCommand extends Command { + private String orderNo; + private Integer productType; + private Object extensionData; + + public BPMAuditCommand orderNo(String orderNo) { + this.orderNo = orderNo; + return this; + } + + public BPMAuditCommand productType(Integer productType) { + this.productType = productType; + return this; + } + + public BPMAuditCommand extensionData(Object extensionData) { + this.extensionData = extensionData; + return this; + } +} diff --git a/src/main/java/com/chint/application/dtos/SupplierLoginParam.java b/src/main/java/com/chint/application/dtos/SupplierLoginParam.java new file mode 100644 index 00000000..7b8477c4 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/SupplierLoginParam.java @@ -0,0 +1,8 @@ +package com.chint.application.dtos; + +import lombok.Data; + +@Data +public class SupplierLoginParam { + private Long routeId; +} diff --git a/src/main/java/com/chint/application/in/RankController.java b/src/main/java/com/chint/application/in/RankController.java index eb1cbbeb..2a0a11f9 100644 --- a/src/main/java/com/chint/application/in/RankController.java +++ b/src/main/java/com/chint/application/in/RankController.java @@ -50,15 +50,15 @@ public class RankController { return Result.Success(SUCCESS, save); } - @Transactional - @ApiOperation("添加差标") - @PostMapping("/add/standards") - public Result addStandardsToRanks(@RequestBody StandardsData standardsData) { - Ranks ranks = ranksRepository.queryById(standardsData.getRanksId()); - DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(standardsData); - ranks.addStandards(differenceStandards); - return Result.Success(SUCCESS, ranks); - } +// @Transactional +// @ApiOperation("添加差标") +// @PostMapping("/add/standards") +// public Result addStandardsToRanks(@RequestBody StandardsData standardsData) { +// Ranks ranks = ranksRepository.queryById(standardsData.getRanksId()); +// DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(standardsData); +// ranks.addStandards(differenceStandards); +// return Result.Success(SUCCESS, ranks); +// } @Transactional @ApiOperation("修改差标") @@ -76,7 +76,7 @@ public class RankController { ranks.setIndustry(ranksdata.getIndustry()); if (ranksdata.getStandardsData() != null) { DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(ranksdata.getStandardsData()); - ranks.addStandards(differenceStandards); +// ranks.addStandards(differenceStandards); } ranksRepository.save(ranks); return Result.Success(SUCCESS, ranks); diff --git a/src/main/java/com/chint/application/out/SupplierLoginController.java b/src/main/java/com/chint/application/out/SupplierLoginController.java index f57cb795..2b3ed2b8 100644 --- a/src/main/java/com/chint/application/out/SupplierLoginController.java +++ b/src/main/java/com/chint/application/out/SupplierLoginController.java @@ -1,6 +1,7 @@ package com.chint.application.out; +import com.chint.application.dtos.SupplierLoginParam; import com.chint.application.services.SupplierLoginService; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.ctrip.dto.login.H5Response; @@ -23,30 +24,30 @@ public class SupplierLoginController { @ApiOperation("单点登录同程-移动") @PostMapping("/ly/login") - public Result lyLogin() { + public Result lyLogin(SupplierLoginParam supplierLoginParam) { //登录 - LYRedirectUrlResponse data = supplierLoginService.lyLogin(); + LYRedirectUrlResponse data = supplierLoginService.lyLogin(supplierLoginParam); return Result.Success(SUCCESS, data); } @ApiOperation("单点登录同程-PC") @PostMapping("/ly/login/pc") - public Result lyLoginPC() { + public Result lyLoginPC(SupplierLoginParam supplierLoginParam) { //登录 - LYRedirectUrlResponse data = supplierLoginService.lyLoginPC(); + LYRedirectUrlResponse data = supplierLoginService.lyLoginPC(supplierLoginParam); return Result.Success(SUCCESS, data); } @ApiOperation("单点登录携程-移动") @PostMapping("/CTrip/login") - public Result cTripLogin() { - return Result.Success(SUCCESS, supplierLoginService.cTripLogin()); + public Result cTripLogin(SupplierLoginParam supplierLoginParam) { + return Result.Success(SUCCESS, supplierLoginService.cTripLogin(supplierLoginParam)); } @ApiOperation("单点登录携程-PC") @PostMapping("/CTrip/login/pc") - public Result cTripLoginPC() { - return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC()); + public Result cTripLoginPC(SupplierLoginParam supplierLoginParam) { + return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC(supplierLoginParam)); } } diff --git a/src/main/java/com/chint/application/services/SupplierLoginService.java b/src/main/java/com/chint/application/services/SupplierLoginService.java index 22fb0459..de04b29a 100644 --- a/src/main/java/com/chint/application/services/SupplierLoginService.java +++ b/src/main/java/com/chint/application/services/SupplierLoginService.java @@ -1,5 +1,8 @@ package com.chint.application.services; +import com.chint.application.dtos.SupplierLoginParam; +import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.repository.RouteRepository; import com.chint.interfaces.rest.ctrip.CTripLoginRequest; import com.chint.interfaces.rest.ctrip.dto.login.H5Response; import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; @@ -7,7 +10,6 @@ import com.chint.interfaces.rest.ly.LYLoginRequest; import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.yaml.snakeyaml.extensions.compactnotation.PackageCompactConstructor; import static com.chint.infrastructure.constant.Constant.L_Y_ENTRANCE_HOME; @@ -20,21 +22,30 @@ public class SupplierLoginService { @Autowired private CTripLoginRequest cTripLoginRequest; + @Autowired + private RouteRepository routeRepository; + /** * 登录接口 */ - public LYRedirectUrlResponse lyLogin() { - return lyLoginRequest.login(L_Y_ENTRANCE_HOME); + public LYRedirectUrlResponse lyLogin(SupplierLoginParam supplierLoginParam) { + return lyLoginRequest.login(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId())); } - public LYRedirectUrlResponse lyLoginPC() { - return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME); + public LYRedirectUrlResponse lyLoginPC(SupplierLoginParam supplierLoginParam) { + return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId())); } - public H5Response cTripLogin() { - return cTripLoginRequest.hSingleLogin(); + public H5Response cTripLogin(SupplierLoginParam supplierLoginParam) { + return cTripLoginRequest.hSingleLogin(getEmployeeNo(supplierLoginParam.getRouteId())); } - public PCResponse cTripLoginPC() { - return cTripLoginRequest.authLogin(); + + public PCResponse cTripLoginPC(SupplierLoginParam supplierLoginParam) { + return cTripLoginRequest.authLogin(getEmployeeNo(supplierLoginParam.getRouteId())); + } + + private String getEmployeeNo(Long routeId) { + RouteOrder routeOrder = routeRepository.queryById(routeId); + return routeOrder.getUserId().toString(); } } diff --git a/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java b/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java index a9263894..cf24d0e3 100644 --- a/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java +++ b/src/main/java/com/chint/domain/aggregates/order/ApproveOrderNo.java @@ -15,4 +15,6 @@ public class ApproveOrderNo { private String accountCompany; @ApiModelProperty("申请说明") private String instructions; + @ApiModelProperty("财务共享订单创建人") + private String creator; } 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 f20d5834..02022667 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -1,5 +1,6 @@ package com.chint.domain.aggregates.order; +import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.value_object.enums.CurrencyType; import lombok.Data; import org.springframework.data.annotation.Id; @@ -12,8 +13,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import static com.chint.infrastructure.constant.Constant.ORDER_EVENT_PREPARE_NAME; -import static com.chint.infrastructure.constant.Constant.ORDER_EVENT_UNKNOWN; +import static com.chint.infrastructure.constant.Constant.*; @Data @Table("order_detail") @@ -97,6 +97,17 @@ public class OrderDetail { return this; } + public Object getExtensionDataByProductType() { + return switch (this.productType) { + case LEG_TYPE_TRAIN -> this.trainOrderDetail; + case LEG_TYPE_AIRPLANE -> this.flightOrderDetail; + case LEG_TYPE_HOTEL -> this.hotelOrderDetail; + case LEG_TYPE_TAXI -> this.carOrderDetail; + case LEG_TYPE_OTHER -> this.otherOrderDetail; + default -> throw new NotFoundException(NOT_FOUND); + }; + } + public OrderDetail addCarOrderData(CarOrderDetail carOrderDetail) { this.carOrderDetail = carOrderDetail; return this; 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 1b831ac2..f87dc0d3 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderEvent.java @@ -36,6 +36,7 @@ public class OrderEvent { case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME; case ORDER_EVENT_UNKNOWN -> ORDER_EVENT_UNKNOWN_NAME; case ORDER_EVENT_FINISH -> ORDER_EVENT_FINISH_NAME; + case ORDER_EVENT_ETA -> ORDER_EVENT_ETA_NAME; default -> "未知事件"; }; } diff --git a/src/main/java/com/chint/domain/repository/OrderDetailRepository.java b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java index cb901e7f..3a58bb45 100644 --- a/src/main/java/com/chint/domain/repository/OrderDetailRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java @@ -13,4 +13,5 @@ public interface OrderDetailRepository { Optional findByOrderNo(String orderNo); OrderDetail save(OrderDetail orderDetail); + } diff --git a/src/main/java/com/chint/domain/repository/RouteRepository.java b/src/main/java/com/chint/domain/repository/RouteRepository.java index ca8c398a..ef7b6c23 100644 --- a/src/main/java/com/chint/domain/repository/RouteRepository.java +++ b/src/main/java/com/chint/domain/repository/RouteRepository.java @@ -16,8 +16,6 @@ public interface RouteRepository { RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode); - - RouteOrder findByOrderNo(String orderNo); Page findByOrderNoFuzzy(OrderQueryData orderQueryData); diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index 675e58d9..8225ca14 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -1,13 +1,12 @@ package com.chint.domain.service; +import com.chint.application.commands.BPMAuditCommand; import com.chint.application.commands.OrderApprovalCommand; import com.chint.application.commands.OrderCreateCommand; import com.chint.application.commands.OrderStatusChangeCommand; -import com.chint.domain.aggregates.order.ApprovalEvent; -import com.chint.domain.aggregates.order.Leg; -import com.chint.domain.aggregates.order.OrderEvent; -import com.chint.domain.aggregates.order.RouteOrder; +import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; +import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.factoriy.order_detail.OrderDetailFactory; import com.chint.domain.repository.LocationRepository; @@ -17,7 +16,11 @@ import com.chint.domain.repository.UserRepository; import com.chint.domain.value_object.ApprovalLegData; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.echo_framework.annotation.ListenTo; -import com.chint.infrastructure.util.BaseContext; +import com.chint.infrastructure.echo_framework.command.Command; +import com.chint.infrastructure.util.DelayDispatch; +import com.chint.interfaces.rest.bpm.BPMParamFactory; +import com.chint.interfaces.rest.bpm.BPMRequest; +import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto; import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -25,7 +28,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; -import static com.chint.infrastructure.constant.Constant.APPROVAL_EVENT_PREPARE; +import static com.chint.infrastructure.constant.Constant.*; @Service public class OrderDomainService { @@ -50,6 +53,13 @@ public class OrderDomainService { @Autowired private UserHttpRequest userHttpRequest; + @Autowired + private BPMParamFactory bpmParamFactory; + + @Autowired + private BPMRequest bpmRequest; + + public RouteOrder saveOrder(RouteOrder routeOrder) { return routeRepository.save(routeOrder); } @@ -93,15 +103,39 @@ public class OrderDomainService { @ListenTo(command = "OrderStatusChangeCommand", order = 0) public void orderDetailStatusChange(OrderStatusChangeCommand command) { orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> { - OrderEvent event = orderDetailFactory.createEvent(command.getOrderEventType(), command.getOutStatus()); + String outStatus = command.getOutStatus(); + Integer orderEventType = command.getOrderEventType(); + OrderEvent event = orderDetailFactory.createEvent(orderEventType, + outStatus); orderDetail.addOrderEvent(event); orderDetailRepository.save(orderDetail); + + if (orderEventType.equals(ORDER_EVENT_ETA)) { + //这里如果发现事件的状态为ORDER_EVENT_ETA + //需要根据发送审批给bpm + //根据订单类型获取不同的订单扩展明细 + orderDetail.getExtensionDataByProductType(); + Command.of(BPMAuditCommand.class) + .orderNo(orderDetail.getOrderNo()) + .productType(orderDetail.getProductType()) + .extensionData(orderDetail.getExtensionDataByProductType()) + .sendToQueue(); + } }); - - //这里如果发现事件的状态为Approving2 , 需要根据发送审批给bpm,需要先查询订单数据 } - - public void legAutoAddOrder(){ + @ListenTo(command = "BPMAuditCommand", order = 0) + public void toBpmAudit(BPMAuditCommand command) { + Object data = command.getExtensionData(); + ExceedStandardDto exceedStandardDto = switch (command.getProductType()) { + case LEG_TYPE_TRAIN -> bpmParamFactory.creatAuditParamByTrain((TrainOrderDetail) data); + case LEG_TYPE_AIRPLANE -> bpmParamFactory.creatAuditParamByFlight((FlightOrderDetail) data); + case LEG_TYPE_HOTEL -> bpmParamFactory.creatAuditParamByHotel((HotelOrderDetail) data); + case LEG_TYPE_TAXI -> bpmParamFactory.creatAuditParamByCar((CarOrderDetail) data); + case LEG_TYPE_OTHER -> bpmParamFactory.creatAuditParamByOther((OtherOrderDetail) data); + default -> throw new NotFoundException(NOT_FOUND); + }; + DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto).getSuccess(), + 0); } } 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 0723d507..c573e252 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 @@ -80,6 +80,7 @@ public class LegEventHandler implements LegEventService { approveOrderNo.setActualOrderNo(data.getActualOrderNo()); approveOrderNo.setAccountCompany(data.getAccountCompany()); approveOrderNo.setInstructions(data.getInstructions()); + approveOrderNo.setCreator(data.getCreator()); //这里order所有的leg触发approve事件 routeOrder.getLegItems().forEach(leg -> leg.getEventList().add( legEventFactory.creatLegEvent(command.getLegEventType()) diff --git a/src/main/java/com/chint/domain/value_object/ApprovalLegData.java b/src/main/java/com/chint/domain/value_object/ApprovalLegData.java index 147f057c..5c2c8fc2 100644 --- a/src/main/java/com/chint/domain/value_object/ApprovalLegData.java +++ b/src/main/java/com/chint/domain/value_object/ApprovalLegData.java @@ -8,4 +8,5 @@ public class ApprovalLegData { // private String fakeOrderNo; private String actualOrderNo; private String sysCode; + private String creator; } diff --git a/src/main/java/com/chint/domain/value_object/ApproveLegData.java b/src/main/java/com/chint/domain/value_object/ApproveLegData.java index d21fadce..35b93a24 100644 --- a/src/main/java/com/chint/domain/value_object/ApproveLegData.java +++ b/src/main/java/com/chint/domain/value_object/ApproveLegData.java @@ -9,4 +9,5 @@ public class ApproveLegData { private String accountCompany; private String sysCode; private String instructions; + private String creator; } diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index 6c56af7f..d5d8a570 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -149,6 +149,8 @@ public class Constant { 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; + public static final String ORDER_EVENT_ETA_NAME = "超标"; public static final int ORDER_EVENT_UNKNOWN = -99; public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件"; @@ -196,8 +198,13 @@ public class Constant { public static final String TRAVEL_RANK_PATH = "/fssc/queryBill/queryTravelLevelByRank"; public static final String SUPPLIER_C_TRIP = "CTrip"; public static final String SUPPLIER_C_TRIP_CN_NAME = "携程"; + public static final String SUPPLIER_C_TRIP_EXTENSION_NAME = "携程预定"; + public static final String SUPPLIER_C_TRIP_BPM_NAME = "携程商旅"; + public static final String SUPPLIER_L_Y = "LY"; public static final String SUPPLIER_L_Y_CN_NAME = "同程"; + public static final String SUPPLIER_L_Y_EXTENSION_NAME = "同程预定"; + public static final String SUPPLIER_L_Y_BPM_NAME = "同程商旅"; // 携程 public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket"; @@ -296,4 +303,10 @@ public class Constant { //BPM public static final String EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson"; + public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称 + public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称 + public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称 + public static final String EXCEED_STANDARD_TYPE_CAR = "用车超标";//方法名称 + public static final String EXCEED_STANDARD_TYPE_OTHER = "其他超标";//方法名称 + } diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index 17bd7b82..ae8fbb42 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -1,7 +1,6 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.RouteRepository; import com.chint.domain.value_object.OrderQueryData; import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository; @@ -51,19 +50,27 @@ public class RouteRepositoryImpl implements RouteRepository { public Page findByOrderNoFuzzy(OrderQueryData orderQueryData) { PageRequest sort = PageRequest .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort")); - User currentUser = BaseContext.getCurrentUser(); + String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); return jdbcRouteRepository - .findByCreateUserAndRouteOrderNoContaining(currentUser.getUserId().toString() - , orderQueryData.getOrderNo(), sort); + .findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining( + Long.valueOf(employeeNo), + orderQueryData.getOrderNo(), + employeeNo, + orderQueryData.getOrderNo(), + sort); } @Override - public Page findByInstructions(OrderQueryData orderQueryData) { + public Page findByInstructions(OrderQueryData orderQueryData) { PageRequest sort = PageRequest .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort")); - User currentUser = BaseContext.getCurrentUser(); - return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_InstructionsContaining(currentUser.getUserId().toString(), - orderQueryData.getInstructions(),sort); + String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); + return jdbcRouteRepository.findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining( + Long.valueOf(employeeNo), + orderQueryData.getInstructions(), + employeeNo, + orderQueryData.getInstructions(), + sort); } @Override @@ -75,9 +82,9 @@ public class RouteRepositoryImpl implements RouteRepository { public PageResult pageQuery(OrderQueryData orderQueryData) { PageRequest sort = PageRequest .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort")); - User currentUser = BaseContext.getCurrentUser(); + String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); Page byUserId = jdbcRouteRepository - .findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString(), sort); + .findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo, sort); List orders = byUserId.toList(); orders.forEach(RouteOrder::reloadStatus); return new PageResult<>(byUserId.getTotalElements(), orders); @@ -85,7 +92,7 @@ public class RouteRepositoryImpl implements RouteRepository { @Override public List findByActualOrderNoNotNull(OrderQueryData orderQueryData) { - User currentUser = BaseContext.getCurrentUser(); - return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString()); + String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString(); + return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo); } } 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 1031219e..08711078 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -3,7 +3,9 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.RouteOrder; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; import java.util.List; @@ -12,19 +14,26 @@ import java.util.List; public interface JdbcRouteRepository extends CrudRepository { Page findByCreateUser(String userId, Pageable pageable); - Page findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String userId, Pageable pageable); - RouteOrder findByRouteId(Long routeId); RouteOrder findByApproveOrderNo_FakeOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_fakeOrderNo, String sysCode); - Page findByCreateUserAndApproveOrderNo_InstructionsContaining(String createUser, String approveOrderNo_instructions, Pageable pageable); - RouteOrder findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_actualOrderNo, String approveOrderNo_sysCode); RouteOrder findByRouteOrderNo(String routeOrderNo); - List findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String createUser); - Page findByCreateUserAndRouteOrderNoContaining(String createUser, String routeOrderNo, Pageable pageable); + Page findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(Long userId, String routeOrderNo, String approveOrderNo_creator, String routeOrderNo2, Pageable pageable); + + + Page findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(Long userId, String approveOrderNo_instructions, String approveOrderNo_creator, String approveOrderNo_instructions2, Pageable pageable); + + + Page findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator, Pageable pageable); + + + + List findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator); + + } diff --git a/src/main/java/com/chint/infrastructure/util/DelayDispatch.java b/src/main/java/com/chint/infrastructure/util/DelayDispatch.java new file mode 100644 index 00000000..8bd5cbe0 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/util/DelayDispatch.java @@ -0,0 +1,26 @@ +package com.chint.infrastructure.util; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public class DelayDispatch { + + public static void attemptToSend(Supplier requestSupplier, int attempt) { + if (attempt >= 5) { + return; + } + boolean success = requestSupplier.get(); // 使用Supplier获取请求成功与否的状态 + if (!success) { + ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); + scheduler.schedule(() -> { + try { + attemptToSend(requestSupplier, attempt + 1); + } finally { + scheduler.shutdown(); // 确保在任务执行完毕后关闭scheduler + } + }, 30, TimeUnit.SECONDS); + } + } +} diff --git a/src/main/java/com/chint/interfaces/rest/bpm/BPMParamFactory.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMParamFactory.java new file mode 100644 index 00000000..f2566f9d --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMParamFactory.java @@ -0,0 +1,78 @@ +package com.chint.interfaces.rest.bpm; + +import com.chint.domain.aggregates.order.*; +import com.chint.domain.exceptions.NotFoundException; +import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; + +import static com.chint.infrastructure.constant.Constant.*; + +@Component +public class BPMParamFactory { + + public ExceedStandardDto creatAuditParamByCar(CarOrderDetail carOrderDetail) { + ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); + exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR) + .setOrderSource(getSupplierName(carOrderDetail.getSupplier())) + .setOrderNo(carOrderDetail.getOrderNo()) + .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(carOrderDetail.getOrderAmount()))) + .setReason(carOrderDetail.getOverStandardReason()); + return exceedStandardDto; + } + + public ExceedStandardDto creatAuditParamByTrain(TrainOrderDetail trainOrderDetail) { + ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); + exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_TRAIN) + .setSeatingStandard(trainOrderDetail.getSeatName()) + .setOrderSource(getSupplierName(trainOrderDetail.getSupplier())) + .setOrderNo(trainOrderDetail.getOrderNo()) + .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(trainOrderDetail.getOrderAmount()))) + .setReason(trainOrderDetail.getOverStandardReason()); + return exceedStandardDto; + } + + public ExceedStandardDto creatAuditParamByHotel(HotelOrderDetail hotelOrderDetail) { + ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); + exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_HOTEL) + .setHotelStandard(hotelOrderDetail.getStarRate()) + .setHouseLayout(hotelOrderDetail.getRoomTypeName()) + .setHotelName(hotelOrderDetail.getHotelName()) + .setOrderSource(getSupplierName(hotelOrderDetail.getSupplier())) + .setOrderNo(hotelOrderDetail.getOrderNo()) + .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(hotelOrderDetail.getOrderAmount()))) + .setReason(hotelOrderDetail.getOverStandardReason()); + return exceedStandardDto; + } + + public ExceedStandardDto creatAuditParamByFlight(FlightOrderDetail flightOrderDetail) { + ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); + exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR) + .setCabinClass(flightOrderDetail.getSeatPointName()) + .setOrderSource(getSupplierName(flightOrderDetail.getSupplier())) + .setOrderNo(flightOrderDetail.getOrderNo()) + .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(flightOrderDetail.getOrderAmount()))) + .setReason(flightOrderDetail.getOverStandardReason()); + return exceedStandardDto; + } + + public ExceedStandardDto creatAuditParamByOther(OtherOrderDetail otherOrderDetail) { + ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); +// exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR) +// .setOrderSource(getSupplierName(carOrderDetail.getSupplier())) +// .setOrderNo(carOrderDetail.getOrderNo()) +// .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(carOrderDetail.getOrderAmount()))) +// .setReason(carOrderDetail.getOverStandardReason()); + return exceedStandardDto; + } + + + private String getSupplierName(String supplier) { + return switch (supplier) { + case SUPPLIER_C_TRIP_EXTENSION_NAME -> SUPPLIER_C_TRIP_BPM_NAME; + case SUPPLIER_L_Y_EXTENSION_NAME -> SUPPLIER_L_Y_BPM_NAME; + default -> throw new NotFoundException(NOT_FOUND); + }; + } +} \ No newline at end of file diff --git a/src/main/java/com/chint/interfaces/rest/ly/BPMRequest.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java similarity index 85% rename from src/main/java/com/chint/interfaces/rest/ly/BPMRequest.java rename to src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java index cca5bac3..d6f8654f 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/BPMRequest.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java @@ -1,12 +1,12 @@ -package com.chint.interfaces.rest.ly; +package com.chint.interfaces.rest.bpm; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.base.PostRequest; -import com.chint.interfaces.rest.ly.dto.bpm.BPMBaseRequest; -import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse; -import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto; -import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto; +import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest; +import com.chint.interfaces.rest.bpm.dot.BPMResponse; +import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto; +import com.chint.interfaces.rest.bpm.dot.RescheduleDto; import com.google.gson.Gson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMBaseRequest.java b/src/main/java/com/chint/interfaces/rest/bpm/dot/BPMBaseRequest.java similarity index 87% rename from src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMBaseRequest.java rename to src/main/java/com/chint/interfaces/rest/bpm/dot/BPMBaseRequest.java index 3d35392d..abfddf9a 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMBaseRequest.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dot/BPMBaseRequest.java @@ -1,4 +1,4 @@ -package com.chint.interfaces.rest.ly.dto.bpm; +package com.chint.interfaces.rest.bpm.dot; import lombok.Data; import lombok.experimental.Accessors; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMResponse.java b/src/main/java/com/chint/interfaces/rest/bpm/dot/BPMResponse.java similarity index 80% rename from src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMResponse.java rename to src/main/java/com/chint/interfaces/rest/bpm/dot/BPMResponse.java index 324e3831..d650b9b3 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/BPMResponse.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dot/BPMResponse.java @@ -1,4 +1,4 @@ -package com.chint.interfaces.rest.ly.dto.bpm; +package com.chint.interfaces.rest.bpm.dot; import lombok.Data; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/ExceedStandardDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dot/ExceedStandardDto.java similarity index 96% rename from src/main/java/com/chint/interfaces/rest/ly/dto/bpm/ExceedStandardDto.java rename to src/main/java/com/chint/interfaces/rest/bpm/dot/ExceedStandardDto.java index 4e9efbcd..f54b8050 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/ExceedStandardDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dot/ExceedStandardDto.java @@ -1,4 +1,4 @@ -package com.chint.interfaces.rest.ly.dto.bpm; +package com.chint.interfaces.rest.bpm.dot; import lombok.Data; diff --git a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/RescheduleDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dot/RescheduleDto.java similarity index 95% rename from src/main/java/com/chint/interfaces/rest/ly/dto/bpm/RescheduleDto.java rename to src/main/java/com/chint/interfaces/rest/bpm/dot/RescheduleDto.java index 1b5c1ca2..36bc886e 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/dto/bpm/RescheduleDto.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/dot/RescheduleDto.java @@ -1,4 +1,4 @@ -package com.chint.interfaces.rest.ly.dto.bpm; +package com.chint.interfaces.rest.bpm.dot; import lombok.Data; import lombok.experimental.Accessors; diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java index f0502a66..73087e4f 100644 --- a/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ctrip/CTripLoginRequest.java @@ -71,14 +71,16 @@ public class CTripLoginRequest { } - public PCResponse authLogin() { - User currentUser = BaseContext.getCurrentUser(); - String employeeId = String.valueOf( - currentUser.getEmployeeNo() - ); - CTripAuthLoginParam authLoginParam = CTripAuthLoginParam.of(String.valueOf( - employeeId - )); + public PCResponse authLogin(String employeeNo) { + String employeeId; + if (employeeNo == null) { + User currentUser = BaseContext.getCurrentUser(); + employeeId = currentUser.getEmployeeNo().toString(); + } else { + employeeId = employeeNo; + } + + CTripAuthLoginParam authLoginParam = CTripAuthLoginParam.of(employeeId); authLoginParam.setForCorp(0); String ticket = loadLoginToken(); @@ -144,12 +146,17 @@ public class CTripLoginRequest { } - public H5Response hSingleLogin() { + public H5Response hSingleLogin(String employeeNo) { CTripHSingleLoginParam hSingleLoginParam = new CTripHSingleLoginParam(); - User currentUser = BaseContext.getCurrentUser(); + String employeeId; + if (employeeNo == null) { + User currentUser = BaseContext.getCurrentUser(); + employeeId = String.valueOf(currentUser.getEmployeeNo()); + } else { + employeeId = employeeNo; + } String token = loadLoginToken(); String accessUserId = C_TRIP_APP_KEY; - String employeeId = String.valueOf(currentUser.getEmployeeNo()); String corpPayType = StringUtils.isNotBlank(hSingleLoginParam.getCorpPayType()) ? hSingleLoginParam.getCorpPayType() : "public"; @@ -216,20 +223,22 @@ public class CTripLoginRequest { } - public H5Response h5Login() { - User currentUser = BaseContext.getCurrentUser(); - - + public H5Response h5Login(String employeeNo) { + String employeeId; + if (employeeNo == null) { + User currentUser = BaseContext.getCurrentUser(); + employeeId = String.valueOf(currentUser.getEmployeeNo()); + } else { + employeeId = employeeNo; + } CTripHSingleLoginParam cTripHSingleLoginParam = new CTripHSingleLoginParam(); cTripHSingleLoginParam.setAppId(C_TRIP_APP_KEY); - cTripHSingleLoginParam.setEmployeeId(String.valueOf(currentUser.getEmployeeNo())); + cTripHSingleLoginParam.setEmployeeId(String.valueOf(employeeId)); cTripHSingleLoginParam.setToken(tokenRequest.getToken()); cTripHSingleLoginParam.setAppId("zhengtai"); cTripHSingleLoginParam.setCorpPayType("public"); - - String finallySign = - Digest.md5(C_TRIP_APP_KEY + currentUser.getEmployeeNo() + "public" + Digest.md5(C_TRIP_APP_SECURITY)); + Digest.md5(C_TRIP_APP_KEY + employeeId + "public" + Digest.md5(C_TRIP_APP_SECURITY)); cTripHSingleLoginParam.setSignature(finallySign); return postRequest.post(hSinngleLoginUrl, cTripHSingleLoginParam, H5Response.class); diff --git a/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java b/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java index 1557611b..51b2b4c8 100644 --- a/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java +++ b/src/main/java/com/chint/interfaces/rest/ly/LYLoginRequest.java @@ -19,27 +19,27 @@ public class LYLoginRequest { private final String loginUrl = L_Y_BASE_URL + L_Y_LOGIN_PATH; - public LYRedirectUrlResponse login(Integer entrance) { - User currentUser = BaseContext.getCurrentUser(); + public LYRedirectUrlResponse login(Integer entrance, String employeeNo) { + return getLyRedirectUrlResponse(entrance, employeeNo, L_Y_PLAT_H5); + } + + private LYRedirectUrlResponse getLyRedirectUrlResponse(Integer entrance, String employeeNo, Integer lYPlatH5) { LoginTokenData loginTokenData = new LoginTokenData(); LoginParam loginParam = new LoginParam(); - loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo())); - loginParam.setPlat(L_Y_PLAT_H5); + if(employeeNo == null){ + User currentUser = BaseContext.getCurrentUser(); + loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo())); + } else { + loginParam.setOutEmployeeId(employeeNo); + } + loginParam.setPlat(lYPlatH5); loginParam.setEntrance(entrance); loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL); loginTokenData.setParam(loginParam); return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class); } - public LYRedirectUrlResponse loginPC(Integer entrance) { - User currentUser = BaseContext.getCurrentUser(); - LoginTokenData loginTokenData = new LoginTokenData(); - LoginParam loginParam = new LoginParam(); - loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo())); - loginParam.setPlat(L_Y_PLAT_PC); - loginParam.setEntrance(entrance); - loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL); - loginTokenData.setParam(loginParam); - return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class); + public LYRedirectUrlResponse loginPC(Integer entrance, String employeeNo) { + return getLyRedirectUrlResponse(entrance, employeeNo, L_Y_PLAT_PC); } } diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 5a6443c5..56d0fd5b 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -12,4 +12,11 @@ chint: url: https://gxdev03.chint.com/businesstravel/ cTrip: - baseUrl: https://ct.ctrip.com \ No newline at end of file + baseUrl: https://ct.ctrip.com + auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi + appId: zhengtai2024 + corpId: zhengtai2024 + appKey: obk_zhengtai2024 + appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO + requestSecret: zhengtai2024_nEbmKfOo + diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 77efa2e7..2e315c72 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -30,4 +30,10 @@ logging: cTrip: - baseUrl: https://ct.ctrip.com \ No newline at end of file + baseUrl: https://ct.ctrip.com + auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi + appId: zhengtai2024 + corpId: zhengtai2024 + appKey: obk_zhengtai2024 + appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO + requestSecret: zhengtai2024_nEbmKfOo \ No newline at end of file diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 85a86450..7506728a 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -93,7 +93,7 @@ public class CTripTest { //@Test void authLogin() { BaseContext.setCurrentUser(user); - PCResponse response = loginRequest.authLogin(); + PCResponse response = loginRequest.authLogin(null); System.out.println(response.getRedirectUrl()); } @@ -101,13 +101,13 @@ public class CTripTest { //@Test void hSingleLogin() { BaseContext.setCurrentUser(user); - System.out.println(loginRequest.hSingleLogin().getRedirectUrl()); + System.out.println(loginRequest.hSingleLogin(null).getRedirectUrl()); } //@Test void h5LoginTest() { BaseContext.setCurrentUser(user); - System.out.println(loginRequest.h5Login()); + System.out.println(loginRequest.h5Login(null)); } // @Test diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 7843def1..fb8243b4 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -1,6 +1,5 @@ package com.chint; -import com.chint.domain.aggregates.base.BaseEntity; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.constant.Constant; import com.chint.infrastructure.util.BaseContext; @@ -10,19 +9,14 @@ import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYTokenRequest; import com.chint.interfaces.rest.ly.LYUserRequest; import com.chint.interfaces.rest.ly.dto.applyordersync.*; -import com.chint.interfaces.rest.ly.dto.bpm.BPMBaseRequest; -import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse; -import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto; -import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto; +import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest; +import com.chint.interfaces.rest.bpm.dot.BPMResponse; +import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto; +import com.chint.interfaces.rest.bpm.dot.RescheduleDto; import com.chint.interfaces.rest.ly.dto.commonresult.Result; import com.chint.interfaces.rest.ly.dto.estimateprice.*; -import com.chint.interfaces.rest.ly.vo.estimateprice.HotelListVo; import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo; import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.reflect.TypeToken; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -31,7 +25,6 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; -import java.util.List; import java.util.Map; import static com.chint.infrastructure.constant.Constant.*; @@ -292,13 +285,13 @@ public class LYTest { // @Test void loginLY() { BaseContext.setCurrentUser(user); - System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME)); + System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME,null)); } // @Test void loginLYPC() { BaseContext.setCurrentUser(user); - System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME)); + System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME,null)); } //超标 diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 545d14e9..517cd40d 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -45,9 +45,9 @@ class RouteApplicationTests { } @Test void loginSign() { - String sfno = "230615020"; + String sfno = "230615021"; String syscode = "abc"; - String billcode = "KKK12321412323"; + String billcode = "NNN12321412323"; String companycode = "浙江正泰电器股份有限公司"; String sec = "Superdandan"; String timespan = "12312321412312";