| | |
| | | import com.sandu.ximon.admin.utils.request.requestbody.GetSchedules; |
| | | import com.sandu.ximon.admin.utils.request.requestbody.Task; |
| | | import com.sandu.ximon.admin.vo.LedScheduleVO; |
| | | import com.sandu.ximon.admin.vo.XiXunResultVO; |
| | | import com.sandu.ximon.dao.domain.LedScheduleEntity; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.enums.OrderByEnums; |
| | |
| | | * |
| | | * @param scheduleId |
| | | * @param lightemitIds |
| | | * @return |
| | | */ |
| | | public void ledschedulepush(Integer scheduleId, Long[] lightemitIds) { |
| | | public Map<String, List<XiXunResultVO>> ledschedulepush(Integer scheduleId, Long[] lightemitIds) { |
| | | |
| | | // LedScheduleEntity ledScheduleEntity = baseMapper.selectById(scheduleId); |
| | | LedScheduleEntity ledScheduleEntity = getById(scheduleId); |
| | | if (ledScheduleEntity == null) { |
| | | throw new BusinessException("该定时任务不存在"); |
| | | } |
| | | // SendCommand sendCommand = new SendCommand(); |
| | | // SendCommand sendCommand = new SendCommand(); |
| | | // sendCommand.setTask(ledScheduleEntity.getSchedule()); |
| | | // String json = new Gson().toJson(sendCommand); |
| | | Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(Arrays.asList(lightemitIds)); |
| | | Map<String, List<XiXunResultVO>> result=new HashMap<>(); |
| | | List<XiXunResultVO> success =new ArrayList<>(); |
| | | List<XiXunResultVO> fail =new ArrayList<>(); |
| | | |
| | | |
| | | if (poleLightemitEntities != null) { |
| | | for (PoleLightemitEntity entity : poleLightemitEntities) { |
| | | lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), ledScheduleEntity.getSchedule()); |
| | | String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), ledScheduleEntity.getSchedule()); |
| | | XiXunResultVO vo=new XiXunResultVO(); |
| | | vo.setLightemitId(entity.getLightemitId()); |
| | | vo.setLightemitName(entity.getLightemitName()); |
| | | if(post.contains("{\"_type\":\"success\",\"_id\":")){ |
| | | success.add(vo); |
| | | }else { |
| | | fail.add(vo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 熙汛定时推送 日志记录开始 |
| | |
| | | /** |
| | | * 熙汛定时任务推送 日志记录结束 |
| | | */ |
| | | |
| | | result.put("success",success); |
| | | result.put("fail",fail); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 清空定时 |
| | | * |
| | | * @param |
| | | * @param lightemitIds |
| | | */ |
| | | public Map<String, List<XiXunResultVO>> deleteSchedulePush( Long[] lightemitIds) { |
| | | |
| | | Collection<PoleLightemitEntity> poleLightemitEntities = poleLightemitService.listByIds(Arrays.asList(lightemitIds)); |
| | | |
| | | Map<String, List<XiXunResultVO>> result=new HashMap<>(); |
| | | List<XiXunResultVO> success =new ArrayList<>(); |
| | | List<XiXunResultVO> fail =new ArrayList<>(); |
| | | |
| | | if (poleLightemitEntities != null) { |
| | | for (PoleLightemitEntity entity : poleLightemitEntities) { |
| | | // lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), ledScheduleEntity.getSchedule()); |
| | | String post = lightemitUtils.post(realtimeServerBean.getCommand() + entity.getLightemitControlCode(), "{\"type\": \"timedScreening\",\"task\":{}}"); |
| | | |
| | | XiXunResultVO vo=new XiXunResultVO(); |
| | | vo.setLightemitId(entity.getLightemitId()); |
| | | vo.setLightemitName(entity.getLightemitName()); |
| | | if(post.contains("{\"_type\":\"success\",\"_id\":")){ |
| | | success.add(vo); |
| | | }else { |
| | | fail.add(vo); |
| | | } |
| | | |
| | | System.out.println(post+"---------"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清空熙汛定时任务 日志记录开始 |
| | | */ |
| | | String message = ""; |
| | | List<String> listCode = new ArrayList<>(); |
| | | |
| | | for (PoleLightemitEntity entity : poleLightemitEntities) { |
| | | |
| | | listCode.add(entity.getLightemitControlCode()); |
| | | message += "[屏幕Code:" + entity.getLightemitControlCode() + "屏幕名称:" + entity.getLightemitName() + "],"; |
| | | } |
| | | String content = "{熙汛屏幕信息:" + message + " }"; |
| | | StoreOperationRecordsUtils.storeOperationData(listCode, null, "清空熙汛定时任务", content); |
| | | /** |
| | | * 清空熙汛定时任务 日志记录结束 |
| | | */ |
| | | result.put("success",success); |
| | | result.put("fail",fail); |
| | | return result; |
| | | } |
| | | |
| | | public boolean updateSchedule(LEDScheduleParam_xixun paramXixun) { |