yourName 1 år sedan
förälder
incheckning
a14a75e771

+ 3 - 1
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -361,7 +361,9 @@ public class UniversalController extends BaseRESTfulController {
         }
         byte[] stream1 = exportExcelFile(columnMaps, listMap);
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        String path = "/data/file/"+  map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx";
+        Random random = new Random();
+        String path = "/data/file/"+  map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-"
+                + map.get("exclename").toString()+ Util.RandomCreate(8) + ".xlsx";
         FileOutputStream outputStream1 = new FileOutputStream(new File(path));
         outputStream1.write(stream1);
         outputStream1.flush();

+ 20 - 0
src/main/java/com/steerinfo/dil/util/Util.java

@@ -0,0 +1,20 @@
+package com.steerinfo.dil.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Author zhangnan
+ * @Date 2021/5/26 8:59
+ * @Version 1.0
+ * 工具类
+ */
+public class Util {
+    public static String RandomCreate(int i) {
+        String str = "";
+        for (int k = 0; k < i; k++) {
+            str += (int) (Math.random() * 10);// [1-10)随机数 即0-9
+        }
+        return str;
+    }
+}

+ 0 - 14
src/main/java/com/steerinfo/dil/util/util.java

@@ -1,14 +0,0 @@
-package com.steerinfo.dil.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Author zhangnan
- * @Date 2021/5/26 8:59
- * @Version 1.0
- * 工具类
- */
-public class util {
-
-}