From c8ce26aac0004e249a0cef35fe15b2ddb280ad25 Mon Sep 17 00:00:00 2001
From: liuhaonan <konodioda2333@vip.qq.com>
Date: 星期三, 27 四月 2022 15:51:10 +0800
Subject: [PATCH] 大气数据推送到LED
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/PoleController.java | 89 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 84 insertions(+), 5 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 4e046de..7e3eb33 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
@@ -2,25 +2,30 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.sandu.common.domain.CommonPage;
import com.sandu.common.domain.ResponseVO;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.util.ResponseUtil;
+import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.dto.DeviceStatus;
import com.sandu.ximon.admin.param.PoleBindParam;
import com.sandu.ximon.admin.param.PoleBindingParam;
import com.sandu.ximon.admin.param.PoleParam;
import com.sandu.ximon.admin.param.PoleStatesParam;
+import com.sandu.ximon.admin.security.PermissionConfig;
import com.sandu.ximon.admin.service.AirEquipmentService;
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.dao.domain.Pole;
+import com.sandu.ximon.dao.enums.MenuEnum;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.sql.Wrapper;
import java.util.List;
/**
@@ -37,6 +42,7 @@
private MonitorService monitorService;
private IpVolumeService broadcastTerminalV2Service;
private AirEquipmentService airEquipmentService;
+ private final PermissionConfig permissionConfig;
@PostMapping("/add")
public ResponseVO<Object> addPole(@RequestBody @Validated PoleParam param) {
@@ -55,8 +61,11 @@
@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);
+ List<Pole> results = poleService.queryAllStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), param);
CommonPage commonPage = CommonPage.restPage(results);
int size = results.size();
commonPage.setTotal((long) size);
@@ -65,15 +74,23 @@
commonPage.setTotalPage(size / baseConditionVO.getPageSize());
}
return ResponseUtil.success(commonPage);
- // return ResponseUtil.success(poles);
+ // return ResponseUtil.success(poles);
}
@GetMapping("/listPoleAndState")
public ResponseVO<Object> listPoleAndState(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "groupid", required = false) Long groupid) {
PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- List<Pole> poles = poleService.queryStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(),keyword,groupid);
+ List<Pole> poles = poleService.queryStatesAndList(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), keyword, groupid);
return ResponseUtil.successPage(poles);
+ }
+
+ /**
+ * 鍦ㄧ嚎鏁伴噺
+ */
+ @GetMapping("/online")
+ public ResponseVO<Object> online() {
+ return ResponseUtil.success(poleService.poleCount());
}
@@ -104,9 +121,15 @@
public ResponseVO<Object> bindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) {
boolean result = poleService.bindPole(poleId, param);
if (result) {
- //璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�
+ //璁惧绫诲瀷锛�0璺伅锛�1nove锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�, 10鐔欒, 11鍐滆��
switch (param.getDeviceType()) {
case 0:
+ Pole pole = poleService.getById(poleId);
+ if (pole != null) {
+ pole.setPoleName(param.getDeviceName());
+ pole.setDeviceCode(param.getDeviceCode());
+ poleService.updateById(pole);
+ }
break;
case 1:
break;
@@ -128,6 +151,10 @@
break;
case 9:
break;
+ case 10:
+ break;
+ case 11:
+ break;
default:
break;
}
@@ -145,9 +172,14 @@
public ResponseVO<Object> unBindPole(@PathVariable Long poleId, @RequestBody @Validated PoleBindingParam param) {
boolean result = poleService.unBindPole(poleId, param.getDeviceCode());
if (result) {
- //璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�
+ //璁惧绫诲瀷锛�0璺伅锛�1led灞忓箷锛�2鍏呯數妗╋紝3澶ф皵鐩戞祴锛�4姘磋川鐩戞祴锛�5ip闊虫煴锛�6lcd骞垮憡鏈猴紝7鎽勫儚澶达紝8鏉嗕綋鍊炬祴锛�9涓�閿晳鍔�, 10鐔欒, 11鍐滆��
switch (param.getDeviceType()) {
case 0:
+ //鍒犻櫎鐏潌鐨刣evicescode
+ Pole pole = poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, poleId));
+ if (pole != null) {
+ poleService.updateDeviceCode(pole.getId());
+ }
break;
case 1:
break;
@@ -168,6 +200,10 @@
case 8:
break;
case 9:
+ break;
+ case 10:
+ break;
+ case 11:
break;
default:
break;
@@ -200,4 +236,47 @@
}
+ /**
+ * 鏌ユ壘鑷繁鎷ユ湁鐨勭伅鏉�
+ */
+ @PostMapping("/getOwnerPole/{cilentId}")
+ public ResponseVO<Object> getOwnerPole(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword
+ , @PathVariable Long cilentId) {
+ List<Pole> results = poleService.getOwnerPole(baseConditionVO, keyword, cilentId);
+// 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());
+// }
+// return ResponseUtil.success(commonPage);
+ return ResponseUtil.success(results);
+ }
+
+ /**
+ * 鏌ョ湅鐏潌缁戝畾鐨勮澶�
+ */
+ @PostMapping("/getPoleBindDevice/{poleId}")
+ public ResponseVO<Object> getPoleBindDevice(@PathVariable Long poleId) {
+ return ResponseUtil.success(poleService.getBindByPoleId(poleId));
+ }
+
+
+ /**
+ * 鎺ㄩ�佸ぇ姘旇澶囧埌璇虹摝
+ */
+ @GetMapping("/pushAidDataToNova/{poleId}")
+ public ResponseVO<Object> pushAirDataToNova(@PathVariable Long poleId) {
+ return ResponseUtil.success(poleService.pushAirDataToNova(poleId));
+ }
+
+ /**
+ * 鎺ㄩ�佸ぇ姘旇澶囧埌鐔欒
+ */
+ @GetMapping("/pushAirDataToXiXun/{poleId}")
+ public ResponseVO<Object> pushAirDataToXiXun(@PathVariable Long poleId) {
+ return ResponseUtil.success(poleService.pushAirDataToXiXun(poleId));
+ }
+
}
--
Gitblit v1.9.3