From e02bf5a481c0301baf40f9f729ee49f1037a0854 Mon Sep 17 00:00:00 2001
From: yyy <1083599556@qq.com>
Date: 星期日, 17 五月 2026 10:37:01 +0800
Subject: [PATCH] 修改定向服务查询

---
 xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTargetedServiceServiceImpl.java |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTargetedServiceServiceImpl.java b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTargetedServiceServiceImpl.java
index 8e452dc..25bae83 100644
--- a/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTargetedServiceServiceImpl.java
+++ b/xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTargetedServiceServiceImpl.java
@@ -1,12 +1,14 @@
 package com.xiaopeng.operation.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient;
 import com.xiaopeng.api.model.account.SysUser;
 import com.xiaopeng.api.model.operation.XpTargetedService;
 import com.xiaopeng.api.model.operation.XpTargetedServiceVehicle;
 import com.xiaopeng.api.model.operation.XpTargetedServiceWhitelist;
+import com.xiaopeng.api.model.operation.XpWhitelist;
 import com.xiaopeng.api.model.vehicleConvoy.XpVehicle;
 import com.xiaopeng.api.query.operation.XpTargetedServiceQuery;
 import com.xiaopeng.api.vo.operation.XpTargetedServiceVehicleVo;
@@ -16,6 +18,7 @@
 import com.xiaopeng.common.core.utils.SensitiveDataCryptoUtil;
 import com.xiaopeng.common.core.web.page.PageInfo;
 import com.xiaopeng.operation.mapper.XpTargetedServiceMapper;
+import com.xiaopeng.operation.service.IXpWhitelistService;
 import com.xiaopeng.operation.service.XpTargetedServiceService;
 import com.xiaopeng.operation.service.XpTargetedServiceVehicleService;
 import com.xiaopeng.operation.service.XpTargetedServiceWhitelistService;
@@ -39,6 +42,9 @@
     XpVehicleClient xpVehicleClient;
     @Resource
     XpTargetedServiceMapper xpTargetedServiceMapper;
+
+    @Resource
+    private IXpWhitelistService xpWhitelistService;
 
 
     public List<XpTargetedServiceVehicle> listByTargetedServiceId(Long targetedServiceId) {
@@ -239,7 +245,22 @@
         return null;
     }
 
-
-
-
+    @Override
+    public Integer getTargetedServiceWeight(Long appUserId, String cityCode) {
+        List<XpWhitelist> one = xpWhitelistService.list(new QueryWrapper<XpWhitelist>().eq("app_user_id", appUserId).eq("status", 1)
+                .eq("is_deleted", 0).last(" and expire_time >= DATE(NOW()) or expire_time is null"));
+        if(!one.isEmpty()){
+            List<Long> collect = one.stream().map(XpWhitelist::getId).collect(Collectors.toList());
+            List<XpTargetedServiceWhitelist> xpTargetedServiceWhitelists = xpTargetedServiceWhitelistService.list(new QueryWrapper<XpTargetedServiceWhitelist>().in("whitelist_id", collect));
+            for (XpTargetedServiceWhitelist xpTargetedServiceWhitelist : xpTargetedServiceWhitelists) {
+                XpTargetedService targetedServiceVo = this.getOne(new QueryWrapper<XpTargetedService>().eq("id", xpTargetedServiceWhitelist.getTargetedServiceId())
+                        .eq("status", 1).eq("is_deleted", 0).eq("city_code", cityCode)
+                        .last(" and (is_long_valid = 1 or now() between start_time and end_time)"));
+                if(null != targetedServiceVo){
+                    return xpTargetedServiceWhitelist.getWeight();
+                }
+            }
+        }
+        return null;
+    }
 }

--
Gitblit v1.7.1