| | |
| | | import com.sandu.ximon.admin.utils.JsonUtil; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.LogUtils; |
| | | import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils; |
| | | import com.sandu.ximon.admin.utils.request.SubTitleSet; |
| | | import com.sandu.ximon.dao.domain.LedSFile; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | |
| | | } |
| | | |
| | | public boolean insert(ProgramPro programPro) { |
| | | programPro.getLayers().forEach( |
| | | layerPro -> { |
| | | layerPro.getSources().forEach( |
| | | sourcePro -> { |
| | | long fileId = Long.parseLong(sourcePro.getId()); |
| | | LedSFile file = xiXunFileService.getById(fileId); |
| | | sourcePro.setUrl(file.getFileUrl()); |
| | | sourcePro.setMd5(file.getMd5()); |
| | | } |
| | | ); |
| | | } |
| | | ); |
| | | String json = JsonUtil.jsonObj2Sting(programPro); |
| | | PoleXixunPlayerEntity poleXixunPlayer = new PoleXixunPlayerEntity(); |
| | | poleXixunPlayer.setProgramCode(programPro.get_id()); |
| | |
| | | poleXixunPlayer.setHeight(programPro.getHeight()); |
| | | poleXixunPlayer.setWidth(programPro.getWidth()); |
| | | poleXixunPlayer.setTotalSize((float) programPro.getTotalSize() / 1000000 + "MB"); |
| | | // poleXixunPlayer.setTotalSize( Long.parseLong(programPro.getTotalSize()) / 1000000 + "MB"); |
| | | // programPro.setProgramId(poleXixunPlayer.getProgramId()); |
| | | // System.out.println(poleXixunPlayer.getProgramId()); |
| | | poleXixunPlayer.setRequestBody(json); |
| | | poleXixunPlayer.setScreenShot(programPro.getScreenShot()); |
| | | // poleXixunPlayer.setCreatTime(sdf.format(date)); |
| | | poleXixunPlayer.setCreateUserId(SecurityUtils.getUserId()); |
| | | if (SecurityUtils.getClientId() != null) { |
| | | poleXixunPlayer.setCreateUserId(SecurityUtils.getUserId()); |
| | | if (clientService.findClientId()) { |
| | | poleXixunPlayer.setClientId(clientService.getClientId()); |
| | | } |
| | | } |
| | | return this.save(poleXixunPlayer); |
| | | boolean save = this.save(poleXixunPlayer); |
| | | /** |
| | | * 熙汛节目新增日志记录开始 |
| | | */ |
| | | String content = "{节目id:" + poleXixunPlayer.getProgramId() |
| | | + ", 节目名称:" + poleXixunPlayer.getProgramName() |
| | | + ", 节目内容:" + json |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "熙汛节目更改", content); |
| | | /** |
| | | * 熙汛节目新增日志记录结束 |
| | | */ |
| | | return save; |
| | | } |
| | | |
| | | public boolean deleteProgram(Long pid) { |
| | |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到该节目"); |
| | | } |
| | | /** |
| | | * 熙汛节目删除日志记录开始 |
| | | */ |
| | | String content = "{删除的节目id:" + byId.getProgramId() |
| | | + ", 删除的节目名称:" + byId.getProgramName() |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(null, null, "熙汛节目删除", content); |
| | | /** |
| | | * 熙汛节目删除日志记录结束 |
| | | */ |
| | | return removeById(pid); |
| | | } |
| | | |
| | |
| | | } |
| | | return programPro; |
| | | } |
| | | |
| | | |
| | | // public Object getProgram(String json) { |
| | | //// PoleXixunPlayerEntity byId = getById(pid); |
| | | // List<Long> fileIds = new ArrayList<>(); |
| | | // List<LedSFile> file = new ArrayList<>(); |
| | | // if (json == null) { |
| | | // throw new BusinessException("未找到该节目"); |
| | | // } |
| | | // ProgramPro programPro = new ProgramPro(); |
| | | // try { |
| | | // programPro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class); |
| | | // programPro.setProgramId(pid); |
| | | // programPro.setScreenShot(byId.getScreenShot()); |
| | | // programPro.getLayers().forEach( |
| | | // layerPro -> { |
| | | // layerPro.getSources().forEach( |
| | | // sourcePro -> { |
| | | // long fileId = Long.parseLong(sourcePro.getId()); |
| | | // file.add(xiXunFileService.getById(fileId)); |
| | | // } |
| | | // ); |
| | | // } |
| | | // ); |
| | | // programPro.setFileList(file); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return programPro; |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | list2.add(items); |
| | | taskPro.setItems(list2); |
| | | command.setId(UUID.randomUUID().toString()); |
| | | //这里是下方的post回调地址,需要修改IP地址 |
| | | command.setNotificationURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/getJSON"); |
| | | // //这里是下方的post回调地址,需要修改IP地址 |
| | | command.setNotificationURL(""); |
| | | //资源下载链接的请求头 |
| | | command.setPreDownloadURL("http://" + config.getIp() + ":" + config.getPort() + "/machine-fast/serv/download/downliadFileById/"); |
| | | command.setPreDownloadURL(""); |
| | | command.setTask(taskPro); |
| | | xixun.set_id(UUID.randomUUID().toString()); |
| | | xixun.setCommand(command); |
| | |
| | | LogUtils.error("结果:" + post); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 熙汛节目推送日志记录开始 |
| | | */ |
| | | List<String> listCode = new ArrayList<>(); |
| | | for (PoleLightemitEntity bean : poleLightemitEntities) { |
| | | listCode.add(bean.getLightemitControlCode()); |
| | | } |
| | | String content = "{节目id:" + programId |
| | | + ", 节目名称:" + poleXixunPlayerEntity.getProgramName() |
| | | + ", 节目内容:" + json |
| | | + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "熙汛节目推送", content); |
| | | /** |
| | | * 熙汛节目推送日志记录结束 |
| | | */ |
| | | } |
| | | |
| | | |
| | |
| | | lightemitUtils.clearPlayerTask(lightemitControlCode); |
| | | //推送最后命令 |
| | | lightemitUtils.sendLastCommand(lightemitControlCode); |
| | | |
| | | /** |
| | | * 熙汛大气数据推送日志记录开始 |
| | | // */ |
| | | // String content = "{设备code:" + lightemitControlCode |
| | | // + ", 推送内容:" + body |
| | | // + " }"; |
| | | // List<String> listCode = new ArrayList<>(); |
| | | // listCode.add(lightemitControlCode); |
| | | // StoreOperationRecordsUtils.storeOperationData(listCode, null, "熙汛大气数据推送", content); |
| | | /** |
| | | * 熙汛大气数据推送日志记录结束 |
| | | */ |
| | | } |
| | | }, 60 * 1000); |
| | | } |