|
|
|
@ -44,6 +44,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import util.DateUtil;
|
|
|
|
|
import util.IdWorker;
|
|
|
|
|
import util.ScaleFilter;
|
|
|
|
|
import util.StringTools;
|
|
|
|
|
|
|
|
|
@ -56,7 +57,8 @@ public class MyController extends BaseController{
|
|
|
|
|
private S3Service s3Service;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserInfoService userInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IdWorker idWorker;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserCollectInfoService userCollectInfoService;
|
|
|
|
|
// private UserCollectService userCollectService;
|
|
|
|
@ -74,9 +76,7 @@ public class MyController extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
UserRespDTO userRespDTO = new UserRespDTO();
|
|
|
|
|
UserInfo user = userInfoService.findById(userLoginDto.getUserId());
|
|
|
|
|
UserCollectInfo userCollectInfo = userCollectInfoService.findByUserId(userLoginDto.getUserId());
|
|
|
|
|
List songList =userCollectInfo.getSongList();
|
|
|
|
|
List journalList = userCollectInfo.getJournalList();
|
|
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(user, userRespDTO);
|
|
|
|
|
//EnumMap<CollectTypeEnum,Long> map=userCollectService.getUserCollectTypeMap(user.getId());
|
|
|
|
|
// int fansCount=userCollectService.getFansCount(user.getId());
|
|
|
|
@ -91,6 +91,13 @@ public class MyController extends BaseController{
|
|
|
|
|
// userRespDTO.setCommentReplyCount(0);
|
|
|
|
|
// userRespDTO.setSongCount(songCount);
|
|
|
|
|
// userRespDTO.setJournalCount(journalCount);
|
|
|
|
|
if(null!=userRespDTO.getAvatar()) {
|
|
|
|
|
userRespDTO.setAvatar(Constants.RESOURCE_PREFIX+userRespDTO.getAvatar());
|
|
|
|
|
}
|
|
|
|
|
UserCollectInfo userCollectInfo = userCollectInfoService.findByUserId(userLoginDto.getUserId());
|
|
|
|
|
if(null!=userCollectInfo) {
|
|
|
|
|
List songList =userCollectInfo.getSongList();
|
|
|
|
|
List journalList = userCollectInfo.getJournalList();
|
|
|
|
|
userRespDTO.setJournalList(journalList);
|
|
|
|
|
userRespDTO.setSongList(songList);
|
|
|
|
|
if(null != songList){
|
|
|
|
@ -100,6 +107,8 @@ public class MyController extends BaseController{
|
|
|
|
|
if(null != journalList) {
|
|
|
|
|
userRespDTO.setJournalCount(journalList.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(null!=user.getBirthday()) {
|
|
|
|
|
userRespDTO.setBirthDay(DateUtil.format(user.getBirthday(), DateTimePatternEnum.YYYY_DOT_MM_DOT_DD.getPattern()));
|
|
|
|
|
}
|
|
|
|
@ -153,7 +162,7 @@ public class MyController extends BaseController{
|
|
|
|
|
UserLoginDto userLoginDto = getUserLoginDto(token);
|
|
|
|
|
|
|
|
|
|
byte[] thumbnail =ScaleFilter.createThumbnail(file.getInputStream(), Constants.LENGTH_70, Constants.LENGTH_70);
|
|
|
|
|
String avatarName = userLoginDto.getUserId() + StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
|
String avatarName = userLoginDto.getUserId()+"_"+idWorker.nextId() + StringTools.getFileSuffix(file.getOriginalFilename());
|
|
|
|
|
String filePath=UPLOAD_DIRECTORY+avatarName;
|
|
|
|
|
s3Service.uploadAvatar("indie",filePath,thumbnail);
|
|
|
|
|
|
|
|
|
@ -161,6 +170,6 @@ public class MyController extends BaseController{
|
|
|
|
|
user.setAvatar(filePath);
|
|
|
|
|
|
|
|
|
|
userInfoService.update(user);
|
|
|
|
|
return Result.success(filePath);
|
|
|
|
|
return Result.success(Constants.RESOURCE_PREFIX+filePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|