diff --git a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java index 3b6a57f..ee33476 100644 --- a/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java +++ b/ics-web/src/main/java/com/ics/controller/mobile/meeting/ApiEquipmentController.java @@ -21,6 +21,7 @@ import com.ics.common.utils.IpUtils; import com.ics.common.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import org.wf.jwtp.annotation.Ignore; import org.wf.jwtp.annotation.RequiresPermissions; @@ -49,6 +50,11 @@ public class ApiEquipmentController extends BaseController { @Autowired private IVisitorPersonService visitorPersonService; + @Autowired + private RedisTemplate redisTemplate; + + String smallWxAccessTokenKey = "nantong-"; + //根据用户id查询对应的设备, 楼层分割,房间,设备信息, @RequiresPermissions("member:center:view") @GetMapping("/getEquipmentByUserId/{userId}") @@ -169,4 +175,37 @@ public class ApiEquipmentController extends BaseController { return R.ok("开门成功"); } + + /** + * 扫描二维码开门 用户id 和设备id + * + */ + @Ignore + @GetMapping("/scanDoor") + public R scanDoor(String ip ){ + // todo 开门 + // todo 获取ip后,key为ip,value为设备id 存入redis + // 所有设备的ip都存入redis 里面 + System.out.println(ip); + return R.ok("开门成功"); + } + + /** + * 开门接口,南通 + */ + @Ignore + @GetMapping("/isOpenDoor") + public R isOpenDoor(String ip ){ + // 根据ip 去redis读取数据 + String smallWxAccessToken = redisTemplate.opsForValue().get(smallWxAccessTokenKey+ip); + if (StringUtils.isNotBlank(smallWxAccessToken)){ + Boolean delete = redisTemplate.delete(smallWxAccessTokenKey + ip); + if (delete){ + R.error("删除redis失败"); + } + return R.ok("开门成功"); + }else { + return R.error("开门失败"); + } + } }