Browse Source

内容通知评论功能 init

feature/syp_points
liuchuang 5 years ago
parent
commit
60afb9ddf3
  1. 22
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/BehaviorEnum.java
  2. 84
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiNewsController.java
  3. 36
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
  4. 17
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
  5. 33
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/NewsService.java
  6. 29
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java
  7. 5
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/ModuleCategoryDTO.java
  8. 151
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/NoticeCommentDTO.java
  9. 86
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/NoticeCommentUserAttitudeDTO.java
  10. 50
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentListFormDTO.java
  11. 40
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentStatementFormDTO.java
  12. 67
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentSubmitFormDTO.java
  13. 28
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentListResultDTO.java
  14. 35
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentUserInfoResultDTO.java
  15. 57
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentsResultDTO.java
  16. 24
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeReplyCommentResultDTO.java
  17. 5
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ModuleCategoryResultDTO.java
  18. 57
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java
  19. 87
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentController.java
  20. 87
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentUserAttitudeController.java
  21. 107
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentDao.java
  22. 33
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentUserAttitudeDao.java
  23. 2
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java
  24. 5
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/ModuleCategoryEntity.java
  25. 121
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/NoticeCommentEntity.java
  26. 56
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/NoticeCommentUserAttitudeEntity.java
  27. 170
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentService.java
  28. 107
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentUserAttitudeService.java
  29. 18
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeService.java
  30. 201
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentServiceImpl.java
  31. 163
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentUserAttitudeServiceImpl.java
  32. 10
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java
  33. 1
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/ModuleCategoryDao.xml
  34. 124
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentDao.xml
  35. 6
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentUserAttitudeDao.xml
  36. 4
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeDao.xml

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

@ -290,7 +290,27 @@ public enum BehaviorEnum {
/**
* 内容浏览
*/
CONTENT_BROWSE("content_browse");
CONTENT_BROWSE("content_browse"),
/**
* 评论内容
*/
NOTICE_COMMENT_SUBMIT("notice_comment_submit"),
/**
* 回复内容的评论
*/
NOTICE_COMMENT_REPLY_SUBMIT("notice_comment_reply_submit"),
/**
* 内容评论的点赞
*/
NOTICE_COMMENT_SUPPORT("notice_comment_support"),
/**
* 内容评论的点踩
*/
NOTICE_COMMENT_OPPOSITION("notice_comment_opposition");
private String value;

84
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiNewsController.java

@ -238,4 +238,88 @@ public class ApiNewsController {
}
return newsService.getModuleCategory(dto);
}
/**
* 内容评论提交
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 11:14
*/
@PostMapping("notice/comment/submit")
@RecordUserBehavior(behavior = BehaviorEnum.NOTICE_COMMENT_SUBMIT,referenceId = "#{fromDTO.getNoticeId}",userId = "#{userDetail.getUserId}")
public Result noticeCommentSubmit(@LoginUser TokenDto userDetail, @RequestBody EpdcNoticeCommentSubmitFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return newsService.saveNoticeComment(userDetail, formDto);
}
/**
* 内容评论的回复提交
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 11:14
*/
@PostMapping("notice/comment/reply/submit")
@RecordUserBehavior(behavior = BehaviorEnum.NOTICE_COMMENT_REPLY_SUBMIT,referenceId = "#{fromDTO.getNoticeId}",userId = "#{userDetail.getUserId}")
public Result noticeCommentReplySubmit(@LoginUser TokenDto userDetail, @RequestBody EpdcNoticeCommentSubmitFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return newsService.saveNoticeComment(userDetail, formDto);
}
/**
* 内容评论表态-支持
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:32
*/
@PostMapping("notice/comment/statement/support")
@RecordUserBehavior(behavior = BehaviorEnum.NOTICE_COMMENT_SUPPORT,referenceId = "#{fromDTO.getNoticeId}",userId = "#{userDetail.getUserId}")
public Result noticeCommentStatementSupport(@LoginUser TokenDto userDetail, @RequestBody EpdcNoticeCommentStatementFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return newsService.noticeCommentStatement(userDetail, formDto);
}
/**
* 内容评论表态-反对
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:33
*/
@PostMapping("notice/comment/statement/opposition")
@RecordUserBehavior(behavior = BehaviorEnum.NOTICE_COMMENT_OPPOSITION,referenceId = "#{fromDTO.getNoticeId}",userId = "#{userDetail.getUserId}")
public Result noticeCommentStatementOpposition(@LoginUser TokenDto userDetail, @RequestBody EpdcNoticeCommentStatementFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return newsService.noticeCommentStatement(userDetail, formDto);
}
/**
* 内容评论列表
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO>
* @author Liuchuang
* @since 2021/3/16 13:43
*/
@GetMapping("notice/comment/list")
public Result<EpdcNoticeCommentListResultDTO> noticeCommentList(@LoginUser TokenDto userDetail, @RequestBody EpdcNoticeCommentListFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return newsService.listNoticeComments(userDetail, formDto);
}
}

36
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java

@ -157,10 +157,9 @@ public interface NewsFeignClient {
@PostMapping(value = "news/epdc-app/information/first/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<EpdcInformationFristResultDTO> selectOneFristByUserId(@PathVariable String userId);
/*
/**
* 移动端通知列表接口 - v2
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO>>
* @Author zhangyong
@ -178,4 +177,37 @@ public interface NewsFeignClient {
**/
@GetMapping("news/modulecategory/moduleCategory")
Result<List<ModuleCategoryResultDTO>> getModuleCategory(@RequestBody ModuleCategoryFormDTO dto);
/**
* 内容评论回复提交
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:50
*/
@PostMapping(value = "news/epdc-app/notice/comment/submit", consumes = MediaType.APPLICATION_JSON_VALUE)
Result noticeCommentSubmit(EpdcNoticeCommentSubmitFormDTO formDto);
/**
* 内容评论表态
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:55
*/
@PostMapping(value = "news/epdc-app/notice/comment/statement", consumes = MediaType.APPLICATION_JSON_VALUE)
Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto);
/**
* 内容评论列表
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO>
* @author Liuchuang
* @since 2021/3/16 13:57
*/
@GetMapping(value = "news/epdc-app/notice/comment/list", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto);
}

17
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java

@ -86,6 +86,21 @@ public class NewsFeignClientFallback implements NewsFeignClient {
@Override
public Result<List<ModuleCategoryResultDTO>> getModuleCategory(ModuleCategoryFormDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_CUSTOM_SERVER, "ModuleCategoryFormDTO", dto);
return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "ModuleCategoryFormDTO", dto);
}
@Override
public Result noticeCommentSubmit(EpdcNoticeCommentSubmitFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "noticeCommentSubmit", formDto);
}
@Override
public Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "noticeCommentStatement", formDto);
}
@Override
public Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "listNoticeComments", formDto);
}
}

33
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/NewsService.java

@ -182,4 +182,37 @@ public interface NewsService {
* @return void
**/
void addContentPoints(TokenDto userDetail, ModuleCategoryFormDTO dto);
/**
* 内容评论回复提交
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 11:18
*/
Result saveNoticeComment(TokenDto userDetail, EpdcNoticeCommentSubmitFormDTO formDto);
/**
* 内容评论表态
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:33
*/
Result noticeCommentStatement(TokenDto userDetail, EpdcNoticeCommentStatementFormDTO formDto);
/**
* 内容评论列表
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO>
* @author Liuchuang
* @since 2021/3/16 13:43
*/
Result<EpdcNoticeCommentListResultDTO> listNoticeComments(TokenDto userDetail, EpdcNoticeCommentListFormDTO formDto);
}

29
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java

@ -3,6 +3,7 @@ package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.common.token.dto.TokenDto;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.BehaviorEnum;
import com.elink.esua.epdc.commons.tools.enums.UserTagEnum;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
@ -15,6 +16,7 @@ import com.elink.esua.epdc.feign.ActInfoFeignClient;
import com.elink.esua.epdc.feign.NewsFeignClient;
import com.elink.esua.epdc.pointcommons.tools.annotation.RecordUserBehavior;
import com.elink.esua.epdc.service.NewsService;
import com.elink.esua.epdc.utils.UserTagUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -165,4 +167,31 @@ public class NewsServiceImpl implements NewsService {
public void addContentPoints(TokenDto userDetail, ModuleCategoryFormDTO dto) {
}
@Override
public Result saveNoticeComment(TokenDto userDetail, EpdcNoticeCommentSubmitFormDTO formDto) {
formDto.setUserId(userDetail.getUserId());
formDto.setUserName(userDetail.getNickname());
formDto.setUserFace(userDetail.getFaceImg());
formDto.setDeptId(userDetail.getGridId());
if (UserTagUtils.containIdentity(userDetail.getUserTagInfos(), UserTagEnum.PARTY_MEMBER)) {
formDto.setPartyFlag(YesOrNoEnum.YES.value());
} else {
formDto.setPartyFlag(YesOrNoEnum.NO.value());
}
return newsFeignClient.noticeCommentSubmit(formDto);
}
@Override
public Result noticeCommentStatement(TokenDto userDetail, EpdcNoticeCommentStatementFormDTO formDto) {
formDto.setUserId(userDetail.getUserId());
return newsFeignClient.noticeCommentStatement(formDto);
}
@Override
public Result<EpdcNoticeCommentListResultDTO> listNoticeComments(TokenDto userDetail, EpdcNoticeCommentListFormDTO formDto) {
formDto.setUserId(userDetail.getUserId());
return newsFeignClient.listNoticeComments(formDto);
}
}

5
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/ModuleCategoryDTO.java

@ -105,6 +105,11 @@ public class ModuleCategoryDTO extends TreeNode implements Serializable {
*/
private String enableFlag;
/**
* 内容评论标识 0-1-
*/
private String commentFlag;
private String parentName;
private String value;

151
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/NoticeCommentDTO.java

@ -0,0 +1,151 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
public class NoticeCommentDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 内容ID
*/
private String noticeId;
/**
* 评论人ID
*/
private String userId;
/**
* 评论人昵称
*/
private String userName;
/**
* 评论人头像
*/
private String userFace;
/**
* 评论内容
*/
private String content;
/**
* 评论类型 0评论1回复2回复的回复
*/
private String commentType;
/**
* 回复的评论ID
*/
private String commentId;
/**
* 被回复数
*/
private Integer replyCount;
/**
* 被回复人ID
*/
private String replyUserId;
/**
* 被回复人名称
*/
private String replyUserName;
/**
* 被回复人头像
*/
private String replyUserFace;
/**
* 点赞数
*/
private Integer likeCount;
/**
* 点踩数
*/
private Integer unLikeCount;
/**
* 屏蔽标识 0未屏蔽1已屏蔽
*/
private String shieldFlag;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 0 未进行校验1 微信校验通过2 微信校验不通过3 管理员校验通过4 管理员校验不通过
*/
private String sensitiveFlag;
/**
* 党员标识0-1-
*/
private String partyFlag;
}

86
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/NoticeCommentUserAttitudeDTO.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
public class NoticeCommentUserAttitudeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 内容评论ID
*/
private String noticeCommentId;
/**
* 用户ID
*/
private String userId;
/**
* 用户点赞点踩标识 0点赞1点踩
*/
private String attitudeFlag;
/**
* 删除标识 0未删除1删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

50
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentListFormDTO.java

@ -0,0 +1,50 @@
package com.elink.esua.epdc.dto.epdc.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 移动端-内容最新最热列表
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeCommentListFormDTO implements Serializable {
private static final long serialVersionUID = -8864248267171206774L;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0")
private int pageIndex;
/**
* 页容量默认20页
*/
@Min(value = 1, message = "每页条数必须大于必须大于0")
private int pageSize = 10;
/**
* 第一页查询发起时的时间
*/
private String timestamp;
/**
* 列表类型 0最新1最热
*/
@NotBlank(message = "列表类型不能为空")
private String orderType;
/**
* 内容ID
*/
@NotBlank(message = "内容ID不能为空")
private String noticeId;
/**
* 用户ID
*/
private String userId;
}

40
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentStatementFormDTO.java

@ -0,0 +1,40 @@
package com.elink.esua.epdc.dto.epdc.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author: zhangyong
* @Date: 2020/3/25
* @Description: 表态评论/
*/
@Data
public class EpdcNoticeCommentStatementFormDTO implements Serializable {
private static final long serialVersionUID = -2046090814527654468L;
/**
* 表态 0赞1踩2取消点赞3取消点踩
*/
@NotNull(message = "态度不能为空")
private String attitude;
/**
* 评论ID
*/
@NotNull(message = "评论ID不能为空")
private String commentId;
/**
* 新闻ID
*/
@NotNull(message = "内容ID不能为空")
private String noticeId;
/**
* 用户ID
*/
private String userId;
}

67
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNoticeCommentSubmitFormDTO.java

@ -0,0 +1,67 @@
package com.elink.esua.epdc.dto.epdc.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* 移动端-评论内容提交评论
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeCommentSubmitFormDTO implements Serializable {
private static final long serialVersionUID = -8864248267071206774L;
/**
* 被评论的内容ID
*/
@NotBlank(message = "被评论的内容ID不能为空")
private String noticeId;
/**
* 父评论被评论ID
*/
private String faCommentId;
/**
* 评论内容
*/
@Size(min = 1, max = 500, message = "评论内容不能超过500字")
private String content;
/**
* 评论人ID
*/
@NotNull(message = "评论人ID不能为空")
private String userId;
/**
* 评论人昵称
*/
private String userName;
/**
* 评论人头像
*/
private String userFace;
/**
* 党员标识0-1-
*/
private String partyFlag;
/**
*是否提交为内容待审核状态
*/
private Boolean isConReview;
/**
* 部门id
*/
private Long deptId;
}

28
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentListResultDTO.java

@ -0,0 +1,28 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 移动端-新闻最新最热列表
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeCommentListResultDTO implements Serializable {
private static final long serialVersionUID = 6087794316919494277L;
/**
* 表态数
*/
private long statementNum;
/**
* 最新最热 评论列表
*/
private List<EpdcNoticeCommentsResultDTO> commentsListResultDTO;
}

35
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentUserInfoResultDTO.java

@ -0,0 +1,35 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 移动端-内容评论用户信息
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeCommentUserInfoResultDTO implements Serializable {
private static final long serialVersionUID = 6087794316919494277L;
/**
* 用户ID
*/
private String userId;
/**
* 用户名
*/
private String userName;
/**
* 用户头像
*/
private String userFace;
/**
* 党员标识0-1-
*/
private String partyFlag;
}

57
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/EpdcNoticeCommentsResultDTO.java

@ -0,0 +1,57 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 移动端-内容最新最热 评论列表
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeCommentsResultDTO implements Serializable {
private static final long serialVersionUID = 6087794316919494277L;
/**
* 评论ID
*/
private String commentId;
/**
* 评论内容
*/
private String content;
/**
* 时间
*/
private String commentTime;
/**
* 赞数
*/
private Integer approveNum;
/**
* 踩数
*/
private Integer opposeNum;
/**
* 用户信息
*/
private EpdcNoticeCommentUserInfoResultDTO user;
/**
* 回复评论信息
*/
private EpdcNoticeReplyCommentResultDTO replyComment;
/**
* 用户是否赞过false未赞
*/
private Boolean userLike;
/**
* 用户是否踩过true踩
*/
private Boolean userDislike;
}

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

@ -0,0 +1,24 @@
package com.elink.esua.epdc.dto.epdc.result;
import lombok.Data;
import java.io.Serializable;
/**
* 移动端-内容回复评论信息
* @Author zy
* @Date 2020/3/26
*/
@Data
public class EpdcNoticeReplyCommentResultDTO implements Serializable {
private static final long serialVersionUID = 6087794316919494277L;
/**
* 用户名
*/
private String userName;
/**
* 内容
*/
private String content;
}

5
esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/result/ModuleCategoryResultDTO.java

@ -54,6 +54,11 @@ public class ModuleCategoryResultDTO implements Serializable {
*/
private String bannerFlag;
/**
* 内容评论标识 0-1-
*/
private String commentFlag;
/**
* 备注
*/

57
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java

@ -20,13 +20,15 @@ package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO;
import com.elink.esua.epdc.service.NoticeCommentService;
import com.elink.esua.epdc.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -45,6 +47,9 @@ public class EpdcAppNoticeController {
@Autowired
private NoticeService noticeService;
@Autowired
private NoticeCommentService noticeCommentService;
/**
* 移动端通知列表
*
@ -86,10 +91,9 @@ public class EpdcAppNoticeController {
return this.noticeService.updateReadingAmount(formDto);
}
/*
/**
* 移动端通知列表接口 - v2
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO>>
* @Author zhangyong
@ -99,4 +103,49 @@ public class EpdcAppNoticeController {
public Result<List<EpdcNoticeListResultDTO>> listNotice(@RequestBody EpdcNoticeListV2FormDTO formDto) {
return noticeService.listV2Notice(formDto);
}
/**
* 内容评论回复提交
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:50
*/
@PostMapping("comment/submit")
public Result noticeCommentSubmit(@RequestBody EpdcNoticeCommentSubmitFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return noticeCommentService.saveNoticeComment(formDto);
}
/**
* 内容评论表态
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:55
*/
@PostMapping("comment/statement")
public Result noticeCommentStatement(@RequestBody EpdcNoticeCommentStatementFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return noticeCommentService.noticeCommentStatement(formDto);
}
/**
* 内容评论列表
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO>
* @author Liuchuang
* @since 2021/3/16 13:57
*/
@GetMapping("comment/list")
public Result<EpdcNoticeCommentListResultDTO> listNoticeComments(@RequestBody EpdcNoticeCommentListFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
return noticeCommentService.listNoticeComments(formDto);
}
}

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

@ -0,0 +1,87 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
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.DefaultGroup;
import com.elink.esua.epdc.dto.NoticeCommentDTO;
import com.elink.esua.epdc.service.NoticeCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@RestController
@RequestMapping("noticecomment")
public class NoticeCommentController {
@Autowired
private NoticeCommentService noticeCommentService;
@GetMapping("page")
public Result<PageData<NoticeCommentDTO>> page(@RequestParam Map<String, Object> params){
PageData<NoticeCommentDTO> page = noticeCommentService.page(params);
return new Result<PageData<NoticeCommentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<NoticeCommentDTO> get(@PathVariable("id") String id){
NoticeCommentDTO data = noticeCommentService.get(id);
return new Result<NoticeCommentDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody NoticeCommentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
noticeCommentService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody NoticeCommentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
noticeCommentService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
noticeCommentService.delete(ids);
return new Result();
}
}

87
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/NoticeCommentUserAttitudeController.java

@ -0,0 +1,87 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
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.DefaultGroup;
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO;
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@RestController
@RequestMapping("noticecommentuserattitude")
public class NoticeCommentUserAttitudeController {
@Autowired
private NoticeCommentUserAttitudeService noticeCommentUserAttitudeService;
@GetMapping("page")
public Result<PageData<NoticeCommentUserAttitudeDTO>> page(@RequestParam Map<String, Object> params){
PageData<NoticeCommentUserAttitudeDTO> page = noticeCommentUserAttitudeService.page(params);
return new Result<PageData<NoticeCommentUserAttitudeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<NoticeCommentUserAttitudeDTO> get(@PathVariable("id") String id){
NoticeCommentUserAttitudeDTO data = noticeCommentUserAttitudeService.get(id);
return new Result<NoticeCommentUserAttitudeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody NoticeCommentUserAttitudeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
noticeCommentUserAttitudeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody NoticeCommentUserAttitudeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
noticeCommentUserAttitudeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
noticeCommentUserAttitudeService.delete(ids);
return new Result();
}
}

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

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
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.result.EpdcNoticeCommentsResultDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Mapper
public interface NoticeCommentDao extends BaseDao<NoticeCommentEntity> {
/**
* 评论回复数加1
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:19
*/
void updateReplyCount(String commentId);
/**
* 更新内容评论支持数
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:52
*/
void updateNoticeCommentApproveNum(String commentId);
/**
* 更新内容评论反对数
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:52
*/
void updateNoticeCommentOpposeNum(String commentId);
/**
* 评论 赞数-1
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 15:02
*/
void updateNoticeCommentApproveNumSubtract(String commentId);
/**
* 评论 踩数-1
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 15:02
*/
void updateNoticeCommentOpposeNumSubtract(String commentId);
/**
* 内容评论的表态数
*
* @param noticeId 内容ID
* @return long
* @author Liuchuang
* @since 2021/3/16 15:11
*/
long selectCountOfNoticeCommentStatementNum(String noticeId);
/**
* 内容评论列表
*
* @param formDto 参数
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO>
* @author Liuchuang
* @since 2021/3/16 15:14
*/
List<EpdcNoticeCommentsResultDTO> selectListNoticeComments(EpdcNoticeCommentListFormDTO formDto);
}

33
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeCommentUserAttitudeDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Mapper
public interface NoticeCommentUserAttitudeDao extends BaseDao<NoticeCommentUserAttitudeEntity> {
}

2
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java

@ -138,4 +138,6 @@ public interface NoticeDao extends BaseDao<NoticeEntity> {
* @return java.util.List<com.elink.esua.epdc.dto.NoticeDTO>
**/
List<NoticeDTO> selectListOfNoticeDTO(Map<String, Object> params);
void updateNoticeCommentNum(String id);
}

5
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/ModuleCategoryEntity.java

@ -91,6 +91,11 @@ public class ModuleCategoryEntity extends BaseEpdcEntity {
*/
private String enableFlag;
/**
* 内容评论标识 0-1-
*/
private String commentFlag;
/**
* 上级部门名称
*/

121
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/NoticeCommentEntity.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_notice_comment")
public class NoticeCommentEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 内容ID
*/
private String noticeId;
/**
* 评论人ID
*/
private String userId;
/**
* 评论人昵称
*/
private String userName;
/**
* 评论人头像
*/
private String userFace;
/**
* 评论内容
*/
private String content;
/**
* 评论类型 0评论1回复2回复的回复
*/
private String commentType;
/**
* 回复的评论ID
*/
private String commentId;
/**
* 被回复数
*/
private Integer replyCount;
/**
* 被回复人ID
*/
private String replyUserId;
/**
* 被回复人名称
*/
private String replyUserName;
/**
* 被回复人头像
*/
private String replyUserFace;
/**
* 点赞数
*/
private Integer likeCount;
/**
* 点踩数
*/
private Integer unLikeCount;
/**
* 屏蔽标识 0未屏蔽1已屏蔽
*/
private String shieldFlag;
/**
* 0 未进行校验1 微信校验通过2 微信校验不通过3 管理员校验通过4 管理员校验不通过
*/
private String sensitiveFlag;
/**
* 党员标识0-1-
*/
private String partyFlag;
}

56
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/entity/NoticeCommentUserAttitudeEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_notice_comment_user_attitude")
public class NoticeCommentUserAttitudeEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 内容评论ID
*/
private String noticeCommentId;
/**
* 用户ID
*/
private String userId;
/**
* 用户点赞点踩标识 0点赞1点踩
*/
private String attitudeFlag;
}

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

@ -0,0 +1,170 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.NoticeCommentDTO;
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.EpdcNoticeCommentSubmitFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity;
import java.util.List;
import java.util.Map;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
public interface NoticeCommentService extends BaseService<NoticeCommentEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<NoticeCommentDTO>
* @author generator
* @date 2021-03-16
*/
PageData<NoticeCommentDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<NoticeCommentDTO>
* @author generator
* @date 2021-03-16
*/
List<NoticeCommentDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return NoticeCommentDTO
* @author generator
* @date 2021-03-16
*/
NoticeCommentDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void save(NoticeCommentDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void update(NoticeCommentDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-16
*/
void delete(String[] ids);
/**
* 内容评论回复提交
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 11:18
*/
Result saveNoticeComment(EpdcNoticeCommentSubmitFormDTO formDto);
/**
* 内容评论表态
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @author Liuchuang
* @since 2021/3/16 13:33
*/
Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto);
/**
* 内容评论列表
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO>
* @author Liuchuang
* @since 2021/3/16 13:43
*/
Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto);
/**
* 更新内容评论支持数
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:52
*/
void updateNoticeCommentApproveNum(String commentId);
/**
* 更新内容评论反对数
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:52
*/
void updateNoticeCommentOpposeNum(String commentId);
/**
* 评论 赞数-1
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:59
*/
void updateNoticeCommentApproveNumSubtract(String commentId);
/**
* 评论 踩数-1
*
* @param commentId 评论ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:59
*/
void updateNoticeCommentOpposeNumSubtract(String commentId);
}

107
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeCommentUserAttitudeService.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service;
import com.elink.esua.epdc.commons.mybatis.service.BaseService;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO;
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity;
import java.util.List;
import java.util.Map;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
public interface NoticeCommentUserAttitudeService extends BaseService<NoticeCommentUserAttitudeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<NoticeCommentUserAttitudeDTO>
* @author generator
* @date 2021-03-16
*/
PageData<NoticeCommentUserAttitudeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<NoticeCommentUserAttitudeDTO>
* @author generator
* @date 2021-03-16
*/
List<NoticeCommentUserAttitudeDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return NoticeCommentUserAttitudeDTO
* @author generator
* @date 2021-03-16
*/
NoticeCommentUserAttitudeDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void save(NoticeCommentUserAttitudeDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void update(NoticeCommentUserAttitudeDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-16
*/
void delete(String[] ids);
/**
* 内容评论表态
*
* @param formDto
* @return com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO
* @author Liuchuang
* @since 2021/3/16 14:45
*/
Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto);
}

18
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/NoticeService.java

@ -22,9 +22,9 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.NoticeDTO;
import com.elink.esua.epdc.dto.SysSimpleDictDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO;
import com.elink.esua.epdc.entity.NoticeEntity;
@ -171,10 +171,9 @@ public interface NoticeService extends BaseService<NoticeEntity> {
**/
Result<List<SysSimpleDictDTO>> getListSimpleByDictType(String dictType);
/*
/**
* 移动端通知列表接口 - v2
*
* @param userDetail
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO>>
* @Author zhangyong
@ -189,4 +188,15 @@ public interface NoticeService extends BaseService<NoticeEntity> {
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.NoticeDTO>
**/
PageData<NoticeDTO> listPage(Map<String, Object> params);
/**
* 内容评论数+1
*
* @param id 内容ID
* @return void
* @author Liuchuang
* @since 2021/3/16 14:23
*/
void updateNoticeCommentNum(String id);
}

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

@ -0,0 +1,201 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.NoticeCommentDao;
import com.elink.esua.epdc.dto.NoticeCommentDTO;
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO;
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.EpdcNoticeCommentSubmitFormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO;
import com.elink.esua.epdc.entity.NoticeCommentEntity;
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity;
import com.elink.esua.epdc.service.NoticeCommentService;
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService;
import com.elink.esua.epdc.service.NoticeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 内容评论表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Service
public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao, NoticeCommentEntity> implements NoticeCommentService {
@Autowired
private NoticeService noticeService;
@Autowired
private NoticeCommentUserAttitudeService noticeCommentUserAttitudeService;
@Override
public PageData<NoticeCommentDTO> page(Map<String, Object> params) {
IPage<NoticeCommentEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, NoticeCommentDTO.class);
}
@Override
public List<NoticeCommentDTO> list(Map<String, Object> params) {
List<NoticeCommentEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, NoticeCommentDTO.class);
}
private QueryWrapper<NoticeCommentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<NoticeCommentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public NoticeCommentDTO get(String id) {
NoticeCommentEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, NoticeCommentDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(NoticeCommentDTO dto) {
NoticeCommentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(NoticeCommentDTO dto) {
NoticeCommentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result saveNoticeComment(EpdcNoticeCommentSubmitFormDTO formDto) {
NoticeCommentEntity commentEntity = new NoticeCommentEntity();
commentEntity.setContent(formDto.getContent());
commentEntity.setUserId(formDto.getUserId());
commentEntity.setUserName(formDto.getUserName());
commentEntity.setUserFace(formDto.getUserFace());
commentEntity.setPartyFlag(formDto.getPartyFlag());
commentEntity.setNoticeId(formDto.getNoticeId());
// 评论类型 0-评论
String commentType = NumConstant.ZERO_STR;
// 父评论:用户回复的那条评论
NoticeCommentEntity parentComment = null;
if (!StringUtils.isEmpty(formDto.getFaCommentId())) {
parentComment = baseDao.selectById(formDto.getFaCommentId());
if (null == parentComment || null == parentComment.getId()) {
return new Result().error("您要回复的评论不存在");
}
commentType = NumConstant.ONE_STR;
commentEntity.setCommentId(formDto.getFaCommentId());
commentEntity.setReplyUserId(parentComment.getUserId());
commentEntity.setReplyUserName(parentComment.getUserName());
commentEntity.setReplyUserFace(parentComment.getUserFace());
}
commentEntity.setCommentType(commentType);
if (NumConstant.ONE != baseDao.insert(commentEntity)) {
return new Result().error("评论失败");
}
// 回复加1
if (NumConstant.ONE_STR.equals(commentType)) {
baseDao.updateReplyCount(formDto.getFaCommentId());
}
// 内容评论数加1
noticeService.updateNoticeCommentNum(commentEntity.getNoticeId());
return new Result();
}
@Override
public Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto) {
return noticeCommentUserAttitudeService.noticeCommentStatement(formDto);
}
@Override
public Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto) {
// 表态数
long statementNum = baseDao.selectCountOfNoticeCommentStatementNum(formDto.getNoticeId());
int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageIndex(pageIndex);
// 评论
List<EpdcNoticeCommentsResultDTO> list = baseDao.selectListNoticeComments(formDto);
EpdcNoticeCommentListResultDTO data = new EpdcNoticeCommentListResultDTO();
data.setStatementNum(statementNum);
data.setCommentsListResultDTO(list);
return new Result<EpdcNoticeCommentListResultDTO>().ok(data);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateNoticeCommentApproveNum(String commentId) {
baseDao.updateNoticeCommentApproveNum(commentId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateNoticeCommentOpposeNum(String commentId) {
baseDao.updateNoticeCommentOpposeNum(commentId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateNoticeCommentApproveNumSubtract(String commentId) {
baseDao.updateNoticeCommentApproveNumSubtract(commentId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateNoticeCommentOpposeNumSubtract(String commentId) {
baseDao.updateNoticeCommentOpposeNumSubtract(commentId);
}
}

163
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeCommentUserAttitudeServiceImpl.java

@ -0,0 +1,163 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.NoticeCommentUserAttitudeDao;
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO;
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity;
import com.elink.esua.epdc.service.NoticeCommentService;
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 内容评论点赞点踩表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Service
public class NoticeCommentUserAttitudeServiceImpl extends BaseServiceImpl<NoticeCommentUserAttitudeDao, NoticeCommentUserAttitudeEntity> implements NoticeCommentUserAttitudeService {
@Autowired
private NoticeCommentService noticeCommentService;
@Override
public PageData<NoticeCommentUserAttitudeDTO> page(Map<String, Object> params) {
IPage<NoticeCommentUserAttitudeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, NoticeCommentUserAttitudeDTO.class);
}
@Override
public List<NoticeCommentUserAttitudeDTO> list(Map<String, Object> params) {
List<NoticeCommentUserAttitudeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, NoticeCommentUserAttitudeDTO.class);
}
private QueryWrapper<NoticeCommentUserAttitudeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<NoticeCommentUserAttitudeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public NoticeCommentUserAttitudeDTO get(String id) {
NoticeCommentUserAttitudeEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, NoticeCommentUserAttitudeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(NoticeCommentUserAttitudeDTO dto) {
NoticeCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentUserAttitudeEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(NoticeCommentUserAttitudeDTO dto) {
NoticeCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentUserAttitudeEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto) {
// 获取用户表态记录
QueryWrapper<NoticeCommentUserAttitudeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(formDto.getUserId()), "USER_ID", formDto.getUserId());
wrapper.eq(StringUtils.isNotBlank(formDto.getCommentId()), "NOTICE_COMMENT_ID", formDto.getCommentId());
NoticeCommentUserAttitudeEntity attitudeEntity = baseDao.selectOne(wrapper);
if (NumConstant.ZERO_STR.equals(formDto.getAttitude()) || NumConstant.ONE_STR.equals(formDto.getAttitude())){
if (attitudeEntity == null){
//没有点赞或者点踩,直接插入数据
NoticeCommentUserAttitudeDTO noticeCommentUserAttitudeDto = new NoticeCommentUserAttitudeDTO();
noticeCommentUserAttitudeDto.setNoticeCommentId(formDto.getCommentId());
noticeCommentUserAttitudeDto.setUserId(formDto.getUserId());
noticeCommentUserAttitudeDto.setAttitudeFlag(formDto.getAttitude());
this.save(noticeCommentUserAttitudeDto);
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){
noticeCommentService.updateNoticeCommentApproveNum(formDto.getCommentId());
}
if (NumConstant.ONE_STR.equals(formDto.getAttitude())){
noticeCommentService.updateNoticeCommentOpposeNum(formDto.getCommentId());
}
}else {
if (!formDto.getAttitude().equals(attitudeEntity.getAttitudeFlag())){
attitudeEntity.setAttitudeFlag(formDto.getAttitude());
this.updateById(attitudeEntity);
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){
//赞数加1 踩数减一
noticeCommentService.updateNoticeCommentApproveNum(formDto.getCommentId());
noticeCommentService.updateNoticeCommentOpposeNumSubtract(formDto.getCommentId());
}else {
//踩数加一 赞数减一
noticeCommentService.updateNoticeCommentOpposeNum(formDto.getCommentId());
noticeCommentService.updateNoticeCommentApproveNumSubtract(formDto.getCommentId());
}
}
}
}else {
//删除点赞或踩的记录,如果重新点赞或踩则重新插入
this.deleteById(attitudeEntity.getId());
if (NumConstant.TWO_STR.equals(formDto.getAttitude())){
//取消赞
noticeCommentService.updateNoticeCommentApproveNumSubtract(formDto.getCommentId());
}
if (NumConstant.THREE_STR.equals(formDto.getAttitude())){
//取消踩
noticeCommentService.updateNoticeCommentOpposeNumSubtract(formDto.getCommentId());
}
}
return new Result();
}
}

10
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java

@ -34,9 +34,9 @@ import com.elink.esua.epdc.dao.NoticeDao;
import com.elink.esua.epdc.dto.NoticeDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
import com.elink.esua.epdc.dto.SysSimpleDictDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.*;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO;
import com.elink.esua.epdc.entity.ModuleCategoryEntity;
@ -397,4 +397,10 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
List<NoticeDTO> list = baseDao.selectListOfNoticeDTO(params);
return new PageData<>(list, page.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateNoticeCommentNum(String id) {
baseDao.updateNoticeCommentNum(id);
}
}

1
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/ModuleCategoryDao.xml

@ -61,6 +61,7 @@
IMG_URL,
MODULE_STYLE,
BANNER_FLAG,
COMMENT_FLAG,
REMARK,
SORT
from epdc_module_category

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

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.NoticeCommentDao">
<update id="updateReplyCount">
UPDATE epdc_notice_comment
SET REPLY_COUNT = REPLY_COUNT + 1
WHERE ID = #{commentId}
</update>
<update id="updateNoticeCommentApproveNum">
UPDATE epdc_notice_comment
SET LIKE_COUNT = LIKE_COUNT + 1
WHERE ID = #{commentId}
</update>
<update id="updateNoticeCommentOpposeNum">
UPDATE epdc_notice_comment
SET UN_LIKE_COUNT = UN_LIKE_COUNT + 1
WHERE ID = #{commentId}
</update>
<update id="updateNoticeCommentApproveNumSubtract" parameterType="java.lang.String">
UPDATE epdc_notice_comment
SET LIKE_COUNT = LIKE_COUNT - 1
WHERE ID = #{commentId}
</update>
<update id="updateNoticeCommentOpposeNumSubtract" parameterType="java.lang.String">
UPDATE epdc_notice_comment
SET UN_LIKE_COUNT = UN_LIKE_COUNT - 1
WHERE ID = #{commentId}
</update>
<select id="selectCountOfNoticeCommentStatementNum" resultType="long">
SELECT
COUNT( ID ) +
CASE
WHEN SUM( LIKE_COUNT + UN_LIKE_COUNT ) IS NULL THEN
0 ELSE SUM( LIKE_COUNT + UN_LIKE_COUNT )
END AS statementNum
FROM
epdc_notice_comment
WHERE
DEL_FLAG = '0'
AND NOTICE_ID = #{noticeId}
</select>
<resultMap id="listNoticeCommentsMap" type="com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO">
<result property="commentId" column="ID"/>
<result property="content" column="CONTENT"/>
<result property="commentTime" column="CREATED_TIME"/>
<result property="approveNum" column="LIKE_COUNT"/>
<result property="opposeNum" column="UN_LIKE_COUNT"/>
<result property="user.userId" column="USER_ID"/>
<result property="user.userName" column="USERNAME"/>
<result property="user.userFace" column="USER_FACE"/>
<result property="user.partyFlag" column="PARTY_FLAG"/>
<result property="userLike" column="userLike"/>
<result property="userDislike" column="userDislike"/>
<result property="replyComment.userName" column="replyUserName"/>
<result property="replyComment.content" column="replyContent"/>
</resultMap>
<select id="selectListNoticeComments" resultMap="listNoticeCommentsMap">
SELECT
t2.ID,
t2.CONTENT,
t2.CREATED_TIME,
t2.LIKE_COUNT,
t2.UN_LIKE_COUNT,
t2.USER_ID,
t2.USER_FACE,
t2.USERNAME,
t2.PARTY_FLAG,
t2.userLike,
t2.userDislike,
t3.USER_NAME AS replyUserName,
t3.CONTENT AS replyContent
FROM (
SELECT
(ua.attitude_flag = 0) userLike,
(ua.attitude_flag = 1) userDislike,
t1.ID,
t1.COMMENT_ID,
t1.CONTENT,
t1.CREATED_TIME,
t1.USER_ID,
t1.USER_FACE,
t1.USER_NAME USERNAME,
t1.PARTY_FLAG,
t1.LIKE_COUNT,
t1.UN_LIKE_COUNT,
(t1.REPLY_COUNT + t1.LIKE_COUNT + t1.UN_LIKE_COUNT) AS attitudeNum
FROM
epdc_notice_comment t1
LEFT JOIN epdc_notice_comment_user_attitude ua
ON t1.ID = ua.NOTICE_COMMENT_ID
AND ua.DEL_FLAG = '0'
AND ua.USER_ID = #{userId}
AND ua.UPDATED_TIME = ( SELECT MAX( a.updated_time ) FROM epdc_notice_comment_user_attitude a WHERE a.NOTICE_COMMENT_ID = ua.NOTICE_COMMENT_ID AND a.user_id = ua.user_id )
WHERE t1.DEL_FLAG = '0' AND t1.SHIELD_FLAG = '0'
AND t1.NOTICE_ID = #{noticeId}
ORDER BY
<if test='orderType == "1"'>
attitudeNum DESC,
</if>
t1.CREATED_TIME DESC
LIMIT #{pageIndex},#{pageSize}
) t2
LEFT JOIN epdc_notice_comment t3 ON t2.COMMENT_ID = t3.ID
ORDER BY
<if test='orderType == "1"'>
attitudeNum DESC,
</if>
t2.CREATED_TIME DESC
</select>
</mapper>

6
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeCommentUserAttitudeDao.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.dao.NoticeCommentUserAttitudeDao">
</mapper>

4
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/NoticeDao.xml

@ -182,4 +182,8 @@
</if>
order by t1.SORT, t1.RELEASE_TIME desc
</select>
<update id="updateNoticeCommentNum">
UPDATE epdc_notice SET COMMENT_NUM = COMMENT_NUM + 1 WHERE ID = #{id}
</update>
</mapper>

Loading…
Cancel
Save