Commit ea136a42 by 吕明尚

修改自动发送权益会员过期短信自动任务

parent 6de6e84a
......@@ -476,6 +476,9 @@ public class RedisTask {
});
}
/**
* 自动发送权益会员过期短信
*/
public void AutoEquityMembersSms() {
Set<String> keys = redisTemplate.keys(ReceiptRdeisEnum.EQUITY_MEMBERS_TIME + "*");
if (keys.size() == 0) {
......@@ -487,7 +490,7 @@ public class RedisTask {
Date expirationTime = jsonObject.getDate("expirationTime");
Long consumerId = jsonObject.getLong("consumerId");
//判断当前的日期是否在第3天和第2天中
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000 / 60 / 60;
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000 / 60;
if (THREE_DAY < expire && expire < FOUR_DAY) {
SConsumer sConsumer = sConsumerService.getById(consumerId);
logger.debug("手机号为:{}的用户年度权益会员将在3天后失效", sConsumer.getPhone());
......@@ -530,6 +533,9 @@ public class RedisTask {
});
}
/**
* 会员等级滚动降级
*/
public void AutoProgressLog() {
//查询1年之前的数据
List<MemberProgressLog> list = memberProgressLogService.list(new LambdaQueryWrapper<MemberProgressLog>()
......@@ -559,32 +565,31 @@ public class RedisTask {
sum[0] = sum[0].subtract(log.getVariableProgress());
}
});
if (consumerMember.getMembershipProgress().compareTo(sum[0]) < 0) {
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setMembershipLevel(0L);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
} else
//判断会员进度是否大于扣除进度
if (consumerMember.getMembershipProgress().compareTo(sum[0]) > 0) {
if (consumerMember.getMembershipProgress().compareTo(sum[0]) >= 0) {
//会员进度减去扣除进度
BigDecimal subtract = consumerMember.getMembershipProgress().subtract(sum[0]);
consumerMember.setMembershipProgress(subtract);
if (subtract.compareTo(BigDecimal.valueOf(memberConfig.getLimitRequirements())) < 0) {
//等级降一级
if (consumerMember.getMembershipLevel() > 0L) {
consumerMember.setMembershipLevel(memberConfig.getMembershipLevel() - 1);
consumerMember.setMembershipLevel(consumerMember.getMembershipLevel() - 1);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
}
}
} else if (consumerMember.getMembershipProgress().compareTo(sum[0]) == 0) {
consumerMember.setMembershipProgress(BigDecimal.ZERO);
consumerMember.setMembershipLevel(0L);
MemberConfig memberConfigServiceOne = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>()
.eq(MemberConfig::getMemberType, consumerMember.getMemberType())
.eq(MemberConfig::getMembershipLevel, consumerMember.getMembershipLevel())
);
consumerMember.setMemberConfigId(memberConfigServiceOne.getId());
}
consumerMemberService.updateConsumerMember(consumerMember);
}
......
......@@ -186,7 +186,7 @@ public class MqttConfig {
@EventListener(MqttMessageSentEvent.class)
public void mqttMessageSentEvent(MqttMessageSentEvent event) {
log.info("mqttMessageSentEvent发送信息: date={}, info={}", new Date(), event.toString());
log.debug("mqttMessageSentEvent发送信息: date={}, info={}", new Date(), event.toString());
}
// @EventListener(MqttMessageDeliveredEvent.class)
......@@ -196,7 +196,7 @@ public class MqttConfig {
@EventListener(MqttSubscribedEvent.class)
public void mqttSubscribedEvent(MqttSubscribedEvent event) {
log.info("mqttSubscribedEvent订阅成功信息: date={}, info={}", new Date(), event.toString());
log.debug("mqttSubscribedEvent订阅成功信息: date={}, info={}", new Date(), event.toString());
}
......
......@@ -36,7 +36,7 @@ public class MqttMessageHandler implements MessageHandler {
String topic = message.getHeaders().get(MqttHeaders.RECEIVED_TOPIC).toString();
boolean exist = topic.startsWith("ydlink");
if (!exist) {
log.info("当前topic:{}未注册!不做处理!",topic);
log.debug("当前topic:{}未注册!不做处理!", topic);
return;
}
//MqttTopicHandler topicHandler = SpringUtil.getBean(mqttTopicEnum.getTopicHandlerBeanName(), TopicHandler.class);
......
......@@ -27,7 +27,7 @@ public class MqttTopicHandler {
*/
public void handler(Message<?> message) {
String topic = message.getHeaders().get(MqttHeaders.RECEIVED_TOPIC).toString();
log.info("topic:{}-->message received!", topic);
log.debug("topic:{}-->message received!", topic);
String payload = new String((byte[]) message.getPayload());
Assert.notNull(payload, "接收到的消息为空!");
dispose(payload, topic);
......@@ -41,7 +41,7 @@ public class MqttTopicHandler {
if (!ObjectUtil.isNull(payload)){
try {
mqttxService.mqttReport(topic, payload);
log.info("来自topic:{}的消息处理完毕!", topic);
log.debug("来自topic:{}的消息处理完毕!", topic);
} catch (Exception e) {
log.error("来自topic:{}的消息处理异常!原因:{}", topic, e);
}
......
......@@ -74,7 +74,7 @@ public class MultiMqttMessageHandler extends AbstractMessageHandler implements L
//负载均衡
Random random = new Random();
MyMqttPahoMessageHandler messageHandler = (MyMqttPahoMessageHandler) mqttHandlerMap.get(random.nextInt(handlerCount));
log.info("开始处理信息:{}", message.toString());
log.debug("开始处理信息:{}", message.toString());
messageHandler.handleMessageInternal(message);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment