Przeglądaj źródła

修改,fileType 我必传字段

wuweihao 4 lat temu
rodzic
commit
532badf1f6

+ 10 - 0
gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -172,6 +172,8 @@ public class FileUtils {
         HashMap<String, String> result = new HashMap<>();
         result.put("fileName", fileName);
 
+
+
         String fileType = getFileType(fileName);
         String dirType = "image/";
         if (fileType.equals("doc")) {
@@ -179,6 +181,7 @@ public class FileUtils {
         }
 
         String suffix = StringUtils.substringAfterLast(fileName, ".");
+        result.put("suffix", suffix);
         String newName = time  + "."  +suffix;
         savePath = savePath + dirType + newName;
 
@@ -205,6 +208,12 @@ public class FileUtils {
     }
 
 
+    @Test
+    public void testsss(){
+        System.out.println(StringUtils.substringAfterLast("xxxx.doc", "."));
+    }
+
+
     /**
      * 文件上传,用来上传指定文档,应用程序需要不同的文件,特意针对他们设计
      * @param file
@@ -234,6 +243,7 @@ public class FileUtils {
         String dirType = "doc/" + code + "/";
 
         String suffix = StringUtils.substringAfterLast(fileName, ".");
+        result.put("suffix", suffix);
         String newName = type  + "."  +suffix;
         savePath = savePath + dirType + newName;
 

+ 2 - 1
gis_domain/src/main/java/com/gis/domain/dto/FormDto.java

@@ -52,7 +52,8 @@ public class FormDto implements Serializable {
     @ApiModelProperty(value = "文件code")
     private String code;
 
-    @ApiModelProperty(value = "文件类型,doc、xls")
+    @NotBlank(message = "文件类型不能为空")
+    @ApiModelProperty(value = "文件类型,doc、xls", required = true)
     private String fileType;