38 changed files with 2100 additions and 8 deletions
@ -0,0 +1,50 @@ |
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|||
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; |
|||
import com.elink.esua.epdc.service.TopicCommentService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* 移动端接口-评论模块 |
|||
* @Author WJP |
|||
* @Date 2019/9/9 09:45 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("group/comment") |
|||
public class ApiTopicCommentController { |
|||
|
|||
@Autowired |
|||
private TopicCommentService topicCommentService; |
|||
|
|||
/** |
|||
* 提交评论或回复接口 |
|||
*/ |
|||
@PostMapping("submit") |
|||
public Result submit(@LoginUser TokenDto userDetail, @RequestBody TopicCommentFormDTO topicCommentFormDTO) { |
|||
return topicCommentService.submit(userDetail,topicCommentFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* 评论(赞/踩) |
|||
*/ |
|||
@PostMapping("statement") |
|||
public Result statement(@LoginUser TokenDto userDetail, @RequestBody TopicCommentStatementFormDTO topicCommentStatementFormDTO) { |
|||
return topicCommentService.statement(userDetail,topicCommentStatementFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* 评论列表 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<EventCommentsResultDTO> listOfComments(@LoginUser TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO) { |
|||
return topicCommentService.listOfComments(userDetail,topicCommentsFormDTO); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; |
|||
import com.elink.esua.epdc.feign.fallback.TopicCommentFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
/** |
|||
* 评论模块调用 |
|||
* @Author LC |
|||
* @Date 2019/9/7 11:34 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_GROUP_SERVER, fallback = TopicCommentFeignClientFallback.class) |
|||
public interface TopicCommentFeignClient { |
|||
|
|||
|
|||
@PostMapping(value = "group/epdc-app/comment/submit", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result submit(TopicCommentFormDTO commentFormDTO); |
|||
|
|||
@PostMapping(value = "group/epdc-app/comment/statement", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result statement(TopicCommentStatementFormDTO commentStatementFormDTO); |
|||
|
|||
@GetMapping(value = "group/epdc-app/comment/list", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result<EventCommentsResultDTO> listOfComments(TopicCommentsFormDTO formDto); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; |
|||
import com.elink.esua.epdc.feign.TopicCommentFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
|
|||
@Component |
|||
public class TopicCommentFeignClientFallback implements TopicCommentFeignClient { |
|||
|
|||
@Override |
|||
public Result submit(TopicCommentFormDTO commentFormDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "submit", commentFormDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result statement(TopicCommentStatementFormDTO commentStatementFormDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "statement", commentStatementFormDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result<EventCommentsResultDTO> listOfComments(TopicCommentsFormDTO formDto) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_GROUP_SERVER, "listOfComments", formDto); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|||
import com.elink.esua.epdc.commons.tools.annotation.LoginUser; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.comment.*; |
|||
import com.elink.esua.epdc.dto.comment.form.CommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.form.EventCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; |
|||
|
|||
|
|||
/** |
|||
* 移动端接口-评论模块 |
|||
* @Author WJP |
|||
* @Date 2019/9/9 09:45 |
|||
*/ |
|||
public interface TopicCommentService { |
|||
|
|||
/** |
|||
* 提交评论或回复接口 |
|||
*/ |
|||
Result submit(@LoginUser TokenDto userDetail, TopicCommentFormDTO topicCommentFormDTO); |
|||
|
|||
/** |
|||
* 评论(赞/踩) |
|||
*/ |
|||
Result statement(@LoginUser TokenDto userDetail, TopicCommentStatementFormDTO topicCommentStatementFormDTO); |
|||
|
|||
|
|||
/** |
|||
* 评论列表 |
|||
*/ |
|||
Result<EventCommentsResultDTO> listOfComments(TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO); |
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
|
|||
import com.elink.esua.epdc.async.WxMaSecCheckTask; |
|||
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.result.EventCommentsResultDTO; |
|||
import com.elink.esua.epdc.feign.TopicCommentFeignClient; |
|||
import com.elink.esua.epdc.service.TopicCommentService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.redis.listener.Topic; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 移动端接口-评论模块 |
|||
* @Author WJP |
|||
* @Date 2019/9/9 09:45 |
|||
*/ |
|||
@Service |
|||
public class TopicCommentServiceImpl implements TopicCommentService { |
|||
|
|||
@Autowired |
|||
private TopicCommentFeignClient topicCommentFeignClient; |
|||
|
|||
@Autowired |
|||
private WxMaSecCheckTask wxMaSecCheckTask; |
|||
|
|||
@Override |
|||
public Result submit(TokenDto userDetail, TopicCommentFormDTO topicCommentFormDTO) { |
|||
if (null == userDetail) { |
|||
return new Result().error("获取用户信息失败"); |
|||
} |
|||
// 上传内容安全检查
|
|||
wxMaSecCheckTask.checkMessage(topicCommentFormDTO.getContent()); |
|||
topicCommentFormDTO.setUserId(userDetail.getUserId()); |
|||
topicCommentFormDTO.setUserName(userDetail.getNickname()); |
|||
topicCommentFormDTO.setUserFace(userDetail.getFaceImg()); |
|||
return topicCommentFeignClient.submit(topicCommentFormDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result statement(TokenDto userDetail, TopicCommentStatementFormDTO topicCommentStatementFormDTO) { |
|||
if (null == userDetail) { |
|||
return new Result<EventCommentsResultDTO>().error("获取用户信息失败"); |
|||
} |
|||
topicCommentStatementFormDTO.setUseId(userDetail.getUserId()); |
|||
topicCommentStatementFormDTO.setUserName(userDetail.getNickname()); |
|||
return topicCommentFeignClient.statement(topicCommentStatementFormDTO); |
|||
} |
|||
|
|||
@Override |
|||
public Result<EventCommentsResultDTO> listOfComments(TokenDto userDetail, TopicCommentsFormDTO topicCommentsFormDTO) { |
|||
if (null == userDetail) { |
|||
return new Result<EventCommentsResultDTO>().error("获取用户信息失败"); |
|||
} |
|||
topicCommentsFormDTO.setUserId(userDetail.getUserId()); |
|||
return topicCommentFeignClient.listOfComments(topicCommentsFormDTO); |
|||
} |
|||
} |
@ -0,0 +1,141 @@ |
|||
/** |
|||
* 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.comment; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 话题ID |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 评论人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,0 +1,48 @@ |
|||
/** |
|||
* Copyright (c) 2018 人人开源 All rights reserved. |
|||
* <p> |
|||
* https://www.renren.io
|
|||
* <p> |
|||
* 版权所有,侵权必究! |
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto.comment; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.Size; |
|||
|
|||
/** |
|||
* 评论议题、提交评论 |
|||
* |
|||
*/ |
|||
@Data |
|||
public class TopicCommentFormDTO { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String topicId; |
|||
|
|||
private String faCommentId; |
|||
|
|||
@Size(min = 1, max = 500, message = "评论内容不能超过500字") |
|||
private String content; |
|||
|
|||
/** |
|||
* 评论人ID |
|||
*/ |
|||
@NotBlank(message = "评论人ID不能为空") |
|||
private String userId; |
|||
|
|||
/** |
|||
* 评论人昵称 |
|||
*/ |
|||
private String userName; |
|||
|
|||
/** |
|||
* 评论人头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.comment; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
@Data |
|||
public class TopicCommentStatementFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 表态 0赞;1踩;2取消点赞;3取消点踩 |
|||
*/ |
|||
private String attitude; |
|||
|
|||
/** |
|||
* 评论ID |
|||
*/ |
|||
private String commentId; |
|||
|
|||
private String useId; |
|||
|
|||
private String userName; |
|||
|
|||
private String topicId; |
|||
|
|||
|
|||
} |
@ -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 2019-10-23 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentUserAttitudeDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 评论ID |
|||
*/ |
|||
private String commentId; |
|||
|
|||
/** |
|||
* 用户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; |
|||
|
|||
} |
@ -0,0 +1,45 @@ |
|||
package com.elink.esua.epdc.dto.comment; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 移动端评论表单DTO |
|||
* @Author LC |
|||
* @Date 2019/9/9 15:09 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentsFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -3804142943077174555L; |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空") |
|||
private Integer pageIndex; |
|||
/** |
|||
* 页容量 |
|||
*/ |
|||
@NotNull(message = "分页数量不能为空") |
|||
private Integer pageSize; |
|||
/** |
|||
* 时间戳(yyyy-MM-dd HH:mm:ss) |
|||
*/ |
|||
private String timestamp; |
|||
/** |
|||
* 列表类型 0最新;1最热 |
|||
*/ |
|||
@NotBlank(message = "列表类型不能为空") |
|||
private String orderType; |
|||
/** |
|||
* 项目ID |
|||
*/ |
|||
private String topicId; |
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.elink.esua.epdc.dto.comment; |
|||
|
|||
import com.elink.esua.epdc.dto.topic.TopicCommentsDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 移动端评论列表DTO |
|||
* @Author LC |
|||
* @Date 2019/9/9 14:46 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentsResultDTO implements Serializable { |
|||
private static final long serialVersionUID = -5087234859322214256L; |
|||
|
|||
/** |
|||
* 表态数 |
|||
*/ |
|||
private long statementNum; |
|||
|
|||
/** |
|||
* 评论 |
|||
*/ |
|||
List<TopicCommentsDTO> commentsList; |
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.elink.esua.epdc.dto.constant; |
|||
|
|||
/** |
|||
* 发送消息常量 |
|||
* @Author LC |
|||
* @Date 2019/9/18 17:26 |
|||
*/ |
|||
public interface TopicNoticeConstant { |
|||
/** |
|||
* 话题被评论 |
|||
*/ |
|||
String NOTICE_TOPIC_COMMENT = "你的话题【有新评论】"; |
|||
/** |
|||
* 评论被回复 |
|||
*/ |
|||
String NOTICE_TOPIC_COMMENT_REPLY = "你的评论【有新回复】"; |
|||
|
|||
/** |
|||
* 话题支持 |
|||
*/ |
|||
String NOTICE_TOPIC_APPROVE = "你的话题【有新的支持】"; |
|||
/** |
|||
* 话题反对 |
|||
*/ |
|||
String NOTICE_TOPIC_OPPOSE = "你的话题【有新的反对】"; |
|||
/** |
|||
* 评论支持 |
|||
*/ |
|||
String NOTICE_COMMENT_APPROVE = "你的评论【有新的支持】"; |
|||
/** |
|||
* 评论反对 |
|||
*/ |
|||
String NOTICE_COMMENT_OPPOSE = "你的评论【有新的反对】"; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 我的消息类型:1互动通知 |
|||
*/ |
|||
String NOTICE_TYPE_INTERACTIVE_NOTICE = "1"; |
|||
|
|||
|
|||
/** |
|||
* 消息所属业务类型:话题评论 |
|||
*/ |
|||
String NOTICE_BUSINESS_TYPE_TOPIC_COMMENT = "topicComment"; |
|||
/** |
|||
* 消息所属业务类型:话题评论回复 |
|||
*/ |
|||
String NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_REPLY = "topicCommentReply"; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.elink.esua.epdc.dto.events; |
|||
|
|||
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; |
|||
} |
@ -0,0 +1,63 @@ |
|||
package com.elink.esua.epdc.dto.topic; |
|||
|
|||
import com.elink.esua.epdc.dto.events.ReplyCommentDto; |
|||
import com.elink.esua.epdc.dto.events.UserBaseInfoDto; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 事件评论DTO |
|||
* @Author LC |
|||
* @Date 2019/9/6 17:20 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentsDTO implements Serializable { |
|||
private static final long serialVersionUID = 2112619345374657409L; |
|||
|
|||
/** |
|||
* 评论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; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.elink.esua.epdc.dto.events; |
|||
|
|||
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,0 +1,61 @@ |
|||
/** |
|||
* 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.modules.comment.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.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
@RestController |
|||
@RequestMapping(Constant.EPDC_APP + "comment") |
|||
public class AppTopicCommentController { |
|||
|
|||
@Autowired |
|||
private TopicCommentService topicCommentService; |
|||
|
|||
@Autowired |
|||
private TopicCommentUserAttitudeService topicCommentUserAttitudeService; |
|||
|
|||
/** |
|||
* 提交评论或回复接口 |
|||
*/ |
|||
@PostMapping("submit") |
|||
public Result submit(@RequestBody TopicCommentFormDTO commentFormDTO){ |
|||
ValidatorUtils.validateEntity(commentFormDTO); |
|||
return topicCommentService.submit(commentFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* 评论列表 |
|||
*/ |
|||
@GetMapping("list") |
|||
public Result<TopicCommentsResultDTO> listOfComments(@RequestBody TopicCommentsFormDTO formDto) { |
|||
return topicCommentService.listOfComments(formDto); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* 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.modules.comment.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.comment.TopicCommentDTO; |
|||
import com.elink.esua.epdc.modules.comment.excel.TopicCommentExcel; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|||
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 2019-10-23 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("topiccomment") |
|||
public class TopicCommentController { |
|||
|
|||
@Autowired |
|||
private TopicCommentService topicCommentService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<TopicCommentDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<TopicCommentDTO> page = topicCommentService.page(params); |
|||
return new Result<PageData<TopicCommentDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<TopicCommentDTO> get(@PathVariable("id") String id){ |
|||
TopicCommentDTO data = topicCommentService.get(id); |
|||
return new Result<TopicCommentDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody TopicCommentDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
topicCommentService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody TopicCommentDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
topicCommentService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
topicCommentService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<TopicCommentDTO> list = topicCommentService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* 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.modules.comment.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.TopicCommentUserAttitudeDTO; |
|||
import com.elink.esua.epdc.modules.comment.excel.TopicCommentUserAttitudeExcel; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|||
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 2019-10-23 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("topiccommentuserattitude") |
|||
public class TopicCommentUserAttitudeController { |
|||
|
|||
@Autowired |
|||
private TopicCommentUserAttitudeService topicCommentUserAttitudeService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<TopicCommentUserAttitudeDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<TopicCommentUserAttitudeDTO> page = topicCommentUserAttitudeService.page(params); |
|||
return new Result<PageData<TopicCommentUserAttitudeDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<TopicCommentUserAttitudeDTO> get(@PathVariable("id") String id){ |
|||
TopicCommentUserAttitudeDTO data = topicCommentUserAttitudeService.get(id); |
|||
return new Result<TopicCommentUserAttitudeDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody TopicCommentUserAttitudeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
topicCommentUserAttitudeService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody TopicCommentUserAttitudeDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
topicCommentUserAttitudeService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
topicCommentUserAttitudeService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<TopicCommentUserAttitudeDTO> list = topicCommentUserAttitudeService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, TopicCommentUserAttitudeExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
/** |
|||
* 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.modules.comment.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Mapper |
|||
public interface TopicCommentDao extends BaseDao<TopicCommentEntity> { |
|||
|
|||
void updateReplyCount(String commentId); |
|||
|
|||
} |
@ -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.modules.comment.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 话题评论用户表态表 话题评论用户表态表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Mapper |
|||
public interface TopicCommentUserAttitudeDao extends BaseDao<TopicCommentUserAttitudeEntity> { |
|||
|
|||
} |
@ -0,0 +1,111 @@ |
|||
/** |
|||
* 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.modules.comment.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 2019-10-23 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_topic_comment") |
|||
public class TopicCommentEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 话题ID |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 评论人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,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.modules.comment.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 2019-10-23 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_topic_comment_user_attitude") |
|||
public class TopicCommentUserAttitudeEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 评论ID |
|||
*/ |
|||
private String commentId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 表态标识 0:点赞,1:点踩 |
|||
*/ |
|||
private String attitudeFlag; |
|||
|
|||
} |
@ -0,0 +1,98 @@ |
|||
/** |
|||
* 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.modules.comment.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "话题ID") |
|||
private String topicId; |
|||
|
|||
@Excel(name = "评论人ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "评论人昵称") |
|||
private String username; |
|||
|
|||
@Excel(name = "评论人头像") |
|||
private String userFace; |
|||
|
|||
@Excel(name = "评论内容") |
|||
private String content; |
|||
|
|||
@Excel(name = "评论类型 0:评论,1:回复,2:回复的回复") |
|||
private String commentType; |
|||
|
|||
@Excel(name = "回复的评论ID") |
|||
private String commentId; |
|||
|
|||
@Excel(name = "被回复数") |
|||
private Integer replyCount; |
|||
|
|||
@Excel(name = "被回复人ID") |
|||
private String replyUserId; |
|||
|
|||
@Excel(name = "被回复人名称") |
|||
private String replyUsername; |
|||
|
|||
@Excel(name = "被回复人头像") |
|||
private String replyUserFace; |
|||
|
|||
@Excel(name = "点赞数") |
|||
private Integer likeCount; |
|||
|
|||
@Excel(name = "点踩数") |
|||
private Integer unLikeCount; |
|||
|
|||
@Excel(name = "屏蔽标识 0:未屏蔽,1:已屏蔽") |
|||
private String shieldFlag; |
|||
|
|||
@Excel(name = "删除标记 0:未删除,1:已删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
/** |
|||
* 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.modules.comment.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 话题评论用户表态表 话题评论用户表态表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Data |
|||
public class TopicCommentUserAttitudeExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "评论ID") |
|||
private String commentId; |
|||
|
|||
@Excel(name = "用户ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "表态标识 0:点赞,1:点踩") |
|||
private String attitudeFlag; |
|||
|
|||
@Excel(name = "删除标记 0:未删除,1:删除") |
|||
private String delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.modules.comment.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Component |
|||
public class TopicCommentRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* 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.modules.comment.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 话题评论用户表态表 话题评论用户表态表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
@Component |
|||
public class TopicCommentUserAttitudeRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
/** |
|||
* 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.modules.comment.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.comment.TopicCommentDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 话题评论表 话题评论表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
public interface TopicCommentService extends BaseService<TopicCommentEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<TopicCommentDTO> |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
PageData<TopicCommentDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<TopicCommentDTO> |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
List<TopicCommentDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return TopicCommentDTO |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
TopicCommentDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void save(TopicCommentDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void update(TopicCommentDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 提交评论或回复接口 |
|||
* @param commentFormDTO |
|||
*/ |
|||
Result submit(TopicCommentFormDTO commentFormDTO); |
|||
|
|||
/** |
|||
* 移动端评论列表 |
|||
*/ |
|||
Result<TopicCommentsResultDTO> listOfComments(TopicCommentsFormDTO formDto); |
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* 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.modules.comment.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 话题评论用户表态表 话题评论用户表态表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-10-23 |
|||
*/ |
|||
public interface TopicCommentUserAttitudeService extends BaseService<TopicCommentUserAttitudeEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<TopicCommentUserAttitudeDTO> |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
PageData<TopicCommentUserAttitudeDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<TopicCommentUserAttitudeDTO> |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
List<TopicCommentUserAttitudeDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return TopicCommentUserAttitudeDTO |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
TopicCommentUserAttitudeDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void save(TopicCommentUserAttitudeDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void update(TopicCommentUserAttitudeDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-10-23 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,188 @@ |
|||
/** |
|||
* 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.modules.comment.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.dto.comment.TopicCommentDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsFormDTO; |
|||
import com.elink.esua.epdc.dto.comment.TopicCommentsResultDTO; |
|||
import com.elink.esua.epdc.dto.constant.TopicNoticeConstant; |
|||
import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|||
import com.elink.esua.epdc.modules.async.NewsTask; |
|||
import com.elink.esua.epdc.modules.comment.dao.TopicCommentDao; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; |
|||
import com.elink.esua.epdc.modules.comment.redis.TopicCommentRedis; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|||
import com.elink.esua.epdc.modules.topic.service.TopicService; |
|||
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 2019-10-23 |
|||
*/ |
|||
@Service |
|||
public class TopicCommentServiceImpl extends BaseServiceImpl<TopicCommentDao, TopicCommentEntity> implements TopicCommentService { |
|||
|
|||
@Autowired |
|||
private TopicCommentRedis topicCommentRedis; |
|||
|
|||
@Autowired |
|||
private TopicService topicService; |
|||
|
|||
@Autowired |
|||
private NewsTask newsTask; |
|||
|
|||
@Override |
|||
public PageData<TopicCommentDTO> page(Map<String, Object> params) { |
|||
IPage<TopicCommentEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, TopicCommentDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<TopicCommentDTO> list(Map<String, Object> params) { |
|||
List<TopicCommentEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, TopicCommentDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<TopicCommentEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<TopicCommentEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public TopicCommentDTO get(String id) { |
|||
TopicCommentEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, TopicCommentDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(TopicCommentDTO dto) { |
|||
TopicCommentEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(TopicCommentDTO dto) { |
|||
TopicCommentEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public Result submit(TopicCommentFormDTO commentFormDTO) { |
|||
|
|||
TopicCommentEntity commentEntity = new TopicCommentEntity(); |
|||
commentEntity.setContent(commentFormDTO.getContent()); |
|||
commentEntity.setUserId(commentFormDTO.getUserId()); |
|||
commentEntity.setUsername(commentFormDTO.getUserName()); |
|||
commentEntity.setUserFace(commentFormDTO.getUserFace()); |
|||
|
|||
boolean isComment = true; |
|||
|
|||
// 评论类型 0-评论
|
|||
String commentType = NumConstant.ZERO_STR; |
|||
// 父评论:用户回复的那条评论
|
|||
TopicCommentEntity parentComment = null; |
|||
if (!StringUtils.isEmpty(commentFormDTO.getFaCommentId())) { |
|||
parentComment = this.selectById(commentFormDTO.getFaCommentId()); |
|||
if (null == parentComment || null == parentComment.getId()) { |
|||
return new Result().error("您要回复的评论不存在"); |
|||
} |
|||
isComment = false; |
|||
commentType = NumConstant.ONE_STR; |
|||
commentEntity.setCommentId(commentFormDTO.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(commentFormDTO.getFaCommentId()); |
|||
} |
|||
// 评论数加1
|
|||
topicService.updateCommentNum(commentEntity.getTopicId()); |
|||
|
|||
// 组装发送消息内容
|
|||
EpdcInformationFormDTO informationFormDTO = new EpdcInformationFormDTO(); |
|||
informationFormDTO.setType(TopicNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE); |
|||
if (isComment) { |
|||
// 评论
|
|||
informationFormDTO.setUserId(commentEntity.getUserId()); |
|||
informationFormDTO.setContent(commentEntity.getContent()); |
|||
informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_TOPIC_COMMENT); |
|||
informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT); |
|||
informationFormDTO.setBusinessId(commentEntity.getId()); |
|||
informationFormDTO.setRelBusinessContent(commentFormDTO.getUserName()+":"+commentFormDTO.getContent()); |
|||
} else { |
|||
// 回复
|
|||
informationFormDTO.setUserId(parentComment.getUserId()); |
|||
informationFormDTO.setContent(commentFormDTO.getUserName()+":"+commentFormDTO.getContent()); |
|||
informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_TOPIC_COMMENT_REPLY); |
|||
informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_REPLY); |
|||
informationFormDTO.setBusinessId(commentEntity.getId()); |
|||
informationFormDTO.setRelBusinessContent(parentComment.getContent()); |
|||
} |
|||
// 发送消息
|
|||
newsTask.insertUserInformation(informationFormDTO); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public Result<TopicCommentsResultDTO> listOfComments(TopicCommentsFormDTO formDto) { |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* 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.modules.comment.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.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.dto.TopicCommentUserAttitudeDTO; |
|||
import com.elink.esua.epdc.modules.comment.dao.TopicCommentUserAttitudeDao; |
|||
import com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity; |
|||
import com.elink.esua.epdc.modules.comment.redis.TopicCommentUserAttitudeRedis; |
|||
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|||
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 2019-10-23 |
|||
*/ |
|||
@Service |
|||
public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCommentUserAttitudeDao, TopicCommentUserAttitudeEntity> implements TopicCommentUserAttitudeService { |
|||
|
|||
@Autowired |
|||
private TopicCommentUserAttitudeRedis topicCommentUserAttitudeRedis; |
|||
|
|||
@Override |
|||
public PageData<TopicCommentUserAttitudeDTO> page(Map<String, Object> params) { |
|||
IPage<TopicCommentUserAttitudeEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, TopicCommentUserAttitudeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<TopicCommentUserAttitudeDTO> list(Map<String, Object> params) { |
|||
List<TopicCommentUserAttitudeEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, TopicCommentUserAttitudeDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<TopicCommentUserAttitudeEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<TopicCommentUserAttitudeEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public TopicCommentUserAttitudeDTO get(String id) { |
|||
TopicCommentUserAttitudeEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, TopicCommentUserAttitudeDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(TopicCommentUserAttitudeDTO dto) { |
|||
TopicCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentUserAttitudeEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(TopicCommentUserAttitudeDTO dto) { |
|||
TopicCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, TopicCommentUserAttitudeEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
<?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.modules.comment.dao.TopicCommentDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity" id="topicCommentMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="topicId" column="TOPIC_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="username" column="USERNAME"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="commentType" column="COMMENT_TYPE"/> |
|||
<result property="commentId" column="COMMENT_ID"/> |
|||
<result property="replyCount" column="REPLY_COUNT"/> |
|||
<result property="replyUserId" column="REPLY_USER_ID"/> |
|||
<result property="replyUsername" column="REPLY_USERNAME"/> |
|||
<result property="replyUserFace" column="REPLY_USER_FACE"/> |
|||
<result property="likeCount" column="LIKE_COUNT"/> |
|||
<result property="unLikeCount" column="UN_LIKE_COUNT"/> |
|||
<result property="shieldFlag" column="SHIELD_FLAG"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
<update id="updateReplyCount" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET REPLY_COUNT = REPLY_COUNT + 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,20 @@ |
|||
<?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.modules.comment.dao.TopicCommentUserAttitudeDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity" id="topicCommentUserAttitudeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="commentId" column="COMMENT_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="attitudeFlag" column="ATTITUDE_FLAG"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -1,7 +1,12 @@ |
|||
<?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.modules.topic.TopicDao"> |
|||
<mapper namespace="com.elink.esua.epdc.modules.topic.dao.TopicDao"> |
|||
|
|||
|
|||
</mapper> |
|||
<update id="updateCommentNum" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic SET COMMENT_NUM = COMMENT_NUM + 1 WHERE ID = #{id} |
|||
</update> |
|||
|
|||
|
|||
</mapper> |
|||
|
Loading…
Reference in new issue