|
@ -20,14 +20,18 @@ package com.elink.esua.epdc.modules.comment.service.impl; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
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.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
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.constant.FieldConstant; |
|
|
import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; |
|
|
import com.elink.esua.epdc.dto.TopicCommentUserAttitudeDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.comment.TopicCommentDTO; |
|
|
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|
|
import com.elink.esua.epdc.dto.comment.TopicCommentStatementFormDTO; |
|
|
|
|
|
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.TopicCommentUserAttitudeDao; |
|
|
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.entity.TopicCommentUserAttitudeEntity; |
|
|
import com.elink.esua.epdc.modules.comment.redis.TopicCommentUserAttitudeRedis; |
|
|
|
|
|
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|
|
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|
|
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|
|
import com.elink.esua.epdc.modules.comment.service.TopicCommentUserAttitudeService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
@ -48,11 +52,12 @@ import java.util.Map; |
|
|
@Service |
|
|
@Service |
|
|
public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCommentUserAttitudeDao, TopicCommentUserAttitudeEntity> implements TopicCommentUserAttitudeService { |
|
|
public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCommentUserAttitudeDao, TopicCommentUserAttitudeEntity> implements TopicCommentUserAttitudeService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private TopicCommentUserAttitudeRedis topicCommentUserAttitudeRedis; |
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private TopicCommentService topicCommentService; |
|
|
private TopicCommentService topicCommentService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private NewsTask newsTask; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<TopicCommentUserAttitudeDTO> page(Map<String, Object> params) { |
|
|
public PageData<TopicCommentUserAttitudeDTO> page(Map<String, Object> params) { |
|
|
IPage<TopicCommentUserAttitudeEntity> page = baseDao.selectPage( |
|
|
IPage<TopicCommentUserAttitudeEntity> page = baseDao.selectPage( |
|
@ -114,8 +119,14 @@ public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCo |
|
|
wrapper.eq(StringUtils.isNotBlank(formDto.getCommentId()), "COMMENT_ID", formDto.getCommentId()); |
|
|
wrapper.eq(StringUtils.isNotBlank(formDto.getCommentId()), "COMMENT_ID", formDto.getCommentId()); |
|
|
TopicCommentUserAttitudeEntity topicCommentUserAttitudeEntity = baseDao.selectOne(wrapper); |
|
|
TopicCommentUserAttitudeEntity topicCommentUserAttitudeEntity = baseDao.selectOne(wrapper); |
|
|
|
|
|
|
|
|
|
|
|
// 组装发送消息内容
|
|
|
|
|
|
TopicCommentDTO commentDto = topicCommentService.get(formDto.getCommentId()); |
|
|
|
|
|
EpdcInformationFormDTO informationFormDTO = new EpdcInformationFormDTO(); |
|
|
|
|
|
informationFormDTO.setType(TopicNoticeConstant.NOTICE_TYPE_INTERACTIVE_NOTICE); |
|
|
|
|
|
informationFormDTO.setUserId(commentDto.getUserId()); |
|
|
|
|
|
informationFormDTO.setContent(commentDto.getContent()); |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude()) || "1".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude()) || NumConstant.ONE_STR.equals(formDto.getAttitude())){ |
|
|
if (topicCommentUserAttitudeEntity == null){ |
|
|
if (topicCommentUserAttitudeEntity == null){ |
|
|
//没有点赞或者点踩,直接插入数据
|
|
|
//没有点赞或者点踩,直接插入数据
|
|
|
TopicCommentUserAttitudeDTO topicCommentUserAttitudeDTO = new TopicCommentUserAttitudeDTO(); |
|
|
TopicCommentUserAttitudeDTO topicCommentUserAttitudeDTO = new TopicCommentUserAttitudeDTO(); |
|
@ -124,11 +135,21 @@ public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCo |
|
|
topicCommentUserAttitudeDTO.setAttitudeFlag(formDto.getAttitude()); |
|
|
topicCommentUserAttitudeDTO.setAttitudeFlag(formDto.getAttitude()); |
|
|
this.save(topicCommentUserAttitudeDTO); |
|
|
this.save(topicCommentUserAttitudeDTO); |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){ |
|
|
topicCommentService.updateApproveNumAdd(formDto.getCommentId()); |
|
|
topicCommentService.updateApproveNumAdd(formDto.getCommentId()); |
|
|
|
|
|
|
|
|
|
|
|
// 支持
|
|
|
|
|
|
informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_COMMENT_APPROVE); |
|
|
|
|
|
informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_APPROVE); |
|
|
|
|
|
informationFormDTO.setRelBusinessContent(formDto.getUserName()+"支持了你的评论"); |
|
|
} |
|
|
} |
|
|
if ("1".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.ONE_STR.equals(formDto.getAttitude())){ |
|
|
topicCommentService.updateOpposeNumAdd(formDto.getCommentId()); |
|
|
topicCommentService.updateOpposeNumAdd(formDto.getCommentId()); |
|
|
|
|
|
|
|
|
|
|
|
// 反对
|
|
|
|
|
|
informationFormDTO.setTitle(TopicNoticeConstant.NOTICE_COMMENT_OPPOSE); |
|
|
|
|
|
informationFormDTO.setBusinessType(TopicNoticeConstant.NOTICE_BUSINESS_TYPE_TOPIC_COMMENT_OPPOSE); |
|
|
|
|
|
informationFormDTO.setRelBusinessContent(formDto.getUserName()+"反对了你的评论"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}else { |
|
|
}else { |
|
@ -136,7 +157,7 @@ public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCo |
|
|
topicCommentUserAttitudeEntity.setAttitudeFlag(formDto.getAttitude()); |
|
|
topicCommentUserAttitudeEntity.setAttitudeFlag(formDto.getAttitude()); |
|
|
this.updateById(topicCommentUserAttitudeEntity); |
|
|
this.updateById(topicCommentUserAttitudeEntity); |
|
|
|
|
|
|
|
|
if ("0".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){ |
|
|
//赞数加1 踩数减一
|
|
|
//赞数加1 踩数减一
|
|
|
topicCommentService.updateApproveNumAdd(formDto.getCommentId()); |
|
|
topicCommentService.updateApproveNumAdd(formDto.getCommentId()); |
|
|
topicCommentService.updateOpposeNumSubtract(formDto.getCommentId()); |
|
|
topicCommentService.updateOpposeNumSubtract(formDto.getCommentId()); |
|
@ -150,18 +171,16 @@ public class TopicCommentUserAttitudeServiceImpl extends BaseServiceImpl<TopicCo |
|
|
}else { |
|
|
}else { |
|
|
//删除点赞或踩的记录,如果重新点赞或踩则重新插入
|
|
|
//删除点赞或踩的记录,如果重新点赞或踩则重新插入
|
|
|
this.deleteById(topicCommentUserAttitudeEntity.getId()); |
|
|
this.deleteById(topicCommentUserAttitudeEntity.getId()); |
|
|
if ("2".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.TWO_STR.equals(formDto.getAttitude())){ |
|
|
//取消赞
|
|
|
//取消赞
|
|
|
topicCommentService.updateApproveNumSubtract(formDto.getCommentId()); |
|
|
topicCommentService.updateApproveNumSubtract(formDto.getCommentId()); |
|
|
} |
|
|
} |
|
|
if ("3".equals(formDto.getAttitude())){ |
|
|
if (NumConstant.THREE_STR.equals(formDto.getAttitude())){ |
|
|
//取消踩
|
|
|
//取消踩
|
|
|
topicCommentService.updateOpposeNumSubtract(formDto.getCommentId()); |
|
|
topicCommentService.updateOpposeNumSubtract(formDto.getCommentId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 发送消息
|
|
|
|
|
|
newsTask.insertUserInformation(informationFormDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|