14 changed files with 172 additions and 1 deletions
@ -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消息 |
||||
|
* |
||||
|
* @Author:wangtong |
||||
|
* @Date:2020/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(); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -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; |
||||
|
} |
@ -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…
Reference in new issue