| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Author liuhaonan |
| | |
| | | return ResponseUtil.success(playPlanNvService.addPlan(param)); |
| | | } |
| | | |
| | | @GetMapping("/getByPlanId/{planId}") |
| | | public ResponseVO<Object> getPlan(@PathVariable Long planId) { |
| | | return ResponseUtil.success(playPlanNvService.getByPlanId(planId)); |
| | | } |
| | | |
| | | @PostMapping("/update/{planId}") |
| | | public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId,@RequestBody @Validated PlayPlanParam param) { |
| | | public ResponseVO<Object> updateLEDPlan(@PathVariable Long planId, @RequestBody @Validated PlayPlanParam param) { |
| | | return ResponseUtil.success(playPlanNvService.updatePlan(planId, param)); |
| | | } |
| | | |
| | | @PostMapping("/delete/{plianId}") |
| | | public ResponseVO<Object> deleteLEDPlan(@PathVariable Long plianId) { |
| | | return ResponseUtil.success(playPlanNvService.deletePlan(plianId)); |
| | | @PostMapping("/delete") |
| | | public ResponseVO<Object> deleteLEDPlan(@RequestBody List<Long> plianIds) { |
| | | return ResponseUtil.success(playPlanNvService.deletePlan(plianIds)); |
| | | } |
| | | |
| | | @PostMapping("/push/{plianId}") |
| | | public ResponseVO<Object> pushToLed(@PathVariable Long plianId) { |
| | | return ResponseUtil.success(playPlanNvService.pushToLed(plianId)); |
| | | @PostMapping(value = "/push/{plianId}", produces = "application/json;charset=UTF-8") |
| | | public ResponseVO<Object> pushToLed(@PathVariable Long plianId, @RequestBody List<String> playerIds) { |
| | | return ResponseUtil.success(playPlanNvService.pushToLed(plianId, playerIds)); |
| | | } |
| | | @GetMapping("/listPaln") |
| | | |
| | | @GetMapping("/listPlan") |
| | | public ResponseVO<Object> list(BaseConditionVO baseConditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | LambdaQueryWrapper<PlayPlanNv> wrapper = new LambdaQueryWrapper<>();// |
| | | if(AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())){ |
| | | wrapper= Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getUserId,SecurityUtils.getUserId()); |
| | | if (AdministratorEnums.CUSTOMER.getCode().equals(SecurityUtils.getAdministratorIdentity())) { |
| | | wrapper = Wrappers.lambdaQuery(PlayPlanNv.class).eq(PlayPlanNv::getUserId, SecurityUtils.getUserId()); |
| | | } |
| | | wrapper=Wrappers.lambdaQuery(PlayPlanNv.class); |
| | | if(null!=keyword){ |
| | | wrapper.like(PlayPlanNv::getName,keyword); |
| | | wrapper = Wrappers.lambdaQuery(PlayPlanNv.class); |
| | | if (StrUtil.isNotBlank(keyword)) { |
| | | wrapper.like(PlayPlanNv::getName, keyword); |
| | | } |
| | | return ResponseUtil.successPage(playPlanNvService.list(wrapper)); |
| | | List<PlayPlanNv> list = playPlanNvService.list(wrapper); |
| | | //PlayPlanParam param=new PlayPlanParam(); |
| | | list.forEach(plan -> { |
| | | plan.setPlan(JSON.parseObject(plan.getSchedule(), Map.class)); |
| | | }); |
| | | return ResponseUtil.successPage(list); |
| | | } |
| | | |
| | | } |