Commit defef165 by 江和松

APP段上传附件代码修改

parent ee49ba16
...@@ -16,9 +16,11 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile; ...@@ -16,9 +16,11 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -30,7 +32,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -30,7 +32,7 @@ import javax.servlet.http.HttpServletRequest;
@RestController @RestController
@RequestMapping({"/upload/file"}) @RequestMapping({"/upload/file"})
public class FileUploadController { public class FileUploadController {
/** /**
* 更具docId上传文件 * 更具docId上传文件
* *
...@@ -44,7 +46,11 @@ public class FileUploadController { ...@@ -44,7 +46,11 @@ public class FileUploadController {
JSONObject upload = new JSONObject(); JSONObject upload = new JSONObject();
String projectEnv = ProjectInfo.getProjectEnv(); String projectEnv = ProjectInfo.getProjectEnv();
if (CommonConstant.projectEnv.RUN.equalsIgnoreCase(projectEnv)) { if (CommonConstant.projectEnv.RUN.equalsIgnoreCase(projectEnv)) {
upload = UploadUtils.upload((CommonsMultipartFile)file); Iterator multiFileIterator = ((DefaultMultipartHttpServletRequest) request).getMultiFileMap().get("uploadFile").iterator();
while(multiFileIterator.hasNext()) {
CommonsMultipartFile multipartFile = (CommonsMultipartFile)multiFileIterator.next();
upload = UploadUtils.upload(multipartFile);
}
}else { }else {
upload = UploadUtils.uploadFile(request); upload = UploadUtils.uploadFile(request);
} }
...@@ -58,7 +64,7 @@ public class FileUploadController { ...@@ -58,7 +64,7 @@ public class FileUploadController {
return resultMap; return resultMap;
} }
} }
/** /**
* @param content * @param content
* @return * @return
...@@ -75,5 +81,5 @@ public class FileUploadController { ...@@ -75,5 +81,5 @@ public class FileUploadController {
return resultMap; return resultMap;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment