From e55c8b0a92eb9715edd90c31dfd4de51a47b588b Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 04 十一月 2022 17:40:08 +0800
Subject: [PATCH] changes
---
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/XiXunController.java | 630 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 557 insertions(+), 73 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 5cf223e..d6e85e1 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,30 +1,37 @@
package com.sandu.ximon.admin.controller;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.api.R;
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.file.FileUploadDto;
+import com.sandu.common.file.impl.AliOssFileServiceImpl;
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;
+import com.sandu.ximon.admin.param.SetScreenOpenParam;
+import com.sandu.ximon.admin.param.SetVolumeParam;
+import com.sandu.ximon.admin.security.PermissionConfig;
import com.sandu.ximon.admin.security.SecurityUtils;
-import com.sandu.ximon.admin.service.ClientService;
-import com.sandu.ximon.admin.service.PoleLightemitService;
-import com.sandu.ximon.admin.service.XiXunPlayerService;
-import com.sandu.ximon.dao.domain.LedPlayerEntity;
-import com.sandu.ximon.dao.domain.PlayPlanNv;
+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;
-import com.sandu.ximon.dao.enums.AdministratorEnums;
+import com.sandu.ximon.dao.enums.MenuEnum;
import lombok.AllArgsConstructor;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
/**
* @Author liuhaonan
@@ -39,65 +46,148 @@
private final XiXunPlayerService xiXunPlayerService;
private final ClientService clientService;
private final PoleLightemitService poleLightemitService;
+ private final LightemitUtils lightemitUtils;
+ private final LedScheduleService scheduleService;
+ private PermissionConfig permissionConfig;
+
+
+ private final AliOssFileServiceImpl aliOssFileService;
+ private final FileOperationRecordService fileOperationRecordService;
+
+ /**
+ * 鏂板鑺傜洰
+ *
+ * @param programPro
+ * @return
+ */
@PostMapping("/addProgram")
- public ResponseVO<Object> addProgram(@RequestBody ProgramPro programPro){
- return ResponseUtil.success(xiXunPlayerService.insert(programPro));
+ public ResponseVO<Object> addProgram(@RequestBody ProgramPro programPro) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_ADD.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ return ResponseUtil.success(xiXunPlayerService.insert(programPro));
}
- @PostMapping("/deleteProgram/{pid}")
- public ResponseVO<Object> deleteProgram(@PathVariable Long pid){
- return ResponseUtil.success(xiXunPlayerService.deleteProgram(pid));
+ /**
+ * 淇敼
+ */
+ @PostMapping("/updateProgram")
+ 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灞�");
+ }
+
+ boolean update = xiXunPlayerService.update(programPro);
+ if (update) {
+ return ResponseUtil.success("缂栬緫鎴愬姛锛�");
+
+ } else {
+ return ResponseUtil.fail("缂栬緫澶辫触锛�");
+
+ }
+
}
+ /**
+ * 鍒犻櫎鑺傜洰
+ *
+ * @param
+ * @return
+ */
+ @PostMapping("/deleteProgram")
+ public ResponseVO<Object> deleteProgram(@RequestBody List<Long> pids) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_DELETE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ return ResponseUtil.success(xiXunPlayerService.deleteProgram(pids));
+ }
+
+ /**
+ * 鑾峰彇鑺傜洰璇︽儏
+ *
+ * @param pid
+ * @return
+ */
@GetMapping("/getByPid/{pid}")
- public ResponseVO<Object> getByPid(@PathVariable Long 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));
}
+
+ /**
+ * 鑺傜洰鍒楄〃
+ *
+ * @param baseConditionVO
+ * @param keyword
+ * @return
+ */
@GetMapping("/list")
- public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
- PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
-
- LambdaQueryWrapper<PoleXixunPlayerEntity> wrapper = Wrappers.lambdaQuery(PoleXixunPlayerEntity.class).like(PoleXixunPlayerEntity::getProgramName, keyword);
-// if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){
-// boolean clientId = clientService.findClientId();
-// if(clientId){
-// wrapper= wrapper.eq(PoleXixunPlayerEntity::getUserId,SecurityUtils.getUserId());
-// }
-// wrapper= wrapper.eq(PoleXixunPlayerEntity::getClientId,clientService.getClientId());
-// }
-// wrapper=Wrappers.lambdaQuery(PoleXixunPlayerEntity.class);
-// if(StrUtil.isNotBlank(keyword)){
-// wrapper.like(PoleXixunPlayerEntity::getLightemitName,keyword).or(
-// lambdaQueryWrapper -> {
-// lambdaQueryWrapper.like(PoleXixunPlayerEntity::getLightemitControlCode, keyword);
-// }
-// );
-// }
-// return ResponseUtil.success(poleLightemitService.list(wrapper));
- if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) {
-
- return ResponseUtil.success(xiXunPlayerService.list(wrapper)); // todo
- }else {
- return ResponseUtil.success(xiXunPlayerService.list(wrapper));
+ 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("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
}
+ List<PoleXixunPlayerEntity> list = xiXunPlayerService.listProgram(baseConditionVO, order, seq, keyword);
+ return ResponseUtil.success(list);
}
- @GetMapping("/pushToXixun/{pid}")
- public ResponseVO<Object> getByPid(@PathVariable Long pid, @RequestBody List<Long> lightemitIds ){
- xiXunPlayerService.videoXixunPlayer(pid,lightemitIds);
- return ResponseUtil.success("鎺ㄩ�佹垚鍔�");
+ /**
+ * 鑺傜洰鎺ㄩ��
+ *
+ * @param pid
+ * @param lightemitIds
+ * @return
+ */
+ @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("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+
+ 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(poleLightemitService.getProgram(lightemitId));
+ }
+
+
+ /**
+ * LED灞忓箷鏂板
+ *
+ * @param poleLightemit
+ * @return
+ */
@PostMapping("/saveLed")
- public ResponseVO<Object> save(@RequestBody PoleLightemitEntity poleLightemit){
+ 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鎺у埗鍗$紪鍙蜂笉鑳介噸澶�");
+ if (count != 0) {
+ 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);
@@ -105,42 +195,436 @@
return ResponseUtil.success("鏂板鎴愬姛");
}
+ /**
+ * LED灞忓箷淇敼
+ *
+ * @param ledId
+ * @param poleLightemit
+ * @return
+ */
@PostMapping("/updateLed/{ledId}")
- public ResponseVO<Object> updatePoleLightemit(@PathVariable Long ledId,@RequestBody PoleLightemitEntity poleLightemit){
- poleLightemitService.updatePoleLightemit(ledId,poleLightemit);
+ 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("淇敼鎴愬姛");
}
+ /**
+ * LED灞忓箷鍒犻櫎
+ *
+ * @param ledIds
+ * @return
+ */
@PostMapping("/deleteLed")
- public ResponseVO<Object> deleteLed(@RequestBody List<Long> ledIds){
+ 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){
+ if (b) {
return ResponseUtil.success("鍒犻櫎鎴愬姛");
- }else {
+ } else {
return ResponseUtil.success("鍒犻櫎澶辫触");
}
}
-
+ /**
+ * LED灞忓箷鍒楄〃
+ *
+ * @param baseConditionVO
+ * @param keyword
+ * @return
+ */
@GetMapping("/listLed")
- public ResponseVO<Object> listLed(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) {
- 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());
+ 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, order, seq, isOnLine);
+
+
+ CommonPage commonPage = ListPagingUtils.pages(poleLightemitEntityList, baseConditionVO.getPageNo(), baseConditionVO.getPageSize());
+
+ return ResponseUtil.success(commonPage);
+ }
+
+ /**
+ * @param
+ * @return
+ */
+ @GetMapping("/getbycode")
+ public ResponseVO<Object> getLedByLightControlCode(String lightemitControlCode) {
+ 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灞�");
+ }
+ Collection poleLightemitControllers = poleLightemitService.listByIds(Arrays.asList(setScreenOpenEntity.getIds()));
+ if (!poleLightemitControllers.isEmpty()) {
+
+ Map<Long, Object> map = new HashMap<>();
+
+ Iterator iterator = poleLightemitControllers.iterator();
+ while (iterator.hasNext()) {
+ PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
+ //缁撴灉鏌ヨ
+ String result = lightemitUtils.setScreenOpen(poleLightemitEntity.getLightemitControlCode(), setScreenOpenEntity.getBool());
+
+ System.out.println("result:---------------------" + result);
+ if (result.isEmpty() || !"true".equals(result)) {
+
+ }
+
+ map.put(poleLightemitEntity.getLightemitId(), result);
}
- wrapper= wrapper.eq(PoleLightemitEntity::getClientId,clientService.getClientId());
+ return ResponseUtil.success(map);
+ } else {
+ throw new BusinessException("鏈纭�夋嫨LED灞�");
}
- wrapper=Wrappers.lambdaQuery(PoleLightemitEntity.class);
- if(StrUtil.isNotBlank(keyword)){
- wrapper.like(PoleLightemitEntity::getLightemitName,keyword).or(
- lambdaQueryWrapper -> {
- lambdaQueryWrapper.like(PoleLightemitEntity::getLightemitControlCode, keyword);
- }
- );
+ }
+
+
+ /*
+ 鑾峰彇led瀹炴椂鐢婚潰
+ */
+ @GetMapping("/getPicture/{id}")
+ public ResponseVO<Object> getPicture(@PathVariable Long id) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_SCREENSHOT.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
}
- return ResponseUtil.success(poleLightemitService.list(wrapper));
+ if (id == null) {
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ PoleLightemitEntity poleLightemitEntity = poleLightemitService.getById(id);
+ if (poleLightemitEntity != null) {
+ String result = lightemitUtils.getPicture(poleLightemitEntity.getLightemitControlCode());
+ return ResponseUtil.success(result);
+ } else {
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ }
+
+ /*
+ 鑾峰彇闊抽噺
+ */
+ @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灞�");
+ }
+ PoleLightemitEntity poleLightemitEntity = poleLightemitService.getById(id);
+ if (poleLightemitEntity != null) {
+ String result = lightemitUtils.getVoiume(poleLightemitEntity.getLightemitControlCode());
+ return ResponseUtil.success(result);
+ } else {
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ }
+
+
+ /*
+ 璁剧疆浜害
+ */
+ @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");
+ }
+
+ Collection poleLightemitControllers = poleLightemitService.listByIds(Arrays.asList(setBrightnessParam.getIds()));
+ if (!poleLightemitControllers.isEmpty()) {
+ Iterator iterator = poleLightemitControllers.iterator();
+ while (iterator.hasNext()) {
+ PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
+ poleLightemitService.setBrightness(poleLightemitEntity.getLightemitControlCode(), setBrightnessParam.getBrightness());
+ }
+ return ResponseUtil.success("璁剧疆浜害鎴愬姛");
+ } else {
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ }
+
+ /*
+ 璁剧疆闊抽噺
+ */
+ @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");
+ }
+
+ Collection poleLightemitControllers = poleLightemitService.listByIds(Arrays.asList(setVolumeEntity.getIds()));
+ if (!poleLightemitControllers.isEmpty()) {
+ Iterator iterator = poleLightemitControllers.iterator();
+ while (iterator.hasNext()) {
+ PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
+ poleLightemitService.setVolume(poleLightemitEntity.getLightemitControlCode(), setVolumeEntity.getVolume());
+ }
+ return ResponseUtil.success("璁剧疆闊抽噺鎴愬姛");
+ } else {
+ throw new BusinessException("鏈�夋嫨LED灞�");
+ }
+ }
+
+ @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 = "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, order, seq, keyword));
+ }
+
+
+ /**
+ * 璁剧疆瀹氭椂
+ *
+ * @param id
+ * @param lightemitIds
+ * @return
+ */
+ @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("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ return ResponseUtil.success(scheduleService.ledschedulepush(id, lightemitIds));
+ }
+
+ /**
+ * 娓呯┖瀹氭椂
+ *
+ * @param
+ * @param lightemitIds
+ * @return
+ */
+ @PostMapping("/deletePushSchedule")
+ public ResponseVO<Object> deletePushSchedule(@RequestBody Long[] lightemitIds) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PLAN_PUSH_SCHEDULE.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+
+ return ResponseUtil.success(scheduleService.deleteSchedulePush(lightemitIds));
+ }
+
+ /**
+ * 鑾峰彇鎵ц涓殑瀹氭椂
+ *
+ * @param
+ * @return
+ */
+
+ @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灞�");
+ }
+ List<LedScheduleVO> list = new ArrayList<>();
+ for (Long id : ids) {
+ LedScheduleVO ledScheduleVO = scheduleService.getledschedules(id);
+ list.add(ledScheduleVO);
+ }
+ return ResponseUtil.success(list);
+ }
+
+
+ /**
+ * 鍏抽棴澶╂皵鎺ㄩ��
+ */
+ @GetMapping("/closeWeatherPush/{poleId}")
+ public ResponseVO<Object> closeWeatherPush(@PathVariable Long poleId) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_CLOSE_AIR.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ if (poleId == null) {
+ throw new BusinessException("鐏潌id涓嶈兘涓虹┖!");
+ }
+ SpringContextHolder.getBean(PoleService.class).closeXiXunAirPush(poleId);
+ return ResponseUtil.success("鍏抽棴鎴愬姛");
+ }
+
+ /**
+ * 娓呭睆鎿嶄綔
+ */
+ @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灞�");
+ }
+ for (PoleLightemitEntity playerId : list) {
+ //娓呭睆
+ String clear = lightemitUtils.clear(playerId.getLightemitControlCode());
+ //娓呴櫎鎾斁鍒楄〃
+ lightemitUtils.clearVideoPlay(playerId.getLightemitControlCode());
+ //娓呴櫎鑺傜洰鍒楄〃
+ lightemitUtils.clearPlayerTask(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("娓呭睆鎴愬姛");
+ }
+
+
+ /**
+ * 鐔欐睕鐩存帴涓婁紶瑙嗛鍒版挱鏀惧櫒鎾斁
+ */
+ @PostMapping("/pushVideo")
+ @Transactional(rollbackFor = Exception.class)
+ public ResponseVO<Object> video(@RequestParam("file") MultipartFile file,
+ @RequestParam("lightemitId") List<Long> lightemitIds,
+ @RequestParam("type") Integer type) {
+ if (!permissionConfig.check(MenuEnum.XIXUN_PROGRAM_PUSH.getCode())) {
+ return ResponseUtil.fail("缂哄皯瀵瑰簲鐢ㄦ埛鏉冮檺");
+ }
+ if (file == null || lightemitIds.isEmpty()) {
+ throw new BusinessException("鏈�夋嫨LED灞忔垨鏂囦欢");
+ }
+
+ FileUploadDto fileUploadDto = aliOssFileService.uploadFile(file);
+ if (type == null && (type > 2 || type < 1)) {
+ throw new BusinessException("璇烽�夋嫨姝g‘鐨勬挱鏀剧被鍨�");
+ }
+
+ if (type == 1 && !"mp4".equals(fileUploadDto.getFileType())) {
+ throw new BusinessException("璇蜂笉瑕佸湪鎾斁瑙嗛鏃堕�夋嫨闈瀖p4鏂囦欢");
+ } else if (type == 2 && (!"jpg".equals(fileUploadDto.getFileType()) && !"gif".equals(fileUploadDto.getFileType()) && !"png".equals(fileUploadDto.getFileType()))) {
+ throw new BusinessException("璇蜂笉瑕佸湪鎾斁鍥剧墖鏃舵椂閫夋嫨闈瀓pg/gif/png鏂囦欢");
+ }
+
+
+ //鑾峰彇鎵�鏈塴ed鏁版嵁
+ List<PoleLightemitEntity> poleLightemitControllers = poleLightemitService.listByIds(lightemitIds);
+
+ int num = 0;
+ if (!poleLightemitControllers.isEmpty()) {
+
+ Iterator iterator = poleLightemitControllers.iterator();
+ while (iterator.hasNext()) {
+ PoleLightemitEntity poleLightemitEntity = (PoleLightemitEntity) iterator.next();
+ //涓婁紶瑙嗛
+ String s = poleLightemitService.videoUpload(poleLightemitEntity.getLightemitControlCode(), fileUploadDto, type);
+ if ("鎺ㄩ�佸け璐�".equals(s)) {
+ num++;
+ }
+ }
+ } else {
+ throw new BusinessException("鏈纭�夋嫨LED灞�");
+ }
+
+ /**
+ * 鐔欐睕涓婁紶鏂囦欢鎾斁 鏃ュ織璁板綍寮�濮�
+ */
+ //鑾峰彇listCode
+ List<String> listCode = new ArrayList<>();
+ List<String> msg = new ArrayList<>();
+ for (PoleLightemitEntity poleLightemitEntity : poleLightemitControllers) {
+ listCode.add(poleLightemitEntity.getLightemitControlCode());
+ msg.add("[灞忓箷鍚嶇О" + poleLightemitEntity.getLightemitName() + "璁惧缂栫爜" + poleLightemitEntity.getLightemitControlCode() + "],");
+ }
+ String content = JSON.toJSONString(msg);
+ StoreOperationRecordsUtils.storeOperationData(listCode, null, "鐔欐睕鏂囦欢鎺ㄩ��", content);
+ /**
+ * 鐔欐睕涓婁紶鏂囦欢鎾斁 鏃ュ織璁板綍缁撴潫
+ */
+
+ if (num != 0 && num != lightemitIds.size()) {
+ //瀛樺湪澶辫触浣嗘槸涓嶅畬鍏ㄥけ璐�
+ return ResponseUtil.success("閮ㄥ垎鏂囦欢鎾斁鎴愬姛");
+ } else if (num == lightemitIds.size()) {
+ //鍏ㄩ儴澶辫触
+ return ResponseUtil.fail("鏂囦欢鎾斁澶辫触");
+ } else {
+ return ResponseUtil.success("鏂囦欢鎾斁鎴愬姛");
+ }
}
}
--
Gitblit v1.9.3