| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.config.VnnoxConstant; |
| | | import com.sandu.ximon.admin.dto.nova.AirDataProgram; |
| | | import com.sandu.ximon.admin.dto.nova.PlayerLayout; |
| | |
| | | import com.sandu.ximon.admin.dto.nova.PlayerWidget; |
| | | import com.sandu.ximon.admin.manager.iot.frame.inner.report.A5AtmosphereHeartbeatReportInnerFrame; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import com.sandu.ximon.admin.utils.VnnoxProgramAPIUtil; |
| | | import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType; |
| | |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedPlayerInfoEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @AllArgsConstructor |
| | | public class VnnoxService { |
| | | |
| | | // @Autowired |
| | | |
| | | private VnnoxAPIUtil vnnoxAPIUtil; |
| | | // @Autowired |
| | | |
| | | private RedisUtils redisUtils; |
| | | // @Autowired |
| | | |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | // @Autowired |
| | | |
| | | private VnnoxProgramAPIUtil vnnoxProgramAPIUtil; |
| | | |
| | | /** |
| | |
| | | type = VnnoxScreenStatusType.OPEN; |
| | | } |
| | | |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenStatus( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | type |
| | | ); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.screenStatus(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), type); |
| | | // 根据屏幕状态调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_SCREEN_STATUS + playerId, screenStatus, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | |
| | | } |
| | | |
| | | public VnnoxResult volChange(List<LedPlayerEntity> playerList, Integer vol) { |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | vol |
| | | ); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.volChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), vol); |
| | | // 根据音量调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_VOL + playerId, vol, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | |
| | | } |
| | | |
| | | public VnnoxResult brightnessChange(List<LedPlayerEntity> playerList, Integer brightness) { |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.brightnessChange( |
| | | playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), |
| | | brightness |
| | | ); |
| | | VnnoxResult vnnoxResult = vnnoxAPIUtil.brightnessChange(playerList.stream().map(item -> item.getPlayerId()).collect(Collectors.toList()), brightness); |
| | | // 根据亮度调整REDIS标识位 |
| | | for (String playerId : vnnoxResult.getSuccess()) { |
| | | redisUtils.set(VnnoxConstant.REDIS_BRIGHTNESS + playerId, brightness, VnnoxConstant.REDIS_MAX_SAVE_TIME); |
| | |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到该设备"); |
| | | } |
| | | boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getSn(), PoleBindingEnums.VONNOX); |
| | | if (!belong) { |
| | | throw new BusinessException("该设备不属于您,不能修改设备信息"); |
| | | } |
| | | LedPlayerEntity led = new LedPlayerEntity(); |
| | | led.setId(id); |
| | | led.setName(name); |
| | | /** |
| | | * 诺瓦设备编辑 日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(1); |
| | | listCode.add(led.getSn()); |
| | | String content = "{ 设备id:" + led.getId() + "设备code:" + led.getSn() + "诺瓦playId:" + led.getPlayerId() + "诺瓦设备原名:" + byId.getName() + "诺瓦设备更改后的名称:" + led.getName() + "}"; |
| | | |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "诺瓦设备编辑", content); |
| | | /** |
| | | * 诺瓦设备编辑 日志记录结束 |
| | | */ |
| | | return ledPlayerEntityService.updateById(led); |
| | | } |
| | | |
| | |
| | | playerProgram.setPages(list); |
| | | playerProgram.setNoticeUrl(VnnoxConstant.NOTIFY_URL); |
| | | |
| | | |
| | | /** |
| | | * 诺瓦推送大气数据 日志记录开始 |
| | | //// */ |
| | | // String content = "{诺瓦playerId:" + playerId + ",节目内容:" + JSON.toJSONString(playerProgram) + " }"; |
| | | // StoreOperationRecordsUtils.storeOperationData(null, null, "大气数据推送到诺瓦", content); |
| | | /** |
| | | * 诺瓦推送大气数据 日志记录结束 |
| | | */ |
| | | |
| | | return vnnoxProgramAPIUtil.normalProgram(playerProgram).getData(); |
| | | } |
| | | |
| | |
| | | list.add("CO2:" + poleSensorEntity.getCo2() + "ppm"); |
| | | } |
| | | |
| | | widgetList.add(new PlayerWidget().generateScrollUpTextWidget( |
| | | "water", |
| | | 1, |
| | | 100000L, |
| | | list, |
| | | "#FFFFFF", |
| | | 15, |
| | | new PlayerLayout("0%", "5%", "100%", "100%") |
| | | )); |
| | | widgetList.add(new PlayerWidget().generateScrollUpTextWidget("weather", 1, 100000L, list, "#FFFFFF", 15, new PlayerLayout("0%", "5%", "100%", "100%"))); |
| | | |
| | | return widgetList; |
| | | } |