MQ
This commit is contained in:
@@ -119,6 +119,12 @@ public class RabbitConfig {
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------ 申请短信模板队列
|
//------------------------------------------------------ 申请短信模板队列
|
||||||
|
/**
|
||||||
|
* 1,2,applySmsTemp 模版审核
|
||||||
|
* 1,2,sendMarkSms 发送营销短信
|
||||||
|
* 1,2,sendWechatTemp 发送微信模版消息
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public Queue applySmsTemplateQueue() {
|
public Queue applySmsTemplateQueue() {
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, true);
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, true);
|
||||||
@@ -128,26 +134,6 @@ public class RabbitConfig {
|
|||||||
return BindingBuilder.bind(applySmsTemplateQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE);
|
return BindingBuilder.bind(applySmsTemplateQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------ 发送微信模板队列
|
|
||||||
@Bean
|
|
||||||
public Queue sendWechatTemplateQueue() {
|
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.SEND_WECHAT_TEMPLATE_QUEUE, true);
|
|
||||||
}
|
|
||||||
@Bean
|
|
||||||
public Binding bindingSendWechatTemplateExchange(Queue sendWechatTemplateQueue, DirectExchange exchange) {
|
|
||||||
return BindingBuilder.bind(sendWechatTemplateQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.SEND_WECHAT_TEMPLATE_QUEUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------ 发送营销短信队列
|
|
||||||
@Bean
|
|
||||||
public Queue sendMarketSmsQueue() {
|
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.SEND_MARKET_SMS_QUEUE, true);
|
|
||||||
}
|
|
||||||
@Bean
|
|
||||||
public Binding bindingSendMarketSmsExchange(Queue sendMarketSmsQueue, DirectExchange exchange) {
|
|
||||||
return BindingBuilder.bind(sendMarketSmsQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.SEND_MARKET_SMS_QUEUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------ 生日礼品短信队列
|
//------------------------------------------------------ 生日礼品短信队列
|
||||||
@Bean
|
@Bean
|
||||||
public Queue birthdayGiftSmsQueue() {
|
public Queue birthdayGiftSmsQueue() {
|
||||||
|
|||||||
@@ -20,17 +20,12 @@ public interface RabbitConstants {
|
|||||||
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请短信模板队列
|
* 1,2,applySmsTemp 模版审核
|
||||||
|
* 1,2,sendMarkSms 发送营销短信
|
||||||
|
* 1,2,sendWechatTemp 发送微信模版消息
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public static final String APPLY_SMS_TEMPLATE_QUEUE = "apply.sms.temp";
|
public static final String APPLY_SMS_TEMPLATE_QUEUE = "apply.sms.temp";
|
||||||
/**
|
|
||||||
* 发送微信模板队列
|
|
||||||
*/
|
|
||||||
public static final String SEND_WECHAT_TEMPLATE_QUEUE = "send.wechat.temp";
|
|
||||||
/**
|
|
||||||
* 发送营销短信队列
|
|
||||||
*/
|
|
||||||
public static final String SEND_MARKET_SMS_QUEUE = "send.mark.sms";
|
|
||||||
/**
|
/**
|
||||||
* 生日礼品短信队列
|
* 生日礼品短信队列
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -102,30 +102,14 @@ public class RabbitPublisher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请短信模板消息
|
* 1,2,applySmsTemp 模版审核 shop_id,sms_shop_template.id,applySmsTemp
|
||||||
*
|
* 1,2,sendMarkSms 发送营销短信 shop_id,sms_push_event.id,sendMarkSms
|
||||||
* @param param 申请短信模板请求 shop_id,sms_shop_template.id
|
* 1,2,sendWechatTemp 发送微信模版消息 ?
|
||||||
|
* @param param 店铺Id,主键Id
|
||||||
|
* @param type applySmsTemp,sendMarkSms,sendWechatTemp
|
||||||
*/
|
*/
|
||||||
public void sendApplySmsTemplateMsg(String param) {
|
public void sendApplySmsMsg(String param, String type) {
|
||||||
sendMsg(RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, param);
|
sendMsg(RabbitConstants.Queue.APPLY_SMS_TEMPLATE_QUEUE, param + "," + type);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送微信模板消息
|
|
||||||
*
|
|
||||||
* @param param 发送微信模板请求 shop_id,sms_push_event.id
|
|
||||||
*/
|
|
||||||
public void sendWechatTemplateMsg(String param) {
|
|
||||||
sendMsg(RabbitConstants.Queue.SEND_WECHAT_TEMPLATE_QUEUE, param);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送营销短信队列
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
public void sendMarketSmsMsg(String param) {
|
|
||||||
sendMsg(RabbitConstants.Queue.SEND_MARKET_SMS_QUEUE, param);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
package com.czg.service.market.service.impl;
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.czg.BaseQueryParam;
|
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.dto.ShopCouponDTO;
|
|
||||||
import com.czg.market.dto.SmsPushEventDTO;
|
import com.czg.market.dto.SmsPushEventDTO;
|
||||||
import com.czg.market.entity.ShopCoupon;
|
import com.czg.market.entity.SmsPushEvent;
|
||||||
import com.czg.market.entity.SmsPushEventUser;
|
import com.czg.market.entity.SmsPushEventUser;
|
||||||
|
import com.czg.market.service.SmsPushEventService;
|
||||||
|
import com.czg.service.market.mapper.SmsPushEventMapper;
|
||||||
import com.czg.service.market.mapper.SmsPushEventUserMapper;
|
import com.czg.service.market.mapper.SmsPushEventUserMapper;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.PageUtil;
|
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.market.entity.SmsPushEvent;
|
|
||||||
import com.czg.market.service.SmsPushEventService;
|
|
||||||
import com.czg.service.market.mapper.SmsPushEventMapper;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -81,8 +77,8 @@ public class SmsPushEventServiceImpl extends ServiceImpl<SmsPushEventMapper, Sms
|
|||||||
eventUser.setEventId(pushEvent.getId());
|
eventUser.setEventId(pushEvent.getId());
|
||||||
eventUserMapper.insert(eventUser);
|
eventUserMapper.insert(eventUser);
|
||||||
}
|
}
|
||||||
// 推送消息 进行 阿里模板申请
|
// 推送消息 进行 消息发送
|
||||||
rabbitPublisher.sendMarketSmsMsg(pushEvent.getShopId() + "," + pushEvent.getId());
|
rabbitPublisher.sendApplySmsMsg(pushEvent.getShopId() + "," + pushEvent.getId(), "sendMarkSms");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,19 +6,17 @@ import com.czg.account.service.ShopInfoService;
|
|||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.market.dto.SmsShopTemplateDTO;
|
import com.czg.market.dto.SmsShopTemplateDTO;
|
||||||
import com.czg.market.dto.SmsTemplateQueryDTO;
|
import com.czg.market.dto.SmsTemplateQueryDTO;
|
||||||
import com.czg.market.entity.ShopCoupon;
|
import com.czg.market.entity.SmsShopTemplate;
|
||||||
|
import com.czg.market.service.SmsShopTemplateService;
|
||||||
|
import com.czg.service.market.mapper.SmsShopTemplateMapper;
|
||||||
import com.czg.utils.CzgStrUtils;
|
import com.czg.utils.CzgStrUtils;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.market.entity.SmsShopTemplate;
|
|
||||||
import com.czg.market.service.SmsShopTemplateService;
|
|
||||||
import com.czg.service.market.mapper.SmsShopTemplateMapper;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,6 +122,6 @@ public class SmsShopTemplateServiceImpl extends ServiceImpl<SmsShopTemplateMappe
|
|||||||
|
|
||||||
private void sendApplyMsg(Long shopId, Long templateId) {
|
private void sendApplyMsg(Long shopId, Long templateId) {
|
||||||
// 推送消息 进行 阿里模板申请
|
// 推送消息 进行 阿里模板申请
|
||||||
rabbitPublisher.sendApplySmsTemplateMsg(shopId + "," + templateId);
|
rabbitPublisher.sendApplySmsMsg(shopId + "," + templateId, "applySmsTemp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user