| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.common.annotation.NotRepeatCommit; |
| | | import com.ruoyi.common.annotation.UniqueCheck; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.enums.OrganEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.project.domain.ServiceDonatebaseinfo; |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.project.domain.vo.ServiceDonationwitnessVO; |
| | | import com.ruoyi.project.domain.vo.DonationwitnessBaseInfoVO; |
| | | import com.ruoyi.project.domain.ServiceDonateorgan; |
| | | import com.ruoyi.project.domain.ServiceDonationwitnessorgan; |
| | | import com.ruoyi.project.domain.dto.DonationwitnessBaseInfoDTO; |
| | | import com.ruoyi.project.domain.vo.DonationWitnessVO; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.service.IBaseOnlyvalueService; |
| | | import com.ruoyi.project.service.IServiceDonatebaseinfoService; |
| | | import com.ruoyi.project.service.IServiceDonateorganService; |
| | | import com.ruoyi.project.service.*; |
| | | import com.ruoyi.web.controller.common.OnlyValueCommon; |
| | | import freemarker.template.Configuration; |
| | | import freemarker.template.Template; |
| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.project.domain.ServiceDonationwitness; |
| | | import com.ruoyi.project.service.IServiceDonationwitnessService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * 捐献见证Controller |
| | |
| | | * @date 2021-11-17 |
| | | */ |
| | | @Slf4j |
| | | @Api("捐献见证管理") |
| | | @Api(description = "捐献见证管理") |
| | | @RestController |
| | | @RequestMapping("/project/donationwitness") |
| | | public class ServiceDonationwitnessController extends BaseController { |
| | |
| | | configuration.setDefaultEncoding("utf-8"); |
| | | } |
| | | |
| | | /** |
| | | * 查询捐献见证列表 |
| | | */ |
| | | @ApiOperation("获取捐献见证列表") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donationwitness:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ServiceDonationwitness serviceDonationwitness) { |
| | | startPage(); |
| | | List<ServiceDonationwitness> list = serviceDonationwitnessService.queryList(serviceDonationwitness); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @ApiOperation("获取捐献见证列表-新") |
| | | @GetMapping("/listnew") |
| | | public TableDataInfo listnew(DonationWitnessVO donationWitnessVO) { |
| | | startPage(); |
| | | List<DonationWitnessVO> list = serviceDonationwitnessService.selectVOList(donationWitnessVO); |
| | | return getDataTable(list); |
| | | @ApiOperation("获取捐献见证基本信息(器官获取)") |
| | | @PostMapping("/getDonationwitnessBaseInfo") |
| | | public Map<String, Object> getDonationwitnessBaseInfo(@RequestBody DonationwitnessBaseInfoVO donationwitnessBaseInfoVO) { |
| | | Integer offset = PageUtils.getOffset(donationwitnessBaseInfoVO.getPageNum(), donationwitnessBaseInfoVO.getPageSize()); |
| | | donationwitnessBaseInfoVO.setPageNum(offset); |
| | | List<DonationwitnessBaseInfoDTO> donationwitnessBaseInfo = serviceDonationwitnessService.getDonationwitnessBaseInfo(donationwitnessBaseInfoVO); |
| | | |
| | | donationwitnessBaseInfoVO.setPageNum(null); |
| | | donationwitnessBaseInfoVO.setPageSize(null); |
| | | Integer totalCount = 0; |
| | | List<DonationwitnessBaseInfoDTO> total = serviceDonationwitnessService.getDonationwitnessBaseInfo(donationwitnessBaseInfoVO); |
| | | if (!CollectionUtils.isEmpty(total)) totalCount = total.size(); |
| | | return getDataTable(donationwitnessBaseInfo, totalCount); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @ApiOperation("通过id获取见证信息") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donationwitness:query')") |
| | | @GetMapping(value = "/{id}") |
| | | @GetMapping(value = "/getInfo/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(serviceDonationwitnessService.getById(id)); |
| | | } |
| | |
| | | * 新增捐献见证 |
| | | */ |
| | | @ApiOperation("新增捐献见证") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donationwitness:add')") |
| | | @Log(title = "捐献见证", businessType = BusinessType.INSERT) |
| | | @UniqueCheck( |
| | | fields = {"infoid"}, |
| | | entityClass = ServiceDonationwitnessVO.class, |
| | | serviceClass = IServiceDonationwitnessService.class, |
| | | message = "新增捐献见证的infoid已存在,无法保存!" |
| | | ) |
| | | @PostMapping("/add") |
| | | @RepeatSubmit |
| | | public AjaxResult add(@RequestBody ServiceDonationwitness serviceDonationwitness) { |
| | | boolean save = serviceDonationwitnessService.save(serviceDonationwitness); |
| | | log.info("新增捐献见证是否成功:{},id为:{},infoId为:{}", save, serviceDonationwitness.getId(), serviceDonationwitness.getInfoid()); |
| | | // if (save) { |
| | | // //生成“捐献者编号” |
| | | // ServiceDonatebaseinfo serviceDonatebaseinfo = serviceDonatebaseinfoService.getById(serviceDonationwitness.getInfoid()); |
| | | // log.info("serviceDonatebaseinfo的信息为{}", serviceDonatebaseinfo); |
| | | // String donorno = serviceDonatebaseinfoService.getDonateNumber(serviceDonatebaseinfo); |
| | | // log.info("生成的捐献者编号为:{}", donorno); |
| | | // serviceDonatebaseinfo.setDonorno(donorno); |
| | | // serviceDonatebaseinfoService.updateById(serviceDonatebaseinfo); |
| | | // } |
| | | return AjaxResult.success(serviceDonationwitness); |
| | | public AjaxResult add(@RequestBody ServiceDonationwitnessVO serviceDonationwitnessVO) { |
| | | boolean save = serviceDonationwitnessService.add(serviceDonationwitnessVO); |
| | | log.info("新增捐献见证是否成功:{},id为:{},infoId为:{}", save, serviceDonationwitnessVO.getId(), serviceDonationwitnessVO.getInfoid()); |
| | | return AjaxResult.success(save); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "捐献见证", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | @RepeatSubmit |
| | | public AjaxResult edit(@RequestBody ServiceDonationwitness serviceDonationwitness) { |
| | | log.info("新增捐献见证id为:{},infoId为:{}", serviceDonationwitness.getId(), serviceDonationwitness.getInfoid()); |
| | | |
| | | int last = -1; |
| | | if (StringUtils.isNotEmpty(serviceDonationwitness.getDonorno())) { |
| | | last = serviceDonationwitness.getDonorno().lastIndexOf("*"); |
| | | } |
| | | //捐献者编号最后一位是 * ,才可以往唯一里表加数据 |
| | | if (last == serviceDonationwitness.getDonorno().length()) { |
| | | onlyValueCommon.addOnlyValue("donationwitness"); |
| | | } |
| | | |
| | | return toAjax(serviceDonationwitnessService.updateById(serviceDonationwitness)); |
| | | public AjaxResult edit(@RequestBody ServiceDonationwitnessVO serviceDonationwitnessVO) { |
| | | log.info("新增捐献见证id为:{},infoId为:{}", serviceDonationwitnessVO.getId(), serviceDonationwitnessVO.getInfoid()); |
| | | Boolean edit = serviceDonationwitnessService.edit(serviceDonationwitnessVO); |
| | | return toAjax(edit); |
| | | } |
| | | |
| | | /** |
| | |
| | | log.info("捐献见证管理id是否为空 : {},基础表的id为 : {}", serviceDonationwitness.getId(), serviceDonationwitness.getInfoid()); |
| | | ServiceDonationwitness sd2 = new ServiceDonationwitness(); |
| | | sd2.setInfoid(serviceDonationwitness.getInfoid()); |
| | | sd2.setDel_flag(0); |
| | | sd2.setDelFlag(0); |
| | | List<ServiceDonationwitness> serviceDonationwitnesses = serviceDonationwitnessService.queryList(sd2); |
| | | if (!CollectionUtils.isEmpty(serviceDonationwitnesses)) { |
| | | serviceDonationwitness.setId(serviceDonationwitnesses.get(0).getId()); |