修改头像上传路径及回显
This commit is contained in:
parent
fe7905cc9f
commit
2bad682e39
|
|
@ -139,4 +139,7 @@ public interface RemoteUploadUtilsService {
|
|||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
@PostMapping(value = "/uploadFile/getFileUrl")
|
||||
public R<String> getFileUrl(@RequestParam(value = "filePath") String filePath, @RequestParam(value = "bucketName")String bucketName,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,11 @@ public class RemoteUploadUtilsFallbackFactory implements FallbackFactory<RemoteU
|
|||
return R.fail("文件bast64获取失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> getFileUrl(String filePath, String bucketName, String source) {
|
||||
return R.fail("文件bast64获取失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -230,4 +230,10 @@ public class FileUtilController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getFileUrl")
|
||||
public R<String> getFileUrl(String filePath,String bucketName,String sourceType) {
|
||||
return R.ok(service.getFileUrl(filePath,bucketName));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,4 +437,17 @@ public class FileUtilsServiceImpl {
|
|||
return vo;
|
||||
|
||||
}
|
||||
|
||||
public String getFileUrl(String filePath, String bucketName) {
|
||||
try {
|
||||
if(StringHelper.isNullOrEmptyString(bucketName)){
|
||||
bucketName=minioConfig.getBucketName();
|
||||
}
|
||||
return minioUtils.getFileUrl(bucketName,filePath,60*60*12);
|
||||
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.system.controller;
|
||||
|
||||
import com.bonus.common.core.constant.CacheConstants;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
|
|
@ -15,6 +16,7 @@ import com.bonus.common.security.annotation.PreventRepeatSubmit;
|
|||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.RemoteUploadUtilsService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysRole;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
|
|
@ -68,13 +70,12 @@ public class SysUserController extends BaseController {
|
|||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private WebSocketHandler webSocketHandler;
|
||||
private RemoteUploadUtilsService service;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
|
@ -236,6 +237,7 @@ public class SysUserController extends BaseController {
|
|||
public AjaxResult getInfo() {
|
||||
try {
|
||||
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
user.setAvatar(service.getFileUrl(user.getAvatar(),null, SecurityConstants.INNER).getData());
|
||||
user.setPassword(null);
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
|
|
|||
Loading…
Reference in New Issue