| | |
| | | |
| | | import com.sandu.common.execption.BusinessException; |
| | | 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.PlayerPage; |
| | | 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.VnnoxAPIUtil; |
| | | import com.sandu.ximon.admin.utils.VnnoxProgramAPIUtil; |
| | | import com.sandu.ximon.admin.utils.request.VnnoxScreenStatusType; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerListResponse; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxPlayerResponse; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.net.URISyntaxException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private RedisUtils redisUtils; |
| | | // @Autowired |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | // @Autowired |
| | | private VnnoxProgramAPIUtil vnnoxProgramAPIUtil; |
| | | |
| | | /** |
| | | * 设备校验注册 |
| | |
| | | |
| | | /** |
| | | * 同步播放 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | public VnnoxResult syncPlay(List<String> playerList,Integer option) { |
| | | return vnnoxAPIUtil.syncPlay(playerList,option); |
| | | public VnnoxResult syncPlay(List<String> playerList, Integer option) { |
| | | return vnnoxAPIUtil.syncPlay(playerList, option); |
| | | } |
| | | |
| | | /** |
| | | * 对时 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | public VnnoxResult ntpSync(List<String> playerList,boolean enable) { |
| | | return vnnoxAPIUtil.ntpSync(playerList,enable); |
| | | public VnnoxResult ntpSync(List<String> playerList, boolean enable) { |
| | | return vnnoxAPIUtil.ntpSync(playerList, enable); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public VnnoxResult publishWaterData(String playerId, A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage poleSensorEntity) { |
| | | List<String> playerIds = new ArrayList<>(); |
| | | playerIds.add(playerId); |
| | | AirDataProgram playerProgram = new AirDataProgram(); |
| | | playerProgram.setPlayerIds(playerIds); |
| | | PlayerPage playerPage = new PlayerPage(); |
| | | playerPage.setName("AirData page"); |
| | | List<PlayerWidget> widgetList = generateWaterAndSensorWidget(poleSensorEntity); |
| | | playerPage.setWidgets(widgetList); |
| | | List<PlayerPage> list = new ArrayList<>(); |
| | | list.add(playerPage); |
| | | playerProgram.setPages(list); |
| | | playerProgram.setNoticeUrl(VnnoxConstant.NOTIFY_URL); |
| | | |
| | | return vnnoxProgramAPIUtil.normalProgram(playerProgram).getData(); |
| | | } |
| | | |
| | | |
| | | private List<PlayerWidget> generateWaterAndSensorWidget(A5AtmosphereHeartbeatReportInnerFrame.HeartBeatDataPackage poleSensorEntity) { |
| | | List widgetList = new ArrayList<>(); |
| | | List<String> list = new ArrayList<>(); |
| | | // if (Objects.nonNull(waterDataEntity)) { |
| | | // list.add("水质环境监测实时数据:"); |
| | | // list.add("ph:"+waterDataEntity.getPh()); |
| | | // list.add("溶解氧:"+waterDataEntity.getDoData() + "(mg/L)"); |
| | | // list.add("电导率:"+waterDataEntity.getEc() + "(10^(-6)S)"); |
| | | // list.add("浊度:"+waterDataEntity.getNtu() + "NTU"); |
| | | // } |
| | | if (Objects.nonNull(poleSensorEntity)) { |
| | | // list.add("环境监测:"); |
| | | list.add("温度:" + poleSensorEntity.getTemperature() + "°"); |
| | | list.add("湿度:" + poleSensorEntity.getHumidity() + "%"); |
| | | list.add("pm25:" + poleSensorEntity.getPm25() + "μg/m³"); |
| | | list.add("pm10:" + poleSensorEntity.getPm10() + "μg/m³"); |
| | | list.add("甲醛:" + poleSensorEntity.getEch2o() + "μg/m³"); |
| | | list.add("CO2:" + poleSensorEntity.getCo2() + "ppm"); |
| | | } |
| | | |
| | | widgetList.add(new PlayerWidget().generateScrollUpTextWidget( |
| | | "water", |
| | | 1, |
| | | 100000L, |
| | | list, |
| | | "#FFFFFF", |
| | | 15, |
| | | new PlayerLayout("0%", "5%", "100%", "100%") |
| | | )); |
| | | |
| | | return widgetList; |
| | | } |
| | | |
| | | } |