From 9d25f1f915995603754646933934da945eb138d2 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期五, 07 一月 2022 17:30:19 +0800
Subject: [PATCH] 功能完善
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
index bc8b7a7..86ab0fd 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/PoleService.java
@@ -207,14 +207,14 @@
*/
- public boolean setMac(Long poleId) {
- Pole pole = getById(poleId);
- if (pole == null) {
+ public boolean setMac(String baseMac) {
+ //Pole pole = getById(poleId);
+ /* if (pole == null) {
throw new BusinessException("鏈壘鍒拌鐏潌");
- }
+ }*/
boolean setMac = false;
- String baseMac = "baseDevice";
+ // String baseMac = "baseDevice";
A1Frame a1Frame = new A1Frame(A1OrderEnum.REQUEST_READ_DEVICE_UNIQUE_MAC.getCode(), new EmptyRequestInnerFrame());
CommonFrame commonFrame = MainBoardInvokeSyncService.getInstance()
.sendRRPC(baseMac, a1Frame);
@@ -225,6 +225,10 @@
log.info(commonFrame.toString());
String uniqueMac = a1DeviceMacRespInnerFrame.getMac();
uniqueMac = uniqueMac.toLowerCase();
+
+ if(uniqueMac.isEmpty()){
+ throw new BusinessException("璇诲彇璁惧鍞竴ID澶辫触!");
+ }
log.info("鍞竴鐮亄}", uniqueMac);
// 2 浠庨樋閲屾敞鍐�
@@ -277,12 +281,23 @@
FrameBuilder.builderA2().innerFrame(new EmptyRequestInnerFrame())
.orderType(A2OrderEnum.REQUEST_MAIN_BOARD_RESET.getCode()).build());
if ("00".equals(rebootFrame.getPayload())) {
- pole.setDeviceCode(uniqueMac);
+ // pole.setDeviceCode(uniqueMac);
- setMac = updateById(pole);
+ // setMac = updateById(pole);
System.out.println("閲嶅惎鎴愬姛");
}
+
+ Pole pole=new Pole();
+ String strh = uniqueMac.substring(uniqueMac.length() -2,uniqueMac.length());
+ pole.setDeviceCode(strh);
+ pole.setPoleName(strh);
+ String strm = uniqueMac.substring(0,uniqueMac.length()-2);
+ int i = Integer.parseInt(strm);
+ pole.setPoleCode(generatePoleCode());
+ pole.setDeviceType(i);
+ setMac= save(pole);
+
return setMac;
}
--
Gitblit v1.9.3