提交oss相关代码

master
星期八 4 years ago
parent dbc95a4f8c
commit 4d286af61a
  1. 4
      src/main/java/com/lq/cms/web/sys/OssController.java
  2. 8
      src/main/java/com/lq/cms/web/sys/UserController.java

@ -0,0 +1,4 @@
package com.lq.cms.web.sys;
public class OssController {
}

@ -112,14 +112,18 @@ public class UserController {
@ResponseBody @ResponseBody
@RequestMapping("/update") @RequestMapping("/update")
public Object update(SysUserVo vo,@RequestParam(value = "file",required = false) MultipartFile file) throws IOException { public Object update(SysUserVo vo,@RequestParam(value = "file",required = false) MultipartFile file) throws IOException {
System.out.println(minUtil);
minUtil.uploadFile(file.getInputStream());
Date nowTime = new Date(); Date nowTime = new Date();
AjaxResult ajaxResult = new AjaxResult(); AjaxResult ajaxResult = new AjaxResult();
if (vo!=null&&vo.getId()!=null){ if (vo!=null&&vo.getId()!=null){
SysUser sysUser = sysUserService.findOne(vo.getId()); SysUser sysUser = sysUserService.findOne(vo.getId());
BeanUtil.copyNotNull(sysUser,vo); BeanUtil.copyNotNull(sysUser,vo);
sysUser.setUpdateTime(nowTime); sysUser.setUpdateTime(nowTime);
UUID uuid = UUID.randomUUID();
String fileType = FileUtil.fileFormat(file.getOriginalFilename());
String newFileName = "wechat/"+uuid.toString()+"."+fileType;
minUtil.uploadFile(newFileName,file.getInputStream());
String uploadFileName =upLoadFile(file); String uploadFileName =upLoadFile(file);
sysUser.setImgUrl(uploadFileName); sysUser.setImgUrl(uploadFileName);
sysUserService.update(sysUser); sysUserService.update(sysUser);

Loading…
Cancel
Save