Compare commits
2 Commits
53c2193cd7
...
a19770bfab
Author | SHA1 | Date |
---|---|---|
|
a19770bfab | 3 months ago |
|
d9cd915f73 | 3 months ago |
@ -0,0 +1,63 @@
|
|||||||
|
package com.mashibing.strategy.utils;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.constant.RabbitMQConstant;
|
||||||
|
import com.mashibing.common.pojo.StandardReport;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: StrategyCheckFailedUtil
|
||||||
|
* @Description: 策略校验失败后发送消息到mq工具类
|
||||||
|
* @date 2025/6/10 16:17
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class StrategyCheckFailedUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送推送短信状态报告消息
|
||||||
|
*
|
||||||
|
* @param submit 短信提交对象
|
||||||
|
* @param strategyName 策略名称
|
||||||
|
*/
|
||||||
|
public void smsPushReport(StandardSubmit submit, String strategyName) {
|
||||||
|
Integer isCallback = cacheClient.hgetInteger(CacheConstant.CLIENT_BUSINESS + submit.getApikey(), CacheConstant.IS_CALLBACK);
|
||||||
|
if (isCallback != null && isCallback == 1) {
|
||||||
|
String callbackUrl = cacheClient.hgetString(CacheConstant.CLIENT_BUSINESS + submit.getApikey(), CacheConstant.CALLBACK_URL);
|
||||||
|
if (StringUtils.isNotBlank(callbackUrl)) {
|
||||||
|
StandardReport report = new StandardReport();
|
||||||
|
BeanUtils.copyProperties(submit, report);
|
||||||
|
report.setIsCallback(isCallback);
|
||||||
|
report.setCallbackUrl(callbackUrl);
|
||||||
|
rabbitTemplate.convertAndSend(RabbitMQConstant.SMS_PUSH_REPORT, report);
|
||||||
|
log.info("【策略模块-{}校验】发送短信状态报告消息到{}队列,消息:{}", strategyName, RabbitMQConstant.SMS_PUSH_REPORT, report);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送写日志消息
|
||||||
|
*
|
||||||
|
* @param submit 短信提交对象
|
||||||
|
* @param strategyName 策略名称
|
||||||
|
*/
|
||||||
|
public void smsSendLog(StandardSubmit submit, String strategyName) {
|
||||||
|
rabbitTemplate.convertAndSend(RabbitMQConstant.SMS_WRITE_LOG, submit);
|
||||||
|
log.error("【策略模块-{}校验】发送写日志消息到{}队列,消息:{}", strategyName, RabbitMQConstant.SMS_WRITE_LOG, submit);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue