Browse Source

内容通知评论管理功能 init

feature/syp_points
liuchuang 5 years ago
parent
commit
5867bf49db
  1. 2
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java
  2. 16
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/NoticeShieldCommentsFormDTO.java
  3. 60
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NoticeCommentListDTO.java
  4. 24
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ReplyCommentDto.java
  5. 33
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/UserBaseInfoDto.java
  6. 29
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java
  7. 23
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java
  8. 21
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java
  9. 15
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java
  10. 56
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml

2
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java

@ -298,7 +298,7 @@ public enum BehaviorEnum {
NOTICE_COMMENT_SUBMIT("notice_comment_submit"), NOTICE_COMMENT_SUBMIT("notice_comment_submit"),
/** /**
* 回复内容评论 * 内容评论的回复
*/ */
NOTICE_COMMENT_REPLY_SUBMIT("notice_comment_reply_submit"), NOTICE_COMMENT_REPLY_SUBMIT("notice_comment_reply_submit"),

16
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/NoticeShieldCommentsFormDTO.java

@ -0,0 +1,16 @@
package com.elink.esua.epdc.dto.epdc.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Authorliuchuang
* @Date2019/11/12 11:06
*/
@Data
public class NoticeShieldCommentsFormDTO implements Serializable {
private static final long serialVersionUID = -8359841146893592752L;
private String[] commentIds;
}

60
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/NoticeCommentListDTO.java

@ -0,0 +1,60 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Authorliuchuang
* @Date2019/11/12 10:55
*/
@Data
public class NoticeCommentListDTO implements Serializable {
private static final long serialVersionUID = 1678760230045285655L;
/**
* 评论ID
*/
private String commentId;
/**
* 内容
*/
private String content;
/**
* 用户是否赞过false未赞
*/
private boolean userLike;
/**
* 用户是否踩过true踩
*/
private boolean userDislike;
/**
* 评论时间
*/
private Date commentTime;
/**
* 赞数
*/
private Integer approveNum;
/**
* 踩数
*/
private Integer opposeNum;
/**
* 表态次数
*/
private Integer attitudeNum;
/**
* 用户信息
*/
private UserBaseInfoDto user;
/**
* 屏蔽标识 0未屏蔽1已屏蔽
*/
private String shieldFlag;
/**
* 回复评论信息
*/
private ReplyCommentDto replyComment;
}

24
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ReplyCommentDto.java

@ -0,0 +1,24 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 被回复的评论
* @Author LC
* @Date 2019/9/6 17:25
*/
@Data
public class ReplyCommentDto implements Serializable {
private static final long serialVersionUID = 3501567846629315395L;
/**
* 用户名
*/
private String userName;
/**
* 内容
*/
private String content;
}

33
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/UserBaseInfoDto.java

@ -0,0 +1,33 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 用户基础信息DTO
* @Author LC
* @Date 2019/9/6 17:23
*/
@Data
public class UserBaseInfoDto implements Serializable {
private static final long serialVersionUID = -6564298463849924671L;
/**
* 用户ID
*/
private String userId;
/**
* 用户名
*/
private String userName;
/**
* 用户头像
*/
private String userFace;
/**
* 党员标识是否是党员(0-1-)
*/
private String partyFlag;
}

29
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java

@ -26,6 +26,8 @@ import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
import com.elink.esua.epdc.dto.NoticeCommentDTO; import com.elink.esua.epdc.dto.NoticeCommentDTO;
import com.elink.esua.epdc.dto.epdc.form.NoticeShieldCommentsFormDTO;
import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO;
import com.elink.esua.epdc.service.NoticeCommentService; import com.elink.esua.epdc.service.NoticeCommentService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -84,4 +86,31 @@ public class NoticeCommentController {
return new Result(); return new Result();
} }
/**
* 评论列表
*
* @param params
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO>>
* @author Liuchuang
* @since 2021/3/16 16:12
*/
@GetMapping("comments")
public Result<PageData<NoticeCommentListDTO>> commentsList(@RequestParam Map<String, Object> params) {
PageData<NoticeCommentListDTO> page = noticeCommentService.listComments(params);
return new Result<PageData<NoticeCommentListDTO>>().ok(page);
}
/**
* 屏蔽评论
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 16:14
*/
@PostMapping("shieldComment")
public Result shieldComment(@RequestBody NoticeShieldCommentsFormDTO formDto) {
return noticeCommentService.modifyCommentById(formDto.getCommentIds());
}
} }

23
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java

