Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
huangxh3 2024-03-01 10:51:59 +08:00
commit 86e3b21554
27 changed files with 274 additions and 84 deletions

View File

@ -106,4 +106,11 @@
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>central</id>
<name>新正泰集团公共仓库</name>
<url>https://newmaven.chint.com/repository/maven-public/</url>
</repository>
</repositories>
</project> </project>

View File

@ -15,6 +15,9 @@ public class LocationRes {
private String province; private String province;
public static LocationRes copyFrom(Location location) { public static LocationRes copyFrom(Location location) {
if (location == null) {
return null;
}
LocationRes locationRes = BeanUtil.copyProperties(location, LocationRes.class); LocationRes locationRes = BeanUtil.copyProperties(location, LocationRes.class);
String[] parts = location.getLocationPathName().split("_"); String[] parts = location.getLocationPathName().split("_");
if (parts.length != 4) { if (parts.length != 4) {

View File

@ -3,6 +3,7 @@ package com.chint.application.out;
import com.chint.application.commands.OrderCreateCommand; import com.chint.application.commands.OrderCreateCommand;
import com.chint.application.services.login.strategy.PailaLoginStrategy; 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.aggregates.user.User;
import com.chint.domain.exceptions.OrderException; import com.chint.domain.exceptions.OrderException;
import com.chint.domain.service.SystemDomainService; import com.chint.domain.service.SystemDomainService;
@ -48,6 +49,9 @@ public class LoginController {
@Autowired @Autowired
private PailaLoginStrategy pailaLoginStrategy; private PailaLoginStrategy pailaLoginStrategy;
@Autowired
private PailaMobileLoginStrategy pailaMobileLoginStrategy;
@ApiOperation("财务共享登录") @ApiOperation("财务共享登录")
@Transactional @Transactional
@GetMapping("/login") @GetMapping("/login")
@ -136,7 +140,7 @@ public class LoginController {
@PostMapping("/login/sso/mobile") @PostMapping("/login/sso/mobile")
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){ public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){
String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode()); String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode());
userLoginParam.setSfno(employeeNo); userLoginParam.setSfno(employeeNo);
UserLoginResult userLoginResult = authenticateService UserLoginResult userLoginResult = authenticateService

View File

@ -232,23 +232,29 @@ public class OrderQuery {
CityEntity destinationCity; CityEntity destinationCity;
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder(); ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder();
if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) { if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) {
if (leg.getOriginLocation() != null) {
originCity = cityEntities.stream().filter(cityEntity -> cityEntity originCity = cityEntities.stream().filter(cityEntity -> cityEntity
.getCityName() .getCityName()
.equals(leg.getOriginLocation().getLocationName())) .equals(leg.getOriginLocation().getLocationName()))
.findFirst().get(); .findFirst().get();
scheduleDetailBuilder
.startCity(originCity.getCityName())
.startCityName(originCity.getCityName())
.startCityEnName(originCity.getCityename());
}
if (leg.getDestinationLocation() != null) {
destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
.getCityName() .getCityName()
.equals(leg.getDestinationLocation().getLocationName())) .equals(leg.getDestinationLocation().getLocationName()))
.findFirst().get(); .findFirst().get();
scheduleDetailBuilder scheduleDetailBuilder
.startCity(originCity.getCityName())
.startCityName(originCity.getCityName())
.startCityEnName(originCity.getCityename())
.endCityName(destinationCity.getCityName()) .endCityName(destinationCity.getCityName())
.endCity(destinationCity.getCityName()) .endCity(destinationCity.getCityName())
.endCityEnName(destinationCity.getCityename()); .endCityEnName(destinationCity.getCityename());
} }
}
if (leg.getCurrencyType() != null) { if (leg.getCurrencyType() != null) {
scheduleDetailBuilder scheduleDetailBuilder

View File

@ -1,7 +1,6 @@
package com.chint.application.queryies.estimate; package com.chint.application.queryies.estimate;
import com.chint.domain.aggregates.standards.CityTag; 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.standards.TravelStandards;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository; import com.chint.domain.repository.CityRepository;
@ -30,11 +29,11 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap; 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.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
@Component @Component
public class CTripEstimatePrice implements EstimatePrice { public class CTripEstimatePrice implements EstimatePrice {
@ -98,7 +97,16 @@ public class CTripEstimatePrice implements EstimatePrice {
@Override @Override
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) { public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
FlightProductInfo flightProductInfo = new FlightProductInfo(); FlightProductInfo flightProductInfo = new FlightProductInfo();
User currentUser = BaseContext.getCurrentUser();
String standardLevel = currentUser.getStandardLevel();
//差标价值管控 差标等级不是一等只能选择经济舱
if (standardLevel.equals(STANDARD_LEVEL_ONE)) {
flightProductInfo.setClassType("YCF"); flightProductInfo.setClassType("YCF");
} else {
flightProductInfo.setClassType("Y");
}
RouteInfo routeInfo = new RouteInfo(); RouteInfo routeInfo = new RouteInfo();
routeInfo.setArriveCityID( routeInfo.setArriveCityID(
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity()); cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity());
@ -111,6 +119,7 @@ public class CTripEstimatePrice implements EstimatePrice {
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest); BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
FlightPriceData flightPriceData = new FlightPriceData(); FlightPriceData flightPriceData = new FlightPriceData();
if (estimate.getStatus().getSuccess()) {
Optional.ofNullable( Optional.ofNullable(
estimate.getData().getFlightValuationResult().getTotalPrice() estimate.getData().getFlightValuationResult().getTotalPrice()
).ifPresentOrElse(price -> { ).ifPresentOrElse(price -> {
@ -120,6 +129,9 @@ public class CTripEstimatePrice implements EstimatePrice {
flightPriceData.setSuccess(false); flightPriceData.setSuccess(false);
flightPriceData.setMaxPrice("无估算价格"); flightPriceData.setMaxPrice("无估算价格");
}); });
}
return flightPriceData; return flightPriceData;
} }

View File

@ -26,8 +26,9 @@ import java.time.format.DateTimeFormatter;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; 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; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
@Service @Service
@ -73,15 +74,50 @@ public class OrderApplicationService {
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId())) RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
.orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)); .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
order.reloadStatus(); order.reloadStatus();
if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
throw new OrderException(ORDER_STATUS_ERROR);
}
List<Leg> legs = processLegData(addLegData.getLegData(), order); List<Leg> legs = processLegData(addLegData.getLegData(), order);
RouteOrder routeOrder = orderDomainService.saveOrder(order); RouteOrder routeOrder = orderDomainService.saveOrder(order);
legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue()); 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; // 仅在所有操作完成后保存一次 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<Leg> processLegData(LegData legData, RouteOrder order) { private List<Leg> processLegData(LegData legData, RouteOrder order) {
List<Leg> legs = switch (legData.legType) { List<Leg> legs = switch (legData.legType) {
case LegConstant.LEG_TYPE_TRAIN -> legFactory.createTrainLeg(legData); case LegConstant.LEG_TYPE_TRAIN -> legFactory.createTrainLeg(legData);
@ -156,15 +192,5 @@ public class OrderApplicationService {
public void updateLegToOrder(AddLegData addLegData) { 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);
}
} }

View File

@ -20,6 +20,9 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
@Slf4j @Slf4j
@Data @Data
@Table("leg") @Table("leg")
@ -82,7 +85,9 @@ public class Leg {
} }
public Leg queryEstimateAmount(EstimateAdapter estimateAdapter, String supplierName) { public Leg queryEstimateAmount(EstimateAdapter estimateAdapter, String supplierName) {
if (!this.getLegType().equals(LEG_TYPE_OTHER) && !this.getLegType().equals(LEG_TYPE_TAXI)) {
this.estimateAmount = estimateAdapter.of(supplierName).amountEstimate(this); this.estimateAmount = estimateAdapter.of(supplierName).amountEstimate(this);
}
return this; return this;
} }
@ -146,8 +151,8 @@ public class Leg {
case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_NAME; case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_NAME;
case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_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_HOTEL -> LegConstant.LEG_TYPE_HOTEL_NAME;
case LegConstant.LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME; case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME;
case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME; case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME;
default -> "未知类型"; default -> "未知类型";
}; };
} }
@ -157,8 +162,8 @@ public class Leg {
case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_EN_NAME; 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_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_EN_NAME;
case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_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 LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME;
case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME; case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME;
default -> "未知类型"; default -> "未知类型";
}; };
} }
@ -192,7 +197,7 @@ public class Leg {
if (!eventList.isEmpty()) { if (!eventList.isEmpty()) {
LegEvent lastEvent = eventList.get(eventList.size() - 1); LegEvent lastEvent = eventList.get(eventList.size() - 1);
int lastEventType = lastEvent.getEventType(); 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."); throw new LegEventException("New event must be the same as, immediately before, or immediately after the last event type.");
} }
} }

View File

@ -22,6 +22,7 @@ public class Location {
private String locationShortName; private String locationShortName;
private String firstPinYin; private String firstPinYin;
private Long parentLocationId; private Long parentLocationId;
private Integer isInternal;
@Column("level") @Column("level")
private Integer level; private Integer level;

View File

@ -20,6 +20,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode())); orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
orderDetail.setDestinationId(orderLegData.getDestinationId()); orderDetail.setDestinationId(orderLegData.getDestinationId());
orderDetail.setOriginId(orderLegData.getOriginId()); orderDetail.setOriginId(orderLegData.getOriginId());
orderDetail
.price(orderLegData.getPrice())
.productType(orderLegData.getProductType());
return orderDetail; return orderDetail;
} }

View File

@ -11,6 +11,9 @@ import org.springframework.stereotype.Service;
import java.util.List; 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 @Service
public class LocationDomainService { public class LocationDomainService {
@ -33,12 +36,12 @@ public class LocationDomainService {
return switch (cityType) { return switch (cityType) {
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
.stream() .stream()
.filter(location -> location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH) .filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL)
&& location.getLevel().equals(3)).toList(); && location.getLevel().equals(3)).toList();
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
.stream() .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(); && location.getLevel().equals(3)).toList();
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND); default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
}; };

