|
|
@@ -12,8 +12,10 @@ import com.sckw.core.model.enums.CarWaybillEnum;
|
|
|
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;
|
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
|
import com.sckw.fleet.api.model.vo.RDriverVo;
|
|
|
import com.sckw.fleet.api.model.vo.RFleetDriverVo;
|
|
|
@@ -33,8 +35,10 @@ import com.sckw.transport.model.KwtWaybillOrder;
|
|
|
import com.sckw.transport.model.KwtWaybillOrderAddress;
|
|
|
import com.sckw.transport.model.KwtWaybillOrderSubtask;
|
|
|
import com.sckw.transport.model.dto.TruckDto;
|
|
|
-import com.sckw.transport.model.dto.VehicleDataDTO;
|
|
|
-import com.sckw.transport.model.dto.VehicleReturnData;
|
|
|
+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.api.model.vo.VehicleTraceResponse;
|
|
|
import com.sckw.transport.model.param.CurrentTaskTraceReq;
|
|
|
import com.sckw.transport.model.param.KwfTruckTraceReplayReq;
|
|
|
import com.sckw.transport.model.param.TruckInfoReq;
|
|
|
@@ -79,6 +83,7 @@ public class kwfTruckTraceService {
|
|
|
private final KwtWaybillOrderSubtaskRepository kwtWaybillOrderSubtaskRepository;
|
|
|
private final VehicleCollectService vehicleCollectService;
|
|
|
private final KwtLogisticsOrderUnitRepository kwtLogisticsOrderUnitRepository;
|
|
|
+ private final VehicleTraceClient vehicleTraceClient;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
|
RemoteSystemService remoteSystemService;
|
|
|
|
|
|
@@ -528,19 +533,21 @@ public class kwfTruckTraceService {
|
|
|
public VehicleReturnData getVehicleReturnData(String truckId) {
|
|
|
VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
|
|
|
vehicleDataDTO.setCarNo(truckId);
|
|
|
- String s = null;
|
|
|
+
|
|
|
try {
|
|
|
- s = HttpUtil.postJson(urlConfigProperties.getApiBaseUrl()+ UrlConstants.QUERY_REAL_TIME_TRACE_URL, JSON.toJSONString(vehicleDataDTO), null);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("查询任务轨迹异常",e);
|
|
|
+ // 使用 Feign 调用查询实时位置
|
|
|
+ BaseResult<VehicleTraceResponse> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
|
|
|
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(s)){
|
|
|
+ if (result == null || result.getCode() != HttpStatus.SUCCESS_CODE || result.getData() == null) {
|
|
|
+ log.warn("查询实时轨迹返回空数据, 车牌号: {}", truckId);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return result.getData().getData();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询任务轨迹异常, 车牌号: {}", truckId, e);
|
|
|
return null;
|
|
|
}
|
|
|
- JSONObject jsonObject = JSON.parseObject(s, JSONObject.class);
|
|
|
- String data = JSON.toJSONString(jsonObject.get("data"));
|
|
|
- return JSON.parseObject(data, VehicleReturnData.class);
|
|
|
}
|
|
|
|
|
|
private static CurrentTaskTraceReqVo.CurrentTaskTrace getCurrentTaskTrace(VehicleReturnData e) {
|
|
|
@@ -601,11 +608,19 @@ public class kwfTruckTraceService {
|
|
|
.orElse(null)));
|
|
|
req.setVehicleDataVO(vehicleDataVO);
|
|
|
req.setStatus("1");
|
|
|
+
|
|
|
try {
|
|
|
- String url = urlConfigProperties.getApiBaseUrl();
|
|
|
- HttpUtil.postJson(url+ UrlConstants.VEHICLE_TRAJECTORY, JSON.toJSONString(req), null);
|
|
|
+ // 使用 Feign 调用上报车辆轨迹
|
|
|
+ BaseResult<Void> result = vehicleTraceClient.saveVehicleData(req);
|
|
|
+
|
|
|
+ if (result == null || result.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
+ log.error("app上报车辆轨迹失败, 响应: {}", result);
|
|
|
+ throw new BusinessException("app上报车辆轨迹异常");
|
|
|
+ }
|
|
|
+ } catch (BusinessException e) {
|
|
|
+ throw e;
|
|
|
} catch (Exception e) {
|
|
|
- log.error("app上报车辆轨迹异常",e);
|
|
|
+ log.error("app上报车辆轨迹异常", e);
|
|
|
throw new BusinessException("app上报车辆轨迹异常");
|
|
|
}
|
|
|
String key = CommonConstants.TRUCK_LOCATION + truckId+CommonConstants.UNDERSCORE;
|