Procházet zdrojové kódy

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

donglang před 1 měsícem
rodič
revize
29562ac9d8
16 změnil soubory, kde provedl 213 přidání a 33 odebrání
  1. 15 0
      sckw-gateway/src/main/java/com/sckw/gateway/filter/AuthenticationFilter.java
  2. 4 0
      sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/model/dto/res/ContractTradeOrderInfo.java
  3. 2 2
      sckw-modules-api/sckw-transport-api/src/main/java/com/sckw/transport/api/feign/VehicleTraceClient.java
  4. 25 8
      sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/operateService/KwcContractTradeService.java
  5. 2 2
      sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/service/KwfTruckService.java
  6. 11 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtLogisticsOrderController.java
  7. 4 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/GenerateTraceReq.java
  8. 21 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/LogisticsOrderUnitReq.java
  9. 37 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/LogisticsOrderUnitResp.java
  10. 7 2
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/MapVehicleVo.java
  11. 7 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/repository/KwtLogisticsOrderRepository.java
  12. 9 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/repository/KwtLogisticsOrderUnitRepository.java
  13. 48 0
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtTransportCommonService.java
  14. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderV1Service.java
  15. 1 1
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/VehicleExceptionService.java
  16. 19 15
      sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/kwfTruckTraceService.java

+ 15 - 0
sckw-gateway/src/main/java/com/sckw/gateway/filter/AuthenticationFilter.java

@@ -93,6 +93,21 @@ public class AuthenticationFilter implements GlobalFilter, Ordered {
         String requestUri = request.getPath().value();
         /*1、非token校验接口放行*/
         if (EXCLUDEPATH.contains(requestUri)) {
+            Map<String, Object> tokenMap = EncryUtil.descryV2(Global.PRI_KEY, token);
+            if (tokenMap != null) {
+                Long userId = StringUtils.isNotBlank(tokenMap.get("userId")) ? NumberUtils.parseLong(tokenMap.get("userId")) : null;
+                String key = Global.getFullUserLoginKey(systemType, userId);
+
+                String userInfoStr = RedissonUtils.getString(key);
+                LoginUserInfo loginUserInfo = StringUtils.isNotBlank(userInfoStr) ? com.alibaba.fastjson.JSON.parseObject(userInfoStr, LoginUserInfo.class) : null;
+                if (Objects.nonNull(loginUserInfo)) {
+                    loginUserInfo.setClientType(clientType);
+                    String loginEntStr = RedissonUtils.getString(Global.getFullUserEntKey(loginUserInfo.getEntId()));
+                    LoginEntInfo loginEntInfo = StringUtils.isNotBlank(loginEntStr) ? com.alibaba.fastjson.JSON.parseObject(loginEntStr, LoginEntInfo.class) : null;
+                    ServerWebExchange build = buildNewExchange(exchange,loginUserInfo,loginEntInfo);
+                    return chain.filter(build);
+                }
+            }
             return chain.filter(exchange);
         }
 

+ 4 - 0
sckw-modules-api/sckw-contract-api/src/main/java/com/sckw/contract/api/model/dto/res/ContractTradeOrderInfo.java

@@ -153,4 +153,8 @@ public class ContractTradeOrderInfo implements Serializable {
      */
 
     private String salesmanPhone;
+    /**
+     * 签约价格
+     */
+    private BigDecimal signPrice;
 }

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

@@ -19,8 +19,8 @@ import java.util.List;
  */
 @FeignClient(
     name = "iot-platform",
-    url = "${vehicle.trace.api.base-url}",
-    path = "/api/transfer",
+    url = "${vehicle.trace.api.base-url}/api/transfer",
+   // path = "/api/transfer",
     configuration = VehicleTraceFeignConfig.class
 )
 @ConditionalOnProperty(name = "vehicle.trace.api.base-url")

+ 25 - 8
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/service/operateService/KwcContractTradeService.java

@@ -1840,20 +1840,32 @@ public class KwcContractTradeService {
         List<KwcContractTradeUnit> tradeUnits = kwcContractTradeUnitRepository.queryByEntIdAndUnitType(contractTradeOrderDto.getEntId(),
                 contractTradeOrderDto.getEntType());
         if (org.apache.commons.collections4.CollectionUtils.isEmpty(tradeUnits)){
-            return Collections.emptyList();
+            return  List.of();
         }
-        Map<String, KwcContractTradeUnit> conTractTradeUnitMap =
-                tradeUnits.stream().collect(Collectors.toMap(x -> x.getContractId() +
-                        "_" + x.getUnitType(), Function.identity(),
-                (x, y) -> x));
         Set<Long> contractIds =
                 tradeUnits.stream().map(KwcContractTradeUnit::getContractId).collect(Collectors.toSet());
+
+        List<KwcContractTradeUnit> tradeUnits1 = kwcContractTradeUnitRepository.queryByContractIds(contractIds);
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(tradeUnits1)){
+            return List.of();
+        }
+        Map<String, KwcContractTradeUnit> conTractTradeUnitMap =
+                tradeUnits1.stream().collect(Collectors.toMap(x -> x.getContractId() +
+                                "_" + x.getUnitType(), Function.identity(),
+                        (x, y) -> x));
+        contractIds= tradeUnits1.stream()
+                .filter(x -> Objects.equals(x.getEntId(), LoginUserHolder.getEntId()) && Objects.equals(x.getUnitType(),
+                        2))
+                .map(KwcContractTradeUnit::getContractId)
+                .collect(Collectors.toSet());
         //查询商品信息
         List<KwcContractTradeGoods> kwcContractGoods = kwcContractTradeGoodsRepository.queryByContractIdsAndGoodsId(contractIds,
                 contractTradeOrderDto.getGoodsId());
         if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwcContractGoods)){
             return Collections.emptyList();
         }
+        Map<Long, KwcContractTradeGoods> contractGoodsMap = kwcContractGoods.stream()
+                .collect(Collectors.toMap(KwcContractTradeGoods::getContractId,Function.identity(),(x,y)->x));
         //只查询已签约的
         Set<Long> contractIdList = kwcContractGoods.stream()
                 .filter(x->Objects.equals(x.getStatus(), ContractStatusEnum.SIGNED.getCode()))
@@ -1864,8 +1876,11 @@ public class KwcContractTradeService {
         if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwcContractTrades)){
             return Collections.emptyList();
         }
+        kwcContractTrades = kwcContractTrades.stream()
+                .filter(x-> Objects.equals(x.getStatus(), ContractStatusEnum.SIGNED.getCode()))
+                .collect(Collectors.toList());
         return kwcContractTrades.stream()
-                .map(x-> getContractTradeOrderInfo(x, conTractTradeUnitMap,contractTradeOrderDto.getEntType()))
+                .map(x-> getContractTradeOrderInfo(x, conTractTradeUnitMap,contractTradeOrderDto.getEntType(),contractGoodsMap))
                 .collect(Collectors.toList());
     }
     private static void checkParam(Long contractTradeOrderDto, Long contractTradeOrderDto1, Integer contractTradeOrderDto2) {
@@ -1881,7 +1896,7 @@ public class KwcContractTradeService {
     }
     @NotNull
     private static ContractTradeOrderInfo getContractTradeOrderInfo(KwcContractTrade c, Map<String,
-            KwcContractTradeUnit> conTractTradeUnitMap,Integer entType) {
+            KwcContractTradeUnit> conTractTradeUnitMap,Integer entType, Map<Long, KwcContractTradeGoods> contractGoodsMap) {
         ContractTradeOrderInfo contractTradeOrderInfo = new ContractTradeOrderInfo();
         contractTradeOrderInfo.setId(c.getId());
         KwcContractTradeUnit unit = conTractTradeUnitMap.getOrDefault(c.getId() + "_" + entType,
@@ -1893,7 +1908,7 @@ public class KwcContractTradeService {
         contractTradeOrderInfo.setTrading(c.getTrading());
         contractTradeOrderInfo.setStartTime(c.getStartTime());
         contractTradeOrderInfo.setEndTime(c.getEndTime());
-        contractTradeOrderInfo.setAmount(c.getAmount());
+        contractTradeOrderInfo.setAmount(Objects.isNull(c.getAmount()) ? new BigDecimal("-1") : c.getAmount());
         contractTradeOrderInfo.setPerformedAmount(c.getPerformedAmount());
         contractTradeOrderInfo.setSigningUrl(c.getSigningUrl());
         contractTradeOrderInfo.setSignedUrl(c.getSignedUrl());
@@ -1912,6 +1927,8 @@ public class KwcContractTradeService {
         contractTradeOrderInfo.setUnloadWay(c.getUnloadWay());
         contractTradeOrderInfo.setSalesmanId(c.getSalesmanId());
         contractTradeOrderInfo.setSalesmanPhone(c.getSalesmanPhone());
+        KwcContractTradeGoods kwcContractTradeGoods = contractGoodsMap.getOrDefault(c.getId(), new KwcContractTradeGoods());
+        contractTradeOrderInfo.setSignPrice(Objects.nonNull(kwcContractTradeGoods.getPrice())?kwcContractTradeGoods.getPrice():new BigDecimal("-1"));
         return contractTradeOrderInfo;
     }
 

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

@@ -1632,7 +1632,7 @@ public class KwfTruckService {
             // 使用 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("查询实时轨迹返回空数据, 运单号: {}", odrderNo);
                 return null;
             }
@@ -1652,7 +1652,7 @@ public class KwfTruckService {
             // 使用 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;
             }

+ 11 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/KwtLogisticsOrderController.java

@@ -11,6 +11,7 @@ import com.sckw.transport.model.dto.LogisticsOrderFinishDto;
 import com.sckw.transport.model.dto.LogisticsOrderSubcontractDto;
 import com.sckw.transport.model.param.AddLogisticsOrderParam;
 import com.sckw.transport.model.param.LogisticsOrderResp;
+import com.sckw.transport.model.param.LogisticsOrderUnitReq;
 import com.sckw.transport.model.param.QueryLogisticsOrderReq;
 import com.sckw.transport.model.vo.*;
 import com.sckw.transport.service.KwtLogisticsConsignmentService;
@@ -24,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-
+import java.util.List;
 /**
  * @author lfdc
  * @desc 物流订单Controller-v4.2
@@ -195,4 +196,13 @@ public class KwtLogisticsOrderController {
     public BaseResult<OrderStatusStatisticsResp> orderStatusStatistics(@RequestBody QueryLogisticsOrderReq req) {
         return BaseResult.success(logisticsConsignmentService.orderStatusStatistics(req));
     }
+
+    /**
+     * 查询物流订单托运/承运企业(unitType:1托运、2承运)
+     */
+    @GetMapping("/orderUnits")
+    @Operation(summary = "查询物流订单托运/承运企业")
+    public BaseResult<List<LogisticsOrderUnitResp>> orderUnits() {
+        return BaseResult.success(transportCommonService.queryOrderUnits());
+    }
 }

+ 4 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/dto/GenerateTraceReq.java

@@ -25,7 +25,7 @@ public class GenerateTraceReq implements Serializable {
 
     @Schema(description = "运单号", example = "T88565469682136456969", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotBlank(message = "运单号不能为空")
-    private String wOrderNo;
+    private String wayOrderNo;
 
     @Schema(description = "车牌号", example = "川A888528", requiredMode = Schema.RequiredMode.REQUIRED)
     @NotBlank(message = "车牌号不能为空")
@@ -35,6 +35,9 @@ public class GenerateTraceReq implements Serializable {
     @NotBlank(message = "当前位置不能为空")
     private String currentLocation;
 
+    @Schema(description = "异常位置详细地址")
+    private String exceptionLocation;
+
     @Schema(description = "异常类型(1-车辆偏航,2-急刹车,3-超速,4-异常停车)")
     private Integer exceptionType;
 }

+ 21 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/LogisticsOrderUnitReq.java

@@ -0,0 +1,21 @@
+package com.sckw.transport.model.param;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author PC
+ */
+@Data
+public class LogisticsOrderUnitReq implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 7624865925084141417L;
+    @Schema(description = "物流订单ID")
+    @NotNull(message = "物流订单ID不能为空")
+    private Long logisticOrderId;
+}
+

+ 37 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/LogisticsOrderUnitResp.java

@@ -0,0 +1,37 @@
+package com.sckw.transport.model.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author PC
+ */
+@Data
+public class LogisticsOrderUnitResp implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 3135159552358047843L;
+    @Schema(description = "主键")
+    private Long id;
+    @Schema(description = "物流订单ID")
+    private Long lOrderId;
+    @Schema(description = "单位类型(1托运企业、2承运企业)")
+    private Integer unitType;
+    @Schema(description = "顶级企业ID")
+    private Long topEntId;
+    @Schema(description = "企业ID")
+    private Long entId;
+    @Schema(description = "企业名称")
+    private String firmName;
+    @Schema(description = "联系人ID")
+    private Long contactsId;
+    @Schema(description = "联系人姓名")
+    private String contacts;
+    @Schema(description = "联系电话")
+    private String phone;
+    @Schema(description = "备注")
+    private String remark;
+}
+

+ 7 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/vo/MapVehicleVo.java

@@ -41,12 +41,17 @@ public class MapVehicleVo implements Serializable {
 
     @Schema(description = "司机手机号")
     private String driverPhone;
+    @Schema(description = "运单ID")
+    private Long wayOrderId;
 
     @Schema(description = "运单号")
-    private String wOrderNo;
+    private String wayOrderNo;
+
+    @Schema(description = "物流订单ID")
+    private Long logisticOrderId;
 
     @Schema(description = "物流订单号")
-    private String lOrderNo;
+    private String logisticOrderNo;
 
     @Schema(description = "托运单位")
     private String consignUnit;

+ 7 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/repository/KwtLogisticsOrderRepository.java

@@ -124,4 +124,11 @@ public class KwtLogisticsOrderRepository extends ServiceImpl<KwtLogisticsOrderMa
                 .eq(KwtLogisticsOrder::getLOrderNo, lOrderNo)
                 .last("limit 1"));
     }
+
+    public List<KwtLogisticsOrder> queryByEntId(Long entId) {
+        return list(Wrappers.<KwtLogisticsOrder>lambdaQuery()
+                .eq(KwtLogisticsOrder::getDelFlag,0)
+                .eq(KwtLogisticsOrder::getEntId, entId)
+                .orderByDesc(KwtLogisticsOrder::getId));
+    }
 }

+ 9 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/repository/KwtLogisticsOrderUnitRepository.java

@@ -62,4 +62,13 @@ public class KwtLogisticsOrderUnitRepository extends ServiceImpl<KwtLogisticsOrd
                 .eq(KwtLogisticsOrderUnit::getDelFlag, 0)
                 .in(KwtLogisticsOrderUnit::getLOrderId, lOrderIds));
     }
