|
|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.mysql.cj.x.protobuf.MysqlxDatatypes;
|
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
|
import com.sckw.contract.api.model.dto.res.ContractCommonInfoResDto;
|
|
|
import com.sckw.core.common.enums.StringConstant;
|
|
|
@@ -3222,6 +3223,21 @@ public class KwtAcceptCarriageOrderService {
|
|
|
//实际派车数 20
|
|
|
Integer actualDisPatch = orderDTO.getActualDisPatch() == null ? 0 : orderDTO.getActualDisPatch();
|
|
|
//已派车辆数(累计已分配的车辆数)
|
|
|
+ //装卸地之间距离
|
|
|
+ double distanceKm = LocUtils.calculateDistanceByAmap(
|
|
|
+ Optional.ofNullable(orderDTO.getLoadLng()).map(String::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getLoadLat()).map(String::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getUnloadLng()).map(String::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getUnloadLat()).map(String::valueOf).orElse(null));
|
|
|
+ // 如果高德API调用失败,使用原始方法作为备选
|
|
|
+ if (distanceKm == -1) {
|
|
|
+ distanceKm = DistanceUtils.calculateDistance(
|
|
|
+ Optional.ofNullable(orderDTO.getLoadLng()).map(Double::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getLoadLat()).map(Double::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getUnloadLng()).map(Double::valueOf).orElse(null),
|
|
|
+ Optional.ofNullable(orderDTO.getUnloadLat()).map(Double::valueOf).orElse(null));
|
|
|
+ }
|
|
|
+ String distance = String.valueOf(distanceKm);
|
|
|
Integer dispatched = 0;
|
|
|
for (LogisticData x : logisticInfo) {
|
|
|
Long lOrderId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
@@ -3253,7 +3269,7 @@ public class KwtAcceptCarriageOrderService {
|
|
|
dispatched = Math.min(dispatched, actualDisPatch);
|
|
|
|
|
|
//物流订单信息
|
|
|
- setLogisticOrderInfo(orderDTO, x, lOrderId, lOrderNo, saveLogisticsOrderList);
|
|
|
+ setLogisticOrderInfo(orderDTO, x, lOrderId, lOrderNo, saveLogisticsOrderList,distance);
|
|
|
//地址信息
|
|
|
setLogisticAddress(orderDTO, x, lOrderId, saveAddressList);
|
|
|
//商品信息
|
|
|
@@ -3268,7 +3284,7 @@ public class KwtAcceptCarriageOrderService {
|
|
|
|
|
|
} else {
|
|
|
//物流订单信息
|
|
|
- setLogisticOrderInfo(orderDTO, x, lOrderId, lOrderNo, saveLogisticsOrderList);
|
|
|
+ setLogisticOrderInfo(orderDTO, x, lOrderId, lOrderNo, saveLogisticsOrderList,distance);
|
|
|
|
|
|
//地址信息
|
|
|
setLogisticAddress(orderDTO, x, lOrderId, saveAddressList);
|
|
|
@@ -3588,7 +3604,7 @@ public class KwtAcceptCarriageOrderService {
|
|
|
saveAddressList.add(unloadAddress);
|
|
|
}
|
|
|
|
|
|
- private static void setLogisticOrderInfo(AddLogisticOrderDTO orderDTO, LogisticData x, Long lOrderId, String lOrderNo, List<KwtLogisticsOrder> saveLogisticsOrderList) {
|
|
|
+ private static void setLogisticOrderInfo(AddLogisticOrderDTO orderDTO, LogisticData x, Long lOrderId, String lOrderNo, List<KwtLogisticsOrder> saveLogisticsOrderList,String distance) {
|
|
|
KwtLogisticsOrder kwtLogisticsOrder = new KwtLogisticsOrder();
|
|
|
kwtLogisticsOrder.setId(lOrderId);
|
|
|
kwtLogisticsOrder.setEntId(orderDTO.getEntId());
|
|
|
@@ -3631,6 +3647,7 @@ public class KwtAcceptCarriageOrderService {
|
|
|
kwtLogisticsOrder.setUpdateTime(date);
|
|
|
kwtLogisticsOrder.setBindStatus(String.valueOf(NumberConstant.ZERO));
|
|
|
kwtLogisticsOrder.setDispatchWay(orderDTO.getDispatchWay());
|
|
|
+ kwtLogisticsOrder.setDistance(distance);
|
|
|
saveLogisticsOrderList.add(kwtLogisticsOrder);
|
|
|
}
|
|
|
}
|