| | |
| | | package com.ruoyi.web.controller.project; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.NotRepeatCommit; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | |
| | | import freemarker.template.TemplateException; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | * @author ruoyi |
| | | * @date 2021-11-10 |
| | | */ |
| | | @Slf4j |
| | | @Api("潜在捐献信息管理") |
| | | @RestController |
| | | @RequestMapping("/project/donatebaseinfo") |
| | |
| | | * 查询捐献基础列表 |
| | | */ |
| | | @ApiOperation("潜在捐献信息列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:list')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("潜在捐献信息列表:{}", serviceDonatebaseinfo); |
| | | startPage(); |
| | | //List<ServiceDonatebaseinfo> list = serviceDonatebaseinfoService.queryList(serviceDonatebaseinfo); |
| | | List<ServiceDonatebaseinfo> list = serviceDonatebaseinfoService.selectServiceDonatebaseinfoList(serviceDonatebaseinfo); |
| | |
| | | @ApiOperation("小程序端潜在捐献信息列表") |
| | | @GetMapping("/listForSearch") |
| | | public TableDataInfo listForSearch(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("小程序端潜在捐献信息列表:{}", serviceDonatebaseinfo); |
| | | startPage(); |
| | | List<ServiceDonatebaseinfo> list = serviceDonatebaseinfoService.listForSearch(serviceDonatebaseinfo); |
| | | return getDataTable(list); |
| | |
| | | * 导出捐献基础列表 |
| | | */ |
| | | @ApiOperation("导出潜在捐献信息列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:export')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:export')") |
| | | @Log(title = "捐献基础", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("导出潜在捐献信息列表:{}", serviceDonatebaseinfo); |
| | | List<ServiceDonatebaseinfo> list = serviceDonatebaseinfoService.queryList(serviceDonatebaseinfo); |
| | | ExcelUtil<ServiceDonatebaseinfo> util = new ExcelUtil<ServiceDonatebaseinfo>(ServiceDonatebaseinfo.class); |
| | | return util.exportExcel(list, "捐献基础数据"); |
| | |
| | | * 获取捐献基础详细信息 |
| | | */ |
| | | @ApiOperation("通过id获得潜在捐献信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:query')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | log.info("通过id获得潜在捐献信息:{}", id); |
| | | return AjaxResult.success(serviceDonatebaseinfoService.getById(id)); |
| | | } |
| | | |
| | |
| | | * 新增捐献基础 |
| | | */ |
| | | @ApiOperation("新增潜在捐献信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:add')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:add')") |
| | | @Log(title = "捐献基础", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @PostMapping("/add") |
| | | @RepeatSubmit |
| | | public AjaxResult add(@RequestBody ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("新增潜在捐献信息:{}", serviceDonatebaseinfo); |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | String bh = ""; |
| | | bh = serviceDonatebaseinfoService.getDonateNumber(serviceDonatebaseinfo); |
| | | if (bh == "") { |
| | | return AjaxResult.error("新增时生成的编号为空,创建失败!"); |
| | | } else { |
| | | ServiceDonatebaseinfo serviceDonatebaseinfo1 = new ServiceDonatebaseinfo(); |
| | | serviceDonatebaseinfo1.setDonorno(bh); |
| | | List<ServiceDonatebaseinfo> listrecord = serviceDonatebaseinfoService.queryList(serviceDonatebaseinfo1); |
| | | if (listrecord.size() > 0) { |
| | | return AjaxResult.error("新增时生成的编号" + bh + "已存在,无法保存!"); |
| | | } |
| | | |
| | | } |
| | | // String bh = ""; |
| | | // bh = serviceDonatebaseinfoService.getDonateNumber(serviceDonatebaseinfo); |
| | | // if (bh == "") { |
| | | // return AjaxResult.error("新增时生成的编号为空,创建失败!"); |
| | | // } else { |
| | | // ServiceDonatebaseinfo serviceDonatebaseinfo1 = new ServiceDonatebaseinfo(); |
| | | // serviceDonatebaseinfo1.setDonorno(bh); |
| | | // List<ServiceDonatebaseinfo> listrecord = serviceDonatebaseinfoService.queryList(serviceDonatebaseinfo1); |
| | | // if (listrecord.size() > 0) { |
| | | // return AjaxResult.error("新增时生成的编号" + bh + "已存在,无法保存!"); |
| | | // } |
| | | // |
| | | // } |
| | | String idcardno = serviceDonatebaseinfo.getIdcardno(); |
| | | ServiceDonatebaseinfo serviceDonatebaseinfo2 = new ServiceDonatebaseinfo(); |
| | | serviceDonatebaseinfo2.setIdcardno(idcardno); |
| | |
| | | return AjaxResult.error("新增时身份证" + idcardno + "已存在,无法保存!"); |
| | | } |
| | | |
| | | serviceDonatebaseinfo.setDonorno(bh); |
| | | // serviceDonatebaseinfo.setDonorno(bh); |
| | | serviceDonatebaseinfo.setDeptid(user.getDeptId()); |
| | | serviceDonatebaseinfo.setDeptname(sysDeptMapper.getDeptNameByDeptId(user.getDeptId())); |
| | | serviceDonatebaseinfoService.save(serviceDonatebaseinfo); |
| | |
| | | * 修改捐献基础 |
| | | */ |
| | | @ApiOperation("修改潜在捐献信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:edit')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:edit')") |
| | | @Log(title = "捐献基础", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @RepeatSubmit |
| | | public AjaxResult edit(@RequestBody ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("修改潜在捐献信息:{}", serviceDonatebaseinfo); |
| | | return toAjax(serviceDonatebaseinfoService.updateById(serviceDonatebaseinfo)); |
| | | } |
| | | |
| | |
| | | * 删除捐献基础 |
| | | */ |
| | | @ApiOperation("删除潜在捐献信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatebaseinfo:remove')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatebaseinfo:remove')") |
| | | @Log(title = "捐献基础", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | log.info("删除潜在捐献信息:{}", ids); |
| | | return toAjax(serviceDonatebaseinfoService.removeByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @ApiOperation("获取捐献编号") |
| | | @GetMapping("/donatenumber") |
| | | public AjaxResult getDonateNumber(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | @PostMapping("/donatenumber") |
| | | public AjaxResult getDonateNumber(@RequestBody ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | log.info("获取捐献编号:{}", serviceDonatebaseinfo); |
| | | return AjaxResult.success(serviceDonatebaseinfoService.getDonateNumber(serviceDonatebaseinfo)); |
| | | } |
| | | |
| | |
| | | @ApiOperation("获取捐献报告人") |
| | | @GetMapping("/reportName/{usertype}") |
| | | public AjaxResult getReportName(@PathVariable("usertype") String usertype) { |
| | | log.info("获取捐献报告人:{}", usertype); |
| | | return AjaxResult.success(serviceExternalpersonService.getReportName(usertype)); |
| | | } |
| | | |
| | | @GetMapping(value = "/updateS1S2S3S4/{id}") |
| | | public AjaxResult updateS1S2S3S4(@PathVariable Long id) { |
| | | log.info("updateS1S2S3S4的入参:{}", id); |
| | | return AjaxResult.success(serviceDonatebaseinfoService.updateS1S2S3S4(id)); |
| | | } |
| | | |
| | |
| | | @ApiOperation("通过id下载人体器官潜在捐献者登记表") |
| | | @GetMapping(value = "/download/{id}") |
| | | public Map downloadInfo(@PathVariable("id") Long id) throws IOException { |
| | | log.info("通过id下载人体器官潜在捐献者登记表:{}", id); |
| | | Map dataMap = new HashMap(); |
| | | getData(dataMap, id); |
| | | String filePath = getClass().getResource("/template/").getPath(); |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc"); |
| | | map.put("downloadName", name + ".doc"); |
| | | return map; |
| | | } |
| | | |
| | |
| | | @ApiOperation("获取状态获取计数") |
| | | @GetMapping("/countByRecordState") |
| | | public AjaxResult countByRecordState(TimeVO timeVO) { |
| | | log.info("获取状态获取计数:{}", timeVO); |
| | | return AjaxResult.success(serviceDonatebaseinfoService.countByRecordState(timeVO)); |
| | | } |
| | | |
| | |
| | | @ApiOperation("获取捐献工作流") |
| | | @GetMapping(value = "/getWorkFlow/{id}") |
| | | public AjaxResult getWorkFlow(@PathVariable("id") Long id) { |
| | | log.info("获取捐献工作流:{}", id); |
| | | return AjaxResult.success(serviceDonatebaseinfoService.getWorkFlow(id)); |
| | | } |
| | | |