zhang
2025-07-23 b3814333d786324bb81cca7d1bcf5ac8f2f1a7cf
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java
@@ -15,13 +15,17 @@
import com.zy.acs.manager.manager.service.CodeService;
import com.zy.acs.manager.manager.service.RouteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.*;
/**
 * Created by vincent on 6/6/2024
 */
@Slf4j
@Service
public class MapDataDispatcher {
    public static final Integer MAP_DEFAULT_LEV = 1;
@@ -41,13 +45,22 @@
    public Map<String, Boolean> routeCdaMap = new HashMap<>();
    private final CodeService codeService;
    @Autowired
    private CodeService codeService;
    private final RouteService routeService;
    @Autowired
    private RouteService routeService;
    public MapDataDispatcher(CodeService codeService, RouteService routeService) {
        this.codeService = codeService;
        this.routeService = routeService;
    @PostConstruct
    public void init() {
        String[][] codeMatrix = this.getCodeMatrix(null);
        this.initRouteMap(null);
        if (codeMatrix.length > 0) {
            this.getMapMatrix(null, null);
            this.getTurnMatrix(null);
            this.getCdaMatrix(null);
            this.getDynamicMatrix(null);
        }
    }
    public String[][] getWaveMatrix(Integer lev) {
@@ -294,11 +307,20 @@
                            turnMatrix[i][j] = TurnNodeType.STRAIGHT.val;
                            break;
                        case 2:
                            String firstCode = neighborCodeList.get(0); assert !Cools.isEmpty(firstCode);
                            String secondCode = neighborCodeList.get(1); assert !Cools.isEmpty(secondCode);
                            String firstCode = neighborCodeList.get(0);
                            assert !Cools.isEmpty(firstCode);
                            String secondCode = neighborCodeList.get(1);
                            assert !Cools.isEmpty(secondCode);
                            int[] firstIdx = this.getCodeMatrixIdx(lev, firstCode);
                            int[] secondIdx = this.getCodeMatrixIdx(lev, secondCode);
                            if (firstIdx == null) {
                                throw new CoolException("不存在点位:" + firstCode);
                            }
                            if (secondIdx == null) {
                                throw new CoolException("不存在点位:" + secondCode);
                            }
                            if (firstIdx[0] != secondIdx[0] && firstIdx[1] != secondIdx[1]) {
                                turnMatrix[i][j] = TurnNodeType.TURN.val;
@@ -320,7 +342,7 @@
        return turnMatrix;
    }
    public synchronized int[][] initMapMatrix(Integer lev) {
        log.info("There is initializing Map Matrix......");
@@ -403,7 +425,9 @@
        for (Code code : codeList) {
            Double x = code.getX();
            Double y = code.getY();
            if (null == x || null == y) { continue; }
            if (null == x || null == y) {
                continue;
            }
            if (!xIdxList.contains(x)) {
                xIdxList.add(x);
            }