Compare commits
9 Commits
07685dbd35
...
5b8a9a3ac2
Author | SHA1 | Date |
---|---|---|
lulz1 | 5b8a9a3ac2 | |
lulz1 | 25c65d0986 | |
lulz1 | b99c0e945e | |
lulz1 | bb302bfb7a | |
dengwc | e4ffad832c | |
dengwc | 984b584dc6 | |
dengwc | 37ab01578c | |
lulz1 | c4885c2aa8 | |
lulz1 | 93a001ce6a |
|
@ -1,5 +1,6 @@
|
|||
package com.chint.application.commands;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -11,6 +12,7 @@ public class OrderStatusChangeCommand extends Command {
|
|||
private String orderNo;
|
||||
private String outStatus;
|
||||
private Integer orderEventType;
|
||||
private OrderDetail orderDetail;
|
||||
|
||||
public OrderStatusChangeCommand eventType(Integer eventType) {
|
||||
this.orderEventType = eventType;
|
||||
|
@ -26,4 +28,9 @@ public class OrderStatusChangeCommand extends Command {
|
|||
this.outStatus = outStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OrderStatusChangeCommand orderDetail(OrderDetail orderDetail) {
|
||||
this.orderDetail = orderDetail;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.chint.application.dtos.trip;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ExtendedFieldParam implements Serializable {
|
||||
@JsonProperty("isExceed")
|
||||
private boolean isExceed;
|
||||
}
|
|
@ -62,7 +62,7 @@ public class ScheduleDetail {
|
|||
protected String ParentScheduleNum;
|
||||
|
||||
@JsonProperty("ExtendedField")
|
||||
protected String ExtendedField;
|
||||
protected ExtendedFieldParam ExtendedField;
|
||||
|
||||
@JsonProperty("QuoteGroupNum")
|
||||
protected String QuoteGroupNum;
|
||||
|
@ -114,6 +114,8 @@ public class ScheduleDetail {
|
|||
|
||||
@JsonProperty("RealScheduleNum")
|
||||
protected String RealScheduleNum;
|
||||
|
||||
|
||||
// Constructor, getters and setters
|
||||
|
||||
public static ScheduleDetailBuilder builder(){
|
||||
|
@ -213,10 +215,10 @@ public class ScheduleDetail {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ScheduleDetailBuilder extendedField(String extendedField) {
|
||||
scheduleDetail.setExtendedField(extendedField);
|
||||
return this;
|
||||
}
|
||||
// public ScheduleDetailBuilder extendedField(String extendedField) {
|
||||
// scheduleDetail.setExtendedField(extendedField);
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public ScheduleDetailBuilder quoteGroupNum(String quoteGroupNum) {
|
||||
scheduleDetail.setQuoteGroupNum(quoteGroupNum);
|
||||
|
@ -312,6 +314,9 @@ public class ScheduleDetail {
|
|||
}
|
||||
|
||||
public ScheduleDetail build() {
|
||||
ExtendedFieldParam extendedFieldParam = new ExtendedFieldParam();
|
||||
extendedFieldParam.setExceed(false);
|
||||
scheduleDetail.setExtendedField(extendedFieldParam);
|
||||
return scheduleDetail;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.chint.application.dtos.DeleteLegData;
|
|||
import com.chint.application.queryies.OrderQuery;
|
||||
import com.chint.application.services.OrderApplicationService;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.service.OrderDetailDomainService;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -24,6 +25,9 @@ public class OrderController {
|
|||
@Autowired
|
||||
private OrderApplicationService orderApplicationService;
|
||||
|
||||
@Autowired
|
||||
private OrderDetailDomainService orderDetailDomainService;
|
||||
|
||||
@Autowired
|
||||
private OrderQuery orderQuery;
|
||||
|
||||
|
@ -69,4 +73,12 @@ public class OrderController {
|
|||
orderApplicationService.deleteLegToOrder(deleteLegData);
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("同步行程规划单的订单状态")
|
||||
@PostMapping("/sync/order")
|
||||
public Result<String> reloadOrderDetail(@RequestBody SyncLegData syncLegData) {
|
||||
orderDetailDomainService.syncOrderDetailStatusByRouteId(syncLegData.getRouteId());
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.application.in;
|
|||
|
||||
import com.chint.application.queryies.OrderQuery;
|
||||
import com.chint.application.services.OrderApplicationService;
|
||||
import com.chint.domain.service.SystemDomainService;
|
||||
import com.chint.domain.value_object.ApprovalLegData;
|
||||
import com.chint.domain.value_object.ApproveLegData;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
|
@ -22,6 +23,9 @@ public class OrderPublicController {
|
|||
@Autowired
|
||||
private OrderApplicationService orderApplicationService;
|
||||
|
||||
@Autowired
|
||||
private SystemDomainService systemDomainService;
|
||||
|
||||
@Autowired
|
||||
private OrderQuery orderQuery;
|
||||
|
||||
|
@ -29,6 +33,7 @@ public class OrderPublicController {
|
|||
@ApiOperation("提交审批行程规划单")
|
||||
@PostMapping("/approve")
|
||||
public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) {
|
||||
systemDomainService.checkSystemCode(approveLegData.getSysCode());
|
||||
orderApplicationService.approve(approveLegData);
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
@ -49,4 +54,5 @@ public class OrderPublicController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/rank")
|
||||
public class RankController {
|
||||
|
@ -89,6 +91,10 @@ public class RankController {
|
|||
.setProductType(String.valueOf(travelStandardsData.getProductType()))
|
||||
.setPrice(travelStandardsData.getPrice())
|
||||
.setCityTag(travelStandardsData.getCityTag());
|
||||
List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards);
|
||||
if (travelStandardsList.isEmpty()) {
|
||||
return Result.error("该差标已经存在,不可重复添加!");
|
||||
}
|
||||
travelStandards = travelStandardsRepository.save(travelStandards);
|
||||
return Result.Success(CommonMessageConstant.SUCCESS, travelStandards);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.chint.application.out;
|
|||
import com.chint.application.commands.OrderCreateCommand;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.OrderException;
|
||||
import com.chint.domain.service.SystemDomainService;
|
||||
import com.chint.domain.service.auth.AuthenticateService;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.domain.value_object.UserLoginResult;
|
||||
|
@ -41,6 +42,9 @@ public class LoginController {
|
|||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private SystemDomainService systemDomainService;
|
||||
|
||||
@Transactional
|
||||
@GetMapping("/login")
|
||||
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno,
|
||||
|
@ -53,15 +57,8 @@ public class LoginController {
|
|||
String originalString = sfno + syscode + billcode + companycode + AuthMessageConstant.LOGIN_SECRET_KEY + timespan;
|
||||
String generateSign = Digest.md5(originalString);
|
||||
if (generateSign.equals(sign)) {
|
||||
//公司名称转为,中文转为编号
|
||||
/*if (StringCheck.isFirstCharacterChinese(companycode)) {
|
||||
User user = new User(Long.valueOf(sfno));
|
||||
user.setUserLoginParam(new UserLoginParam());
|
||||
BaseContext.setCurrentUser(user);
|
||||
userHttpRequest.loadUserInfo(user);
|
||||
BaseContext.removeCurrentUser();
|
||||
companycode = user.getCompanyCode();
|
||||
}*/
|
||||
//创建订单先对sysCode进行检查
|
||||
systemDomainService.checkSystemCode(syscode);
|
||||
|
||||
// 创建 UserLoginParam 对象
|
||||
UserLoginParam userLoginParam = new UserLoginParam(sfno, syscode, billcode, companycode, timespan);
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.chint.domain.aggregates.order.RouteOrder;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.google.gson.Gson;
|
||||
|
@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
|
@ -61,6 +61,11 @@ public class OrderOutController {
|
|||
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
|
||||
routeOrderRes.setUserName(user.getName());
|
||||
routeOrderRes.setOrderDetailRes(orderDetailResList);
|
||||
routeOrderRes.setOrderDetailRes(routeOrderRes
|
||||
.getOrderDetailRes()
|
||||
.stream()
|
||||
.filter(it -> !it.getOrderStatus().equals(ORDER_EVENT_CANCEL_NAME) && !it.getOrderStatus().equals(ORDER_EVENT_PREPARE_NAME))
|
||||
.toList());
|
||||
return Result.Success(SUCCESS, routeOrderRes);
|
||||
}
|
||||
|
||||
|
@ -81,6 +86,7 @@ public class OrderOutController {
|
|||
public Result<FlightPriceData> estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) {
|
||||
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
|
||||
}
|
||||
|
||||
@ApiOperation("查询酒店估算价格")
|
||||
@PostMapping("/estimate/hotel")
|
||||
public Result<HotelPriceData> estimateHotelPrice(@RequestBody PriceQueryData priceQueryData) {
|
||||
|
@ -88,6 +94,7 @@ public class OrderOutController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据Id查询行程规划单-元年数据")
|
||||
@PostMapping("/query/tripCallback")
|
||||
public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) {
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.chint.infrastructure.constant.DataMessageConstant;
|
|||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -44,6 +45,8 @@ public class OrderApplicationService {
|
|||
@Autowired
|
||||
private LegFactory legFactory;
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
public RouteOrder saveOrder(OrderSaveData orderSaveData) {
|
||||
RouteOrder order;
|
||||
|
@ -142,4 +145,8 @@ public class OrderApplicationService {
|
|||
Command.of(OrderApprovalCommand.class).data(data).sendToQueue();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void reloadOrderDetail(SyncLegData syncLegData) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,10 @@ public class ApproveOrderNo {
|
|||
private String sysCode;
|
||||
@ApiModelProperty("实际单号")
|
||||
private String actualOrderNo;
|
||||
@ApiModelProperty("入账公司")
|
||||
@ApiModelProperty("入账公司编码")
|
||||
private String accountCompany;
|
||||
@ApiModelProperty("入账公司名称")
|
||||
private String accountCompanyName;
|
||||
@ApiModelProperty("申请说明")
|
||||
private String instructions;
|
||||
@ApiModelProperty("财务共享订单创建人")
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.chint.infrastructure.constant.LegConstant;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
|
@ -19,7 +20,7 @@ import java.time.LocalDateTime;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@Table("leg")
|
||||
@NoArgsConstructor
|
||||
|
@ -173,7 +174,8 @@ public class Leg {
|
|||
// 检查是否已存在此类型的事件
|
||||
boolean exists = eventList.stream().anyMatch(e -> e.getEventType().equals(newEventType));
|
||||
if (exists) {
|
||||
throw new LegEventException("Event of this type already exists.");
|
||||
log.info("Event of this type already exists.");
|
||||
return this;
|
||||
}
|
||||
|
||||
// 如果列表为空,且新事件不是准备事件,抛出异常
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.value_object.enums.CurrencyType;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.constant.OrderConstant;
|
||||
import lombok.Data;
|
||||
|
@ -16,12 +15,15 @@ import java.util.ArrayList;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
|
||||
@Data
|
||||
@Table("order_detail")
|
||||
public class OrderDetail {
|
||||
@Id
|
||||
private Long orderId; // 使用 order_id 作为主键
|
||||
private Long legId; // 使用行程节点关联leg
|
||||
private Long routeId;
|
||||
private String orderNo;
|
||||
private String supplierName;
|
||||
private Integer productType; // 商品类型
|
||||
|
@ -93,6 +95,13 @@ public class OrderDetail {
|
|||
return this;
|
||||
}
|
||||
|
||||
public OrderEvent getLastEvent() {
|
||||
return this.orderEventList
|
||||
.stream()
|
||||
.max(Comparator.comparingLong(OrderEvent::getOrderEventId))
|
||||
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
}
|
||||
|
||||
public OrderDetail price(String price) {
|
||||
this.price = price;
|
||||
return this;
|
||||
|
@ -105,7 +114,7 @@ public class OrderDetail {
|
|||
case LegConstant.LEG_TYPE_HOTEL -> this.hotelOrderDetail;
|
||||
case LegConstant.LEG_TYPE_TAXI -> this.carOrderDetail;
|
||||
case LegConstant.LEG_TYPE_OTHER -> this.otherOrderDetail;
|
||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
default -> throw new NotFoundException(NOT_FOUND);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ import com.chint.infrastructure.constant.RouteConstant;
|
|||
import com.chint.infrastructure.constant.SupplierNameConstant;
|
||||
import com.chint.infrastructure.constant.UtilConstant;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.infrastructure.echo_framework.dispatch.Properties;
|
||||
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
|
||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
@ -28,6 +30,8 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
|
||||
|
||||
@Data
|
||||
@Table("route_order")
|
||||
public class RouteOrder extends BaseEntity {
|
||||
|
@ -192,6 +196,8 @@ public class RouteOrder extends BaseEntity {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public RouteOrder reloadStatus(OrderSaveData orderSaveData) {
|
||||
// 重新加载所有Leg的状态
|
||||
List<Leg> legs = this.getLegItems();
|
||||
|
@ -340,13 +346,13 @@ public class RouteOrder extends BaseEntity {
|
|||
};
|
||||
}
|
||||
|
||||
public void matchOrderWithLeg(OrderDetail orderDetail) {
|
||||
public OrderDetail matchOrderWithLeg(OrderDetail orderDetail) {
|
||||
if (this.legItems.isEmpty()) {
|
||||
return;
|
||||
return orderDetail;
|
||||
}
|
||||
|
||||
// 定义时间容差(例如1天)
|
||||
long tolerance = Duration.ofDays(1).toMillis();
|
||||
long tolerance = Duration.ofDays(2).toMillis();
|
||||
|
||||
List<Leg> potentialMatches = this.legItems.stream()
|
||||
.filter(leg -> leg.getLegType().equals(orderDetail.getProductType())
|
||||
|
@ -363,11 +369,14 @@ public class RouteOrder extends BaseEntity {
|
|||
|
||||
// 如果找到最佳匹配项,执行相应操作
|
||||
if (bestMatch != null) {
|
||||
Command.of(LegOrderedCommand.class)
|
||||
Properties properties = Command.of(LegOrderedCommand.class)
|
||||
.legId(bestMatch.getLegId())
|
||||
.orderDetailId(orderDetail.getOrderId())
|
||||
.sendToQueue();
|
||||
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
|
||||
return (OrderDetail) byPropertyName.getValue();
|
||||
}
|
||||
return orderDetail;
|
||||
}
|
||||
|
||||
private double calculateMatchScore(Leg leg, OrderDetail orderDetail, long tolerance) {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.chint.domain.aggregates.system;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Data
|
||||
@Table("system_code")
|
||||
public class SystemCode {
|
||||
private Long id;
|
||||
private String systemName;
|
||||
private String systemCode;
|
||||
}
|
|
@ -32,6 +32,8 @@ public class User {
|
|||
@Transient
|
||||
private String companyCode;
|
||||
@Transient
|
||||
private String companyName;
|
||||
@Transient
|
||||
private String workStatus;
|
||||
@Transient
|
||||
private String manaLevel;
|
||||
|
|
|
@ -55,6 +55,7 @@ public class RouteOrderFactory implements OrderFactory {
|
|||
approveOrderNo.setSysCode(loginParam.getSyscode());
|
||||
approveOrderNo.setFakeOrderNo(loginParam.getBillcode());
|
||||
approveOrderNo.setAccountCompany(currentUser.getCompanyCode());
|
||||
approveOrderNo.setAccountCompanyName(currentUser.getCompanyName());
|
||||
routeOrder.setApproveOrderNo(approveOrderNo);
|
||||
routeOrder.setBookingTime(LocalDateTime.now());
|
||||
return routeOrder;
|
||||
|
|
|
@ -1,17 +1,45 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
|
||||
|
||||
@Component
|
||||
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{
|
||||
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||
|
||||
|
||||
@Autowired
|
||||
private OrderDetailRepository orderDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private RouteRepository routeRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
@Override
|
||||
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -22,7 +50,45 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{
|
|||
|
||||
@Override
|
||||
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
|
||||
return null;
|
||||
|
||||
HotelOrderInfoEntity hotelOrderInfoEntity = (HotelOrderInfoEntity) hotelOrderDetailData;
|
||||
String orderNo = hotelOrderInfoEntity.getOrderID();
|
||||
Optional<OrderDetail> byOrderNo = orderDetailRepository.findByOrderNo(orderNo);
|
||||
String journeyNo = hotelOrderInfoEntity.getJourneyNo();
|
||||
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
|
||||
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||
hotelOrderDetail.setOrderNo(orderNo); //订单号
|
||||
hotelOrderDetail.setOverStandard(null); //是否超标
|
||||
hotelOrderDetail.setOrderStatus(ORDER_DETAIL_STATUS_SUCCESS);
|
||||
hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
|
||||
hotelOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
|
||||
hotelOrderDetail.setReceiptsNum(journeyNo);
|
||||
|
||||
byOrderNo.flatMap(orderDetail -> routeOrder.getLegItems()
|
||||
.stream()
|
||||
.filter(it -> byOrderNo.get().getLegId().equals(it.getLegId()))
|
||||
.findFirst()).ifPresent(it ->
|
||||
hotelOrderDetail.setScheduleNum(it.getLegNo()));
|
||||
|
||||
Long EmployeeNo = routeOrder.getUserId();
|
||||
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
|
||||
String cityName = hotelOrderInfoEntity.getCityName();
|
||||
hotelOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo()));
|
||||
hotelOrderDetail.setBookingName(user.getName());
|
||||
hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber());
|
||||
hotelOrderDetail.setCreateTime(hotelOrderInfoEntity.getOrderDate());
|
||||
hotelOrderDetail.setCheckInCity(cityName);
|
||||
hotelOrderDetail.setHotelName(hotelOrderInfoEntity.getHotelName());
|
||||
hotelOrderDetail.setContactPhone(hotelOrderInfoEntity.getTelephone());
|
||||
hotelOrderDetail.setHotelAddress(locationRepository.locationPathByName(cityName)
|
||||
+ hotelOrderInfoEntity.getDistrictName() + hotelOrderInfoEntity.getAddress());
|
||||
hotelOrderDetail.setStarRate(hotelOrderInfoEntity.getStar());
|
||||
hotelOrderDetail.setCheckInDate(hotelOrderInfoEntity.getStartTime());
|
||||
hotelOrderDetail.setDepartureDate(hotelOrderInfoEntity.getEndTime());
|
||||
// hotelOrderDetail.setNightCount(hotelOrderInfoEntity.);
|
||||
return hotelOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,4 +20,6 @@ public interface LocationRepository {
|
|||
|
||||
List<Location> findByName(LocationParam locationParam);
|
||||
List<Location> findByName(String localName);
|
||||
|
||||
String locationPathByName(String localName);
|
||||
}
|
|
@ -14,4 +14,6 @@ public interface OrderDetailRepository {
|
|||
|
||||
OrderDetail save(OrderDetail orderDetail);
|
||||
|
||||
void deleteById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.system.SystemCode;
|
||||
|
||||
public interface SystemCodeRepository {
|
||||
|
||||
SystemCode save(SystemCode systemCode);
|
||||
|
||||
SystemCode findBySysCode(String sysCode);
|
||||
|
||||
SystemCode findById(Long id);
|
||||
}
|
|
@ -12,4 +12,6 @@ public interface TravelStandardsRepository {
|
|||
void saveAll(List<TravelStandards> travelStandardsList);
|
||||
List<TravelStandards> findByStandardLevel(String standardLevel);
|
||||
|
||||
List<TravelStandards> findByTravelStandards(TravelStandards travelStandards);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.chint.domain.service;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.service.order_search.OrderSearchSelector;
|
||||
import com.chint.domain.service.supplier.OrderDataAdapterSelector;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
|
||||
|
||||
@Service
|
||||
public class OrderDetailDomainService {
|
||||
|
||||
@Autowired
|
||||
private OrderDetailRepository orderDetailRepository;
|
||||
|
||||
@Autowired
|
||||
private OrderDetailFactory orderDetailFactory;
|
||||
|
||||
@Autowired
|
||||
private RouteRepository routeRepository;
|
||||
|
||||
@Autowired
|
||||
private OrderSearchSelector orderSearchSelector;
|
||||
|
||||
@Autowired
|
||||
private OrderDataAdapterSelector orderDataAdapterSelector;
|
||||
|
||||
public void syncOrderDetailStatus(List<OrderLegData> orderLegDataList) {
|
||||
for (OrderLegData orderLegData : orderLegDataList) {
|
||||
orderDetailRepository.findByOrderNo(orderLegData.getOutOrderNo()).ifPresent(
|
||||
it -> {
|
||||
if (!it.getLastEvent().getEventType().equals(orderLegData.getOrderStatus())) {
|
||||
it.addOrderEvent(orderDetailFactory.createEvent(orderLegData.getOrderStatus(),
|
||||
orderLegData.getOriginOrderStatus()));
|
||||
orderDetailRepository.save(it);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void syncOrderDetailStatusByRouteId(Long RouteId) {
|
||||
RouteOrder routeOrder = routeRepository.queryById(RouteId);
|
||||
String supplierName = routeOrder.getSupplierName();
|
||||
List<OrderLegData> orderLegDataList = new ArrayList<>();
|
||||
List<String> list = routeOrder.getOrderDetails().stream()
|
||||
.filter(it -> it.getLastEvent().getEventType() != ORDER_EVENT_CANCEL)
|
||||
.map(OrderDetail::getOrderNo).toList();
|
||||
for (String orderNo : list) {
|
||||
SupplierCallbackData supplierCallbackData = orderSearchSelector.of(supplierName).searchOrderDetail(orderNo);
|
||||
orderDataAdapterSelector.of(supplierName).adapt(supplierCallbackData).ifPresent(orderLegDataList::add);
|
||||
}
|
||||
syncOrderDetailStatus(orderLegDataList);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
|
|||
import com.chint.infrastructure.util.DelayDispatch;
|
||||
import com.chint.interfaces.rest.bpm.BPMParamFactory;
|
||||
import com.chint.interfaces.rest.bpm.BPMRequest;
|
||||
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -104,26 +104,25 @@ public class OrderDomainService {
|
|||
|
||||
@ListenTo(command = "OrderStatusChangeCommand", order = 0)
|
||||
public void orderDetailStatusChange(OrderStatusChangeCommand command) {
|
||||
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {
|
||||
String outStatus = command.getOutStatus();
|
||||
Integer orderEventType = command.getOrderEventType();
|
||||
OrderEvent event = orderDetailFactory.createEvent(orderEventType,
|
||||
outStatus);
|
||||
orderDetail.addOrderEvent(event);
|
||||
orderDetailRepository.save(orderDetail);
|
||||
OrderDetail orderDetail = command.getOrderDetail();
|
||||
String outStatus = command.getOutStatus();
|
||||
Integer orderEventType = command.getOrderEventType();
|
||||
OrderEvent event = orderDetailFactory.createEvent(orderEventType,
|
||||
outStatus);
|
||||
orderDetail.addOrderEvent(event);
|
||||
orderDetailRepository.save(orderDetail);
|
||||
|
||||
if (orderEventType.equals(OrderConstant.ORDER_EVENT_ETA)) {
|
||||
//这里如果发现事件的状态为ORDER_EVENT_ETA
|
||||
//需要根据发送审批给bpm
|
||||
//根据订单类型获取不同的订单扩展明细
|
||||
orderDetail.getExtensionDataByProductType();
|
||||
Command.of(BPMAuditCommand.class)
|
||||
.orderNo(orderDetail.getOrderNo())
|
||||
.productType(orderDetail.getProductType())
|
||||
.extensionData(orderDetail.getExtensionDataByProductType())
|
||||
.sendToQueue();
|
||||
}
|
||||
});
|
||||
if (orderEventType.equals(OrderConstant.ORDER_EVENT_ETA)) {
|
||||
//这里如果发现事件的状态为ORDER_EVENT_ETA
|
||||
//需要根据发送审批给bpm
|
||||
//根据订单类型获取不同的订单扩展明细
|
||||
orderDetail.getExtensionDataByProductType();
|
||||
Command.of(BPMAuditCommand.class)
|
||||
.orderNo(orderDetail.getOrderNo())
|
||||
.productType(orderDetail.getProductType())
|
||||
.extensionData(orderDetail.getExtensionDataByProductType())
|
||||
.sendToQueue();
|
||||
};
|
||||
}
|
||||
|
||||
@ListenTo(command = "BPMAuditCommand", order = 0)
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.chint.domain.service;
|
||||
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.SystemCodeRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.SYS_CODE_ERROR;
|
||||
|
||||
@Service
|
||||
public class SystemDomainService {
|
||||
|
||||
@Autowired
|
||||
private SystemCodeRepository systemCodeRepository;
|
||||
|
||||
public boolean checkSystemCode(String sysCode) {
|
||||
boolean b = systemCodeRepository.findBySysCode(sysCode) != null;
|
||||
if(!b){
|
||||
throw new NotFoundException(SYS_CODE_ERROR);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
|
@ -28,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.ORDER_STATUS_ERROR;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
|
||||
|
||||
@Service
|
||||
|
@ -76,10 +78,10 @@ public class LegEventHandler implements LegEventService {
|
|||
if (routeOrder.getLegItems().isEmpty()) {
|
||||
throw new OrderException(CommonMessageConstant.LEG_ERROR);
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_PREPARE)) {
|
||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
|
||||
approveOrderNo.setAccountCompany(data.getAccountCompany());
|
||||
// approveOrderNo.setAccountCompany(data.getAccountCompany());
|
||||
approveOrderNo.setInstructions(data.getInstructions());
|
||||
approveOrderNo.setCreator(data.getCreator());
|
||||
//这里order所有的leg触发approve事件
|
||||
|
@ -92,8 +94,10 @@ public class LegEventHandler implements LegEventService {
|
|||
routeOrder.addApprovalEvent(approvalEvent);
|
||||
//保存routeOrder的状态
|
||||
routeRepository.save(routeOrder);
|
||||
} else if (routeOrder.getOrderStatus() > ORDER_STATUS_PREPARE) {
|
||||
throw new CommandException(ORDER_STATUS_ERROR);
|
||||
} else {
|
||||
throw new CommandException("订单未初始化");
|
||||
throw new CommandException(ORDER_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +109,7 @@ public class LegEventHandler implements LegEventService {
|
|||
if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
|
||||
throw new CommandException("订单已同步");
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_PREPARE)) {
|
||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
throw new CommandException("订单未提交审批");
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) {
|
||||
|
@ -158,7 +162,7 @@ public class LegEventHandler implements LegEventService {
|
|||
// .max(Comparator.comparing(OrderDetail::getCreateTime))
|
||||
// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
|
||||
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理
|
||||
routeOrder.matchOrderWithLeg(orderDetail);
|
||||
orderDetail = routeOrder.matchOrderWithLeg(orderDetail);
|
||||
} else {
|
||||
orderDetail = byOrderNo.get();
|
||||
}
|
||||
|
@ -167,7 +171,7 @@ public class LegEventHandler implements LegEventService {
|
|||
|
||||
@Transactional
|
||||
@Override
|
||||
public void orderLeg(LegOrderedCommand command) {
|
||||
public ResultContainer orderLeg(LegOrderedCommand command) {
|
||||
//如果筛选事件可能会是错误,需要用户手动添加并修改事件 , 因此会进行额外出发修改下单事件。
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
//因为orderDetail已经进行持久化保存 ,只需要从数据库进行查询
|
||||
|
@ -178,6 +182,7 @@ public class LegEventHandler implements LegEventService {
|
|||
orderDetail.setLegId(leg.getLegId());
|
||||
legRepository.save(leg);
|
||||
orderDetailRepository.save(orderDetail);
|
||||
return ResultContainer.of(RESULT_ORDER_DETAIL).value(orderDetail);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface LegEventService {
|
|||
void syncLeg(LegSyncCommand command);
|
||||
|
||||
//下单事件
|
||||
void orderLeg(LegOrderedCommand command);
|
||||
ResultContainer orderLeg(LegOrderedCommand command);
|
||||
|
||||
ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command);
|
||||
|
||||
|
|
|
@ -39,15 +39,14 @@ public class LegEventServiceImpl implements LegEventService {
|
|||
//下单时间要求回传,需要付款的金额,以及生成对于的行程订单号,如果没有行程订单号根据地点和时间进行匹配
|
||||
@ListenTo(command = "LegOrderedCommand", order = 0)
|
||||
@Override
|
||||
public void orderLeg(LegOrderedCommand command) {
|
||||
legEventHandler.orderLeg(command);
|
||||
public ResultContainer orderLeg(LegOrderedCommand command) {
|
||||
return legEventHandler.orderLeg(command);
|
||||
}
|
||||
|
||||
@ListenTo(command = "RouteUpdateOrderCommand", order = 0)
|
||||
@Override
|
||||
public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) {
|
||||
legEventHandler.routeUpdateOrder(command);
|
||||
return null;
|
||||
return legEventHandler.routeUpdateOrder(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.chint.domain.service.order_search;
|
||||
|
||||
import com.chint.domain.service.supplier.OrderDataAdapterSelector;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||
|
||||
@Service
|
||||
public class CTripOrderSearchImpl implements OrderSearchRequest {
|
||||
@Autowired
|
||||
private CTripOrderSearchRequest cTripOrderSearchRequest;
|
||||
|
||||
@Override
|
||||
public SupplierCallbackData searchOrderDetail(String orderNo) {
|
||||
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo);
|
||||
return SupplierCallbackData.of(SUPPLIER_C_TRIP).data(response);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.chint.domain.service.order_search;
|
||||
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LYOrderSearchImpl implements OrderSearchRequest{
|
||||
@Override
|
||||
public SupplierCallbackData searchOrderDetail(String orderNo) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.chint.domain.service.order_search;
|
||||
|
||||
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
|
||||
public interface OrderSearchRequest {
|
||||
SupplierCallbackData searchOrderDetail(String orderNo);
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.chint.domain.service.order_search;
|
||||
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.service.supplier.CTripOrderDataAdapter;
|
||||
import com.chint.domain.service.supplier.LYOrderDataAdapter;
|
||||
import com.chint.domain.service.supplier.OrderDataAdapter;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.SupplierNameConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OrderSearchSelector {
|
||||
@Autowired
|
||||
private CTripOrderSearchImpl cTripOrderSearch;
|
||||
|
||||
@Autowired
|
||||
private LYOrderSearchImpl lyOrderSearch;
|
||||
|
||||
public OrderSearchRequest of(String supplierName) {
|
||||
// 当找不到匹配的适配器时,抛出一个异常
|
||||
return switch (supplierName) {
|
||||
case SupplierNameConstant.SUPPLIER_C_TRIP -> cTripOrderSearch;
|
||||
case SupplierNameConstant.SUPPLIER_L_Y -> lyOrderSearch;
|
||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
};
|
||||
}
|
||||
}
|
|
@ -55,6 +55,7 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
|
|||
Location byName = locationRepository.findByName(hotelOrderInfoEntity.getCityName()).get(0);
|
||||
|
||||
return builder.productType(LegConstant.LEG_TYPE_HOTEL)
|
||||
.hotelOrderDetailData(hotelOrderInfoEntity)
|
||||
.currencyCode(hotelOrderInfoEntity.getCurrency())
|
||||
.orderTime(hotelOrderInfoEntity.getOrderDate())
|
||||
.startTime(hotelOrderInfoEntity.getStartTime())
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.chint.domain.service.supplier;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
|
||||
public interface SupplierService {
|
||||
void handleSupplierCallback(SupplierCallbackData callbackData);
|
||||
OrderDetail handleSupplierCallback(SupplierCallbackData callbackData);
|
||||
}
|
|
@ -2,9 +2,11 @@ package com.chint.domain.service.supplier;
|
|||
|
||||
import com.chint.application.commands.RouteUpdateOrderCommand;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
|
||||
import com.chint.domain.factoriy.order_detail.OrderExtensionFactory;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
|
@ -13,6 +15,9 @@ import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
|
||||
|
||||
@Service
|
||||
|
@ -28,45 +33,43 @@ public class SupplierServiceImpl implements SupplierService {
|
|||
private OrderDetailRepository orderDetailRepository;
|
||||
|
||||
@Override
|
||||
public void handleSupplierCallback(SupplierCallbackData callbackData) {
|
||||
public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) {
|
||||
String supplierName = callbackData.getSupplierName();
|
||||
orderDataAdapterSelector
|
||||
.of(supplierName)
|
||||
.adapt(callbackData)
|
||||
.ifPresent(data -> {
|
||||
|
||||
System.out.println(data);
|
||||
//获取使用RouteUpdateOrderCommand命令创建的orderDetail
|
||||
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(data).sendToQueue();
|
||||
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
|
||||
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();
|
||||
Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData);
|
||||
if (data.isPresent()) {
|
||||
//获取使用RouteUpdateOrderCommand命令创建的orderDetail
|
||||
OrderLegData orderLegData = data.get();
|
||||
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(orderLegData).sendToQueue();
|
||||
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
|
||||
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();
|
||||
|
||||
Integer productType = data.getProductType();
|
||||
OrderExtensionFactory orderExtensionFactory = orderExtensionCreator
|
||||
.of(supplierName);
|
||||
Object callbackDataData = callbackData.getData();
|
||||
Integer productType = orderLegData.getProductType();
|
||||
OrderExtensionFactory orderExtensionFactory = orderExtensionCreator
|
||||
.of(supplierName);
|
||||
|
||||
//根据产品的不同类型添加不同的扩展字段
|
||||
switch (productType) {
|
||||
case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData(
|
||||
orderExtensionFactory.createTrainOrderDetail(callbackDataData)
|
||||
);
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData(
|
||||
orderExtensionFactory.createFlightOrderDetail(callbackDataData)
|
||||
);
|
||||
case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData(
|
||||
orderExtensionFactory.createHotelOrderDetail(callbackDataData)
|
||||
);
|
||||
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
|
||||
orderExtensionFactory.createCarOrderDetail(callbackDataData)
|
||||
);
|
||||
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
|
||||
orderExtensionFactory.createOtherOrderDetail(callbackDataData)
|
||||
);
|
||||
}
|
||||
|
||||
//对orderDetail进行保存
|
||||
orderDetailRepository.save(orderDetail);
|
||||
});
|
||||
//根据产品的不同类型添加不同的扩展字段
|
||||
switch (productType) {
|
||||
case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData(
|
||||
orderExtensionFactory.createTrainOrderDetail(orderLegData.getTrainOrderDetailData())
|
||||
);
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData(
|
||||
orderExtensionFactory.createFlightOrderDetail(orderLegData.getFlightOrderDetailData())
|
||||
);
|
||||
case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData(
|
||||
orderExtensionFactory.createHotelOrderDetail(orderLegData.getHotelOrderDetailData())
|
||||
);
|
||||
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
|
||||
orderExtensionFactory.createCarOrderDetail(orderLegData.getCarOrderDetailData())
|
||||
);
|
||||
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
|
||||
orderExtensionFactory.createOtherOrderDetail(orderLegData.getOtherOrderDetailData())
|
||||
);
|
||||
}
|
||||
//对orderDetail进行保存
|
||||
return orderDetailRepository.save(orderDetail);
|
||||
} else {
|
||||
throw new NotFoundException(NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
package com.chint.domain.value_object;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApproveLegData {
|
||||
@ApiModelProperty("实际财务共享订单号")
|
||||
private String actualOrderNo;
|
||||
@ApiModelProperty("临时财务共享订单号")
|
||||
private String fakeOrderNo;
|
||||
@ApiModelProperty("入账公司")
|
||||
private String accountCompany;
|
||||
@ApiModelProperty("系统标识")
|
||||
private String sysCode;
|
||||
@ApiModelProperty("出差说明")
|
||||
private String instructions;
|
||||
@ApiModelProperty("财务共享订单创建人")
|
||||
private String creator;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ public class OrderLegData {
|
|||
this.destinationId = builder.destinationId;
|
||||
this.originOrderStatus = builder.originOrderStatus;
|
||||
this.currencyCode = builder.currencyCode;
|
||||
this.carOrderDetailData = builder.carOrderDetailData;
|
||||
this.trainOrderDetailData = builder.trainOrderDetailData;
|
||||
this.hotelOrderDetailData = builder.hotelOrderDetailData;
|
||||
this.flightOrderDetailData = builder.flightOrderDetailData;
|
||||
this.otherOrderDetailData = builder.otherOrderDetailData;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
|
@ -71,10 +76,36 @@ public class OrderLegData {
|
|||
private Long destinationId;
|
||||
|
||||
private String currencyCode;
|
||||
private Object carOrderDetailData;
|
||||
private Object trainOrderDetailData;
|
||||
private Object hotelOrderDetailData;
|
||||
private Object flightOrderDetailData;
|
||||
private Object otherOrderDetailData;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder carOrderDetailData(Object carOrderDetailData) {
|
||||
this.carOrderDetailData = carOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
public Builder trainOrderDetailData(Object trainOrderDetailData) {
|
||||
this.trainOrderDetailData = trainOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
public Builder hotelOrderDetailData(Object hotelOrderDetailData) {
|
||||
this.hotelOrderDetailData = hotelOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
public Builder flightOrderDetailData(Object flightOrderDetailData) {
|
||||
this.flightOrderDetailData = flightOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
public Builder otherOrderDetailData(Object otherOrderDetailData) {
|
||||
this.otherOrderDetailData = otherOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder currencyCode(String currencyCode) {
|
||||
this.currencyCode = currencyCode;
|
||||
return this;
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.chint.infrastructure.constant;
|
|||
|
||||
public class BPMConstant {
|
||||
//BPM
|
||||
public static final String EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
|
||||
public static final String H3BPM = "H3BPM";
|
||||
public static final String H3BPM_EXCEED_STANDARD_URL = "/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";
|
||||
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
|
||||
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
|
||||
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称
|
||||
|
|
|
@ -8,4 +8,6 @@ public class DataMessageConstant {
|
|||
public static final String DATA_DELETION_SUCCESS = "数据删除成功";
|
||||
public static final String DATA_NOT_FOUND = "未找到数据";
|
||||
public static final String DATA_INVALID = "数据不合法";
|
||||
public static final String SYS_CODE_ERROR = "系统标识字段错误";
|
||||
public static final String ORDER_STATUS_ERROR = "订单状态错误";
|
||||
}
|
||||
|
|
|
@ -20,4 +20,12 @@ public class OrderConstant {
|
|||
public static final String ORDER_EVENT_ETA_NAME = "超标";
|
||||
public static final int ORDER_EVENT_UNKNOWN = -99;
|
||||
public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件";
|
||||
|
||||
|
||||
//这批字段用于
|
||||
public static final String ORDER_DETAIL_STATUS_SUCCESS = "1";
|
||||
public static final String ORDER_DETAIL_STATUS_HALF = "4";
|
||||
public static final String ORDER_EVENT_UNKNOWN_FAIL = "3";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,6 +51,10 @@ public class GlobalExceptionHandler {
|
|||
while (rootCause instanceof InvocationTargetException && cause != null) {
|
||||
rootCause = cause;
|
||||
}
|
||||
if(cause == null){
|
||||
rootCause.printStackTrace();
|
||||
return Result.error("未知错误");
|
||||
}
|
||||
Throwable causeCause = cause.getCause();
|
||||
causeCause.printStackTrace();
|
||||
return Result.error(causeCause.getMessage());
|
||||
|
|
|
@ -70,4 +70,10 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
public List<Location> findByName(String localName) {
|
||||
return jdbcLocationRepository.findByLocationNameContaining(localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String locationPathByName(String localName) {
|
||||
Location byLocationName = jdbcLocationRepository.findByLocationName(localName);
|
||||
return byLocationName.getLocationPathName().replace("_", "、");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,4 +36,9 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
|||
public OrderDetail save(OrderDetail orderDetail) {
|
||||
return orderDetailRepository.save(orderDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
orderDetailRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.system.SystemCode;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.SystemCodeRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcSystemCodeRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
|
||||
@Repository
|
||||
public class SystemCodeRepositoryImpl implements SystemCodeRepository {
|
||||
|
||||
@Autowired
|
||||
private JdbcSystemCodeRepository jdbcSystemCodeRepository;
|
||||
|
||||
@Override
|
||||
public SystemCode save(SystemCode systemCode) {
|
||||
return jdbcSystemCodeRepository.save(systemCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemCode findBySysCode(String sysCode) {
|
||||
return jdbcSystemCodeRepository.findBySystemCode(sysCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemCode findById(Long id) {
|
||||
return jdbcSystemCodeRepository.findById(id).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
}
|
||||
}
|
|
@ -30,4 +30,11 @@ public class TravelStandardsRepositoryImpl implements TravelStandardsRepository
|
|||
public List<TravelStandards> findByStandardLevel(String standardLevel) {
|
||||
return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TravelStandards> findByTravelStandards(TravelStandards travelStandards) {
|
||||
return jdbcTravelStandardsRepository.findByProductTypeAndStandardLevelAndCityTag(
|
||||
travelStandards.getProductType(), travelStandards.getStandardLevel(), travelStandards.getCityTag());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,5 +19,8 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
|||
Page<Location> findAllByLevel(Integer level, Pageable pageable);
|
||||
|
||||
List<Location> findByFirstPinYin(String firstPinYin);
|
||||
|
||||
List<Location> findByLocationNameContaining(String locationName);
|
||||
|
||||
Location findByLocationName(String locationName);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.system.SystemCode;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface JdbcSystemCodeRepository extends CrudRepository<SystemCode, Long> {
|
||||
|
||||
SystemCode findBySystemCode(String systemCode);
|
||||
}
|
|
@ -11,4 +11,5 @@ import java.util.List;
|
|||
public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> {
|
||||
|
||||
List<TravelStandards> findByStandardLevel(String standardLevel);
|
||||
List<TravelStandards> findByProductTypeAndStandardLevelAndCityTag(String productType,String standardLevel,String cityTag);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.interfaces.rest.base;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
|
@ -14,6 +15,7 @@ import org.springframework.stereotype.Component;
|
|||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PostRequest {
|
||||
private final Gson gson = new Gson();
|
||||
private final HttpClient client = HttpClients.createDefault();
|
||||
|
@ -21,7 +23,7 @@ public class PostRequest {
|
|||
public <T> T post(String url, Object jsonRequest, Class<T> responseType) {
|
||||
HttpPost post = new HttpPost(url);
|
||||
String json = gson.toJson(jsonRequest);
|
||||
System.out.println(json);
|
||||
log.info(json);
|
||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||
String responseBody = null;
|
||||
HttpEntity responseEntity = null;
|
||||
|
@ -40,7 +42,7 @@ public class PostRequest {
|
|||
HttpPost post = new HttpPost(url);
|
||||
post.addHeader(headName, headValue);
|
||||
String json = gson.toJson(jsonRequest);
|
||||
System.out.println(json);
|
||||
log.info(json);
|
||||
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
|
||||
String responseBody = null;
|
||||
HttpEntity responseEntity = null;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.chint.interfaces.rest.bpm;
|
||||
|
||||
import com.chint.domain.aggregates.standards.TravelStandards;
|
||||
import com.chint.domain.value_object.TravelStandardsData;
|
||||
import com.chint.infrastructure.constant.BPMConstant;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMBack;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3BPM;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/public/BPM")
|
||||
public class BPMController {
|
||||
//超标
|
||||
@ApiOperation("BPM超标审批结果回传")
|
||||
@PostMapping("/exceedStandard/back")
|
||||
public Result<TravelStandards> exceedStandardBack(@RequestBody BPMBack bpmBack) {
|
||||
//H3BPM平台
|
||||
if (H3BPM.equals(bpmBack.getTag())) {
|
||||
System.out.println("H3BPM");
|
||||
}
|
||||
System.out.println("bpmBack = " + bpmBack);
|
||||
return Result.Success(CommonMessageConstant.SUCCESS);
|
||||
}
|
||||
|
||||
//改签
|
||||
@ApiOperation("BPM改签审批结果回传")
|
||||
@PostMapping("/reschedule/back")
|
||||
public Result<TravelStandards> rescheduleBack(@RequestBody BPMBack bpmBack) {
|
||||
//获取订单号和审批结果
|
||||
|
||||
return Result.Success(CommonMessageConstant.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,8 @@ import com.chint.domain.exceptions.NotFoundException;
|
|||
import com.chint.infrastructure.constant.BPMConstant;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.SupplierNameConstant;
|
||||
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
|
@ -3,15 +3,17 @@ package com.chint.interfaces.rest.bpm;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
|
||||
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.bpm.dot.RescheduleDto;
|
||||
import com.chint.interfaces.rest.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.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.EXCEED_STANDARD_URL;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
|
||||
|
||||
|
||||
@Service
|
||||
|
@ -20,6 +22,9 @@ public class BPMRequest {
|
|||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
@Value("${bpm.H3BPMUrl}")
|
||||
private String H3BPMUrl;
|
||||
|
||||
//超标申请
|
||||
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
|
||||
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
|
||||
|
@ -40,8 +45,8 @@ public class BPMRequest {
|
|||
.setUserCode(String.valueOf(user.getEmployeeNo()))//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(EXCEED_STANDARD_URL, bpmRequest, BPMResponse.class);
|
||||
System.out.println("response = " + response);
|
||||
return response;
|
||||
BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
|
||||
System.out.println("response = " + bpmBaseResponse);
|
||||
return bpmBaseResponse.getD();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BPMBack {
|
||||
private String tag;//BPM平台:H3BPM/其它
|
||||
private String orderNo;//订单号
|
||||
private String result;//审批结果:通过/拒绝
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
|
||||
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BPMBaseResponse {
|
||||
private BPMResponse d;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
package com.chint.interfaces.rest.bpm.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
|
@ -1,4 +1,4 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
package com.chint.interfaces.rest.bpm.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
package com.chint.interfaces.rest.bpm.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package com.chint.interfaces.rest.bpm.dot;
|
||||
package com.chint.interfaces.rest.bpm.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
|
@ -87,7 +87,7 @@ public class CTripEstimateRequest {
|
|||
.valuationBaseInfo()
|
||||
.eID(user.getEmployeeNo().toString())
|
||||
.corpID(C_TRIP_CORP_ID)
|
||||
// .rankName(user.getRankCode())
|
||||
.rankName(user.getStandardLevel())
|
||||
.done()
|
||||
.valuationProductInfo()
|
||||
.addFlightProductInfo(flightProductInfo)
|
||||
|
|
|
@ -95,10 +95,10 @@ public class BookingRelatedApiRequestBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
// public ValuationBaseInfoBuilder rankName(String rankName) {
|
||||
// baseInfo.setRankName(rankName);
|
||||
// return this;
|
||||
// }
|
||||
public ValuationBaseInfoBuilder rankName(String rankName) {
|
||||
baseInfo.setRankName(rankName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValuateBudgetRequestTypeBuilder done() {
|
||||
requestContent.setValuationBaseInfo(baseInfo);
|
||||
|
|
|
@ -10,7 +10,7 @@ public class ValuationBaseInfo {
|
|||
// 员工ID
|
||||
private String eID;
|
||||
// 职级名称
|
||||
// private String rankName;
|
||||
private String rankName;
|
||||
|
||||
// Getters and setters...
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.chint.interfaces.rest.ctrip.in;
|
||||
|
||||
import com.chint.application.commands.OrderStatusChangeCommand;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.constant.OrderConstant;
|
||||
|
@ -13,6 +14,7 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse;
|
|||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -52,6 +54,7 @@ public class CTripNoteController {
|
|||
// return new CTripNoteResponse("1", "未收到消息");
|
||||
// }
|
||||
|
||||
@Transactional
|
||||
@PostMapping("/status")
|
||||
public CTripStatusResponse statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
|
||||
String productType = cTripStatusNotification.getProductType();
|
||||
|
@ -62,45 +65,51 @@ public class CTripNoteController {
|
|||
return new CTripStatusResponse("1", "sign错误");
|
||||
}
|
||||
if (orderStatus != null && orderId != null) {
|
||||
SupplierCallbackData supplierCallbackData =
|
||||
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP);
|
||||
SearchOrderResponse response = cTripOrderSearchRequest
|
||||
.searchOrderResponseByOrderId(orderId);
|
||||
supplierCallbackData.data(response);
|
||||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderNo(orderId)
|
||||
.outStatus(orderStatus);
|
||||
switch (productType) {
|
||||
case "FlightInternational":
|
||||
case "FlightDomestic":
|
||||
command.eventType(mapFlightStatus(orderStatus));
|
||||
break;
|
||||
case "HotelMember":
|
||||
case "HotelContract":
|
||||
command.eventType(mapHotelStatus(orderStatus));
|
||||
break;
|
||||
case "Train":
|
||||
case "OverseaTrain":
|
||||
command.eventType(mapTrainStatus(orderStatus));
|
||||
break;
|
||||
case "CarPickUpInternational":
|
||||
case "CarRentalDomestic":
|
||||
case "CarImmediately":
|
||||
case "CarPickUpDomesticNew":
|
||||
case "CarCharterDomestic":
|
||||
case "BusTicket":
|
||||
command.eventType(mapCarStatus(orderStatus));
|
||||
break;
|
||||
}
|
||||
command.sendToQueue();
|
||||
return new CTripStatusResponse("0", "成功收到消息");
|
||||
return handlerData(orderId, orderStatus, productType);
|
||||
}
|
||||
return new CTripStatusResponse("1", "未收到消息");
|
||||
}
|
||||
|
||||
|
||||
public CTripStatusResponse handlerData(String orderId, String orderStatus, String productType) {
|
||||
SupplierCallbackData supplierCallbackData =
|
||||
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP);
|
||||
SearchOrderResponse response = cTripOrderSearchRequest
|
||||
.searchOrderResponseByOrderId(orderId);
|
||||
supplierCallbackData.data(response);
|
||||
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
|
||||
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
|
||||
.orderDetail(orderDetail)
|
||||
.orderNo(orderId)
|
||||
.outStatus(orderStatus);
|
||||
switch (productType) {
|
||||
case "FlightInternational":
|
||||
case "FlightDomestic":
|
||||
command.eventType(mapFlightStatus(orderStatus));
|
||||
break;
|
||||
case "HotelMember":
|
||||
case "HotelContract":
|
||||
command.eventType(mapHotelStatus(orderStatus));
|
||||
break;
|
||||
case "Train":
|
||||
case "OverseaTrain":
|
||||
command.eventType(mapTrainStatus(orderStatus));
|
||||
break;
|
||||
case "CarPickUpInternational":
|
||||
case "CarRentalDomestic":
|
||||
case "CarImmediately":
|
||||
case "CarPickUpDomesticNew":
|
||||
case "CarCharterDomestic":
|
||||
case "BusTicket":
|
||||
command.eventType(mapCarStatus(orderStatus));
|
||||
break;
|
||||
}
|
||||
command.sendToQueue();
|
||||
return new CTripStatusResponse("0", "成功收到消息");
|
||||
}
|
||||
|
||||
|
||||
public Integer mapFlightStatus(String status) {
|
||||
return switch (status) {
|
||||
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备下单
|
||||
|
|
|
@ -4,14 +4,20 @@ import com.chint.domain.aggregates.user.User;
|
|||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ly.dto.user.EmployeeRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.user.EmployeeEntity;
|
||||
import com.chint.interfaces.rest.ly.dto.user.PreTravelPolicy;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.chint.interfaces.rest.ly.dto.user.UserResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.LYConstant.L_Y_BASE_URL;
|
||||
import static com.chint.infrastructure.constant.LYConstant.L_Y_USER_PATH;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LYUserRequest {
|
||||
|
||||
|
@ -27,7 +33,7 @@ public class LYUserRequest {
|
|||
private final String userUrl = L_Y_BASE_URL + L_Y_USER_PATH;
|
||||
|
||||
public boolean saveCurrentUser() {
|
||||
System.out.println("saveCurrentUser");
|
||||
log.info("saveCurrentUser");
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
userHttpRequest.loadUserInfo(currentUser);
|
||||
EmployeeEntity employeeEntity = user2LYEmployee(currentUser);
|
||||
|
@ -66,7 +72,17 @@ public class LYUserRequest {
|
|||
employeeEntity.setGender(translateGender(user.getGender()));
|
||||
employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus()));
|
||||
employeeEntity.setReservationType(0);
|
||||
employeeEntity.setPositionLevelName(user.getStandardLevel());
|
||||
String standardLevel = user.getStandardLevel();
|
||||
employeeEntity.setPositionLevelName(standardLevel);
|
||||
List<PreTravelPolicy> preTravelPolicyList = List.of(
|
||||
new PreTravelPolicy(standardLevel,1),
|
||||
new PreTravelPolicy(standardLevel,2),
|
||||
new PreTravelPolicy(standardLevel,3),
|
||||
new PreTravelPolicy(standardLevel,4),
|
||||
new PreTravelPolicy(standardLevel,5),
|
||||
new PreTravelPolicy(standardLevel,6)
|
||||
);
|
||||
employeeEntity.setPreTravelPolicyList(preTravelPolicyList);
|
||||
return employeeEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ public class EmployeeEntity {
|
|||
private Map<String, String> remarks;
|
||||
private String baseCity;
|
||||
|
||||
// Getters and setters
|
||||
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
package com.chint.interfaces.rest.ly.dto.user;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class PreTravelPolicy {
|
||||
private String policyCode;
|
||||
private int productTypeId;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.chint.interfaces.rest.user;
|
||||
|
||||
|
||||
//import com.chint.dc.api.DataCenterResult;
|
||||
//import com.chint.dc.api.dto.DataCenterOption;
|
||||
//import com.chint.dc.api.service.DataCenterService;
|
||||
import com.chint.dc.api.DataCenterResult;
|
||||
import com.chint.dc.api.dto.DataCenterOption;
|
||||
import com.chint.dc.api.service.DataCenterService;
|
||||
|
||||
import com.chint.domain.aggregates.standards.Ranks;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
|
@ -14,6 +14,8 @@ import com.chint.infrastructure.util.StringCheck;
|
|||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
import com.chint.interfaces.rest.user.dto.*;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
|
@ -21,15 +23,23 @@ import org.apache.http.util.EntityUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_THREE;
|
||||
import static com.chint.infrastructure.constant.SFConstant.OPENAI_BASE_URL;
|
||||
import static com.chint.infrastructure.constant.SFConstant.USER_DATA_PATH;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserHttpRequestImpl implements UserHttpRequest {
|
||||
|
||||
|
||||
private final String asSkUrl = SFConstant.AK_BASE_URL + SFConstant.GET_AK_URL + "?systemId=" + SFConstant.SYSTEM_ID;
|
||||
private final String userUrl = SFConstant.OPENAI_BASE_URL + SFConstant.USER_DATA_PATH;
|
||||
private final String userUrl = OPENAI_BASE_URL + USER_DATA_PATH;
|
||||
private final String travelRankUrl = SFConstant.TRAVEL_RANK_BASE_URL + SFConstant.TRAVEL_RANK_PATH;
|
||||
|
||||
@Autowired
|
||||
|
@ -53,6 +63,8 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
|||
if (ranks != null) {
|
||||
user.setStandardLevel(ranks.getStandardLevel());
|
||||
// user.setStandardLevel("测试职级");
|
||||
} else {
|
||||
user.setStandardLevel(STANDARD_LEVEL_THREE);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
@ -72,73 +84,74 @@ public class UserHttpRequestImpl implements UserHttpRequest {
|
|||
}
|
||||
|
||||
private User loadSFInfo(User user) {
|
||||
// Gson gson = new Gson();
|
||||
// AccessKeyDTO akSkLoad = akSkLoad();
|
||||
// DataCenterOption option = new DataCenterOption();
|
||||
// option.setSk(akSkLoad.sk);
|
||||
// option.setAk(akSkLoad.ak);
|
||||
// option.setUrl(OPENAI_BASE_URL);
|
||||
// DataCenterService dataCenterService = new DataCenterService(option);
|
||||
// LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
// map.put("LoginUsername", user.getEmployeeNo().toString());
|
||||
// map.put("start", 0);
|
||||
// map.put("pageSize", 99);
|
||||
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
// Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
// }.getType();
|
||||
// if (result.getData() != null) {
|
||||
// String companyCode = user.getCompanyCode();
|
||||
// if (companyCode == null) {
|
||||
// companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
|
||||
// }
|
||||
// String newCompanyCode = companyCode;
|
||||
//
|
||||
// if (fromJson.size() == 1) {
|
||||
// UserDataDTO userData = fromJson.get(0);
|
||||
// user.setCompanyCode(userData.getCompany());
|
||||
// user.setWorkStatus(userData.getStatus());
|
||||
// user.setGender(userData.getGender());
|
||||
// user.setName(userData.getUname());
|
||||
// user.setPhoneNumber(userData.getMobilePhone());
|
||||
// user.setManaLevel(userData.getCust_manaLevel());
|
||||
// user.setProfLevel(userData.getCust_profLevel());
|
||||
// } else {
|
||||
// Optional<UserDataDTO> first;
|
||||
//
|
||||
// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
|
||||
// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
|
||||
// first = fromJson.stream()
|
||||
// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
|
||||
// .findFirst();
|
||||
//
|
||||
// } else {
|
||||
// first = fromJson.stream()
|
||||
// .filter(userData -> userData.getCompany().equals(newCompanyCode))
|
||||
// .findFirst();
|
||||
// }
|
||||
// first.ifPresent(
|
||||
// userData -> {
|
||||
// user.setCompanyCode(userData.getCompany());
|
||||
// user.setWorkStatus(userData.getStatus());
|
||||
// user.setGender(userData.getGender());
|
||||
// user.setName(userData.getUname());
|
||||
// user.setPhoneNumber(userData.getMobilePhone());
|
||||
// }
|
||||
// );
|
||||
// fromJson.stream()
|
||||
// .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
|
||||
// .findFirst()
|
||||
// .ifPresent(userData -> {
|
||||
// user.setManaLevel(userData.getCust_manaLevel());
|
||||
// user.setProfLevel(userData.getCust_profLevel());
|
||||
// });
|
||||
// }
|
||||
// return user;
|
||||
// } else {
|
||||
// throw new RuntimeException("用户数据不存在");
|
||||
// }
|
||||
Gson gson = new Gson();
|
||||
AccessKeyDTO akSkLoad = akSkLoad();
|
||||
DataCenterOption option = new DataCenterOption();
|
||||
option.setSk(akSkLoad.sk);
|
||||
option.setAk(akSkLoad.ak);
|
||||
option.setUrl(OPENAI_BASE_URL);
|
||||
DataCenterService dataCenterService = new DataCenterService(option);
|
||||
LinkedHashMap map = new LinkedHashMap<String, Object>();
|
||||
map.put("LoginUsername", user.getEmployeeNo().toString());
|
||||
map.put("start", 0);
|
||||
map.put("pageSize", 99);
|
||||
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
|
||||
Type type = new TypeToken<List<UserDataDTO>>() {
|
||||
}.getType();
|
||||
if (result.getData() != null) {
|
||||
String companyCode = user.getCompanyCode();
|
||||
if (companyCode == null) {
|
||||
companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
|
||||
}
|
||||
String newCompanyCode = companyCode;
|
||||
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
|
||||
if (fromJson.size() == 1) {
|
||||
UserDataDTO userData = fromJson.get(0);
|
||||
user.setCompanyCode(userData.getCompany());
|
||||
user.setCompanyName(userData.getCompany_cn());
|
||||
user.setWorkStatus(userData.getStatus());
|
||||
user.setGender(userData.getGender());
|
||||
user.setName(userData.getUname());
|
||||
user.setPhoneNumber(userData.getMobilePhone());
|
||||
user.setManaLevel(userData.getCust_manaLevel());
|
||||
user.setProfLevel(userData.getCust_profLevel());
|
||||
} else {
|
||||
Optional<UserDataDTO> first;
|
||||
//这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
|
||||
if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
|
||||
first = fromJson.stream()
|
||||
.filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
|
||||
.findFirst();
|
||||
|
||||
return null;
|
||||
} else {
|
||||
first = fromJson.stream()
|
||||
.filter(userData -> userData.getCompany().equals(newCompanyCode))
|
||||
.findFirst();
|
||||
}
|
||||
first.ifPresent(
|
||||
userData -> {
|
||||
user.setCompanyCode(userData.getCompany());
|
||||
user.setWorkStatus(userData.getStatus());
|
||||
user.setGender(userData.getGender());
|
||||
user.setName(userData.getUname());
|
||||
user.setPhoneNumber(userData.getMobilePhone());
|
||||
user.setCompanyName(userData.getCompany_cn());
|
||||
}
|
||||
);
|
||||
fromJson.stream()
|
||||
.filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
|
||||
.findFirst()
|
||||
.ifPresent(userData -> {
|
||||
user.setManaLevel(userData.getCust_manaLevel());
|
||||
user.setProfLevel(userData.getCust_profLevel());
|
||||
});
|
||||
}
|
||||
return user;
|
||||
} else {
|
||||
throw new RuntimeException("用户数据不存在");
|
||||
}
|
||||
|
||||
// return null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,3 +24,6 @@ cTrip:
|
|||
appKey: obk_zhengtai2024
|
||||
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
|
||||
requestSecret: zhengtai2024_nEbmKfOo
|
||||
|
||||
bpm:
|
||||
H3BPMUrl: http://10.207.0.245:8012
|
|
@ -1,32 +1,33 @@
|
|||
server:
|
||||
port: 8081
|
||||
|
||||
chint:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
|
||||
# host: 10.9.56.48
|
||||
port: 3306
|
||||
database: itinerary_booking
|
||||
username: echo
|
||||
password: R3nd0mP@ssw0rd!
|
||||
url: https://gxdev03.chint.com/businesstravel/
|
||||
|
||||
#chint:
|
||||
# datasource:
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# host: 10.10.24.44
|
||||
# host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
|
||||
# # host: 10.9.56.48
|
||||
# port: 6603
|
||||
# port: 3306
|
||||
# database: itinerary_booking
|
||||
# username: tripbook
|
||||
# password: W@Xgf25d&lRk*L0X#
|
||||
# username: echo
|
||||
# password: R3nd0mP@ssw0rd!
|
||||
# url: https://gxdev03.chint.com/businesstravel/
|
||||
|
||||
chint:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
host: 10.10.24.44
|
||||
# host: 10.9.56.48
|
||||
port: 6603
|
||||
database: itinerary_booking
|
||||
username: tripbook
|
||||
password: W@Xgf25d&lRk*L0X#
|
||||
url: https://gxdev03.chint.com/businesstravel/
|
||||
|
||||
logging:
|
||||
level:
|
||||
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
||||
org.springframework.jdbc.core.StatementCreatorUtils: TRACE
|
||||
root: info
|
||||
|
||||
|
||||
cTrip:
|
||||
|
@ -36,4 +37,7 @@ cTrip:
|
|||
corpId: zhengtai2024
|
||||
appKey: obk_zhengtai2024
|
||||
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
|
||||
requestSecret: zhengtai2024_nEbmKfOo
|
||||
requestSecret: zhengtai2024_nEbmKfOo
|
||||
|
||||
bpm:
|
||||
H3BPMUrl: http://10.207.0.245:8012
|
|
@ -16,6 +16,7 @@ import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
|
|||
import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam;
|
||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
|
||||
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -50,6 +51,9 @@ public class CTripTest {
|
|||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Autowired
|
||||
private CTripNoteController cTripNoteController;
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
|
||||
//@Test
|
||||
|
@ -149,7 +153,7 @@ public class CTripTest {
|
|||
System.out.println(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
void searchAndHandlerData(){
|
||||
BaseContext.setCurrentUser(user);
|
||||
SupplierCallbackData supplierCallbackData =
|
||||
|
@ -158,4 +162,10 @@ public class CTripTest {
|
|||
supplierCallbackData.data(response);
|
||||
supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
}
|
||||
|
||||
// @Test
|
||||
void backData(){
|
||||
BaseContext.setCurrentUser(user);
|
||||
cTripNoteController.handlerData("30607415392","Paid","HotelContract");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,21 +4,23 @@ import com.chint.domain.aggregates.user.User;
|
|||
import com.chint.infrastructure.constant.LYConstant;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.base.PostRequest;
|
||||
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.ly.LYLoginRequest;
|
||||
import com.chint.interfaces.rest.ly.LYPostRequest;
|
||||
import com.chint.interfaces.rest.ly.LYTokenRequest;
|
||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
|
||||
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||
import com.chint.interfaces.rest.bpm.dot.RescheduleDto;
|
||||
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
|
||||
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
|
||||
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
|
||||
import com.google.gson.Gson;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -27,6 +29,9 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
|
||||
|
||||
@SpringBootTest
|
||||
public class LYTest {
|
||||
|
||||
|
@ -46,6 +51,9 @@ public class LYTest {
|
|||
@Autowired
|
||||
private PostRequest httpPostRequest;
|
||||
|
||||
@Value("${bpm.H3BPMUrl}")
|
||||
private String H3BPMUrl;
|
||||
|
||||
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
|
||||
|
||||
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync";
|
||||
|
@ -65,8 +73,7 @@ public class LYTest {
|
|||
private final String minPriceUrl = L_Y_BASE_URL + L_Y_HOTLE_MIN_PRICE_PATH;
|
||||
private final String hotleListUrl = L_Y_BASE_URL + L_Y_HOTLE_LIST_PATH;
|
||||
|
||||
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||
|
||||
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";
|
||||
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
|
||||
|
@ -283,13 +290,13 @@ public class LYTest {
|
|||
// @Test
|
||||
void loginLY() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.login(LYConstant.L_Y_ENTRANCE_HOME,null));
|
||||
System.out.println(loginRequest.login(LYConstant.L_Y_ENTRANCE_HOME, null));
|
||||
}
|
||||
|
||||
// @Test
|
||||
void loginLYPC() {
|
||||
BaseContext.setCurrentUser(user);
|
||||
System.out.println(loginRequest.loginPC(LYConstant.L_Y_ENTRANCE_HOME,null));
|
||||
System.out.println(loginRequest.loginPC(LYConstant.L_Y_ENTRANCE_HOME, null));
|
||||
}
|
||||
|
||||
//超标
|
||||
|
@ -300,20 +307,22 @@ public class LYTest {
|
|||
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||
exceedStandardDto.setOrderType("酒店超标")//内容选项:酒店超标,火车票超标,机票超标
|
||||
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
|
||||
.setOrderNo("00002")//订单号
|
||||
.setOrderNo("001021214")//订单号
|
||||
.setHotelStandard("标间")//酒店超标提供:住宿标准
|
||||
.setHotelName("酒店名称")//酒店超标提供:酒店名称
|
||||
.setHouseLayout("双人床")//酒店超标提供:房型
|
||||
.setSeatingStandard("")//火车票超标提供:席别标准
|
||||
.setCabinClass("")//:机票超标提供:舱等
|
||||
.setExcessAmount(BigDecimal.valueOf(100))//超标金额
|
||||
.setExcessAmount(BigDecimal.valueOf(1000))//超标金额
|
||||
.setReason("酒店爆满订不到");//超标原因
|
||||
String entityParamValues = gson.toJson(exceedStandardDto);
|
||||
bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码
|
||||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -339,7 +348,9 @@ public class LYTest {
|
|||
.setUserCode("231116011")//sf号
|
||||
.setFinishStart(true)//true:会自动流转到下一审批点,false:停在手工填写节点
|
||||
.setEntityParamValues(entityParamValues);
|
||||
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@ import cn.hutool.extra.pinyin.PinyinUtil;
|
|||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -16,6 +18,7 @@ import java.time.LocalDateTime;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@SpringBootTest
|
||||
class RouteApplicationTests {
|
||||
|
||||
|
@ -28,6 +31,8 @@ class RouteApplicationTests {
|
|||
@Autowired
|
||||
private RouteRepository routeRepository;
|
||||
|
||||
@Autowired
|
||||
private OrderDetailRepository orderDetailRepository;
|
||||
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
|
||||
|
||||
|
||||
|
@ -43,16 +48,20 @@ class RouteApplicationTests {
|
|||
LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter);
|
||||
System.out.println(parse);
|
||||
}
|
||||
@Test
|
||||
// @Test
|
||||
void loginSign() {
|
||||
String sfno = "230615020";
|
||||
String syscode = "abc";
|
||||
String billcode = "CCC12321412323";
|
||||
String companycode = "A30000001";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240225000099";
|
||||
String companycode = "正泰集团股份有限公司";
|
||||
String sec = "Superdandan";
|
||||
String timespan = "12312321412312";
|
||||
String timespan = "1708908662738";
|
||||
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
|
||||
System.out.println(s);
|
||||
// log.info("info");
|
||||
// log.trace("trace");
|
||||
// log.trace("trace");
|
||||
// log.trace("trace");
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
@ -92,4 +101,16 @@ class RouteApplicationTests {
|
|||
routeRepository.deleteById(19L);
|
||||
routeRepository.deleteById(19L);
|
||||
}
|
||||
// @Test
|
||||
void deleteOrderDetail(){
|
||||
orderDetailRepository.deleteById(15L);
|
||||
orderDetailRepository.deleteById(18L);
|
||||
orderDetailRepository.deleteById(19L);
|
||||
orderDetailRepository.deleteById(20L);
|
||||
orderDetailRepository.deleteById(23L);
|
||||
orderDetailRepository.deleteById(26L);
|
||||
orderDetailRepository.deleteById(28L);
|
||||
orderDetailRepository.deleteById(31L);
|
||||
orderDetailRepository.deleteById(33L);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue