|  |  | 
 |  |  | import com.doumee.core.model.PageData; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.dao.business.model.YwProblem; | 
 |  |  | import com.doumee.dao.business.model.YwWorkorder; | 
 |  |  | import com.doumee.service.business.YwProblemService; | 
 |  |  | import com.doumee.service.business.impl.YwWorkorderServiceImpl; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private YwProblemService ywProblemService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private YwWorkorderServiceImpl ywWorkorderService; | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @PreventRepeat | 
 |  |  |     @ApiOperation("问题提报") | 
 |  |  | 
 |  |  |         return ApiResponse.success(ywProblemService.create(ywProblem)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("转工单") | 
 |  |  |     @PostMapping("/editProblem") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:update") | 
 |  |  |     public ApiResponse editProblem(@RequestBody YwProblem ywProblem,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywProblem.setLoginUserInfo(getLoginUser(token)); | 
 |  |  |         ywProblemService.editProblem(ywProblem,ywWorkorderService); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID删除") | 
 |  |  |     @GetMapping("/delete/{id}") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:delete") | 
 |  |  |     public ApiResponse deleteById(@PathVariable Integer id) { | 
 |  |  |     public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywProblemService.deleteById(id); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  | 
 |  |  |     @ApiOperation("批量删除") | 
 |  |  |     @GetMapping("/delete/batch") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:delete") | 
 |  |  |     public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
 |  |  |     public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         String [] idArray = ids.split(","); | 
 |  |  |         List<Integer> idList = new ArrayList<>(); | 
 |  |  |         for (String id : idArray) { | 
 |  |  | 
 |  |  |     @ApiOperation("根据ID修改") | 
 |  |  |     @PostMapping("/updateById") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:update") | 
 |  |  |     public ApiResponse updateById(@RequestBody YwProblem ywProblem) { | 
 |  |  |     public ApiResponse updateById(@RequestBody YwProblem ywProblem,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ywProblemService.updateById(ywProblem); | 
 |  |  |         return ApiResponse.success(null); | 
 |  |  |     } | 
 |  |  | 
 |  |  |     @ApiOperation("分页查询") | 
 |  |  |     @PostMapping("/page") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:query") | 
 |  |  |     public ApiResponse<PageData<YwProblem>> findPage (@RequestBody PageWrap<YwProblem> pageWrap) { | 
 |  |  |     public ApiResponse<PageData<YwProblem>> findPage (@RequestBody PageWrap<YwProblem> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(ywProblemService.findPage(pageWrap)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("导出Excel") | 
 |  |  |     @PostMapping("/exportExcel") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:exportExcel") | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<YwProblem> pageWrap, HttpServletResponse response) { | 
 |  |  |     public void exportExcel (@RequestBody PageWrap<YwProblem> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         ExcelExporter.build(YwProblem.class).export(ywProblemService.findPage(pageWrap).getRecords(), "运维问题上报信息表", response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据ID查询") | 
 |  |  |     @GetMapping("/{id}") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:query") | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id) { | 
 |  |  |         return ApiResponse.success(ywProblemService.findById(id)); | 
 |  |  |     public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(ywProblemService.getDetail(id,null)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("根据工单查询") | 
 |  |  |     @GetMapping("/getByWorkorderId") | 
 |  |  |     @CloudRequiredPermission("business:ywproblem:query") | 
 |  |  |     public ApiResponse getByWorkorderId(@RequestParam Integer workorderId,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
 |  |  |         return ApiResponse.success(ywProblemService.getDetail(null,workorderId)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |