zhang
2025-05-20 1313906bb1eb983d3beece810035e7fc28d6a92f
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/LaneService.java
@@ -16,6 +16,8 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.time.StopWatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -38,6 +40,8 @@
    private final Map<String, List<String>> adjacencyCodeMap = new HashMap<>();
    private final Map<String, List<int[]>> laneCodeIdxMap = new HashMap<>();
    private final Map<String, Lane> codeLaneMap = new HashMap<>();
    private boolean initialized = Boolean.FALSE;
@@ -62,12 +66,14 @@
        if (Cools.isEmpty(codeData) || !this.initialized) {
            return null;
        }
        for (Lane lane : this.lanes) {
            if (lane.getCodes().contains(codeData)) {
                return lane;
            }
        }
        return null;
//        if (result == null) {
//            for (Lane lane : this.lanes) {
//                if (lane.getCodes().contains(codeData)) {
//                    return lane;
//                }
//            }
//        }
        return this.codeLaneMap.get(codeData);
    }
    public List<int[]> getLaneCodeIdxList(String codeData) {
@@ -83,7 +89,7 @@
    // launcher -------------------------------------------------------
    @PostConstruct
    @EventListener(ApplicationReadyEvent.class)
    public void init() {
        Integer lev = MapDataDispatcher.MAP_DEFAULT_LEV;
        String laneDataStr = redis.getValue(RedisConstant.MAP_LANE_DATA, String.valueOf(lev));
@@ -291,7 +297,7 @@
                for (String anotherPointNear : anotherPointNears) {
                    if (!lane.getCodes().contains(anotherPointNear) && this.adjacencyCodeMap.get(anotherPointNear).size() == 2) {
                        for (Lane lane0 : lanes) {
                        for (Lane lane0 : new ArrayList<>(lanes)) {
                            if (lane0.getCodes().contains(anotherPointNear)) {
                                lane0.getCodes().addAll(lane.getCodes());
@@ -348,7 +354,6 @@
    public void generateLaneCodeIdx(Integer lev) {
        log.info("There is initializing Lane CodeIdxMap......");
        long l = System.currentTimeMillis();
        if (Cools.isEmpty(this.lanes)) {
            return;
        }
@@ -358,6 +363,7 @@
                int[] codeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(lev, code);
                codeIdxList.add(codeMatrixIdx);
                this.laneCodeIdxMap.put(code, codeIdxList);
                this.codeLaneMap.put(code, lane);
            }
        }
    }