From c02206dbafda5a091de064e0fb45b6054de384a8 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期四, 08 九月 2022 16:33:49 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java | 83 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 77 insertions(+), 6 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java
index d89f0f9..f9c8fe7 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedScheduleService.java
@@ -20,6 +20,7 @@
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;
@@ -112,25 +113,37 @@
*
* @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);
+ }
}
}
+
+
+
/**
* 鐔欐睕瀹氭椂鎺ㄩ�� 鏃ュ織璁板綍寮�濮�
@@ -148,6 +161,64 @@
/**
* 鐔欐睕瀹氭椂浠诲姟鎺ㄩ�� 鏃ュ織璁板綍缁撴潫
*/
+
+ 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) {
--
Gitblit v1.9.3