@ -20,10 +20,13 @@ package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO;
import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity; import com.elink.esua.epdc.entity.NoticeCommentEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 内容评论表 * 内容评论表
@ -104,4 +107,24 @@ public interface NoticeCommentDao extends BaseDao<NoticeCommentEntity> {
*/ */
List<EpdcNoticeCommentsResultDTO> selectListNoticeComments(EpdcNoticeCommentListFormDTO formDto); List<EpdcNoticeCommentsResultDTO> selectListNoticeComments(EpdcNoticeCommentListFormDTO formDto);
/**
* 评论列表
*
* @param params
* @return java.util.List<TopicCommentListDTO>
* @author Liuchuang
* @since 2021/3/16 16:17
*/
List<NoticeCommentListDTO> selectListOfCommentsByNoticeId(Map<String, Object> params);
/**
* 屏蔽评论
*
* @param commentIds
* @return void
* @author Liuchuang
* @since 2021/3/16 16:17
*/
void updateCommentShieldFlag(@Param("commentIds") String[] commentIds);
} }

21
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java

@ -25,6 +25,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity; import com.elink.esua.epdc.entity.NoticeCommentEntity;
import java.util.List; import java.util.List;
@ -167,4 +168,24 @@ public interface NoticeCommentService extends BaseService<NoticeCommentEntity> {
* @since 2021/3/16 14:59 * @since 2021/3/16 14:59
*/ */
void updateNoticeCommentOpposeNumSubtract(String commentId); void updateNoticeCommentOpposeNumSubtract(String commentId);
/**
* 评论列表
*
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO>
* @author Liuchuang
* @since 2021/3/16 16:15
*/
PageData<NoticeCommentListDTO> listComments(Map<String, Object> params);
/**
* 屏蔽评论
*
* @param commentIds
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 16:15
*/
Result modifyCommentById(String[] commentIds);
} }

15
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java

@ -33,6 +33,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO;
import com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity; import com.elink.esua.epdc.entity.NoticeCommentEntity;
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity;
import com.elink.esua.epdc.service.NoticeCommentService; import com.elink.esua.epdc.service.NoticeCommentService;
@ -198,4 +199,18 @@ public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao,
baseDao.updateNoticeCommentOpposeNumSubtract(commentId); baseDao.updateNoticeCommentOpposeNumSubtract(commentId);
} }
@Override
public PageData<NoticeCommentListDTO> listComments(Map<String, Object> params) {
IPage<NoticeCommentListDTO> page = getPage(params);
List<NoticeCommentListDTO> list = baseDao.selectListOfCommentsByNoticeId(params);
return new PageData<>(list, page.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result modifyCommentById(String[] commentIds) {
baseDao.updateCommentShieldFlag(commentIds);
return new Result();
}
} }

56
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml

@ -121,4 +121,60 @@
t2.CREATED_TIME DESC t2.CREATED_TIME DESC
</select> </select>
<resultMap id="commentListMap" type="com.elink.esua.epdc.dto.epdc.result.NoticeCommentListDTO">
<result property="commentId" column="ID"/>
<result property="content" column="CONTENT"/>
<result property="commentTime" column="CREATED_TIME"/>
<result property="shieldFlag" column="SHIELD_FLAG"/>
<result property="user.userId" column="USER_ID"/>
<result property="user.userName" column="USERNAME"/>
<result property="user.userFace" column="USER_FACE"/>
<result property="replyComment.userName" column="replyUserName"/>
<result property="replyComment.content" column="replyContent"/>
</resultMap>
<select id="selectListOfCommentsByNoticeId" resultMap="commentListMap">
SELECT
t2.ID,
t2.COMMENT_ID,
t2.CONTENT,
t2.CREATED_TIME,
t2.USER_ID,
t2.USER_FACE,
t2.USERNAME,
t2.SHIELD_FLAG,
t3.ID AS replyId,
t3.USERNAME AS replyUserName,
t3.CONTENT AS replyContent
FROM
(
SELECT
t1.ID,
t1.COMMENT_ID,
t1.CONTENT,
t1.CREATED_TIME,
t1.USER_ID,
t1.USER_FACE,
t1.USERNAME,
t1.SHIELD_FLAG
FROM
epdc_notice_comment t1
WHERE
t1.DEL_FLAG = '0'
AND t1.NOTICE_ID = #{id}
ORDER BY
t1.CREATED_TIME DESC
) t2
LEFT JOIN epdc_notice_comment t3 ON t2.COMMENT_ID = t3.ID
ORDER BY
t2.CREATED_TIME DESC
</select>
<update id="updateCommentShieldFlag">
UPDATE epdc_notice_comment SET SHIELD_FLAG = '1' WHERE ID IN
<foreach collection="commentIds" item="commentId" index="no" open="("
separator="," close=")">
#{commentId}
</foreach>
</update>
</mapper> </mapper>

Loading…
Cancel
Save