| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | 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.ximon.admin.param.NovaAStateInfoParam; |
| | | import com.sandu.ximon.admin.param.VnnoxParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LedPlayerEntityService; |
| | | import com.sandu.ximon.admin.service.PoleBindingService; |
| | | import com.sandu.ximon.admin.service.PoleService; |
| | | import com.sandu.ximon.admin.service.VnnoxService; |
| | | import com.sandu.ximon.admin.utils.VnnoxAPIUtil; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.admin.vo.NovaAStateInfoVO; |
| | | import com.sandu.ximon.admin.vo.NovaPushResultVO; |
| | | import com.sandu.ximon.admin.vo.NovaResultParam; |
| | | import com.sandu.ximon.dao.domain.LedPlayerEntity; |
| | | import com.sandu.ximon.dao.domain.LedV2RegisterResultEntity; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.net.URISyntaxException; |
| | |
| | | * 诺瓦LED处理 |
| | | */ |
| | | @RestController |
| | | //@AllArgsConstructor |
| | | @RequestMapping("/v1/Vnnox") |
| | | public class VnnoxController { |
| | | @Autowired |
| | |
| | | private LedPlayerEntityService ledPlayerEntityService; |
| | | @Autowired |
| | | private VnnoxAPIUtil vnnoxAPIUtil; |
| | | @Autowired |
| | | private PoleBindingService bindingService; |
| | | @Autowired |
| | | private PoleService poleService; |
| | | |
| | | /** |
| | | * 截屏 |
| | |
| | | return ResponseUtil.success(map.get("url")); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/allScreenShot") |
| | | public ResponseVO<Object> allScreenShot(@RequestBody List<NovaPushResultVO> vnnoxWebRequest) throws InterruptedException { |
| | | return ResponseUtil.success(vnnoxService.getScreenShotUrl(vnnoxWebRequest)); |
| | | } |
| | | |
| | | /** |
| | | * 重启 |
| | | * |
| | | * @param vnnoxWebRequest |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/reboot") |
| | | public ResponseVO<Object> reboot(@RequestBody List<String> vnnoxWebRequest) { |
| | | public ResponseVO<Object> reboot(@RequestBody List<NovaPushResultVO> nova) { |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_RESTART.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | VnnoxResult vnnoxResult = vnnoxService.reboot(vnnoxWebRequest); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | return ResponseUtil.success(vnnoxService.reboot(nova)); |
| | | } |
| | | |
| | | /** |
| | | * 同步播放 |
| | | */ |
| | | @PostMapping("/syncPlay") |
| | | public ResponseVO<Object> syncPlay(@RequestBody Map map) { |
| | | public ResponseVO<Object> syncPlay(@RequestBody NovaResultParam vo) { |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_SYNC_PLAY.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List playIdlist = (List) map.get("playIdlist"); |
| | | Integer option = (Integer) map.get("option"); |
| | | VnnoxResult vnnoxResult = vnnoxService.syncPlay(playIdlist, option); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | List<NovaPushResultVO> playIdlist = vo.getPlayIdlist(); |
| | | Integer option = vo.getOption(); |
| | | if (option == null || vo.getOption() == null) { |
| | | throw new BusinessException("option不能为空"); |
| | | } |
| | | return ResponseUtil.success(vnnoxService.syncPlay(playIdlist, option)); |
| | | } |
| | | |
| | | /** |
| | | * ntp对时 |
| | | */ |
| | | @PostMapping("/ntp") |
| | | public ResponseVO<Object> ntp(@RequestBody Map map) { |
| | | public ResponseVO<Object> ntp(@RequestBody NovaResultParam vo) { |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_NTP.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean enable = (boolean) map.get("enable"); |
| | | List playIdlist = (List) map.get("playIdlist"); |
| | | VnnoxResult vnnoxResult = vnnoxService.ntpSync(playIdlist, enable); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | boolean enable = vo.isEnable(); |
| | | List<NovaPushResultVO> playIdlist = vo.getPlayIdlist(); |
| | | return ResponseUtil.success(vnnoxService.ntpSync(playIdlist, enable)); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_ON_OFF.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | VnnoxResult vnnoxResult = vnnoxService.screenStatusChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getScreenStatus()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | return ResponseUtil.success(vnnoxService.screenStatusChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getScreenStatus())); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_VOL_CHANGE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | VnnoxResult vnnoxResult = vnnoxService.volChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getVol()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | return ResponseUtil.success(vnnoxService.volChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getVol())); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!permissionConfig.check(MenuEnum.VNNOX_BRIGHTNESS_CHANGE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | VnnoxResult vnnoxResult = vnnoxService.brightnessChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getBrightness()); |
| | | return ResponseUtil.success(vnnoxResult); |
| | | return ResponseUtil.success(vnnoxService.brightnessChange(vnnoxWebRequest.getPlayerList(), vnnoxWebRequest.getBrightness())); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "order", required = false) Integer order, @RequestParam(value = "seq", required = false) Integer seq) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.successPage(ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword)); |
| | | return ResponseUtil.successPage(ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq)); |
| | | } |
| | | |
| | | @GetMapping("/onLineList") |
| | | public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | public ResponseVO<Object> onLineList(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "order", required = false) Integer order, @RequestParam(value = "seq", required = false) Integer seq) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword); |
| | | List<LedPlayerEntity> list = ledPlayerEntityService.ledPlayerEntityList(baseConditionVO, keyword, order, seq); |
| | | List<LedPlayerEntity> entities = vnnoxService.setCacheInfo(vnnoxAPIUtil.syncCurrentInfo(list)); |
| | | List<LedPlayerEntity> online = new ArrayList<>(); |
| | | for (LedPlayerEntity ledPlayer : entities) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 屏幕详情 |
| | | * |
| | | * @param sn |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVnnoxInfo/{sn}") |
| | | public ResponseVO<Object> getBySnAndPlayerId(@PathVariable String sn) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(ledPlayerEntityService.getBySnAndPlayerSn(sn)); |
| | | } |
| | | |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping("/saveInfo") |
| | | public ResponseVO<Object> saveInfo() { |
| | | vnnoxService.saveInfo(); |
| | | return ResponseUtil.success("执行完毕"); |
| | | } |
| | | |
| | | // @AnonymousAccess |
| | | // @PostMapping("/asyncStatus") |
| | | // public ResponseVO<Object> asyncStatus(@RequestBody List<String> playerIds) { |
| | | // vnnoxService.asyncStatus(playerIds); |
| | | // return ResponseUtil.success("ok"); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 获取屏幕信息 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping("/getInfo") |
| | | public ResponseVO<Object> getInfo(@RequestBody @Validated NovaAStateInfoParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | //同步状态 |
| | | vnnoxService.getAsyncStatus(param.getPlayerIdList(),param.getStateValue()); |
| | | //获取同步 |
| | | List<NovaAStateInfoVO> info = vnnoxService.getInfo(param.getStateValue(), param.getPlayerIdList()); |
| | | return ResponseUtil.success(info); |
| | | } |
| | | } |