+
+    public List<KwtLogisticsOrderUnit> queryListByLOrderId(Long lOrderId) {
+        return list(Wrappers.<KwtLogisticsOrderUnit>lambdaQuery()
+                        .eq(KwtLogisticsOrderUnit::getDelFlag, 0)
+                        .eq(KwtLogisticsOrderUnit::getLOrderId, lOrderId)
+                        .in(KwtLogisticsOrderUnit::getUnitType, 1, 2)
+                        .orderByDesc(KwtLogisticsOrderUnit::getCreateTime)
+        );
+    }
 }

+ 48 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtTransportCommonService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.contract.api.RemoteContractService;
@@ -44,11 +45,16 @@ import com.sckw.transport.model.*;
 import com.sckw.transport.model.dto.*;
 import com.sckw.transport.model.param.ContractParam;
 import com.sckw.transport.model.param.LogisticsOrderParam;
+import com.sckw.transport.model.vo.LogisticsOrderUnitResp;
 import com.sckw.transport.model.vo.*;
+import com.sckw.transport.repository.KwtLogisticsOrderRepository;
+import com.sckw.transport.repository.KwtLogisticsOrderUnitRepository;
 import io.seata.spring.annotation.GlobalTransactional;
 import jakarta.annotation.Resource;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cloud.stream.function.StreamBridge;
 import org.springframework.stereotype.Service;
