puzhibing
2026-04-28 19787c0b4f5f29026c1790bbb043b9186cdd0e11
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpElectronicFenceAreaServiceImpl.java
@@ -36,6 +36,7 @@
import com.xiaopeng.map.vo.WalkTimeVo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
@@ -86,6 +87,9 @@
    private GDMapGeocodingUtil gdMapGeocodingUtil;
    @Autowired
    private XpPointService xpPointService;
    @Lazy
    @Autowired
    private BootCommonService bootCommonService;
@@ -126,7 +130,7 @@
            if(xpElectronicFence.getFailureType() == 2){
                JSONArray jsonArray = JSONArray.parseArray(operationStrategy);
                if(!jsonArray.isEmpty()){
                    Boolean inOperationTime = isInOperationTime(operationStrategy);
                    Boolean inOperationTime = bootCommonService.getFenceOperation(operationStrategy);
                    if(!inOperationTime){
                        continue;
                    }
@@ -180,53 +184,7 @@
    }
    /**
     * 是否在运营内
     * @param operationStrategy 规则json字符串
     * @return
     */
    private Boolean isInOperationTime(String operationStrategy) {
        JSONArray jsonArray = JSONArray.parseArray(operationStrategy);
        Integer holidayToday = holidayUtil.isHolidayToday();
        for (Object o : jsonArray) {
            JSONObject jsonObject =JSONObject.parseObject(o.toString());
            String type = jsonObject.getString("type");
            if(type.equals(holidayToday.toString())){
                JSONArray time = jsonObject.getJSONArray("time");
                // 判断当前时间 是否在time时间段中
                for (Object object : time) {
                    String[] timeArray = object.toString().split("-");
                    String startTime = timeArray[0];
                    String endTime = timeArray[1];
                    boolean currentTimeInRange = DateUtils.isCurrentTimeInRange(startTime, endTime);
                    if(currentTimeInRange){
                        return true;
                    }
                }
            }else if(type.equals("3")){
                // 判断是什么类型 0每天  1-7 想起
                String typeStr = jsonObject.getString("typeStr");
                // 查看今天周几
                Integer week = DateUtils.getWeek();
                // 包含每天 或者  包含当天
                if(typeStr.contains("0") || typeStr.contains(week.toString())){
                    JSONArray time = jsonObject.getJSONArray("time");
                    // 判断当前时间 是否在time时间段中
                    for (Object object : time) {
                        String[] timeArray = object.toString().split("-");
                        String startTime = timeArray[0];
                        String endTime = timeArray[1];
                        boolean currentTimeInRange = DateUtils.isCurrentTimeInRange(startTime, endTime);
                        if(currentTimeInRange){
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }
@@ -260,7 +218,7 @@
                        String operationStrategy = electronicFence.getOperationStrategy();
                        Boolean inOperationTime = true;
                        if(electronicFence.getFailureType() == 2){
                            inOperationTime = isInOperationTime(operationStrategy);
                            inOperationTime = bootCommonService.getFenceOperation(operationStrategy);
                        }
                        XpElectronicFenceArea electronicFenceArea = this.getById(Long.valueOf(polygon.getAreaId()));
                        if(inOperationTime && null != electronicFenceArea && !electronicFenceArea.getDeleted()){