From bfce748e37a753c729e15dd233600379f504d019 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 28 四月 2022 13:59:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java | 148 ++++++++++++++++++++++--------------------------
1 files changed, 68 insertions(+), 80 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
index e04c73a..414ab56 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java
@@ -1,15 +1,14 @@
package com.sandu.ximon.admin.controller;
-import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-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.execption.BusinessException;
import com.sandu.common.object.BaseConditionVO;
import com.sandu.common.util.ResponseUtil;
+import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.entity.ProgramPro;
import com.sandu.ximon.admin.param.LEDScheduleParam_xixun;
import com.sandu.ximon.admin.param.SetBrightnessParam;
@@ -19,11 +18,9 @@
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.service.*;
import com.sandu.ximon.admin.utils.LightemitUtils;
-import com.sandu.ximon.dao.domain.Pole;
-import com.sandu.ximon.dao.domain.PoleBinding;
+import com.sandu.ximon.admin.vo.LedScheduleVO;
import com.sandu.ximon.dao.domain.PoleLightemitEntity;
import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
-import com.sandu.ximon.dao.enums.AdministratorEnums;
import com.sandu.ximon.dao.enums.MenuEnum;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@@ -135,6 +132,13 @@
return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
}
+ //鎵ц涓殑鑺傜洰
+ @GetMapping("/getProgram/{lightemitId}")
+ public ResponseVO<Object> getProgram(@PathVariable Long lightemitId) {
+ return ResponseUtil.success(xiXunPlayerService.getByPid(lightemitId));
+ }
+
+
/**
* LED灞忓箷鏂板
*
@@ -148,7 +152,11 @@
throw new BusinessException("LED鎺у埗鍗$紪鍙蜂笉鑳介噸澶�");
}
- poleLightemit.setCreateUserId(SecurityUtils.getClientId());
+ if (SecurityUtils.getClientId() == null) {
+ poleLightemit.setClientId(clientService.getClientId());
+ poleLightemit.setUserId(SecurityUtils.getUserId());
+ poleLightemit.setCreateUserId(SecurityUtils.getUserId());
+ }
poleLightemitService.savePoleLightemit(poleLightemit);
@@ -195,8 +203,16 @@
@GetMapping("/listLed")
public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "isOnLine", required = false) boolean isOnLine) {
-
+ if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
List<PoleLightemitEntity> poleLightemitEntityList = poleLightemitService.listLed(keyword, isOnLine);
+ poleLightemitEntityList.forEach(
+ led -> {
+ led.setStreetlightId(led.getPoleId());
+ led.setStreetlightName(led.getPoleName());
+ }
+ );
CommonPage commonPage = CommonPage.restPage(poleLightemitEntityList);
int size = poleLightemitEntityList.size();
@@ -206,79 +222,6 @@
commonPage.setTotalPage(size / baseConditionVO.getPageSize());
}
return ResponseUtil.success(commonPage);
-
-
-// if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) {
-// return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
-// }
-// PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
-// LambdaQueryWrapper<PoleLightemitEntity> wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
-// if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
-// boolean clientId = clientService.findClientId();
-// if (clientId) {
-// wrapper = wrapper.eq(PoleLightemitEntity::getUserId, SecurityUtils.getUserId());
-// }
-// wrapper = wrapper.eq(PoleLightemitEntity::getClientId, clientService.getClientId());
-// }
-// wrapper = Wrappers.lambdaQuery(PoleLightemitEntity.class);
-// if (StrUtil.isNotBlank(keyword)) {
-// wrapper.like(PoleLightemitEntity::getLightemitName, keyword).or(
-// lambdaQueryWrapper -> {
-// lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword);
-// }
-// );
-// }
-// List<PoleBinding> bindings = bindingService.list(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceType, 1));
-// List<PoleLightemitEntity> list = poleLightemitService.list(wrapper);
-// if (isOnLine) {
-// List<PoleLightemitEntity> results = poleLightemitService.ledOnline(list);
-// results.forEach(
-// led -> {
-// bindings.forEach(
-// bind -> {
-// if (bind.getDeviceCode() != null && led.getLightemitControlCode() == bind.getDeviceCode()) {
-// led.setStreetlightId(bind.getPoleId());
-// System.out.println("鏈夋病鏈夎繍琛屽埌杩欓噷?---------------" + bind.getPoleId());
-// led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
-// }
-// }
-// );
-// }
-// );
-// 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);
-// } else {
-// poleLightemitService.ledOnlineCheck(list);
-// list.forEach(
-// led -> {
-// bindings.forEach(
-// bind -> {
-// if (bind.getDeviceCode() != null && led.getLightemitControlCode().equals(bind.getDeviceCode())) {
-// led.setStreetlightId(bind.getPoleId());
-// System.out.println("鏈夋病鏈夎繍琛屽埌杩欓噷?---------------" + bind.getPoleId());
-// led.setStreetlightName(poleService.getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getId, bind.getPoleId())).getPoleName());
-// }
-// }
-// );
-// }
-// );
-// CommonPage commonPage = CommonPage.restPage(list);
-// int size = list.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(list);
-// }
-//// return ResponseUtil.success(poleLightemitService.list(wrapper));
}
/**
@@ -449,5 +392,50 @@
return ResponseUtil.success("璁剧疆鎴愬姛");
}
+ /**
+ * 鑾峰彇鎵ц涓殑瀹氭椂
+ * @param
+ * @return
+ */
+ @GetMapping("/getPushSchedule")
+ public ResponseVO<Object> getPushSchedule(@RequestBody List<Long> ids) {
+ if(ids.isEmpty()){
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ List<LedScheduleVO> list = new ArrayList<>();
+ for(Long id : ids) {
+ LedScheduleVO ledScheduleVO = scheduleService.getledschedules(id);
+ list.add(ledScheduleVO);
+ }
+ return ResponseUtil.success(list);
+ }
+
+
+ /**
+ * 鍏抽棴澶╂皵鎺ㄩ��
+ */
+ @GetMapping("/closeWeatherPush/{id}")
+ public ResponseVO<Object> closeWeatherPush(@PathVariable Long id) {
+ if(id==null){
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ SpringContextHolder.getBean(PoleService.class).closeXiXunAirPush(id);
+ return ResponseUtil.success("鍏抽棴鎴愬姛");
+ }
+
+ /**
+ * 娓呭睆鎿嶄綔
+ */
+ @GetMapping("/clearScreen")
+ public ResponseVO<Object> clearScreen(@RequestBody List<String> codes) {
+
+ if(codes.isEmpty()){
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ for(String playerId : codes) {
+ lightemitUtils.clear(playerId);
+ }
+ return ResponseUtil.success("娓呭睆鎴愬姛");
+ }
}
--
Gitblit v1.9.3