From b6dd47b05107fc36d8ff4f7f29a4446521f95503 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 02 一月 2025 18:44:28 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonatecompletioninfoController.java |   80 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonatecompletioninfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonatecompletioninfoController.java
index 3895d03..0c05ca2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonatecompletioninfoController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonatecompletioninfoController.java
@@ -8,17 +8,22 @@
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.enums.OrganEnum;
+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.ServiceDonatecompletioninfo;
 import com.ruoyi.project.domain.ServiceDonateorgan;
 import com.ruoyi.project.domain.vo.DonationCompletionVO;
 import com.ruoyi.project.service.IServiceDonatecompletioninfoService;
+import com.ruoyi.project.service.IServiceDonatecomporganService;
 import com.ruoyi.project.service.IServiceDonateorganService;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -33,6 +38,7 @@
  * @author ruoyi
  * @date 2021-11-19
  */
+@Slf4j
 @Api("鎹愮尞瀹屾垚鐧昏绠$悊")
 @RestController
 @RequestMapping("/project/donatecompletioninfo")
@@ -42,6 +48,9 @@
 
     @Autowired
     private IServiceDonateorganService serviceDonateorganService;
+
+    @Autowired
+    private IServiceDonatecomporganService serviceDonatecomporganService;
 
     private static Configuration configuration = null;
 
@@ -54,9 +63,10 @@
      * 鏌ヨ鎹愮尞瀹屾垚鍒楄〃
      */
     @ApiOperation("鏌ヨ鎹愮尞瀹屾垚鍒楄〃")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')")
     @GetMapping("/list")
     public TableDataInfo list(ServiceDonatecompletioninfo serviceDonatecompletioninfo) {
+        log.info("鏌ヨ鎹愮尞瀹屾垚鍒楄〃锛歿}", serviceDonatecompletioninfo);
         startPage();
         List<ServiceDonatecompletioninfo> list = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo);
         return getDataTable(list);
@@ -66,6 +76,7 @@
     @GetMapping("/listnew")
     @Log(title = "鏌ヨ鎹愮尞瀹屾垚鍒楄〃锛堟柊锛�", businessType = BusinessType.OTHER)
     public TableDataInfo listnew(DonationCompletionVO donationCompletionVO) {
+        log.info("鏌ヨ鎹愮尞瀹屾垚鍒楄〃锛堟柊锛夛細{}", donationCompletionVO);
         startPage();
         List<DonationCompletionVO> list = serviceDonatecompletioninfoService.selectVOList(donationCompletionVO);
         return getDataTable(list);
@@ -76,10 +87,11 @@
      * 瀵煎嚭鎹愮尞瀹屾垚鍒楄〃
      */
     @ApiOperation("瀵煎嚭鎹愮尞瀹屾垚鍒楄〃")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')")
     @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(ServiceDonatecompletioninfo serviceDonatecompletioninfo) {
+        log.info("瀵煎嚭鎹愮尞瀹屾垚鍒楄〃锛堟柊锛夛細{}", serviceDonatecompletioninfo);
         List<ServiceDonatecompletioninfo> list = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo);
         ExcelUtil<ServiceDonatecompletioninfo> util = new ExcelUtil<ServiceDonatecompletioninfo>(ServiceDonatecompletioninfo.class);
         return util.exportExcel(list, "鎹愮尞瀹屾垚鏁版嵁");
@@ -89,9 +101,10 @@
      * 鑾峰彇鎹愮尞瀹屾垚璇︾粏淇℃伅
      */
     @ApiOperation("閫氳繃id鑾峰彇鏌愪竴鏉℃崘鐚畬鎴愪俊鎭�")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id) {
+        log.info("閫氳繃id鑾峰彇鏌愪竴鏉℃崘鐚畬鎴愪俊鎭細{}", id);
         return AjaxResult.success(serviceDonatecompletioninfoService.getById(id));
     }
 
@@ -99,13 +112,60 @@
      * 鏂板鎹愮尞瀹屾垚
      */
     @ApiOperation("鏂板鎹愮尞瀹屾垚")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')")
     @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.INSERT)
