From c90e9e6d615b94aec96969b59d1eaecffaf8d0ef Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期二, 28 六月 2022 18:07:50 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java | 146 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 122 insertions(+), 24 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 f5ed65b..3f6aaf8 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
@@ -18,10 +18,11 @@
import com.sandu.ximon.admin.manager.iot.rrpc.mainboard.MainBoardInvokeSyncService;
import com.sandu.ximon.admin.param.C3ChargingAddParam;
import com.sandu.ximon.admin.param.C3ChargingParam;
-import com.sandu.ximon.admin.param.PoleBindingParam;
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.utils.StoreOperationRecordsUtils;
+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;
@@ -33,6 +34,7 @@
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -57,17 +59,11 @@
* @return 鏄惁鎴愬姛
*/
public boolean updateReportState(String deviceName, String c3Mac, String statusBit, String deviceTemperature) {
- C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, c3Mac));
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Mac, c3Mac));
if (one != null) {
-// one.setStatusBit(Integer.valueOf(statusBit));
one.setDeviceTemperature(deviceTemperature);
one.setPoleDevicesCode(deviceName);
one.setC3Mac(c3Mac);
-
-// List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, one.getC3Id()));
-// if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃� 娣诲姞榛樿璐圭巼
-// c3mChargingChargeService.initCharge((one.getC3Id()).intValue());
-// }
return updateById(one);
} else {
return false;
@@ -89,24 +85,17 @@
c3mCharging.setPoleDevicesCode(deviceName);
c3mCharging.setC3Mac(c3Mac);
flag = save(c3mCharging);
- //璁剧疆璐圭巼
- C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
- List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
- if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃� 娣诲姞榛樿璐圭巼
- c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
- }
-
} else {
//灏嗚澶囦俊鎭坊鍔犲埌鍏呯數妗╄澶囪〃
one.setPoleDevicesCode(deviceName);
one.setC3Mac(c3Mac);
flag = updateById(one);
- //璁剧疆璐圭巼
- C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
- List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
- if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃� 娣诲姞榛樿璐圭巼
- c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
- }
+ }
+ //璁剧疆璐圭巼
+ C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
+ List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, c3mCharging1.getC3Id()));
+ if (list.size() == 0) {//璐圭巼琛ㄤ腑娌℃湁姝ゅ厖鐢垫々鏁版嵁鏃� 娣诲姞榛樿璐圭巼
+ c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
}
// /**
// * 娣诲姞缁戝畾鍏崇郴寮�濮�
@@ -240,6 +229,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;
+ }
+
/**
* 寮�濮嬪厖鐢�
@@ -260,6 +301,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-寮�濮嬪厖鐢�", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
@@ -293,7 +335,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
-
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-缁撴潫鍏呯數", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -323,6 +365,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鍚屾缁撴潫", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -351,6 +395,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-浜岀淮鐮�", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -380,6 +426,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鐗堟湰鏌ヨ", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -409,6 +457,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ蹇冭烦鍖呴棿闅旀椂闂�", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
@@ -438,6 +487,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鐢靛帇/鐢垫祦甯告暟", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -467,6 +518,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鍦板潃", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -496,6 +549,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鏌ヨ鏁呴殰鐮�", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -525,6 +580,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璇诲彇蹇冭烦鍖�", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -558,6 +615,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆蹇冭烦鍖呴棿闅旀椂闂�", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -589,6 +648,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鐢靛帇/鐢垫祦甯告暟", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -629,6 +690,8 @@
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鍦板潃", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -666,6 +729,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-璁剧疆鏃ュ巻", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
@@ -697,6 +761,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-娓呴櫎鏁呴殰鐮佷笂鎶�", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
@@ -728,6 +793,7 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-鎭㈠鍑哄巶璁剧疆", a5Frame, commonFrame);
System.out.println(commonFrame + " -----commonFrame");
@@ -756,7 +822,8 @@
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
-// CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC("32313243305008ff1a06ffff", a5Frame);
+ StoreOperationRecordsUtils.storeInnerFrameData(c3Mac, "C3甯�-杞噸鍚�", a5Frame, commonFrame);
+
System.out.println(commonFrame + " -----commonFrame");
@@ -784,7 +851,23 @@
c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
}
c3mCharging.setC3Mac(c3ChargingAddParam.getC3Mac());
- return save(c3mCharging);
+ /**
+ * 娣诲姞鍏呯數妗� 鏃ュ織璁板綍寮�濮�
+ */
+ List<String> listCode = new ArrayList<>(1);
+ listCode.add(c3mCharging.getMcuUdid());
+ String content = "{璁惧code锛�" + c3mCharging.getMcuUdid() + "璁惧鍚�:" + c3mCharging.getC3Name() +
+ "}";
+
+ StoreOperationRecordsUtils.storeOperationData(listCode, null, "娣诲姞鍏呯數妗�", content);
+ /**
+ * 娣诲姞鍏呯數妗� 鏃ュ織璁板綍缁撴潫
+ */
+
+ return
+
+ save(c3mCharging);
+
}
public boolean updateC3ChargingName(C3ChargingAddParam c3ChargingAddParam) {
@@ -799,6 +882,21 @@
C3mCharging c3mCharging = new C3mCharging();
c3mCharging.setC3Id(c3ChargingAddParam.getC3Id());
c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
+
+ /**
+ * 淇敼鍏呯數妗� 鏃ュ織璁板綍寮�濮�
+ */
+ List<String> listCode = new ArrayList<>(1);
+ listCode.add(c3mCharging.getMcuUdid());
+ String content = "{璁惧code锛�" + c3mCharging.getMcuUdid() + "璁惧鍘熷悕:" + one.getC3Name() + "鏇存敼鍚庣殑璁惧鍚�:" + c3mCharging.getC3Name() +
+ "}";
+
+ StoreOperationRecordsUtils.storeOperationData(listCode, null, "缂栬緫鍏呯數妗�", content);
+ /**
+ * 淇敼鍏呯數妗� 鏃ュ織璁板綍缁撴潫
+ */
+
+
return updateById(c3mCharging);
}
--
Gitblit v1.9.3