Browse Source

【内容审核】-【邻里党群消息队列开发】-(王童)-2020/07/15

feature/dangjian
Jackwang 5 years ago
parent
commit
1ad8f7d256
  1. 1
      esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml
  2. 8
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java
  3. 10
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java
  4. 8
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java
  5. 57
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/rocketmq/consumer/RejectCheckRecordConsumer.java
  6. 27
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/rocketmq/dto/RejectRecordDTO.java
  7. 8
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java
  8. 11
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicImgDao.java
  9. 10
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java
  10. 13
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java
  11. 1
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml
  12. 4
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml
  13. 4
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml
  14. 11
      esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicImgDao.xml

1
esua-epdc/epdc-module/epdc-group/epdc-group-server/pom.xml

@ -146,6 +146,7 @@
<!--RocketMQ--> <!--RocketMQ-->
<rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server> <rocketmq.name.server>47.104.85.99:9876;114.215.125.123:9876</rocketmq.name.server>
<rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group> <rocketmq.consumer.group>organizationGroup</rocketmq.consumer.group>
<rocketmq.consumer.contentSecurity.group>contentSecurityGroup</rocketmq.consumer.contentSecurity.group>
</properties> </properties>
</profile> </profile>

8
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/dao/TopicCommentDao.java

@ -116,4 +116,12 @@ public interface TopicCommentDao extends BaseDao<TopicCommentEntity> {
*/ */
List<EventCommentUserAttitudeDTO> selectListCommentAttitudeForEvent(String topicId); List<EventCommentUserAttitudeDTO> selectListCommentAttitudeForEvent(String topicId);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong
* @date 2020/7/15 17:52
* @params [relationId]
* @return void
*/
void rejectTopicCommentInfo(@Param("relationId") String relationId);
} }

10
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/TopicCommentService.java

@ -23,6 +23,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.comment.*; import com.elink.esua.epdc.dto.comment.*;
import com.elink.esua.epdc.dto.topic.form.TopicReviewFormDTO; import com.elink.esua.epdc.dto.topic.form.TopicReviewFormDTO;
import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity;
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -174,4 +175,13 @@ public interface TopicCommentService extends BaseService<TopicCommentEntity> {
* @since 2019/11/12 14:13 * @since 2019/11/12 14:13
*/ */
List<EventCommentUserAttitudeDTO> listCommentAttitudeForEvent(String topicId); List<EventCommentUserAttitudeDTO> listCommentAttitudeForEvent(String topicId);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong
* @date 2020/7/15 17:52
* @params [dto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result rejectTopicCommentInfo(RejectRecordDTO dto);
} }

8
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/comment/service/impl/TopicCommentServiceImpl.java

@ -41,6 +41,7 @@ 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.entity.TopicCommentEntity;
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; import com.elink.esua.epdc.modules.comment.service.TopicCommentService;
import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient;
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO;
import com.elink.esua.epdc.modules.topic.service.TopicService; import com.elink.esua.epdc.modules.topic.service.TopicService;
import com.elink.esua.epdc.modules.topic.service.impl.TopicServiceImpl; import com.elink.esua.epdc.modules.topic.service.impl.TopicServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -281,4 +282,11 @@ public class TopicCommentServiceImpl extends BaseServiceImpl<TopicCommentDao, To
public List<EventCommentUserAttitudeDTO> listCommentAttitudeForEvent(String topicId) { public List<EventCommentUserAttitudeDTO> listCommentAttitudeForEvent(String topicId) {
return baseDao.selectListCommentAttitudeForEvent(topicId); return baseDao.selectListCommentAttitudeForEvent(topicId);
} }
@Override
@Transactional
public Result rejectTopicCommentInfo(RejectRecordDTO dto) {
baseDao.rejectTopicCommentInfo(dto.getRelationId());
return new Result();
}
} }

57
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/rocketmq/consumer/RejectCheckRecordConsumer.java

