已合并 PR 10224: 修复县级市无法同步到同程的问题
This commit is contained in:
commit
7fadb61e3b
|
@ -208,6 +208,12 @@ public class OrderDetailQuery {
|
|||
if (receiptsNum != null) {
|
||||
carOrderDetail.setReceiptsNum(regetReceiptsNum(receiptsNum));
|
||||
}
|
||||
|
||||
//如果订单的状态处于开始时间有, 结束时间无的状态 ,那么该订单处于进行中,暂时返回null
|
||||
if (carOrderDetail.getStartTime() != null && carOrderDetail.getArriveTime() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CarOrderDetailDto orderDetailDto = CarOrderDetailDto.copyFrom(carOrderDetail);
|
||||
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
||||
orderDetailDto.setApplicantId(routeOrder.getUserId());
|
||||
|
|
|
@ -39,8 +39,7 @@ import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
|
|||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_CITY;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_LEVEL_COUNTY;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.*;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.*;
|
||||
|
||||
@Service
|
||||
|
@ -152,6 +151,13 @@ public class OrderQuery {
|
|||
return getRouteOrderPageRes(routeOrder, user);
|
||||
})
|
||||
.toList();
|
||||
|
||||
//这里按照业务要求,尝试进行自动确认结束行程
|
||||
orders.forEach(it->{
|
||||
if(it.getIfCanBeFinished().equals("1") && !it.getOrderStatus().equals(ORDER_EVENT_FINISH)){
|
||||
orderDomainService.finishOrder(it.getRouteId());
|
||||
}
|
||||
});
|
||||
return new PageResult<>(total, orders);
|
||||
|
||||
// //根据订单编号事项进行模糊匹配查询
|
||||
|
|
|
@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -23,4 +22,10 @@ public class OrderTravel implements Serializable {
|
|||
private String orderNo;
|
||||
private String travelNo;
|
||||
|
||||
public static OrderTravel of(String orderNo, String travelNo) {
|
||||
OrderTravel orderTravel = new OrderTravel();
|
||||
orderTravel.setTravelNo(travelNo);
|
||||
orderTravel.setOrderNo(orderNo);
|
||||
return orderTravel;
|
||||
}
|
||||
}
|
|
@ -75,8 +75,12 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
if (orderFeeList != null && !orderFeeList.isEmpty()) {
|
||||
orderFeeList.forEach(it -> {
|
||||
if (it.getFeeName().equals("取消费")) {
|
||||
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND);
|
||||
carOrderDetail.setCancellationFee(it.getAmount().toString());
|
||||
if(it.getAmount() > 0){
|
||||
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND);
|
||||
} else {
|
||||
carOrderDetail.setOrderStatus(FSSC_ORDER_STATUS_CANCEL);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -76,6 +76,14 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
} else {
|
||||
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_SUCCESS);
|
||||
}
|
||||
//根据状态33来判断该订单已经被取消
|
||||
if (carOrderDetailInfo.getOrderStatus() == 33) {
|
||||
carOrderDetail.setOrderStatus(FSSC_ORDER_STATUS_CANCEL);
|
||||
if (carOrderDetailInfo.getTotalPrice() > 0) {
|
||||
carOrderDetail.setOrderStatus(FSSC_CAR_STATUS_REFUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<PriceDetail> priceDetailList = data.getPriceDetailList();
|
||||
if (priceDetailList != null && !priceDetailList.isEmpty()) {
|
||||
|
@ -86,7 +94,7 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
}
|
||||
});
|
||||
}
|
||||
return updateCarOrderDetailData(carOrderDetail,data);
|
||||
return updateCarOrderDetailData(carOrderDetail, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderTravel;
|
||||
|
||||
public interface OrderTravelRepository {
|
||||
OrderTravel save(OrderTravel orderTravel);
|
||||
|
||||
OrderTravel findByOrderNo(String orderNo);
|
||||
}
|
|
@ -427,7 +427,6 @@ public class OrderDomainService {
|
|||
.setReason("计划有变,更改行程");
|
||||
}
|
||||
}
|
||||
|
||||
//火车票改签
|
||||
private void setLYChangeTrain(RescheduleDto rescheduleDto, TrainDetailResponse trainDetailResponse) {
|
||||
TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData();
|
||||
|
|
|
@ -216,10 +216,10 @@ public class LYOrderSyncAdapter implements SupplierOrderSync {
|
|||
}
|
||||
|
||||
|
||||
private Location getCityLocation(Location location) {
|
||||
public Location getCityLocation(Location location) {
|
||||
if (location.getLocationType().equals(LOCATION_TYPE_CITY)) {
|
||||
return location;
|
||||
} else if (location.getLocationType().equals(LOCATION_LEVEL_COUNTY) || location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) {
|
||||
} else if (location.getLocationType().equals(LOCATION_TYPE_COUNTY) || location.getLocationType().equals(LOCATION_TYPE_DISTRICT)) {
|
||||
return locationRepository.findById(location.getParentLocationId());
|
||||
} else if (location.getLocationType().equals(LOCATION_TYPE_AIRPORT)) {
|
||||
//如果是机场的话,要查询出对应的地级市
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderTravel;
|
||||
import com.chint.domain.repository.OrderTravelRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class OrderTravelRepositoryImpl implements OrderTravelRepository {
|
||||
|
||||
@Autowired
|
||||
private JdbcOrderTravelRepository jdbcOrderTravelRepository;
|
||||
|
||||
@Override
|
||||
public OrderTravel save(OrderTravel orderTravel) {
|
||||
List<OrderTravel> byOrderNo = jdbcOrderTravelRepository.findByOrderNo(orderTravel.getOrderNo());
|
||||
if (byOrderNo != null && byOrderNo.isEmpty()) {
|
||||
jdbcOrderTravelRepository.save(orderTravel);
|
||||
}
|
||||
return orderTravel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderTravel findByOrderNo(String orderNo) {
|
||||
List<OrderTravel> byOrderNo = jdbcOrderTravelRepository.findByOrderNo(orderNo);
|
||||
if (byOrderNo != null && !byOrderNo.isEmpty()) {
|
||||
return byOrderNo.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -2,14 +2,17 @@ package com.chint.interfaces.rest.bpm;
|
|||
|
||||
import com.chint.domain.aggregates.order.OrderTravel;
|
||||
import com.chint.domain.aggregates.standards.TravelStandards;
|
||||
import com.chint.domain.service.SystemDomainService;
|
||||
import com.chint.domain.value_object.TravelStandardsData;
|
||||
import com.chint.infrastructure.constant.BPMConstant;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
|
||||
import com.chint.infrastructure.util.DelayDispatch;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.interfaces.rest.bpm.dot.BPMBack;
|
||||
import com.chint.interfaces.rest.ctrip.CTripAuditRequest;
|
||||
import com.chint.interfaces.rest.ly.LyApprovalRequest;
|
||||
import com.chint.interfaces.rest.ly.dto.strokepush.Param;
|
||||
import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController;
|
||||
import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO;
|
||||
|
@ -22,8 +25,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.*;
|
||||
import static com.chint.infrastructure.constant.BelongSystemConstant.BELONG_SYS_CODE_ANFSSC;
|
||||
import static com.chint.infrastructure.constant.Constant.*;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
|
||||
|
||||
|
@ -41,6 +46,12 @@ public class BPMController {
|
|||
@Autowired
|
||||
private JdbcOrderTravelRepository orderTravelRepository;
|
||||
|
||||
@Autowired
|
||||
private SystemDomainService systemDomainService;
|
||||
|
||||
@Autowired
|
||||
private LyApprovalRequest lyApprovalRequest;
|
||||
|
||||
//超标
|
||||
@ApiOperation("BPM超标审批结果回传")
|
||||
@PostMapping("/exceedStandard/back")
|
||||
|
@ -70,10 +81,25 @@ public class BPMController {
|
|||
.setApprovalStatus(2);//1驳回 2通过
|
||||
} else {
|
||||
param.setTravelBizOrderNo(travelNo)//同程行程单号
|
||||
.setApprovalStatus(2);//1驳回 2通过
|
||||
.setApprovalStatus(1);//1驳回 2通过
|
||||
}
|
||||
strokePushDTO.setParam(param);
|
||||
strokeController.strokePush(strokePushDTO);
|
||||
|
||||
//新审批接口
|
||||
if (BELONG_SYS_CODE_ANFSSC.equals(bpmBack.getTag()) && "拒绝".equals(bpmBack.getResult())) {
|
||||
//安能拒绝
|
||||
CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(
|
||||
() -> lyApprovalRequest.pushApprovalError(travelNo).isSuccess(), 0
|
||||
));
|
||||
} else {
|
||||
//其它都为通过
|
||||
CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(
|
||||
() -> lyApprovalRequest.pushApprovalSuccess(travelNo).isSuccess(), 0
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return Result.Success(CommonMessageConstant.SUCCESS);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.chint.interfaces.rest.ly.dto.eta;
|
||||
|
||||
import com.chint.interfaces.rest.ctrip.dto.search.flight.FlightInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class LyETAPush {
|
||||
private NotifyData notifyData;
|
||||
private NotifyData notifyDataObject;
|
||||
private String notifyData;
|
||||
private int notifyType;
|
||||
private int subNotifyType;
|
||||
private long notifyTime;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.chint.interfaces.rest.ly.in;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.chint.application.commands.OrderStatusChangeCommand;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.aggregates.order.OrderTravel;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.OrderTravelRepository;
|
||||
import com.chint.domain.service.SystemDomainService;
|
||||
import com.chint.domain.service.supplier.SupplierService;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
|
@ -49,13 +52,20 @@ public class LYETAController {
|
|||
@Autowired
|
||||
private SupplierService supplierService;
|
||||
|
||||
@Autowired
|
||||
private OrderTravelRepository orderTravelRepository;
|
||||
|
||||
@PostMapping("/eta")
|
||||
public LYNoteResponse noteByETA(@RequestBody LyETAPush lyETAPush) {
|
||||
if (lyETAPush.getNotifyType() != 51) {
|
||||
return LYNoteResponse.error("推送类型错误");
|
||||
}
|
||||
String notifyDataJson = lyETAPush.getNotifyData();
|
||||
LyETAPush.NotifyData data = JSON.parseObject(notifyDataJson, LyETAPush.NotifyData.class);
|
||||
lyETAPush.setNotifyDataObject(data);
|
||||
|
||||
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyData();
|
||||
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyDataObject();
|
||||
String approvalOrderId = notifyData.getApprovalOrderId();
|
||||
String travelApplyNo = notifyData.getTravelApplyNo();
|
||||
String[] split = travelApplyNo.split("-");
|
||||
if (split.length == 0) {
|
||||
|
@ -67,7 +77,7 @@ public class LYETAController {
|
|||
if (systemDomainService.ifImmediateResponse(sysCode)) {
|
||||
//如果是可以立刻返回结果的,直接返回审批通过信息
|
||||
CompletableFuture.runAsync(() -> DelayDispatch.attemptToSend(
|
||||
() -> lyApprovalRequest.pushApprovalSuccess(notifyData.getApprovalOrderId()).isSuccess(), 0
|
||||
() -> lyApprovalRequest.pushApprovalSuccess(approvalOrderId).isSuccess(), 0
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -75,6 +85,8 @@ public class LYETAController {
|
|||
SupplierCallbackData supplierCallbackData = handlerETACallBackData(lyETAPush);
|
||||
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
|
||||
|
||||
orderTravelRepository.save(OrderTravel.of(orderDetail.getOrderNo(), approvalOrderId));
|
||||
|
||||
//发送超标事件
|
||||
Command.of(OrderStatusChangeCommand.class)
|
||||
.orderDetail(orderDetail)
|
||||
|
@ -85,7 +97,7 @@ public class LYETAController {
|
|||
.sendToQueue();
|
||||
|
||||
int subNotifyType = lyETAPush.getSubNotifyType();
|
||||
if(subNotifyType == 2 || subNotifyType == 4 || subNotifyType == 6 ){
|
||||
if (subNotifyType == 2 || subNotifyType == 4 || subNotifyType == 6) {
|
||||
//如果推送类是2,4,6还要触发改签事件
|
||||
Command.of(OrderStatusChangeCommand.class)
|
||||
.orderDetail(orderDetail)
|
||||
|
@ -101,7 +113,7 @@ public class LYETAController {
|
|||
|
||||
|
||||
private SupplierCallbackData handlerETACallBackData(LyETAPush lyETAPush) {
|
||||
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyData();
|
||||
LyETAPush.NotifyData notifyData = lyETAPush.getNotifyDataObject();
|
||||
String bookEmpId = notifyData.getBookEmpId();
|
||||
SupplierCallbackData supplierCallbackData =
|
||||
SupplierCallbackData.of(SUPPLIER_L_Y, bookEmpId);
|
||||
|
@ -138,7 +150,7 @@ public class LYETAController {
|
|||
LyETAPush.FlightOrderInfo flightOrderInfo = flightOrderInfos.get(0);
|
||||
FlightOrderResponse.Data data = lySearchRequest
|
||||
.getFlightOrderDetail(flightOrderInfo.getOrderNo()).getData();
|
||||
supplierCallbackData.data(data).extension(getETAReason(flightOrderInfo));
|
||||
supplierCallbackData.data(data).extension(getETAReason(flightOrderInfo)).productType(LEG_TYPE_AIRPLANE);
|
||||
}
|
||||
}
|
||||
case LEG_TYPE_TRAIN -> {
|
||||
|
@ -147,7 +159,7 @@ public class LYETAController {
|
|||
LyETAPush.TrainOrderInfo trainOrderInfo = trainOrderInfos.get(0);
|
||||
TrainDetailResponse.TrainDetailData data = lySearchRequest
|
||||
.getTrainOrderDetail(trainOrderInfo.getOrderNo()).getData();
|
||||
supplierCallbackData.data(data).extension(getETAReason(trainOrderInfo));
|
||||
supplierCallbackData.data(data).extension(getETAReason(trainOrderInfo)).productType(LEG_TYPE_TRAIN);
|
||||
}
|
||||
}
|
||||
case LEG_TYPE_HOTEL -> {
|
||||
|
@ -156,7 +168,7 @@ public class LYETAController {
|
|||
LyETAPush.HotelOrderInfo hotelOrderInfo = hotelOrderInfos.get(0);
|
||||
HotelDetailResponse.Data data = lySearchRequest
|
||||
.getHotelOrderDetail(hotelOrderInfo.getOrderNo()).getData();
|
||||
supplierCallbackData.data(data).extension(getETAReason(hotelOrderInfo));
|
||||
supplierCallbackData.data(data).extension(getETAReason(hotelOrderInfo)).productType(LEG_TYPE_HOTEL);
|
||||
}
|
||||
}
|
||||
default -> throw new NotFoundException(NOT_FOUND);
|
||||
|
|
|
@ -103,7 +103,7 @@ public class LYOrderUtil {
|
|||
case 30 -> ORDER_EVENT_ORDERED; //"待支付"
|
||||
case 31 -> ORDER_EVENT_ORDERED; //"行程结束"
|
||||
case 32 -> ORDER_EVENT_ORDERED; //"待支付"
|
||||
case 33 -> ORDER_EVENT_ORDERED; //"已完成"
|
||||
case 33 -> ORDER_EVENT_CANCEL; //"已完成"
|
||||
case 41 -> ORDER_EVENT_CANCEL; //"已取消"
|
||||
case 42 -> ORDER_EVENT_CANCEL; //"已取消"
|
||||
case 43 -> ORDER_EVENT_CANCEL; //"已取消"
|
||||
|
|
|
@ -38,10 +38,10 @@ logging:
|
|||
#正式
|
||||
ly:
|
||||
appId: zhengtai
|
||||
account: ab9fe0c19dd64a99b936fded72c3bb94
|
||||
password: glHRJJ9JMUwNfQ8OwAQi
|
||||
secret: MnghmYJpM1U2RaLx
|
||||
baseUrl: https://api.dttrip.cn/openapi
|
||||
account: 4f9cb1080b564dd0a94aa95f7a19c8b5
|
||||
password: 1fD3SutgzfS48qznYQiq
|
||||
secret: WOHzCMvHd823iHgH
|
||||
baseUrl: https://api.qa.dttrip.cn/openapi
|
||||
ifForwardRequest: false
|
||||
forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ chint:
|
|||
# host: gf-jump.chint.com
|
||||
# port: 30108
|
||||
# database: itinerary_booking
|
||||
# username: e2b8171f-9920-4972-8f84-383ff27eee44
|
||||
# password: zbPYf9CUI1ef1nhW
|
||||
# username: 0f4f7804-ba70-413f-90df-e4201a75e836
|
||||
# password: ojQXnZi4pzT0Yc9A
|
||||
|
||||
url: https://trip.chint.com/
|
||||
redis:
|
||||
|
|
|
@ -48,10 +48,10 @@ logging:
|
|||
#正式
|
||||
ly:
|
||||
appId: zhengtai
|
||||
account: ab9fe0c19dd64a99b936fded72c3bb94
|
||||
password: glHRJJ9JMUwNfQ8OwAQi
|
||||
secret: MnghmYJpM1U2RaLx
|
||||
baseUrl: https://api.dttrip.cn/openapi
|
||||
account: 4f9cb1080b564dd0a94aa95f7a19c8b5
|
||||
password: 1fD3SutgzfS48qznYQiq
|
||||
secret: WOHzCMvHd823iHgH
|
||||
baseUrl: https://api.qa.dttrip.cn/openapi
|
||||
ifForwardRequest: false
|
||||
forwardRequestBaseUrl: https://secureqrdev-t.chint.com/llz
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.chint.domain.aggregates.order.RouteOrder;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.*;
|
||||
import com.chint.domain.service.JTCompanyDomainService;
|
||||
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
|
||||
import com.chint.domain.value_object.RanksData;
|
||||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.infrastructure.util.PinyinUtil;
|
||||
|
@ -116,6 +117,8 @@ class RouteApplicationTests {
|
|||
@Autowired
|
||||
private UserHttpRequestImpl userHttpRequestImpl;
|
||||
|
||||
@Autowired
|
||||
private LYOrderSyncAdapter lyOrderSyncAdapter;
|
||||
|
||||
@Autowired
|
||||
private UserSFRequest userSFRequest;
|
||||
|
@ -264,9 +267,9 @@ class RouteApplicationTests {
|
|||
// log.trace("trace");
|
||||
}
|
||||
|
||||
// @Test
|
||||
@Test
|
||||
void loginSignProd() {
|
||||
String sfno = "081001001";
|
||||
String sfno = "230601010";
|
||||
String syscode = "FSSC";
|
||||
String billcode = "CLSQ240315000308";
|
||||
String companycode = "浙江正泰电器股份有限公司";
|
||||
|
@ -1206,4 +1209,10 @@ class RouteApplicationTests {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
void testQueryCity() {
|
||||
Location location = locationRepository.findById(373L);
|
||||
Location cityLocation = lyOrderSyncAdapter.getCityLocation(location);
|
||||
System.out.println(cityLocation);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue