添加空值过滤
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.mq.Consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.common.utils.DateUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
@@ -9,6 +10,7 @@ import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.ClassEntityService;
|
||||
import com.peanut.modules.common.service.ClassExamService;
|
||||
import com.peanut.modules.common.service.CouponHistoryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -19,6 +21,7 @@ import java.util.Map;
|
||||
|
||||
//通用延迟队列
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CommonConsumer {
|
||||
|
||||
@Autowired
|
||||
@@ -42,6 +45,7 @@ public class CommonConsumer {
|
||||
|
||||
@RabbitListener(queues = DelayQueueConfig.COMMON_QUEUE)
|
||||
public void commonConsumer(String typeAndParam) {
|
||||
try {
|
||||
//参数为 业务模块 + , + 参数
|
||||
String[] typeAndParams = typeAndParam.split(",");
|
||||
//考试周天数,根据设置的天数将班级状态从进行中设置成考试中
|
||||
@@ -64,7 +68,9 @@ public class CommonConsumer {
|
||||
//加班后24小时未买课踢出去
|
||||
if ("joinClass".equals(typeAndParams[0])){
|
||||
ClassEntity classEntity = classEntityDao.selectById(typeAndParams[1]);
|
||||
if (classEntity!=null&&"0".equals(classEntity.getState())){
|
||||
MyUserEntity user = myUserDao.selectById(typeAndParams[2]);
|
||||
if (user!=null){
|
||||
if ("0".equals(user.getVip())||"3".equals(user.getVip())){
|
||||
//不是vip查询每门课是否购买
|
||||
List<ClassCourse> courses = classCourseDao.selectList(new LambdaQueryWrapper<ClassCourse>()
|
||||
@@ -86,6 +92,8 @@ public class CommonConsumer {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//优惠卷过期
|
||||
if ("couponExpire".equals(typeAndParams[0])){
|
||||
CouponHistory couponHistory = couponHistoryService.getById(typeAndParams[1]);
|
||||
@@ -94,8 +102,9 @@ public class CommonConsumer {
|
||||
couponHistoryService.updateById(couponHistory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error("mq通用队列消费异常",e.getMessage()+"-"+typeAndParam);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user