liujie
2026-02-26 b4b7cd341ef554b3832cdb9abf210d48016d42cb
map修改远程调用
3个文件已添加
4个文件已修改
171 ■■■■■ 已修改文件
xp-robotaxi-api/src/main/java/com/xiaopeng/api/factory/operation/XpElectronicFenceClientFallbackFactory.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/operation/XpElectronicFenceClient.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpElectronicFenceController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/config/MybatisPlusConfig.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/factory/operation/XpElectronicFenceClientFallbackFactory.java
New file
@@ -0,0 +1,48 @@
package com.xiaopeng.api.factory.operation;
import com.xiaopeng.api.dto.map.XpPointExportExcelQuery;
import com.xiaopeng.api.dto.operation.PointAddDto;
import com.xiaopeng.api.dto.operation.PointMapQuery;
import com.xiaopeng.api.dto.operation.PointUpdateDto;
import com.xiaopeng.api.dto.operation.XpPointEnableDisableDto;
import com.xiaopeng.api.dto.order.HistoryEndPointsDto;
import com.xiaopeng.api.dto.order.HistoryStartPointsDto;
import com.xiaopeng.api.feignClient.operation.XpElectronicFenceClient;
import com.xiaopeng.api.feignClient.operation.XpPointClient;
import com.xiaopeng.api.model.operation.XpElectronicFence;
import com.xiaopeng.api.model.operation.XpElectronicFenceArea;
import com.xiaopeng.api.model.operation.XpPoint;
import com.xiaopeng.api.query.operation.PointListQuery;
import com.xiaopeng.api.query.operation.PointPageListListQuery;
import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo;
import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.page.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Slf4j
@Component
public class XpElectronicFenceClientFallbackFactory implements FallbackFactory<XpElectronicFenceClient> {
    @Override
    public XpElectronicFenceClient create(Throwable cause) {
        return new XpElectronicFenceClient() {
            @Override
            public R<List<XpElectronicFence>> selectBatchIds(List<String> fenceIds) {
                log.error("XpElectronicFenceClient.selectBatchIds error:{}",cause.getMessage());
                return null;
            }
            @Override
            public R<XpElectronicFence> selectById(String fenceId) {
                log.error("XpElectronicFenceClient.selectById error:{}",cause.getMessage());
                return null;
            }
        };
    }
}
xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/operation/XpElectronicFenceClient.java
New file
@@ -0,0 +1,28 @@
package com.xiaopeng.api.feignClient.operation;
import com.xiaopeng.api.factory.operation.XpElectronicFenceClientFallbackFactory;
import com.xiaopeng.api.model.operation.XpElectronicFence;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(contextId = "XpElectronicFenceClient", value = ServiceNameConstantsEnum.XP_OPERATION_SERVICE, fallbackFactory = XpElectronicFenceClientFallbackFactory.class)
public interface XpElectronicFenceClient {
    @PostMapping("/inner/xpElectronicFence/selectBatchIds")
    R<List<XpElectronicFence>> selectBatchIds(@RequestBody List<String> fenceIds);
    @GetMapping("/inner/xpElectronicFence/selectById")
    R<XpElectronicFence> selectById(@RequestParam String fenceId);
}
xp-robotaxi-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -19,6 +19,7 @@
com.xiaopeng.api.factory.operation.XpOpenCityClientFallbackFactory
com.xiaopeng.api.factory.operation.XpCouponClientFallbackFactory
com.xiaopeng.api.factory.operation.XpWhiteListClientFallbackFactory
com.xiaopeng.api.factory.operation.XpElectronicFenceClientFallbackFactory
com.xiaopeng.api.factory.operation.ReassignOrderClientFallbackFactory
com.xiaopeng.api.factory.vehicleConvoy.UserVehicleClientFallbackFactory
com.xiaopeng.api.factory.vehicleConvoy.XpFleetOperationsClientFallbackFactory
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.api.dto.map.RouteAndFareDto;
import com.xiaopeng.api.dto.operation.LonLatDto;
import com.xiaopeng.api.feignClient.operation.XpElectronicFenceClient;
import com.xiaopeng.api.feignClient.operation.XpSystemSettingClient;
import com.xiaopeng.api.model.map.XpGeoFencingPolygon;
import com.xiaopeng.api.model.operation.XpElectronicFence;
@@ -52,8 +53,7 @@
    @Resource
    private XpElectronicFenceMapper xpElectronicFenceMapper;
    private XpElectronicFenceClient xpElectronicFenceClient;
    @Resource
    private XpSystemSettingClient xpSystemSettingClient;
