| | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.OrganEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.domain.ServiceDonatecompletioninfo; |
| | | import com.ruoyi.project.domain.ServiceDonateorgan; |
| | |
| | | * 查询捐献完成列表 |
| | | */ |
| | | @ApiOperation("查询捐献完成列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | log.info("查询捐献完成列表:{}", serviceDonatecompletioninfo); |
| | |
| | | * 导出捐献完成列表 |
| | | */ |
| | | @ApiOperation("导出捐献完成列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | |
| | | * 获取捐献完成详细信息 |
| | | */ |
| | | @ApiOperation("通过id获取某一条捐献完成信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | log.info("通过id获取某一条捐献完成信息:{}", id); |
| | |
| | | * 新增捐献完成 |
| | | */ |
| | | @ApiOperation("新增捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @PostMapping("/add") |
| | | @RepeatSubmit(interval = 5000) |
| | | public AjaxResult add(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | log.info("新增捐献完成:{}", serviceDonatecompletioninfo); |
| | | serviceDonatecompletioninfoService.delDuplicateDonateCompletioninfo(serviceDonatecompletioninfo.getInfoid(), serviceDonatecompletioninfo.getCreateBy()); |
| | | return toAjax(serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo)); |
| | | boolean save = serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo); |
| | | log.info("新增捐献完成serviceDonatecompletioninfo的ID:{}", serviceDonatecompletioninfo.getId()); |
| | | return AjaxResult.success(serviceDonatecompletioninfo); |
| | | } |
| | | |
| | | // /** |
| | | // * 新增捐献完成详情 |
| | | // */ |
| | | // @ApiOperation("新增捐献完成详情") |
| | | // //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | // //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | // @Log(title = "新增捐献完成详情", businessType = BusinessType.INSERT) |
| | | // @PostMapping |
| | | // @RepeatSubmit(interval = 5000) |
| | |
| | | |
| | | @RepeatSubmit |
| | | @ApiOperation("新增或修改捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/saveOrUpdateDonatecompletioninfo") |
| | | public AjaxResult saveOrUpdateDonatecompletioninfo(@RequestBody List<ServiceDonatecompletioninfo> serviceDonatecompletioninfoList) { |
| | |
| | | */ |
| | | @RepeatSubmit |
| | | @ApiOperation("修改捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | |
| | | * 删除捐献完成 |
| | | */ |
| | | @ApiOperation("删除捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | |
| | | String name = "人体器官捐献完成结果登记表_" + dataMap.get("XM") + "_" + newTime; |
| | | //输出文档路径及名称 |
| | | File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc"); |
| | | Writer out = null; |
| | | |
| | | try { |
| | | out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8")); |
| | | |
| | | } catch (FileNotFoundException e1) { |
| | | e1.printStackTrace(); |
| | | if (t == null) { |
| | | throw new ServiceException("模板加载失败,请检查模板文件是否存在", HttpStatus.NO_CONTENT); |
| | | } |
| | | try { |
| | | |
| | | // Writer 必须关闭/刷新:BufferedWriter 带缓冲,不关闭会造成文件句柄泄漏且内容可能不完整 |
| | | try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"))) { |
| | | t.process(dataMap, out); |
| | | } catch (TemplateException e) { |
| | | e.printStackTrace(); |
| | | } catch (TemplateException | IOException e) { |
| | | log.error("生成模板文档失败, name={}", name, e); |
| | | throw new ServiceException("生成文档失败", HttpStatus.ERROR); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc"); |
| | | map.put("downloadName", name + ".doc"); |
| | | return map; |
| | | } |
| | | |