修改个人资料
This commit is contained in:
@@ -2,6 +2,7 @@ package com.dd.admin.business.api;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
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.IPage;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
import com.dd.admin.business.author.entity.Author;
|
import com.dd.admin.business.author.entity.Author;
|
||||||
@@ -198,20 +199,32 @@ public class AuthApi {
|
|||||||
public ResultBean<Author> getMine() {
|
public ResultBean<Author> getMine() {
|
||||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||||
Author author = authorService.getById(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> followMes = followService.selectFollowList(new FollowDto().setAuthorId(author.getAuthorId()));
|
||||||
List<FollowVo> myFollows = followService.selectFollowList(new FollowDto().setFollowId(author.getAuthorId()));
|
List<FollowVo> myFollows = followService.selectFollowList(new FollowDto().setFollowId(author.getAuthorId()));
|
||||||
|
|
||||||
author.setFollow(Long.valueOf(myFollows.size()));
|
author.setFollow(Long.valueOf(myFollows.size()));
|
||||||
author.setFans(Long.valueOf(followMes.size()));
|
author.setFans(Long.valueOf(followMes.size()));
|
||||||
author.setFollowMes(followMes);
|
|
||||||
author.setMyFollows(myFollows);
|
|
||||||
Long upAndStarTotalCount = authorService.selectAuthorUpAndStarTotalCount(authorId);
|
Long upAndStarTotalCount = authorService.selectAuthorUpAndStarTotalCount(authorId);
|
||||||
author.setUpAndStarCount(upAndStarTotalCount);
|
author.setUpAndStarCount(upAndStarTotalCount);
|
||||||
return ResultBean.success(author);
|
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 = "获取关注目标作者的所有粉丝")
|
@ApiOperation(value = "获取关注目标作者的所有粉丝")
|
||||||
|
@@ -15,6 +15,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.dd.admin.business.follow.domain.FollowDto;
|
import com.dd.admin.business.follow.domain.FollowDto;
|
||||||
import com.dd.admin.business.follow.domain.FollowVo;
|
import com.dd.admin.business.follow.domain.FollowVo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -66,6 +67,7 @@ public class Author implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "生日")
|
@ApiModelProperty(value = "生日")
|
||||||
@TableField("BIRTH")
|
@TableField("BIRTH")
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")
|
||||||
private Date birth;
|
private Date birth;
|
||||||
|
|
||||||
@ApiModelProperty(value = "职业")
|
@ApiModelProperty(value = "职业")
|
||||||
@@ -163,4 +165,7 @@ public class Author implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Long upAndStarCount;
|
private Long upAndStarCount;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer age = 0;
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,6 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
|
|||||||
// 先尝试压缩并保存图片
|
// 先尝试压缩并保存图片
|
||||||
Thumbnails.of(file.getInputStream()).scale(1)
|
Thumbnails.of(file.getInputStream()).scale(1)
|
||||||
.outputQuality(0.25f)
|
.outputQuality(0.25f)
|
||||||
.outputFormat("jpeg")
|
|
||||||
.toFile(sysUploadPath + newFileSavePath + finalName);
|
.toFile(sysUploadPath + newFileSavePath + finalName);
|
||||||
newFile = new java.io.File(sysUploadPath + newFileSavePath + finalName);
|
newFile = new java.io.File(sysUploadPath + newFileSavePath + finalName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -126,6 +125,7 @@ public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements Fi
|
|||||||
file.transferTo(newFile);
|
file.transferTo(newFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
File fileInfo = new File();
|
File fileInfo = new File();
|
||||||
//保存文件信息
|
//保存文件信息
|
||||||
fileInfo.setFileId(fileId);
|
fileInfo.setFileId(fileId);
|
||||||
|
@@ -1 +1 @@
|
|||||||
package com.dd.admin.business.webSocket;
|
package com.dd.admin.business.webSocket;
|
Reference in New Issue
Block a user