Commit 1a4fe8d4 by 宋珺琪

意见反馈添加姓名和警号(重庆)

parent 2771da6d
......@@ -21,7 +21,12 @@ public class CommentEntity implements Serializable {
@TableId(type = IdType.INPUT)
private String plId; // 评论ID
private String content; // 评论内容
private String userName; // 评论作者姓名
private String userName; // 评论作者身份证
@TableField(exist = false)
private String name; // 评论作者姓名
@TableField(exist = false)
private String policemanId; //评论者警号
private String createTime; // 评论时间
private String isDelete; // 是否删除(0:未删除;1:已删除)
......@@ -32,9 +37,10 @@ public class CommentEntity implements Serializable {
private String userPhoto; // 作者照片
@TableField(exist = false)
private String parentName; // 父评论名字(被回复的评论)
@TableField(exist = false)
private String parentPolicemanId; // 父评论警号(被回复的评论)
@TableField(exist = false)
private List<CommentEntity> child; // 本评论下的子评论
......
......@@ -19,7 +19,11 @@ import java.io.Serializable;
public class PaperEntity implements Serializable {
@TableId(type = IdType.INPUT)
private String id; // 文章id
private String userName; // 文章作者姓名
private String userName; // 文章作者身份证
@TableField(exist = false)
private String name; // 文章作者姓名
@TableField(exist = false)
private String policemanId; //文章作者警号
private String content; // 文章内容
private String title; // 文章标题
private Integer count; // 文章评论次数
......@@ -34,8 +38,6 @@ public class PaperEntity implements Serializable {
private String userPhoto; // 作者照片
@TableField(exist = false)
private int page;//当前第几页
......
......@@ -4,12 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.SkypDesktopEntity.SkMenu;
import com.founder.commonutils.model.newPublicEntity.SysUser;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.CommentEntity;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.PaperEntity;
import com.founder.commonutils.util.KeyUtilNaotu;
import com.founder.publicapi.mapper.mysqlMapper.CommentMapper;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import com.founder.servicebase.mapper.qgxzMapper.SysUserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,7 +27,8 @@ import java.util.stream.Collectors;
public class CommentController {
@Autowired
CommentMapper commentMapper;
@Autowired
SysUserMapper sysUserMapper;
/**
* 评论发表、评论回复
......@@ -117,30 +120,36 @@ public class CommentController {
// 将所有根评论加入 map
for(CommentEntity comment : list) {
if(comment.getParentId() == null){
//获取姓名和警号
SysUser sysUser = jbxxBysfz(comment.getUserName());
comment.setName(sysUser.getTrueName());
comment.setPolicemanId(sysUser.getPolicemanid());
result.add(comment);
}
map.put(comment.getPlId(), comment);
}
// 子评论加入到父评论的 child 中
for(CommentEntity comment : list) {
List<CommentEntity> child = new ArrayList<>();
String id = comment.getParentId();
System.out.println(id);
if(id != null) { // 当前评论为子评论
//父的名称
CommentEntity name = commentMapper.selectById(id);
comment.setParentName(name.getUserName());
SysUser sysUser1 = jbxxBysfz(name.getUserName());
comment.setParentName(sysUser1.getTrueName());
comment.setParentPolicemanId(sysUser1.getPolicemanid());
//根的名称
SysUser sysUser = jbxxBysfz(comment.getUserName());
comment.setName(sysUser.getTrueName());
comment.setPolicemanId(sysUser.getPolicemanid());
CommentEntity p = map.get(id);
if(p.getChild() == null) { // child 为空,则创建
child.add(comment);
p.setChild(child);
}else {
p.getChild().add(comment);
if(p.getChild() == null) { // child 为空,则先创建list
p.setChild(new ArrayList<>());
}
p.getChild().add(comment);
}
}
return new MapRestResult(200,"ok",list.size(),result);
}
......@@ -155,6 +164,9 @@ public class CommentController {
public MapRestResult commentDetails(@RequestBody CommentEntity commentEntity){
CommentEntity commentEntity1 = commentMapper.selectById(commentEntity.getPlId());
SysUser sysUser = jbxxBysfz(commentEntity1.getUserName());
commentEntity1.setName(sysUser.getTrueName());
commentEntity1.setPolicemanId(sysUser.getPolicemanid());
return new MapRestResult(200,"ok",commentEntity1);
}
......@@ -169,4 +181,11 @@ public class CommentController {
return formatter.format(date);
}
public SysUser jbxxBysfz(String sfz){
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq("IDENTITYCARD",sfz);
SysUser sysUser = sysUserMapper.selectOne(wrapper);
return sysUser;
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.SysUser;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.CommentEntity;
import com.founder.commonutils.model.newPublicEntity.suggestionEntity.PaperEntity;
import com.founder.commonutils.util.KeyUtil;
......@@ -15,6 +16,7 @@ import com.founder.publicapi.mapper.mysqlMapper.CommentMapper;
import com.founder.publicapi.mapper.mysqlMapper.PaperMapper;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import com.founder.servicebase.mapper.qgxzMapper.SysUserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,6 +55,10 @@ public class PaperController {
@Autowired
CommentMapper commentMapper;
@Autowired
SysUserMapper sysUserMapper;
/**
* 文章新增
* @return
......@@ -231,6 +237,10 @@ public class PaperController {
List<PaperEntity> list = iPage.getRecords();
//遍历每一个文章 获取他的评论次数
for (PaperEntity pap : list) {
SysUser sysUser = jbxxBysfz(pap.getUserName());
pap.setName(sysUser.getTrueName());
pap.setPolicemanId(sysUser.getPolicemanid());
QueryWrapper<CommentEntity> wrapper1 = new QueryWrapper<>();
wrapper1.eq("blog_id",pap.getId());
wrapper1.eq("is_delete","0");
......@@ -251,6 +261,9 @@ public class PaperController {
public MapRestResult articleDetails(@RequestBody PaperEntity paperEntity) {
PaperEntity paperEntity1 = paperMapper.selectById(paperEntity.getId());
SysUser sysUser = jbxxBysfz(paperEntity1.getUserName());
paperEntity1.setName(sysUser.getTrueName());
paperEntity1.setPolicemanId(sysUser.getPolicemanid());
return new MapRestResult(200,"ok",paperEntity1);
}
......@@ -265,5 +278,11 @@ public class PaperController {
return formatter.format(date);
}
public SysUser jbxxBysfz(String sfz){
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq("IDENTITYCARD",sfz);
SysUser sysUser = sysUserMapper.selectOne(wrapper);
return sysUser;
}
}
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