liusheng
2023-11-17 054cfdd53b732d2f60627fc9ac7cf92233d3c200
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
@@ -1,37 +1,29 @@
package com.ruoyi.web.controller.project;
import java.util.Arrays;
import java.util.List;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.DonateOrganVO;
import com.ruoyi.project.domain.vo.NumberOfOrgans;
import com.ruoyi.project.domain.vo.TimeVO;
import com.ruoyi.project.mapper.BaseOrganizationMapper;
import com.ruoyi.project.service.IServiceDonatebaseinfoService;
import com.ruoyi.project.service.IServiceOrganallocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.NotRepeatCommit;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.service.IServiceDonateorganService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceDonateorgan;
import com.ruoyi.project.domain.ServiceDonateorganVO;
import com.ruoyi.project.domain.ServiceOrganallocation;
import com.ruoyi.project.domain.vo.DonateOrganVO;
import com.ruoyi.project.domain.vo.TimeVO;
import com.ruoyi.project.service.IServiceDonateorganService;
import com.ruoyi.project.service.IServiceOrganallocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
/**
 * 捐献器官管理Controller
@@ -61,12 +53,12 @@
        List<ServiceDonateorgan> list = serviceDonateorganService.queryList(serviceDonateorgan);
        if (!CollectionUtils.isEmpty(list)) {
            List<ServiceDonateorganVO> serviceDonateorganVOS = DtoConversionUtils.sourceToTarget(list, ServiceDonateorganVO.class);
            for (ServiceDonateorganVO serviceDonateorganVO : serviceDonateorganVOS) {
                ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation();
                serviceOrganallocation.setOrganid(serviceDonateorganVO.getId());
                List<ServiceOrganallocation> serviceOrganallocations = serviceOrganallocationService.selectServiceOrganallocationList(serviceOrganallocation);
                serviceDonateorganVO.setServiceOrganallocations(serviceOrganallocations);
            }
//            for (ServiceDonateorganVO serviceDonateorganVO : serviceDonateorganVOS) {
//                ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation();
//                serviceOrganallocation.setOrganid(serviceDonateorganVO.getId());
//                List<ServiceOrganallocation> serviceOrganallocations = serviceOrganallocationService.selectServiceOrganallocationList(serviceOrganallocation);
//                serviceDonateorganVO.setServiceOrganallocations(serviceOrganallocations);
//            }
            return getDataTable(serviceDonateorganVOS);
        }
@@ -142,6 +134,19 @@
        return saveDataTable(serviceDonateorgans1);
    }
    /**
     * 修改器官分配
     */
    @ApiOperation("修改器官分配信息")
    //@PreAuthorize("@ss.hasPermi('project:organallocation:edit')")
    @Log(title = "器官分配", businessType = BusinessType.UPDATE)
    @PostMapping("/editarraydata")
    @RepeatSubmit
    public AjaxResult editArrayData(@RequestBody List<ServiceDonateorgan> serviceDonateorgans) {
        return AjaxResult.success(serviceDonateorganService.editArrayData(serviceDonateorgans));
    }
    /**
     * 修改捐献器官管理
     */