-    @PostMapping
+    @PostMapping("/add")
     @RepeatSubmit(interval = 5000)
     public AjaxResult add(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) {
+        log.info("鏂板鎹愮尞瀹屾垚锛歿}", serviceDonatecompletioninfo);
         serviceDonatecompletioninfoService.delDuplicateDonateCompletioninfo(serviceDonatecompletioninfo.getInfoid(), serviceDonatecompletioninfo.getCreateBy());
-        return toAjax(serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo));
+        boolean save = serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo);
+        log.info("鏂板鎹愮尞瀹屾垚serviceDonatecompletioninfo鐨処D锛歿}", serviceDonatecompletioninfo.getId());
+        return AjaxResult.success(serviceDonatecompletioninfo);
+    }
+
+//    /**
+//     * 鏂板鎹愮尞瀹屾垚璇︽儏
+//     */
+//    @ApiOperation("鏂板鎹愮尞瀹屾垚璇︽儏")
+//    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')")
+//    @Log(title = "鏂板鎹愮尞瀹屾垚璇︽儏", businessType = BusinessType.INSERT)
+//    @PostMapping
+//    @RepeatSubmit(interval = 5000)
+//    public AjaxResult addDetail(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) {
+//        log.info("鏂板鎹愮尞瀹屾垚锛歿}", serviceDonatecompletioninfo);
+//        serviceDonatecompletioninfoService.delDuplicateDonateCompletioninfo(serviceDonatecompletioninfo.getInfoid(), serviceDonatecompletioninfo.getCreateBy());
+//        //鏂板donatecomporgan鏁版嵁
+//        if (CollectionUtils.isNotEmpty(serviceDonatecompletioninfo.getServiceDonatecomporganList())) {
+//            for (ServiceDonatecomporgan serviceDonatecomporgan : serviceDonatecompletioninfo.getServiceDonatecomporganList()) {
+//                if (serviceDonatecomporgan.getInfoid() == null) {
+//                    throw new BaseException("璇锋鏌ユ崘鐚櫒瀹樼Щ妞嶄俊鎭紝鏄惁涓庢崘鐚熀纭�琛ㄨ繘琛屽叧鑱�");
+//                }
+//                serviceDonatecomporganService.save(serviceDonatecomporgan);
+//            }
+//        }
+//        return toAjax(serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo));
+//    }
+
+    @RepeatSubmit
+    @ApiOperation("鏂板鎴栦慨鏀规崘鐚畬鎴�")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')")
+    @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.UPDATE)
+    @PostMapping("/saveOrUpdateDonatecompletioninfo")
+    public AjaxResult saveOrUpdateDonatecompletioninfo(@RequestBody List<ServiceDonatecompletioninfo> serviceDonatecompletioninfoList) {
+        if (CollectionUtils.isEmpty(serviceDonatecompletioninfoList)) {
+            throw new BaseException("璇锋鏌ラ渶瑕佹柊澧炴垨淇敼鐨勬崘鐚畬鎴愬弬鏁版槸鍚﹀畬鏁�");
+        }
+        Boolean i = null;
+        for (ServiceDonatecompletioninfo serviceDonatecompletioninfo : serviceDonatecompletioninfoList) {
+            log.info("鎹愮尞瀹屾垚id鏄惁涓虹┖ : {},鍩虹琛ㄧ殑id涓� : {}", serviceDonatecompletioninfo.getId(), serviceDonatecompletioninfo.getInfoid());
+            if (serviceDonatecompletioninfo.getId() == null) {
+                i = serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo);
+            } else {
+                i = serviceDonatecompletioninfoService.updateById(serviceDonatecompletioninfo);
+            }
+        }
+        return toAjax(i);
     }
 
     /**
@@ -113,13 +173,16 @@
      */
     @RepeatSubmit
     @ApiOperation("淇敼鎹愮尞瀹屾垚")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')")
     @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
     public AjaxResult edit(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) {
         ServiceDonatecompletioninfo serviceDonatecompletioninfo1 = new ServiceDonatecompletioninfo();
         serviceDonatecompletioninfo1.setInfoid(serviceDonatecompletioninfo.getInfoid());
         List<ServiceDonatecompletioninfo> list = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo1);
+        if (CollectionUtils.isEmpty(list)) {
+            return error("妗堜緥ID锛屽搴旂殑瀹屾垚鐧昏淇℃伅涓虹┖");
+        }
         serviceDonatecompletioninfo.setId(list.get(0).getId());
         return toAjax(serviceDonatecompletioninfoService.updateById(serviceDonatecompletioninfo));
     }
@@ -128,7 +191,7 @@
      * 鍒犻櫎鎹愮尞瀹屾垚
      */
     @ApiOperation("鍒犻櫎鎹愮尞瀹屾垚")
-    //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')")
+    //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')")
     @Log(title = "鎹愮尞瀹屾垚", businessType = BusinessType.DELETE)
     @GetMapping("/remove/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids) {
@@ -173,6 +236,7 @@
         }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc");
+        map.put("downloadName", name + ".doc");
         return map;
     }
 

--
Gitblit v1.9.3