From e2380b9138846978de9ae4295f41faa2a260800f Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期二, 10 五月 2022 16:56:17 +0800
Subject: [PATCH] Changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java | 86 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 82 insertions(+), 4 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 b94de67..397febb 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
@@ -7,6 +7,7 @@
import com.sandu.common.domain.ResponseVO;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.object.BaseConditionVO;
+import com.sandu.common.security.annotation.AnonymousAccess;
import com.sandu.common.util.ResponseUtil;
import com.sandu.common.util.SpringContextHolder;
import com.sandu.ximon.admin.entity.ProgramPro;
@@ -55,6 +56,9 @@
*/
@PostMapping("/addProgram")
public ResponseVO<Object> addProgram(@RequestBody ProgramPro programPro) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_ADD.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(xiXunPlayerService.insert(programPro));
}
@@ -62,8 +66,10 @@
* 淇敼
*/
@PostMapping("/updateProgram")
- // @RequiresPermissions("pole:polexixunplayer:update")
public ResponseVO<Object> update(@RequestBody ProgramPro programPro) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_UPDATE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
PoleXixunPlayerEntity byId = xiXunPlayerService.getById(programPro.getProgramId());
if (byId == null) {
throw new BusinessException("鏈�夋嫨LED灞�");
@@ -86,6 +92,9 @@
*/
@PostMapping("/deleteProgram/{pid}")
public ResponseVO<Object> deleteProgram(@PathVariable Long pid) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_DELETE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(xiXunPlayerService.deleteProgram(pid));
}
@@ -97,6 +106,9 @@
*/
@GetMapping("/getByPid/{pid}")
public ResponseVO<Object> getByPid(@PathVariable Long pid) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_DETAIL.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(xiXunPlayerService.getByPid(pid));
}
@@ -128,6 +140,9 @@
*/
@PostMapping("/pushToXixun/{pid}")
public ResponseVO<Object> pushByPid(@PathVariable Long pid, @RequestBody List<Long> lightemitIds) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_PUSH.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
xiXunPlayerService.videoXixunPlayer(pid, lightemitIds);
return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
}
@@ -135,6 +150,9 @@
//鎵ц涓殑鑺傜洰
@GetMapping("/getProgram/{lightemitId}")
public ResponseVO<Object> getProgram(@PathVariable Long lightemitId) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_PLAYING.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(xiXunPlayerService.getByPid(lightemitId));
}
@@ -147,6 +165,9 @@
*/
@PostMapping("/saveLed")
public ResponseVO<Object> save(@RequestBody PoleLightemitEntity poleLightemit) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_LED_ADD.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
int count = poleLightemitService.count(new QueryWrapper<PoleLightemitEntity>().eq("lightemit_control_code", poleLightemit.getLightemitControlCode()));
if (count != 0) {
throw new BusinessException("LED鎺у埗鍗$紪鍙蜂笉鑳介噸澶�");
@@ -173,6 +194,9 @@
*/
@PostMapping("/updateLed/{ledId}")
public ResponseVO<Object> updatePoleLightemit(@PathVariable Long ledId, @RequestBody PoleLightemitEntity poleLightemit) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_LED_UPDATE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
poleLightemitService.updatePoleLightemit(ledId, poleLightemit);
return ResponseUtil.success("淇敼鎴愬姛");
}
@@ -185,6 +209,9 @@
*/
@PostMapping("/deleteLed")
public ResponseVO<Object> deleteLed(@RequestBody List<Long> ledIds) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_LED_DELETE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
boolean b = poleLightemitService.deletePoleLightemit(ledIds);
if (b) {
return ResponseUtil.success("鍒犻櫎鎴愬姛");
@@ -237,8 +264,12 @@
璁剧疆灞忓箷寮�鍏�
*/
+ @AnonymousAccess
@PostMapping("/setScreenOpen")
public ResponseVO<Object> setScreenOpen(@RequestBody SetScreenOpenParam setScreenOpenEntity) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_ON_OFF.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (setScreenOpenEntity.getIds() == null || setScreenOpenEntity.getIds().length == 0 || setScreenOpenEntity.getBool() == null) {
throw new BusinessException("鏈�夋嫨LED灞�");
}
@@ -272,6 +303,9 @@
*/
@GetMapping("/getPicture/{id}")
public ResponseVO<Object> getPicture(@PathVariable Long id) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_SCREENSHOT.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (id == null) {
throw new BusinessException("鏈�夋嫨LED灞�");
}
@@ -289,6 +323,9 @@
*/
@PostMapping("/getVolume/{id}")
public ResponseVO<Object> getVolume(@PathVariable Long id) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_VOL_CHANGE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (id == null) {
throw new BusinessException("鏈�夋嫨LED灞�");
}
@@ -302,12 +339,27 @@
}
+ /**
+ * 娴嬭瘯
+ *
+ * @param
+ * @return
+ */
+ @AnonymousAccess
+ @PostMapping("/test/{str}")
+ public ResponseVO<Object> setBrightness(@PathVariable String str) {
+ return ResponseUtil.success(lightemitUtils.getIsScreenOpen(str));
+ }
+
+
/*
璁剧疆浜害
*/
@PostMapping("/setBrightness")
public ResponseVO<Object> setBrightness(@RequestBody SetBrightnessParam setBrightnessParam) {
-
+ if (!permissionConfig.check(MenuEnum.XIXUN_BRIGHTNESS_CHANGE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (setBrightnessParam == null || setBrightnessParam.getIds() == null || setBrightnessParam.getBrightness() > 255) {
throw new BusinessException("鍙傛暟閿欒涓虹┖鎴栦寒搴︿笉鑳借秴杩�255");
}
@@ -330,7 +382,9 @@
*/
@PostMapping("/setVolume")
public ResponseVO<Object> setVolume(@RequestBody SetVolumeParam setVolumeEntity) {
-
+ if (!permissionConfig.check(MenuEnum.XIXUN_VOL_CHANGE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (setVolumeEntity == null || setVolumeEntity.getIds() == null || setVolumeEntity.getVolume() > 15) {
throw new BusinessException("闊抽噺鑼冨洿涓�0---15");
}
@@ -350,21 +404,33 @@
@PostMapping("/addSchedule")
public ResponseVO<Object> addSchedule(@RequestBody LEDScheduleParam_xixun ledEntity) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_ADD.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(scheduleService.insert(ledEntity));
}
@PostMapping("/updateSchedule")
public ResponseVO<Object> updateSchedule(@RequestBody LEDScheduleParam_xixun ledEntity) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_UPDATE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(scheduleService.updateSchedule(ledEntity));
}
@PostMapping("/deleteSchedule")
public ResponseVO<Object> deleteSchedule(@RequestBody List<Integer> ids) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_DELETE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(scheduleService.removeByIds(ids));
}
@GetMapping("/getSchedule/{id}")
public ResponseVO<Object> getSchedule(@PathVariable Integer id) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_DETAIL.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
return ResponseUtil.success(scheduleService.getSchedule(id));
}
@@ -388,6 +454,9 @@
*/
@PostMapping("/pushSchedule/{id}")
public ResponseVO<Object> pushSchedule(@PathVariable Integer id, @RequestBody Long[] lightemitIds) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_PUSH_SCHEDULE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
scheduleService.ledschedulepush(id, lightemitIds);
return ResponseUtil.success("璁剧疆鎴愬姛");
}
@@ -399,8 +468,11 @@
* @return
*/
- @GetMapping("/getPushSchedule")
+ @PostMapping("/getPushSchedule")
public ResponseVO<Object> getPushSchedule(@RequestBody List<Long> ids) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_SCHEDULE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (ids.isEmpty()) {
throw new BusinessException("鏈�夋嫨LED灞�");
}
@@ -418,6 +490,9 @@
*/
@GetMapping("/closeWeatherPush/{id}")
public ResponseVO<Object> closeWeatherPush(@PathVariable Long id) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_CLOSE_AIR.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
if (id == null) {
throw new BusinessException("鏈�夋嫨LED灞�");
}
@@ -430,6 +505,9 @@
*/
@GetMapping("/clearScreen")
public ResponseVO<Object> clearScreen(@RequestBody List<Long> ids) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_CLEAN.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
List<PoleLightemitEntity> list = poleLightemitService.listByIds(ids);
if (ids.isEmpty() && list.isEmpty()) {
throw new BusinessException("鏈�夋嫨LED灞�");
--
Gitblit v1.9.3