@ -0,0 +1,57 @@
package com.elink.esua.epdc.modules.rocketmq.consumer;
import com.alibaba.fastjson.JSONObject;
import com.elink.esua.epdc.commons.tools.constant.RocketMqConstant;
import com.elink.esua.epdc.modules.comment.service.TopicCommentService;
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO;
import com.elink.esua.epdc.modules.topic.service.TopicService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* 内容审核驳回信息处理-监听MQ消息
*
* @Authorwangtong
* @Date2020/7/14 1:54
*/
@Slf4j
@Component
@RocketMQMessageListener(topic = RocketMqConstant.MQ_TOPIC_GROUP_CONTENTSECURITY, consumerGroup = "${rocketmq.consumer.contentSecurity-group}", messageModel = MessageModel.CLUSTERING)
public class RejectCheckRecordConsumer implements RocketMQListener<MessageExt> {
@Autowired
private TopicService topicService;
@Autowired
private TopicCommentService topicCommentService;
@Override
public void onMessage(MessageExt messageExt) {
log.info("EPDC-GROUP-SERVER消费消息START:{topic:{}, msgId:{}}", RocketMqConstant.MQ_TOPIC_GROUP_CONTENTSECURITY, messageExt.getMsgId());
try {
String charset = "UTF-8";
String body = new String(messageExt.getBody(), charset);
String tag = messageExt.getTags();
RejectRecordDTO dto = JSONObject.parseObject(body, RejectRecordDTO.class);
if(RocketMqConstant.MQ_TAG_GROUP_TOPIC_CONTENTSECURITY.equals(tag)){
//删除 邻里党群-我有话说 相关信息
topicService.rejectTopicInfo(dto);
}else if(RocketMqConstant.MQ_TAG_GROUP_TOPIC_COMMENT_CONTENTSECURITY.equals(tag)){
//删除 邻里党群-我有话说-评论 相关信息
topicCommentService.rejectTopicCommentInfo(dto);
}
log.info("EPDC-GROUP-SERVER消费消息END:{topic:{}, msgId:{}, body:{}}", RocketMqConstant.MQ_TOPIC_GROUP_CONTENTSECURITY, messageExt.getMsgId(), body);
} catch (Exception e) {
log.info("EPDC-GROUP-SERVER消费消息失败:msgId:{}", messageExt.getMsgId());
e.printStackTrace();
}
}
}

27
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/rocketmq/dto/RejectRecordDTO.java

@ -0,0 +1,27 @@
package com.elink.esua.epdc.modules.rocketmq.dto;
import lombok.Data;
import java.io.Serializable;
/**
*
* 内容审核驳回信息处理-发送MQ消息DTO
*
* @Author wangtong
* @Date 2020/7/14 14:58
*/
@Data
public class RejectRecordDTO implements Serializable {
private static final long serialVersionUID = 3032661994413974324L;
/**
* 用户ID
*/
private String userId;
/**
* 关联信息ID
*/
private String relationId;
}

8
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicDao.java

@ -134,4 +134,12 @@ public interface TopicDao extends BaseDao<TopicEntity> {
*/ */
void updateBatchPartyGroupNameByGroupId(@Param("groups") List<GroupDTO> groups); void updateBatchPartyGroupNameByGroupId(@Param("groups") List<GroupDTO> groups);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong
* @date 2020/7/15 17:43
* @params [relationId]
* @return void
*/
void rejectTopicInfo(@Param("relationId") String relationId);
} }

11
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/dao/TopicImgDao.java

@ -20,6 +20,7 @@ package com.elink.esua.epdc.modules.topic.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.topic.entity.TopicImgEntity; import com.elink.esua.epdc.modules.topic.entity.TopicImgEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 话题图片表 话题图片表 * 话题图片表 话题图片表
@ -29,5 +30,13 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface TopicImgDao extends BaseDao<TopicImgEntity> { public interface TopicImgDao extends BaseDao<TopicImgEntity> {
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong
* @date 2020/7/15 17:44
* @params [relationId]
* @return void
*/
void rejectTopicImgInfo(@Param("relationId") String relationId);
} }

10
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/TopicService.java

