jinglun-cloud
2026-04-24 6ecd168c3bb818397ca97650da9bfeb1b85bfd6e
src/main/java/com/zy/asrs/service/impl/BasMapEditorServiceImpl.java
@@ -19,6 +19,7 @@
import com.zy.asrs.service.BasStationService;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.asrs.utils.MapExcelUtils;
import com.zy.common.utils.NavigateSolution;
import com.zy.common.utils.RedisUtil;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
@@ -46,7 +47,7 @@
    private static final String FREE_EDITOR_MODE = "free-v1";
    private static final Set<String> RUNTIME_TYPES = new HashSet<>(Arrays.asList(
            "shelf", "crn", "dualCrn", "devp", "rgv"
            "shelf", "crn", "dualCrn", "devp", "rgv", "annulus"
    ));
    private static final int DEFAULT_ROW_HEIGHT = 200;
    private static final int DEFAULT_COL_WIDTH = 1000;
@@ -111,7 +112,7 @@
            persistFloorMap(lev, storedData, toFreeEditorDoc(lev, storedData));
        }
        rebuildDeviceAndStationSync();
        clearMapCaches();
        clearMapCaches(levList);
    }
    @Override
@@ -121,7 +122,7 @@
        List<List<HashMap<String, Object>>> storedData = compileToStoredMapData(normalizedDoc);
        persistFloorMap(normalizedDoc.getLev(), storedData, normalizedDoc);
        rebuildDeviceAndStationSync();
        clearMapCaches();
        clearMapCaches(Collections.singletonList(normalizedDoc.getLev()));
    }
    private void persistFloorMap(Integer lev,
@@ -288,6 +289,26 @@
        element.setWidth(width);
        element.setHeight(height);
        element.setValue(stringifyValue(source == null ? null : source.getValue()));
        // 添加环穿轨道等信息
        if (source != null && !Cools.isEmpty(source.getShape())) {
            element.setShape(String.valueOf(source.getShape()).trim());
        }
        if (source != null && source.getPathList() != null && !source.getPathList().isEmpty()) {
            List<Map<String, Object>> copy = new ArrayList<>();
            for (Map<String, Object> seg : source.getPathList()) {
                if (seg == null || seg.isEmpty()) {
                    continue;
                }
                copy.add(new LinkedHashMap<>(seg));
            }
            element.setPathList(copy);
        }
        if (source != null && source.getTurningPoint() != null && !source.getTurningPoint().isEmpty()) {
            element.setTurningPoint(new LinkedHashMap<>(source.getTurningPoint()));
        }
        if (source != null && source.getAnnulusBandInset() != null) {
            element.setAnnulusBandInset(source.getAnnulusBandInset());
        }
        if ("devp".equals(element.getType())) {
            validateDevpValue(element.getValue(), index);
        }
@@ -977,9 +998,19 @@
        return JSON.toJSONString(list, SerializerFeature.DisableCircularReferenceDetect);
    }
    private void clearMapCaches() {
    private void clearMapCaches(List<Integer> levList) {
        redisUtil.del(RedisKeyType.LOC_MAP_BASE.key);
        redisUtil.del(RedisKeyType.LOC_MAST_MAP_LIST.key);
        if (levList == null || levList.isEmpty()) {
            return;
        }
        LinkedHashSet<Integer> distinctLevSet = new LinkedHashSet<>(levList);
        for (Integer lev : distinctLevSet) {
            if (lev == null) {
                continue;
            }
            NavigateSolution.refreshMapCache(lev);
        }
    }
    private String normalizeType(String type) {