修改个人资料

This commit is contained in:
wxl
2025-01-03 22:33:34 +08:00
parent 9bdc9c0fc4
commit 0e35af0c79
4 changed files with 23 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package com.dd.admin.business.api;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.dd.admin.business.author.entity.Author;
@@ -198,20 +199,32 @@ public class AuthApi {
public ResultBean<Author> getMine() {
String authorId = String.valueOf(request.getAttribute("authorId"));
Author author = authorService.getById(authorId);
if(author.getBirth()!=null){
author.setAge(DateUtil.ageOfNow(author.getBirth()));
}
//关注我的列表
List<FollowVo> followMes = followService.selectFollowList(new FollowDto().setAuthorId(author.getAuthorId()));
List<FollowVo> myFollows = followService.selectFollowList(new FollowDto().setFollowId(author.getAuthorId()));
author.setFollow(Long.valueOf(myFollows.size()));
author.setFans(Long.valueOf(followMes.size()));
author.setFollowMes(followMes);
author.setMyFollows(myFollows);
Long upAndStarTotalCount = authorService.selectAuthorUpAndStarTotalCount(authorId);
author.setUpAndStarCount(upAndStarTotalCount);
return ResultBean.success(author);
}
@ApiOperation(value = "修改我的信息")
@ApiOperationSupport(order = 1)
@PostMapping("/api/auth/updateMine")
@OperLog(operModule = "修改我的信息",operType = OperType.EDIT,operDesc = "修改我的信息")
public ResultBean<Author> updateAuthorBackGround(@RequestBody Author author) {
authorService.updateById(author);
return ResultBean.success(author);
};
@ApiOperation(value = "获取关注目标作者的所有粉丝")

View File

@@ -15,6 +15,7 @@ import java.util.List;
import com.dd.admin.business.follow.domain.FollowDto;
import com.dd.admin.business.follow.domain.FollowVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -66,6 +67,7 @@ public class Author implements Serializable {
@ApiModelProperty(value = "生日")
@TableField("BIRTH")
@JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
private Date birth;
@ApiModelProperty(value = "职业")
@@ -163,4 +165,7 @@ public class Author implements Serializable {
@TableField(exist = false)
private Long upAndStarCount;
@TableField(exist = false)
private Integer age = 0;
}

View File

@@ -117,7 +117,6 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
// 先尝试压缩并保存图片
Thumbnails.of(file.getInputStream()).scale(1)
.outputQuality(0.25f)
.outputFormat("jpeg")
.toFile(sysUploadPath + newFileSavePath + finalName);
newFile = new java.io.File(sysUploadPath + newFileSavePath + finalName);
} catch (IOException e) {
@@ -126,6 +125,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
file.transferTo(newFile);
}
File fileInfo = new File();
//保存文件信息
fileInfo.setFileId(fileId);

View File

@@ -1 +1 @@
package com.dd.admin.business.webSocket;
package com.dd.admin.business.webSocket;