Commit 6fb7aa58 authored by 赵啸非's avatar 赵啸非

分组更新设备

parent 7766e11b
......@@ -10,7 +10,6 @@ import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.sms.SmsSetPdu;
import com.mortals.xhx.feign.sms.ISmsSetFeign;
......@@ -40,6 +39,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.mortals.xhx.common.key.RedisKey.KEY_DEVICE_ONLINE_CACHE;
/**
* 离线通知
*
......@@ -74,11 +75,11 @@ public class CustomerKeyExpirationListener implements MessageListener {
public void onMessage(Message message, byte[] bytes) {
String key = message.toString();
//解决分布式系统 重复获取广播消息
boolean setnx = cacheService.setnx(key, 1, 5);
if (setnx) {
String subStr = StrUtil.removePrefix(key, RedisKey.KEY_DEVICE_ONLINE_CACHE);
String subStr = StrUtil.removePrefix(key, KEY_DEVICE_ONLINE_CACHE);
if (!subStr.equals(key)) {
boolean setnx = cacheService.setnx(subStr+"#lock", 1, 5);
if (setnx) {
DeviceEntity deviceEntity = deviceService.getExtCache(subStr);
if (!ObjectUtils.isEmpty(deviceEntity)) {
if (deviceEntity.getDeviceStatus() == DeviceStatusEnum.在线.getValue()) {
......
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