Compare commits

...

9 Commits

Author SHA1 Message Date
lulz1 5b8a9a3ac2 同步代码 2024-02-26 19:20:08 +08:00
lulz1 25c65d0986 Merge remote-tracking branch 'origin/dev' into dev 2024-02-26 17:45:15 +08:00
lulz1 b99c0e945e 同步代码 2024-02-26 17:42:20 +08:00
lulz1 bb302bfb7a 同步代码 2024-02-26 17:41:36 +08:00
dengwc e4ffad832c BPM超标回推接口发起测试 2024-02-26 15:00:44 +08:00
dengwc 984b584dc6 BPM超标、改签流程发起测试 2024-02-26 10:21:15 +08:00
dengwc 37ab01578c BPM超标、改签流程发起测试 2024-02-26 10:19:51 +08:00
lulz1 c4885c2aa8 同步代码 2024-02-26 09:12:26 +08:00
lulz1 93a001ce6a 修复误删代码 2024-02-25 22:17:17 +08:00
70 changed files with 888 additions and 257 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;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -11,6 +12,7 @@ public class OrderStatusChangeCommand extends Command {
private String orderNo; private String orderNo;
private String outStatus; private String outStatus;
private Integer orderEventType; private Integer orderEventType;
private OrderDetail orderDetail;
public OrderStatusChangeCommand eventType(Integer eventType) { public OrderStatusChangeCommand eventType(Integer eventType) {
this.orderEventType = eventType; this.orderEventType = eventType;
@ -26,4 +28,9 @@ public class OrderStatusChangeCommand extends Command {
this.outStatus = outStatus; this.outStatus = outStatus;
return this; return this;
} }
public OrderStatusChangeCommand orderDetail(OrderDetail orderDetail) {
this.orderDetail = orderDetail;
return this;
}
} }

View File

@ -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;
}

View File

@ -62,7 +62,7 @@ public class ScheduleDetail {
protected String ParentScheduleNum; protected String ParentScheduleNum;
@JsonProperty("ExtendedField") @JsonProperty("ExtendedField")
protected String ExtendedField; protected ExtendedFieldParam ExtendedField;
@JsonProperty("QuoteGroupNum") @JsonProperty("QuoteGroupNum")
protected String QuoteGroupNum; protected String QuoteGroupNum;
@ -114,6 +114,8 @@ public class ScheduleDetail {
@JsonProperty("RealScheduleNum") @JsonProperty("RealScheduleNum")
protected String RealScheduleNum; protected String RealScheduleNum;
// Constructor, getters and setters // Constructor, getters and setters
public static ScheduleDetailBuilder builder(){ public static ScheduleDetailBuilder builder(){
@ -213,10 +215,10 @@ public class ScheduleDetail {
return this; return this;
} }
public ScheduleDetailBuilder extendedField(String extendedField) { // public ScheduleDetailBuilder extendedField(String extendedField) {
scheduleDetail.setExtendedField(extendedField); // scheduleDetail.setExtendedField(extendedField);
return this; // return this;
} // }
public ScheduleDetailBuilder quoteGroupNum(String quoteGroupNum) { public ScheduleDetailBuilder quoteGroupNum(String quoteGroupNum) {
scheduleDetail.setQuoteGroupNum(quoteGroupNum); scheduleDetail.setQuoteGroupNum(quoteGroupNum);
@ -312,6 +314,9 @@ public class ScheduleDetail {
} }
public ScheduleDetail build() { public ScheduleDetail build() {
ExtendedFieldParam extendedFieldParam = new ExtendedFieldParam();
extendedFieldParam.setExceed(false);
scheduleDetail.setExtendedField(extendedFieldParam);
return scheduleDetail; return scheduleDetail;
} }
} }

View File

@ -5,6 +5,7 @@ import com.chint.application.dtos.DeleteLegData;
import com.chint.application.queryies.OrderQuery; import com.chint.application.queryies.OrderQuery;
import com.chint.application.services.OrderApplicationService; import com.chint.application.services.OrderApplicationService;
import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.service.OrderDetailDomainService;
import com.chint.domain.value_object.*; import com.chint.domain.value_object.*;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -24,6 +25,9 @@ public class OrderController {
@Autowired @Autowired
private OrderApplicationService orderApplicationService; private OrderApplicationService orderApplicationService;
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Autowired @Autowired
private OrderQuery orderQuery; private OrderQuery orderQuery;
@ -69,4 +73,12 @@ public class OrderController {
orderApplicationService.deleteLegToOrder(deleteLegData); orderApplicationService.deleteLegToOrder(deleteLegData);
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("同步行程规划单的订单状态")
@PostMapping("/sync/order")
public Result<String> reloadOrderDetail(@RequestBody SyncLegData syncLegData) {
orderDetailDomainService.syncOrderDetailStatusByRouteId(syncLegData.getRouteId());
return Result.Success(SUCCESS);
}
} }

View File

@ -2,6 +2,7 @@ package com.chint.application.in;
import com.chint.application.queryies.OrderQuery; import com.chint.application.queryies.OrderQuery;
import com.chint.application.services.OrderApplicationService; 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.ApprovalLegData;
import com.chint.domain.value_object.ApproveLegData; import com.chint.domain.value_object.ApproveLegData;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
@ -22,6 +23,9 @@ public class OrderPublicController {
@Autowired @Autowired
private OrderApplicationService orderApplicationService; private OrderApplicationService orderApplicationService;
@Autowired
private SystemDomainService systemDomainService;
@Autowired @Autowired
private OrderQuery orderQuery; private OrderQuery orderQuery;
@ -29,6 +33,7 @@ public class OrderPublicController {
@ApiOperation("提交审批行程规划单") @ApiOperation("提交审批行程规划单")
@PostMapping("/approve") @PostMapping("/approve")
public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) { public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) {
systemDomainService.checkSystemCode(approveLegData.getSysCode());
orderApplicationService.approve(approveLegData); orderApplicationService.approve(approveLegData);
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@ -49,4 +54,5 @@ public class OrderPublicController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
} }

View File

@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
@RequestMapping("/rank") @RequestMapping("/rank")
public class RankController { public class RankController {
@ -89,6 +91,10 @@ public class RankController {
.setProductType(String.valueOf(travelStandardsData.getProductType())) .setProductType(String.valueOf(travelStandardsData.getProductType()))
.setPrice(travelStandardsData.getPrice()) .setPrice(travelStandardsData.getPrice())
.setCityTag(travelStandardsData.getCityTag()); .setCityTag(travelStandardsData.getCityTag());
List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards);
if (travelStandardsList.isEmpty()) {
return Result.error("该差标已经存在,不可重复添加!");
}
travelStandards = travelStandardsRepository.save(travelStandards); travelStandards = travelStandardsRepository.save(travelStandards);
return Result.Success(CommonMessageConstant.SUCCESS, travelStandards); return Result.Success(CommonMessageConstant.SUCCESS, travelStandards);
} }

View File

@ -4,6 +4,7 @@ package com.chint.application.out;
import com.chint.application.commands.OrderCreateCommand; import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.OrderException; import com.chint.domain.exceptions.OrderException;
import com.chint.domain.service.SystemDomainService;
import com.chint.domain.service.auth.AuthenticateService; import com.chint.domain.service.auth.AuthenticateService;
import com.chint.domain.value_object.UserLoginParam; import com.chint.domain.value_object.UserLoginParam;
import com.chint.domain.value_object.UserLoginResult; import com.chint.domain.value_object.UserLoginResult;
@ -41,6 +42,9 @@ public class LoginController {
@Autowired @Autowired
private UserHttpRequest userHttpRequest; private UserHttpRequest userHttpRequest;
@Autowired
private SystemDomainService systemDomainService;
@Transactional @Transactional
@GetMapping("/login") @GetMapping("/login")
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno, 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 originalString = sfno + syscode + billcode + companycode + AuthMessageConstant.LOGIN_SECRET_KEY + timespan;
String generateSign = Digest.md5(originalString); String generateSign = Digest.md5(originalString);
if (generateSign.equals(sign)) { if (generateSign.equals(sign)) {
//公司名称转为中文转为编号 //创建订单先对sysCode进行检查
/*if (StringCheck.isFirstCharacterChinese(companycode)) { systemDomainService.checkSystemCode(syscode);
User user = new User(Long.valueOf(sfno));
user.setUserLoginParam(new UserLoginParam());
BaseContext.setCurrentUser(user);
userHttpRequest.loadUserInfo(user);
BaseContext.removeCurrentUser();
companycode = user.getCompanyCode();
}*/
// 创建 UserLoginParam 对象 // 创建 UserLoginParam 对象
UserLoginParam userLoginParam = new UserLoginParam(sfno, syscode, billcode, companycode, timespan); UserLoginParam userLoginParam = new UserLoginParam(sfno, syscode, billcode, companycode, timespan);

View File

@ -11,7 +11,6 @@ import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.UserRepository; import com.chint.domain.repository.UserRepository;
import com.chint.domain.value_object.*; import com.chint.domain.value_object.*;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -25,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
import static com.chint.infrastructure.constant.OrderConstant.*;
@RestController @RestController
@RequestMapping("/order") @RequestMapping("/order")
@ -61,6 +61,11 @@ public class OrderOutController {
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId()); User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
routeOrderRes.setUserName(user.getName()); routeOrderRes.setUserName(user.getName());
routeOrderRes.setOrderDetailRes(orderDetailResList); 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); return Result.Success(SUCCESS, routeOrderRes);
} }
@ -81,6 +86,7 @@ public class OrderOutController {
public Result<FlightPriceData> estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) { public Result<FlightPriceData> estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) {
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData)); return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
} }
@ApiOperation("查询酒店估算价格") @ApiOperation("查询酒店估算价格")
@PostMapping("/estimate/hotel") @PostMapping("/estimate/hotel")
public Result<HotelPriceData> estimateHotelPrice(@RequestBody PriceQueryData priceQueryData) { public Result<HotelPriceData> estimateHotelPrice(@RequestBody PriceQueryData priceQueryData) {
@ -88,6 +94,7 @@ public class OrderOutController {
} }
@ApiOperation("根据Id查询行程规划单-元年数据") @ApiOperation("根据Id查询行程规划单-元年数据")
@PostMapping("/query/tripCallback") @PostMapping("/query/tripCallback")
public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) { public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) {

View File

@ -17,6 +17,7 @@ import com.chint.infrastructure.constant.DataMessageConstant;
import com.chint.infrastructure.constant.LegConstant; import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.constant.RouteConstant; import com.chint.infrastructure.constant.RouteConstant;
import com.chint.infrastructure.echo_framework.command.Command; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -44,6 +45,8 @@ public class OrderApplicationService {
@Autowired @Autowired
private LegFactory legFactory; private LegFactory legFactory;
@Transactional @Transactional
public RouteOrder saveOrder(OrderSaveData orderSaveData) { public RouteOrder saveOrder(OrderSaveData orderSaveData) {
RouteOrder order; RouteOrder order;
@ -142,4 +145,8 @@ public class OrderApplicationService {
Command.of(OrderApprovalCommand.class).data(data).sendToQueue(); Command.of(OrderApprovalCommand.class).data(data).sendToQueue();
} }
@Transactional
public void reloadOrderDetail(SyncLegData syncLegData) {
}
} }

View File

@ -11,8 +11,10 @@ public class ApproveOrderNo {
private String sysCode; private String sysCode;
@ApiModelProperty("实际单号") @ApiModelProperty("实际单号")
private String actualOrderNo; private String actualOrderNo;
@ApiModelProperty("入账公司") @ApiModelProperty("入账公司编码")
private String accountCompany; private String accountCompany;
@ApiModelProperty("入账公司名称")
private String accountCompanyName;
@ApiModelProperty("申请说明") @ApiModelProperty("申请说明")
private String instructions; private String instructions;
@ApiModelProperty("财务共享订单创建人") @ApiModelProperty("财务共享订单创建人")

View File

@ -9,6 +9,7 @@ import com.chint.infrastructure.constant.LegConstant;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.Id; 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.Column; import org.springframework.data.relational.core.mapping.Column;
@ -19,7 +20,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
@Slf4j
@Data @Data
@Table("leg") @Table("leg")
@NoArgsConstructor @NoArgsConstructor
@ -173,7 +174,8 @@ public class Leg {
// 检查是否已存在此类型的事件 // 检查是否已存在此类型的事件
boolean exists = eventList.stream().anyMatch(e -> e.getEventType().equals(newEventType)); boolean exists = eventList.stream().anyMatch(e -> e.getEventType().equals(newEventType));
if (exists) { if (exists) {
throw new LegEventException("Event of this type already exists."); log.info("Event of this type already exists.");
return this;
} }
// 如果列表为空且新事件不是准备事件抛出异常 // 如果列表为空且新事件不是准备事件抛出异常

View File

@ -2,7 +2,6 @@ package com.chint.domain.aggregates.order;
import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.value_object.enums.CurrencyType; 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.LegConstant;
import com.chint.infrastructure.constant.OrderConstant; import com.chint.infrastructure.constant.OrderConstant;
import lombok.Data; import lombok.Data;
@ -16,12 +15,15 @@ import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Data @Data
@Table("order_detail") @Table("order_detail")
public class OrderDetail { public class OrderDetail {
@Id @Id
private Long orderId; // 使用 order_id 作为主键 private Long orderId; // 使用 order_id 作为主键
private Long legId; // 使用行程节点关联leg private Long legId; // 使用行程节点关联leg
private Long routeId;
private String orderNo; private String orderNo;
private String supplierName; private String supplierName;
private Integer productType; // 商品类型 private Integer productType; // 商品类型
@ -93,6 +95,13 @@ public class OrderDetail {
return this; return this;
} }
public OrderEvent getLastEvent() {
return this.orderEventList
.stream()
.max(Comparator.comparingLong(OrderEvent::getOrderEventId))
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
}
public OrderDetail price(String price) { public OrderDetail price(String price) {
this.price = price; this.price = price;
return this; return this;
@ -105,7 +114,7 @@ public class OrderDetail {
case LegConstant.LEG_TYPE_HOTEL -> this.hotelOrderDetail; case LegConstant.LEG_TYPE_HOTEL -> this.hotelOrderDetail;
case LegConstant.LEG_TYPE_TAXI -> this.carOrderDetail; case LegConstant.LEG_TYPE_TAXI -> this.carOrderDetail;
case LegConstant.LEG_TYPE_OTHER -> this.otherOrderDetail; case LegConstant.LEG_TYPE_OTHER -> this.otherOrderDetail;
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND); default -> throw new NotFoundException(NOT_FOUND);
}; };
} }

View File

@ -12,6 +12,8 @@ import com.chint.infrastructure.constant.RouteConstant;
import com.chint.infrastructure.constant.SupplierNameConstant; import com.chint.infrastructure.constant.SupplierNameConstant;
import com.chint.infrastructure.constant.UtilConstant; import com.chint.infrastructure.constant.UtilConstant;
import com.chint.infrastructure.echo_framework.command.Command; 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.chint.infrastructure.util.BigDecimalCalculator;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
@ -28,6 +30,8 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Data @Data
@Table("route_order") @Table("route_order")
public class RouteOrder extends BaseEntity { public class RouteOrder extends BaseEntity {
@ -192,6 +196,8 @@ public class RouteOrder extends BaseEntity {
return this; return this;
} }
public RouteOrder reloadStatus(OrderSaveData orderSaveData) { public RouteOrder reloadStatus(OrderSaveData orderSaveData) {
// 重新加载所有Leg的状态 // 重新加载所有Leg的状态
List<Leg> legs = this.getLegItems(); 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()) { if (this.legItems.isEmpty()) {
return; return orderDetail;
} }
// 定义时间容差例如1天 // 定义时间容差例如1天
long tolerance = Duration.ofDays(1).toMillis(); long tolerance = Duration.ofDays(2).toMillis();
List<Leg> potentialMatches = this.legItems.stream() List<Leg> potentialMatches = this.legItems.stream()
.filter(leg -> leg.getLegType().equals(orderDetail.getProductType()) .filter(leg -> leg.getLegType().equals(orderDetail.getProductType())
@ -363,11 +369,14 @@ public class RouteOrder extends BaseEntity {
// 如果找到最佳匹配项执行相应操作 // 如果找到最佳匹配项执行相应操作
if (bestMatch != null) { if (bestMatch != null) {
Command.of(LegOrderedCommand.class) Properties properties = Command.of(LegOrderedCommand.class)
.legId(bestMatch.getLegId()) .legId(bestMatch.getLegId())
.orderDetailId(orderDetail.getOrderId()) .orderDetailId(orderDetail.getOrderId())
.sendToQueue(); .sendToQueue();
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
return (OrderDetail) byPropertyName.getValue();
} }
return orderDetail;
} }
private double calculateMatchScore(Leg leg, OrderDetail orderDetail, long tolerance) { private double calculateMatchScore(Leg leg, OrderDetail orderDetail, long tolerance) {

View File

@ -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;
}

View File

@ -32,6 +32,8 @@ public class User {
@Transient @Transient
private String companyCode; private String companyCode;
@Transient @Transient
private String companyName;
@Transient
private String workStatus; private String workStatus;
@Transient @Transient
private String manaLevel; private String manaLevel;

View File

@ -55,6 +55,7 @@ public class RouteOrderFactory implements OrderFactory {
approveOrderNo.setSysCode(loginParam.getSyscode()); approveOrderNo.setSysCode(loginParam.getSyscode());
approveOrderNo.setFakeOrderNo(loginParam.getBillcode()); approveOrderNo.setFakeOrderNo(loginParam.getBillcode());
approveOrderNo.setAccountCompany(currentUser.getCompanyCode()); approveOrderNo.setAccountCompany(currentUser.getCompanyCode());
approveOrderNo.setAccountCompanyName(currentUser.getCompanyName());
routeOrder.setApproveOrderNo(approveOrderNo); routeOrder.setApproveOrderNo(approveOrderNo);
routeOrder.setBookingTime(LocalDateTime.now()); routeOrder.setBookingTime(LocalDateTime.now());
return routeOrder; return routeOrder;

View File

@ -1,17 +1,45 @@
package com.chint.domain.factoriy.order_detail; package com.chint.domain.factoriy.order_detail;
import com.chint.domain.aggregates.order.*; 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 org.springframework.stereotype.Component;
import java.util.Optional;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
@Component @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 @Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) { public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
return null; return null;
} }
@Override @Override
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) { public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
return null; return null;
} }
@ -22,7 +50,45 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{
@Override @Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) { 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 @Override

View File

@ -20,4 +20,6 @@ public interface LocationRepository {
List<Location> findByName(LocationParam locationParam); List<Location> findByName(LocationParam locationParam);
List<Location> findByName(String localName); List<Location> findByName(String localName);
String locationPathByName(String localName);
} }

View File

@ -14,4 +14,6 @@ public interface OrderDetailRepository {
OrderDetail save(OrderDetail orderDetail); OrderDetail save(OrderDetail orderDetail);
void deleteById(Long id);
} }

View File

@ -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);
}

View File

@ -12,4 +12,6 @@ public interface TravelStandardsRepository {
void saveAll(List<TravelStandards> travelStandardsList); void saveAll(List<TravelStandards> travelStandardsList);
List<TravelStandards> findByStandardLevel(String standardLevel); List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByTravelStandards(TravelStandards travelStandards);
} }

