From a8b458570fea9039e464150da723b9415b95a64c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 01 二月 2024 16:30:05 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java |  108 +++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 75 insertions(+), 33 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
index 8444488..4b621a4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
@@ -1,37 +1,32 @@
 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.exception.base.BaseException;
+import com.ruoyi.common.utils.bean.DtoConversionUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.project.domain.ServiceDonatecomporgan;
+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 lombok.extern.slf4j.Slf4j;
+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
@@ -39,6 +34,7 @@
  * @author ruoyi
  * @date 2021-11-10
  */
+@Slf4j
 @Api("鎹愮尞鍣ㄥ畼绠$悊")
 @RestController
 @RequestMapping("/project/donateorgan")
@@ -61,12 +57,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);
         }
 
@@ -126,6 +122,33 @@
         }
         serviceDonateorgan.setOrgannumber(organNumber);
         return toAjax(serviceDonateorganService.save(serviceDonateorgan));
+    }
+
+
+    /**
+     * 鏂板鎹愮尞鍣ㄥ畼绠$悊
+     */
+    @ApiOperation("鏂板鎹愮尞鍣ㄥ畼淇℃伅")
+    //@PreAuthorize("@ss.hasPermi('project:donateorgan:add')")
+    @Log(title = "鎹愮尞鍣ㄥ畼绠$悊", businessType = BusinessType.INSERT)
+    @PostMapping("/addData")
+    @RepeatSubmit
+    public TableDataInfo addData(@RequestBody List<ServiceDonateorgan> serviceDonateorgans) {
+        List<ServiceDonateorgan> serviceDonateorgans1 = serviceDonateorganService.saveData(serviceDonateorgans);
+        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));
     }
 
     /**
@@ -261,5 +284,24 @@
         return AjaxResult.success(serviceDonateorganService.getOrganCount(timeVO));
     }
 
+    @RepeatSubmit
+    @ApiOperation("鏂板鎴栦慨鏀规崘鐚櫒瀹樼鐞�")
+    @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.UPDATE)
+    @PostMapping("/saveOrUpdateDonateorgan")
+    public AjaxResult saveOrUpdateDonateorgan(@RequestBody List<ServiceDonateorgan> serviceDonateorganList) {
+        if (CollectionUtils.isEmpty(serviceDonateorganList)) {
+            throw new BaseException("璇锋鏌ラ渶瑕佹柊澧炴垨淇敼鐨勬崘鐚櫒瀹樼鐞嗗弬鏁版槸鍚﹀畬鏁�");
+        }
+        Boolean i = null;
+        for (ServiceDonateorgan serviceDonateorgan : serviceDonateorganList) {
+            log.info("鎹愮尞鍣ㄥ畼绉绘id鏄惁涓虹┖ : {},鍩虹琛ㄧ殑id涓� : {}", serviceDonateorgan.getId(), serviceDonateorgan.getInfoid());
+            if (serviceDonateorgan.getId() == null) {
+                i = serviceDonateorganService.save(serviceDonateorgan);
+            } else {
+                i = serviceDonateorganService.updateById(serviceDonateorgan);
+            }
+        }
+        return toAjax(i);
+    }
 
 }

--
Gitblit v1.9.3