@@ -67,6 +73,7 @@ import java.util.stream.Collectors;
  */
 @Slf4j
 @Service
+@RequiredArgsConstructor
 public class KwtTransportCommonService {
 
     @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 10000)
@@ -136,6 +143,8 @@ public class KwtTransportCommonService {
     @Autowired
     private KwtLogisticsOrderLineFreightRateMapper kwtLogisticsOrderLineFreightRateMapper;
 
+    private final KwtLogisticsOrderUnitRepository logisticsOrderUnitRepository;
+    private final KwtLogisticsOrderRepository logisticsOrderRepository;
     /**
      * 查看订单详情
      *
@@ -1878,4 +1887,43 @@ public class KwtTransportCommonService {
         }
 
     }
+
+    /**
+     * 查询物流订单托运/承运企业
+     */
+    public List<LogisticsOrderUnitResp> queryOrderUnits() {
+        log.info("查询物流订单托运/承运企业");
+        Long entId = LoginUserHolder.getEntId();
+        //根据企业查询物流订单
+        List<KwtLogisticsOrder> logisticsOrders = logisticsOrderRepository.queryByEntId(entId);
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(logisticsOrders)){
+            return List.of();
+        }
+        List<Long> logIds = logisticsOrders.stream()
+                .map(KwtLogisticsOrder::getId)
+                .collect(Collectors.toList());
+        List<KwtLogisticsOrderUnit> units =logisticsOrderUnitRepository.queryByLOrderIds(logIds);
+        if (CollectionUtils.isEmpty(units)){
+            return List.of();
+        }
+        return units.stream()
+                .map(KwtTransportCommonService::getLogisticsOrderUnitResp).
+                collect(Collectors.toList());
+    }
+
+    @NotNull
+    private static LogisticsOrderUnitResp getLogisticsOrderUnitResp(KwtLogisticsOrderUnit u) {
+        LogisticsOrderUnitResp resp = new LogisticsOrderUnitResp();
+        resp.setId(u.getId());
+        resp.setLOrderId(u.getLOrderId());
+        resp.setUnitType(u.getUnitType());
+        resp.setTopEntId(u.getTopEntId());
+        resp.setEntId(u.getEntId());
+        resp.setFirmName(u.getFirmName());
+        resp.setContactsId(u.getContactsId());
+        resp.setContacts(u.getContacts());
+        resp.setPhone(u.getPhone());
+        resp.setRemark(u.getRemark());
+        return resp;
+    }
 }

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

@@ -2208,7 +2208,7 @@ public class KwtWaybillOrderV1Service {
                     vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
                     BaseResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = vehicleTraceClient.queryVehicleDataList(vehicleDataDTO1);
                     
-                    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> vehicleReturn = result.getData();
                         List<VehicleRouteData> vehicleReturnData = vehicleReturn.stream().map(x->{
                             VehicleRouteData vehicleRouteData = new VehicleRouteData();

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

@@ -144,7 +144,7 @@ public class VehicleExceptionService {
                 // 默认离线
                 Integer locationStatus = 0;
                 
-                if (result != null && result.getCode() == 200 && result.getData() != null) {
+                if (result != null && result.getCode() == 0 && result.getData() != null) {
                     VehicleReturnData vehicleData = result.getData();
                     
                     // 判断30分钟内有定位数据为在线

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

@@ -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());