liujie
2026-06-09 c96fbe6b0aeb413a17c429133ee6d81d138144b9
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpTargetedServiceController.java
@@ -2,9 +2,12 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.xiaopeng.api.feignClient.account.SysGroupMenuClient;
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.XpWhitelist;
import com.xiaopeng.api.query.operation.XpTargetedServiceQuery;
import com.xiaopeng.api.vo.account.LoginUser;
@@ -21,6 +24,7 @@
import com.xiaopeng.operation.dto.WhitelistEditDto;
import com.xiaopeng.operation.query.WhitelistPageListQuery;
import com.xiaopeng.operation.service.XpTargetedServiceService;
import com.xiaopeng.operation.service.XpTargetedServiceVehicleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -42,11 +46,13 @@
public class XpTargetedServiceController {
    @Resource
    XpTargetedServiceService xpTargetedServiceService;
    private XpTargetedServiceService xpTargetedServiceService;
    @Resource
    private TokenService tokenService;
    @Resource
    private SysGroupMenuClient groupMenuClient;
    @Resource
    private XpTargetedServiceVehicleService xpTargetedServiceVehicleService;
    @ApiOperation(value = "定向服务分页", tags = {"管理后台-定向服务分页"})
@@ -55,6 +61,8 @@
        PageInfo<XpTargetedServiceVo> pageList = xpTargetedServiceService.pageList(query);
        return R.ok(pageList);
    }
    @ApiOperation(value = "定向服务-详情", tags = {"管理后台-定向服务详情"})
    @GetMapping("/api/v1/targetedService/detail")
    public R<XpTargetedServiceVo> detail(@RequestParam Long id) {
@@ -177,6 +185,43 @@
    }
    /**
     * 获取定向服务权限
     * @param appUserId
     * @param cityCode
     * @return
     */
    @GetMapping("/logan/inner/v1/targetedService/getTargetedServiceWeight")
    public R<Integer> getTargetedServiceWeight(@RequestParam("appUserId") Long appUserId, @RequestParam("cityCode") String cityCode){
        Integer targetedServiceWeight = xpTargetedServiceService.getTargetedServiceWeight(appUserId, cityCode);
        return R.ok(targetedServiceWeight);
    }
    /**
     * 获取定向服务所有车辆
     * @return
     */
    @GetMapping("/logan/inner/v1/targetedService/getAllTargetedServiceVehicle")
    public R<List<Long>> getAllTargetedServiceVehicle(){
        List<XpTargetedService> targetedServices = xpTargetedServiceService.list(null);
        List<XpTargetedServiceVehicle> list = xpTargetedServiceVehicleService.list(new LambdaQueryWrapper<XpTargetedServiceVehicle>().in(XpTargetedServiceVehicle::getTargetedServiceId, targetedServices.stream()
                .map(XpTargetedService::getId).collect(Collectors.toList())));
        return R.ok(list.stream().map(XpTargetedServiceVehicle::getVehicleId).collect(Collectors.toList()));
    }
    /**
     * 获取定向服务所有车辆
     * @return
     */
    @GetMapping("/logan/inner/v1/targetedService/getAllTargetedServiceVehicleByCityCode")
    public R<List<XpTargetedServiceVehicle>> getAllTargetedServiceVehicleByCityCode(@RequestParam("cityCode") String cityCode){
        List<XpTargetedService> targetedServices = xpTargetedServiceService.list(new LambdaQueryWrapper<XpTargetedService>()
                .eq(XpTargetedService::getCityCode, cityCode).eq(XpTargetedService::getStatus, 1));
        List<XpTargetedServiceVehicle> list = xpTargetedServiceVehicleService.list(new LambdaQueryWrapper<XpTargetedServiceVehicle>().in(XpTargetedServiceVehicle::getTargetedServiceId, targetedServices.stream()
                .map(XpTargetedService::getId).collect(Collectors.toList())));
        return R.ok(list);
    }
}