管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-19 d5baa6ea163058129f35f9b8657ccdf5e21e7a63
src/main/java/com/lf/server/helper/PathHelper.java
@@ -65,7 +65,7 @@
            }
            File[] files = file.listFiles();
            if (files.length < SettingData.MAX_FILES) {
            if (null == files || files.length < SettingData.MAX_FILES) {
                return subPath;
            }
@@ -105,20 +105,29 @@
     */
    public String getTempPath() {
        String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date());
        String tempPath = config.getTempPath();
        String path = tempPath + File.separator + tempName;
        String path = config.getTempPath() + File.separator + tempName;
        File file = new File(path);
        if (!file.exists() && !file.isDirectory()) {
            file.mkdirs();
        }
        double ran = Math.random() * 99;
        if (ran > D90) {
            deleteOldPath(tempPath);
        return path;
    }
    /**
     * 获取临时路径名称
     */
    public String getTempPathName() {
        String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date());
        String path = config.getTempPath() + File.separator + tempName;
        File file = new File(path);
        if (!file.exists() && !file.isDirectory()) {
            file.mkdirs();
        }
        return path;
        return tempName;
    }
    /**
@@ -142,6 +151,11 @@
     */
    public void deleteOldPath(String tempPath) {
        try {
            double ran = Math.random() * 99;
            if (ran < D90) {
                return;
            }
            File file = new File(tempPath);
            String str = StringHelper.YMD__FORMAT.format(new Date());