diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index 393c5865..db72f6ef 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -230,34 +230,48 @@ public class OrderDetail implements Serializable { copyOrderDetail.setOtherOrderDetail(copiedOtherOrderDetail); // 深拷贝 orderEventList - List copiedOrderEventList = this.orderEventList.stream() - .map(event -> BeanUtil.copyProperties(event, OrderEvent.class)) - .collect(Collectors.toList()); - copyOrderDetail.setOrderEventList(copiedOrderEventList); + if(this.orderEventList != null && !this.orderEventList.isEmpty()) { + List copiedOrderEventList = this.orderEventList.stream() + .map(event -> BeanUtil.copyProperties(event, OrderEvent.class)) + .collect(Collectors.toList()); + copyOrderDetail.setOrderEventList(copiedOrderEventList); + } + // 深拷贝 orderCarRecordList - List copiedOrderCarRecordList = this.orderCarRecordList.stream() - .map(record -> BeanUtil.copyProperties(record, OrderCarRecord.class)) - .collect(Collectors.toList()); - copyOrderDetail.setOrderCarRecordList(copiedOrderCarRecordList); + if (this.orderCarRecordList != null && !this.orderCarRecordList.isEmpty()) { + List copiedOrderCarRecordList = this.orderCarRecordList.stream() + .map(record -> BeanUtil.copyProperties(record, OrderCarRecord.class)) + .collect(Collectors.toList()); + copyOrderDetail.setOrderCarRecordList(copiedOrderCarRecordList); + } + // 深拷贝 orderFlightRecordList - List copiedOrderFlightRecordList = this.orderFlightRecordList.stream() - .map(record -> BeanUtil.copyProperties(record, OrderFlightRecord.class)) - .collect(Collectors.toList()); - copyOrderDetail.setOrderFlightRecordList(copiedOrderFlightRecordList); + if (this.orderFlightRecordList != null && !this.orderFlightRecordList.isEmpty()) { + List copiedOrderFlightRecordList = this.orderFlightRecordList.stream() + .map(record -> BeanUtil.copyProperties(record, OrderFlightRecord.class)) + .collect(Collectors.toList()); + copyOrderDetail.setOrderFlightRecordList(copiedOrderFlightRecordList); + } + // 深拷贝 orderHotelRecordList - List copiedOrderHotelRecordList = this.orderHotelRecordList.stream() - .map(record -> BeanUtil.copyProperties(record, OrderHotelRecord.class)) - .collect(Collectors.toList()); - copyOrderDetail.setOrderHotelRecordList(copiedOrderHotelRecordList); + if (this.orderHotelRecordList != null && !this.orderHotelRecordList.isEmpty()) { + List copiedOrderHotelRecordList = this.orderHotelRecordList.stream() + .map(record -> BeanUtil.copyProperties(record, OrderHotelRecord.class)) + .collect(Collectors.toList()); + copyOrderDetail.setOrderHotelRecordList(copiedOrderHotelRecordList); + } + // 深拷贝 orderTrainRecordList - List copiedOrderTrainRecordList = this.orderTrainRecordList.stream() - .map(record -> BeanUtil.copyProperties(record, OrderTrainRecord.class)) - .collect(Collectors.toList()); - copyOrderDetail.setOrderTrainRecordList(copiedOrderTrainRecordList); + if (this.orderTrainRecordList != null && !this.orderTrainRecordList.isEmpty()) { + List copiedOrderTrainRecordList = this.orderTrainRecordList.stream() + .map(record -> BeanUtil.copyProperties(record, OrderTrainRecord.class)) + .collect(Collectors.toList()); + copyOrderDetail.setOrderTrainRecordList(copiedOrderTrainRecordList); + } return copyOrderDetail; } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index 50514519..06c5d5db 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -31,8 +31,7 @@ import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; -import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI; -import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN; +import static com.chint.infrastructure.constant.LegConstant.*; import static com.chint.infrastructure.constant.RouteConstant.*; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL; @@ -541,7 +540,7 @@ public class RouteOrder implements Serializable { List potentialMatches = this.legItems.stream() .filter(leg -> { // Skip taxi legs already handled - if (leg.getLegType().equals(LEG_TYPE_TAXI)) { + if (leg.getLegType().equals(LEG_TYPE_TAXI) || leg.getLegType().equals(LEG_TYPE_OTHER)) { return false; } diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteRequestEvent.java b/src/main/java/com/chint/domain/aggregates/order/RouteRequestEvent.java index c5026ab3..a09c237a 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteRequestEvent.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteRequestEvent.java @@ -22,7 +22,6 @@ public class RouteRequestEvent extends BaseEvent implements Serializable { private Long routeRequestId; - private Long routeRequestKey; @Override protected Map getStatusMappings() { diff --git a/src/main/java/com/chint/domain/service/LegDomainService.java b/src/main/java/com/chint/domain/service/LegDomainService.java index df59af84..4386a644 100644 --- a/src/main/java/com/chint/domain/service/LegDomainService.java +++ b/src/main/java/com/chint/domain/service/LegDomainService.java @@ -90,6 +90,9 @@ public class LegDomainService { public void deleteByLegNo(String legNo) { Leg byLegNo = legRepository.findByLegNo(legNo); + if(byLegNo == null){ + return; + } RouteOrder routeOrder = routeRepository.queryById(byLegNo.getRouteId()).reloadStatus(); if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { legRepository.deleteById(byLegNo); diff --git a/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java index ce47bfe3..7604363d 100644 --- a/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java @@ -7,10 +7,7 @@ import com.chint.domain.aggregates.supplier.SupplierProductStandardLevel; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.AuthException; import com.chint.domain.exceptions.CommandException; -import com.chint.domain.repository.AmapPolicyRepository; -import com.chint.domain.repository.AmapRouteRelationshipRepository; -import com.chint.domain.repository.SupplierRepository; -import com.chint.domain.repository.UserRepository; +import com.chint.domain.repository.*; import com.chint.domain.service.LegDomainService; import com.chint.infrastructure.util.DateTimeUtil; import com.chint.interfaces.rest.amap.AmapLocationRequest; @@ -30,6 +27,7 @@ import java.util.List; import java.util.Optional; import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI; +import static com.chint.infrastructure.constant.LocationConstant.LOCATION_TYPE_CITY; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP; @Slf4j @@ -57,6 +55,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { @Autowired private SupplierRepository supplierRepository; + private Gson gson = new Gson(); @Override @@ -142,7 +141,13 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { } List areaCodes = new ArrayList<>(); for (Location location : locationList) { - areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName())); + if(location.getLocationType() != LOCATION_TYPE_CITY){ + //如果类型不是地级市,那么就从地区路径获取地级市信息 + String[] split = location.getLocationPathName().split("_"); + areaCodes.add(amapLocationRequest.getACodeByLocationName(split[3])); + } else { + areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName())); + } } processContent.setValidCityList(areaCodes); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 2fe1dd85..c2914043 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -302,7 +302,7 @@ class RouteApplicationTests { @Test void loginSign() { - String sfno = "230615020"; + String sfno = "230207110"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -359,7 +359,7 @@ class RouteApplicationTests { @Test void deleteOrderDetail() { - orderDetailRepository.deleteById(3128L); + orderDetailRepository.deleteById(3157L); } // @Test