@ -28,6 +28,7 @@ import com.elink.esua.epdc.dto.topic.form.*;
import com.elink.esua.epdc.dto.topic.result.TopicDetailResultDTO; import com.elink.esua.epdc.dto.topic.result.TopicDetailResultDTO;
import com.elink.esua.epdc.dto.topic.result.TopicListResultDTO; import com.elink.esua.epdc.dto.topic.result.TopicListResultDTO;
import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO;
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO;
import com.elink.esua.epdc.modules.topic.entity.TopicEntity; import com.elink.esua.epdc.modules.topic.entity.TopicEntity;
import java.util.List; import java.util.List;
@ -227,4 +228,13 @@ public interface TopicService extends BaseService<TopicEntity> {
* @since 2020/3/7 12:20 * @since 2020/3/7 12:20
*/ */
void modifyPartyGroupNameByGroupId(List<GroupDTO> groups); void modifyPartyGroupNameByGroupId(List<GroupDTO> groups);
/**
* @describe: 驳回-内容违规检测-待审核信息
* @author wangtong
* @date 2020/7/15 17:40
* @params [dto]
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result rejectTopicInfo(RejectRecordDTO dto);
} }

13
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/topic/service/impl/TopicServiceImpl.java

@ -62,7 +62,9 @@ import com.elink.esua.epdc.modules.feign.EventFeignClient;
import com.elink.esua.epdc.modules.group.service.GroupService; import com.elink.esua.epdc.modules.group.service.GroupService;
import com.elink.esua.epdc.modules.group.service.UserGroupService; import com.elink.esua.epdc.modules.group.service.UserGroupService;
import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO; import com.elink.esua.epdc.modules.rocketmq.dto.OrganizationModifyDTO;
import com.elink.esua.epdc.modules.rocketmq.dto.RejectRecordDTO;
import com.elink.esua.epdc.modules.topic.dao.TopicDao; import com.elink.esua.epdc.modules.topic.dao.TopicDao;
import com.elink.esua.epdc.modules.topic.dao.TopicImgDao;
import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity; import com.elink.esua.epdc.modules.topic.entity.GroupTopicUserReadEntity;
import com.elink.esua.epdc.modules.topic.entity.TopicAuditRecordEntity; import com.elink.esua.epdc.modules.topic.entity.TopicAuditRecordEntity;
import com.elink.esua.epdc.modules.topic.entity.TopicEntity; import com.elink.esua.epdc.modules.topic.entity.TopicEntity;
@ -118,6 +120,9 @@ public class TopicServiceImpl extends BaseServiceImpl<TopicDao, TopicEntity> imp
@Autowired @Autowired
private ContentSecurityFeignClient contentSecurityFeign; private ContentSecurityFeignClient contentSecurityFeign;
@Autowired
private TopicImgDao topicImgDao;
private static final Logger logger = LoggerFactory.getLogger(TopicServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(TopicServiceImpl.class);
@Override @Override
@ -587,4 +592,12 @@ public class TopicServiceImpl extends BaseServiceImpl<TopicDao, TopicEntity> imp
baseDao.updateBatchPartyGroupNameByGroupId(groups); baseDao.updateBatchPartyGroupNameByGroupId(groups);
} }
@Override
@Transactional
public Result rejectTopicInfo(RejectRecordDTO dto) {
baseDao.rejectTopicInfo(dto.getRelationId());
topicImgDao.rejectTopicImgInfo(dto.getRelationId());
return new Result();
}
} }

1
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/application.yml

@ -112,3 +112,4 @@ rocketmq:
name-server: @rocketmq.name.server@ name-server: @rocketmq.name.server@
consumer: consumer:
group: @rocketmq.consumer.group@ group: @rocketmq.consumer.group@
contentSecurity-group: @rocketmq.consumer.contentSecurity.group@

4
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/comment/TopicCommentDao.xml

@ -273,5 +273,9 @@
t1.DEL_FLAG = '0' t1.DEL_FLAG = '0'
AND t1.COMMENT_ID IN ( SELECT t2.ID FROM epdc_topic_comment t2 WHERE t2.DEL_FLAG = '0' AND t2.TOPIC_ID = #{topicId} ) AND t1.COMMENT_ID IN ( SELECT t2.ID FROM epdc_topic_comment t2 WHERE t2.DEL_FLAG = '0' AND t2.TOPIC_ID = #{topicId} )
</select> </select>
<update id="rejectTopicCommentInfo">
UPDATE epdc_topic_comment SET DEL_FLAG = 1,UPDATED_TIME=NOW()
where id=#{relationId}
</update>
</mapper> </mapper>

4
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicDao.xml

@ -310,6 +310,10 @@
UPDATE epdc_topic SET GROUP_NAME = #{group.groupName}, UPDATED_TIME = NOW() WHERE GROUP_ID = #{group.id} UPDATE epdc_topic SET GROUP_NAME = #{group.groupName}, UPDATED_TIME = NOW() WHERE GROUP_ID = #{group.id}
</foreach> </foreach>
</update> </update>
<update id="rejectTopicInfo">
UPDATE epdc_topic SET DEL_FLAG = 1,UPDATED_TIME=NOW()
where id=#{relationId}
</update>
</mapper> </mapper>

11
esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/topic/TopicImgDao.xml

@ -0,0 +1,11 @@
<?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.dao.TopicImgDao">
<update id="rejectTopicImgInfo">
UPDATE epdc_topic_img SET DEL_FLAG = 1,UPDATED_TIME=NOW()
where REFERENCE_ID=#{relationId}
</update>
</mapper>
Loading…
Cancel
Save