| | |
| | | import com.sandu.ximon.admin.param.LightTaskIssueParam; |
| | | import com.sandu.ximon.admin.param.LightTaskParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.LightEnergyDataService; |
| | | import com.sandu.ximon.admin.service.LightTaskService; |
| | | import com.sandu.ximon.dao.domain.LightTask; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("/v1/light/task") |
| | | public class LightTaskController { |
| | | |
| | | private final LightEnergyDataService lightEnergyDataService; |
| | | private final LightTaskService lightTaskService; |
| | | private PermissionConfig permissionConfig; |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | public ResponseVO<Object> listLightTask(BaseConditionVO conditionVO, @RequestParam(required = false) String keyword) { |
| | | public ResponseVO<Object> listLightTask(BaseConditionVO conditionVO, @RequestParam(value = "keyword", required = false) String keyword) { |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_TASK_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | |
| | | if (!permissionConfig.check(MenuEnum.LIGHT_TASK_UPDATE.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | boolean result = lightTaskService.updateLightTask(taskId, param); |
| | | if (result) { |
| | | int result = lightTaskService.updateLightTask(taskId, param); |
| | | if(result==0){ |
| | | return ResponseUtil.success("编辑成功"); |
| | | } else { |
| | | return ResponseUtil.fail("编辑失败"); |
| | | }else if(result==1){ |
| | | return ResponseUtil.success("原任务存在发送指令异常,旧任务保留,下发成功的部分保存至对应新增任务"); |
| | | }else if(result==2){ |
| | | return ResponseUtil.fail("原任务存在发送指令异常,任务下发失败,旧任务保留"); |
| | | }else { |
| | | return ResponseUtil.fail("未知错误"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @GetMapping("/{taskId}") |
| | |
| | | |
| | | /** |
| | | * 单灯下发 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | return ResponseUtil.fail("下发失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/energy") |
| | | public ResponseVO<Object> energy() { |
| | | |
| | | |
| | | lightTaskService.energy(); |
| | | return ResponseUtil.success("lightEnergyDataService.energy(0)"); |
| | | } |
| | | |
| | | |
| | | } |