From 981055073317b3b07534d5ac504a4e470e87f3d8 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期三, 30 三月 2022 11:04:22 +0800
Subject: [PATCH] 摄像头
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java | 136 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 108 insertions(+), 28 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 68989bb..2a70fe6 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
@@ -13,8 +13,11 @@
import com.sandu.ximon.admin.manager.iot.rrpc.dto.CommonFrame;
import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum;
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.dao.domain.C3mCharging;
import com.sandu.ximon.dao.domain.C3mChargingCharge;
+import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.domain.PoleBinding;
import com.sandu.ximon.dao.mapper.C3mChargingMapper;
import lombok.AllArgsConstructor;
@@ -35,24 +38,47 @@
private final C3mChargingChargeService c3mChargingChargeService;
private final PoleBindingService bindingService;
+ private final PoleService poleService;
/**
* 淇濆瓨涓婃姤C3鍏呯數璁惧蹇冭烦鏁版嵁
*
* @return 鏄惁鎴愬姛
*/
- public boolean saveReportData(String deviceName, A5C3HeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage) {
- C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, deviceName));
+ public boolean updateReportState(String deviceName, String c3Mac, String statusBit, String deviceTemperature) {
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getPoleDevicesCode, deviceName));
+ 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;
+ }
+ }
+
+ /**
+ * 淇濆瓨涓婃姤C3鍏呯數璁惧蹇冭烦鏁版嵁
+ *
+ * @return 鏄惁鎴愬姛
+ */
+ public boolean saveReporEquipment(String deviceName, String mcuUdid, String c3Mac) {
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, mcuUdid));
if (one == null) {
//灏嗚澶囦俊鎭坊鍔犲埌鍏呯數妗╄澶囪〃
C3mCharging c3mCharging = new C3mCharging();
- c3mCharging.setMcuUdid(deviceName);
- c3mCharging.setC3Mac(heartBeatDataPackage.getC3Mac());
- c3mCharging.setStatusBit(Integer.valueOf(heartBeatDataPackage.getStatusBit()));
- c3mCharging.setDeviceTemperature(heartBeatDataPackage.getDeviceTemperature());
+ c3mCharging.setMcuUdid(mcuUdid);
+ c3mCharging.setPoleDevicesCode(deviceName);
+ c3mCharging.setC3Mac(c3Mac);
boolean flag = save(c3mCharging);
//璁剧疆璐圭巼
- C3mCharging c3mCharging1 = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, deviceName));
+ 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());
@@ -60,13 +86,18 @@
return flag;
} else {
- one.setStatusBit(Integer.valueOf(heartBeatDataPackage.getStatusBit()));
- one.setDeviceTemperature(heartBeatDataPackage.getDeviceTemperature());
- List<C3mChargingCharge> list = c3mChargingChargeService.list(Wrappers.lambdaQuery(C3mChargingCharge.class).eq(C3mChargingCharge::getC3Id, one.getC3Id()));
+ //灏嗚澶囦俊鎭坊鍔犲埌鍏呯數妗╄澶囪〃
+ one.setPoleDevicesCode(deviceName);
+ one.setC3Mac(c3Mac);
+ boolean 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((one.getC3Id()).intValue());
+ c3mChargingChargeService.initCharge((c3mCharging1.getC3Id()).intValue());
}
- return updateById(one);
+
+ return flag;
}
}
@@ -98,7 +129,7 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
System.out.println(commonFrame + " -----commonFrame");
@@ -131,7 +162,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -160,7 +192,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -188,7 +221,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3QueryReportInnerFrame a5C3QueryReportInnerFrame = new A5C3QueryReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -216,7 +250,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3QueryReportInnerFrame queryReportInnerFrame = new A5C3QueryReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -244,7 +279,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3QueryReportInnerFrame queryReportInnerFrame = new A5C3QueryReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -272,7 +308,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3QueryReportInnerFrame queryReportInnerFrame = new A5C3QueryReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -300,7 +337,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3QueryReportInnerFrame queryReportInnerFrame = new A5C3QueryReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -328,7 +366,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3HeartbeatReportInnerFrame heartbeatReportInnerFrame = new A5C3HeartbeatReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -360,7 +399,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -390,7 +430,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -423,7 +464,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -453,7 +495,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -483,7 +526,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -513,7 +557,8 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -540,7 +585,9 @@
if (c3mCharging == null) {
throw new BusinessException("C3鍏呯數妗╃‖浠秏cu_udid涓嶅瓨鍦�");
}
- CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getMcuUdid(), a5Frame);
+ CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC(c3mCharging.getPoleDevicesCode(), a5Frame);
+// CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance().sendRRPC("32313243305008ff1a06ffff", a5Frame);
+
System.out.println(commonFrame + " -----commonFrame");
A5C3OperationReportInnerFrame operationReportInnerFrame = new A5C3OperationReportInnerFrame().transformFrame(commonFrame.getPayload());
@@ -552,6 +599,39 @@
}
}
+ public boolean addC3Charging(C3ChargingAddParam c3ChargingAddParam) {
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, c3ChargingAddParam.getMcuUdid()));
+ if (one != null) {
+ throw new BusinessException("纭欢璁惧宸插瓨鍦紒");
+ }
+
+ if (c3ChargingAddParam.getC3Name() == null || c3ChargingAddParam.getMcuUdid() == null) {
+ throw new BusinessException("娣诲姞C3鍏呯數妗╄澶囧嚭閿欙紒");
+ }
+ C3mCharging c3mCharging = new C3mCharging();
+ c3mCharging.setMcuUdid(c3ChargingAddParam.getMcuUdid());
+ if (c3ChargingAddParam.getC3Name() != null) {
+ c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
+ }
+ c3mCharging.setC3Mac(c3ChargingAddParam.getC3Mac());
+ return save(c3mCharging);
+ }
+
+ public boolean updateC3ChargingName(C3ChargingAddParam c3ChargingAddParam) {
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getC3Id, c3ChargingAddParam.getC3Id()));
+ if (one == null) {
+ throw new BusinessException("纭欢璁惧涓嶅瓨鍦紒");
+ }
+
+ if (c3ChargingAddParam.getC3Id() == null || c3ChargingAddParam.getC3Name() == null) {
+ throw new BusinessException("娣诲姞C3鍏呯數妗╄澶囧嚭閿欙紒");
+ }
+ C3mCharging c3mCharging = new C3mCharging();
+ c3mCharging.setC3Id(c3ChargingAddParam.getC3Id());
+ c3mCharging.setC3Name(c3ChargingAddParam.getC3Name());
+ return updateById(c3mCharging);
+ }
+
public C3mCharging getC3mByPoleId(Long poleId) {
PoleBinding one = bindingService.getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceType, 2).eq(PoleBinding::getPoleId, poleId));
if (one == null) {
--
Gitblit v1.9.3