liusheng
2024-05-22 9b44e841586ce281e4e3e9d7296d74b29939418b
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceRelativesconfirmationController.java
@@ -9,6 +9,7 @@
import com.ruoyi.common.enums.Education;
import com.ruoyi.common.enums.NationalityEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.project.domain.vo.RelativeConfirmationVO;
import com.ruoyi.project.mapper.ServiceDonatebaseinfoMapper;
import com.ruoyi.project.mapper.ServiceRelativesconfirmationMapper;
@@ -70,7 +71,7 @@
     * 查询捐献亲属确认列表
     */
    @ApiOperation("获取亲属确认列表")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:list')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceRelativesconfirmation serviceRelativesconfirmation) {
        startPage();
@@ -90,7 +91,7 @@
     * 导出捐献亲属确认列表
     */
    @ApiOperation("导出亲属确认列表")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:export')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:export')")
    @Log(title = "捐献亲属确认", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceRelativesconfirmation serviceRelativesconfirmation) {
@@ -103,7 +104,7 @@
     * 获取捐献亲属确认详细信息
     */
    @ApiOperation("通过id获取亲属确认信息")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:query')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceRelativesconfirmationService.getById(id));
@@ -113,30 +114,34 @@
     * 新增捐献亲属确认
     */
    @ApiOperation("新增亲属确认")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:add')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:add')")
    @Log(title = "捐献亲属确认", businessType = BusinessType.INSERT)
    @PostMapping
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
        return toAjax(serviceRelativesconfirmationService.save(serviceRelativesconfirmation));
        boolean save = serviceRelativesconfirmationService.save(serviceRelativesconfirmation);
        return AjaxResult.success(serviceRelativesconfirmation);
    }
    /**
     * 修改捐献亲属确认
     */
    @ApiOperation("修改亲属确认")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:edit')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:edit')")
    @Log(title = "捐献亲属确认", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceRelativesconfirmation serviceRelativesconfirmation) {
        ServiceRelativesconfirmation serviceRelativesconfirmation1 = new ServiceRelativesconfirmation();
        serviceRelativesconfirmation1.setInfoid(serviceRelativesconfirmation.getInfoid());
        List<ServiceRelativesconfirmation> list = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation1);
        if (CollectionUtils.isEmpty(list)) {
            return error("捐献亲属确认数据不存在,请检查后再次修改");
        if (serviceRelativesconfirmation.getInfoid() == null || serviceRelativesconfirmation.getId() == null) {
            throw new BaseException("请联系工程师检查ID是否为空");
        }
        serviceRelativesconfirmation.setId(list.get(0).getId());
//        ServiceRelativesconfirmation serviceRelativesconfirmation1 = new ServiceRelativesconfirmation();
//        serviceRelativesconfirmation1.setInfoid(serviceRelativesconfirmation.getInfoid());
//        List<ServiceRelativesconfirmation> list = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation1);
//        if (CollectionUtils.isEmpty(list)) {
//            return error("捐献亲属确认数据不存在,请检查后再次修改");
//        }
//        serviceRelativesconfirmation.setId(list.get(0).getId());
        return toAjax(serviceRelativesconfirmationService.updateById(serviceRelativesconfirmation));
    }
@@ -144,7 +149,7 @@
     * 删除捐献亲属确认
     */
    @ApiOperation("删除亲属确认")
    //@PreAuthorize("@ss.hasPermi('project:relativesconfirmation:remove')")
    //// @PreAuthorize("@ss.hasPermi('project:relativesconfirmation:remove')")
    @Log(title = "捐献亲属确认", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
@@ -184,17 +189,13 @@
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
        try {
            t.process(dataMap, out);
        } catch (TemplateException e) {
            e.printStackTrace();
        }
        Map<String, Object> map = new HashMap<>();
        map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
        map.put("downloadName", name + ".doc");
        return map;
    }