| | |
| | | Boolean hasKey = redisService.hasKey(LightKey.REPORT_MAC.key(deviceName)); |
| | | if (!hasKey) { |
| | | int count = count(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, deviceName)); |
| | | log.info("redis查不到路灯数据{}={}", count, deviceName); |
| | | log.info("redis查不到路灯数据 数量:{}={}", count, deviceName); |
| | | // 当前路灯表没有录入设备吗 |
| | | if (count == 0) { |
| | | Light light = new Light(); |
| | |
| | | light.setLightPercent(heartBeatDataPackage.getLightPercent()); |
| | | light.setLight2Percent(heartBeatDataPackage.getLight2Percent()); |
| | | save(light); |
| | | log.info("新增路灯"); |
| | | } |
| | | redisService.set(LightKey.REPORT_MAC.key(deviceName), 1, LightKey.REPORT_MAC.expireSeconds()); |
| | | log.info("新增路灯"); |
| | | } else { |
| | | Light light = new Light(); |
| | | light.setLightPercent(heartBeatDataPackage.getLightPercent()); |
| | | light.setLight2Percent(heartBeatDataPackage.getLight2Percent()); |
| | | update(light, Wrappers.lambdaUpdate(Light.class).eq(Light::getDeviceCode, deviceName)); |
| | | log.info("更新路灯亮度"); |
| | | boolean update = update(light, Wrappers.lambdaUpdate(Light.class).eq(Light::getDeviceCode, deviceName)); |
| | | log.info("更新路灯亮度 {}", update); |
| | | } |
| | | } |
| | | |
| | |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | |
| | | //排序字段 |
| | | String orderByResult = OrderByEnums.LIGHT_POLE_NAME.getCode(); |
| | | String orderByResult = "light_id"; |
| | | //正序、倒叙 |
| | | String orderBySeq = OrderByEnums.ASC.getCode(); |
| | | if (order != null) { |