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/PoleService.java | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index ded784c..95f7215 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -262,12 +262,13 @@
String orderBy = "t1." + orderByResult + " " + orderBySeq;
List<Pole> poleList;
+ Integer center = param.getCenter();
if (SecurityUtils.getClientId() == null) {
poleList = poleMapper.queryPoleOnLineStatesList(null, param.getIsTrue(),
- param.getBingStates(), param.getGroupid(), param.getKeyword(), param.getCenter(), orderBy);
+ param.getBingStates(), param.getGroupid(), param.getKeyword(), center, orderBy);
} else {
poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(),
- param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword(), param.getCenter(), orderBy);
+ param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword(), center, orderBy);
}
poleList.forEach(
@@ -642,10 +643,13 @@
boolean result = saveOrUpdate(pole);
if (result) {
- Light light = new Light();
- light.setDeviceCode(uniqueMac);
- light.setLightCount(2);
- SpringContextHolder.getBean(LightService.class).save(light);
+ Light light = SpringContextHolder.getBean(LightService.class).getOne(Wrappers.lambdaQuery(Light.class).eq(Light::getDeviceCode, pole.getDeviceCode()).last("limit 1"));
+ if (light == null) {
+ light = new Light();
+ light.setDeviceCode(uniqueMac);
+ light.setLightCount(2);
+ SpringContextHolder.getBean(LightService.class).save(light);
+ }
}
/**
@@ -898,8 +902,10 @@
throw new BusinessException("璁惧涓嶅瓨鍦�");
}
//鍏抽棴鎺ㄩ��
- SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
-
+ String clear = SpringContextHolder.getBean(LightemitUtils.class).clear(xixun.getDeviceCode());
+ if (clear.contains("is not") || clear.contains("does not")) {
+ throw new BusinessException("璁惧涓嶅湪绾挎垨璁惧鏈瓨鍦ㄤ簬鏈嶅姟鍣�");
+ }
}
/**
--
Gitblit v1.9.3