1
luxiaotao1123
3 天以前 594309532fecd0f75c72752885ab93a8a56e5b9b
1
4个文件已修改
32 ■■■■■ 已修改文件
algo-zkd/src/main/java/com/algo/service/PathPlanningService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
algo-zkd/src/main/java/com/algo/util/JsonUtils.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
algo-zkd/src/main/resources/META-INF/spring.factories 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
algo-zkd/target/classes/META-INF/spring.factories 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
algo-zkd/src/main/java/com/algo/service/PathPlanningService.java
@@ -4,6 +4,7 @@
import com.algo.model.*;
import com.algo.util.JsonUtils;
import com.algo.util.PathTimeCalculator;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -612,6 +613,7 @@
    /**
     * 路径规划结果类
     */
    @Data
    public static class PathPlanningResult {
        private int totalAgvs;
        private int executingTasksCount;
algo-zkd/src/main/java/com/algo/util/JsonUtils.java
@@ -3,12 +3,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
 * JSON文件读取
@@ -132,7 +127,7 @@
                        Map<String, Integer> pointMap = new HashMap<>();
                        pointMap.put("x", x);
                        pointMap.put("y", y);
                        pathMapping.put(pathId, pointMap);
                        pathMapping.put(zeroFill(pathId,8), pointMap);
                    }
                }
            }
@@ -435,7 +430,7 @@
                        Map<?, ?> coordMap = (Map<?, ?>) coordsList.get(0);
                        double x = ((Number) coordMap.get("x")).doubleValue();
                        double y = ((Number) coordMap.get("y")).doubleValue();
                        coordinateMapping.put(pathId, new double[]{x, y});
                        coordinateMapping.put(zeroFill(pathId,8), new double[]{x, y});
                    }
                }
            }
@@ -631,4 +626,19 @@
            return neighbors;
        }
    }
    public static String zeroFill(String msg, Integer len) {
        len = Optional.ofNullable(len).orElse(16);
        if (msg.length() == len){
            return msg;
        } else if (msg.length() > len){
            return msg.substring(0, 16);
        } else {
            StringBuilder msgBuilder = new StringBuilder(msg);
            for (int i = 0; i<len-msg.length(); i++){
                msgBuilder.insert(0,"0");
            }
            return msgBuilder.toString();
        }
    }
algo-zkd/src/main/resources/META-INF/spring.factories
@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.algo.service.PathPlanningService
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.algo.service.PathPlanningService,com.algo.config.EnvDataConfig,com.algo.expose.impl.BaseDataServiceImpl,com.algo.service.TaskAllocationService
algo-zkd/target/classes/META-INF/spring.factories
@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.algo.service.PathPlanningService
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.algo.service.PathPlanningService,com.algo.config.EnvDataConfig,com.algo.expose.impl.BaseDataServiceImpl,com.algo.service.TaskAllocationService