|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.CloudRequiredPermission; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("新建") | 
|---|
|  |  |  | @ApiOperation("问题提报") | 
|---|
|  |  |  | @PostMapping("/create") | 
|---|
|  |  |  | @CloudRequiredPermission("business:ywproblem:create") | 
|---|
|  |  |  | public ApiResponse create(@RequestBody YwProblem ywProblem) { | 
|---|
|  |  |  | return ApiResponse.success(ywProblemService.create(ywProblem)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID修改") | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|