行程规划同步添加提示
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.LegConstant.*;
|
||||
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_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;
|
||||
|
||||
@Service
|
||||
|
@ -161,15 +160,26 @@ public class LegEventHandler implements LegEventService {
|
|||
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
|
||||
String supplierName = data.getSupplierName();
|
||||
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事件
|
||||
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
|
||||
legItems.forEach(leg -> leg.getEventList().add(
|
||||
legEventFactory.creatLegEvent(command.getLegEventType())
|
||||
));
|
||||
|
||||
//保存routeOrder的状态
|
||||
routeRepository.save(routeOrder).reloadStatus();
|
||||
routeOrder.setLegItems(
|
||||
routeOrder
|
||||
.getLegItems()
|
||||
legItems
|
||||
.stream()
|
||||
.filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER))
|
||||
.toList()
|
||||
|
|
Loading…
Reference in New Issue