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

# Conflicts:
#	src/main/java/com/chint/interfaces/rest/ly/in/HotelBackController.java
This commit is contained in:
huangxh3 2024-03-01 16:06:58 +08:00
commit f7538a1e11
22 changed files with 189 additions and 72 deletions

View File

@ -1,5 +1,6 @@
package com.chint.application.commands; package com.chint.application.commands;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data; import lombok.Data;
@ -7,7 +8,7 @@ import lombok.Data;
public class BPMAuditCommand extends Command { public class BPMAuditCommand extends Command {
private String orderNo; private String orderNo;
private Integer productType; private Integer productType;
private Object extensionData; private OrderDetail extensionData;
public BPMAuditCommand orderNo(String orderNo) { public BPMAuditCommand orderNo(String orderNo) {
this.orderNo = orderNo; this.orderNo = orderNo;
@ -19,7 +20,7 @@ public class BPMAuditCommand extends Command {
return this; return this;
} }
public BPMAuditCommand extensionData(Object extensionData) { public BPMAuditCommand extensionData(OrderDetail extensionData) {
this.extensionData = extensionData; this.extensionData = extensionData;
return this; return this;
} }

View File

@ -1,6 +1,5 @@
package com.chint.application.commands; package com.chint.application.commands;
import com.chint.domain.value_object.ApproveLegData;
import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data; import lombok.Data;
@ -8,17 +7,11 @@ import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL;
@Data @Data
public class LegApprovalCommand extends Command { public class LegApprovalCommand extends Command {
private Integer LegEventType = LEG_EVENT_APPROVAL; private Integer legEventType = LEG_EVENT_APPROVAL;
private Long LegId; private Long legId;
private ApproveLegData data;
public LegApprovalCommand legId(Long LegId) { public LegApprovalCommand legId(Long LegId) {
this.setLegId(LegId); this.setLegId(LegId);
return this; return this;
} }
public LegApprovalCommand data(ApproveLegData data) {
this.data = data;
return this;
}
} }

View File

@ -0,0 +1,24 @@
package com.chint.application.commands;
import com.chint.domain.value_object.ApproveLegData;
import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data;
import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL;
@Data
public class RouteApprovalCommand extends Command {
private Integer LegEventType = LEG_EVENT_APPROVAL;
private Long LegId;
private ApproveLegData data;
public RouteApprovalCommand legId(Long LegId) {
this.setLegId(LegId);
return this;
}
public RouteApprovalCommand data(ApproveLegData data) {
this.data = data;
return this;
}
}

View File

@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
public class HotelScheduleDetail extends ScheduleDetail { public class HotelScheduleDetail extends ScheduleDetail {
private String lastUpdateTime; private String lastUpdateTime;
private Integer nightCount; private String nightCount;
public static HotelScheduleDetailBuilder builder(){ public static HotelScheduleDetailBuilder builder(){
return new HotelScheduleDetailBuilder(); return new HotelScheduleDetailBuilder();
} }
@ -19,7 +19,7 @@ public class HotelScheduleDetail extends ScheduleDetail {
return this; return this;
} }
public HotelScheduleDetailBuilder nightCount(Integer nightCount) { public HotelScheduleDetailBuilder nightCount(String nightCount) {
hotelScheduleDetail.setNightCount(nightCount); hotelScheduleDetail.setNightCount(nightCount);
return this; return this;
} }

View File

@ -9,6 +9,9 @@ import java.util.List;
@Data @Data
public class ScheduleDetail { public class ScheduleDetail {
protected Long legId;
protected String serviceProvider; protected String serviceProvider;
protected String orderState; protected String orderState;
@ -114,6 +117,10 @@ public class ScheduleDetail {
@JsonProperty("RealScheduleNum") @JsonProperty("RealScheduleNum")
protected String RealScheduleNum; protected String RealScheduleNum;
@JsonProperty("NightCount")
protected String NightCount;
@JsonProperty("RoomCount")
protected String RoomCount;
// Constructor, getters and setters // Constructor, getters and setters
@ -130,6 +137,21 @@ public class ScheduleDetail {
return this; return this;
} }
public ScheduleDetailBuilder legId(Long legId) {
scheduleDetail.setLegId(legId);
return this;
}
public ScheduleDetailBuilder nightCount(String NightCount) {
scheduleDetail.setNightCount(NightCount);
return this;
}
public ScheduleDetailBuilder roomCount(String RoomCount) {
scheduleDetail.setRoomCount(RoomCount);
return this;
}
public ScheduleDetailBuilder orderState(String orderState) { public ScheduleDetailBuilder orderState(String orderState) {
scheduleDetail.setOrderState(orderState); scheduleDetail.setOrderState(orderState);
return this; return this;

View File

@ -6,6 +6,7 @@ import com.chint.application.services.login.strategy.PailaLoginStrategy;
import com.chint.application.services.login.strategy.PailaMobileLoginStrategy; 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.repository.UserRepository;
import com.chint.domain.service.SystemDomainService; import com.chint.domain.service.SystemDomainService;
import com.chint.domain.service.auth.AuthenticateService; import com.chint.domain.service.auth.AuthenticateService;
import com.chint.domain.value_object.UserLoginParam; import com.chint.domain.value_object.UserLoginParam;
@ -18,15 +19,18 @@ import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest; import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
import com.chint.interfaces.rest.ly.LYUserRequest; import com.chint.interfaces.rest.ly.LYUserRequest;
import com.chint.interfaces.rest.ly.dto.login.LoginParam;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@Slf4j
@RestController @RestController
@RequestMapping("/public") @RequestMapping("/public")
public class LoginController { public class LoginController {
@ -52,6 +56,9 @@ public class LoginController {
@Autowired @Autowired
private PailaMobileLoginStrategy pailaMobileLoginStrategy; private PailaMobileLoginStrategy pailaMobileLoginStrategy;
@Autowired
private UserRepository userRepository;
@ApiOperation("财务共享登录") @ApiOperation("财务共享登录")
@Transactional @Transactional
@GetMapping("/login") @GetMapping("/login")
@ -83,17 +90,7 @@ public class LoginController {
//异步执行更新用户信息到同程 //异步执行更新用户信息到同程
User currentUser = userLoginResult.getUser(); User currentUser = userLoginResult.getUser();
CompletableFuture.runAsync(() -> { syncUserInfoToSupplier(currentUser);
BaseContext.setCurrentUser(currentUser);
lyUserRequest.saveCurrentUser();
BaseContext.removeCurrentUser();
});
//异步执行更新用户信息到携程
CompletableFuture.runAsync(() -> {
BaseContext.setCurrentUser(currentUser);
cTripUserSaveRequest.saveUserToCTrip();
BaseContext.removeCurrentUser();
});
//清除职级信息 //清除职级信息
userLoginResult.getUser().setProfLevel(null); userLoginResult.getUser().setProfLevel(null);
@ -107,7 +104,7 @@ public class LoginController {
@ApiOperation("商旅平台单点") @ApiOperation("商旅平台单点")
@Transactional @Transactional
@PostMapping("/login/sso") @PostMapping("/login/sso")
public Result<UserLoginResult> loginSSO(@RequestBody UserLoginParam userLoginParam){ public Result<UserLoginResult> loginSSO(@RequestBody UserLoginParam userLoginParam) {
String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode()); String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode());
@ -117,18 +114,7 @@ public class LoginController {
//异步执行更新用户信息到同程 //异步执行更新用户信息到同程
User currentUser = userLoginResult.getUser(); User currentUser = userLoginResult.getUser();
CompletableFuture.runAsync(() -> { syncUserInfoToSupplier(currentUser);
BaseContext.setCurrentUser(currentUser);
lyUserRequest.saveCurrentUser();
BaseContext.removeCurrentUser();
});
//异步执行更新用户信息到携程
CompletableFuture.runAsync(() -> {
BaseContext.setCurrentUser(currentUser);
cTripUserSaveRequest.saveUserToCTrip();
BaseContext.removeCurrentUser();
});
//清除职级信息 //清除职级信息
userLoginResult.getUser().setProfLevel(null); userLoginResult.getUser().setProfLevel(null);
userLoginResult.getUser().setManaLevel(null); userLoginResult.getUser().setManaLevel(null);
@ -138,7 +124,7 @@ public class LoginController {
@ApiOperation("商旅平台移动端单点") @ApiOperation("商旅平台移动端单点")
@Transactional @Transactional
@PostMapping("/login/sso/mobile") @PostMapping("/login/sso/mobile")
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam){ public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam) {
String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode()); String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode());
@ -148,21 +134,51 @@ public class LoginController {
//异步执行更新用户信息到同程 //异步执行更新用户信息到同程
User currentUser = userLoginResult.getUser(); User currentUser = userLoginResult.getUser();
CompletableFuture.runAsync(() -> { syncUserInfoToSupplier(currentUser);
BaseContext.setCurrentUser(currentUser);
lyUserRequest.saveCurrentUser();
BaseContext.removeCurrentUser();
});
//异步执行更新用户信息到携程
CompletableFuture.runAsync(() -> {
BaseContext.setCurrentUser(currentUser);
cTripUserSaveRequest.saveUserToCTrip();
BaseContext.removeCurrentUser();
});
//清除职级信息 //清除职级信息
userLoginResult.getUser().setProfLevel(null); userLoginResult.getUser().setProfLevel(null);
userLoginResult.getUser().setManaLevel(null); userLoginResult.getUser().setManaLevel(null);
return Result.Success(CommonMessageConstant.SUCCESS, userLoginResult); return Result.Success(CommonMessageConstant.SUCCESS, userLoginResult);
} }
private void syncUserInfoToSupplier(User user) {
// 给定的 LocalDateTime 实例示例中为2024年3月1日15:00
LocalDateTime lastSyncTime = user.getSyncTime();
if (lastSyncTime == null) {
asyncUser(user);
return;
}
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 计算当前时间与给定时间之间的持续时间
Duration duration = Duration.between(lastSyncTime, now);
// 判断是否超过一天
if (duration.toDays() >= 1) {
asyncUser(user);
} else {
log.info("未超过一天,不执行同步。");
}
}
private void asyncUser(User user) {
// 如果超过一天执行同步代码
CompletableFuture.runAsync(() -> {
BaseContext.setCurrentUser(user);
lyUserRequest.saveCurrentUser();
BaseContext.removeCurrentUser();
});
//异步执行更新用户信息到携程
CompletableFuture.runAsync(() -> {
BaseContext.setCurrentUser(user);
cTripUserSaveRequest.saveUserToCTrip();
BaseContext.removeCurrentUser();
});
// 发送保存用户同步时间
user.setSyncTime(LocalDateTime.now());
userRepository.save(user);
}
} }

View File

@ -19,6 +19,7 @@ import com.chint.infrastructure.constant.FSSCConstant;
import com.chint.infrastructure.constant.LegConstant; import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -32,6 +33,7 @@ import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME; import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_APPROVAL; import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_APPROVAL;
@ -68,6 +70,12 @@ public class OrderQuery {
public PageResult<RouteOrderPageRes> pageQuery(OrderQueryData queryData) { public PageResult<RouteOrderPageRes> pageQuery(OrderQueryData queryData) {
if (StringCheck.isFirstCharacterChinese(queryData.getKeyWord())) {
queryData.setInstructions(queryData.getKeyWord());
} else {
queryData.setOrderNo(queryData.getKeyWord());
}
//执行筛选分页查询 //执行筛选分页查询
List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes(); List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes();
List<Integer> legTypes = queryData.getLegTypes(); List<Integer> legTypes = queryData.getLegTypes();
@ -230,7 +238,9 @@ public class OrderQuery {
leg.reloadStatus(); leg.reloadStatus();
CityEntity originCity; CityEntity originCity;
CityEntity destinationCity; CityEntity destinationCity;
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder(); ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail
.builder()
.legId(leg.getLegId());
if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) { if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) {
if (leg.getOriginLocation() != null) { if (leg.getOriginLocation() != null) {
@ -256,6 +266,12 @@ public class OrderQuery {
} }
} }
if (leg.getLegType().equals(LEG_TYPE_HOTEL)) {
scheduleDetailBuilder
.roomCount("1")
.nightCount(leg.nightCount().toString());
}
if (leg.getCurrencyType() != null) { if (leg.getCurrencyType() != null) {
scheduleDetailBuilder scheduleDetailBuilder
.currencyName(leg.getCurrencyType().getDescription()) .currencyName(leg.getCurrencyType().getDescription())
@ -301,7 +317,7 @@ public class OrderQuery {
return switch (legType) { return switch (legType) {
case LegConstant.LEG_TYPE_TRAIN -> FSSCConstant.TRIP_CALLBACK_TRAIN_TYPE; case LegConstant.LEG_TYPE_TRAIN -> FSSCConstant.TRIP_CALLBACK_TRAIN_TYPE;
case LegConstant.LEG_TYPE_AIRPLANE -> FSSCConstant.TRIP_CALLBACK_FLIGHT_TYPE; case LegConstant.LEG_TYPE_AIRPLANE -> FSSCConstant.TRIP_CALLBACK_FLIGHT_TYPE;
case LegConstant.LEG_TYPE_HOTEL -> FSSCConstant.TRIP_CALLBACK_HOTEL_TYPE; case LEG_TYPE_HOTEL -> FSSCConstant.TRIP_CALLBACK_HOTEL_TYPE;
case LegConstant.LEG_TYPE_TAXI -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE; case LegConstant.LEG_TYPE_TAXI -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;
case LegConstant.LEG_TYPE_OTHER -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE; case LegConstant.LEG_TYPE_OTHER -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;
default -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE; default -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;

View File

@ -28,8 +28,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_NOT_ORDERED; import static com.chint.infrastructure.constant.RouteConstant.*;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
@Service @Service
public class OrderApplicationService { public class OrderApplicationService {
@ -77,7 +76,14 @@ public class OrderApplicationService {
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();
//如果订单状态已经处于审批中 那么为这个新增的leg也提交审批状态
if (order.getOrderStatus() >= ORDER_STATUS_APPROVAL) {
Command.of(LegApprovalCommand.class).legId(leg.getLegId()).sendToQueue();
}
});
//异步操作-如果是当前的状态已经进行过匹配那么就要订单同步到供应商一次 //异步操作-如果是当前的状态已经进行过匹配那么就要订单同步到供应商一次
if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) { if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) {
@ -142,7 +148,7 @@ public class OrderApplicationService {
@Transactional @Transactional
public void approve(ApproveLegData approveLegData) { public void approve(ApproveLegData approveLegData) {
Command.of(LegApprovalCommand.class).data(approveLegData).sendToQueue(); Command.of(RouteApprovalCommand.class).data(approveLegData).sendToQueue();
} }
@Transactional @Transactional

View File

@ -16,8 +16,10 @@ import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection; import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
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_OTHER;
@ -212,6 +214,17 @@ public class Leg {
.max(Integer::compareTo); .max(Integer::compareTo);
} }
public Integer nightCount() {
return calculateNightsBetweenDates(LocalDate.from(this.startTime),
LocalDate.from(this.endTime));
}
public static int calculateNightsBetweenDates(LocalDate start, LocalDate end) {
// 计算两个日期之间的天数差异不包括结束日期
long daysBetween = ChronoUnit.DAYS.between(start, end);
// 将天数差异转换为晚上数量
return (int) daysBetween;
}
// private Leg timeFormatter() { // private Leg timeFormatter() {
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// String string = this.startTime.toString(); // String string = this.startTime.toString();

View File

@ -43,6 +43,10 @@ public class HotCityTag {
internationalCitys.add("欧洲_挪威_奥斯陆市_奥斯陆_"); internationalCitys.add("欧洲_挪威_奥斯陆市_奥斯陆_");
internationalCitys.add("北美洲_美国_加利福尼亚州_旧金山_"); internationalCitys.add("北美洲_美国_加利福尼亚州_旧金山_");
internationalCitys.add("亚洲_新加坡_新加坡_新加坡_"); internationalCitys.add("亚洲_新加坡_新加坡_新加坡_");
internationalCitys.add("亚洲_中国_香港_香港_");
internationalCitys.add("亚洲_中国_澳门_澳门_");
internationalCitys.add("亚洲_中国_台湾_台北_");
} }

View File

@ -9,4 +9,5 @@ public class SystemCode {
private Long id; private Long id;
private String systemName; private String systemName;
private String systemCode; private String systemCode;
private String bpmCode;
} }

View File

@ -11,6 +11,7 @@ import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Table; import org.springframework.data.relational.core.mapping.Table;
import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
@Data @Data
@ -27,6 +28,7 @@ public class User {
private String gender; private String gender;
private String phoneNumber; private String phoneNumber;
private String password; private String password;
private LocalDateTime syncTime;
@Transient @Transient
private String standardLevel; private String standardLevel;
@Transient @Transient
@ -47,7 +49,7 @@ public class User {
this.employeeNo = employeeNo; this.employeeNo = employeeNo;
} }
public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel,String companyCode) { public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) {
this.userId = userId; this.userId = userId;
this.employeeNo = employeeNo; this.employeeNo = employeeNo;
this.employeeLevel = employeeLevel; this.employeeLevel = employeeLevel;
@ -80,7 +82,7 @@ public class User {
Claim employeeNo = claims.get(AuthMessageConstant.USER_EMPLOYEE_NO); Claim employeeNo = claims.get(AuthMessageConstant.USER_EMPLOYEE_NO);
Claim name = claims.get(AuthMessageConstant.USER_NAME); Claim name = claims.get(AuthMessageConstant.USER_NAME);
Claim employeeLevel = claims.get(AuthMessageConstant.USER_EMPLOYEE_LEVEL); Claim employeeLevel = claims.get(AuthMessageConstant.USER_EMPLOYEE_LEVEL);
// Claim rankCode = claims.get(AuthMessageConstant.USER_RANK_CODE); // Claim rankCode = claims.get(AuthMessageConstant.USER_RANK_CODE);
Claim companyCode = claims.get(AuthMessageConstant.USER_COMPANY_CODE); Claim companyCode = claims.get(AuthMessageConstant.USER_COMPANY_CODE);
Claim loginParam = claims.get(AuthMessageConstant.USER_LOGIN_PARAM); Claim loginParam = claims.get(AuthMessageConstant.USER_LOGIN_PARAM);
Claim standardLevel = claims.get(AuthMessageConstant.USER_STANDARD_LEVEL); Claim standardLevel = claims.get(AuthMessageConstant.USER_STANDARD_LEVEL);

View File

@ -32,6 +32,7 @@ public class LocationDomainService {
} }
private List<Location> getLocationsByType(LocationParam locationParam, List<Location> queryByCityName) { private List<Location> getLocationsByType(LocationParam locationParam, List<Location> queryByCityName) {
System.out.println(queryByCityName);
Integer cityType = locationParam.getCityType(); Integer cityType = locationParam.getCityType();
return switch (cityType) { return switch (cityType) {
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName

View File

@ -126,15 +126,17 @@ public class OrderDomainService {
Command.of(BPMAuditCommand.class) Command.of(BPMAuditCommand.class)
.orderNo(orderDetail.getOrderNo()) .orderNo(orderDetail.getOrderNo())
.productType(orderDetail.getProductType()) .productType(orderDetail.getProductType())
.extensionData(orderDetail.getExtensionDataByProductType()) .extensionData(orderDetail)
.sendToQueue(); .sendToQueue();
} }
;
} }
@ListenTo(command = "BPMAuditCommand", order = 0) @ListenTo(command = "BPMAuditCommand", order = 0)
public void toBpmAudit(BPMAuditCommand command) { public void toBpmAudit(BPMAuditCommand command) {
Object data = command.getExtensionData(); OrderDetail orderDetail = command.getExtensionData();
Object data = orderDetail.getExtensionDataByProductType();
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
ExceedStandardDto exceedStandardDto = switch (command.getProductType()) { ExceedStandardDto exceedStandardDto = switch (command.getProductType()) {
case LegConstant.LEG_TYPE_TRAIN -> bpmParamFactory.creatAuditParamByTrain((TrainOrderDetail) data); case LegConstant.LEG_TYPE_TRAIN -> bpmParamFactory.creatAuditParamByTrain((TrainOrderDetail) data);
case LegConstant.LEG_TYPE_AIRPLANE -> bpmParamFactory.creatAuditParamByFlight((FlightOrderDetail) data); case LegConstant.LEG_TYPE_AIRPLANE -> bpmParamFactory.creatAuditParamByFlight((FlightOrderDetail) data);
@ -143,7 +145,7 @@ public class OrderDomainService {
case LegConstant.LEG_TYPE_OTHER -> bpmParamFactory.creatAuditParamByOther((OtherOrderDetail) data); case LegConstant.LEG_TYPE_OTHER -> bpmParamFactory.creatAuditParamByOther((OtherOrderDetail) data);
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND); default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
}; };
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto).getSuccess(), DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto, sysCode).getSuccess(),
0); 0);
} }
} }

View File

@ -72,7 +72,7 @@ public class LegEventHandler implements LegEventService {
@Transactional @Transactional
@Override @Override
public void approveLeg(LegApprovalCommand command) { public void approveRoute(RouteApprovalCommand command) {
ApproveLegData data = command.getData(); ApproveLegData data = command.getData();
RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus(); RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus();
if (routeOrder.getLegItems().isEmpty()) { if (routeOrder.getLegItems().isEmpty()) {
@ -135,6 +135,13 @@ public class LegEventHandler implements LegEventService {
} }
} }
@Override
public void approveLeg(LegApprovalCommand command) {
Leg leg = legRepository.findByLegId(command.getLegId());
leg.addEvent(legEventFactory.creatLegEvent(command.getLegEventType()));
legRepository.save(leg);
}
@Transactional @Transactional
@Override @Override
public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) { public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) {

View File

@ -8,10 +8,12 @@ public interface LegEventService {
void prepareLeg(LegPrepareCommand command); void prepareLeg(LegPrepareCommand command);
//审批事件要从bpm或其他平台接收到一个真实订单 //审批事件要从bpm或其他平台接收到一个真实订单
void approveLeg(LegApprovalCommand command); void approveRoute(RouteApprovalCommand command);
void syncLeg(LegSyncCommand command); void syncLeg(LegSyncCommand command);
void approveLeg(LegApprovalCommand command);
//下单事件 //下单事件
ResultContainer orderLeg(LegOrderedCommand command); ResultContainer orderLeg(LegOrderedCommand command);

View File

@ -23,10 +23,10 @@ public class LegEventServiceImpl implements LegEventService {
//因为审批是针对整个订单的因此所有订单下属的行程节点触发审批事件 //因为审批是针对整个订单的因此所有订单下属的行程节点触发审批事件
//出发审批提交事件 需要生成 差旅单 将差旅但提交到供应商 //出发审批提交事件 需要生成 差旅单 将差旅但提交到供应商
//根据command里面选择的数据来讲差旅但提交到不同的实现类当中 //根据command里面选择的数据来讲差旅但提交到不同的实现类当中
@ListenTo(command = "LegApprovalCommand", order = 0) @ListenTo(command = "RouteApprovalCommand", order = 0)
@Override @Override
public void approveLeg(LegApprovalCommand command) { public void approveRoute(RouteApprovalCommand command) {
legEventHandler.approveLeg(command); legEventHandler.approveRoute(command);
} }
//这里需要获取同步类价格routeOrder同步到供应商 //这里需要获取同步类价格routeOrder同步到供应商
@ -36,6 +36,13 @@ public class LegEventServiceImpl implements LegEventService {
legEventHandler.syncLeg(command); legEventHandler.syncLeg(command);
} }
@ListenTo(command = "LegApprovalCommand", order = 0)
@Override
public void approveLeg(LegApprovalCommand command) {
legEventHandler.approveLeg(command);
}
//下单时间要求回传需要付款的金额以及生成对于的行程订单号如果没有行程订单号根据地点和时间进行匹配 //下单时间要求回传需要付款的金额以及生成对于的行程订单号如果没有行程订单号根据地点和时间进行匹配
@ListenTo(command = "LegOrderedCommand", order = 0) @ListenTo(command = "LegOrderedCommand", order = 0)
@Override @Override

View File

@ -94,6 +94,8 @@ public class LocationRepositoryImpl implements LocationRepository {
List<Location> hotCities = List<Location> hotCities =
jdbcLocationRepository.findByLocationPathNameInAndLevel(locationNames,3); jdbcLocationRepository.findByLocationPathNameInAndLevel(locationNames,3);
return hotCities; return hotCities;
} }

View File

@ -41,7 +41,7 @@ public class BPMRequest {
private String XNBPMUrl; private String XNBPMUrl;
//超标申请 //超标申请
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) { public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto , String sysCode ) {
if ("H3BPM".equals("XNBPM")) { if ("H3BPM".equals("XNBPM")) {
return XNBPMSubmitWorkflow("JG_AS_CLCESQ", exceedStandardDto); return XNBPMSubmitWorkflow("JG_AS_CLCESQ", exceedStandardDto);
} else { } else {

View File

@ -34,6 +34,5 @@ public class CommonController {
case 6-> carBackController.carBack(notification); case 6-> carBackController.carBack(notification);
default -> new LYNoteResponse("200", "失败"); default -> new LYNoteResponse("200", "失败");
}; };
} }
} }

View File

@ -81,7 +81,6 @@ public class HotelBackController {
case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中 case 1 -> OrderConstant.ORDER_EVENT_PAYED;//确认中
case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房 case 2,3,6 -> OrderConstant.ORDER_EVENT_ORDERED;//待入住,已变更,已退房
case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败 case 4,5 -> OrderConstant.ORDER_EVENT_CANCEL;//已取消,预定失败
// case 50 -> OrderConstant.ORDER_EVENT_ETA;//超标
default -> -99; default -> -99;
}; };
} }

View File

@ -139,9 +139,9 @@ class RouteApplicationTests {
} }
@Test @Test
void loginSign() { void loginSign() {
String sfno = "230615020"; String sfno = "090223001";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ20240228"; String billcode = "CLSQ240226000004";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";
String sec = "Superdandan"; String sec = "Superdandan";
String timespan = "1708908662738"; String timespan = "1708908662738";