Commit 16c95443 authored by xuepeng.chang's avatar xuepeng.chang

修改头像 记录日志

parent 8ce423fd
......@@ -322,6 +322,7 @@ public class UserCenterController implements IBaseController {
executorService.execute(() -> {
try {
String avatarUrl = userInfoEntity.getPhoto();
log.info("开始执行头像刷新.id={},avatarUrl={}", userInfoEntity.getId(),avatarUrl);
if(StringUtils.isEmpty(avatarUrl)){
return;
}
......@@ -329,10 +330,15 @@ public class UserCenterController implements IBaseController {
return;
}
byte[] avatarBytes = HttpClientUtil.download(avatarUrl);
if(Objects.isNull(avatarBytes)){
log.info("下载头像失败.id={},avatarUrl={}", userInfoEntity.getId(),avatarUrl);
return;
}
String imageName = "avatar/"+UUID.randomUUID().toString()+".jpg";
String fileName = qiNiuYunUtil.overrideUpload(avatarBytes, ".jpg",imageName);
userInfoEntity.setPhoto(fileName);
userInfoRepository.save(userInfoEntity);
log.info("开始执行头像刷新完成.id={},avatarUrl={}", userInfoEntity.getId(),avatarUrl);
} catch (Exception e) {
log.error("refeshAvatar.error",e);
}finally {
......
......@@ -54,7 +54,7 @@ public class HttpClientUtil {
private static PoolingHttpClientConnectionManager connectionManager = null;
private static HttpRequestRetryHandler retryHandler = null;
private static ConnectionKeepAliveStrategy keepAliveStrategy = null;
private static final int TIME_OUT = 5 * 1000; // 超时时间
private static final int TIME_OUT = 1 * 1000; // 超时时间
private static final int REQUEST_CONNECTION_TIME_OUT = 1 * 1000; // 超时时间
private static final int CONNECTION_TIME_OUT = 2 * 1000; // 超时时间
private static final int SOCKET_TIME_OUT = 5 * 1000; // 超时时间
......
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