From 326334dbf5de8eeb09cdf8dd7a4511ab821e12ff Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 10 五月 2022 18:23:41 +0800
Subject: [PATCH] Changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java | 88 +++++++++++++++++++++++++++++++++++---------
1 files changed, 70 insertions(+), 18 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
index b179dcf..2b119f6 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java
@@ -22,6 +22,7 @@
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.utils.LogUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
+import com.sandu.ximon.admin.vo.EquipmentInfomation;
import com.sandu.ximon.dao.bo.C3ChargingBo;
import com.sandu.ximon.dao.domain.C3mCharging;
import com.sandu.ximon.dao.domain.C3mChargingCharge;
@@ -108,23 +109,23 @@
c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
}
}
- /**
- * 娣诲姞缁戝畾鍏崇郴寮�濮�
- */
- Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
- if (pole == null) {
- Pole pole1 = new Pole();
- pole1.setDeviceCode(deviceName);
- pole1.setPoleName(deviceName);
- pole1.setPoleCode(poleService.generatePoleCode());
- poleService.save(pole1);
- }
-
- Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId();
- PoleBindingParam poleBindingParam = new PoleBindingParam();
- poleBindingParam.setDeviceType(2);
- poleBindingParam.setDeviceCode(mcuUdid);
- bindingService.bindPole(poleId, poleBindingParam);
+// /**
+// * 娣诲姞缁戝畾鍏崇郴寮�濮�
+// */
+// Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName));
+// if (pole == null) {
+// Pole pole1 = new Pole();
+// pole1.setDeviceCode(deviceName);
+// pole1.setPoleName(deviceName);
+// pole1.setPoleCode(poleService.generatePoleCode());
+// poleService.save(pole1);
+// }
+//
+// Long poleId = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, deviceName)).getId();
+// PoleBindingParam poleBindingParam = new PoleBindingParam();
+// poleBindingParam.setDeviceType(2);
+// poleBindingParam.setDeviceCode(mcuUdid);
+// bindingService.bindPole(poleId, poleBindingParam);
/**
* 娣诲姞缁戝畾鍏崇郴缁撴潫
@@ -238,6 +239,57 @@
one.setStatusBit(0);
}
return one;
+ }
+
+ /**
+ * 棣栭〉鐏潌缁戝畾淇℃伅
+ *
+ * @return
+ */
+ public EquipmentInfomation getByC3MacInfo(String udid) {
+ EquipmentInfomation equipmentInfo = new EquipmentInfomation();
+ equipmentInfo.setEquipmentType("C3鍏呯數妗�");
+ if (udid == null || udid.trim().length() == 0) {
+ return equipmentInfo;
+ }
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, udid));
+ if (one != null) {
+ String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
+ if (s != null) {
+ try {
+ A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage beatDataPackage = JSON.parseObject(s, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage.class);
+ switch (beatDataPackage.getStatusBit()) {
+ case "1":
+ equipmentInfo.setEquipmentState("绌洪棽");
+ break;
+ case "2":
+ equipmentInfo.setEquipmentState("鍏呯數涓�");
+ break;
+ case "3":
+ equipmentInfo.setEquipmentState("鍏呯數涓柇锛岀瓑寰呮湇鍔″櫒纭");
+ break;
+ case "4":
+ equipmentInfo.setEquipmentState("鍏呯數缁撴潫锛岀瓑寰呮湇鍔″櫒纭");
+ break;
+ case "5":
+ equipmentInfo.setEquipmentState("鏈夋晠闅�");
+ break;
+ case "6":
+ equipmentInfo.setEquipmentState("涓庡厖鐢垫々瀵规帴涓�");
+ break;
+ default:
+ equipmentInfo.setEquipmentState("鏈煡");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ equipmentInfo.setEquipmentState("绂荤嚎");
+ }
+ equipmentInfo.setEquipmentCreateTime(one.getUpdateTime());
+ equipmentInfo.setEquipmentMac(one.getMcuUdid());
+ }
+ return equipmentInfo;
}
@@ -807,7 +859,7 @@
if (one == null) {
throw new BusinessException("鏈壘鍒扮粦瀹氬叧绯�");
}
- return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, one.getDeviceCode()));
+ return getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, one.getDeviceCode()));
}
--
Gitblit v1.9.3