View File

@ -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);
}
}

View File

@ -24,7 +24,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.DelayDispatch; import com.chint.infrastructure.util.DelayDispatch;
import com.chint.interfaces.rest.bpm.BPMParamFactory; import com.chint.interfaces.rest.bpm.BPMParamFactory;
import com.chint.interfaces.rest.bpm.BPMRequest; 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 com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -104,7 +104,7 @@ public class OrderDomainService {
@ListenTo(command = "OrderStatusChangeCommand", order = 0) @ListenTo(command = "OrderStatusChangeCommand", order = 0)
public void orderDetailStatusChange(OrderStatusChangeCommand command) { public void orderDetailStatusChange(OrderStatusChangeCommand command) {
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> { OrderDetail orderDetail = command.getOrderDetail();
String outStatus = command.getOutStatus(); String outStatus = command.getOutStatus();
Integer orderEventType = command.getOrderEventType(); Integer orderEventType = command.getOrderEventType();
OrderEvent event = orderDetailFactory.createEvent(orderEventType, OrderEvent event = orderDetailFactory.createEvent(orderEventType,
@ -122,8 +122,7 @@ public class OrderDomainService {
.productType(orderDetail.getProductType()) .productType(orderDetail.getProductType())
.extensionData(orderDetail.getExtensionDataByProductType()) .extensionData(orderDetail.getExtensionDataByProductType())
.sendToQueue(); .sendToQueue();
} };
});
} }
@ListenTo(command = "BPMAuditCommand", order = 0) @ListenTo(command = "BPMAuditCommand", order = 0)

View File

@ -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;
}
}

View File

@ -28,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Optional; 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; import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service @Service
@ -76,10 +78,10 @@ public class LegEventHandler implements LegEventService {
if (routeOrder.getLegItems().isEmpty()) { if (routeOrder.getLegItems().isEmpty()) {
throw new OrderException(CommonMessageConstant.LEG_ERROR); 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 approveOrderNo = routeOrder.getApproveOrderNo();
approveOrderNo.setActualOrderNo(data.getActualOrderNo()); approveOrderNo.setActualOrderNo(data.getActualOrderNo());
approveOrderNo.setAccountCompany(data.getAccountCompany()); // approveOrderNo.setAccountCompany(data.getAccountCompany());
approveOrderNo.setInstructions(data.getInstructions()); approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator()); approveOrderNo.setCreator(data.getCreator());
//这里order所有的leg触发approve事件 //这里order所有的leg触发approve事件
@ -92,8 +94,10 @@ public class LegEventHandler implements LegEventService {
routeOrder.addApprovalEvent(approvalEvent); routeOrder.addApprovalEvent(approvalEvent);
//保存routeOrder的状态 //保存routeOrder的状态
routeRepository.save(routeOrder); routeRepository.save(routeOrder);
} else if (routeOrder.getOrderStatus() > ORDER_STATUS_PREPARE) {
throw new CommandException(ORDER_STATUS_ERROR);
} else { } 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)) { if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
throw new CommandException("订单已同步"); throw new CommandException("订单已同步");
} }
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_PREPARE)) { if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
throw new CommandException("订单未提交审批"); throw new CommandException("订单未提交审批");
} }
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) { if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) {
@ -158,7 +162,7 @@ public class LegEventHandler implements LegEventService {
// .max(Comparator.comparing(OrderDetail::getCreateTime)) // .max(Comparator.comparing(OrderDetail::getCreateTime))
// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)); // .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理 //为订单添加订单已下单事件,这里需要发出额外的命令进行处理
routeOrder.matchOrderWithLeg(orderDetail); orderDetail = routeOrder.matchOrderWithLeg(orderDetail);
} else { } else {
orderDetail = byOrderNo.get(); orderDetail = byOrderNo.get();
} }
@ -167,7 +171,7 @@ public class LegEventHandler implements LegEventService {
@Transactional @Transactional
@Override @Override
public void orderLeg(LegOrderedCommand command) { public ResultContainer orderLeg(LegOrderedCommand command) {
//如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件 //如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId())); Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
//因为orderDetail已经进行持久化保存 只需要从数据库进行查询 //因为orderDetail已经进行持久化保存 只需要从数据库进行查询
@ -178,6 +182,7 @@ public class LegEventHandler implements LegEventService {
orderDetail.setLegId(leg.getLegId()); orderDetail.setLegId(leg.getLegId());
legRepository.save(leg); legRepository.save(leg);
orderDetailRepository.save(orderDetail); orderDetailRepository.save(orderDetail);
return ResultContainer.of(RESULT_ORDER_DETAIL).value(orderDetail);
} }
@Transactional @Transactional

View File

@ -13,7 +13,7 @@ public interface LegEventService {
void syncLeg(LegSyncCommand command); void syncLeg(LegSyncCommand command);
//下单事件 //下单事件
void orderLeg(LegOrderedCommand command); ResultContainer orderLeg(LegOrderedCommand command);
ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command); ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command);

View File

@ -39,15 +39,14 @@ public class LegEventServiceImpl implements LegEventService {
//下单时间要求回传需要付款的金额以及生成对于的行程订单号如果没有行程订单号根据地点和时间进行匹配 //下单时间要求回传需要付款的金额以及生成对于的行程订单号如果没有行程订单号根据地点和时间进行匹配
@ListenTo(command = "LegOrderedCommand", order = 0) @ListenTo(command = "LegOrderedCommand", order = 0)
@Override @Override
public void orderLeg(LegOrderedCommand command) { public ResultContainer orderLeg(LegOrderedCommand command) {
legEventHandler.orderLeg(command); return legEventHandler.orderLeg(command);
} }
@ListenTo(command = "RouteUpdateOrderCommand", order = 0) @ListenTo(command = "RouteUpdateOrderCommand", order = 0)
@Override @Override
public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) { public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) {
legEventHandler.routeUpdateOrder(command); return legEventHandler.routeUpdateOrder(command);
return null;
} }
@Override @Override

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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);
};
}
}

View File

@ -55,6 +55,7 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
Location byName = locationRepository.findByName(hotelOrderInfoEntity.getCityName()).get(0); Location byName = locationRepository.findByName(hotelOrderInfoEntity.getCityName()).get(0);
return builder.productType(LegConstant.LEG_TYPE_HOTEL) return builder.productType(LegConstant.LEG_TYPE_HOTEL)
.hotelOrderDetailData(hotelOrderInfoEntity)
.currencyCode(hotelOrderInfoEntity.getCurrency()) .currencyCode(hotelOrderInfoEntity.getCurrency())
.orderTime(hotelOrderInfoEntity.getOrderDate()) .orderTime(hotelOrderInfoEntity.getOrderDate())
.startTime(hotelOrderInfoEntity.getStartTime()) .startTime(hotelOrderInfoEntity.getStartTime())

View File

@ -1,7 +1,8 @@
package com.chint.domain.service.supplier; package com.chint.domain.service.supplier;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.value_object.SupplierCallbackData; import com.chint.domain.value_object.SupplierCallbackData;
public interface SupplierService { public interface SupplierService {
void handleSupplierCallback(SupplierCallbackData callbackData); OrderDetail handleSupplierCallback(SupplierCallbackData callbackData);
} }

View File

