WANG 6 жил өмнө
parent
commit
900ace26c6

+ 58 - 0
src/main/java/cn/com/qmth/examcloud/api/commons/exchange/FormFileDataPart.java

@@ -0,0 +1,58 @@
+package cn.com.qmth.examcloud.api.commons.exchange;
+
+import java.io.File;
+
+/**
+ * 表单文件参数
+ *
+ * @author WANGWEI
+ * @date 2019年5月9日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class FormFileDataPart {
+
+	private String paramName;
+
+	private String filename;
+
+	private File file;
+
+	/**
+	 * 构造函数
+	 *
+	 * @param paramName
+	 * @param filename
+	 * @param file
+	 */
+	public FormFileDataPart(String paramName, String filename, File file) {
+		super();
+		this.paramName = paramName;
+		this.filename = filename;
+		this.file = file;
+	}
+
+	public String getParamName() {
+		return paramName;
+	}
+
+	public void setParamName(String paramName) {
+		this.paramName = paramName;
+	}
+
+	public String getFilename() {
+		return filename;
+	}
+
+	public void setFilename(String filename) {
+		this.filename = filename;
+	}
+
+	public File getFile() {
+		return file;
+	}
+
+	public void setFile(File file) {
+		this.file = file;
+	}
+
+}

+ 7 - 33
src/main/java/cn/com/qmth/examcloud/api/commons/exchange/FormRequest.java

@@ -1,8 +1,6 @@
 package cn.com.qmth.examcloud.api.commons.exchange;
 
-import javax.validation.constraints.NotNull;
-
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
+import java.util.List;
 
 import io.swagger.annotations.ApiModelProperty;
 
@@ -17,39 +15,15 @@ public class FormRequest extends BaseRequest {
 
 	private static final long serialVersionUID = 1201394717322230917L;
 
-	@NotNull(message = "fileName不能为空")
-	@ApiModelProperty(value = "文件路径", example = "", required = true)
-	private String fileName;
-
-	@NotNull(message = "filePath不能为空")
-	@ApiModelProperty(value = "文件路径", example = "", required = true)
-	private transient String filePath;
-
-	@ApiModelProperty(value = "请求时,无需传值", example = "", required = false)
-	private CommonsMultipartFile file;
-
-	public String getFileName() {
-		return fileName;
-	}
-
-	public void setFileName(String fileName) {
-		this.fileName = fileName;
-	}
-
-	public String getFilePath() {
-		return filePath;
-	}
-
-	public void setFilePath(String filePath) {
-		this.filePath = filePath;
-	}
+	@ApiModelProperty(value = "文件参数集合", required = false)
+	private transient List<FormFileDataPart> fileDataPartList;
 
-	public CommonsMultipartFile getFile() {
-		return file;
+	public List<FormFileDataPart> getFileDataPartList() {
+		return fileDataPartList;
 	}
 
-	public void setFile(CommonsMultipartFile file) {
-		this.file = file;
+	public void setFileDataPartList(List<FormFileDataPart> fileDataPartList) {
+		this.fileDataPartList = fileDataPartList;
 	}
 
 }