行程规划同步添加提示
This commit is contained in:
parent
8eb0c2dfc2
commit
2adcf92af0
|
@ -42,10 +42,9 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE
|
||||||
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
|
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
|
||||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.*;
|
import static com.chint.infrastructure.constant.OrderConstant.*;
|
||||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_FINISH_NAME;
|
|
||||||
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE;
|
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE;
|
||||||
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME;
|
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME;
|
||||||
import static com.chint.infrastructure.constant.RouteConstant.*;
|
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
|
||||||
|
@ -161,15 +160,26 @@ public class LegEventHandler implements LegEventService {
|
||||||
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
|
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
|
||||||
String supplierName = data.getSupplierName();
|
String supplierName = data.getSupplierName();
|
||||||
routeOrder.setSupplierName(supplierName);
|
routeOrder.setSupplierName(supplierName);
|
||||||
|
List<Leg> legItems = routeOrder.getLegItems();
|
||||||
|
|
||||||
|
//这里增加一个判断 ,如果这个订单的行程为空,那么就返回给用户提示
|
||||||
|
if (legItems == null || legItems.isEmpty()) {
|
||||||
|
throw new CommandException("订单的行程不能为空");
|
||||||
|
}
|
||||||
|
List<Leg> needSyncLegs = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList();
|
||||||
|
if (needSyncLegs.isEmpty()) {
|
||||||
|
throw new CommandException("有所选的行程规划单不存在需要同步的行程");
|
||||||
|
}
|
||||||
|
|
||||||
//这里order所有的leg触发sync事件
|
//这里order所有的leg触发sync事件
|
||||||
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
legItems.forEach(leg -> leg.getEventList().add(
|
||||||
legEventFactory.creatLegEvent(command.getLegEventType())
|
legEventFactory.creatLegEvent(command.getLegEventType())
|
||||||
));
|
));
|
||||||
|
|
||||||
//保存routeOrder的状态
|
//保存routeOrder的状态
|
||||||
routeRepository.save(routeOrder).reloadStatus();
|
routeRepository.save(routeOrder).reloadStatus();
|
||||||
routeOrder.setLegItems(
|
routeOrder.setLegItems(
|
||||||
routeOrder
|
legItems
|
||||||
.getLegItems()
|
|
||||||
.stream()
|
.stream()
|
||||||
.filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER))
|
.filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER))
|
||||||
.toList()
|
.toList()
|
||||||
|
@ -245,8 +255,8 @@ public class LegEventHandler implements LegEventService {
|
||||||
LegEvent legEvent = legEventFactory
|
LegEvent legEvent = legEventFactory
|
||||||
.creatLegEvent(command.getLegEventType());
|
.creatLegEvent(command.getLegEventType());
|
||||||
leg.addEvent(legEvent);
|
leg.addEvent(legEvent);
|
||||||
} else if(orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
|
} else if (orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
|
||||||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)){
|
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)) {
|
||||||
//如果是退款状态,那么就创建加入未下单事件
|
//如果是退款状态,那么就创建加入未下单事件
|
||||||
LegEvent legEvent = legEventFactory
|
LegEvent legEvent = legEventFactory
|
||||||
.creatLegEvent(LEG_EVENT_NOT_ORDERED);
|
.creatLegEvent(LEG_EVENT_NOT_ORDERED);
|
||||||
|
|
Loading…
Reference in New Issue