From f92e7a801cb5e59bd2391641eccad67036513b8a Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 15 四月 2022 15:00:14 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/C3ChargingService.java | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 2 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 33736e7..5f5ad5a 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,11 +18,13 @@
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.utils.LogUtils;
import com.sandu.ximon.admin.utils.RedisUtils;
import com.sandu.ximon.dao.bo.C3ChargingBo;
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;
@@ -105,6 +107,28 @@
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);
+
+ /**
+ * 娣诲姞缁戝畾鍏崇郴缁撴潫
+ */
+
//鍚屾鏃堕棿鎴�
String date = new SimpleDateFormat("yyMMddHHmmss").format(new Date());
String s = SetCalendar(c3Mac, Integer.parseInt(date.substring(0, 2)), Integer.parseInt(date.substring(2, 4)),
@@ -172,9 +196,9 @@
List<C3ChargingBo> c3ChargingBoList = c3mChargingMapper.listC3mChargingDto(c3ChargingParam.getKeyword());
for (C3ChargingBo one : c3ChargingBoList) {
String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
- if(s != null){
+ if (s != null) {
one.setStatusBit(1);
- }else{
+ } else {
one.setStatusBit(0);
}
@@ -183,6 +207,23 @@
}
/**
+ * 鏌ヨ鍏呯數妗�
+ *
+ * @return
+ */
+ public C3mCharging getByC3Mac(String udid) {
+ C3mCharging one = getOne(Wrappers.lambdaQuery(C3mCharging.class).eq(C3mCharging::getMcuUdid, udid));
+ String s = RedisUtils.getBean().get(C3mRedisConstant.C3_STATUS.getCode() + one.getC3Mac());
+ if (s != null) {
+ one.setStatusBit(1);
+ } else {
+ one.setStatusBit(0);
+ }
+ return one;
+ }
+
+
+ /**
* 寮�濮嬪厖鐢�
*
* @param c3Mac
--
Gitblit v1.9.3