| | |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.service.PlayPlanNvService; |
| | | import com.sandu.ximon.admin.vo.NovaPushResultVO; |
| | | import com.sandu.ximon.dao.bo.SchedulesDTO; |
| | | import com.sandu.ximon.dao.domain.PlayPlanNv; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | |
| | | @PostMapping("/add") |
| | | public ResponseVO<Object> addLEDPlan(@RequestBody @Validated PlayPlanParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_ADD.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.addPlan(param)); |
| | | } |
| | | |
| | | @GetMapping("/getByPlanId/{planId}") |
| | | public ResponseVO<Object> getPlan(@PathVariable Long planId) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_DETAIL.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.getByPlanId(planId)); |
| | | } |
| | | |
| | | @PostMapping("/update/{planId}") |
| | | public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId, @RequestBody @Validated PlayPlanParam param) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.updatePlan(planId, param)); |
| | | } |
| | | |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteLEDPlan(@RequestBody List<Long> plianIds) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_DETELE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.deletePlan(plianIds)); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @PostMapping(value = "/push/{plianId}", produces = "application/json;charset=UTF-8") |
| | | public ResponseVO<Object> pushToLed(@PathVariable Long plianId, @RequestBody List<NovaPushResultVO> playerIds) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_PUSH.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.pushToLed(plianId, playerIds)); |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/pushSchedule/{planId}", produces = "application/json;charset=UTF-8") |
| | | public ResponseVO<Object> pushSchedule(@PathVariable Long planId, @RequestBody List<NovaPushResultVO> playerIds) { |
| | | if (!permissionConfig.check(MenuEnum.LED_N_PLAY_PLAN_PUSH_SCHEDULE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | return ResponseUtil.success(playPlanNvService.pushSchedule(planId, playerIds)); |
| | | } |
| | | |
| | | @GetMapping("/listPlan") |
| | |
| | | List<PlayPlanNv> list = playPlanNvService.list(wrapper); |
| | | list.forEach(plan -> { |
| | | // plan.setPlan(JSON.parseObject(plan.getSchedule(), Map.class)); |
| | | plan.setPlan(JSON.parseArray(plan.getSchedule(), SchedulesDTO.class)); |
| | | plan.setPlan(JSON.parseObject(plan.getSchedules(), List.class)); |
| | | // plan.setPlan(JSON.parseArray(plan.getSchedule(), SchedulesDTO.class)); |
| | | }); |
| | | return ResponseUtil.successPage(list); |
| | | } |