@@ -81,9 +81,12 @@
        if(fenceIds.isEmpty()){
            return new ArrayList<>();
        }
        List<XpElectronicFence> xpElectronicFences = xpElectronicFenceMapper.selectBatchIds(fenceIds);
        R<List<XpElectronicFence>> xpElectronicFences = xpElectronicFenceClient.selectBatchIds(fenceIds);
        if(xpElectronicFences==null){
            return new ArrayList<>();
        }
        for (XpGeoFencingPolygon polygon : xpGeoFencingPolygons) {
            XpElectronicFence xpElectronicFence = xpElectronicFences.stream().filter(e -> e.getId().toString().equals(polygon.getFenceId())).findFirst().orElse(null);
            XpElectronicFence xpElectronicFence = xpElectronicFences.getData().stream().filter(e -> e.getId().toString().equals(polygon.getFenceId())).findFirst().orElse(null);
            if(xpElectronicFence==null){
                continue;
            }
@@ -199,9 +202,9 @@
                String collect = coordinates.stream().collect(Collectors.joining(";"));
                if (ElectricFenceUtil.areaMonitoring(collect, dto.getLongitude()+","+dto.getLatitude())) {
                    String fenceId = polygon.getFenceId();
                    XpElectronicFence xpElectronicFence = xpElectronicFenceMapper.selectById(fenceId);
                    R<XpElectronicFence> xpElectronicFence = xpElectronicFenceClient.selectById(fenceId);
                    if(xpElectronicFence!=null){
                        String operationStrategy = xpElectronicFence.getOperationStrategy();
                        String operationStrategy = xpElectronicFence.getData().getOperationStrategy();
                        Boolean inOperationTime = isInOperationTime(operationStrategy);
                        if(inOperationTime){
                            vo.setStatus("inside");
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpElectronicFenceController.java
@@ -201,4 +201,28 @@
    R<List<XpElectronicFence>> getList(){
        return R.ok(xpElectronicFenceService.getList());
    }
    /**
     * 批量查询电子围栏
     * @param fenceIds
     * @return
     */
    @PostMapping("/inner/xpElectronicFence/selectBatchIds")
    public R<List<XpElectronicFence>> selectBatchIds(@RequestBody List<String> fenceIds){
        List<XpElectronicFence> xpElectronicFences = xpElectronicFenceService.listByIds(fenceIds);
        return R.ok(xpElectronicFences);
    }
    /**
     * 根据ID查询电子围栏
     * @param fenceId
     * @return
     */
    @GetMapping("/inner/xpElectronicFence/selectById")
    public R<XpElectronicFence> selectById(@RequestParam String fenceId){
        XpElectronicFence xpElectronicFence = xpElectronicFenceService.getById(fenceId);
        return R.ok(xpElectronicFence);
    }
}
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/config/MybatisPlusConfig.java
New file
@@ -0,0 +1,51 @@
package com.xiaopeng.order.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
 * @author xiaochen
 * @ClassName MybatisPlusConfig
 * @Description MybatisPlus相关配置
 * @date 2020-09-22 11:22、
 * 直接以实现类作为bean的注入(有事务管理的类)
 * @EnableTransactionManagement(proxyTargetClass = true)
 */
@Configuration
public class MybatisPlusConfig {
    private final DataUpdateHandlerConfig dataUpdateHandler;
    @Autowired
    public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) {
        this.dataUpdateHandler = dataUpdateHandler;
    }
    /**
     * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
    /**
     * 自动填充功能
     *
     * @return
     */
    @Bean
    public GlobalConfig globalConfig() {
        GlobalConfig globalConfig = new GlobalConfig();
        globalConfig.setMetaObjectHandler(dataUpdateHandler);
        return globalConfig;
    }
}
xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -87,6 +87,8 @@
import com.xiaopeng.order.vo.OrderDetailVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@@ -1651,7 +1653,7 @@
     */
    @Override
    @Transactional
//    @ShardingTransactionType(TransactionType.BASE)
    @ShardingSphereTransactionType(TransactionType.BASE)
    public void popOrder(PopOrderDto dto) {
        String orderType = dto.getOrderType();
        Long orderId = dto.getOrderId();