Ver Fonte

Merge remote-tracking branch 'origin/dev_20251130' into dev_20251130

xucaiqin há 1 mês atrás
pai
commit
9b20901448
16 ficheiros alterados com 348 adições e 38 exclusões
  1. 68 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/BaseIotResult.java
  2. 4 3
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/feign/VehicleTraceClient.java
  3. 84 3
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/feign/VehicleTraceFeignConfig.java
  4. 59 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/LocalDateTimeDeserializer.java
  5. 4 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/VehicleReturnData.java
  6. 26 0
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/param/AddLogisticOrderParam.java
  7. 5 4
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  8. 6 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dubbo/TransportServiceImpl.java
  9. 26 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/AddLogisticOrderDTO.java
  10. 11 8
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/VehiclesTrajectoryReq.java
  11. 22 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtAcceptCarriageOrderService.java
  12. 10 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtLogisticsConsignmentService.java
  13. 3 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java
  14. 4 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/VehicleExceptionService.java
  15. 15 14
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/kwfTruckTraceService.java
  16. 1 1
      sckw-modules/sckw-transport/src/main/resources/bootstrap.yml

+ 68 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/response/BaseIotResult.java

@@ -0,0 +1,68 @@
+package com.sckw.core.web.response;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author: donglang
+ * @CreateTime: 2025-10-09
+ * @Description: 返回模型
+ * @Version: 1.0
+ */
+
+@Data
+public class BaseIotResult<T> implements Serializable {
+
+
+    /**
+     * 处理是否成功
+     */
+    protected boolean success = true;
+
+    /**
+     * 错误码
+     */
+    protected String code;
+
+    /**
+     * 错误信息
+     */
+    protected String message;
+
+    /**
+     * 业务数据
+     */
+    protected T data;
+
+    /**
+     * 构建成功结果,包含具体信息
+     */
+    public static <T> BaseIotResult<T> success(T data) {
+        BaseIotResult<T> result = new BaseIotResult<>();
+        result.setSuccess(true);
+        result.setCode("0");
+        result.setData(data);
+        return result;
+    }
+
+    /**
+     * 构建成功结果,无返回具体信息
+     */
+    public static <T> BaseIotResult<T> success() {
+        return success(null);
+    }
+
+    /**
+     * 构建失败结果,返回错误信息
+     */
+    public static <T> BaseIotResult<T> error(String code, String message) {
+        BaseIotResult<T> result = new BaseIotResult<>();
+        result.setSuccess(false);
+        result.setCode(code);
+        result.setMessage(message);
+        return result;
+    }
+
+}

+ 4 - 3
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/feign/VehicleTraceClient.java

@@ -1,5 +1,6 @@
 package com.sckw.transport.api.feign;
 
+import com.sckw.core.web.response.BaseIotResult;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.transport.api.model.dto.VehicleDataDTO;
 import com.sckw.transport.api.model.dto.VehicleReturnData;
@@ -32,7 +33,7 @@ public interface VehicleTraceClient {
      * @return 车辆位置信息
      */
     @PostMapping("/queryRealTimeLocation")
-    BaseResult<VehicleReturnData> queryRealTimeLocation(@RequestBody VehicleDataDTO vehicleDataDTO);
+    BaseIotResult<VehicleReturnData> queryRealTimeLocation(@RequestBody VehicleDataDTO vehicleDataDTO);
 
     /**
      * 查询车辆轨迹列表
@@ -40,7 +41,7 @@ public interface VehicleTraceClient {
      * @return 车辆轨迹列表
      */
     @PostMapping("/queryVehicleDataList")
-    BaseResult<List<VehicleReturnData>> queryVehicleDataList(@RequestBody VehicleDataDTO vehicleDataDTO);
+    BaseIotResult<List<VehicleReturnData>> queryVehicleDataList(@RequestBody VehicleDataDTO vehicleDataDTO);
 
     /**
      * 上报车辆轨迹
@@ -48,5 +49,5 @@ public interface VehicleTraceClient {
      * @return 上报结果
      */
     @PostMapping("/saveVehicleData")
-    BaseResult<Void> saveVehicleData(@RequestBody Object request);
+    BaseIotResult<Void> saveVehicleData(@RequestBody Object request);
 }

+ 84 - 3
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/feign/VehicleTraceFeignConfig.java

@@ -1,13 +1,27 @@
 package com.sckw.transport.api.feign;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import feign.Logger;
 import feign.Request;
