|
|
@@ -17,7 +17,6 @@ import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
|
import com.sckw.core.utils.DateUtils;
|
|
|
import com.sckw.core.utils.HttpUtil;
|
|
|
import com.sckw.core.web.constant.CommonConstants;
|
|
|
-import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.result.PageDataResult;
|
|
|
import com.sckw.core.web.response.BaseResult;
|
|
|
@@ -41,6 +40,7 @@ import com.sckw.transport.model.dto.TruckDto;
|
|
|
import com.sckw.transport.api.feign.VehicleTraceClient;
|
|
|
import com.sckw.transport.api.model.dto.VehicleDataDTO;
|
|
|
import com.sckw.transport.api.model.dto.VehicleReturnData;
|
|
|
+import com.sckw.transport.model.enuma.VehicleExceptionTypeEnum;
|
|
|
import com.sckw.transport.model.param.*;
|
|
|
import com.sckw.transport.model.dto.GenerateTraceReq;
|
|
|
import com.sckw.transport.model.vo.CurrentTaskTraceReqVo;
|
|
|
@@ -546,7 +546,7 @@ public class kwfTruckTraceService {
|
|
|
// 使用 Feign 调用查询实时位置
|
|
|
BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
|
|
|
|
|
|
- if (result == null || result.getCode() != HttpStatus.SUCCESS_CODE || result.getData() == null) {
|
|
|
+ if (result == null || result.getCode() != 0 || result.getData() == null) {
|
|
|
log.warn("查询实时轨迹返回空数据, 车牌号: {}", truckId);
|
|
|
return null;
|
|
|
}
|
|
|
@@ -621,7 +621,7 @@ public class kwfTruckTraceService {
|
|
|
// 使用 Feign 调用上报车辆轨迹
|
|
|
BaseResult<Void> result = vehicleTraceClient.saveVehicleData(req);
|
|
|
|
|
|
- if (result == null || result.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
+ if (result == null || result.getCode() != 0) {
|
|
|
log.error("app上报车辆轨迹失败, 响应: {}", result);
|
|
|
throw new BusinessException("app上报车辆轨迹异常");
|
|
|
}
|
|
|
@@ -722,7 +722,7 @@ public class kwfTruckTraceService {
|
|
|
vehicleDataDTO.setCarNo(truckNo);
|
|
|
BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
|
|
|
|
|
|
- if (result == null || result.getCode() != HttpStatus.SUCCESS_CODE || result.getData() == null) {
|
|
|
+ if (result == null || result.getCode() != 0 || result.getData() == null) {
|
|
|
// 无定位数据,设置为离线
|
|
|
truckLocationStatusMap.put(truckNo, 0);
|
|
|
return truckLocationStatusMap;
|
|
|
@@ -1038,7 +1038,7 @@ public class kwfTruckTraceService {
|
|
|
|
|
|
VehicleLocationInfo locationInfo = new VehicleLocationInfo();
|
|
|
|
|
|
- if (result != null && result.getCode() == 200 && result.getData() != null) {
|
|
|
+ if (result != null && result.getCode() == 0 && result.getData() != null) {
|
|
|
VehicleReturnData vehicleData = result.getData();
|
|
|
|
|
|
// 判断定位状态
|
|
|
@@ -1094,7 +1094,7 @@ public class kwfTruckTraceService {
|
|
|
BaseResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result =
|
|
|
vehicleTraceClient.queryVehicleDataList(vehicleDataDTO);
|
|
|
|
|
|
- if (result != null && result.getCode() == HttpStatus.SUCCESS_CODE && result.getData() != null) {
|
|
|
+ if (result != null && result.getCode() == 0 && result.getData() != null) {
|
|
|
List<com.sckw.transport.api.model.dto.VehicleReturnData> traceDataList = result.getData();
|
|
|
|
|
|
// 统计alarmCode不为null且不为0的记录数量(表示有异常报警)
|
|
|
@@ -1133,14 +1133,16 @@ public class kwfTruckTraceService {
|
|
|
vo.setTruckId(order.getTruckId());
|
|
|
vo.setDriverName(order.getDriverName());
|
|
|
vo.setDriverPhone(order.getDriverPhone());
|
|
|
- vo.setWOrderNo(order.getWOrderNo());
|
|
|
+ vo.setWayOrderId(order.getId());
|
|
|
+ vo.setWayOrderNo(order.getWOrderNo());
|
|
|
vo.setStatus(order.getStatus());
|
|
|
vo.setStatusDesc(CarWaybillV1Enum.geDesc(order.getStatus()));
|
|
|
|
|
|
// 子运单信息
|
|
|
KwtWaybillOrderSubtask subtask = subtaskMap.get(order.getId());
|
|
|
if (subtask != null) {
|
|
|
- vo.setLOrderNo(String.valueOf(subtask.getLOrderId()));
|
|
|
+ vo.setLogisticOrderId(subtask.getLOrderId());
|
|
|
+ vo.setLogisticOrderNo(String.valueOf(subtask.getLOrderId()));
|
|
|
vo.setLoadAmount(subtask.getLoadAmount());
|
|
|
vo.setEntrustAmount(subtask.getEntrustAmount());
|
|
|
vo.setUnit(subtask.getUnit());
|
|
|
@@ -1252,12 +1254,12 @@ public class kwfTruckTraceService {
|
|
|
String longitude = location[0];
|
|
|
String latitude = location[1];
|
|
|
|
|
|
- KwtWaybillOrder order = kwtWaybillOrderRepository.queryByWayOrderNo(req.getWOrderNo());
|
|
|
+ KwtWaybillOrder order = kwtWaybillOrderRepository.queryByWayOrderNo(req.getWayOrderNo());
|
|
|
if (Objects.isNull(order)){
|
|
|
throw new BusinessException("运单不存在");
|
|
|
}
|
|
|
//查询子运单
|
|
|
- KwtWaybillOrder subOrders = kwtWaybillOrderRepository.queryByBillOrderId(order.getLOrderId());
|
|
|
+ KwtWaybillOrderSubtask subOrders = kwtWaybillOrderSubtaskRepository.queryByBillOrderId(order.getId());
|
|
|
if (Objects.isNull(subOrders)){
|
|
|
throw new BusinessException("子运单不存在");
|
|
|
}
|
|
|
@@ -1272,7 +1274,7 @@ public class kwfTruckTraceService {
|
|
|
try {
|
|
|
// 调用数据中台保存轨迹数据
|
|
|
BaseResult<Void> result = vehicleTraceClient.saveVehicleData(vehiclesTrajectoryReq);
|
|
|
- if (result.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
+ if (result.getCode() != 0) {
|
|
|
log.error("保存车辆轨迹数据失败:{}", result.getMessage());
|
|
|
throw new BusinessException("生成轨迹失败:" + result.getMessage());
|
|
|
}
|
|
|
@@ -1280,7 +1282,7 @@ public class kwfTruckTraceService {
|
|
|
// 如果有异常类型,同时保存到本地车辆异常表
|
|
|
saveException(req, order, longitude, latitude);
|
|
|
|
|
|
- log.info("生成车辆轨迹成功,运单号:{},车牌号:{}", req.getWOrderNo(), req.getTruckNo());
|
|
|
+ log.info("生成车辆轨迹成功,运单号:{},车牌号:{}", req.getWayOrderNo(), req.getTruckNo());
|
|
|
} catch (Exception e) {
|
|
|
log.error("生成车辆轨迹异常:", e);
|
|
|
throw new BusinessException("生成轨迹失败:" + e.getMessage());
|
|
|
@@ -1296,11 +1298,13 @@ public class kwfTruckTraceService {
|
|
|
vehicleException.setEntId(order.getEntId());
|
|
|
vehicleException.setTruckId(order.getTruckId());
|
|
|
vehicleException.setTruckNo(req.getTruckNo());
|
|
|
- vehicleException.setWOrderNo(req.getWOrderNo());
|
|
|
+ vehicleException.setWOrderNo(req.getWayOrderNo());
|
|
|
vehicleException.setDriverId(order.getDriverId());
|
|
|
vehicleException.setDriverName(order.getDriverName());
|
|
|
vehicleException.setDriverPhone(order.getDriverPhone());
|
|
|
vehicleException.setExceptionType(req.getExceptionType());
|
|
|
+ vehicleException.setDescription(VehicleExceptionTypeEnum.getName(req.getExceptionType()));
|
|
|
+ vehicleException.setLocation(req.getExceptionLocation());
|
|
|
vehicleException.setLongitude(longitude);
|
|
|
vehicleException.setLatitude(latitude);
|
|
|
vehicleException.setExceptionTime(new Date());
|
|
|
@@ -1318,7 +1322,7 @@ public class kwfTruckTraceService {
|
|
|
@NotNull
|
|
|
private static VehiclesTrajectoryReq getVehiclesTrajectoryReq(GenerateTraceReq req, KwtWaybillOrder order, String longitude, String latitude, KwtLogisticsOrder logisticsOrder, RFleetVo fleetByTruckId) {
|
|
|
VehiclesTrajectoryReq vehiclesTrajectoryReq = new VehiclesTrajectoryReq();
|
|
|
- vehiclesTrajectoryReq.setTs(req.getDate() + " " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
|
|
+ vehiclesTrajectoryReq.setTs(req.getDate());
|
|
|
vehiclesTrajectoryReq.setMobile(order.getDriverPhone());
|
|
|
vehiclesTrajectoryReq.setTruckNo(req.getTruckNo());
|
|
|
vehiclesTrajectoryReq.setLongitude(longitude);
|
|
|
@@ -1334,7 +1338,7 @@ public class kwfTruckTraceService {
|
|
|
if (req.getExceptionType() != null){
|
|
|
vehiclesTrajectoryReq.setStatus(String.valueOf(req.getExceptionType()));
|
|
|
}
|
|
|
- vehiclesTrajectoryReq.setWOrderNo(req.getWOrderNo());
|
|
|
+ vehiclesTrajectoryReq.setWOrderNo(req.getWayOrderNo());
|
|
|
vehiclesTrajectoryReq.setLOrderNo(Optional.ofNullable(logisticsOrder).map(KwtLogisticsOrder::getLOrderNo).orElse( ""));
|
|
|
VehiclesTrajectoryReq.VehicleDataVO vehicleDataVO = new VehiclesTrajectoryReq.VehicleDataVO();
|
|
|
vehicleDataVO.setCarNo(req.getTruckNo());
|