|
@@ -74,18 +74,21 @@ public class CommonController {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping(value = "/upload")
|
|
|
- public Map<String,Object> upload(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public Result<?> upload(HttpServletRequest request, HttpServletResponse response) {
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
Result<?> result = new Result<>();
|
|
|
String savePath = "";
|
|
|
String bizPath = request.getParameter("biz");
|
|
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
|
|
|
+ if(file==null){
|
|
|
+ file = multipartRequest.getFile("image");// 获取上传文件对象
|
|
|
+ }
|
|
|
if(oConvertUtils.isEmpty(bizPath)){
|
|
|
if(CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)){
|
|
|
result.setMessage("使用阿里云文件上传时,必须添加目录!");
|
|
|
result.setSuccess(false);
|
|
|
- return map;
|
|
|
+// return map;
|
|
|
}else{
|
|
|
bizPath = "";
|
|
|
}
|
|
@@ -102,11 +105,11 @@ public class CommonController {
|
|
|
result.setMessage("上传失败!");
|
|
|
result.setSuccess(false);
|
|
|
}
|
|
|
- map.put("code",0);
|
|
|
- Map<String,Object> map1=new HashMap<>();
|
|
|
- map1.put("url","http://localhost:3000/jeecg-boot/sys/common/upload/");
|
|
|
- map.put("data",map1);
|
|
|
- return map;
|
|
|
+// map.put("code",0);
|
|
|
+// Map<String,Object> map1=new HashMap<>();
|
|
|
+// map1.put("url","http://localhost:3000/jeecg-boot/sys/common/upload/");
|
|
|
+// map.put("data",map1);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -470,6 +473,7 @@ public class CommonController {
|
|
|
// map1.put("url","http://localhost:3000/jeecg-boot/sys/common/downloadFile/"+dbpath);
|
|
|
map1.put("url","http://oa.cuidiansoft.com/jeecg-boot/sys/common/downloadFile/"+dbpath);
|
|
|
map.put("data",map1);
|
|
|
+ result.setData(map1);
|
|
|
} catch (IOException e) {
|
|
|
map.put("success",false);
|
|
|
map.put("message",e.getMessage());
|
|
@@ -477,6 +481,7 @@ public class CommonController {
|
|
|
result.setMessage(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return map;
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|