+import feign.Response;
 import feign.Retryer;
+import feign.codec.Decoder;
 import feign.codec.ErrorDecoder;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.cloud.openfeign.support.ResponseEntityDecoder;
+import org.springframework.cloud.openfeign.support.SpringDecoder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.util.StreamUtils;
 
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.nio.charset.StandardCharsets;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -56,9 +70,76 @@ public class VehicleTraceFeignConfig {
     @Bean
     public ErrorDecoder errorDecoder() {
         return (methodKey, response) -> {
-            log.error("车辆轨迹服务调用失败, 方法: {}, 状态码: {}", 
-                methodKey, response.status());
-            return new RuntimeException("车辆轨迹服务调用失败: " + response.reason());
+            String responseBody = "";
+            try {
+                if (response.body() != null) {
+                    responseBody = new String(StreamUtils.copyToByteArray(response.body().asInputStream()), StandardCharsets.UTF_8);
+                }
+            } catch (IOException e) {
+                log.warn("读取响应体失败", e);
+            }
+            log.error("车辆轨迹服务调用失败, 方法: {}, 状态码: {}, 响应体: {}", 
+                methodKey, response.status(), responseBody);
+            return new RuntimeException("车辆轨迹服务调用失败: " + response.reason() + ", 响应: " + responseBody);
+        };
+    }
+
+    /**
+     * 自定义 Feign 解码器,支持 Java 8 时间类型(LocalDateTime 等)
+     * 支持 ISO 8601 格式:2025-12-05T00:00:00.000+00:00
+     */
+    @Bean
+    public Decoder feignDecoder() {
+        ObjectMapper objectMapper = new ObjectMapper();
+        // 注册 Java 8 时间模块(自动支持 ISO 8601 格式)
+        objectMapper.registerModule(new JavaTimeModule());
+        // 禁用将日期写为时间戳(使用 ISO 8601 字符串格式)
+        objectMapper.disable(com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+        // 忽略未知属性,避免外部服务返回多余字段导致解析失败
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        // 允许空对象
+        objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
+        // 允许单值作为数组
+        objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+        // 允许空值
+        objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true);
+        
+        MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper);
+        ObjectFactory<HttpMessageConverters> objectFactory = () -> new HttpMessageConverters(converter);
+        
+        // 包装解码器,添加错误日志
+        Decoder defaultDecoder = new ResponseEntityDecoder(new SpringDecoder(objectFactory));
+        return new Decoder() {
+            @Override
+            public Object decode(Response response, Type type) throws IOException {
+                // 先保存响应体内容,以便在解码失败时记录日志
+                String responseBody = "";
+                byte[] bodyBytes = null;
+                if (response.body() != null) {
+                    try {
+                        bodyBytes = StreamUtils.copyToByteArray(response.body().asInputStream());
+                        responseBody = new String(bodyBytes, StandardCharsets.UTF_8);
+                    } catch (IOException ex) {
+                        log.warn("读取响应体失败", ex);
+                    }
+                }
+                
+                try {
+                    // 使用保存的响应体重新构建 Response,因为流已经被读取
+                    if (bodyBytes != null) {
+                        Response rebuiltResponse = response.toBuilder()
+                            .body(bodyBytes)
+                            .build();
+                        return defaultDecoder.decode(rebuiltResponse, type);
+                    } else {
+                        return defaultDecoder.decode(response, type);
+                    }
+                } catch (Exception e) {
+                    log.error("Feign 解码失败, 类型: {}, 状态码: {}, 响应体: {}, 错误: {}", 
+                        type, response.status(), responseBody, e.getMessage(), e);
+                    throw e;
+                }
+            }
         };
     }
 }

+ 59 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/LocalDateTimeDeserializer.java

@@ -0,0 +1,59 @@
+package com.sckw.transport.api.model.dto;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+
+/**
+ * 自定义 LocalDateTime 反序列化器
+ * 支持解析带时区的 ISO 8601 格式(如:2025-12-05T00:00:00.000+00:00)
+ * 自动转换为 LocalDateTime(忽略时区信息)
+ */
+@Slf4j
+public class LocalDateTimeDeserializer extends StdDeserializer<LocalDateTime> {
+
+    private static final long serialVersionUID = 1L;
+
+    public LocalDateTimeDeserializer() {
+        super(LocalDateTime.class);
+    }
+
+    @Override
+    public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
+        String dateTimeStr = p.getText();
+        if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
+            return null;
+        }
+
+        dateTimeStr = dateTimeStr.trim();
+
+        // 优先尝试解析带时区的格式(如:2025-12-05T00:00:00.000+00:00)
+        // OffsetDateTime 可以解析带时区偏移的 ISO 8601 格式
+        try {
+            OffsetDateTime offsetDateTime = OffsetDateTime.parse(dateTimeStr);
+            return offsetDateTime.toLocalDateTime();
+        } catch (DateTimeParseException e) {
+            // 如果解析失败,尝试不带时区的格式
+            try {
+                // 尝试解析不带时区的 ISO 格式(如:2025-12-05T00:00:00 或 2025-12-05T00:00:00.000)
+                return LocalDateTime.parse(dateTimeStr, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
+            } catch (DateTimeParseException e2) {
+                // 尝试其他常见格式
+                try {
+                    return LocalDateTime.parse(dateTimeStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                } catch (DateTimeParseException e3) {
+                    log.error("所有时间格式解析失败: {}", dateTimeStr, e3);
+                    throw new IOException("无法解析时间字符串: " + dateTimeStr, e3);
+                }
+            }
+        }
+    }
+}
+

+ 4 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/dto/VehicleReturnData.java

@@ -1,5 +1,6 @@
 package com.sckw.transport.api.model.dto;
 
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import lombok.Data;
 
 import java.io.Serial;