@ -2,9 +2,11 @@ package com.chint.domain.service.supplier;
import com.chint.application.commands.RouteUpdateOrderCommand; import com.chint.application.commands.RouteUpdateOrderCommand;
import com.chint.domain.aggregates.order.OrderDetail; 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.OrderExtensionCreator;
import com.chint.domain.factoriy.order_detail.OrderExtensionFactory; import com.chint.domain.factoriy.order_detail.OrderExtensionFactory;
import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.value_object.OrderLegData;
import com.chint.domain.value_object.SupplierCallbackData; import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.constant.LegConstant; import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.echo_framework.command.Command; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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; import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service @Service
@ -28,45 +33,43 @@ public class SupplierServiceImpl implements SupplierService {
private OrderDetailRepository orderDetailRepository; private OrderDetailRepository orderDetailRepository;
@Override @Override
public void handleSupplierCallback(SupplierCallbackData callbackData) { public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) {
String supplierName = callbackData.getSupplierName(); String supplierName = callbackData.getSupplierName();
orderDataAdapterSelector
.of(supplierName)
.adapt(callbackData)
.ifPresent(data -> {
System.out.println(data); Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData);
if (data.isPresent()) {
//获取使用RouteUpdateOrderCommand命令创建的orderDetail //获取使用RouteUpdateOrderCommand命令创建的orderDetail
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(data).sendToQueue(); OrderLegData orderLegData = data.get();
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(orderLegData).sendToQueue();
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL); ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue(); OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();
Integer productType = data.getProductType(); Integer productType = orderLegData.getProductType();
OrderExtensionFactory orderExtensionFactory = orderExtensionCreator OrderExtensionFactory orderExtensionFactory = orderExtensionCreator
.of(supplierName); .of(supplierName);
Object callbackDataData = callbackData.getData();
//根据产品的不同类型添加不同的扩展字段 //根据产品的不同类型添加不同的扩展字段
switch (productType) { switch (productType) {
case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData( case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData(
orderExtensionFactory.createTrainOrderDetail(callbackDataData) orderExtensionFactory.createTrainOrderDetail(orderLegData.getTrainOrderDetailData())
); );
case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData( case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData(
orderExtensionFactory.createFlightOrderDetail(callbackDataData) orderExtensionFactory.createFlightOrderDetail(orderLegData.getFlightOrderDetailData())
); );
case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData( case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData(
orderExtensionFactory.createHotelOrderDetail(callbackDataData) orderExtensionFactory.createHotelOrderDetail(orderLegData.getHotelOrderDetailData())
); );
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData( case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
orderExtensionFactory.createCarOrderDetail(callbackDataData) orderExtensionFactory.createCarOrderDetail(orderLegData.getCarOrderDetailData())
); );
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData( case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
orderExtensionFactory.createOtherOrderDetail(callbackDataData) orderExtensionFactory.createOtherOrderDetail(orderLegData.getOtherOrderDetailData())
); );
} }
//对orderDetail进行保存 //对orderDetail进行保存
orderDetailRepository.save(orderDetail); return orderDetailRepository.save(orderDetail);
}); } else {
throw new NotFoundException(NOT_FOUND);
}
} }
} }

View File

@ -1,13 +1,20 @@
package com.chint.domain.value_object; package com.chint.domain.value_object;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
public class ApproveLegData { public class ApproveLegData {
@ApiModelProperty("实际财务共享订单号")
private String actualOrderNo; private String actualOrderNo;
@ApiModelProperty("临时财务共享订单号")
private String fakeOrderNo; private String fakeOrderNo;
@ApiModelProperty("入账公司")
private String accountCompany; private String accountCompany;
@ApiModelProperty("系统标识")
private String sysCode; private String sysCode;
@ApiModelProperty("出差说明")
private String instructions; private String instructions;
@ApiModelProperty("财务共享订单创建人")
private String creator; private String creator;
} }

View File

@ -47,6 +47,11 @@ public class OrderLegData {
this.destinationId = builder.destinationId; this.destinationId = builder.destinationId;
this.originOrderStatus = builder.originOrderStatus; this.originOrderStatus = builder.originOrderStatus;
this.currencyCode = builder.currencyCode; 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() { public static Builder builder() {
@ -71,10 +76,36 @@ public class OrderLegData {
private Long destinationId; private Long destinationId;
private String currencyCode; private String currencyCode;
private Object carOrderDetailData;
private Object trainOrderDetailData;
private Object hotelOrderDetailData;
private Object flightOrderDetailData;
private Object otherOrderDetailData;
public Builder() { 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) { public Builder currencyCode(String currencyCode) {
this.currencyCode = currencyCode; this.currencyCode = currencyCode;
return this; return this;

View File

@ -2,7 +2,9 @@ package com.chint.infrastructure.constant;
public class BPMConstant { public class BPMConstant {
//BPM //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_TRAIN = "火车票超标";//方法名称
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称 public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称 public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称

View File

@ -8,4 +8,6 @@ public class DataMessageConstant {
public static final String DATA_DELETION_SUCCESS = "数据删除成功"; public static final String DATA_DELETION_SUCCESS = "数据删除成功";
public static final String DATA_NOT_FOUND = "未找到数据"; public static final String DATA_NOT_FOUND = "未找到数据";
public static final String DATA_INVALID = "数据不合法"; public static final String DATA_INVALID = "数据不合法";
public static final String SYS_CODE_ERROR = "系统标识字段错误";
public static final String ORDER_STATUS_ERROR = "订单状态错误";
} }

View File

@ -20,4 +20,12 @@ public class OrderConstant {
public static final String ORDER_EVENT_ETA_NAME = "超标"; public static final String ORDER_EVENT_ETA_NAME = "超标";
public static final int ORDER_EVENT_UNKNOWN = -99; public static final int ORDER_EVENT_UNKNOWN = -99;
public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件"; 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";
} }

View File

@ -51,6 +51,10 @@ public class GlobalExceptionHandler {
while (rootCause instanceof InvocationTargetException && cause != null) { while (rootCause instanceof InvocationTargetException && cause != null) {
rootCause = cause; rootCause = cause;
} }
if(cause == null){
rootCause.printStackTrace();
return Result.error("未知错误");
}
Throwable causeCause = cause.getCause(); Throwable causeCause = cause.getCause();
causeCause.printStackTrace(); causeCause.printStackTrace();
return Result.error(causeCause.getMessage()); return Result.error(causeCause.getMessage());

View File

@ -70,4 +70,10 @@ public class LocationRepositoryImpl implements LocationRepository {
public List<Location> findByName(String localName) { public List<Location> findByName(String localName) {
return jdbcLocationRepository.findByLocationNameContaining(localName); return jdbcLocationRepository.findByLocationNameContaining(localName);
} }
@Override
public String locationPathByName(String localName) {
Location byLocationName = jdbcLocationRepository.findByLocationName(localName);
return byLocationName.getLocationPathName().replace("_", "");
}
} }

View File

@ -36,4 +36,9 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
public OrderDetail save(OrderDetail orderDetail) { public OrderDetail save(OrderDetail orderDetail) {
return orderDetailRepository.save(orderDetail); return orderDetailRepository.save(orderDetail);
} }
@Override
public void deleteById(Long id) {
orderDetailRepository.deleteById(id);
}
} }

View File

@ -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));
}
}

View File

@ -30,4 +30,11 @@ public class TravelStandardsRepositoryImpl implements TravelStandardsRepository
public List<TravelStandards> findByStandardLevel(String standardLevel) { public List<TravelStandards> findByStandardLevel(String standardLevel) {
return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel); return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel);
} }
@Override
public List<TravelStandards> findByTravelStandards(TravelStandards travelStandards) {
return jdbcTravelStandardsRepository.findByProductTypeAndStandardLevelAndCityTag(
travelStandards.getProductType(), travelStandards.getStandardLevel(), travelStandards.getCityTag());
}
} }

