From 63e17909e1eee7ff54c38827a4096cbad82e5dad Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期二, 16 四月 2024 11:56:55 +0800 Subject: [PATCH] 代码提交 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java | 109 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 90 insertions(+), 19 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 417ca8b..addc3e8 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,16 +1,18 @@ package com.ruoyi.web.controller.smartor; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; 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.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.smartor.domain.HeTaskVO; -import com.smartor.domain.IvrTaskcall; -import com.smartor.domain.IvrTaskcallVO; -import com.smartor.service.IIvrTaskcallService; +import com.smartor.domain.*; +import com.smartor.service.IIvrTaskSingleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -18,7 +20,9 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 鍗曚竴浠诲姟锛堥殢璁匡級Controller @@ -26,34 +30,34 @@ * @author ruoyi * @date 2024-02-02 */ -@Api(description = "鍗曚竴浠诲姟锛堥殢璁匡級") +@Api(description = "鍗曚竴浠诲姟锛堥殢璁垮鏁欙級") @RestController -@RequestMapping("/smartor/taskcall") +@RequestMapping("/smartor/tasksingle") public class IvrTaskcallController extends BaseController { @Autowired - private IIvrTaskcallService ivrTaskcallService; + private IIvrTaskSingleService ivrTaskcallService; + /** - * 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃 + * 鏌ヨ鎮h�呴殢璁夸俊鎭� */ - @ApiOperation("鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃") + @ApiOperation("鏌ヨ鎮h�呴殢璁夸俊鎭�") @PreAuthorize("@ss.hasPermi('system:taskcall:list')") - @PostMapping("/list") - public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall) { + @PostMapping("/patItem") + public TableDataInfo patItem(@RequestBody IvrTaskSingle ivrTaskcall) { PageUtils.startPageByPost(ivrTaskcall.getPageNum(), ivrTaskcall.getPageSize()); - List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); - return getDataTable(list); + return getDataTable(ivrTaskcallService.patItem(ivrTaskcall)); } /** - * 瀵煎嚭鍗曚竴浠诲姟锛堥殢璁匡級鍒楄〃 + * 瀵煎嚭鍗曚竴浠诲姟锛堥殢璁垮鏁欙級鍒楄〃 */ @PreAuthorize("@ss.hasPermi('system:taskcall:export')") - @Log(title = "鍗曚竴浠诲姟锛堥殢璁匡級", businessType = BusinessType.EXPORT) + @Log(title = "鍗曚竴浠诲姟锛堥殢璁垮鏁欙級", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, IvrTaskcall ivrTaskcall) { - List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); - ExcelUtil<IvrTaskcall> util = new ExcelUtil<IvrTaskcall>(IvrTaskcall.class); + public void export(HttpServletResponse response, IvrTaskSingle ivrTaskcall) { + List<IvrTaskSingle> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); + ExcelUtil<IvrTaskSingle> util = new ExcelUtil<IvrTaskSingle>(IvrTaskSingle.class); util.exportExcel(response, list, "鍗曚竴浠诲姟锛堥殢璁匡級鏁版嵁"); } @@ -73,10 +77,77 @@ @PreAuthorize("@ss.hasPermi('system:task:add')") @Log(title = "鍗曚竴浠诲姟锛堥殢璁匡級", businessType = BusinessType.INSERT) @PostMapping("/insertOrUpdateTask") - public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskcallVO ivrTaskcallVO) { + public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskSingleVO ivrTaskcallVO) { return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO)); } + /** + * 鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅 + */ + @ApiOperation("鏍规嵁鏉′欢鏌ヨ浠诲姟淇℃伅") + @PostMapping("/queryTaskByCondition") + public AjaxResult queryTaskByCondition(@RequestBody IvrTaskSingleVO ivrTaskcallVO) { + //鏍规嵁鍏ュ弬鏌ヨ淇℃伅 + IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class); + List<IvrTaskSingle> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall); + + //瀹氫箟鎮h�呬笌鍗曚竴浠诲姟鍏宠仈琛ㄩ泦鍚� + List<PatTaskRelevance> patTaskRelevances = new ArrayList<>(); + + //灏嗘煡鍑烘潵鐨勬暟鎹�掑叆IvrTaskcallVO涓� + IvrTaskSingleVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.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 (IvrTaskSingle 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 IvrTaskSingleVO 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