From fdf1b9c1e4489a0c2615fa596268b2f71fad7b4c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 15 四月 2024 09:08:10 +0800
Subject: [PATCH] 代码提交
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java | 183 +++++++++++++++++++++++++++++----------------
1 files changed, 117 insertions(+), 66 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
index 13325e6..e4a0f9f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
@@ -1,104 +1,155 @@
-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.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
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.IvrTaskcall;
-import com.smartor.service.IIvrTaskcallService;
-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.DateUtils;
+import com.ruoyi.common.utils.DtoConversionUtils;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.smartor.domain.*;
+import com.smartor.service.IIvrTaskcallService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.ArrayList;
+import java.util.List;
+import java.util.Map;
/**
- * 璇煶浠诲姟鍛煎彨Controller
- *
- * @author smartor
- * @date 2023-03-24
+ * 鍗曚竴浠诲姟锛堥殢璁匡級Controller
+ *
+ * @author ruoyi
+ * @date 2024-02-02
*/
+@Api(description = "鍗曚竴浠诲姟锛堥殢璁垮鏁欙級")
@RestController
-@RequestMapping("/smartor/ivrtaskcall")
-public class IvrTaskcallController extends BaseController
-{
+@RequestMapping("/smartor/taskcall")
+public class IvrTaskcallController extends BaseController {
@Autowired
private IIvrTaskcallService ivrTaskcallService;
/**
- * 鏌ヨ璇煶浠诲姟鍛煎彨鍒楄〃
+ * 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃
*/
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:list')")
- @PostMapping("/list")
- public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall)
- {
- startPage();
+ @ApiOperation("鏌ヨ鍗曚竴浠诲姟锛堥殢璁垮鏁欙級鍒楄〃")
+ @PreAuthorize("@ss.hasPermi('system:taskcall:list')")
+ @PostMapping("/list")
+ public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall) {
+ PageUtils.startPageByPost(ivrTaskcall.getPageNum(), ivrTaskcall.getPageSize());
List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
return getDataTable(list);
}
/**
- * 瀵煎嚭璇煶浠诲姟鍛煎彨鍒楄〃
+ * 瀵煎嚭鍗曚竴浠诲姟锛堥殢璁垮鏁欙級鍒楄〃
*/
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:export')")
- @Log(title = "璇煶浠诲姟鍛煎彨", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:taskcall:export')")
+ @Log(title = "鍗曚竴浠诲姟锛堥殢璁垮鏁欙級", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, IvrTaskcall ivrTaskcall)
- {
+ public void export(HttpServletResponse response, IvrTaskcall ivrTaskcall) {
List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
ExcelUtil<IvrTaskcall> util = new ExcelUtil<IvrTaskcall>(IvrTaskcall.class);
- util.exportExcel(response, list, "璇煶浠诲姟鍛煎彨鏁版嵁");
+ util.exportExcel(response, list, "鍗曚竴浠诲姟锛堥殢璁匡級鏁版嵁");
}
/**
- * 鑾峰彇璇煶浠诲姟鍛煎彨璇︾粏淇℃伅
+ * 鑾峰彇鍗曚竴浠诲姟锛堥殢璁匡級璇︾粏淇℃伅
*/
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:query')")
- @GetMapping(value = "/{callid}")
- public AjaxResult getInfo(@PathVariable("callid") Long callid)
- {
- return success(ivrTaskcallService.selectIvrTaskcallByCallid(callid));
+ @PreAuthorize("@ss.hasPermi('system:taskcall:query')")
+ @GetMapping(value = "/getInfo/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return success(ivrTaskcallService.selectIvrTaskcallById(id));
}
/**
- * 鏂板璇煶浠诲姟鍛煎彨
+ * 鏂板鎴栦慨鏀瑰垹闄ゅ崟涓�浠诲姟
*/
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:add')")
- @Log(title = "璇煶浠诲姟鍛煎彨", businessType = BusinessType.INSERT)
- @PostMapping("/add")
- public AjaxResult add(@RequestBody IvrTaskcall ivrTaskcall)
- {
- return toAjax(ivrTaskcallService.insertIvrTaskcall(ivrTaskcall));
+ @ApiOperation("鏂板鎴栦慨鏀瑰垹闄ゅ崟涓�浠诲姟")
+ @PreAuthorize("@ss.hasPermi('system:task:add')")
+ @Log(title = "鍗曚竴浠诲姟锛堥殢璁匡級", businessType = BusinessType.INSERT)
+ @PostMapping("/insertOrUpdateTask")
+ public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
+ return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO));
}
- /**
- * 淇敼璇煶浠诲姟鍛煎彨
- */
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:edit')")
- @Log(title = "璇煶浠诲姟鍛煎彨", businessType = BusinessType.UPDATE)
- @PostMapping("/edit")
- public AjaxResult edit(@RequestBody IvrTaskcall ivrTaskcall)
- {
- return toAjax(ivrTaskcallService.updateIvrTaskcall(ivrTaskcall));
- }
/**
- * 鍒犻櫎璇煶浠诲姟鍛煎彨
+ * 鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅
*/
- @PreAuthorize("@ss.hasPermi('smartor:ivrtaskcall:remove')")
- @Log(title = "璇煶浠诲姟鍛煎彨", businessType = BusinessType.DELETE)
- @GetMapping("/remove/{callids}")
- public AjaxResult remove(@PathVariable Long[] callids)
- {
- return toAjax(ivrTaskcallService.deleteIvrTaskcallByCallids(callids));
+ @ApiOperation("鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅")
+ @PostMapping("/queryTaskByCondition")
+ public AjaxResult queryTaskByCondition(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
+ //鏍规嵁鍏ュ弬鏌ヨ淇℃伅
+ IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class);
+ List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
+
+ //瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚�
+ List<PatTaskRelevance> patTaskRelevances = new ArrayList<>();
+
+ //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆IvrTaskcallVO涓�
+ IvrTaskcallVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskcallVO.class);
+ String sendTimeSlot = list.get(0).getSendTimeSlot();
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ //鑾峰彇鍒板彂閫佹椂闂寸殑闆嗗悎
+ if (StringUtils.isNotEmpty(sendTimeSlot)) {
+ List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class);
+ ivrTaskcallVO2.setSendTimeslot(taskSendTimeVOList);
+ }
+ //鏂囨湰鍙橀噺鍙傛暟
+ if (StringUtils.isNotEmpty(list.get(0).getTextParam())) {
+ Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class);
+ ivrTaskcallVO2.setTextParam(textParam);
+ }
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+
+ for (IvrTaskcall ivrTaskcall1 : list) {
+ PatTaskRelevance patTaskRelevance = new PatTaskRelevance();
+ //鑾峰彇鍒版偅鑰呬俊鎭紝骞舵斁鍏ュ埌闆嗗悎涓�
+ patTaskRelevance.setName(ivrTaskcall1.getSendname());
+ patTaskRelevance.setAge(ivrTaskcall1.getAge());
+ patTaskRelevance.setSfzh(ivrTaskcall1.getSfzh());
+ patTaskRelevance.setPhone(ivrTaskcall1.getPhone());
+ patTaskRelevance.setAddr(ivrTaskcall1.getAddr());
+ patTaskRelevances.add(patTaskRelevance);
+ }
+
+ ivrTaskcallVO2.setPatTaskRelevances(patTaskRelevances);
+ return success(ivrTaskcallVO2);
}
+
+
+ /**
+ * 浠诲姟鍙戦�佹墽琛�
+ */
+ @ApiOperation("浠诲姟鍙戦�佹墽琛�")
+ @PostMapping("/heTaskSend")
+ public AjaxResult heTaskSend(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
+ return toAjax(ivrTaskcallService.heTaskSend(ivrTaskcallVO));
+ }
+
+
+ /**
+ * 鐢佃瘽鍥炶皟浠诲姟
+ */
+ @ApiOperation("鐢佃瘽鍥炶皟浠诲姟")
+ @PostMapping("/phoneCallBack")
+ public AjaxResult phoneCallBack(@RequestBody PhoneCallBackVO phoneCallBackVO) {
+ //濡傛灉uuid鍦╮edis涓壘涓嶅埌锛岄偅灏辩洿鎺ユ姤寮傚父
+ return success(ivrTaskcallService.phoneCallBack(phoneCallBackVO));
+ }
+
}
--
Gitblit v1.9.3