123
This commit is contained in:
@@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum CommonDelayTypeEnum {
|
||||
USER_FORBID(1),
|
||||
SYS_PUSH(2),
|
||||
;
|
||||
private final Integer code;
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@ import com.ruoyi.cai.manager.UserForbidManager;
|
||||
import com.ruoyi.cai.mq.CommonDelayTypeEnum;
|
||||
import com.ruoyi.cai.mq.config.CommonDelayMqConfig;
|
||||
import com.ruoyi.cai.mq.dto.CommonDelayDto;
|
||||
import com.ruoyi.cai.service.SysPushService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Component;
|
||||
public class CommonDelayMqConsumer {
|
||||
@Autowired
|
||||
private UserForbidManager userForbidManager;
|
||||
@Autowired
|
||||
private SysPushService sysPushService;
|
||||
|
||||
@RabbitListener(queues = CommonDelayMqConfig.QUEUE_NAME
|
||||
,containerFactory = "customContainerFactory")
|
||||
@@ -34,6 +38,12 @@ public class CommonDelayMqConsumer {
|
||||
log.error("检查用户封禁状态失败!需要开发确认!",e);
|
||||
}
|
||||
break;
|
||||
case SYS_PUSH:
|
||||
try {
|
||||
sysPushService.fastStart(dto.getSysPushId());
|
||||
}catch (Exception e){
|
||||
log.error("检查系统推送失败!需要开发确认!", e);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cai.mq.dto;
|
||||
|
||||
public enum CommonConsumerEnum {
|
||||
RANK,WINDOW_GIFT,WINDOW_RECHARGE
|
||||
RANK,WINDOW_GIFT,WINDOW_RECHARGE,
|
||||
SYS_PUSH
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public class CommonDelayDto {
|
||||
*/
|
||||
private Integer type;
|
||||
private Long forbidId;
|
||||
private Long sysPushId;
|
||||
|
||||
public CommonDelayTypeEnum getTypeEnum(){
|
||||
CommonDelayTypeEnum[] values = CommonDelayTypeEnum.values();
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.cai.mq.handle;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.cai.mq.dto.CommonConsumerEnum;
|
||||
import com.ruoyi.cai.mq.handle.dto.SysPushDTO;
|
||||
import com.ruoyi.cai.service.SysPushService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SysPushHandle implements IHandle{
|
||||
@Autowired
|
||||
private SysPushService sysPushService;
|
||||
|
||||
@Override
|
||||
public void run(String message) {
|
||||
try {
|
||||
SysPushDTO sysPush = JSON.parseObject(message, SysPushDTO.class);
|
||||
sysPushService.doRun(sysPush.getSysPushId());
|
||||
}catch (Exception e){
|
||||
log.error("处理推送消息失败!",e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonConsumerEnum getType() {
|
||||
return CommonConsumerEnum.SYS_PUSH;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.mq.handle.dto;
|
||||
|
||||
import com.ruoyi.cai.mq.dto.CommonConsumerEnum;
|
||||
import com.ruoyi.cai.mq.dto.CommonDTO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysPushDTO extends CommonDTO {
|
||||
private Long sysPushId;
|
||||
|
||||
public SysPushDTO() {
|
||||
this.setType(CommonConsumerEnum.SYS_PUSH);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user