liusheng
2024-03-20 4c95b4e5fee50a03c8ba964264ea3ef163e7805b
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonorchargeorganController.java
@@ -1,17 +1,21 @@
package com.ruoyi.web.controller.project;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceDonorchargeorgan;
import com.ruoyi.project.domain.ServiceDonorchargeorganVO;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.service.IServiceDonorchargeorganService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -46,9 +50,23 @@
    @PreAuthorize("@ss.hasPermi('project:donorchargeorgan:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceDonorchargeorgan serviceDonorchargeorgan) {
        log.info("查询捐献器官列表的入参:{}", serviceDonorchargeorgan);
        startPage();
        List<ServiceDonorchargeorgan> list = serviceDonorchargeorganService.queryList(serviceDonorchargeorgan);
        return getDataTable(list);
        List<ServiceDonorchargeorgan> list = null;
        if (serviceDonorchargeorgan.getPaymentidIsNotNull()) {
            list = serviceDonorchargeorganService.queryList(serviceDonorchargeorgan);
        } else {
            list = serviceDonorchargeorganService.queryListBypaymentidIsNull(serviceDonorchargeorgan);
        }
        List<ServiceDonorchargeorganVO> serviceDonorchargeorganVOList = DtoConversionUtils.sourceToTarget(list, ServiceDonorchargeorganVO.class);
        for (ServiceDonorchargeorganVO serviceDonorchargeorganVO : serviceDonorchargeorganVOList) {
            if (!StringUtils.isEmpty(serviceDonorchargeorganVO.getAnnexFiles())) {
                List<RbDetailFile> rbDetailFiles = JSONArray.parseArray(serviceDonorchargeorganVO.getAnnexFiles(), RbDetailFile.class);
                serviceDonorchargeorganVO.setAnnexFilesList(rbDetailFiles);
            }
        }
        return getDataTable2(serviceDonorchargeorganVOList, list);
    }
    /**
@@ -122,19 +140,30 @@
    @ApiOperation("新增或修改捐献器官")
    @Log(title = "捐献器官", businessType = BusinessType.UPDATE)
    @PostMapping("/saveOrUpdateDonorchargeorgan")
    public AjaxResult saveOrUpdateDonorchargeorgan(@RequestBody List<ServiceDonorchargeorgan> serviceDonorchargeorganList) {
    public AjaxResult saveOrUpdateDonorchargeorgan(@RequestBody List<ServiceDonorchargeorganVO> serviceDonorchargeorganList) {
        if (CollectionUtils.isEmpty(serviceDonorchargeorganList)) {
            throw new BaseException("请检查需要新增或修改的捐献器官参数是否完整");
        }
        Boolean i = null;
        for (ServiceDonorchargeorgan serviceDonorchargeorgan : serviceDonorchargeorganList) {
            log.info("捐献器官id是否为空 : {},基础表的id为 : {}", serviceDonorchargeorgan.getId(), serviceDonorchargeorgan.getInfoid());
        for (ServiceDonorchargeorganVO serviceDonorchargeorganVO : serviceDonorchargeorganList) {
            log.info("捐献器官id是否为空 : {},基础表的id为 : {}", serviceDonorchargeorganVO.getId(), serviceDonorchargeorganVO.getInfoid());
            ServiceDonorchargeorgan serviceDonorchargeorgan = DtoConversionUtils.sourceToTarget(serviceDonorchargeorganVO, ServiceDonorchargeorgan.class);
            serviceDonorchargeorgan.setAnnexFiles(JSON.toJSONString(serviceDonorchargeorganVO.getAnnexFilesList()));
            if (serviceDonorchargeorgan.getDel_flag() == null) {
                serviceDonorchargeorgan.setDel_flag(0);
            }
            if (serviceDonorchargeorgan.getId() == null) {
                i = serviceDonorchargeorganService.save(serviceDonorchargeorgan);
            } else {
                i = serviceDonorchargeorganService.updateById(serviceDonorchargeorgan);
                i = serviceDonorchargeorganService.updateDonorchargeorgan(serviceDonorchargeorgan);
            }
        }
        return toAjax(i);
    }
    @ApiOperation("收费统计")
    @PostMapping("/getListBySpStatChange")
    public TableDataInfo getListBySpStatChange(@RequestBody SpStatChangeReq spStatChangeReq) {
        return getDataTable(serviceDonorchargeorganService.getListBySpStatChange(spStatChangeReq));
    }
}