From 9f21969b69703a35bde9d659be19f3e39795010d Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 12 五月 2022 11:58:01 +0800
Subject: [PATCH] fix
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java | 86 ++++++++++++++++++++++++------------------
1 files changed, 49 insertions(+), 37 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..3f35397 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")
@@ -128,7 +141,6 @@
return ResponseUtil.success(poleService.poleReset(poleId));
}
-//TODO 璁惧鐨勭粦瀹氳В缁戦兘瑕佸崟鐙噸鏂板鐞�
/**
* 鐏潌缁戝畾璁惧
@@ -141,8 +153,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 +162,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 +207,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;
--
Gitblit v1.9.3