@@ -19,7 +20,10 @@ public class VehicleReturnData implements Serializable {
 
     /**
      * 时间戳
+     * IoT平台返回ISO 8601格式:2025-12-05T00:00:00.000+00:00
+     * 使用自定义反序列化器支持带时区的格式
      */
+    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
     private LocalDateTime ts;
 
     /**

+ 26 - 0
sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/model/param/AddLogisticOrderParam.java

@@ -38,6 +38,32 @@ public class AddLogisticOrderParam implements Serializable {
      */
     @NotBlank(message = "订单编号不能为空")
     private String tradeOrderNo;
+
+    /**
+     * 非托运方单位
+     */
+    @NotBlank(message = "非托运方单位名称不能为空")
+    private String nonConsignCompany;
+    /**
+     * 非托运方单位id
+     */
+    @NotBlank(message = "非托运方单位id不能为空")
+    private Long nonConsignCompanyId;
+    /**
+     * 非托运方联系电话
+     */
+    @NotBlank(message = "非托运方联系电话不能为空")
+    private String nonConsignContactPhone;
+    /**
+     * 非托运方联系人
+     */
+    @NotBlank(message = "非托运方联系人不能为空")
+    private String nonConsignContacts;
+    /**
+     * 非托运方联系人id
+     */
+    @NotBlank(message = "非托运方联系人id不能为空")
+    private Long nonConsignContactsId;
     /**
      * 托运单位
      */

+ 5 - 4
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java

@@ -26,6 +26,7 @@ import com.sckw.core.web.constant.HttpStatus;
 import com.sckw.core.web.context.LoginEntHolder;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.request.HttpClientUtil;
+import com.sckw.core.web.response.BaseIotResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.core.web.response.result.PageDataResult;
@@ -1630,9 +1631,9 @@ public class KwfTruckService {
         
         try {
             // 使用 Feign 调用查询实时位置
-            BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+            BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
             
-            if (result == null || result.getCode() != 0 || result.getData() == null) {
+            if (result == null || result.getCode() != "0" || result.getData() == null) {
                 log.warn("查询实时轨迹返回空数据, 运单号: {}", odrderNo);
                 return null;
             }
@@ -1650,9 +1651,9 @@ public class KwfTruckService {
         
         try {
             // 使用 Feign 调用查询实时位置
-            BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+            BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
             
-            if (result == null || result.getCode() != 0 || result.getData() == null) {
+            if (result == null || result.getCode() != "0" || result.getData() == null) {
                 log.warn("查询实时轨迹返回空数据, 车牌号: {}", truckId);
                 return null;
             }

+ 6 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/dubbo/TransportServiceImpl.java

@@ -1262,6 +1262,12 @@ public class TransportServiceImpl implements TransportRemoteService {
         addLogisticOrderDTO.setUserId(param.getUserId());
         addLogisticOrderDTO.setTradeOrderId(param.getTradeOrderId());
         addLogisticOrderDTO.setTradeOrderNo(param.getTradeOrderNo());
+        addLogisticOrderDTO.setNonConsignCompany(param.getNonConsignCompany());
+        addLogisticOrderDTO.setNonConsignCompanyId(param.getNonConsignCompanyId());
+        addLogisticOrderDTO.setNonConsignContactPhone(param.getNonConsignContactPhone());
+        addLogisticOrderDTO.setNonConsignContacts(param.getNonConsignContacts());
+        addLogisticOrderDTO.setNonConsignContactsId(param.getNonConsignContactsId());
+
         addLogisticOrderDTO.setConsignCompany(param.getConsignCompany());
         addLogisticOrderDTO.setConsignCompanyId(param.getConsignCompanyId());
         addLogisticOrderDTO.setConsignContactPhone(param.getConsignContactPhone());

+ 26 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/AddLogisticOrderDTO.java

@@ -36,6 +36,32 @@ public class AddLogisticOrderDTO implements Serializable {
      */
     @NotBlank(message = "订单编号不能为空")
     private String tradeOrderNo;
+    /**
+     * 非托运方单位
+     */
+    @NotBlank(message = "非托运方单位名称不能为空")
+    private String nonConsignCompany;
+    /**
+     * 非托运方单位id
+     */
+    @NotBlank(message = "非托运方单位id不能为空")
+    private Long nonConsignCompanyId;
+    /**
+     * 非托运方联系电话
+     */
+    @NotBlank(message = "非托运方联系电话不能为空")
+    private String nonConsignContactPhone;
+    /**
+     * 非托运方联系人
+     */
+    @NotBlank(message = "非托运方联系人不能为空")
+    private String nonConsignContacts;
+    /**
+     * 非托运方联系人id
+     */
+    @NotBlank(message = "非托运方联系人id不能为空")
+    private Long nonConsignContactsId;
+
     /**
      * 托运单位
      */

+ 11 - 8
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/VehiclesTrajectoryReq.java

@@ -1,20 +1,21 @@
 package com.sckw.transport.model.param;
 
 import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.Valid;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
-import java.time.LocalDateTime;
-import java.util.Date;
+import java.io.Serial;
+import java.io.Serializable;
 
 /**
  * @author PC
  */
 @Data
-@Valid
-public class VehiclesTrajectoryReq {
+public class VehiclesTrajectoryReq implements Serializable {
+    
+    @Serial
+    private static final long serialVersionUID = 1L;
     private String ts;
     /**
      * 手机号
@@ -47,7 +48,7 @@ public class VehiclesTrajectoryReq {
      * 车速(km/h)
      */
     @Schema(description = "车速(km/h)")
-    @NotBlank(message = "车速speed不能为空")
+    @NotNull(message = "车速speed不能为空")
     private Float speed;
 
     /**
@@ -118,8 +119,10 @@ public class VehiclesTrajectoryReq {
     private VehicleDataVO vehicleDataVO;
 
     @Data
-    @Valid
-    public static class VehicleDataVO {
+    public static class VehicleDataVO implements Serializable {
+        
+        @Serial
+        private static final long serialVersionUID = 1L;
 
         /**
          * 车牌

+ 22 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtAcceptCarriageOrderService.java

@@ -3332,6 +3332,28 @@ public class KwtAcceptCarriageOrderService {
         unit.setUpdateBy(orderDTO.getUserId());
         unit.setUpdateTime(new Date());
         savelogOrderUnitList.add(unit);
+        KwtLogisticsOrderUnit notifyUnit = new KwtLogisticsOrderUnit();
+
+        notifyUnit.setId(new IdWorker(NumberConstant.THREE).nextId());
+        notifyUnit.setLOrderId(lOrderId);
+        notifyUnit.setUnitType(NumberConstant.THREE);
+        notifyUnit.setEntId(orderDTO.getNonConsignCompanyId());
+        EntCacheResDto ent2 = entMap.get(orderDTO.getNonConsignCompanyId());
+        if (Objects.isNull(ent2)) {
+            throw new BusinessException("企业:" + orderDTO.getNonConsignCompany() + "的一级企业信息不存在!");
+        }
+        notifyUnit.setContactsId(orderDTO.getNonConsignContactsId());
+        notifyUnit.setTopEntId(ent2.getId());
+        notifyUnit.setFirmName(orderDTO.getNonConsignCompany());
+        notifyUnit.setContacts(orderDTO.getNonConsignContacts());
+        notifyUnit.setPhone(orderDTO.getNonConsignContactPhone());
+//        unit.setRemark(orderDTO.getRemark());
+        notifyUnit.setStatus(NumberConstant.ZERO);
+        notifyUnit.setCreateBy(orderDTO.getUserId());
+        notifyUnit.setCreateTime(new Date());
+        notifyUnit.setUpdateBy(orderDTO.getUserId());
+        notifyUnit.setUpdateTime(new Date());
+        savelogOrderUnitList.add(notifyUnit);
     }
 
     private static void setLogisticContractInfo(AddLogisticOrderDTO orderDTO,LogisticData x, Long lOrderId, List<KwtLogisticsOrderContract> saveContractList) {

+ 10 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtLogisticsConsignmentService.java

@@ -2241,7 +2241,9 @@ public class KwtLogisticsConsignmentService {
 
         //根据商品名称查询物流订单
         Set<Long> logOrderIds = getLogOrderIds(req, entList,allEnt);
-
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(logOrderIds) && org.apache.commons.collections4.CollectionUtils.isNotEmpty(entList)){
+            return PageDataResult.empty(req.getPageNum(), req.getPageSize());
+        }
 
         //分页查询物流订单
        IPage<KwtLogisticsOrder> page = logisticsOrderRepository.queryByPage(logOrderIds,req.getTradeOrderId(), req.getOrderNo(),req.getOrderStatus(),
@@ -3055,6 +3057,13 @@ public class KwtLogisticsConsignmentService {
 
         //根据商品名称查询物流订单
         Set<Long> logOrderIds = getLogOrderIds(req, entList,allEnt);
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(logOrderIds) && org.apache.commons.collections4.CollectionUtils.isNotEmpty(entList)){
+            Map<Integer, List<KwtLogisticsOrder>> statusAndLogOrdersMap = Maps.newHashMap() ;
+            List<OrderStatusStatisticsResp.OrderStatusStatistics> statistics = orderV1Enums.stream()
+                    .map(o -> getOrderStatusStatistics(o, statusAndLogOrdersMap))
+                    .collect(Collectors.toList());
+            orderStatusStatisticsResp.setOrderStatusStatistics(statistics);
+         }
         List<KwtLogisticsOrder> logisticsOrders =logisticsOrderRepository.queryList(logOrderIds,req.getTradeOrderId(), req.getOrderNo(),req.getOrderStatus(),
                 req.getStartTime(), req.getEndTime());
 

+ 3 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java

@@ -27,6 +27,7 @@ import com.sckw.core.utils.*;
 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.BaseIotResult;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.core.web.response.result.PageDataResult;
@@ -2206,9 +2207,9 @@ public class KwtWaybillOrderV1Service {
                     // 使用 Feign 调用查询车辆轨迹列表
                     com.sckw.transport.api.model.dto.VehicleDataDTO vehicleDataDTO1 = new com.sckw.transport.api.model.dto.VehicleDataDTO();
                     vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
-                    BaseResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = vehicleTraceClient.queryVehicleDataList(vehicleDataDTO1);
+                    BaseIotResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = vehicleTraceClient.queryVehicleDataList(vehicleDataDTO1);
                     
-                    if (result != null && result.getCode()== 0 && result.getData() != null) {
+                    if (result != null && org.apache.commons.lang3.StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
                         List<com.sckw.transport.api.model.dto.VehicleReturnData> vehicleReturn = result.getData();
                         List<VehicleRouteData> vehicleReturnData = vehicleReturn.stream().map(x->{
                             VehicleRouteData vehicleRouteData = new VehicleRouteData();

+ 4 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/VehicleExceptionService.java

@@ -1,6 +1,7 @@
 package com.sckw.transport.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.sckw.core.web.response.BaseIotResult;
 import com.sckw.core.web.response.result.PageDataResult;
 import com.sckw.transport.api.feign.VehicleTraceClient;
 import com.sckw.transport.api.model.dto.VehicleDataDTO;
@@ -14,6 +15,7 @@ import com.sckw.transport.repository.KwtVehicleExceptionRepository;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
@@ -140,11 +142,11 @@ public class VehicleExceptionService {
             try {
                 VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
                 vehicleDataDTO.setCarNo(truckNo);
-                BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+                BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
                 // 默认离线
                 Integer locationStatus = 0;
                 
-                if (result != null && result.getCode() == 0 && result.getData() != null) {
+                if (result != null && StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
                     VehicleReturnData vehicleData = result.getData();
                     
                     // 判断30分钟内有定位数据为在线

+ 15 - 14
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/kwfTruckTraceService.java

@@ -18,6 +18,7 @@ import com.sckw.core.utils.DateUtils;
 import com.sckw.core.utils.HttpUtil;
 import com.sckw.core.web.constant.CommonConstants;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.core.web.response.BaseIotResult;
 import com.sckw.core.web.response.result.PageDataResult;
 import com.sckw.core.web.response.BaseResult;
 import com.sckw.fleet.api.RemoteFleetService;
@@ -544,9 +545,9 @@ public class kwfTruckTraceService {
 
         try {
             // 使用 Feign 调用查询实时位置
-            BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+            BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
 
-            if (result == null || result.getCode() != 0 || result.getData() == null) {
+            if (result == null || result.getCode() != "0" || result.getData() == null) {
                 log.warn("查询实时轨迹返回空数据, 车牌号: {}", truckId);
                 return null;
             }
@@ -619,9 +620,9 @@ public class kwfTruckTraceService {
         
         try {
             // 使用 Feign 调用上报车辆轨迹
-            BaseResult<Void> result = vehicleTraceClient.saveVehicleData(req);
+            BaseIotResult<Void> result = vehicleTraceClient.saveVehicleData(req);
             
-            if (result == null || result.getCode() != 0) {
+            if (result == null || result.getCode() != "0") {
                 log.error("app上报车辆轨迹失败, 响应: {}", result);
                 throw new BusinessException("app上报车辆轨迹异常");
             }
@@ -720,9 +721,9 @@ public class kwfTruckTraceService {
             try {
                 VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
                 vehicleDataDTO.setCarNo(truckNo);
-                BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+                BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
 
-                if (result == null || result.getCode() != 0 || result.getData() == null) {
+                if (result == null || !Objects.equals(result.getCode(), "0") || result.getData() == null) {
                     // 无定位数据,设置为离线
                     truckLocationStatusMap.put(truckNo, 0);
                     return truckLocationStatusMap;
@@ -1034,11 +1035,11 @@ public class kwfTruckTraceService {
             try {
                 VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
                 vehicleDataDTO.setCarNo(truckNo);
-                BaseResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
-                
+                BaseIotResult<VehicleReturnData> result = vehicleTraceClient.queryRealTimeLocation(vehicleDataDTO);
+                log.info("查询车辆数据中台响应定位信息:{}", JSON.toJSONString( result));
                 VehicleLocationInfo locationInfo = new VehicleLocationInfo();
                 
-                if (result != null && result.getCode() == 0 && result.getData() != null) {
+                if (result != null && StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
                     VehicleReturnData vehicleData = result.getData();
                     
                     // 判断定位状态
@@ -1091,10 +1092,10 @@ public class kwfTruckTraceService {
                 vehicleDataDTO.setWOrderNo(wOrderNo);
                 
                 // 调用Feign接口查询轨迹列表
-                BaseResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = 
+                BaseIotResult<List<VehicleReturnData>> result =
                         vehicleTraceClient.queryVehicleDataList(vehicleDataDTO);
-                
-                if (result != null && result.getCode() == 0 && result.getData() != null) {
+                log.info("查询车辆数据中台响应轨迹数据:{}", JSON.toJSONString( result));
+                if (result != null && StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
                     List<com.sckw.transport.api.model.dto.VehicleReturnData> traceDataList = result.getData();
                     
                     // 统计alarmCode不为null且不为0的记录数量(表示有异常报警)
@@ -1273,8 +1274,8 @@ public class kwfTruckTraceService {
 
         try {
             // 调用数据中台保存轨迹数据
-            BaseResult<Void> result = vehicleTraceClient.saveVehicleData(vehiclesTrajectoryReq);
-            if (result.getCode() != 0) {
+            BaseIotResult<Void> result = vehicleTraceClient.saveVehicleData(vehiclesTrajectoryReq);
+            if (!Objects.equals(result.getCode(), "0")) {
                 log.error("保存车辆轨迹数据失败:{}", result.getMessage());
                 throw new BusinessException("生成轨迹失败:" + result.getMessage());
             }

+ 1 - 1
sckw-modules/sckw-transport/src/main/resources/bootstrap.yml

@@ -19,7 +19,7 @@ mybatis-plus:
 logging:
   level:
     root: info
-    com.sckw.payment: debug
+    com.sckw.transport: debug
 
 # SpringDoc OpenAPI 配置
 springdoc: