From 0d2e4e6b8954d77dd34664f861135ae41f7eb828 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 13 五月 2022 10:31:34 +0800
Subject: [PATCH] 单灯数据直接下载
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java | 87 +++++++++++++++++++++++++++++++++++--------
1 files changed, 70 insertions(+), 17 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 ae16224..06d4839 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);
/**
* 娣诲姞缁戝畾鍏崇郴缁撴潫
@@ -240,6 +241,58 @@
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());
+ equipmentInfo.setEquipmentName(one.getC3Name());
+ }
+ return equipmentInfo;
+ }
+
/**
* 寮�濮嬪厖鐢�
--
Gitblit v1.9.3