View File

@ -19,5 +19,8 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
Page<Location> findAllByLevel(Integer level, Pageable pageable); Page<Location> findAllByLevel(Integer level, Pageable pageable);
List<Location> findByFirstPinYin(String firstPinYin); List<Location> findByFirstPinYin(String firstPinYin);
List<Location> findByLocationNameContaining(String locationName); List<Location> findByLocationNameContaining(String locationName);
Location findByLocationName(String locationName);
} }

View File

@ -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);
}

View File

@ -11,4 +11,5 @@ import java.util.List;
public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> { public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> {
List<TravelStandards> findByStandardLevel(String standardLevel); List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByProductTypeAndStandardLevelAndCityTag(String productType,String standardLevel,String cityTag);
} }

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.base; package com.chint.interfaces.rest.base;
import com.google.gson.Gson; import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient; import org.apache.http.client.HttpClient;
@ -14,6 +15,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
@Component @Component
@Slf4j
public class PostRequest { public class PostRequest {
private final Gson gson = new Gson(); private final Gson gson = new Gson();
private final HttpClient client = HttpClients.createDefault(); private final HttpClient client = HttpClients.createDefault();
@ -21,7 +23,7 @@ public class PostRequest {
public <T> T post(String url, Object jsonRequest, Class<T> responseType) { public <T> T post(String url, Object jsonRequest, Class<T> responseType) {
HttpPost post = new HttpPost(url); HttpPost post = new HttpPost(url);
String json = gson.toJson(jsonRequest); String json = gson.toJson(jsonRequest);
System.out.println(json); log.info(json);
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
String responseBody = null; String responseBody = null;
HttpEntity responseEntity = null; HttpEntity responseEntity = null;
@ -40,7 +42,7 @@ public class PostRequest {
HttpPost post = new HttpPost(url); HttpPost post = new HttpPost(url);
post.addHeader(headName, headValue); post.addHeader(headName, headValue);
String json = gson.toJson(jsonRequest); String json = gson.toJson(jsonRequest);
System.out.println(json); log.info(json);
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON)); post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
String responseBody = null; String responseBody = null;
HttpEntity responseEntity = null; HttpEntity responseEntity = null;

View File

@ -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);
}
}

View File

@ -5,7 +5,8 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.infrastructure.constant.BPMConstant; import com.chint.infrastructure.constant.BPMConstant;
import com.chint.infrastructure.constant.CommonMessageConstant; import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.constant.SupplierNameConstant; 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 org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -3,15 +3,17 @@ package com.chint.interfaces.rest.bpm;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest; import com.chint.interfaces.rest.bpm.dot.*;
import com.chint.interfaces.rest.bpm.dot.BPMResponse; import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto; import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import com.chint.interfaces.rest.bpm.dot.RescheduleDto; import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; 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 @Service
@ -20,6 +22,9 @@ public class BPMRequest {
@Autowired @Autowired
private PostRequest httpPostRequest; private PostRequest httpPostRequest;
@Value("${bpm.H3BPMUrl}")
private String H3BPMUrl;
//超标申请 //超标申请
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) { public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto); return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
@ -40,8 +45,8 @@ public class BPMRequest {
.setUserCode(String.valueOf(user.getEmployeeNo()))//sf号 .setUserCode(String.valueOf(user.getEmployeeNo()))//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点 .setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues); .setEntityParamValues(entityParamValues);
BPMResponse response = httpPostRequest.post(EXCEED_STANDARD_URL, bpmRequest, BPMResponse.class); BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
System.out.println("response = " + response); System.out.println("response = " + bpmBaseResponse);
return response; return bpmBaseResponse.getD();
} }
} }

View File

@ -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;//审批结果:通过/拒绝
}

View File

@ -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;
}

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dot; package com.chint.interfaces.rest.bpm.dto;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dot; package com.chint.interfaces.rest.bpm.dto;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dot; package com.chint.interfaces.rest.bpm.dto;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dot; package com.chint.interfaces.rest.bpm.dto;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;

View File

@ -87,7 +87,7 @@ public class CTripEstimateRequest {
.valuationBaseInfo() .valuationBaseInfo()
.eID(user.getEmployeeNo().toString()) .eID(user.getEmployeeNo().toString())
.corpID(C_TRIP_CORP_ID) .corpID(C_TRIP_CORP_ID)
// .rankName(user.getRankCode()) .rankName(user.getStandardLevel())
.done() .done()
.valuationProductInfo() .valuationProductInfo()
.addFlightProductInfo(flightProductInfo) .addFlightProductInfo(flightProductInfo)

View File

@ -95,10 +95,10 @@ public class BookingRelatedApiRequestBuilder {
return this; return this;
} }
// public ValuationBaseInfoBuilder rankName(String rankName) { public ValuationBaseInfoBuilder rankName(String rankName) {
// baseInfo.setRankName(rankName); baseInfo.setRankName(rankName);
// return this; return this;
// } }
public ValuateBudgetRequestTypeBuilder done() { public ValuateBudgetRequestTypeBuilder done() {
requestContent.setValuationBaseInfo(baseInfo); requestContent.setValuationBaseInfo(baseInfo);

View File

@ -10,7 +10,7 @@ public class ValuationBaseInfo {
// 员工ID // 员工ID
private String eID; private String eID;
// 职级名称 // 职级名称
// private String rankName; private String rankName;
// Getters and setters... // Getters and setters...
} }

View File

@ -1,6 +1,7 @@
package com.chint.interfaces.rest.ctrip.in; package com.chint.interfaces.rest.ctrip.in;
import com.chint.application.commands.OrderStatusChangeCommand; import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData; import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.constant.OrderConstant; 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 com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -52,6 +54,7 @@ public class CTripNoteController {
// return new CTripNoteResponse("1", "未收到消息"); // return new CTripNoteResponse("1", "未收到消息");
// } // }
@Transactional
@PostMapping("/status") @PostMapping("/status")
public CTripStatusResponse statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) { public CTripStatusResponse statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
String productType = cTripStatusNotification.getProductType(); String productType = cTripStatusNotification.getProductType();
@ -62,14 +65,22 @@ public class CTripNoteController {
return new CTripStatusResponse("1", "sign错误"); return new CTripStatusResponse("1", "sign错误");
} }
if (orderStatus != null && orderId != null) { if (orderStatus != null && orderId != null) {
return handlerData(orderId, orderStatus, productType);
}
return new CTripStatusResponse("1", "未收到消息");
}
public CTripStatusResponse handlerData(String orderId, String orderStatus, String productType) {
SupplierCallbackData supplierCallbackData = SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP); SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP);
SearchOrderResponse response = cTripOrderSearchRequest SearchOrderResponse response = cTripOrderSearchRequest
.searchOrderResponseByOrderId(orderId); .searchOrderResponseByOrderId(orderId);
supplierCallbackData.data(response); supplierCallbackData.data(response);
supplierService.handleSupplierCallback(supplierCallbackData); OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class) OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail)
.orderNo(orderId) .orderNo(orderId)
.outStatus(orderStatus); .outStatus(orderStatus);
switch (productType) { switch (productType) {
@ -97,8 +108,6 @@ public class CTripNoteController {
command.sendToQueue(); command.sendToQueue();
return new CTripStatusResponse("0", "成功收到消息"); return new CTripStatusResponse("0", "成功收到消息");
} }
return new CTripStatusResponse("1", "未收到消息");
}
public Integer mapFlightStatus(String status) { public Integer mapFlightStatus(String status) {

View File

@ -4,14 +4,20 @@ import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ly.dto.user.EmployeeRequest; 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.EmployeeEntity;
import com.chint.interfaces.rest.ly.dto.user.PreTravelPolicy;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.chint.interfaces.rest.ly.dto.user.UserResponse; 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_BASE_URL;
import static com.chint.infrastructure.constant.LYConstant.L_Y_USER_PATH; import static com.chint.infrastructure.constant.LYConstant.L_Y_USER_PATH;
@Slf4j
@Service @Service
public class LYUserRequest { public class LYUserRequest {
@ -27,7 +33,7 @@ public class LYUserRequest {
private final String userUrl = L_Y_BASE_URL + L_Y_USER_PATH; private final String userUrl = L_Y_BASE_URL + L_Y_USER_PATH;
public boolean saveCurrentUser() { public boolean saveCurrentUser() {
System.out.println("saveCurrentUser"); log.info("saveCurrentUser");
User currentUser = BaseContext.getCurrentUser(); User currentUser = BaseContext.getCurrentUser();
userHttpRequest.loadUserInfo(currentUser); userHttpRequest.loadUserInfo(currentUser);
EmployeeEntity employeeEntity = user2LYEmployee(currentUser); EmployeeEntity employeeEntity = user2LYEmployee(currentUser);
@ -66,7 +72,17 @@ public class LYUserRequest {
employeeEntity.setGender(translateGender(user.getGender())); employeeEntity.setGender(translateGender(user.getGender()));
employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus())); employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus()));
employeeEntity.setReservationType(0); 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; return employeeEntity;
} }
} }

