自动化立体仓库 - WCS系统
zhangc
2025-03-11 d5449236ef0b3adafb3e4cc872f50479efa0ce7b
src/main/java/com/zy/common/utils/YamlUtils.java
@@ -18,16 +18,38 @@
@Component
public class YamlUtils {
    private static final String src = "src/main/resources/application-prod.yml";
    private final static String C = "#";
    private final static String CHARSET = "UTF-8";
    //读取后的每行数据
    private static List<String> LINES = null;
    @Autowired
    private DataResourceService dataResourceService;
    private static final String src = "src/main/resources/application-prod.yml";
    public static void main(String[] args) {
        Map<String, Integer> keyCountMap = new HashMap<>();
        try {
            List<String> lines = FileUtils.readLines(new File(src), CHARSET);
            for (int i = 0; i < lines.size(); i++) {
                String line = lines.get(i);
                if (line.contains(C)) {
                    String[] split = line.split(C);
                    String tmp = split[0];
                    String memo = split[1];//获取注释
    private final static String C = "#";
    private final static String CHARSET = "UTF-8";
                    String[] split1 = tmp.split(":");
                    String name = split1[0];
                    String data = split1[1];
                    System.out.println(memo);
                    System.out.println(name);
                    System.out.println(data);
                }
            }
    //读取后的每行数据
    private static List<String> LINES = null;
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public Map<String, Object> read() {
        Yaml yaml = new Yaml();
@@ -54,7 +76,7 @@
                dataResource.setData(null);
            } else if (value instanceof Map) {
                dataResource.setData(JSON.toJSONString(value));
            }else {
            } else {
                dataResource.setData(value.toString());
            }
            dataResource.setCreateTime(new Date());
@@ -178,31 +200,6 @@
                data = "";
            }
            map.put(dataResource.getName(), data);
        }
    }
    public static void main(String[] args) {
        Map<String, Integer> keyCountMap = new HashMap<>();
        try {
            List<String> lines = FileUtils.readLines(new File(src), CHARSET);
            for (int i = 0; i < lines.size(); i++) {
                String line = lines.get(i);
                if (line.contains(C)) {
                    String[] split = line.split(C);
                    String tmp = split[0];
                    String memo = split[1];//获取注释
                    String[] split1 = tmp.split(":");
                    String name = split1[0];
                    String data = split1[1];
                    System.out.println(memo);
                    System.out.println(name);
                    System.out.println(data);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }