diff --git a/pom.xml b/pom.xml index ec7065af..f69df198 100644 --- a/pom.xml +++ b/pom.xml @@ -106,4 +106,11 @@ + + + central + 新正泰集团公共仓库 + https://newmaven.chint.com/repository/maven-public/ + + diff --git a/src/main/java/com/chint/application/dtos/response/LocationRes.java b/src/main/java/com/chint/application/dtos/response/LocationRes.java index 18b331fd..15ec5d93 100644 --- a/src/main/java/com/chint/application/dtos/response/LocationRes.java +++ b/src/main/java/com/chint/application/dtos/response/LocationRes.java @@ -15,6 +15,9 @@ public class LocationRes { private String province; public static LocationRes copyFrom(Location location) { + if (location == null) { + return null; + } LocationRes locationRes = BeanUtil.copyProperties(location, LocationRes.class); String[] parts = location.getLocationPathName().split("_"); if (parts.length != 4) { diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java index 3b8c00a7..6b4f3f9b 100644 --- a/src/main/java/com/chint/application/out/LoginController.java +++ b/src/main/java/com/chint/application/out/LoginController.java @@ -3,6 +3,7 @@ package com.chint.application.out; import com.chint.application.commands.OrderCreateCommand; import com.chint.application.services.login.strategy.PailaLoginStrategy; +import com.chint.application.services.login.strategy.PailaMobileLoginStrategy; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.OrderException; import com.chint.domain.service.SystemDomainService; @@ -48,6 +49,9 @@ public class LoginController { @Autowired private PailaLoginStrategy pailaLoginStrategy; + @Autowired + private PailaMobileLoginStrategy pailaMobileLoginStrategy; + @ApiOperation("财务共享登录") @Transactional @GetMapping("/login") @@ -136,7 +140,7 @@ public class LoginController { @PostMapping("/login/sso/mobile") public Result loginSSOMobile(@RequestBody UserLoginParam userLoginParam){ - String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode()); + String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode()); userLoginParam.setSfno(employeeNo); UserLoginResult userLoginResult = authenticateService diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index a2ac90e6..7d38946d 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -232,22 +232,28 @@ public class OrderQuery { CityEntity destinationCity; ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder(); if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) { - originCity = cityEntities.stream().filter(cityEntity -> cityEntity - .getCityName() - .equals(leg.getOriginLocation().getLocationName())) - .findFirst().get(); - destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity - .getCityName() - .equals(leg.getDestinationLocation().getLocationName())) - .findFirst().get(); - scheduleDetailBuilder - .startCity(originCity.getCityName()) - .startCityName(originCity.getCityName()) - .startCityEnName(originCity.getCityename()) - .endCityName(destinationCity.getCityName()) - .endCity(destinationCity.getCityName()) - .endCityEnName(destinationCity.getCityename()); + if (leg.getOriginLocation() != null) { + originCity = cityEntities.stream().filter(cityEntity -> cityEntity + .getCityName() + .equals(leg.getOriginLocation().getLocationName())) + .findFirst().get(); + scheduleDetailBuilder + .startCity(originCity.getCityName()) + .startCityName(originCity.getCityName()) + .startCityEnName(originCity.getCityename()); + } + + if (leg.getDestinationLocation() != null) { + destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity + .getCityName() + .equals(leg.getDestinationLocation().getLocationName())) + .findFirst().get(); + scheduleDetailBuilder + .endCityName(destinationCity.getCityName()) + .endCity(destinationCity.getCityName()) + .endCityEnName(destinationCity.getCityename()); + } } if (leg.getCurrencyType() != null) { 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 b1b9e060..126f3966 100644 --- a/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java +++ b/src/main/java/com/chint/application/queryies/estimate/CTripEstimatePrice.java @@ -1,7 +1,6 @@ package com.chint.application.queryies.estimate; import com.chint.domain.aggregates.standards.CityTag; -import com.chint.domain.aggregates.standards.TrainStandards; import com.chint.domain.aggregates.standards.TravelStandards; import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.CityRepository; @@ -30,11 +29,11 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Optional; -import java.util.regex.Matcher; import java.util.regex.Pattern; import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap; import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL; +import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE; @Component public class CTripEstimatePrice implements EstimatePrice { @@ -98,7 +97,16 @@ public class CTripEstimatePrice implements EstimatePrice { @Override public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) { FlightProductInfo flightProductInfo = new FlightProductInfo(); - flightProductInfo.setClassType("YCF"); + User currentUser = BaseContext.getCurrentUser(); + String standardLevel = currentUser.getStandardLevel(); + + //差标价值管控 , 差标等级不是一等,只能选择经济舱 + if (standardLevel.equals(STANDARD_LEVEL_ONE)) { + flightProductInfo.setClassType("YCF"); + } else { + flightProductInfo.setClassType("Y"); + } + RouteInfo routeInfo = new RouteInfo(); routeInfo.setArriveCityID( cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity()); @@ -111,15 +119,19 @@ public class CTripEstimatePrice implements EstimatePrice { BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest); FlightPriceData flightPriceData = new FlightPriceData(); - Optional.ofNullable( - estimate.getData().getFlightValuationResult().getTotalPrice() - ).ifPresentOrElse(price -> { - flightPriceData.setSuccess(true); - flightPriceData.setMaxPrice(String.valueOf(price)); - }, () -> { - flightPriceData.setSuccess(false); - flightPriceData.setMaxPrice("无估算价格"); - }); + if (estimate.getStatus().getSuccess()) { + Optional.ofNullable( + estimate.getData().getFlightValuationResult().getTotalPrice() + ).ifPresentOrElse(price -> { + flightPriceData.setSuccess(true); + flightPriceData.setMaxPrice(String.valueOf(price)); + }, () -> { + flightPriceData.setSuccess(false); + flightPriceData.setMaxPrice("无估算价格"); + }); + } + + return flightPriceData; } diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index 6a923445..e7fdef23 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -26,8 +26,9 @@ import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.List; import java.util.Optional; +import java.util.concurrent.CompletableFuture; -import static com.chint.infrastructure.constant.CommonMessageConstant.ORDER_STATUS_ERROR; +import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_NOT_ORDERED; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE; @Service @@ -73,15 +74,50 @@ public class OrderApplicationService { RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId())) .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)); order.reloadStatus(); - if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { - throw new OrderException(ORDER_STATUS_ERROR); - } + List legs = processLegData(addLegData.getLegData(), order); RouteOrder routeOrder = orderDomainService.saveOrder(order); legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); + + //异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次 + if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) { + CompletableFuture.runAsync(() -> { + Command + .of(LegSyncCommand.class) + .data(SyncLegData.of(routeOrder.getRouteId(), routeOrder.getSupplierName())) + .sendToQueue(); + }); + } return routeOrder; // 仅在所有操作完成后保存一次 } + @Transactional + public void changeLeg(AddLegData addLegData) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); + LegData legData = addLegData.getLegData(); + Leg byLegId = Optional.ofNullable( + legRepository.findByLegId(legData.getLegId()) + ).orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)); + byLegId.setStartTime(LocalDateTime.parse(legData.getStartTime(), formatter)); + byLegId.setEndTime(LocalDateTime.parse(legData.getEndTime(), formatter)); + byLegId.setOriginId(legData.getOriginId()); + byLegId.setDestinationId(legData.getDestinationId()); + legRepository.save(byLegId); + + //异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次 + CompletableFuture.runAsync(() -> { + Long routeId = byLegId.getRouteId(); + RouteOrder order = Optional.ofNullable(routeRepository.queryById(routeId)) + .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)).reloadStatus(); + if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) { + Command + .of(LegSyncCommand.class) + .data(SyncLegData.of(order.getRouteId(), order.getSupplierName())) + .sendToQueue(); + } + }); + } + private List processLegData(LegData legData, RouteOrder order) { List legs = switch (legData.legType) { case LegConstant.LEG_TYPE_TRAIN -> legFactory.createTrainLeg(legData); @@ -156,15 +192,5 @@ public class OrderApplicationService { public void updateLegToOrder(AddLegData addLegData) { } - @Transactional - public void changeLeg(AddLegData addLegData) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss"); - LegData legData = addLegData.getLegData(); - Leg byLegId = legRepository.findByLegId(legData.getLegId()); - byLegId.setStartTime(LocalDateTime.parse(legData.getStartTime(), formatter)); - byLegId.setEndTime(LocalDateTime.parse(legData.getEndTime(), formatter)); - byLegId.setOriginId(legData.getOriginId()); - byLegId.setDestinationId(legData.getDestinationId()); - legRepository.save(byLegId); - } + } diff --git a/src/main/java/com/chint/domain/aggregates/order/Leg.java b/src/main/java/com/chint/domain/aggregates/order/Leg.java index 0c971028..b5e6a432 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Leg.java +++ b/src/main/java/com/chint/domain/aggregates/order/Leg.java @@ -20,6 +20,9 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER; +import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI; + @Slf4j @Data @Table("leg") @@ -82,7 +85,9 @@ public class Leg { } public Leg queryEstimateAmount(EstimateAdapter estimateAdapter, String supplierName) { - this.estimateAmount = estimateAdapter.of(supplierName).amountEstimate(this); + if (!this.getLegType().equals(LEG_TYPE_OTHER) && !this.getLegType().equals(LEG_TYPE_TAXI)) { + this.estimateAmount = estimateAdapter.of(supplierName).amountEstimate(this); + } return this; } @@ -146,8 +151,8 @@ public class Leg { case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_NAME; case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_NAME; case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_NAME; - case LegConstant.LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME; - case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME; + case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME; + case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME; default -> "未知类型"; }; } @@ -157,8 +162,8 @@ public class Leg { case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_EN_NAME; case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_EN_NAME; case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_EN_NAME; - case LegConstant.LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME; - case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME; + case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME; + case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME; default -> "未知类型"; }; } @@ -192,7 +197,7 @@ public class Leg { if (!eventList.isEmpty()) { LegEvent lastEvent = eventList.get(eventList.size() - 1); int lastEventType = lastEvent.getEventType(); - if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 1) { + if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 5) { throw new LegEventException("New event must be the same as, immediately before, or immediately after the last event type."); } } diff --git a/src/main/java/com/chint/domain/aggregates/order/Location.java b/src/main/java/com/chint/domain/aggregates/order/Location.java index 9b21aa7c..66feff49 100644 --- a/src/main/java/com/chint/domain/aggregates/order/Location.java +++ b/src/main/java/com/chint/domain/aggregates/order/Location.java @@ -22,6 +22,7 @@ public class Location { private String locationShortName; private String firstPinYin; private Long parentLocationId; + private Integer isInternal; @Column("level") private Integer level; 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 72c1db54..e3af7bcb 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 @@ -20,6 +20,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory { orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode())); orderDetail.setDestinationId(orderLegData.getDestinationId()); orderDetail.setOriginId(orderLegData.getOriginId()); + orderDetail + .price(orderLegData.getPrice()) + .productType(orderLegData.getProductType()); return orderDetail; } diff --git a/src/main/java/com/chint/domain/service/LocationDomainService.java b/src/main/java/com/chint/domain/service/LocationDomainService.java index 61f37a7b..738c11d5 100644 --- a/src/main/java/com/chint/domain/service/LocationDomainService.java +++ b/src/main/java/com/chint/domain/service/LocationDomainService.java @@ -11,6 +11,9 @@ import org.springframework.stereotype.Service; import java.util.List; +import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_INTERNAL; +import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_NOT_INTERNAL; + @Service public class LocationDomainService { @@ -33,12 +36,12 @@ public class LocationDomainService { return switch (cityType) { case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName .stream() - .filter(location -> location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH) + .filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL) && location.getLevel().equals(3)).toList(); case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName .stream() - .filter(location -> !location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH) + .filter(location -> location.getIsInternal().equals(LOCATION_IS_NOT_INTERNAL) && location.getLevel().equals(3)).toList(); default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND); }; diff --git a/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java b/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java index ae760c75..c502f128 100644 --- a/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java +++ b/src/main/java/com/chint/domain/service/amount_estimate/CTripEstimate.java @@ -32,7 +32,6 @@ public class CTripEstimate implements AmountEstimate { @Override public String amountEstimate(Leg leg) { - Integer legType = leg.getLegType(); return switch (legType) { case LEG_TYPE_TRAIN -> queryTrainPrice(leg); 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 17fdace9..a71db450 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 @@ -106,13 +106,14 @@ public class LegEventHandler implements LegEventService { public void syncLeg(LegSyncCommand command) { SyncLegData data = command.getData(); RouteOrder routeOrder = routeRepository.queryById(data.getRouteId()).reloadStatus(); - if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) { - throw new CommandException("订单已同步"); - } +// if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) { +// throw new CommandException("订单已同步"); +// } if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { throw new CommandException("订单未提交审批"); } - if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) { + //这里暂时的策略是只要订单状态是大于提交审批状态 , 就可以同步 + if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) { String supplierName = data.getSupplierName(); routeOrder.setSupplierName(supplierName); //这里order所有的leg触发sync事件 @@ -156,11 +157,7 @@ public class LegEventHandler implements LegEventService { .employeeNo(routeOrder.getUserId()); routeOrder.addOrderDetail(orderDetail); routeOrder = routeRepository.save(routeOrder); -// OrderDetail orderDetail = routeOrder -// .getOrderDetails() -// .stream() -// .max(Comparator.comparing(OrderDetail::getCreateTime)) -// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)); + //为订单添加订单已下单事件,这里需要发出额外的命令进行处理 orderDetail = routeOrder.matchOrderWithLeg(orderDetail); } else { diff --git a/src/main/java/com/chint/domain/value_object/SyncLegData.java b/src/main/java/com/chint/domain/value_object/SyncLegData.java index d3664a4a..cf09311c 100644 --- a/src/main/java/com/chint/domain/value_object/SyncLegData.java +++ b/src/main/java/com/chint/domain/value_object/SyncLegData.java @@ -9,4 +9,10 @@ public class SyncLegData { private Long routeId; private List routeIds; private String supplierName; + public static SyncLegData of( Long routeId,String supplierName){ + SyncLegData syncLegData = new SyncLegData(); + syncLegData.setSupplierName(supplierName); + syncLegData.setRouteId(routeId); + return syncLegData; + } } diff --git a/src/main/java/com/chint/infrastructure/constant/LegConstant.java b/src/main/java/com/chint/infrastructure/constant/LegConstant.java index ca566a0a..d9159a59 100644 --- a/src/main/java/com/chint/infrastructure/constant/LegConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/LegConstant.java @@ -27,7 +27,7 @@ public class LegConstant { public static final String LEG_TYPE_HOTEL_NAME = "酒店"; public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel"; public static final int LEG_TYPE_TAXI = 3; - public static final String LEG_TYPE_TAXI_NAME = "出租车"; + public static final String LEG_TYPE_TAXI_NAME = "打车"; public static final String LEG_TYPE_TAXI_EN_NAME = "Traffic"; public static final int LEG_TYPE_OTHER = 4; public static final String LEG_TYPE_OTHER_NAME = "其他"; diff --git a/src/main/java/com/chint/infrastructure/constant/LocationConstant.java b/src/main/java/com/chint/infrastructure/constant/LocationConstant.java index fa3e1286..494a4f56 100644 --- a/src/main/java/com/chint/infrastructure/constant/LocationConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/LocationConstant.java @@ -2,7 +2,10 @@ package com.chint.infrastructure.constant; public class LocationConstant { // 城市类型 - public static final int CITY_TYPE_DOMESTIC = 0;//国内 + public static final int CITY_TYPE_DOMESTIC = 1;//国内 public static final String CITY_TYPE_DOMESTIC_PATH = "3106_1_";//国内 - public static final int CITY_TYPE_FOREIGN = 1;//国外 + public static final int CITY_TYPE_FOREIGN = 0;//国外 + + public static final int LOCATION_IS_INTERNAL = 1;//是国内 + public static final int LOCATION_IS_NOT_INTERNAL = 0;//是国外 } diff --git a/src/main/java/com/chint/infrastructure/constant/RouteConstant.java b/src/main/java/com/chint/infrastructure/constant/RouteConstant.java index dae9e3f7..e0bbac0f 100644 --- a/src/main/java/com/chint/infrastructure/constant/RouteConstant.java +++ b/src/main/java/com/chint/infrastructure/constant/RouteConstant.java @@ -5,7 +5,7 @@ public class RouteConstant { public static final int ORDER_STATUS_PREPARE = 0; public static final String ORDER_STATUS_PREPARE_NAME = "规划中"; public static final int ORDER_STATUS_APPROVAL = 1; - public static final String ORDER_STATUS_APPROVAL_NAME = "提交审批"; + public static final String ORDER_STATUS_APPROVAL_NAME = "未同步"; public static final int ORDER_STATUS_NOT_ORDERED = 2; public static final String ORDER_STATUS_NOT_ORDERED_NAME = "未下单"; public static final int ORDER_STATUS_ORDERED = 3; diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index 9bb51a57..b468c7b0 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -63,12 +63,12 @@ public class LocationRepositoryImpl implements LocationRepository { @Override public List findByName(LocationParam locationParam) { - return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord()); + return jdbcLocationRepository.findByLocationPathNameContaining(locationParam.getQueryWord()); } @Override public List findByName(String localName) { - return jdbcLocationRepository.findByLocationNameContaining(localName); + return jdbcLocationRepository.findByLocationPathNameContaining(localName); } @Override diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java index f289cd07..058477e3 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java @@ -21,7 +21,7 @@ public interface JdbcLocationRepository extends CrudRepository { List findByFirstPinYin(String firstPinYin); - List findByLocationNameContaining(String locationName); + List findByLocationPathNameContaining(String locationName); Location findByLocationName(String locationName); diff --git a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java index 85668c5b..444d6fb2 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java @@ -41,4 +41,13 @@ public class BPMController { System.out.println("bpmBack = " + bpmBack); return Result.Success(CommonMessageConstant.SUCCESS); } + + //差旅更变审批 + @ApiOperation("BPM改签审批结果回传") + @PostMapping("/change/back") + public Result changeBack(@RequestBody BPMBack bpmBack) { + //获取订单号和审批结果 + System.out.println("bpmBack = " + bpmBack); + return Result.Success(CommonMessageConstant.SUCCESS); + } } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java index 08f50c8a..20971861 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMRequest.java @@ -10,7 +10,7 @@ import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto; -import com.chint.interfaces.rest.bpm.dot.*; +import com.chint.interfaces.rest.bpm.dot.BPMBaseResponse; import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest; import com.chint.interfaces.rest.bpm.dto.BPMResponse; import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto; @@ -22,9 +22,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.lang.reflect.Type; -import java.math.BigDecimal; import java.util.HashMap; -import java.util.Map; import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL; import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL; diff --git a/src/main/java/com/chint/interfaces/rest/bpm/XNBPM/ClientFactory.java b/src/main/java/com/chint/interfaces/rest/bpm/XNBPM/ClientFactory.java index 3e5b7053..179d210b 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/XNBPM/ClientFactory.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/XNBPM/ClientFactory.java @@ -1,5 +1,6 @@ package com.chint.interfaces.rest.bpm.XNBPM; + import com.authine.cloudpivot.opensdk.CloudpivotOpenClient; import com.authine.cloudpivot.opensdk.client.impl.JdkHttpClient; import com.authine.cloudpivot.opensdk.config.CloudpivotEnvConfig; diff --git a/src/main/java/com/chint/interfaces/rest/bpm/dto/ChangeDto.java b/src/main/java/com/chint/interfaces/rest/bpm/dto/ChangeDto.java new file mode 100644 index 00000000..64658609 --- /dev/null +++ b/src/main/java/com/chint/interfaces/rest/bpm/dto/ChangeDto.java @@ -0,0 +1,55 @@ +package com.chint.interfaces.rest.bpm.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 变更 + */ +@Data +@Accessors(chain = true) +public class ChangeDto { + private String StartTime;//出差开始时间 是否必填 是 + private String EndTime;//出差结束时间 是否必填 是 + private String Reason;//出差说明 是否必填 是 + private List JT_FI_CLBGSQ_ITEM_NewTrip;//新增行程信息 是否必填 否 + private List JT_FI_CLBGSQ_ITEM_OldTrip;//原行程信息 是否必填 否 + private List JT_FI_CLBGSQ_ITEM_ChangeTrip;//变更行程信息 是否必填 否 + + //新增行程信息 + @Data + @Accessors(chain = true) + public static class NewTrip { + private String AllowProductTypes;//行程类型 是否必填 是 + private String DepartCitiesName;//出发地 是否必填 是 + private String ArriveCitiesName;//目的地 是否必填 是 + private String bsDate;//开始时间 是否必填 否 + private String edDate;//结束时间 是否必填 否 + private String Reason;//新增行程原因 是否必填 否 + } + + //原行程信息 + @Data + @Accessors(chain = true) + public static class OldTrip { + private String AllowProductTypes;//行程类型 是否必填 是 + private String DepartCitiesName;//出发地 是否必填 是 + private String ArriveCitiesName;//目的地 是否必填 是 + private String bsDate;//开始时间 是否必填 否 + private String edDate;//结束时间 是否必填 否 + } + + //变更行程信息 + @Data + @Accessors(chain = true) + public static class ChangeTrip { + private String AllowProductTypes;//行程类型 是否必填 是 + private String DepartCitiesName;//出发地 是否必填 是 + private String ArriveCitiesName;//目的地 是否必填 是 + private String bsDate;//开始时间 是否必填 否 + private String edDate;//结束时间 是否必填 否 + private String Reason;//新增行程原因 是否必填 否 + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 622493fd..04196998 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -59,7 +59,7 @@ paila: redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef - redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/ + redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.* base-url: https://signin-test.chint.com token-name: token diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index b44eb244..dc8b4074 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -29,6 +29,6 @@ paila: redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef - redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/ + redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.* base-url: https://signin-test.chint.com token-name: token diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 36b48380..a69edc2a 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -48,7 +48,7 @@ paila: redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef - redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/#/ + redirect-mobile-url: https://gxdev03.chint.com/businesstravelmhome/*.* base-url: https://signin-test.chint.com token-name: token diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 4d0f5145..c1c0646e 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -121,12 +121,13 @@ public class CTripTest { // @Test void estimateFlight() { BaseContext.setCurrentUser(user); + user.setCompanyCode("A30000001"); FlightProductInfo flightProductInfo = new FlightProductInfo(); flightProductInfo.setClassType("YCF"); RouteInfo routeInfo = new RouteInfo(); - routeInfo.setArriveCityID("1"); - routeInfo.setDepartCityID("491"); - routeInfo.setDepartDate("2024-04-01"); + routeInfo.setArriveCityID("347"); + routeInfo.setDepartCityID("633"); + routeInfo.setDepartDate("2024-03-02"); flightProductInfo.setRoutes(List.of(routeInfo)); BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest .generateBaseRequest(flightProductInfo, null); diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 7bf39386..1aef8680 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -2,11 +2,10 @@ package com.chint; import cn.hutool.core.lang.hash.Hash; import com.alibaba.fastjson.JSON; + import com.authine.cloudpivot.opensdk.ApiException; import com.authine.cloudpivot.opensdk.CloudpivotOpenClient; -import com.authine.cloudpivot.opensdk.model.request.bizobject.CreateBoRequest; import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest; -import com.authine.cloudpivot.opensdk.model.response.bizobject.CreateBoResponse; import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.constant.LYConstant; @@ -16,10 +15,7 @@ import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto; import com.chint.interfaces.rest.bpm.dot.*; -import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest; -import com.chint.interfaces.rest.bpm.dto.BPMResponse; -import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto; -import com.chint.interfaces.rest.bpm.dto.RescheduleDto; +import com.chint.interfaces.rest.bpm.dto.*; import com.chint.interfaces.rest.ly.LYLoginRequest; import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYTokenRequest; @@ -324,7 +320,7 @@ public class LYTest { ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); exceedStandardDto.setOrderType("酒店超标")//内容选项:酒店超标,火车票超标,机票超标 .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅 - .setOrderNo("001021214")//订单号 + .setOrderNo("001121214")//订单号 .setHotelStandard("标间")//酒店超标提供:住宿标准 .setHotelName("酒店名称")//酒店超标提供:酒店名称 .setHouseLayout("双人床")//酒店超标提供:房型 @@ -371,6 +367,61 @@ public class LYTest { System.out.println("response = " + response); } + + //差旅变更 + @Test + void change() { + BPMBaseRequest bpmRequest = new BPMBaseRequest(); + Gson gson = new Gson(); + ChangeDto changeDto = new ChangeDto(); + //新增行程 + ArrayList newTrips = new ArrayList<>(); + ChangeDto.NewTrip newTrip = new ChangeDto.NewTrip(); + newTrip.setAllowProductTypes("飞机") + .setDepartCitiesName("温州") + .setArriveCitiesName("北京") + .setBsDate("2024-03-01") + .setEdDate("2024-03-01") + .setReason("出差帮扶"); + newTrips.add(newTrip); + //原行程 + ArrayList oldTrips = new ArrayList<>(); + ChangeDto.OldTrip oldTrip = new ChangeDto.OldTrip(); + oldTrip.setAllowProductTypes("火车") + .setDepartCitiesName("温州") + .setArriveCitiesName("杭州") + .setBsDate("2024-03-01") + .setEdDate("2024-03-01"); + oldTrips.add(oldTrip); + //变更行程 + ArrayList changeTrips = new ArrayList<>(); + ChangeDto.ChangeTrip changeTrip = new ChangeDto.ChangeTrip(); + changeTrip.setAllowProductTypes("火车") + .setDepartCitiesName("乐清") + .setArriveCitiesName("杭州") + .setBsDate("2024-03-01") + .setEdDate("2024-03-01") + .setReason("出发地变更"); + changeTrips.add(changeTrip); + //设置值 + changeDto.setStartTime("2024-03-01")//出差开始时间 + .setEndTime("2024-03-01")//出差结束时间 + .setReason("出差帮扶")//出差说明 + .setJT_FI_CLBGSQ_ITEM_NewTrip(newTrips)//新增行程信息 + .setJT_FI_CLBGSQ_ITEM_OldTrip(oldTrips)//原行程信息 + .setJT_FI_CLBGSQ_ITEM_ChangeTrip(changeTrips);//变更行程信息 + String entityParamValues = gson.toJson(changeDto); + bpmRequest.setWorkflowCode("JT_FI_CLBGSQ")//流程编码 + .setUserCode("231116011")//sf号 + .setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点 + .setEntityParamValues(entityParamValues); + BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class); + System.out.println("response = " + bpmBaseResponse); + BPMResponse response = bpmBaseResponse.getD(); + System.out.println("response = " + response); + } + + /** * 云枢超标流程测试 */