View File

@ -32,5 +32,5 @@ public class EmployeeEntity {
private Map<String, String> remarks; private Map<String, String> remarks;
private String baseCity; private String baseCity;
// Getters and setters
} }

View File

@ -1,5 +1,10 @@
package com.chint.interfaces.rest.ly.dto.user; package com.chint.interfaces.rest.ly.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class PreTravelPolicy { public class PreTravelPolicy {
private String policyCode; private String policyCode;
private int productTypeId; private int productTypeId;

View File

@ -1,9 +1,9 @@
package com.chint.interfaces.rest.user; package com.chint.interfaces.rest.user;
//import com.chint.dc.api.DataCenterResult; import com.chint.dc.api.DataCenterResult;
//import com.chint.dc.api.dto.DataCenterOption; import com.chint.dc.api.dto.DataCenterOption;
//import com.chint.dc.api.service.DataCenterService; import com.chint.dc.api.service.DataCenterService;
import com.chint.domain.aggregates.standards.Ranks; import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.user.User; 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.base.PostRequest;
import com.chint.interfaces.rest.user.dto.*; import com.chint.interfaces.rest.user.dto.*;
import com.google.gson.Gson; 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.HttpClient;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; 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 @Service
public class UserHttpRequestImpl implements UserHttpRequest { public class UserHttpRequestImpl implements UserHttpRequest {
private final String asSkUrl = SFConstant.AK_BASE_URL + SFConstant.GET_AK_URL + "?systemId=" + SFConstant.SYSTEM_ID; 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; private final String travelRankUrl = SFConstant.TRAVEL_RANK_BASE_URL + SFConstant.TRAVEL_RANK_PATH;
@Autowired @Autowired
@ -53,6 +63,8 @@ public class UserHttpRequestImpl implements UserHttpRequest {
if (ranks != null) { if (ranks != null) {
user.setStandardLevel(ranks.getStandardLevel()); user.setStandardLevel(ranks.getStandardLevel());
// user.setStandardLevel("测试职级"); // user.setStandardLevel("测试职级");
} else {
user.setStandardLevel(STANDARD_LEVEL_THREE);
} }
return user; return user;
} }
@ -72,73 +84,74 @@ public class UserHttpRequestImpl implements UserHttpRequest {
} }
private User loadSFInfo(User user) { private User loadSFInfo(User user) {
// Gson gson = new Gson(); Gson gson = new Gson();
// AccessKeyDTO akSkLoad = akSkLoad(); AccessKeyDTO akSkLoad = akSkLoad();
// DataCenterOption option = new DataCenterOption(); DataCenterOption option = new DataCenterOption();
// option.setSk(akSkLoad.sk); option.setSk(akSkLoad.sk);
// option.setAk(akSkLoad.ak); option.setAk(akSkLoad.ak);
// option.setUrl(OPENAI_BASE_URL); option.setUrl(OPENAI_BASE_URL);
// DataCenterService dataCenterService = new DataCenterService(option); DataCenterService dataCenterService = new DataCenterService(option);
// LinkedHashMap map = new LinkedHashMap<String, Object>(); LinkedHashMap map = new LinkedHashMap<String, Object>();
// map.put("LoginUsername", user.getEmployeeNo().toString()); map.put("LoginUsername", user.getEmployeeNo().toString());
// map.put("start", 0); map.put("start", 0);
// map.put("pageSize", 99); map.put("pageSize", 99);
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map); DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
// Type type = new TypeToken<List<UserDataDTO>>() { Type type = new TypeToken<List<UserDataDTO>>() {
// }.getType(); }.getType();
// if (result.getData() != null) { if (result.getData() != null) {
// String companyCode = user.getCompanyCode(); String companyCode = user.getCompanyCode();
// if (companyCode == null) { if (companyCode == null) {
// companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
// } }
// String newCompanyCode = companyCode; String newCompanyCode = companyCode;
// List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
// if (fromJson.size() == 1) { if (fromJson.size() == 1) {
// UserDataDTO userData = fromJson.get(0); UserDataDTO userData = fromJson.get(0);
// user.setCompanyCode(userData.getCompany()); user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus()); user.setCompanyName(userData.getCompany_cn());
// user.setGender(userData.getGender()); user.setWorkStatus(userData.getStatus());
// user.setName(userData.getUname()); user.setGender(userData.getGender());
// user.setPhoneNumber(userData.getMobilePhone()); user.setName(userData.getUname());
// user.setManaLevel(userData.getCust_manaLevel()); user.setPhoneNumber(userData.getMobilePhone());
// user.setProfLevel(userData.getCust_profLevel()); user.setManaLevel(userData.getCust_manaLevel());
// } else { user.setProfLevel(userData.getCust_profLevel());
// Optional<UserDataDTO> first; } else {
// Optional<UserDataDTO> first;
// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配 //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) { if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
// first = fromJson.stream() first = fromJson.stream()
// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode)) .filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
// .findFirst(); .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("用户数据不存在");
// }
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;
} }

View File

@ -24,3 +24,6 @@ cTrip:
appKey: obk_zhengtai2024 appKey: obk_zhengtai2024
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
requestSecret: zhengtai2024_nEbmKfOo requestSecret: zhengtai2024_nEbmKfOo
bpm:
H3BPMUrl: http://10.207.0.245:8012

View File

@ -1,32 +1,33 @@
server: server:
port: 8081 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: #chint:
# datasource: # datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver # 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 # # host: 10.9.56.48
# port: 6603 # port: 3306
# database: itinerary_booking # database: itinerary_booking
# username: tripbook # username: echo
# password: W@Xgf25d&lRk*L0X# # password: R3nd0mP@ssw0rd!
# url: https://gxdev03.chint.com/businesstravel/ # 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: logging:
level: level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG org.springframework.jdbc.core.JdbcTemplate: DEBUG
org.springframework.jdbc.core.StatementCreatorUtils: TRACE org.springframework.jdbc.core.StatementCreatorUtils: TRACE
root: info
cTrip: cTrip:
@ -37,3 +38,6 @@ cTrip:
appKey: obk_zhengtai2024 appKey: obk_zhengtai2024
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
requestSecret: zhengtai2024_nEbmKfOo requestSecret: zhengtai2024_nEbmKfOo
bpm:
H3BPMUrl: http://10.207.0.245:8012

View File

@ -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.CTripLoginParam;
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse; import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse; import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +51,9 @@ public class CTripTest {
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@Autowired
private CTripNoteController cTripNoteController;
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
//@Test //@Test
@ -149,7 +153,7 @@ public class CTripTest {
System.out.println(response); System.out.println(response);
} }
@Test // @Test
void searchAndHandlerData(){ void searchAndHandlerData(){
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
SupplierCallbackData supplierCallbackData = SupplierCallbackData supplierCallbackData =
@ -158,4 +162,10 @@ public class CTripTest {
supplierCallbackData.data(response); supplierCallbackData.data(response);
supplierService.handleSupplierCallback(supplierCallbackData); supplierService.handleSupplierCallback(supplierCallbackData);
} }
// @Test
void backData(){
BaseContext.setCurrentUser(user);
cTripNoteController.handlerData("30607415392","Paid","HotelContract");
}
} }

