提交 eef9c75a authored 作者: linzhenjie's avatar linzhenjie

添加设备设置5分钟有效

上级 0f6cba5f
...@@ -110,6 +110,7 @@ public class MqConsumer { ...@@ -110,6 +110,7 @@ public class MqConsumer {
// if ("08".equals(datas.get("cmd"))) { // if ("08".equals(datas.get("cmd"))) {
//新增设备 //新增设备
if (redisUtils.hasKey("device:save:" + datas.get("mac"))) { if (redisUtils.hasKey("device:save:" + datas.get("mac"))) {
logger.debug("添加设备:{}", datas.get("mac"));
String[] userId = redisUtils.get("device:save:" + datas.get("mac")).split("-"); String[] userId = redisUtils.get("device:save:" + datas.get("mac")).split("-");
ShProductEntity product = shProductService.getOne(new QueryWrapper<ShProductEntity>().eq("device_flag", datas.get("receiveId").substring(0, 3)).last("LIMIT 1")); ShProductEntity product = shProductService.getOne(new QueryWrapper<ShProductEntity>().eq("device_flag", datas.get("receiveId").substring(0, 3)).last("LIMIT 1"));
ShDeviceEntity shDevice = new ShDeviceEntity(); ShDeviceEntity shDevice = new ShDeviceEntity();
......
...@@ -55,8 +55,8 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe ...@@ -55,8 +55,8 @@ public class OtherShDeviceServiceImpl extends ServiceImpl<OtherShDeviceDao, ShDe
if (count > 0) { if (count > 0) {
return R.error("该设备已添加"); return R.error("该设备已添加");
} }
//保存MAC地址 //保存MAC地址 5分钟失效
redisUtils.set("device:save:" + mac, user.getId() + "-" + familyId); redisUtils.set("device:save:" + mac, user.getId() + "-" + familyId, 300);
return R.ok(); return R.ok();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论