From c0359a005dab3c7b168ed25db2fa4dfc67c7546a Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 27 五月 2022 18:42:30 +0800
Subject: [PATCH] 排序
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java | 171 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 129 insertions(+), 42 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..d1e011d 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,6 +1,6 @@
package com.sandu.ximon.admin.controller;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.sandu.common.domain.CommonPage;
@@ -18,6 +18,8 @@
import com.sandu.ximon.admin.security.SecurityUtils;
import com.sandu.ximon.admin.service.*;
import com.sandu.ximon.admin.utils.LightemitUtils;
+import com.sandu.ximon.admin.utils.ListPagingUtils;
+import com.sandu.ximon.admin.utils.StoreOperationRecordsUtils;
import com.sandu.ximon.admin.vo.LedScheduleVO;
import com.sandu.ximon.dao.domain.PoleLightemitEntity;
import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity;
@@ -42,8 +44,7 @@
private final PoleLightemitService poleLightemitService;
private final LightemitUtils lightemitUtils;
private final LedScheduleService scheduleService;
- private final PoleBindingService bindingService;
- private final PoleService poleService;
+
private PermissionConfig permissionConfig;
// private final ListPageUtil listPageUtil;
@@ -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,20 +66,24 @@
* 淇敼
*/
@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灞�");
}
-// QueryWrapper<PoleXixunPlayerEntity> queryWrapper = new QueryWrapper<>();
-// queryWrapper.eq("program_code", programPro.get_id());
- boolean insert = false;
- if (xiXunPlayerService.removeById(programPro.getProgramId())) {
- insert = xiXunPlayerService.insert(programPro);
+
+ boolean update = xiXunPlayerService.update(programPro);
+ if (update) {
+ return ResponseUtil.success("缂栬緫鎴愬姛锛�");
+
+ } else {
+ return ResponseUtil.fail("缂栬緫澶辫触锛�");
+
}
- ;
- return ResponseUtil.success(insert);
+
}
/**
@@ -86,6 +94,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 +108,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));
}
@@ -108,14 +122,15 @@
* @return
*/
@GetMapping("/list")
- public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
+ public ResponseVO<Object> list(BaseConditionVO baseConditionVO,
+ @RequestParam(value = "order", required = false) Integer order,
+ @RequestParam(value = "seq", required = false) Integer seq,
+ @RequestParam(value = "keyword", required = false) String keyword) {
if (!permissionConfig.check(MenuEnum.LED_PROGRAM_LIST.getCode())) {
return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
}
- LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = xiXunPlayerService.XixunPlayerList(keyword);
- PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
-
- return ResponseUtil.success(xiXunPlayerService.list(wrapper));
+ List<PoleXixunPlayerEntity> list = xiXunPlayerService.listProgram(baseConditionVO, order, seq, keyword);
+ return ResponseUtil.success(list);
}
@@ -128,13 +143,19 @@
*/
@PostMapping("/pushToXixun/{pid}")
public ResponseVO<Object> pushByPid(@PathVariable Long pid, @RequestBody List<Long> lightemitIds) {
- xiXunPlayerService.videoXixunPlayer(pid, lightemitIds);
- return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_PUSH.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+
+ return ResponseUtil.success(xiXunPlayerService.videoXixunPlayer(pid, lightemitIds));
}
//鎵ц涓殑鑺傜洰
@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 +168,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 +197,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 +212,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("鍒犻櫎鎴愬姛");
@@ -201,26 +231,19 @@
* @return
*/
@GetMapping("/listLed")
- public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword,
+ public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO,
+ @RequestParam(value = "order", required = false) Integer order,
+ @RequestParam(value = "seq", required = false) Integer seq,
+ @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());
- }
- );
+ List<PoleLightemitEntity> poleLightemitEntityList = poleLightemitService.listLed(keyword, order, seq, isOnLine);
- CommonPage commonPage = CommonPage.restPage(poleLightemitEntityList);
- int size = poleLightemitEntityList.size();
- commonPage.setTotal((long) size);
- commonPage.setTotalPage(size / baseConditionVO.getPageSize() + 1);
- if (size % baseConditionVO.getPageSize() == 0) {
- commonPage.setTotalPage(size / baseConditionVO.getPageSize());
- }
+
+ CommonPage commonPage = ListPagingUtils.pages(poleLightemitEntityList, baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+
return ResponseUtil.success(commonPage);
}
@@ -233,12 +256,14 @@
return ResponseUtil.success(poleLightemitService.getLedByLightControlCode(lightemitControlCode));
}
- /*
- 璁剧疆灞忓箷寮�鍏�
+ /**
+ * 璁剧疆灞忓箷寮�鍏�
*/
-
@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 +297,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 +317,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灞�");
}
@@ -307,7 +338,9 @@
*/
@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 +363,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,32 +385,56 @@
@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("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ /**
+ * 鐔欐睕瀹氭椂鍒犻櫎 鏃ュ織璁板綍寮�濮�
+ */
+
+ String content = "{鍒犻櫎鐨勭啓姹涘畾鏃秈d锛�" + ids + " }";
+ StoreOperationRecordsUtils.storeOperationData(null, null, "鐔欐睕瀹氭椂浠诲姟鍒犻櫎", content);
+ /**
+ * 鐔欐睕瀹氭椂鍒犻櫎 鏃ュ織璁板綍缁撴潫
+ */
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));
}
@GetMapping("/listSchedule")
- public ResponseVO<Object> listSchedule(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
+ public ResponseVO<Object> listSchedule(BaseConditionVO baseConditionVO,
+ @RequestParam(value = "order", required = false) Integer order,
+ @RequestParam(value = "seq", required = false) Integer seq,
+ @RequestParam(value = "keyword", required = false) String keyword) {
if (!permissionConfig.check(MenuEnum.PLAYPLAN_LIST.getCode())) {
return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
}
PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
- return ResponseUtil.success(scheduleService.listSchedule(baseConditionVO, keyword));
+ return ResponseUtil.success(scheduleService.listSchedule(baseConditionVO, order, seq, keyword));
}
@@ -388,6 +447,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 +461,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 +483,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灞�");
}
@@ -428,8 +496,11 @@
/**
* 娓呭睆鎿嶄綔
*/
- @GetMapping("/clearScreen")
+ @PostMapping("/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灞�");
@@ -437,6 +508,22 @@
for (PoleLightemitEntity playerId : list) {
lightemitUtils.clear(playerId.getLightemitControlCode());
}
+
+ /**
+ * 鐔欐睕娓呭睆 鏃ュ織璁板綍寮�濮�
+ */
+ //鑾峰彇listCode
+ List<String> listCode = new ArrayList<>();
+ List<String> msg = new ArrayList<>();
+ for (PoleLightemitEntity poleLightemitEntity : list) {
+ listCode.add(poleLightemitEntity.getLightemitControlCode());
+ msg.add("[灞忓箷鍚嶇О" + poleLightemitEntity.getLightemitName() + "璁惧缂栫爜" + poleLightemitEntity.getLightemitControlCode() + "],");
+ }
+ String content = JSON.toJSONString(msg);
+ StoreOperationRecordsUtils.storeOperationData(listCode, null, "鐔欐睕娓呭睆", content);
+ /**
+ * 鐔欐睕娓呭睆 鏃ュ織璁板綍缁撴潫
+ */
return ResponseUtil.success("娓呭睆鎴愬姛");
}
}
--
Gitblit v1.9.3