View File

@ -4,21 +4,23 @@ import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.constant.LYConstant; import com.chint.infrastructure.constant.LYConstant;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest; import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.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.LYLoginRequest;
import com.chint.interfaces.rest.ly.LYPostRequest; import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYTokenRequest; import com.chint.interfaces.rest.ly.LYTokenRequest;
import com.chint.interfaces.rest.ly.LYUserRequest; import com.chint.interfaces.rest.ly.LYUserRequest;
import com.chint.interfaces.rest.ly.dto.applyordersync.*; 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.commonresult.Result;
import com.chint.interfaces.rest.ly.dto.estimateprice.*; import com.chint.interfaces.rest.ly.dto.estimateprice.*;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo; import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -27,6 +29,9 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
@SpringBootTest @SpringBootTest
public class LYTest { public class LYTest {
@ -46,6 +51,9 @@ public class LYTest {
@Autowired @Autowired
private PostRequest httpPostRequest; 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_BASE_URL = "https://api.qa.dttrip.cn/openapi";
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync"; 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 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 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 user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063"); private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
@ -283,13 +290,13 @@ public class LYTest {
// @Test // @Test
void loginLY() { void loginLY() {
BaseContext.setCurrentUser(user); 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 // @Test
void loginLYPC() { void loginLYPC() {
BaseContext.setCurrentUser(user); 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 exceedStandardDto = new ExceedStandardDto();
exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标 exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅 .setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
.setOrderNo("00002")//订单号 .setOrderNo("001021214")//订单号
.setHotelStandard("标间")//酒店超标提供住宿标准 .setHotelStandard("标间")//酒店超标提供住宿标准
.setHotelName("酒店名称")//酒店超标提供酒店名称 .setHotelName("酒店名称")//酒店超标提供酒店名称
.setHouseLayout("双人床")//酒店超标提供房型 .setHouseLayout("双人床")//酒店超标提供房型
.setSeatingStandard("")//火车票超标提供席别标准 .setSeatingStandard("")//火车票超标提供席别标准
.setCabinClass("")//机票超标提供舱等 .setCabinClass("")//机票超标提供舱等
.setExcessAmount(BigDecimal.valueOf(100))//超标金额 .setExcessAmount(BigDecimal.valueOf(1000))//超标金额
.setReason("酒店爆满订不到");//超标原因 .setReason("酒店爆满订不到");//超标原因
String entityParamValues = gson.toJson(exceedStandardDto); String entityParamValues = gson.toJson(exceedStandardDto);
bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码 bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码
.setUserCode("231116011")//sf号 .setUserCode("231116011")//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点 .setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues); .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); System.out.println("response = " + response);
} }
@ -339,7 +348,9 @@ public class LYTest {
.setUserCode("231116011")//sf号 .setUserCode("231116011")//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点 .setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues); .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); System.out.println("response = " + response);
} }

View File

@ -4,9 +4,11 @@ import cn.hutool.extra.pinyin.PinyinUtil;
import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository; import com.chint.domain.repository.RouteRepository;
import com.chint.infrastructure.util.Digest; import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.user.UserHttpRequest; import com.chint.interfaces.rest.user.UserHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +18,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
@Slf4j
@SpringBootTest @SpringBootTest
class RouteApplicationTests { class RouteApplicationTests {
@ -28,6 +31,8 @@ class RouteApplicationTests {
@Autowired @Autowired
private RouteRepository routeRepository; private RouteRepository routeRepository;
@Autowired
private OrderDetailRepository orderDetailRepository;
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); 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); LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter);
System.out.println(parse); System.out.println(parse);
} }
@Test // @Test
void loginSign() { void loginSign() {
String sfno = "230615020"; String sfno = "230615020";
String syscode = "abc"; String syscode = "FSSC";
String billcode = "CCC12321412323"; String billcode = "CLSQ240225000099";
String companycode = "A30000001"; String companycode = "正泰集团股份有限公司";
String sec = "Superdandan"; String sec = "Superdandan";
String timespan = "12312321412312"; String timespan = "1708908662738";
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan); String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
System.out.println(s); System.out.println(s);
// log.info("info");
// log.trace("trace");
// log.trace("trace");
// log.trace("trace");
} }
// @Test // @Test
@ -92,4 +101,16 @@ class RouteApplicationTests {
routeRepository.deleteById(19L); routeRepository.deleteById(19L);
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);
}
} }