| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 用户拥有的路灯(用于首页数据统计) |
| | | * |
| | | * @return |
| | | */ |
| | | public List<LightBo> listLightOnHome() { |
| | | List<LightBo> listLight; |
| | | if (SecurityUtils.getClientId() != null) { |
| | | listLight = baseMapper.listLight(SecurityUtils.getUserId(), null); |
| | | } else { |
| | | listLight = baseMapper.listLight(null, null); |
| | | } |
| | | return listLight; |
| | | } |
| | | |
| | | /** |
| | | * 获取用户所有的设备码 |
| | | */ |
| | | public CommonPage<String> listDeviceCode(int pageNo, int pageSize, String keyword, String deviceCode) { |
| | |
| | | lights.forEach(light -> { |
| | | light.setPower1(lightPowerSettingParam.getPower1()); |
| | | light.setPower2(lightPowerSettingParam.getPower2()); |
| | | //存在非0功率 即为存在该灯头 |
| | | if (lightPowerSettingParam.getPower1() != null || lightPowerSettingParam.getPower1() != 0) { |
| | | light.setLight1(1); |
| | | } else if (lightPowerSettingParam.getPower1() == 0) { |
| | | //手动设置灯头功率为0 即不存在该灯头 |
| | | light.setLight1(0); |
| | | } else { |
| | | light.setLight1(0); |
| | | } |
| | | //存在非0功率 即为存在该灯头 |
| | | if (lightPowerSettingParam.getPower2() != null || lightPowerSettingParam.getPower2() != 0) { |
| | | light.setLight2(1); |
| | | } else if (lightPowerSettingParam.getPower2() == 0) { |
| | | //手动设置灯头功率为0 即不存在该灯头 |
| | | light.setLight2(0); |
| | | } else { |
| | | light.setLight2(0); |
| | | } |
| | | light.setLightCount(lightPowerSettingParam.getLightCount()); |
| | | }); |
| | | return updateBatchById(lights); |