From 4b753c6327941dd988e9ca534cf81ae1d368286a Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 22 九月 2022 17:49:14 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java | 651 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 462 insertions(+), 189 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java
index 1a2e630..0227b49 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java
@@ -6,7 +6,8 @@
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.HexUtil;
import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.alibaba.druid.support.json.JSONUtils;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@@ -67,87 +68,23 @@
private final ClientService clientService;
private final LightEnergyDataService lightEnergyDataService;
+
/**
* 鏂板璺伅浠诲姟
+ *
+ * @param param
+ * @return
*/
@Transactional(rollbackFor = Exception.class)
- public boolean addLightTask(LightTaskParam param) {
+ public String AddLightTask(LightTaskParam param) {
if (StrUtil.length(param.getControlOrder()) % LightTaskParam.REQUEST_ORDER_LENGTH != 0) {
throw new BusinessException("鐏帶鍛戒护鏍煎紡涓嶆纭�");
}
- int week = 0;
- for (Integer w : param.getWeekList()) {
- week |= w;
+
+ if (!"0001".equals(param.getLightAddress()) && !"0002".equals(param.getLightAddress())) {
+ throw new BusinessException("鐏ご鍦板潃鏍煎紡涓嶆纭�");
}
- LightTask lightTask = new LightTask();
- if (SecurityUtils.getClientId() != null) {
- lightTask.setClientId(clientService.getClientId());
- lightTask.setUserId(SecurityUtils.getUserId());
- }
- lightTask.setTaskName(param.getTaskName());
- lightTask.setWeek(week);
- lightTask.setLightAdress(param.getLightAddress());
- lightTask.setCloseOrder(param.getCloseOrder());
- lightTask.setOpenOrder(param.getOpenOrder());
- lightTask.setControlOrder(param.getControlOrder());
- lightTask.setCreateUser(SecurityUtils.getUsername());
- lightTask.setFramePayload(buildControlFramePayload(param.getOpenOrder(), param.getCloseOrder(), param.getControlOrder(), week));
- if (!save(lightTask)) {
- throw new BusinessException("淇濆瓨璺伅浠诲姟澶辫触");
- }
-
-
- /**
- * 鏂板璺伅浠诲姟鏃ュ織璁板綍寮�濮�
- */
- List<String> poleCodeList = new ArrayList<>();
- if (CollectionUtil.isNotEmpty(param.getPoleIdList())) {
- List<Pole> poleList = SpringContextHolder.getBean(PoleService.class).listByIds(param.getPoleIdList());
- if (CollectionUtil.isNotEmpty(poleList)) {
- poleCodeList = poleList.stream().map(Pole::getDeviceCode).collect(Collectors.toList());
- }
- }
- String content = "{浠诲姟ID锛�" + lightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + lightTask.getTaskName() + "}锛寋鍐呭抚鎸囦护" + lightTask.getFramePayload() + "锛� 鐏潌ID锛�" + param.getPoleIdList().toString() + "锛� 鎺у埗鐨勭伅澶村湴鍧�锛�" + param.getLightAddress() + " }";
- StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "鏂板璺伅浠诲姟", content);
- /**
- * 鏂板璺伅浠诲姟鏃ュ織璁板綍缁撴潫
- */
-
- List<Long> poleIdList = param.getPoleIdList();
- if (CollectionUtil.isNotEmpty(poleIdList)) {
-
- List<LightTaskPoleRelation> lightTaskPoleRelationList = sendControllerFrame(lightTask, poleIdList, lightTask.getFramePayload(), param.getLightAddress());
-
- // 娣诲姞缁戝畾鐏潌
- if (!lightTaskPoleRelationService.saveBatch(lightTaskPoleRelationList)) {
- throw new BusinessException("缁戝畾鐏潌澶辫触");
- }
-
- // 涓�涓伅鏉嗗彧鑳戒娇鐢ㄤ竴涓换鍔★紝鏂颁换鍔¤瑕嗙洊鏃т换鍔�
- lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIdList).ne(LightTaskPoleRelation::getTaskId, lightTask.getTaskId()));
-
- /**
- * 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍寮�濮�
- */
-
- String content1 = "{浠诲姟ID锛�" + lightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + lightTask.getTaskName() + "}," + " 鐏潌ID锛�" + param.getPoleIdList().toString() + " }";
- StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "涓嬪彂璺伅浠诲姟", content1);
- /**
- * 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍缁撴潫
- */
- }
- return true;
- }
-
- @Transactional(rollbackFor = Exception.class)
- public String updateLightTask(Long taskId, LightTaskParam param) {
- if (StrUtil.length(param.getControlOrder()) % LightTaskParam.REQUEST_ORDER_LENGTH != 0) {
- throw new BusinessException("鐏帶鍛戒护鏍煎紡涓嶆纭�");
- }
- LightTask lightTask = getById(taskId);
- if (lightTask == null) {
- throw new BusinessException("鎵句笉鍒拌矾鐏换鍔�");
- }
+// LightTask lightTask = getById(null);
int week = 0;
@@ -157,10 +94,10 @@
LightTask newLightTask = new LightTask();
newLightTask.setTaskName(param.getTaskName());
- if (SecurityUtils.getClientId() != null) {
- lightTask.setClientId(clientService.getClientId());
- lightTask.setUserId(SecurityUtils.getUserId());
- }
+
+ newLightTask.setClientId(clientService.getClientId());
+ newLightTask.setUserId(SecurityUtils.getUserId());
+
newLightTask.setWeek(week);
newLightTask.setCreateUser(SecurityUtils.getUsername());
newLightTask.setControlOrder(param.getControlOrder());
@@ -170,27 +107,188 @@
newLightTask.setUpdateTime(LocalDateTime.now());
newLightTask.setFramePayload(buildControlFramePayload(param.getOpenOrder(), param.getCloseOrder(), param.getControlOrder(), week));
+ if (!save(newLightTask)) {
+ throw new BusinessException("淇濆瓨璺伅浠诲姟澶辫触");
+ }
+ List<String> poleCodeList = new ArrayList<>();
+ //浼犲叆鐨勭伅鏉唅d闆嗗悎
+ List<Long> poleIdList = new ArrayList<>();
+ //鍘婚噸
+ for (Long item : param.getPoleIdList()) {
+ if (!poleIdList.contains(item)) {
+ poleIdList.add(item);
+ }
+ }
+
+ if (CollectionUtil.isNotEmpty(poleIdList)) {
+ List<Pole> poleList = SpringContextHolder.getBean(PoleService.class).listByIds(poleIdList);
+ if (CollectionUtil.isNotEmpty(poleList)) {
+ poleCodeList = poleList.stream().map(Pole::getDeviceCode).collect(Collectors.toList());
+ }
+ }
+ String content = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}锛寋鍐呭抚鎸囦护" + newLightTask.getFramePayload() + "锛� 鐏潌ID锛�" + poleIdList.toString() + "锛� 鎺у埗鐨勭伅澶村湴鍧�锛�" + param.getLightAddress() + " }";
+ StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "鏂板璺伅浠诲姟", content);
+
+
+ //璁板綍杩欎簺鐏潌鍘熷厛鐨勪换鍔�
+ List<LightTaskPoleRelation> oldLightTaskStatusAndPoles = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class)
+ .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress()));
+
+
+ List<LightTaskPoleRelation> newPoleMap = new ArrayList<>();
+ if (!poleIdList.isEmpty()) {
+ //鏂扮伅鏉嗕笅鍙戞柊浠诲姟
+ newPoleMap = sendControllerFrame(newLightTask, poleIdList, newLightTask.getFramePayload(), param.getLightAddress());
+
+ }
+
+ newPoleMap.forEach(
+ commend -> {
+ //寮�鍏崇伅鏃堕棿
+// String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder();
+// if (newLightTask.getControlOrder() != null) {
+// //鎺х伅鏃堕棿
+// s = s + newLightTask.getControlOrder();
+// }
+// // 鏇存柊绯荤粺瀹氭椂
+// commend.setSysScheduled(s);
+ if (commend.getIssueStatus() == 0) {
+ //涓嬪彂鎴愬姛 鏇存柊绯荤粺瀹氭椂鍜岀‖浠跺畾鏃�
+ commend.setDeviceScheduled(JSONObject.toJSONString(newLightTask));
+ } else {
+ //涓嬪彂澶辫触 鏇存柊绯荤粺瀹氭椂 淇濈暀纭欢瀹氭椂 纭欢瀹氭椂
+// commend.setSysScheduled(s);
+ oldLightTaskStatusAndPoles.forEach(task -> {
+ if (task.getLightAddress().equals(commend.getLightAddress()) && task.getDeviceCode().equals(commend.getDeviceCode())) {
+ //鍚屼竴涓伅澶�
+ LightTask oldTask = getById(task.getTaskId());
+ commend.setDeviceScheduled(JSONObject.toJSONString(oldTask));
+ }
+ });
+
+ }
+ }
+ );
+
+
+ /**
+ * 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍寮�濮�
+ */
+
+ String content1 = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}," + " 鐏潌ID锛�" + poleIdList.toString() + " }";
+ StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "涓嬪彂璺伅浠诲姟", content1);
+ /**
+ * 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍缁撴潫
+ */
+
+
+ //鍒犻櫎鏃х殑鍏崇郴
+ lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class)
+ .eq(LightTaskPoleRelation::getLightAddress, newLightTask.getLightAdress()).in(LightTaskPoleRelation::getPoleId, poleIdList));
+
+ boolean b = true;
+ //淇濆瓨浠诲姟鍏崇郴
+ if (!newPoleMap.isEmpty()) {
+ b = lightTaskPoleRelationService.saveBatch(newPoleMap);
+ }
+
+ if (!b) {
+ //鎵�鏈夌伅鏉嗛兘涓嬪彂澶辫触 鏂板鐨勪换鍔′笉淇濈暀
+ removeById(newLightTask);
+ throw new BusinessException("鎸囦护涓嬪彂澶辫触,璇锋鏌ョ伅鏉嗙姸鎬佸悗閲嶆柊鏂板浠诲姟");
+ } else {
+ return "浠诲姟鏂板鎴愬姛";
+ }
+ }
+
+
+ /**
+ * 缂栬緫璺伅浠诲姟
+ *
+ * @param taskId
+ * @param param
+ * @return
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public String newUpdateLightTask(Long taskId, LightTaskParam param) {
+ if (StrUtil.length(param.getControlOrder()) % LightTaskParam.REQUEST_ORDER_LENGTH != 0) {
+ throw new BusinessException("鐏帶鍛戒护鏍煎紡涓嶆纭�");
+ }
+ LightTask newLightTask = getById(taskId);
+ if (newLightTask == null) {
+ throw new BusinessException("鎵句笉鍒拌矾鐏换鍔�");
+ }
+
+
+ int week = 0;
+ for (Integer w : param.getWeekList()) {
+ week |= w;
+ }
+
+// LightTask newLightTask = new LightTask();
+ newLightTask.setTaskName(param.getTaskName());
+
+ newLightTask.setClientId(clientService.getClientId());
+ newLightTask.setUserId(SecurityUtils.getUserId());
+
+ newLightTask.setWeek(week);
+ newLightTask.setCreateUser(SecurityUtils.getUsername());
+ newLightTask.setControlOrder(param.getControlOrder());
+ newLightTask.setOpenOrder(param.getOpenOrder());
+ newLightTask.setCloseOrder(param.getCloseOrder());
+ newLightTask.setLightAdress(param.getLightAddress());
+ newLightTask.setUpdateTime(LocalDateTime.now());
+ newLightTask.setFramePayload(buildControlFramePayload(param.getOpenOrder(), param.getCloseOrder(), param.getControlOrder(), week));
+
+ updateById(newLightTask);
//缂栬緫鍚庣伅鏉咺D闆嗗悎
- List<Long> poleIdList = param.getPoleIdList();
+ List<Long> poleIdList = new ArrayList<>();
+ //鍘婚噸
+ for (Long item : param.getPoleIdList()) {
+ if (!poleIdList.contains(item)) {
+ poleIdList.add(item);
+ }
+ }
//璁板綍浠诲姟缂栬緫鍣ㄥ墠鐏潌ID闆嗗悎
- List<LightTaskStatusAndPole> oldLightTaskStatusAndPoles = lightTaskPoleRelationService.listPoleAndStatusIdByTaskId(taskId);
- List<Long> oldList = oldLightTaskStatusAndPoles.stream().map(LightTaskStatusAndPole::getId).collect(Collectors.toList());
+// List<LightTaskStatusAndPole> oldLightTaskStatusAndPoles = lightTaskPoleRelationService.listPoleAndStatusIdByTaskId(taskId);
+ List<LightTaskPoleRelation> oldLightTaskStatusAndPoles = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId));
+ List<Long> oldList = oldLightTaskStatusAndPoles.stream().map(LightTaskPoleRelation::getPoleId).collect(Collectors.toList());
- //鍒ゆ柇param.getPoleIdList()涓槸鍚︽湁鏃х殑鐏潌ID (鐩存帴涓嬪彂)
- List<Long> newPoleIdList = param.getPoleIdList().stream().filter(poleId -> !oldList.contains(poleId)).collect(Collectors.toList());
- //鍒ゆ柇param.getPoleIdList()涓槸鍚︽湁鏂扮殑鐏潌ID (瑕嗙洊鎿嶄綔)
- List<Long> oldPoleIdList = param.getPoleIdList().stream().filter(poleId -> oldList.contains(poleId)).collect(Collectors.toList());
- //oldList涓湁鐨勭伅鏉咺D锛屼絾鏄痯aram.getPoleIdList()涓病鏈� (鍏崇伅鎿嶄綔)
- List<Long> closeLight = oldList.stream().filter(poleId -> !param.getPoleIdList().contains(poleId)).collect(Collectors.toList());
+ //鍒ゆ柇poleIdList涓槸鍚︽湁鏃х殑鐏潌ID (鐩存帴涓嬪彂)
+ List<Long> newPoleIdList = poleIdList.stream().filter(poleId -> !oldList.contains(poleId)).collect(Collectors.toList());
+ //鍒ゆ柇poleIdList涓槸鍚︽湁鏂扮殑鐏潌ID (瑕嗙洊鎿嶄綔)
+ List<Long> oldPoleIdList = poleIdList.stream().filter(poleId -> oldList.contains(poleId)).collect(Collectors.toList());
+
+ //oldList涓湁鐨勭伅鏉咺D锛屼絾鏄痯oleIdList涓病鏈� (鍏崇伅鎿嶄綔)
+ List<Long> closeLight = oldList.stream().filter(poleId -> !poleIdList.contains(poleId)).collect(Collectors.toList());
+
+
+ //鍙栧嚭瑕嗙洊鎿嶄綔鐨勫叧绯讳俊鎭�
+ //璁板綍杩欎簺鐏潌鍘熷厛鐨勪换鍔�
+ List<LightTaskPoleRelation> oldRelation = new ArrayList<>();
+
+ if (CollectionUtil.isNotEmpty(oldPoleIdList)) {
+ List<Long> oldRelationList = new ArrayList<>();
+ oldRelationList.addAll(oldPoleIdList);
+ oldRelationList.addAll(closeLight);
+ oldRelation = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, oldRelationList)
+ .ne(LightTaskPoleRelation::getTaskId, taskId).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress()));
+ }
+
+ //鍙栧嚭浠诲姟涓師鏈夌殑浠诲姟淇℃伅
+ List<LightTaskPoleRelation> relations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class)
+ .eq(LightTaskPoleRelation::getTaskId, taskId).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress()));
+
+ relations.addAll(oldRelation);
List<LightTaskPoleRelation> newPoleAll = new ArrayList<>();
List<LightTaskPoleRelation> newPoleSuccess = new ArrayList<>();
List<LightTaskPoleRelation> newPoleFail = new ArrayList<>();
if (CollectionUtil.isNotEmpty(newPoleIdList)) {
//鏂扮伅鏉嗕笅鍙戞柊浠诲姟
- Map<String, List<LightTaskPoleRelation>> newPoleMap = sendControllerFrame(newPoleIdList, lightTask.getFramePayload(), param.getLightAddress());
+ Map<String, List<LightTaskPoleRelation>> newPoleMap = sendControllerFrame(newPoleIdList, newLightTask.getFramePayload(), param.getLightAddress());
//newPoleAll闆嗗悎鍚庨潰鐢ㄤ簬瀛樺偍鍏崇郴琛�
newPoleAll = newPoleMap.getOrDefault("all", new ArrayList<>());
@@ -202,116 +300,106 @@
List<LightTaskPoleRelation> oldPoleSuccess = new ArrayList<>();
if (CollectionUtil.isNotEmpty(oldPoleIdList)) {
//瑕嗙洊鎿嶄綔鐏潌
- Map<String, List<LightTaskPoleRelation>> oldPoleMap = sendControllerFrame(oldPoleIdList, lightTask.getFramePayload(), param.getLightAddress());
+ Map<String, List<LightTaskPoleRelation>> oldPoleMap = sendControllerFrame(oldPoleIdList, newLightTask.getFramePayload(), param.getLightAddress());
oldPoleFail = oldPoleMap.getOrDefault("fail", new ArrayList<>());
oldPoleSuccess = oldPoleMap.getOrDefault("success", new ArrayList<>());
}
+
List<LightTaskPoleRelation> closePoleFail = new ArrayList<>();
List<LightTaskPoleRelation> closePoleSuccess = new ArrayList<>();
- if (CollectionUtil.isNotEmpty(closeLight)) {
- //鎵ц鍏崇伅鍐呭抚
- String framePayloadClose = "7f0000007f173b00";
- //瑕嗙洊鎿嶄綔鐏潌
+ System.out.println(closeLight + "closeLight");
+ if (CollectionUtil.isNotEmpty(closeLight) && closeLight != null && closeLight.get(0) != null) {
+ //娓呴櫎甯ф寚浠�
+ String framePayloadClose = "";
+ //鍏崇伅鎿嶄綔鐏潌
Map<String, List<LightTaskPoleRelation>> closePoleMap = sendControllerFrame(closeLight, framePayloadClose, param.getLightAddress());
closePoleFail = closePoleMap.getOrDefault("fail", new ArrayList<>());
closePoleSuccess = closePoleMap.getOrDefault("success", new ArrayList<>());
}
- if (closePoleFail.size() == 0 && oldPoleFail.size() == 0) {
- //鏃т换鍔′腑鍏ㄩ儴鍙戦�佹寚浠ゆ垚鍔燂紝鏇存柊鍘熸湰浠诲姟涓殑鏁版嵁
- newLightTask.setTaskId(lightTask.getTaskId());
- updateById(newLightTask);
- } else {
- if (!newPoleSuccess.isEmpty() || !oldPoleSuccess.isEmpty()) {
- //鏈夊け鏁楃殑闇�瑕佷繚瀛樻棫鐨勪换鍕欙紝鏂板鏂扮殑浠诲姟鏁版嵁杩涜淇濆瓨
- save(newLightTask);
- }
- }
-
/**
* 缂栬緫璺伅浠诲姟鏃ュ織璁板綍寮�濮�
*/
List<String> poleCodeList = new ArrayList<>();
- if (CollectionUtil.isNotEmpty(param.getPoleIdList())) {
- List<Pole> poleList = SpringContextHolder.getBean(PoleService.class).listByIds(param.getPoleIdList());
+ if (CollectionUtil.isNotEmpty(poleIdList)) {
+ List<Pole> poleList = SpringContextHolder.getBean(PoleService.class).listByIds(poleIdList);
if (CollectionUtil.isNotEmpty(poleList)) {
poleCodeList = poleList.stream().map(Pole::getDeviceCode).collect(Collectors.toList());
}
}
- String content = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}锛寋鍐呭抚鎸囦护" + newLightTask.getFramePayload() + "锛� 鐏潌ID锛�" + param.getPoleIdList().toString() + "锛� 鎺у埗鐨勭伅澶村湴鍧�锛�" + param.getLightAddress() + " }";
+ String content = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}锛寋鍐呭抚鎸囦护" + newLightTask.getFramePayload() + "锛� 鐏潌ID锛�" + poleIdList.toString() + "锛� 鎺у埗鐨勭伅澶村湴鍧�锛�" + param.getLightAddress() + " }";
StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "缂栬緫璺伅浠诲姟", content);
/**
* 缂栬緫璺伅浠诲姟鏃ュ織璁板綍缁撴潫
*/
- for (LightTaskPoleRelation bean : newPoleSuccess) {
- bean.setTaskId(newLightTask.getTaskId());
- }
- //鎴愬姛鐢ㄦ柊鐨勪换鍔D
- for (LightTaskPoleRelation bean : oldPoleSuccess) {
- bean.setTaskId(newLightTask.getTaskId());
- }
- //澶辫触鐢ㄦ棫鐨勪换鍔D
- for (LightTaskPoleRelation bean : oldPoleFail) {
- bean.setTaskId(lightTask.getTaskId());
- }
-
- //澶辫触鐢ㄦ棫鐨勪换鍔D
- for (LightTaskPoleRelation bean : closePoleFail) {
- bean.setTaskId(lightTask.getTaskId());
- }
List<LightTaskPoleRelation> all = new ArrayList<>();
all.addAll(newPoleSuccess);
+ all.addAll(newPoleFail);
all.addAll(oldPoleSuccess);
all.addAll(oldPoleFail);
+ all.addAll(closePoleSuccess);
all.addAll(closePoleFail);
-
- List<Long> allPoleId = new ArrayList<>();
- for (LightTaskPoleRelation bean : newPoleSuccess) {
- allPoleId.add(bean.getPoleId());
- }
- for (LightTaskPoleRelation bean : oldPoleSuccess) {
- allPoleId.add(bean.getPoleId());
- }
- for (LightTaskPoleRelation bean : oldPoleFail) {
- allPoleId.add(bean.getPoleId());
- }
- for (LightTaskPoleRelation bean : closePoleSuccess) {
- allPoleId.add(bean.getPoleId());
- }
-
- if (!allPoleId.isEmpty()) {
- lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, allPoleId));
-
- }
if (!all.isEmpty()) {
- lightTaskPoleRelationService.saveBatch(all);
+ List<LightTaskPoleRelation> finalOldRelation = relations;
+ all.forEach(
+ commend -> {
+ commend.setTaskId(newLightTask.getTaskId());
+ //寮�鍏崇伅鏃堕棿
+ String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder();
+ if (newLightTask.getControlOrder() != null) {
+ //鎺х伅鏃堕棿
+ s = s + newLightTask.getControlOrder();
+ }
+ // 鏇存柊绯荤粺瀹氭椂
+ commend.setSysScheduled(s);
+ // 鍏堣缃‖浠跺畾鏃朵负涓婃鐨勭‖浠跺畾鏃� 涓嶈鎴愬姛澶辫触
+ String finalS = s;
+ finalOldRelation.forEach(task -> {
+ if (task.getLightAddress().equals(commend.getLightAddress()) && task.getDeviceCode().equals(commend.getDeviceCode())) {
+ //鍚屼竴涓伅澶�
+ commend.setDeviceScheduled(task.getDeviceScheduled());
+ if (commend.getIssueStatus() == 0) {
+ //涓嬪彂鎴愬姛 鏇存柊绯荤粺瀹氭椂鍜岀‖浠跺畾鏃�
+ commend.setDeviceScheduled(finalS);
+ }
+ }
+ });
+
+ }
+ );
+ }
+ boolean b = true;
+
+ //缂栬緫鍓嶅悗鎵�鏈夌殑鐏潌ID闆嗗悎
+ poleIdList.addAll(oldList);
+ if (!poleIdList.isEmpty()) {
+ lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getPoleId, poleIdList));
+
+ }
+
+ if (!all.isEmpty()) {
+ b = lightTaskPoleRelationService.saveBatch(all);
}
/**
* 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍寮�濮�
*/
- String content1 = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}," + " 鐏潌ID锛�" + param.getPoleIdList().toString() + " }";
+ String content1 = "{浠诲姟ID锛�" + newLightTask.getTaskId() + "锛� 浠诲姟鍚嶏細" + newLightTask.getTaskName() + "}," + " 鐏潌ID锛�" + poleCodeList.toString() + " }";
StoreOperationRecordsUtils.storeOperationData(poleCodeList, null, "涓嬪彂璺伅浠诲姟", content1);
/**
* 涓嬪彂璺伅浠诲姟鏃ュ織璁板綍缁撴潫
*/
- if (newPoleFail.isEmpty() && oldPoleFail.isEmpty() && closePoleFail.isEmpty()) {
+ if (b) {
return "缂栬緫鎴愬姛";
- } else if (newPoleSuccess.isEmpty() && oldPoleSuccess.isEmpty() && closePoleSuccess.isEmpty()) {
- throw new BusinessException("缂栬緫澶辫触,璇锋鏌ョ紪杈戠殑璁惧鏄惁鍦ㄧ嚎!");
- } else if (!closePoleFail.isEmpty() || !oldPoleFail.isEmpty()) {
- return "鍘熶换鍔′腑瀛樺湪涓嬪彂寮傚父锛屽師浠诲姟淇濈暀锛屽垱寤烘柊浠诲姟杩涜淇濆瓨";
- } else if (!newPoleFail.isEmpty()) {
- return "鏂颁换鍔′腑瀛樺湪涓嬪彂寮傚父锛屽拷鐣ュ紓甯告搷浣滅殑鐏潌";
} else {
- return "鎿嶄綔寮傚父";
+ return "缂栬緫澶辫触";
}
}
@@ -325,24 +413,15 @@
*/
public A5LightTimerRespInnerFrame sendTimeRRpc(String framePayload, String deviceCode, String lightAddress) {
IRequestFrame requestFrame = FrameBuilder.builderA5().innerFrame(new A5LightTimerReqInnerFrame(framePayload, lightAddress)).orderType(A5OrderEnum.REQUEST_LIGHT_DATA.getCode()).build();
+ System.out.println(requestFrame + " --------requestFrame");
+
WrapResponseCommonFrame<A5LightTimerRespInnerFrame> responseCommonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(deviceCode, requestFrame, A5LightTimerRespInnerFrame.class);
-
+ System.out.println(responseCommonFrame + " -----------responseCommonFrame");
StoreOperationRecordsUtils.storeInnerFrameData(deviceCode, "鍗曠伅甯�-鎺х伅", requestFrame, responseCommonFrame);
-
return Optional.ofNullable(responseCommonFrame).map(WrapResponseCommonFrame::getResponseInnerFrame).orElse(null);
}
public List<LightTaskDto> listLightTask(BaseConditionVO conditionVO, String keyword, Integer order, Integer seq) {
- LambdaQueryWrapper<LightTask> wrapper = Wrappers.lambdaQuery(LightTask.class);
- if (StrUtil.isNotBlank(keyword)) {
- wrapper.like(LightTask::getTaskName, keyword);
- }
- //涓嶆槸瓒呯闇�瑕佺瓫閫�
- if (SecurityUtils.getClientId() != null) {
- wrapper.eq(LightTask::getClientId, SecurityUtils.getUserId()).or(w -> {
- w.eq(LightTask::getUserId, SecurityUtils.getUserId());
- });
- }
//鎺掑簭瀛楁
String orderByResult = "task_id";
@@ -372,7 +451,8 @@
String orderBy = orderByResult + " " + orderBySeq;
PageHelper.startPage(conditionVO.getPageNo(), conditionVO.getPageSize(), orderBy);
- List<LightTask> list = list(wrapper);
+ List<LightTask> list = baseMapper.listTask(SecurityUtils.getClientId(), keyword, orderBy);
+
Page<LightTaskDto> page = new Page<>();
BeanUtils.copyProperties(list, page);
@@ -380,6 +460,40 @@
LightTaskDto lightTaskDto = new LightTaskDto();
BeanUtils.copyProperties(lightTask, lightTaskDto);
lightTaskDto.setWeekList(TaskOrderUtil.parseLightWeek2List(lightTask.getWeek()));
+
+
+ //鍒ゆ柇鐏ご鏄惁瀛樺湪浠诲姟
+ List<LightTaskPoleRelation> lightTaskPoleRelationList = lightTaskPoleRelationService.list(Wrappers.<LightTaskPoleRelation>lambdaQuery().eq(LightTaskPoleRelation::getTaskId, lightTask.getTaskId()));
+
+ //涓嬪彂鎴愬姛鐨勭伅鏉嗘暟閲�
+ Integer successCount = baseMapper.successCount(lightTaskDto.getTaskId());
+ ///浠诲姟涓�荤殑鐏潌鏁伴噺
+ Integer toTalCount = baseMapper.toTalCount(lightTaskDto.getTaskId());
+ if (successCount == null) {
+ successCount = 0;
+ }
+ if (toTalCount == null) {
+ toTalCount = 0;
+ }
+ if (toTalCount == 0) {
+ //浠诲姟涓病鏈夌伅鏉�
+ lightTaskDto.setSyncStatus("鏈悓姝�");
+ } else {
+ //浠诲姟涓湁鐏潌
+ if (successCount == 0) {
+ //涓嬪彂鎴愬姛鏈�0
+ lightTaskDto.setSyncStatus("鏈悓姝�");
+ } else if (successCount != 0 && successCount < toTalCount) {
+ //瀛樺湪涓嬪彂鎴愬姛 浣嗗苟鏈叏閮ㄦ垚鍔�
+ lightTaskDto.setSyncStatus("閮ㄥ垎鍚屾");
+ } else if (toTalCount.equals(successCount) && toTalCount != 0 && successCount != 0) {
+ //鍏ㄩ儴鎴愬姛
+ lightTaskDto.setSyncStatus("宸插悓姝�");
+ } else {
+ //鏈煡绫诲瀷
+ lightTaskDto.setSyncStatus("鍚屾鐘舵�佸嚭閿�");
+ }
+ }
page.add(lightTaskDto);
}
return page;
@@ -428,9 +542,59 @@
}
for (Pole pole : poles) {
+ if (pole.getDeviceCode() == null || pole.getDeviceCode().equals("")) {
+ removeById(lightTask.getTaskId());
+ throw new BusinessException("缂栬緫鐨勭伅鏉嗘垨鍘熸湁浠诲姟鐨勭伅鏉嗕笉瀛樺湪mac,涓嶈兘涓嬪彂浠诲姟 璇锋鏌ョ伅鏉嗘槸鍚﹀瓨鍦ㄥ崟鐏�");
+ }
LightTaskPoleRelation lightTaskPoleRelation = new LightTaskPoleRelation();
lightTaskPoleRelation.setPoleId(pole.getId());
lightTaskPoleRelation.setTaskId(lightTask.getTaskId());
+
+ // rrpc 鍙戠敓瀹氭椂鍛戒护
+// if ("FFFF".equals(lightAddress)) {
+// LightTaskPoleRelation lightTaskPoleRelation01 = new LightTaskPoleRelation();
+// lightTaskPoleRelation01.setPoleId(pole.getId());
+// lightTaskPoleRelation01.setTaskId(lightTask.getTaskId());
+// lightTaskPoleRelation01.setLightAddress("0001");
+//
+// LightTaskPoleRelation lightTaskPoleRelation02 = new LightTaskPoleRelation();
+// lightTaskPoleRelation02.setPoleId(pole.getId());
+// lightTaskPoleRelation02.setTaskId(lightTask.getTaskId());
+// lightTaskPoleRelation02.setLightAddress("0002");
+//
+// // 鐏ご1 rrpc 鍙戠敓瀹氭椂鍛戒护
+// try {
+// A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame01 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0001");
+// //鐏ご1
+// if (a5LightTimerRespInnerFrame01 == null) {
+// lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// } else {
+// lightTaskPoleRelation01.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame01.getResponseStatus()));
+// }
+//
+// } catch (BusinessException e) {
+// lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// }
+//
+// // 鐏ご2 rrpc 鍙戠敓瀹氭椂鍛戒护
+// try {
+// A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame02 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0002");
+// //鐏ご2
+// if (a5LightTimerRespInnerFrame02 == null) {
+// lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// } else {
+// lightTaskPoleRelation02.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame02.getResponseStatus()));
+// }
+//
+// } catch (BusinessException e) {
+// lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// }
+//
+// lightTaskPoleRelationList.add(lightTaskPoleRelation01);
+// lightTaskPoleRelationList.add(lightTaskPoleRelation02);
+// } else {
+ lightTaskPoleRelation.setDeviceCode(pole.getDeviceCode());
+ lightTaskPoleRelation.setLightAddress(lightAddress);
// rrpc 鍙戠敓瀹氭椂鍛戒护
try {
A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame = sendTimeRRpc(framePayload, pole.getDeviceCode(), lightAddress);
@@ -440,11 +604,13 @@
lightTaskPoleRelation.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame.getResponseStatus()));
}
} catch (BusinessException e) {
+ e.printStackTrace();
lightTaskPoleRelation.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
}
-
lightTaskPoleRelationList.add(lightTaskPoleRelation);
}
+
+// }
return lightTaskPoleRelationList;
}
@@ -457,6 +623,8 @@
* @return
*/
private Map<String, List<LightTaskPoleRelation>> sendControllerFrame(List<Long> poleIdList, String framePayload, String lightAddress) {
+
+ System.out.println("framePayload:" + framePayload);
List<LightTaskPoleRelation> lightTaskPoleRelationList = new ArrayList<>();
//鎴愬姛
List<LightTaskPoleRelation> success = new ArrayList<>();
@@ -471,9 +639,64 @@
}
for (Pole pole : poles) {
+ if (pole.getDeviceCode() == null || pole.getDeviceCode().equals("")) {
+ throw new BusinessException("缂栬緫鐨勭伅鏉嗘垨鍘熸湁浠诲姟鐨勭伅鏉嗕笉瀛樺湪mac,涓嶈兘涓嬪彂浠诲姟 璇锋鏌ョ伅鏉嗘槸鍚﹀瓨鍦ㄥ崟鐏�");
+ }
LightTaskPoleRelation lightTaskPoleRelation = new LightTaskPoleRelation();
lightTaskPoleRelation.setPoleId(pole.getId());
-// lightTaskPoleRelation.setTaskId(lightTask.getTaskId());
+ //鍏崇郴琛ㄦ彃鍏ョ伅澶村湴鍧�
+ lightTaskPoleRelation.setLightAddress(lightAddress);
+
+
+ // rrpc 鍙戠敓瀹氭椂鍛戒护
+// if ("FFFF".equals(lightAddress)) {
+// LightTaskPoleRelation lightTaskPoleRelation01 = new LightTaskPoleRelation();
+// lightTaskPoleRelation01.setPoleId(pole.getId());
+// lightTaskPoleRelation01.setLightAddress("0001");
+//
+// LightTaskPoleRelation lightTaskPoleRelation02 = new LightTaskPoleRelation();
+// lightTaskPoleRelation02.setPoleId(pole.getId());
+// lightTaskPoleRelation02.setLightAddress("0002");
+//
+// // 鐏ご1 rrpc 鍙戠敓瀹氭椂鍛戒护
+// try {
+// A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame01 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0001");
+// //鐏ご1
+// if (a5LightTimerRespInnerFrame01 == null) {
+// lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// fail.add(lightTaskPoleRelation01);
+// } else {
+// lightTaskPoleRelation01.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame01.getResponseStatus()));
+// success.add(lightTaskPoleRelation01);
+// }
+//
+// } catch (BusinessException e) {
+// lightTaskPoleRelation01.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// fail.add(lightTaskPoleRelation01);
+// }
+//
+// // 鐏ご2 rrpc 鍙戠敓瀹氭椂鍛戒护
+// try {
+// A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame02 = sendTimeRRpc(framePayload, pole.getDeviceCode(), "0002");
+// //鐏ご2
+// if (a5LightTimerRespInnerFrame02 == null) {
+// lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// fail.add(lightTaskPoleRelation02);
+// } else {
+// lightTaskPoleRelation02.setIssueStatus(HexUtil.hexToInt(a5LightTimerRespInnerFrame02.getResponseStatus()));
+// success.add(lightTaskPoleRelation02);
+// }
+//
+// } catch (BusinessException e) {
+// lightTaskPoleRelation02.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
+// fail.add(lightTaskPoleRelation02);
+// }
+//
+// lightTaskPoleRelationList.add(lightTaskPoleRelation01);
+// lightTaskPoleRelationList.add(lightTaskPoleRelation02);
+// } else {
+ lightTaskPoleRelation.setLightAddress(lightAddress);
+ lightTaskPoleRelation.setDeviceCode(pole.getDeviceCode());
// rrpc 鍙戠敓瀹氭椂鍛戒护
try {
A5LightTimerRespInnerFrame a5LightTimerRespInnerFrame = sendTimeRRpc(framePayload, pole.getDeviceCode(), lightAddress);
@@ -488,43 +711,34 @@
lightTaskPoleRelation.setIssueStatus(DeviceRespStatusEnums.OTHER_ERROR.getCode());
fail.add(lightTaskPoleRelation);
}
-
lightTaskPoleRelationList.add(lightTaskPoleRelation);
}
+
+// }
map.put("success", success);
map.put("fail", fail);
map.put("all", lightTaskPoleRelationList);
+ log.error("鍙戦�佹帶鍒跺櫒甯х粨鏋滐細{}", map);
return map;
}
@Transactional(rollbackFor = Exception.class)
- public boolean delLightTask(List<Long> taskIdList) {
+ public String delLightTask(List<Long> taskIdList) {
List<LightTask> lightTaskList = listByIds(taskIdList);
if (CollectionUtil.isEmpty(lightTaskList)) {
throw new BusinessException("鎵句笉鍒颁换鍔′俊鎭�");
}
- List<LightTaskPoleRelation> list = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList));
- if (list.size() != 0) {
- throw new BusinessException("鍒犻櫎浠诲姟澶辫触锛屽垹闄ょ殑浠诲姟鏈夌伅鏉嗘鍦ㄤ娇鐢�");
- }
+ //鍙栧嚭浠诲姟鍏崇郴
+ List<LightTaskPoleRelation> relations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList));
- // 鍒犻櫎浠诲姟
- if (!removeByIds(taskIdList)) {
- throw new BusinessException("鍒犻櫎浠诲姟澶辫触");
- }
+ //鍙栧嚭鐏潌id
+ List<Long> poleIds = relations.stream().map(LightTaskPoleRelation::getPoleId).distinct().collect(Collectors.toList());
- boolean del;
- // 鍒犻櫎缁戝畾鐏潌
-// if (!lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).notIn(LightTaskPoleRelation::getTaskId, taskIdList))) {
-// throw new BusinessException("鏈壘鍒颁换鍔�/鐏潌缁戝畾鍏崇郴");
-// }
-// lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList));
- taskIdList.forEach(taskId -> {
- lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId));
- });
-
+ //涓嬪彂娓呴櫎浠诲姟鎸囦护
+// boolean b = clearLightTask(lightTaskIds);
+ Map<String, List<LightTaskPoleRelation>> ffff = sendControllerFrame(poleIds, "", "FFFF");
/**
* 鍒犻櫎鎺х伅浠诲姟鏃ュ織璁板綍寮�濮�
*/
@@ -533,7 +747,30 @@
/**
* 鍒犻櫎鎺х伅浠诲姟鏃ュ織璁板綍缁撴潫
*/
- return true;
+ if (ffff.get("fail").size() == 0) {
+ //鍏ㄩ儴娓呴櫎鎴愬姛 鍒犻櫎鍏ㄩ儴浠诲姟鍏崇郴
+ lightTaskPoleRelationService.remove(Wrappers.lambdaQuery(LightTaskPoleRelation.class).in(LightTaskPoleRelation::getTaskId, taskIdList));
+ //鍒犻櫎浠诲姟
+ removeByIds(taskIdList);
+ return "浠诲姟鍒犻櫎鎴愬姛";
+ } else {
+ //閮ㄥ垎娓呴櫎鎴愬姛 鍒犻櫎鎴愬姛閮ㄥ垎鐨勪换鍔″叧绯�
+ ffff.get("success").forEach(lightTaskPoleRelation -> {
+ lightTaskPoleRelationService.remove(Wrappers.lambdaUpdate(LightTaskPoleRelation.class)
+ .eq(LightTaskPoleRelation::getPoleId, lightTaskPoleRelation.getPoleId()).eq(LightTaskPoleRelation::getTaskId, lightTaskPoleRelation.getTaskId()));
+ });
+ //鍒犻櫎浠诲姟
+ lightTaskList.forEach(
+ taskId -> {
+ List<LightTaskPoleRelation> poleRelations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getTaskId, taskId));
+ if (poleRelations.size() == 0) {
+ //涓嶅瓨鍦ㄤ换鍔″叧绯� 鍒犻櫎浠诲姟
+ removeById(taskId);
+ }
+ }
+ );
+ return "閮ㄥ垎浠诲姟鍒犻櫎鎴愬姛,娓呴櫎浠诲姟澶辫触鐨勪换鍔″強鏁版嵁淇濈暀";
+ }
}
/**
@@ -646,7 +883,6 @@
for (LightTaskPoleRelationBo bean : list) {
LightTaskDto lightTaskDto = new LightTaskDto();
- //TODO
BeanUtils.copyProperties(bean, lightTaskDto);
lightTaskDto.setWeekList(TaskOrderUtil.parseLightWeek2List(bean.getWeek()));
BigDecimal energySaving;
@@ -698,4 +934,41 @@
}
}
+
+ public boolean clearLightTask(List<Long> poleIds) {
+ Map<String, List<LightTaskPoleRelation>> ffff = sendControllerFrame(poleIds, "", "FFFF");
+ ffff.get("success").forEach(lightTaskPoleRelation -> {
+ lightTaskPoleRelationService.remove(Wrappers.lambdaUpdate(LightTaskPoleRelation.class).eq(LightTaskPoleRelation::getPoleId, lightTaskPoleRelation.getPoleId()).eq(LightTaskPoleRelation::getTaskId, lightTaskPoleRelation.getTaskId()));
+ });
+ return true;
+ }
+
+
+ public Map checkTask(LightTaskParam param) {
+ /**
+ * 閲嶅浠诲姟鐨勭伅澶�
+ */
+ String lightAddress = param.getLightAddress();
+ List<Long> poleIdList = param.getPoleIdList();
+ List<LightTaskPoleRelation> lightTaskPoleRelations = lightTaskPoleRelationService.list(Wrappers.lambdaQuery(LightTaskPoleRelation.class)
+ .in(LightTaskPoleRelation::getPoleId, poleIdList).eq(LightTaskPoleRelation::getLightAddress, param.getLightAddress()));
+ List<Long> taskIds = lightTaskPoleRelations.stream().map(LightTaskPoleRelation::getTaskId).collect(Collectors.toList());
+ List<Long> poleIds = lightTaskPoleRelations.stream().map(LightTaskPoleRelation::getPoleId).collect(Collectors.toList());
+ //poleIds涓噸澶嶅厓绱犲彧淇濈暀涓�涓�
+ taskIds = taskIds.stream().distinct().collect(Collectors.toList());
+ poleIds = poleIds.stream().distinct().collect(Collectors.toList());
+ Map map = new HashMap();
+ if (!lightTaskPoleRelations.isEmpty()) {
+
+ map.put("request", "false");
+ map.put("msg", "浠诲姟涓瓨鍦ㄥ凡鏈変换鍔$殑鍗曠伅," + "浠诲姟id涓簕" + taskIds + "}, "
+ + "鐏潌id涓簕" + poleIds + "}");
+// throw new BusinessException("浠诲姟涓瓨鍦ㄥ凡鏈変换鍔$殑鍗曠伅," + "浠诲姟id涓簕" + taskIds + "}, "
+// + "鐏潌id涓簕" + poleIds + "}");
+ } else {
+ map.put("request", "true");
+ map.put("msg", "浠诲姟涓棤閲嶅鐏潌鍦板潃");
+ }
+ return map;
+ }
}
--
Gitblit v1.9.3