Commit fbf257e5 by 谢海旭

更新旅程客户阶段接口增加发mq事件上报cdp

1 parent 73643ab9
......@@ -35,8 +35,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
public void topicSend(String exchange,String routingKey,Object content) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
log.info("消息id:{},推送数据到mq:{}",correlationId, JSON.toJSONString(content));
rabbitTemplate.convertAndSend(exchange,routingKey, content,correlationId);
String contentJson = JSON.toJSONString(content);
log.info("消息id:{},推送数据到mq:{}",correlationId, contentJson);
rabbitTemplate.convertAndSend(exchange,routingKey, contentJson,correlationId);
}
/**
......@@ -47,8 +48,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
public void topicSend(String routingKey,Object content) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
log.info("消息id:{},推送数据到mq:{}",correlationId, JSON.toJSONString(content));
rabbitTemplate.convertAndSend(RabbitMQConstants.TOPIC_EXCHANGE_PLATFORM_PROCESS,routingKey, content,correlationId);
String contentJson = JSON.toJSONString(content);
log.info("消息id:{},推送数据到mq:{}",correlationId, contentJson);
rabbitTemplate.convertAndSend(RabbitMQConstants.TOPIC_EXCHANGE_PLATFORM_PROCESS,routingKey, contentJson,correlationId);
}
/**
......
......@@ -2,6 +2,7 @@ package cn.com.glsx.process.modules.rabbitmq;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -9,13 +10,34 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitConfig {
public static final String DATA_REPORT_QUEUE_NAME = "dataReport_queue";
public static final String DATA_REPORT_EXCHANGE_NAME = "dataReport_exchange";
public static final String DATA_REPORT_TOPIC = "dataReport.#";
//声明topic交换机
@Bean
public TopicExchange topicExchange(){
public TopicExchange topicExchange() {
//durable(true) 持久化,mq重启之后交换机还在
return ExchangeBuilder.topicExchange(RabbitMQConstants.TOPIC_EXCHANGE_PLATFORM_PROCESS).durable(true).build();
}
@Bean(name = "dataReportQueue")
public Queue dataReportQueue() {
return new Queue(DATA_REPORT_QUEUE_NAME, true);
}
@Bean(name = "dataReportTopicExchange")
public TopicExchange dataReportTopicExchange() {
return new TopicExchange(DATA_REPORT_EXCHANGE_NAME);
}
@Bean
public Binding bindingDataReport(@Qualifier("dataReportQueue") Queue dataReportQueue,
@Qualifier("dataReportTopicExchange") TopicExchange dataReportTopicExchange) {
return BindingBuilder.bind(dataReportQueue).to(dataReportTopicExchange).with(DATA_REPORT_TOPIC);
}
}
......@@ -15,6 +15,7 @@ import cn.com.glsx.process.modules.mapper.*;
import cn.com.glsx.process.modules.model.*;
import cn.com.glsx.process.modules.model.enums.SopInstStatusEnum;
import cn.com.glsx.process.modules.rabbitmq.MsgProducer;
import cn.com.glsx.process.modules.rabbitmq.RabbitConfig;
import cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants;
import cn.com.glsx.process.util.FileUploadServerData;
import cn.com.glsx.process.util.FileUploadUtil;
......@@ -34,6 +35,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.ByteArrayOutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -393,13 +395,41 @@ public class SopInstService {
* @return
*/
public Result<Boolean> stageUpdate(SopJourneyStageUpdate body) {
String orgId = body.getOrgId();
String sopJourneyId = body.getSopJourneyId();
String oneId = body.getOneId();
Result<CustomerSopJourneyDetailDTO> detail = customerSopJourneyFeignClientT.detail(orgId, sopJourneyId, oneId);
if (!SysConstants.ResultStatus.success.getCode().equals(detail.getCode())) {
throw ResultException.create(SystemMessage.ARGS_ERROR.getCode(), "查询客户信息异常");
}
CustomerSopJourneyDetailDTO customerDetail = detail.getData();
if (Objects.isNull(customerDetail)) {
throw ResultException.create(SystemMessage.ARGS_ERROR.getCode(), "客户信息不存在");
}
ModifySopJourneyStageRequest request = new ModifySopJourneyStageRequest();
request.setOrgId(body.getOrgId());
request.setSopJourneyId(body.getSopJourneyId());
request.setOneIds(Lists.newArrayList(body.getOneId()));
request.setOrgId(orgId);
request.setSopJourneyId(sopJourneyId);
request.setOneIds(Lists.newArrayList(oneId));
request.setSopJourneyStage(body.getSopJourneyStage());
request.setOprBy(body.getOprBy());
return customerSopJourneyFeignClientT.modifyStage(request);
Result<Boolean> booleanResult = customerSopJourneyFeignClientT.modifyStage(request);
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> mqMap = new HashMap<>();
mqMap.put("org_id", orgId);
mqMap.put("add_way", "SOP");
mqMap.put("customer_phone", customerDetail.getCustomerPhone());
mqMap.put("event_time", sdf.format(now));
mqMap.put("event_type", "MODIFY_SOP_JOURNEY_STAGE");
mqMap.put("platform", "WebPage");
mqMap.put("extra", body);
msgProducer.topicSend(RabbitConfig.DATA_REPORT_EXCHANGE_NAME, "dataReport.customer.event", Lists.newArrayList(mqMap));
return booleanResult;
}
public FileUploadServerData customersExport(SopCustomerSearch search) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!