View File

@ -32,7 +32,6 @@ public class CTripEstimate implements AmountEstimate {
@Override @Override
public String amountEstimate(Leg leg) { public String amountEstimate(Leg leg) {
Integer legType = leg.getLegType(); Integer legType = leg.getLegType();
return switch (legType) { return switch (legType) {
case LEG_TYPE_TRAIN -> queryTrainPrice(leg); case LEG_TYPE_TRAIN -> queryTrainPrice(leg);

View File

@ -106,13 +106,14 @@ public class LegEventHandler implements LegEventService {
public void syncLeg(LegSyncCommand command) { public void syncLeg(LegSyncCommand command) {
SyncLegData data = command.getData(); SyncLegData data = command.getData();
RouteOrder routeOrder = routeRepository.queryById(data.getRouteId()).reloadStatus(); RouteOrder routeOrder = routeRepository.queryById(data.getRouteId()).reloadStatus();
if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) { // if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
throw new CommandException("订单已同步"); // throw new CommandException("订单已同步");
} // }
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
throw new CommandException("订单未提交审批"); throw new CommandException("订单未提交审批");
} }
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) { //这里暂时的策略是只要订单状态是大于提交审批状态 就可以同步
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
String supplierName = data.getSupplierName(); String supplierName = data.getSupplierName();
routeOrder.setSupplierName(supplierName); routeOrder.setSupplierName(supplierName);
//这里order所有的leg触发sync事件 //这里order所有的leg触发sync事件
@ -156,11 +157,7 @@ public class LegEventHandler implements LegEventService {
.employeeNo(routeOrder.getUserId()); .employeeNo(routeOrder.getUserId());
routeOrder.addOrderDetail(orderDetail); routeOrder.addOrderDetail(orderDetail);
routeOrder = routeRepository.save(routeOrder); routeOrder = routeRepository.save(routeOrder);
// OrderDetail orderDetail = routeOrder
// .getOrderDetails()
// .stream()
// .max(Comparator.comparing(OrderDetail::getCreateTime))
// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理 //为订单添加订单已下单事件,这里需要发出额外的命令进行处理
orderDetail = routeOrder.matchOrderWithLeg(orderDetail); orderDetail = routeOrder.matchOrderWithLeg(orderDetail);
} else { } else {

View File

@ -9,4 +9,10 @@ public class SyncLegData {
private Long routeId; private Long routeId;
private List<Long> routeIds; private List<Long> routeIds;
private String supplierName; private String supplierName;
public static SyncLegData of( Long routeId,String supplierName){
SyncLegData syncLegData = new SyncLegData();
syncLegData.setSupplierName(supplierName);
syncLegData.setRouteId(routeId);
return syncLegData;
}
} }

View File

@ -27,7 +27,7 @@ public class LegConstant {
public static final String LEG_TYPE_HOTEL_NAME = "酒店"; public static final String LEG_TYPE_HOTEL_NAME = "酒店";
public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel"; public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel";
public static final int LEG_TYPE_TAXI = 3; 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 String LEG_TYPE_TAXI_EN_NAME = "Traffic";
public static final int LEG_TYPE_OTHER = 4; public static final int LEG_TYPE_OTHER = 4;
public static final String LEG_TYPE_OTHER_NAME = "其他"; public static final String LEG_TYPE_OTHER_NAME = "其他";

View File

@ -2,7 +2,10 @@ package com.chint.infrastructure.constant;
public class LocationConstant { 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 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;//是国外
} }

View File

@ -5,7 +5,7 @@ public class RouteConstant {
public static final int ORDER_STATUS_PREPARE = 0; public static final int ORDER_STATUS_PREPARE = 0;
public static final String ORDER_STATUS_PREPARE_NAME = "规划中"; public static final String ORDER_STATUS_PREPARE_NAME = "规划中";
public static final int ORDER_STATUS_APPROVAL = 1; 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 int ORDER_STATUS_NOT_ORDERED = 2;
public static final String ORDER_STATUS_NOT_ORDERED_NAME = "未下单"; public static final String ORDER_STATUS_NOT_ORDERED_NAME = "未下单";
public static final int ORDER_STATUS_ORDERED = 3; public static final int ORDER_STATUS_ORDERED = 3;

View File

@ -63,12 +63,12 @@ public class LocationRepositoryImpl implements LocationRepository {
@Override @Override
public List<Location> findByName(LocationParam locationParam) { public List<Location> findByName(LocationParam locationParam) {
return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord()); return jdbcLocationRepository.findByLocationPathNameContaining(locationParam.getQueryWord());
} }
@Override @Override
public List<Location> findByName(String localName) { public List<Location> findByName(String localName) {
return jdbcLocationRepository.findByLocationNameContaining(localName); return jdbcLocationRepository.findByLocationPathNameContaining(localName);
} }
@Override @Override

View File

@ -21,7 +21,7 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
List<Location> findByFirstPinYin(String firstPinYin); List<Location> findByFirstPinYin(String firstPinYin);
List<Location> findByLocationNameContaining(String locationName); List<Location> findByLocationPathNameContaining(String locationName);
Location findByLocationName(String locationName); Location findByLocationName(String locationName);

View File

@ -41,4 +41,13 @@ public class BPMController {
System.out.println("bpmBack = " + bpmBack); System.out.println("bpmBack = " + bpmBack);
return Result.Success(CommonMessageConstant.SUCCESS); return Result.Success(CommonMessageConstant.SUCCESS);
} }
//差旅更变审批
@ApiOperation("BPM改签审批结果回传")
@PostMapping("/change/back")
public Result<TravelStandards> changeBack(@RequestBody BPMBack bpmBack) {
//获取订单号和审批结果
System.out.println("bpmBack = " + bpmBack);
return Result.Success(CommonMessageConstant.SUCCESS);
}
} }

View File

@ -10,7 +10,7 @@ import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory; import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto; 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.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dto.BPMResponse; import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto; 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 org.springframework.stereotype.Service;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.HashMap; 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.H3BPM_EXCEED_STANDARD_URL;
import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL; import static com.chint.infrastructure.constant.BPMConstant.XNBPM_TOKEN_URL;

View File

@ -1,5 +1,6 @@
package com.chint.interfaces.rest.bpm.XNBPM; package com.chint.interfaces.rest.bpm.XNBPM;
import com.authine.cloudpivot.opensdk.CloudpivotOpenClient; import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
import com.authine.cloudpivot.opensdk.client.impl.JdkHttpClient; import com.authine.cloudpivot.opensdk.client.impl.JdkHttpClient;
import com.authine.cloudpivot.opensdk.config.CloudpivotEnvConfig; import com.authine.cloudpivot.opensdk.config.CloudpivotEnvConfig;

View File

@ -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<NewTrip> JT_FI_CLBGSQ_ITEM_NewTrip;//新增行程信息 是否必填
private List<OldTrip> JT_FI_CLBGSQ_ITEM_OldTrip;//原行程信息 是否必填
private List<ChangeTrip> 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;//新增行程原因 是否必填
}
}

View File

@ -59,7 +59,7 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef 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 base-url: https://signin-test.chint.com
token-name: token token-name: token

View File

@ -29,6 +29,6 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef 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 base-url: https://signin-test.chint.com
token-name: token token-name: token

View File

@ -48,7 +48,7 @@ paila:
redirect-url: https://gxdev03.chint.com/businesstravelhome/#/ redirect-url: https://gxdev03.chint.com/businesstravelhome/#/
client-mobile-id: 9b24c91ead42ee4b6918 client-mobile-id: 9b24c91ead42ee4b6918
client-mobile-secret: e54494f1272ffd41b818980f1f8524fd68ef 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 base-url: https://signin-test.chint.com
token-name: token token-name: token

View File

@ -121,12 +121,13 @@ public class CTripTest {
// @Test // @Test
void estimateFlight() { void estimateFlight() {
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
user.setCompanyCode("A30000001");
FlightProductInfo flightProductInfo = new FlightProductInfo(); FlightProductInfo flightProductInfo = new FlightProductInfo();
flightProductInfo.setClassType("YCF"); flightProductInfo.setClassType("YCF");
RouteInfo routeInfo = new RouteInfo(); RouteInfo routeInfo = new RouteInfo();
routeInfo.setArriveCityID("1"); routeInfo.setArriveCityID("347");
routeInfo.setDepartCityID("491"); routeInfo.setDepartCityID("633");
routeInfo.setDepartDate("2024-04-01"); routeInfo.setDepartDate("2024-03-02");
flightProductInfo.setRoutes(List.of(routeInfo)); flightProductInfo.setRoutes(List.of(routeInfo));
BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest BookingRelatedApiRequest bookingRelatedApiRequest = estimateRequest
.generateBaseRequest(flightProductInfo, null); .generateBaseRequest(flightProductInfo, null);

View File

@ -2,11 +2,10 @@ package com.chint;
import cn.hutool.core.lang.hash.Hash; import cn.hutool.core.lang.hash.Hash;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.opensdk.ApiException; import com.authine.cloudpivot.opensdk.ApiException;
import com.authine.cloudpivot.opensdk.CloudpivotOpenClient; 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.request.workflow.StartWorkflowRequest;
import com.authine.cloudpivot.opensdk.model.response.bizobject.CreateBoResponse;
import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse; import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.constant.LYConstant; 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.ClientFactory;
import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto; import com.chint.interfaces.rest.bpm.XNBPM.XNTokenDto;
import com.chint.interfaces.rest.bpm.dot.*; import com.chint.interfaces.rest.bpm.dot.*;
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest; import com.chint.interfaces.rest.bpm.dto.*;
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.ly.LYLoginRequest; import com.chint.interfaces.rest.ly.LYLoginRequest;
import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYTokenRequest; import com.chint.interfaces.rest.ly.LYTokenRequest;
@ -324,7 +320,7 @@ public class LYTest {
ExceedStandardDto exceedStandardDto = new ExceedStandardDto(); ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标 exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅 .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
.setOrderNo("001021214")//订单号 .setOrderNo("001121214")//订单号
.setHotelStandard("标间")//酒店超标提供住宿标准 .setHotelStandard("标间")//酒店超标提供住宿标准
.setHotelName("酒店名称")//酒店超标提供酒店名称 .setHotelName("酒店名称")//酒店超标提供酒店名称
.setHouseLayout("双人床")//酒店超标提供房型 .setHouseLayout("双人床")//酒店超标提供房型
@ -371,6 +367,61 @@ public class LYTest {
System.out.println("response = " + response); System.out.println("response = " + response);
} }
//差旅变更
@Test
void change() {
BPMBaseRequest bpmRequest = new BPMBaseRequest();
Gson gson = new Gson();
ChangeDto changeDto = new ChangeDto();
//新增行程
ArrayList<ChangeDto.NewTrip> 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<ChangeDto.OldTrip> 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<ChangeDto.ChangeTrip> 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);
}
/** /**
* 云枢超标流程测试 * 云枢超标流程测试
*/ */