From 4dd900d3ba36d12adf860eb5a28a40589f55e0a2 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期三, 07 九月 2022 18:29:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 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 9cf84ce..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
@@ -643,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);
+ }
}
/**
@@ -899,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