| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.EncryptionReq; |
| | | import com.doumee.config.annotation.EncryptionResp; |
| | | 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.PageWrap; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.vo.CategoryDcaProblemDto; |
| | | import com.doumee.service.business.CategoryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.*; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:create") |
| | | public ApiResponse create(@RequestBody Category category) { |
| | | return ApiResponse.success(categoryService.create(category)); |
| | |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | categoryService.deleteById(id); |
| | |
| | | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | categoryService.deleteByIdInBatch(this.getIdList(ids)); |
| | |
| | | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:update") |
| | | public ApiResponse updateById(@RequestBody Category category) { |
| | | categoryService.updateById(category); |
| | |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse<PageData<Category>> findPage (@RequestBody PageWrap<Category> pageWrap) { |
| | | return ApiResponse.success(categoryService.findPage(pageWrap)); |
| | | } |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/list") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse<List<Category>> findList (@RequestBody Category pageWrap) { |
| | | return ApiResponse.success(categoryService.findList(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<Category> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(Category.class).exportData(categoryService.findPage(pageWrap).getRecords(), "分类信息表", response); |
| | | ExcelExporter.build(Category.class).export(categoryService.findPage(pageWrap).getRecords(), "分类信息表", response); |
| | | } |
| | | @ApiOperation("导出DCAExcel") |
| | | @PostMapping("/exportDcaExcel") |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:exportExcel") |
| | | public void exportDcaExcel (@RequestBody Category pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(CategoryDcaProblemDto.class).export(categoryService.findListForDca(pageWrap), "DCA事件主题和观察项配置_"+System.currentTimeMillis(), response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(categoryService.findById(id)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("分类树查询") |
| | | @PostMapping("/tree") |
| | | @EncryptionResp |
| | | @EncryptionReq |
| | | @RequiresPermissions("business:category:query") |
| | | public ApiResponse<List<Category>> tree (@RequestBody Category param){ |
| | | return ApiResponse.success(categoryService.treeList(param)); |
| | | } |
| | | @ApiOperation(value = "DCA主题和观察项信息导入" ,notes = "保单申请") |
| | | @PostMapping("/importDcaExcel") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | }) |
| | | @RequiresPermissions("business:member:create") |
| | | public ApiResponse<String> imporimportDcaExceltExcel (@ApiParam(value = "file") MultipartFile file ) { |
| | | return ApiResponse.success(categoryService.importDcaBatch(file)); |
| | | } |
| | | } |