From 0cb32a4fa55bebcba97f4646ec3c401c245b17e5 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 25 四月 2024 15:19:21 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java |  122 ++++++++++++++++++++++++++--------------
 1 files changed, 79 insertions(+), 43 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
index 385bf69..82885bf 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
@@ -1,104 +1,140 @@
-package com.smartor.controller;
+package com.ruoyi.web.controller.smartor;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-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.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.smartor.domain.IvrTask;
-import com.smartor.service.IIvrTaskService;
-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.DtoConversionUtils;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.smartor.domain.IvrTask;
+import com.smartor.domain.IvrTaskVO;
+import com.smartor.domain.IvrTaskSingle;
+import com.smartor.service.IIvrTaskService;
+import com.smartor.service.IIvrTaskSingleService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
- * 璇煶浠诲姟Controller
- * 
+ * 闅忚浠诲姟Controller
+ *
  * @author smartor
  * @date 2023-03-24
  */
+@Api(description = "闅忚浠诲姟")
 @RestController
 @RequestMapping("/smartor/ivrtask")
-public class IvrTaskController extends BaseController
-{
+public class IvrTaskController extends BaseController {
     @Autowired
     private IIvrTaskService ivrTaskService;
+
+    @Autowired
+    private IIvrTaskSingleService iIvrTaskCallService;
 
     /**
      * 鏌ヨ璇煶浠诲姟鍒楄〃
      */
+    @ApiOperation("鏌ヨ浠诲姟鍒楄〃")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:list')")
-   @PostMapping("/list")
-    public TableDataInfo list(@RequestBody IvrTask ivrTask)
-    {
-        startPage();
+    @PostMapping("/list")
+    public TableDataInfo list(@RequestBody IvrTask ivrTask) {
+        PageUtils.startPageByPost(ivrTask.getPageNum(), ivrTask.getPageSize());
         List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask);
-        return getDataTable(list);
+        List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class);
+        if (CollectionUtils.isNotEmpty(ivrTaskVOS)) {
+            for (IvrTaskVO ivrTaskVO : ivrTaskVOS) {
+                IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
+                ivrTaskcall.setTaskid(ivrTaskVO.getTaskid());
+                List<IvrTaskSingle> ivrTaskcalls = iIvrTaskCallService.selectIvrTaskcallList(ivrTaskcall);
+                if (CollectionUtils.isNotEmpty(ivrTaskcalls)) {
+                    //宸插彂閫�
+                    long yfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() != null && ivrTaskcall1.getSendstate() == 3L).collect(Collectors.toList()).stream().count();
+                    //鏈彂閫�
+                    long wfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() != null && ivrTaskcall1.getSendstate() == 2L).collect(Collectors.toList()).stream().count();
+                    ivrTaskVO.setYfs(yfs);
+                    ivrTaskVO.setWfs(wfs);
+                }
+            }
+        }
+        return getDataTable(ivrTaskVOS);
     }
 
     /**
-     * 瀵煎嚭璇煶浠诲姟鍒楄〃
+     * 瀵煎嚭浠诲姟鍒楄〃
      */
+    @ApiOperation("瀵煎嚭浠诲姟鍒楄〃")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:export')")
     @Log(title = "璇煶浠诲姟", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, IvrTask ivrTask)
-    {
+    public void export(HttpServletResponse response, IvrTask ivrTask) {
         List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask);
         ExcelUtil<IvrTask> util = new ExcelUtil<IvrTask>(IvrTask.class);
         util.exportExcel(response, list, "璇煶浠诲姟鏁版嵁");
     }
 
     /**
-     * 鑾峰彇璇煶浠诲姟璇︾粏淇℃伅
+     * 鑾峰彇浠诲姟璇︾粏淇℃伅
      */
+    @ApiOperation("鑾峰彇浠诲姟璇︾粏淇℃伅")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:query')")
     @GetMapping(value = "/{taskid}")
-    public AjaxResult getInfo(@PathVariable("taskid") Long taskid)
-    {
+    public AjaxResult getInfo(@PathVariable("taskid") Long taskid) {
         return success(ivrTaskService.selectIvrTaskByTaskid(taskid));
     }
 
     /**
-     * 鏂板璇煶浠诲姟
+     * 鏂板浠诲姟
      */
+    @ApiOperation("鏂板浠诲姟")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:add')")
     @Log(title = "璇煶浠诲姟", businessType = BusinessType.INSERT)
     @PostMapping("/add")
-    public AjaxResult add(@RequestBody IvrTask ivrTask)
-    {
+    public AjaxResult add(@RequestBody IvrTask ivrTask) {
         return toAjax(ivrTaskService.insertIvrTask(ivrTask));
     }
 
     /**
      * 淇敼璇煶浠诲姟
      */
+    @ApiOperation("淇敼浠诲姟")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:edit')")
-    @Log(title = "璇煶浠诲姟", businessType = BusinessType.UPDATE)
+    @Log(title = "浠诲姟", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")
-    public AjaxResult edit(@RequestBody IvrTask ivrTask)
-    {
+    public AjaxResult edit(@RequestBody IvrTask ivrTask) {
         return toAjax(ivrTaskService.updateIvrTask(ivrTask));
     }
 
+//    /**
+//     * 鍒犻櫎璇煶浠诲姟
+//     */
+//    @ApiOperation("鍒犻櫎浠诲姟")
+//    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')")
+//    @Log(title = "璇煶浠诲姟", businessType = BusinessType.DELETE)
+//    @GetMapping("/remove/{taskids}")
+//    public AjaxResult remove(@PathVariable Long[] taskids) {
+//        return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids));
+//    }
+//
+
     /**
-     * 鍒犻櫎璇煶浠诲姟
+     * 鍒犻櫎浠诲姟(鍖呮嫭瀹冨搴旂殑鎮h�呬俊鎭�)
      */
+    @ApiOperation("鍒犻櫎浠诲姟(鍖呮嫭瀹冨搴旂殑鎮h�呬俊鎭�)")
     @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')")
     @Log(title = "璇煶浠诲姟", businessType = BusinessType.DELETE)
-	@GetMapping("/remove/{taskids}")
-    public AjaxResult remove(@PathVariable Long[] taskids)
-    {
-        return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids));
+    @GetMapping("/remove/{removeTask}")
+    public AjaxResult removeTask(@PathVariable Long taskId) {
+        return toAjax(ivrTaskService.deleteIvrTaskByTaskid(taskId));
     }
+
+
 }

--
Gitblit v1.9.3