完成超标状态回推bpm代码
This commit is contained in:
parent
d815148587
commit
9ab000791e
|
@ -0,0 +1,26 @@
|
||||||
|
package com.chint.application.commands;
|
||||||
|
|
||||||
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BPMAuditCommand extends Command {
|
||||||
|
private String orderNo;
|
||||||
|
private Integer productType;
|
||||||
|
private Object extensionData;
|
||||||
|
|
||||||
|
public BPMAuditCommand orderNo(String orderNo) {
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BPMAuditCommand productType(Integer productType) {
|
||||||
|
this.productType = productType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BPMAuditCommand extensionData(Object extensionData) {
|
||||||
|
this.extensionData = extensionData;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.chint.application.dtos;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SupplierLoginParam {
|
||||||
|
private Long routeId;
|
||||||
|
}
|
|
@ -50,15 +50,15 @@ public class RankController {
|
||||||
return Result.Success(SUCCESS, save);
|
return Result.Success(SUCCESS, save);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
// @Transactional
|
||||||
@ApiOperation("添加差标")
|
// @ApiOperation("添加差标")
|
||||||
@PostMapping("/add/standards")
|
// @PostMapping("/add/standards")
|
||||||
public Result<Ranks> addStandardsToRanks(@RequestBody StandardsData standardsData) {
|
// public Result<Ranks> addStandardsToRanks(@RequestBody StandardsData standardsData) {
|
||||||
Ranks ranks = ranksRepository.queryById(standardsData.getRanksId());
|
// Ranks ranks = ranksRepository.queryById(standardsData.getRanksId());
|
||||||
DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(standardsData);
|
// DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(standardsData);
|
||||||
ranks.addStandards(differenceStandards);
|
// ranks.addStandards(differenceStandards);
|
||||||
return Result.Success(SUCCESS, ranks);
|
// return Result.Success(SUCCESS, ranks);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("修改差标")
|
@ApiOperation("修改差标")
|
||||||
|
@ -76,7 +76,7 @@ public class RankController {
|
||||||
ranks.setIndustry(ranksdata.getIndustry());
|
ranks.setIndustry(ranksdata.getIndustry());
|
||||||
if (ranksdata.getStandardsData() != null) {
|
if (ranksdata.getStandardsData() != null) {
|
||||||
DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(ranksdata.getStandardsData());
|
DifferenceStandards differenceStandards = ranksFactory.createDifferenceStandards(ranksdata.getStandardsData());
|
||||||
ranks.addStandards(differenceStandards);
|
// ranks.addStandards(differenceStandards);
|
||||||
}
|
}
|
||||||
ranksRepository.save(ranks);
|
ranksRepository.save(ranks);
|
||||||
return Result.Success(SUCCESS, ranks);
|
return Result.Success(SUCCESS, ranks);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.application.out;
|
package com.chint.application.out;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chint.application.dtos.SupplierLoginParam;
|
||||||
import com.chint.application.services.SupplierLoginService;
|
import com.chint.application.services.SupplierLoginService;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
||||||
|
@ -23,30 +24,30 @@ public class SupplierLoginController {
|
||||||
|
|
||||||
@ApiOperation("单点登录同程-移动")
|
@ApiOperation("单点登录同程-移动")
|
||||||
@PostMapping("/ly/login")
|
@PostMapping("/ly/login")
|
||||||
public Result<LYRedirectUrlResponse> lyLogin() {
|
public Result<LYRedirectUrlResponse> lyLogin(SupplierLoginParam supplierLoginParam) {
|
||||||
//登录
|
//登录
|
||||||
LYRedirectUrlResponse data = supplierLoginService.lyLogin();
|
LYRedirectUrlResponse data = supplierLoginService.lyLogin(supplierLoginParam);
|
||||||
return Result.Success(SUCCESS, data);
|
return Result.Success(SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("单点登录同程-PC")
|
@ApiOperation("单点登录同程-PC")
|
||||||
@PostMapping("/ly/login/pc")
|
@PostMapping("/ly/login/pc")
|
||||||
public Result<LYRedirectUrlResponse> lyLoginPC() {
|
public Result<LYRedirectUrlResponse> lyLoginPC(SupplierLoginParam supplierLoginParam) {
|
||||||
//登录
|
//登录
|
||||||
LYRedirectUrlResponse data = supplierLoginService.lyLoginPC();
|
LYRedirectUrlResponse data = supplierLoginService.lyLoginPC(supplierLoginParam);
|
||||||
return Result.Success(SUCCESS, data);
|
return Result.Success(SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-移动")
|
@ApiOperation("单点登录携程-移动")
|
||||||
@PostMapping("/CTrip/login")
|
@PostMapping("/CTrip/login")
|
||||||
public Result<H5Response> cTripLogin() {
|
public Result<H5Response> cTripLogin(SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLogin());
|
return Result.Success(SUCCESS, supplierLoginService.cTripLogin(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("单点登录携程-PC")
|
@ApiOperation("单点登录携程-PC")
|
||||||
@PostMapping("/CTrip/login/pc")
|
@PostMapping("/CTrip/login/pc")
|
||||||
public Result<PCResponse> cTripLoginPC() {
|
public Result<PCResponse> cTripLoginPC(SupplierLoginParam supplierLoginParam) {
|
||||||
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC());
|
return Result.Success(SUCCESS, supplierLoginService.cTripLoginPC(supplierLoginParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.chint.application.services;
|
package com.chint.application.services;
|
||||||
|
|
||||||
|
import com.chint.application.dtos.SupplierLoginParam;
|
||||||
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
|
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
||||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||||
|
@ -7,7 +10,6 @@ import com.chint.interfaces.rest.ly.LYLoginRequest;
|
||||||
import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse;
|
import com.chint.interfaces.rest.ly.dto.login.LYRedirectUrlResponse;
|
||||||
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.yaml.snakeyaml.extensions.compactnotation.PackageCompactConstructor;
|
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.L_Y_ENTRANCE_HOME;
|
import static com.chint.infrastructure.constant.Constant.L_Y_ENTRANCE_HOME;
|
||||||
|
|
||||||
|
@ -20,21 +22,30 @@ public class SupplierLoginService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CTripLoginRequest cTripLoginRequest;
|
private CTripLoginRequest cTripLoginRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RouteRepository routeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录接口
|
* 登录接口
|
||||||
*/
|
*/
|
||||||
public LYRedirectUrlResponse lyLogin() {
|
public LYRedirectUrlResponse lyLogin(SupplierLoginParam supplierLoginParam) {
|
||||||
return lyLoginRequest.login(L_Y_ENTRANCE_HOME);
|
return lyLoginRequest.login(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LYRedirectUrlResponse lyLoginPC() {
|
public LYRedirectUrlResponse lyLoginPC(SupplierLoginParam supplierLoginParam) {
|
||||||
return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME);
|
return lyLoginRequest.loginPC(L_Y_ENTRANCE_HOME, getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public H5Response cTripLogin() {
|
public H5Response cTripLogin(SupplierLoginParam supplierLoginParam) {
|
||||||
return cTripLoginRequest.hSingleLogin();
|
return cTripLoginRequest.hSingleLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
}
|
}
|
||||||
public PCResponse cTripLoginPC() {
|
|
||||||
return cTripLoginRequest.authLogin();
|
public PCResponse cTripLoginPC(SupplierLoginParam supplierLoginParam) {
|
||||||
|
return cTripLoginRequest.authLogin(getEmployeeNo(supplierLoginParam.getRouteId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getEmployeeNo(Long routeId) {
|
||||||
|
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||||
|
return routeOrder.getUserId().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,4 +15,6 @@ public class ApproveOrderNo {
|
||||||
private String accountCompany;
|
private String accountCompany;
|
||||||
@ApiModelProperty("申请说明")
|
@ApiModelProperty("申请说明")
|
||||||
private String instructions;
|
private String instructions;
|
||||||
|
@ApiModelProperty("财务共享订单创建人")
|
||||||
|
private String creator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.chint.domain.aggregates.order;
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
import com.chint.domain.value_object.enums.CurrencyType;
|
import com.chint.domain.value_object.enums.CurrencyType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
@ -12,8 +13,7 @@ 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.Constant.ORDER_EVENT_PREPARE_NAME;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
import static com.chint.infrastructure.constant.Constant.ORDER_EVENT_UNKNOWN;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Table("order_detail")
|
@Table("order_detail")
|
||||||
|
@ -97,6 +97,17 @@ public class OrderDetail {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getExtensionDataByProductType() {
|
||||||
|
return switch (this.productType) {
|
||||||
|
case LEG_TYPE_TRAIN -> this.trainOrderDetail;
|
||||||
|
case LEG_TYPE_AIRPLANE -> this.flightOrderDetail;
|
||||||
|
case LEG_TYPE_HOTEL -> this.hotelOrderDetail;
|
||||||
|
case LEG_TYPE_TAXI -> this.carOrderDetail;
|
||||||
|
case LEG_TYPE_OTHER -> this.otherOrderDetail;
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public OrderDetail addCarOrderData(CarOrderDetail carOrderDetail) {
|
public OrderDetail addCarOrderData(CarOrderDetail carOrderDetail) {
|
||||||
this.carOrderDetail = carOrderDetail;
|
this.carOrderDetail = carOrderDetail;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class OrderEvent {
|
||||||
case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME;
|
case ORDER_EVENT_REFUND -> ORDER_EVENT_REFUND_NAME;
|
||||||
case ORDER_EVENT_UNKNOWN -> ORDER_EVENT_UNKNOWN_NAME;
|
case ORDER_EVENT_UNKNOWN -> ORDER_EVENT_UNKNOWN_NAME;
|
||||||
case ORDER_EVENT_FINISH -> ORDER_EVENT_FINISH_NAME;
|
case ORDER_EVENT_FINISH -> ORDER_EVENT_FINISH_NAME;
|
||||||
|
case ORDER_EVENT_ETA -> ORDER_EVENT_ETA_NAME;
|
||||||
default -> "未知事件";
|
default -> "未知事件";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,5 @@ public interface OrderDetailRepository {
|
||||||
Optional<OrderDetail> findByOrderNo(String orderNo);
|
Optional<OrderDetail> findByOrderNo(String orderNo);
|
||||||
|
|
||||||
OrderDetail save(OrderDetail orderDetail);
|
OrderDetail save(OrderDetail orderDetail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ public interface RouteRepository {
|
||||||
|
|
||||||
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RouteOrder findByOrderNo(String orderNo);
|
RouteOrder findByOrderNo(String orderNo);
|
||||||
Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData);
|
Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.chint.domain.service;
|
package com.chint.domain.service;
|
||||||
|
|
||||||
|
import com.chint.application.commands.BPMAuditCommand;
|
||||||
import com.chint.application.commands.OrderApprovalCommand;
|
import com.chint.application.commands.OrderApprovalCommand;
|
||||||
import com.chint.application.commands.OrderCreateCommand;
|
import com.chint.application.commands.OrderCreateCommand;
|
||||||
import com.chint.application.commands.OrderStatusChangeCommand;
|
import com.chint.application.commands.OrderStatusChangeCommand;
|
||||||
import com.chint.domain.aggregates.order.ApprovalEvent;
|
import com.chint.domain.aggregates.order.*;
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
|
||||||
import com.chint.domain.aggregates.order.OrderEvent;
|
|
||||||
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.exceptions.NotFoundException;
|
||||||
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||||
import com.chint.domain.repository.LocationRepository;
|
import com.chint.domain.repository.LocationRepository;
|
||||||
|
@ -17,7 +16,11 @@ import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.value_object.ApprovalLegData;
|
import com.chint.domain.value_object.ApprovalLegData;
|
||||||
import com.chint.domain.value_object.UserLoginParam;
|
import com.chint.domain.value_object.UserLoginParam;
|
||||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
|
import com.chint.infrastructure.util.DelayDispatch;
|
||||||
|
import com.chint.interfaces.rest.bpm.BPMParamFactory;
|
||||||
|
import com.chint.interfaces.rest.bpm.BPMRequest;
|
||||||
|
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||||
import com.chint.interfaces.rest.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;
|
||||||
|
@ -25,7 +28,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.APPROVAL_EVENT_PREPARE;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OrderDomainService {
|
public class OrderDomainService {
|
||||||
|
@ -50,6 +53,13 @@ public class OrderDomainService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserHttpRequest userHttpRequest;
|
private UserHttpRequest userHttpRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BPMParamFactory bpmParamFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BPMRequest bpmRequest;
|
||||||
|
|
||||||
|
|
||||||
public RouteOrder saveOrder(RouteOrder routeOrder) {
|
public RouteOrder saveOrder(RouteOrder routeOrder) {
|
||||||
return routeRepository.save(routeOrder);
|
return routeRepository.save(routeOrder);
|
||||||
}
|
}
|
||||||
|
@ -93,15 +103,39 @@ 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 -> {
|
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {
|
||||||
OrderEvent event = orderDetailFactory.createEvent(command.getOrderEventType(), command.getOutStatus());
|
String outStatus = command.getOutStatus();
|
||||||
|
Integer orderEventType = command.getOrderEventType();
|
||||||
|
OrderEvent event = orderDetailFactory.createEvent(orderEventType,
|
||||||
|
outStatus);
|
||||||
orderDetail.addOrderEvent(event);
|
orderDetail.addOrderEvent(event);
|
||||||
orderDetailRepository.save(orderDetail);
|
orderDetailRepository.save(orderDetail);
|
||||||
|
|
||||||
|
if (orderEventType.equals(ORDER_EVENT_ETA)) {
|
||||||
|
//这里如果发现事件的状态为ORDER_EVENT_ETA
|
||||||
|
//需要根据发送审批给bpm
|
||||||
|
//根据订单类型获取不同的订单扩展明细
|
||||||
|
orderDetail.getExtensionDataByProductType();
|
||||||
|
Command.of(BPMAuditCommand.class)
|
||||||
|
.orderNo(orderDetail.getOrderNo())
|
||||||
|
.productType(orderDetail.getProductType())
|
||||||
|
.extensionData(orderDetail.getExtensionDataByProductType())
|
||||||
|
.sendToQueue();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//这里如果发现事件的状态为Approving2 , 需要根据发送审批给bpm,需要先查询订单数据
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void legAutoAddOrder(){
|
@ListenTo(command = "BPMAuditCommand", order = 0)
|
||||||
|
public void toBpmAudit(BPMAuditCommand command) {
|
||||||
|
Object data = command.getExtensionData();
|
||||||
|
ExceedStandardDto exceedStandardDto = switch (command.getProductType()) {
|
||||||
|
case LEG_TYPE_TRAIN -> bpmParamFactory.creatAuditParamByTrain((TrainOrderDetail) data);
|
||||||
|
case LEG_TYPE_AIRPLANE -> bpmParamFactory.creatAuditParamByFlight((FlightOrderDetail) data);
|
||||||
|
case LEG_TYPE_HOTEL -> bpmParamFactory.creatAuditParamByHotel((HotelOrderDetail) data);
|
||||||
|
case LEG_TYPE_TAXI -> bpmParamFactory.creatAuditParamByCar((CarOrderDetail) data);
|
||||||
|
case LEG_TYPE_OTHER -> bpmParamFactory.creatAuditParamByOther((OtherOrderDetail) data);
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto).getSuccess(),
|
||||||
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class LegEventHandler implements LegEventService {
|
||||||
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());
|
||||||
//这里order所有的leg触发approve事件
|
//这里order所有的leg触发approve事件
|
||||||
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
||||||
legEventFactory.creatLegEvent(command.getLegEventType())
|
legEventFactory.creatLegEvent(command.getLegEventType())
|
||||||
|
|
|
@ -8,4 +8,5 @@ public class ApprovalLegData {
|
||||||
// private String fakeOrderNo;
|
// private String fakeOrderNo;
|
||||||
private String actualOrderNo;
|
private String actualOrderNo;
|
||||||
private String sysCode;
|
private String sysCode;
|
||||||
|
private String creator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,5 @@ public class ApproveLegData {
|
||||||
private String accountCompany;
|
private String accountCompany;
|
||||||
private String sysCode;
|
private String sysCode;
|
||||||
private String instructions;
|
private String instructions;
|
||||||
|
private String creator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,8 @@ public class Constant {
|
||||||
public static final String ORDER_EVENT_FINISH_NAME = "已完成";
|
public static final String ORDER_EVENT_FINISH_NAME = "已完成";
|
||||||
public static final int ORDER_EVENT_CANCEL = -1;
|
public static final int ORDER_EVENT_CANCEL = -1;
|
||||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||||
|
public static final int ORDER_EVENT_ETA = -2;
|
||||||
|
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 = "未知事件";
|
||||||
|
|
||||||
|
@ -196,8 +198,13 @@ public class Constant {
|
||||||
public static final String TRAVEL_RANK_PATH = "/fssc/queryBill/queryTravelLevelByRank";
|
public static final String TRAVEL_RANK_PATH = "/fssc/queryBill/queryTravelLevelByRank";
|
||||||
public static final String SUPPLIER_C_TRIP = "CTrip";
|
public static final String SUPPLIER_C_TRIP = "CTrip";
|
||||||
public static final String SUPPLIER_C_TRIP_CN_NAME = "携程";
|
public static final String SUPPLIER_C_TRIP_CN_NAME = "携程";
|
||||||
|
public static final String SUPPLIER_C_TRIP_EXTENSION_NAME = "携程预定";
|
||||||
|
public static final String SUPPLIER_C_TRIP_BPM_NAME = "携程商旅";
|
||||||
|
|
||||||
public static final String SUPPLIER_L_Y = "LY";
|
public static final String SUPPLIER_L_Y = "LY";
|
||||||
public static final String SUPPLIER_L_Y_CN_NAME = "同程";
|
public static final String SUPPLIER_L_Y_CN_NAME = "同程";
|
||||||
|
public static final String SUPPLIER_L_Y_EXTENSION_NAME = "同程预定";
|
||||||
|
public static final String SUPPLIER_L_Y_BPM_NAME = "同程商旅";
|
||||||
|
|
||||||
// 携程
|
// 携程
|
||||||
public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket";
|
public static final String TICKET_PATH = "/SwitchAPI/Order/Ticket";
|
||||||
|
@ -296,4 +303,10 @@ public class Constant {
|
||||||
|
|
||||||
//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 EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
|
||||||
|
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
|
||||||
|
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
|
||||||
|
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称
|
||||||
|
public static final String EXCEED_STANDARD_TYPE_CAR = "用车超标";//方法名称
|
||||||
|
public static final String EXCEED_STANDARD_TYPE_OTHER = "其他超标";//方法名称
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.chint.infrastructure.repository;
|
package com.chint.infrastructure.repository;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.user.User;
|
|
||||||
import com.chint.domain.repository.RouteRepository;
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.domain.value_object.OrderQueryData;
|
import com.chint.domain.value_object.OrderQueryData;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
||||||
|
@ -51,19 +50,27 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
public Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData) {
|
public Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData) {
|
||||||
PageRequest sort = PageRequest
|
PageRequest sort = PageRequest
|
||||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||||
return jdbcRouteRepository
|
return jdbcRouteRepository
|
||||||
.findByCreateUserAndRouteOrderNoContaining(currentUser.getUserId().toString()
|
.findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(
|
||||||
, orderQueryData.getOrderNo(), sort);
|
Long.valueOf(employeeNo),
|
||||||
|
orderQueryData.getOrderNo(),
|
||||||
|
employeeNo,
|
||||||
|
orderQueryData.getOrderNo(),
|
||||||
|
sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<RouteOrder> findByInstructions(OrderQueryData orderQueryData) {
|
public Page<RouteOrder> findByInstructions(OrderQueryData orderQueryData) {
|
||||||
PageRequest sort = PageRequest
|
PageRequest sort = PageRequest
|
||||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||||
return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_InstructionsContaining(currentUser.getUserId().toString(),
|
return jdbcRouteRepository.findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(
|
||||||
orderQueryData.getInstructions(),sort);
|
Long.valueOf(employeeNo),
|
||||||
|
orderQueryData.getInstructions(),
|
||||||
|
employeeNo,
|
||||||
|
orderQueryData.getInstructions(),
|
||||||
|
sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,9 +82,9 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
public PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData) {
|
public PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData) {
|
||||||
PageRequest sort = PageRequest
|
PageRequest sort = PageRequest
|
||||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||||
Page<RouteOrder> byUserId = jdbcRouteRepository
|
Page<RouteOrder> byUserId = jdbcRouteRepository
|
||||||
.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString(), sort);
|
.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo, sort);
|
||||||
List<RouteOrder> orders = byUserId.toList();
|
List<RouteOrder> orders = byUserId.toList();
|
||||||
orders.forEach(RouteOrder::reloadStatus);
|
orders.forEach(RouteOrder::reloadStatus);
|
||||||
return new PageResult<>(byUserId.getTotalElements(), orders);
|
return new PageResult<>(byUserId.getTotalElements(), orders);
|
||||||
|
@ -85,7 +92,7 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData) {
|
public List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||||
return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString());
|
return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@ package com.chint.infrastructure.repository.jdbc;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,19 +14,26 @@ import java.util.List;
|
||||||
public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
public interface JdbcRouteRepository extends CrudRepository<RouteOrder, Long> {
|
||||||
Page<RouteOrder> findByCreateUser(String userId, Pageable pageable);
|
Page<RouteOrder> findByCreateUser(String userId, Pageable pageable);
|
||||||
|
|
||||||
Page<RouteOrder> findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String userId, Pageable pageable);
|
|
||||||
|
|
||||||
RouteOrder findByRouteId(Long routeId);
|
RouteOrder findByRouteId(Long routeId);
|
||||||
|
|
||||||
RouteOrder findByApproveOrderNo_FakeOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_fakeOrderNo, String sysCode);
|
RouteOrder findByApproveOrderNo_FakeOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_fakeOrderNo, String sysCode);
|
||||||
|
|
||||||
Page<RouteOrder> findByCreateUserAndApproveOrderNo_InstructionsContaining(String createUser, String approveOrderNo_instructions, Pageable pageable);
|
|
||||||
|
|
||||||
RouteOrder findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_actualOrderNo, String approveOrderNo_sysCode);
|
RouteOrder findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(String approveOrderNo_actualOrderNo, String approveOrderNo_sysCode);
|
||||||
|
|
||||||
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
RouteOrder findByRouteOrderNo(String routeOrderNo);
|
||||||
|
|
||||||
List<RouteOrder> findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String createUser);
|
|
||||||
|
|
||||||
Page<RouteOrder> findByCreateUserAndRouteOrderNoContaining(String createUser, String routeOrderNo, Pageable pageable);
|
Page<RouteOrder> findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(Long userId, String routeOrderNo, String approveOrderNo_creator, String routeOrderNo2, Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
Page<RouteOrder> findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(Long userId, String approveOrderNo_instructions, String approveOrderNo_creator, String approveOrderNo_instructions2, Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
Page<RouteOrder> findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator, Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<RouteOrder> findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long userId, String approveOrderNo_creator);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.chint.infrastructure.util;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class DelayDispatch {
|
||||||
|
|
||||||
|
public static void attemptToSend(Supplier<Boolean> requestSupplier, int attempt) {
|
||||||
|
if (attempt >= 5) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean success = requestSupplier.get(); // 使用Supplier<Boolean>获取请求成功与否的状态
|
||||||
|
if (!success) {
|
||||||
|
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
scheduler.schedule(() -> {
|
||||||
|
try {
|
||||||
|
attemptToSend(requestSupplier, attempt + 1);
|
||||||
|
} finally {
|
||||||
|
scheduler.shutdown(); // 确保在任务执行完毕后关闭scheduler
|
||||||
|
}
|
||||||
|
}, 30, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.chint.interfaces.rest.bpm;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.order.*;
|
||||||
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
|
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class BPMParamFactory {
|
||||||
|
|
||||||
|
public ExceedStandardDto creatAuditParamByCar(CarOrderDetail carOrderDetail) {
|
||||||
|
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||||
|
exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR)
|
||||||
|
.setOrderSource(getSupplierName(carOrderDetail.getSupplier()))
|
||||||
|
.setOrderNo(carOrderDetail.getOrderNo())
|
||||||
|
.setExcessAmount(BigDecimal.valueOf(Double.parseDouble(carOrderDetail.getOrderAmount())))
|
||||||
|
.setReason(carOrderDetail.getOverStandardReason());
|
||||||
|
return exceedStandardDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExceedStandardDto creatAuditParamByTrain(TrainOrderDetail trainOrderDetail) {
|
||||||
|
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||||
|
exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_TRAIN)
|
||||||
|
.setSeatingStandard(trainOrderDetail.getSeatName())
|
||||||
|
.setOrderSource(getSupplierName(trainOrderDetail.getSupplier()))
|
||||||
|
.setOrderNo(trainOrderDetail.getOrderNo())
|
||||||
|
.setExcessAmount(BigDecimal.valueOf(Double.parseDouble(trainOrderDetail.getOrderAmount())))
|
||||||
|
.setReason(trainOrderDetail.getOverStandardReason());
|
||||||
|
return exceedStandardDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExceedStandardDto creatAuditParamByHotel(HotelOrderDetail hotelOrderDetail) {
|
||||||
|
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||||
|
exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_HOTEL)
|
||||||
|
.setHotelStandard(hotelOrderDetail.getStarRate())
|
||||||
|
.setHouseLayout(hotelOrderDetail.getRoomTypeName())
|
||||||
|
.setHotelName(hotelOrderDetail.getHotelName())
|
||||||
|
.setOrderSource(getSupplierName(hotelOrderDetail.getSupplier()))
|
||||||
|
.setOrderNo(hotelOrderDetail.getOrderNo())
|
||||||
|
.setExcessAmount(BigDecimal.valueOf(Double.parseDouble(hotelOrderDetail.getOrderAmount())))
|
||||||
|
.setReason(hotelOrderDetail.getOverStandardReason());
|
||||||
|
return exceedStandardDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExceedStandardDto creatAuditParamByFlight(FlightOrderDetail flightOrderDetail) {
|
||||||
|
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||||
|
exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR)
|
||||||
|
.setCabinClass(flightOrderDetail.getSeatPointName())
|
||||||
|
.setOrderSource(getSupplierName(flightOrderDetail.getSupplier()))
|
||||||
|
.setOrderNo(flightOrderDetail.getOrderNo())
|
||||||
|
.setExcessAmount(BigDecimal.valueOf(Double.parseDouble(flightOrderDetail.getOrderAmount())))
|
||||||
|
.setReason(flightOrderDetail.getOverStandardReason());
|
||||||
|
return exceedStandardDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExceedStandardDto creatAuditParamByOther(OtherOrderDetail otherOrderDetail) {
|
||||||
|
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
|
||||||
|
// exceedStandardDto.setOrderType(EXCEED_STANDARD_TYPE_CAR)
|
||||||
|
// .setOrderSource(getSupplierName(carOrderDetail.getSupplier()))
|
||||||
|
// .setOrderNo(carOrderDetail.getOrderNo())
|
||||||
|
// .setExcessAmount(BigDecimal.valueOf(Double.parseDouble(carOrderDetail.getOrderAmount())))
|
||||||
|
// .setReason(carOrderDetail.getOverStandardReason());
|
||||||
|
return exceedStandardDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getSupplierName(String supplier) {
|
||||||
|
return switch (supplier) {
|
||||||
|
case SUPPLIER_C_TRIP_EXTENSION_NAME -> SUPPLIER_C_TRIP_BPM_NAME;
|
||||||
|
case SUPPLIER_L_Y_EXTENSION_NAME -> SUPPLIER_L_Y_BPM_NAME;
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package com.chint.interfaces.rest.ly;
|
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.ly.dto.bpm.BPMBaseRequest;
|
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
import com.chint.interfaces.rest.bpm.dot.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.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.chint.interfaces.rest.ly.dto.bpm;
|
package com.chint.interfaces.rest.bpm.dot;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.chint.interfaces.rest.ly.dto.bpm;
|
package com.chint.interfaces.rest.bpm.dot;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.chint.interfaces.rest.ly.dto.bpm;
|
package com.chint.interfaces.rest.bpm.dot;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.chint.interfaces.rest.ly.dto.bpm;
|
package com.chint.interfaces.rest.bpm.dot;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
|
@ -71,14 +71,16 @@ public class CTripLoginRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PCResponse authLogin() {
|
public PCResponse authLogin(String employeeNo) {
|
||||||
|
String employeeId;
|
||||||
|
if (employeeNo == null) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
String employeeId = String.valueOf(
|
employeeId = currentUser.getEmployeeNo().toString();
|
||||||
currentUser.getEmployeeNo()
|
} else {
|
||||||
);
|
employeeId = employeeNo;
|
||||||
CTripAuthLoginParam authLoginParam = CTripAuthLoginParam.of(String.valueOf(
|
}
|
||||||
employeeId
|
|
||||||
));
|
CTripAuthLoginParam authLoginParam = CTripAuthLoginParam.of(employeeId);
|
||||||
authLoginParam.setForCorp(0);
|
authLoginParam.setForCorp(0);
|
||||||
String ticket = loadLoginToken();
|
String ticket = loadLoginToken();
|
||||||
|
|
||||||
|
@ -144,12 +146,17 @@ public class CTripLoginRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public H5Response hSingleLogin() {
|
public H5Response hSingleLogin(String employeeNo) {
|
||||||
CTripHSingleLoginParam hSingleLoginParam = new CTripHSingleLoginParam();
|
CTripHSingleLoginParam hSingleLoginParam = new CTripHSingleLoginParam();
|
||||||
|
String employeeId;
|
||||||
|
if (employeeNo == null) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
employeeId = String.valueOf(currentUser.getEmployeeNo());
|
||||||
|
} else {
|
||||||
|
employeeId = employeeNo;
|
||||||
|
}
|
||||||
String token = loadLoginToken();
|
String token = loadLoginToken();
|
||||||
String accessUserId = C_TRIP_APP_KEY;
|
String accessUserId = C_TRIP_APP_KEY;
|
||||||
String employeeId = String.valueOf(currentUser.getEmployeeNo());
|
|
||||||
String corpPayType = StringUtils.isNotBlank(hSingleLoginParam.getCorpPayType()) ?
|
String corpPayType = StringUtils.isNotBlank(hSingleLoginParam.getCorpPayType()) ?
|
||||||
hSingleLoginParam.getCorpPayType() : "public";
|
hSingleLoginParam.getCorpPayType() : "public";
|
||||||
|
|
||||||
|
@ -216,20 +223,22 @@ public class CTripLoginRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public H5Response h5Login() {
|
public H5Response h5Login(String employeeNo) {
|
||||||
|
String employeeId;
|
||||||
|
if (employeeNo == null) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
employeeId = String.valueOf(currentUser.getEmployeeNo());
|
||||||
|
} else {
|
||||||
|
employeeId = employeeNo;
|
||||||
|
}
|
||||||
CTripHSingleLoginParam cTripHSingleLoginParam = new CTripHSingleLoginParam();
|
CTripHSingleLoginParam cTripHSingleLoginParam = new CTripHSingleLoginParam();
|
||||||
cTripHSingleLoginParam.setAppId(C_TRIP_APP_KEY);
|
cTripHSingleLoginParam.setAppId(C_TRIP_APP_KEY);
|
||||||
cTripHSingleLoginParam.setEmployeeId(String.valueOf(currentUser.getEmployeeNo()));
|
cTripHSingleLoginParam.setEmployeeId(String.valueOf(employeeId));
|
||||||
cTripHSingleLoginParam.setToken(tokenRequest.getToken());
|
cTripHSingleLoginParam.setToken(tokenRequest.getToken());
|
||||||
cTripHSingleLoginParam.setAppId("zhengtai");
|
cTripHSingleLoginParam.setAppId("zhengtai");
|
||||||
cTripHSingleLoginParam.setCorpPayType("public");
|
cTripHSingleLoginParam.setCorpPayType("public");
|
||||||
|
|
||||||
|
|
||||||
String finallySign =
|
String finallySign =
|
||||||
Digest.md5(C_TRIP_APP_KEY + currentUser.getEmployeeNo() + "public" + Digest.md5(C_TRIP_APP_SECURITY));
|
Digest.md5(C_TRIP_APP_KEY + employeeId + "public" + Digest.md5(C_TRIP_APP_SECURITY));
|
||||||
cTripHSingleLoginParam.setSignature(finallySign);
|
cTripHSingleLoginParam.setSignature(finallySign);
|
||||||
|
|
||||||
return postRequest.post(hSinngleLoginUrl, cTripHSingleLoginParam, H5Response.class);
|
return postRequest.post(hSinngleLoginUrl, cTripHSingleLoginParam, H5Response.class);
|
||||||
|
|
|
@ -19,27 +19,27 @@ public class LYLoginRequest {
|
||||||
|
|
||||||
private final String loginUrl = L_Y_BASE_URL + L_Y_LOGIN_PATH;
|
private final String loginUrl = L_Y_BASE_URL + L_Y_LOGIN_PATH;
|
||||||
|
|
||||||
public LYRedirectUrlResponse login(Integer entrance) {
|
public LYRedirectUrlResponse login(Integer entrance, String employeeNo) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
return getLyRedirectUrlResponse(entrance, employeeNo, L_Y_PLAT_H5);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LYRedirectUrlResponse getLyRedirectUrlResponse(Integer entrance, String employeeNo, Integer lYPlatH5) {
|
||||||
LoginTokenData loginTokenData = new LoginTokenData();
|
LoginTokenData loginTokenData = new LoginTokenData();
|
||||||
LoginParam loginParam = new LoginParam();
|
LoginParam loginParam = new LoginParam();
|
||||||
|
if(employeeNo == null){
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo()));
|
loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo()));
|
||||||
loginParam.setPlat(L_Y_PLAT_H5);
|
} else {
|
||||||
|
loginParam.setOutEmployeeId(employeeNo);
|
||||||
|
}
|
||||||
|
loginParam.setPlat(lYPlatH5);
|
||||||
loginParam.setEntrance(entrance);
|
loginParam.setEntrance(entrance);
|
||||||
loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL);
|
loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL);
|
||||||
loginTokenData.setParam(loginParam);
|
loginTokenData.setParam(loginParam);
|
||||||
return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class);
|
return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LYRedirectUrlResponse loginPC(Integer entrance) {
|
public LYRedirectUrlResponse loginPC(Integer entrance, String employeeNo) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
return getLyRedirectUrlResponse(entrance, employeeNo, L_Y_PLAT_PC);
|
||||||
LoginTokenData loginTokenData = new LoginTokenData();
|
|
||||||
LoginParam loginParam = new LoginParam();
|
|
||||||
loginParam.setOutEmployeeId(String.valueOf(currentUser.getEmployeeNo()));
|
|
||||||
loginParam.setPlat(L_Y_PLAT_PC);
|
|
||||||
loginParam.setEntrance(entrance);
|
|
||||||
loginParam.setTravelType(L_Y_TRAVEL_TYPE_ALL);
|
|
||||||
loginTokenData.setParam(loginParam);
|
|
||||||
return postRequest.post(loginUrl, loginTokenData, LYRedirectUrlResponse.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,3 +13,10 @@ chint:
|
||||||
|
|
||||||
cTrip:
|
cTrip:
|
||||||
baseUrl: https://ct.ctrip.com
|
baseUrl: https://ct.ctrip.com
|
||||||
|
auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi
|
||||||
|
appId: zhengtai2024
|
||||||
|
corpId: zhengtai2024
|
||||||
|
appKey: obk_zhengtai2024
|
||||||
|
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
|
||||||
|
requestSecret: zhengtai2024_nEbmKfOo
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,9 @@ logging:
|
||||||
|
|
||||||
cTrip:
|
cTrip:
|
||||||
baseUrl: https://ct.ctrip.com
|
baseUrl: https://ct.ctrip.com
|
||||||
|
auditBaseUrl: https://gateway-fat.ctripqa.com/switchapi
|
||||||
|
appId: zhengtai2024
|
||||||
|
corpId: zhengtai2024
|
||||||
|
appKey: obk_zhengtai2024
|
||||||
|
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
|
||||||
|
requestSecret: zhengtai2024_nEbmKfOo
|
|
@ -93,7 +93,7 @@ public class CTripTest {
|
||||||
//@Test
|
//@Test
|
||||||
void authLogin() {
|
void authLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
PCResponse response = loginRequest.authLogin();
|
PCResponse response = loginRequest.authLogin(null);
|
||||||
System.out.println(response.getRedirectUrl());
|
System.out.println(response.getRedirectUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,13 +101,13 @@ public class CTripTest {
|
||||||
//@Test
|
//@Test
|
||||||
void hSingleLogin() {
|
void hSingleLogin() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.hSingleLogin().getRedirectUrl());
|
System.out.println(loginRequest.hSingleLogin(null).getRedirectUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
void h5LoginTest() {
|
void h5LoginTest() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.h5Login());
|
System.out.println(loginRequest.h5Login(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.chint;
|
package com.chint;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.base.BaseEntity;
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.infrastructure.constant.Constant;
|
import com.chint.infrastructure.constant.Constant;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
@ -10,19 +9,14 @@ 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.ly.dto.bpm.BPMBaseRequest;
|
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.BPMResponse;
|
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.ExceedStandardDto;
|
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
|
||||||
import com.chint.interfaces.rest.ly.dto.bpm.RescheduleDto;
|
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.HotelListVo;
|
|
||||||
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 com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
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.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
@ -31,7 +25,6 @@ import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.*;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
@ -292,13 +285,13 @@ public class LYTest {
|
||||||
// @Test
|
// @Test
|
||||||
void loginLY() {
|
void loginLY() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME));
|
System.out.println(loginRequest.login(L_Y_ENTRANCE_HOME,null));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
void loginLYPC() {
|
void loginLYPC() {
|
||||||
BaseContext.setCurrentUser(user);
|
BaseContext.setCurrentUser(user);
|
||||||
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME));
|
System.out.println(loginRequest.loginPC(L_Y_ENTRANCE_HOME,null));
|
||||||
}
|
}
|
||||||
|
|
||||||
//超标
|
//超标
|
||||||
|
|
|
@ -45,9 +45,9 @@ class RouteApplicationTests {
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "230615020";
|
String sfno = "230615021";
|
||||||
String syscode = "abc";
|
String syscode = "abc";
|
||||||
String billcode = "KKK12321412323";
|
String billcode = "NNN12321412323";
|
||||||
String companycode = "浙江正泰电器股份有限公司";
|
String companycode = "浙江正泰电器股份有限公司";
|
||||||
String sec = "Superdandan";
|
String sec = "Superdandan";
|
||||||
String timespan = "12312321412312";
|
String timespan = "12312321412312";
|
||||||
|
|
Loading…
Reference in New Issue