安能超标接口

This commit is contained in:
dengwc 2024-03-18 09:17:20 +08:00
parent 1548c8318e
commit f128c38a55
5 changed files with 77 additions and 27 deletions

View File

@ -15,6 +15,7 @@ import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.constant.RouteConstant;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.repository.jdbc.JdbcLegRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.util.DelayDispatch;
import com.chint.interfaces.rest.bpm.BPMParamFactory;
@ -52,6 +53,7 @@ import java.util.Optional;
import java.util.Set;
import static com.chint.infrastructure.constant.BPMConstant.*;
import static com.chint.infrastructure.constant.BelongSystemConstant.BELONG_SYS_CODE_ANFSSC;
import static com.chint.infrastructure.constant.CommonMessageConstant.COMPANY_NAME_IN_BLACK_LIST;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.*;
@ -104,6 +106,10 @@ public class OrderDomainService {
@Autowired
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
@Autowired
private JdbcLegRepository jdbcLegRepository;
private Set<String> companyBlackList = new HashSet<>();
public RouteOrder saveOrder(RouteOrder routeOrder) {
@ -228,14 +234,14 @@ public class OrderDomainService {
}
}
if(orderDetail.getSupplierName().equals(SUPPLIER_L_Y)){
if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TRAIN)){
if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) {
if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TRAIN)) {
lyTrainRefundGenerate(orderDetail.getOrderNo());
}
if(!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_HOTEL)){
if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_HOTEL)) {
lyHotelRefundGenerate(orderDetail.getOrderNo());
}
if(!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TAXI)){
if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TAXI)) {
lyCarRefundGenerate(orderDetail.getOrderNo());
}
}
@ -262,7 +268,7 @@ public class OrderDomainService {
String accountCompany = routeOrder.getApproveOrderNo().getAccountCompany();//用户编号
//获取公司编号
//安能超标
if ("ANFSSC".equals(sysCode)) {
if (BELONG_SYS_CODE_ANFSSC.equals(sysCode)) {
ANExceedStandardDto anExceedStandardDto = switch (command.getProductType()) {
case LEG_TYPE_TRAIN -> bpmParamFactory.ANCreatAuditParamByTrain(orderDetail);
case LEG_TYPE_AIRPLANE -> bpmParamFactory.ANCreatAuditParamByFlight(orderDetail);
@ -271,6 +277,10 @@ public class OrderDomainService {
case LEG_TYPE_OTHER -> bpmParamFactory.ANCreatAuditParamByOther(orderDetail);
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};
Long legId = orderDetail.getLegId();//节点id
Leg leg = jdbcLegRepository.findByLegId(legId);
anExceedStandardDto.setApplyNo(routeOrder.getApproveOrderNo().getFakeOrderNo())//申请单号
.setLegNo(leg == null ? "" : leg.getLegNo());//行程编号
DelayDispatch.attemptToSend(() -> bpmRequest.ANExceedStandard(anExceedStandardDto).getSuccess(),
0);
} else {
@ -284,7 +294,7 @@ public class OrderDomainService {
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};
exceedStandardDto.setReason(command.getReason());
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto, sysCode,employeeNo,accountCompany).getSuccess(),
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto, sysCode, employeeNo, accountCompany).getSuccess(),
0);
}
}
@ -367,7 +377,7 @@ public class OrderDomainService {
String employeeNo = orderDetail.getEmployeeNo();
String accountCompany = routeOrder.getApproveOrderNo().getAccountCompany();
//发送
DelayDispatch.attemptToSend(() -> bpmRequest.reschedule(rescheduleDto, sysCode,employeeNo,accountCompany).getSuccess(),
DelayDispatch.attemptToSend(() -> bpmRequest.reschedule(rescheduleDto, sysCode, employeeNo, accountCompany).getSuccess(),
0);
}
@ -533,7 +543,7 @@ public class OrderDomainService {
}
}
private void lyTrainRefundGenerate(String orderNo){
private void lyTrainRefundGenerate(String orderNo) {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail(orderNo);
TrainDetailResponse.TrainDetailData data = trainOrderDetail.getData();
if (data != null && data.getOrderStatus().equals("T") && data.getItems() != null && !data.getItems().isEmpty()) {
@ -549,18 +559,18 @@ public class OrderDomainService {
}
}
private void lyFlightRefundGenerate(String orderNo){
private void lyFlightRefundGenerate(String orderNo) {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail(orderNo);
}
private void lyHotelRefundGenerate(String orderNo){
private void lyHotelRefundGenerate(String orderNo) {
HotelDetailResponse hotelOrderDetail = lySearchRequest.getHotelOrderDetail(orderNo);
if(hotelOrderDetail == null){
if (hotelOrderDetail == null) {
return;
}
HotelDetailResponse.Data data = hotelOrderDetail.getData();
if(data != null && data.getRefundInfoList() != null && !data.getRefundInfoList().isEmpty()){
if (data != null && data.getRefundInfoList() != null && !data.getRefundInfoList().isEmpty()) {
List<com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo> refundInfoList = data.getRefundInfoList();
for (com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.RefundInfo refundInfo : refundInfoList) {
Command.of(RefundOrderGenerateCommand.class).Info(
@ -577,14 +587,14 @@ public class OrderDomainService {
}
private void lyCarRefundGenerate(String orderNo){
private void lyCarRefundGenerate(String orderNo) {
CarDetailResponse carDetailResponse = lySearchRequest.getCarDetailResponse(orderNo);
if(carDetailResponse == null){
if (carDetailResponse == null) {
return;
}
CarDetailResponse.DataWrapper data = carDetailResponse.getData();
if (data!= null) {
if(data.getPriceVarList() != null && !data.getPriceVarList().isEmpty()){
if (data != null) {
if (data.getPriceVarList() != null && !data.getPriceVarList().isEmpty()) {
for (CarDetailResponse.CarPriceVar carPriceVar : data.getPriceVarList()) {
Command.of(RefundOrderGenerateCommand.class).Info(
carPriceVar.getPriceVarNo(),

View File

@ -34,8 +34,7 @@ public class WebConfig implements WebMvcConfigurer {
//调用bean
registry.addInterceptor(getMyRequestLoggingInterceptor())
.addPathPatterns("/**")
.excludePathPatterns("/public/log/pageQuery", "/order/pageQuery", "/OrderDetail/query/page", "/order/query/**", "/location/**");
.excludePathPatterns("/public/log/pageQuery", "/order/pageQuery", "/OrderDetail/query/**", "/order/query/**", "/location/**");
}

View File

@ -17,6 +17,10 @@ public class BPMConstant {
public static final String ANBPM_EXCEED_STANDARD_URL = "/extapi/businessTravel/exceeding";//安能超标流程地址
public static final String CHINT_TRIP_TAG = "chint-trip";//差旅系统标识
public static final String CHINT_CB_TAG = "CB";//超标
public static final String CHINT_GQ_TAG = "GQ";//改签
public static final String CHINT_TP_TAG = "TP";//退票
public static final String CHINT_BG_TAG = "BG";//变更
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称

View File

@ -14,4 +14,6 @@ public interface JdbcLegRepository extends CrudRepository<Leg, Long> {
void deleteByLegNo(String legNo);
Leg findByLegNo(String legNo);
Leg findByLegId(Long legId);
}

View File

@ -19,6 +19,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.UUID;
import static com.chint.infrastructure.constant.BPMConstant.CHINT_CB_TAG;
import static com.chint.infrastructure.constant.BPMConstant.CHINT_TRIP_TAG;
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
@ -140,14 +141,12 @@ public class BPMParamFactory {
public ANExceedStandardDto ANCreatAuditParamByTrain(OrderDetail orderDetail) {
TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail();
ANExceedStandardDto anExceedStandardDto = new ANExceedStandardDto();
anExceedStandardDto.setSourceSystemNum(UUID.randomUUID().toString())//来源系统ID,唯一标识
anExceedStandardDto.setSourceSystemNum(CHINT_CB_TAG + trainOrderDetail.getOrderNo())//来源系统ID,唯一标识
.setSourceSystem(CHINT_TRIP_TAG)//系统标识
.setApplicant(orderDetail.getEmployeeNo())//申请人
.setApplyNo("CLSQ24031200003")//差旅申请单号
.setOrderNo(trainOrderDetail.getOrderNo())//商旅订单号
.setOrderType(BPMConstant.EXCEED_STANDARD_TYPE_TRAIN)//超标原因类型
.setOrderSource(getSupplierName(orderDetail.getSupplierName()))//订单来源
.setLegNo("L2403121044077470")//行程ID
.setStartPlace(trainOrderDetail.getFromCity())//出发地
.setEndPlace(trainOrderDetail.getToCity())//目的地
.setStartTime(orderDetail.getStartTime())//开始日期
@ -158,18 +157,54 @@ public class BPMParamFactory {
public ANExceedStandardDto ANCreatAuditParamByFlight(OrderDetail orderDetail) {
return new ANExceedStandardDto();
FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail();
ANExceedStandardDto anExceedStandardDto = new ANExceedStandardDto();
anExceedStandardDto.setSourceSystemNum(CHINT_CB_TAG + flightOrderDetail.getOrderNo())//来源系统ID,唯一标识
.setSourceSystem(CHINT_TRIP_TAG)//系统标识
.setApplicant(orderDetail.getEmployeeNo())//申请人
.setOrderNo(flightOrderDetail.getOrderNo())//商旅订单号
.setOrderType(BPMConstant.EXCEED_STANDARD_TYPE_FLIGHT)//超标原因类型
.setOrderSource(getSupplierName(orderDetail.getSupplierName()))//订单来源
.setStartPlace(flightOrderDetail.getStartCityName())//出发地
.setEndPlace(flightOrderDetail.getEndCityName())//目的地
.setStartTime(orderDetail.getStartTime())//开始日期
.setEndTime(orderDetail.getEndTime())//结束日期
.setOrderMoney(BigDecimal.valueOf(Double.parseDouble(flightOrderDetail.getOrderAmount())));//金额
return anExceedStandardDto;
}
public ANExceedStandardDto ANCreatAuditParamByHotel(OrderDetail orderDetail) {
return new ANExceedStandardDto();
HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail();
ANExceedStandardDto anExceedStandardDto = new ANExceedStandardDto();
anExceedStandardDto.setSourceSystemNum(CHINT_CB_TAG + hotelOrderDetail.getOrderNo())//来源系统ID,唯一标识
.setSourceSystem(CHINT_TRIP_TAG)//系统标识
.setApplicant(orderDetail.getEmployeeNo())//申请人
.setOrderNo(hotelOrderDetail.getOrderNo())//商旅订单号
.setOrderType(BPMConstant.EXCEED_STANDARD_TYPE_HOTEL)//超标原因类型
.setOrderSource(getSupplierName(orderDetail.getSupplierName()))//订单来源
.setStartPlace(hotelOrderDetail.getCheckInCity())//出发地
.setEndPlace(hotelOrderDetail.getCheckInCity())//目的地
.setStartTime(orderDetail.getStartTime())//开始日期
.setEndTime(orderDetail.getEndTime())//结束日期
.setOrderMoney(BigDecimal.valueOf(Double.parseDouble(hotelOrderDetail.getOrderAmount())));//金额
return anExceedStandardDto;
}
public ANExceedStandardDto ANCreatAuditParamByCar(OrderDetail orderDetail) {
return new ANExceedStandardDto();
CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail();
ANExceedStandardDto anExceedStandardDto = new ANExceedStandardDto();
anExceedStandardDto.setSourceSystemNum(CHINT_CB_TAG + carOrderDetail.getOrderNo())//来源系统ID,唯一标识
.setSourceSystem(CHINT_TRIP_TAG)//系统标识
.setApplicant(orderDetail.getEmployeeNo())//申请人
.setOrderNo(carOrderDetail.getOrderNo())//商旅订单号
.setOrderType(BPMConstant.EXCEED_STANDARD_TYPE_CAR)//超标原因类型
.setOrderSource(getSupplierName(orderDetail.getSupplierName()))//订单来源
.setStartPlace(carOrderDetail.getFromCity())//出发地
.setEndPlace(carOrderDetail.getToCity())//目的地
.setStartTime(orderDetail.getStartTime())//开始日期
.setEndTime(orderDetail.getEndTime())//结束日期
.setOrderMoney(BigDecimal.valueOf(Double.parseDouble(carOrderDetail.getOrderAmount())));//金额
return anExceedStandardDto;
}
public ANExceedStandardDto ANCreatAuditParamByOther(OrderDetail orderDetail) {