|  |  |  | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.dao.business.dto.SCSupplementDTO; | 
|---|
|  |  |  | import com.doumee.dao.business.model.SettleClaims; | 
|---|
|  |  |  | import com.doumee.dao.business.vo.SettleClaimsExcelVO; | 
|---|
|  |  |  | import com.doumee.service.business.SettleClaimsService; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse create(@RequestBody SettleClaims settleClaims) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.create(settleClaims)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("平台系统案件录入(ID不为空表示编辑,ID为空表示新增)") | 
|---|
|  |  |  | @PostMapping("/createSys") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:create") | 
|---|
|  |  |  | public ApiResponse createSys(@RequestBody SettleClaims settleClaims) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.createOrEditSys(settleClaims)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("添加报案号") | 
|---|
|  |  |  | @PostMapping("/addCode") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:addCode") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse back(@RequestBody SettleClaims settleClaims) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.back(settleClaims)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("附件上传") | 
|---|
|  |  |  | @PostMapping("/claimsUploadFile") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:update") | 
|---|
|  |  |  | public ApiResponse claimsUploadFile(@RequestBody SCSupplementDTO scSupplementDTO) { | 
|---|
|  |  |  | settleClaimsService.claimsUploadFile(scSupplementDTO); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("备注标签") | 
|---|
|  |  |  | @PostMapping("/remark") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:remark") | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("资料下载") | 
|---|
|  |  |  | @PostMapping("/exportFiles") | 
|---|
|  |  |  | @RequiresPermissions("business:locks:exportExcel") | 
|---|
|  |  |  | public void exportFiles(@RequestParam Integer id,HttpServletResponse response) { | 
|---|
|  |  |  | if(id == null){ | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:exportExcel") | 
|---|
|  |  |  | public void exportFiles(@RequestBody SettleClaims model,HttpServletResponse response) { | 
|---|
|  |  |  | if(model.getId() == null){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | settleClaimsService.exportFiles(id,response); | 
|---|
|  |  |  | settleClaimsService.exportFiles(model.getId(),response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID删除") | 
|---|
|  |  |  | @GetMapping("/delete/{id}") | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<SettleClaims> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | ExcelExporter.build(SettleClaims.class).export(settleClaimsService.findPage(pageWrap).getRecords(), "理赔申请表", response); | 
|---|
|  |  |  | ExcelExporter.build(SettleClaims.class).export(settleClaimsService.findPage(pageWrap).getRecords(), "报案理赔_"+System.currentTimeMillis(), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("分页查询 - 手动录入") | 
|---|
|  |  |  | @PostMapping("/pageForSD") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:query") | 
|---|
|  |  |  | public ApiResponse<PageData<SettleClaims>> pageForSD (@RequestBody PageWrap<SettleClaims> pageWrap) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.findPageForSd(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | @PostMapping("/exportForSDExcel") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:exportExcel") | 
|---|
|  |  |  | public void exportForSDExcel (@RequestBody PageWrap<SettleClaims> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | List<SettleClaims> settleClaimsList = settleClaimsService.findPageForSd(pageWrap).getRecords(); | 
|---|
|  |  |  | List<SettleClaimsExcelVO> settleClaimsExcelVOList = new ArrayList<>(); | 
|---|
|  |  |  | if (CollectionUtils.isNotEmpty(settleClaimsList)){ | 
|---|
|  |  |  | for (SettleClaims settleClaims:settleClaimsList) { | 
|---|
|  |  |  | SettleClaimsExcelVO settleClaimsExcelVO = new SettleClaimsExcelVO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(settleClaims,settleClaimsExcelVO); | 
|---|
|  |  |  | settleClaimsExcelVOList.add(settleClaimsExcelVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelExporter.build(SettleClaimsExcelVO.class).export(settleClaimsExcelVOList, "案件录入_"+System.currentTimeMillis(), response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<SettleClaims> findById(@PathVariable Integer id) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.getSettleClaimsDetail(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询 - 手动录入") | 
|---|
|  |  |  | @GetMapping("/getDetailForSd") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:query") | 
|---|
|  |  |  | public ApiResponse<SettleClaims> getDetailForSd(@RequestParam Integer id) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.getSettleClaimsDetailForSd(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("删除附件") | 
|---|
|  |  |  | @GetMapping("/delFile/{id}/{fileId}") | 
|---|
|  |  |  | @RequiresPermissions("business:settleclaims:query") | 
|---|
|  |  |  | public ApiResponse delFile(@PathVariable(name = "id") Integer id,@PathVariable(name = "fileId") Integer fileId) { | 
|---|
|  |  |  | return ApiResponse.success(settleClaimsService.delFile(id,fileId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|