From 31e798604209979bb9e93652dc0b0ac8d4d61538 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期二, 17 五月 2022 17:54:16 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java | 90 ++++++++++++++++++++++++--------------------
1 files changed, 49 insertions(+), 41 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
index 43fd2ce..ace0d00 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java
@@ -19,12 +19,15 @@
import com.sandu.ximon.admin.service.IpVolumeService;
import com.sandu.ximon.admin.service.MonitorService;
import com.sandu.ximon.admin.service.PoleService;
+import com.sandu.ximon.admin.vo.PoleBindVO;
import com.sandu.ximon.dao.domain.Pole;
import com.sandu.ximon.dao.enums.MenuEnum;
+import com.sandu.ximon.dao.enums.PoleBindingEnums;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -67,22 +70,32 @@
return ResponseUtil.success(poleService.deletePole(poleId));
}
+ @PostMapping("/listDetail")
+ public ResponseVO<Object> listPoleDetail(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
+ if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
+ List<Pole> listCommonPage = (List<Pole>) commonPage.getList();
+
+ List<PoleBindVO> listResult = new ArrayList<>();
+ for (Pole pole : listCommonPage) {
+ PoleBindVO bindByPoleId = poleService.getBindByPoleId(pole.getId());
+ bindByPoleId.setPole(pole);
+ listResult.add(bindByPoleId);
+ }
+ commonPage.setList(listResult);
+ return ResponseUtil.success(commonPage);
+ }
+
@PostMapping("/list")
public ResponseVO<Object> listPole(BaseConditionVO baseConditionVO, @RequestBody PoleStatesParam param) {
if (!permissionConfig.check(MenuEnum.POLE_LIST.getCode())) {
return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
}
- PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
- CommonPage commonPage = CommonPage.restPage(results);
- int size = results.size();
- commonPage.setTotal((long) size);
- commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
- if (size % baseConditionVO.getPageSize() == 0) {
- commonPage.setTotalPage(size / baseConditionVO.getPageSize());
- }
+ CommonPage commonPage = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
+
return ResponseUtil.success(commonPage);
- // return ResponseUtil.success(poles);
}
@GetMapping("/listPoleAndState")
@@ -99,7 +112,6 @@
/**
* 鍦ㄧ嚎鏁伴噺
*/
- @AnonymousAccess
@GetMapping("/online")
public ResponseVO<Object> online() {
return ResponseUtil.success(poleService.poleCount());
@@ -128,7 +140,6 @@
return ResponseUtil.success(poleService.poleReset(poleId));
}
-//TODO 璁惧鐨勭粦瀹氳В缁戦兘瑕佸崟鐙噸鏂板鐞�
/**
* 鐏潌缁戝畾璁惧
@@ -141,8 +152,8 @@
boolean result = poleService.bindPole(poleId, param);
if (result) {
//璁惧绫诲瀷锛�0璺伅锛�1nove锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�, 10鐔欒, 11鍐滆��
- switch (param.getDeviceType()) {
- case 0:
+ switch (param.getDeviceType().toString()) {
+ case PoleBindingEnums.LIGHT:
Pole pole = poleService.getById(poleId);
if (pole != null) {
pole.setPoleName(param.getDeviceName());
@@ -150,29 +161,29 @@
poleService.updateById(pole);
}
break;
- case 1:
+ case PoleBindingEnums.VONNOX:
break;
- case 2:
+ case PoleBindingEnums.CHARGING_PILE:
break;
- case 3:
+ case PoleBindingEnums.ATMOSPHERIC:
break;
- case 4:
+ case PoleBindingEnums.WATER:
break;
- case 5:
+ case PoleBindingEnums.IPVOLUME:
broadcastTerminalV2Service.updateBingdingState(true, Integer.valueOf(param.getDeviceCode()).intValue());
break;
- case 6:
+ case PoleBindingEnums.LCD_ADVERTISING:
break;
- case 7:
+ case PoleBindingEnums.MONITOR:
monitorService.updateBingdingState(true, param.getDeviceCode());
break;
- case 8:
+ case PoleBindingEnums.LIGHTPOLEHEELING:
break;
- case 9:
+ case PoleBindingEnums.FOR_HELP:
break;
- case 10:
+ case PoleBindingEnums.XIXUN:
break;
- case 11:
+ case PoleBindingEnums.ATMOSPHERIC_NONG_GENG:
break;
default:
break;
@@ -195,37 +206,37 @@
boolean result = poleService.unBindPole(poleId, param.getDeviceCode());
if (result) {
//璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�, 10鐔欒, 11鍐滆��
- switch (param.getDeviceType()) {
- case 0:
+ switch (param.getDeviceType().toString()) {
+ case PoleBindingEnums.LIGHT:
//鍒犻櫎鐏潌鐨刣evicescode
Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
if (pole != null) {
poleService.updateDeviceCode(pole.getId());
}
break;
- case 1:
+ case PoleBindingEnums.VONNOX:
break;
- case 2:
+ case PoleBindingEnums.CHARGING_PILE:
break;
- case 3:
+ case PoleBindingEnums.ATMOSPHERIC:
break;
- case 4:
+ case PoleBindingEnums.WATER:
break;
- case 5:
+ case PoleBindingEnums.IPVOLUME:
broadcastTerminalV2Service.updateBingdingState(false, Integer.valueOf(param.getDeviceCode()).intValue());
break;
- case 6:
+ case PoleBindingEnums.LCD_ADVERTISING:
break;
- case 7:
+ case PoleBindingEnums.MONITOR:
monitorService.updateBingdingState(false, param.getDeviceCode());
break;
- case 8:
+ case PoleBindingEnums.LIGHTPOLEHEELING:
break;
- case 9:
+ case PoleBindingEnums.FOR_HELP:
break;
- case 10:
+ case PoleBindingEnums.XIXUN:
break;
- case 11:
+ case PoleBindingEnums.ATMOSPHERIC_NONG_GENG:
break;
default:
break;
@@ -280,7 +291,6 @@
/**
* 鏌ョ湅鐏潌缁戝畾鐨勮澶�
*/
- @AnonymousAccess
@PostMapping("/getPoleBindDevice/{poleId}")
public ResponseVO<Object> getPoleBindDevice(@PathVariable Long poleId) {
if (!permissionConfig.check(MenuEnum.GET_POLE_BINDING.getCode())) {
@@ -293,7 +303,6 @@
/**
* 鎺ㄩ�佸ぇ姘旇澶囧埌璇虹摝
*/
- @AnonymousAccess
@GetMapping("/pushAidDataToNova/{poleId}")
public ResponseVO<Object> pushAirDataToNova(@PathVariable Long poleId) {
if (!permissionConfig.check(MenuEnum.PUSH_AIR_DATA_TO_NOVA.getCode())) {
@@ -305,7 +314,6 @@
/**
* 鎺ㄩ�佸ぇ姘旇澶囧埌鐔欒
*/
- @AnonymousAccess
@GetMapping("/pushAirDataToXiXun/{poleId}")
public ResponseVO<Object> pushAirDataToXiXun(@PathVariable Long poleId) {
if (!permissionConfig.check(MenuEnum.PUSH_AIR_DATA_TO_XIXUN.getCode())) {
--
Gitblit v1.9.3