|  |  |  | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody YwPatrolTask ywPatrolTask,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywPatrolTask.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(ywPatrolTaskService.create(ywPatrolTask)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:delete") | 
|---|
|  |  |  | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywPatrolTaskService.deleteById(id); | 
|---|
|  |  |  | ywPatrolTaskService.deleteById(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String id : idArray) { | 
|---|
|  |  |  | idList.add(Integer.valueOf(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ywPatrolTaskService.deleteByIdInBatch(idList); | 
|---|
|  |  |  | ywPatrolTaskService.deleteByIdInBatch(idList,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody YwPatrolTask ywPatrolTask,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywPatrolTask.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | ywPatrolTaskService.updateById(ywPatrolTask); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/page") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:query") | 
|---|
|  |  |  | public ApiResponse<PageData<YwPatrolTask>> findPage (@RequestBody PageWrap<YwPatrolTask> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success(ywPatrolTaskService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<YwPatrolTask> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | List<YwPatrolTask> ywPatrolTaskList = ywPatrolTaskService.findPage(pageWrap).getRecords(); | 
|---|
|  |  |  | for (YwPatrolTask ywPatrolTask:ywPatrolTaskList) { | 
|---|
|  |  |  | if((Constants.equalsInteger(ywPatrolTask.getStatus(),Constants.ZERO) || Constants.equalsInteger(ywPatrolTask.getStatus(),Constants.ONE)) | 
|---|
|  |  |  | && ywPatrolTask.getEndDate().getTime() < System.currentTimeMillis() | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | ywPatrolTask.setStatus(Constants.TWO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelExporter.build(YwPatrolTask.class).export(ywPatrolTaskService.findPage(pageWrap).getRecords(), "运维巡检任务信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(ywPatrolTaskService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("任务取消") | 
|---|
|  |  |  | @GetMapping("/taskCancel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywpatroltask:query") | 
|---|
|  |  |  | public ApiResponse taskCancel(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | ywPatrolTaskService.taskCancel(id,this.getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|