|
|
@@ -0,0 +1,176 @@
|
|
|
+package com.fs.aiSipCall.controller;
|
|
|
+
|
|
|
+import com.fs.aiSipCall.domain.AiSipCallOutboundCdr;
|
|
|
+import com.fs.aiSipCall.domain.CcCustInfo;
|
|
|
+import com.fs.aiSipCall.param.ApiCallRecordByUuidQueryParams;
|
|
|
+import com.fs.aiSipCall.param.ApiCallRecordQueryParams;
|
|
|
+import com.fs.aiSipCall.service.IAiSipCallOutboundCdrService;
|
|
|
+import com.fs.aiSipCall.utils.DateUtils;
|
|
|
+import com.fs.common.annotation.Log;
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.common.enums.BusinessType;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.common.utils.poi.ExcelUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * aiSIP手动外呼通话记录Controller
|
|
|
+ *
|
|
|
+ * @author fs
|
|
|
+ * @date 2026-03-19
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/aiSipCall/outboundCdr")
|
|
|
+public class AiSipCallOutboundCdrController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private IAiSipCallOutboundCdrService aiSipCallOutboundCdrService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询远程aiSIP手动外呼通话记录列表
|
|
|
+ */
|
|
|
+ @PostMapping("/remoteList")
|
|
|
+ public TableDataInfo remoteList(@RequestBody ApiCallRecordQueryParams aiSipCallOutboundCdr)
|
|
|
+ {
|
|
|
+ return aiSipCallOutboundCdrService.remoteList(aiSipCallOutboundCdr);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 查询aiSIP手动外呼通话记录列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(AiSipCallOutboundCdr aiSipCallOutboundCdr)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<AiSipCallOutboundCdr> list = aiSipCallOutboundCdrService.selectAiSipCallOutboundCdrList(aiSipCallOutboundCdr);
|
|
|
+ list.forEach(data -> {
|
|
|
+ data.setStartTimeStr(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date(data.getStartTime())));
|
|
|
+ data.setAnsweredTimeStr(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date(data.getAnsweredTime())));
|
|
|
+ data.setEndTimeStr(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date(data.getEndTime())));
|
|
|
+ data.setTimeLenSec(DateUtils.formatTimeLength(data.getTimeLen()/1000));
|
|
|
+ data.setTimeLenValidStr(DateUtils.formatTimeLength(data.getTimeLenValid()/1000));
|
|
|
+ });
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出aiSIP手动外呼通话记录列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:export')")
|
|
|
+ @Log(title = "aiSIP手动外呼通话记录", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(AiSipCallOutboundCdr aiSipCallOutboundCdr)
|
|
|
+ {
|
|
|
+ List<AiSipCallOutboundCdr> list = aiSipCallOutboundCdrService.selectAiSipCallOutboundCdrList(aiSipCallOutboundCdr);
|
|
|
+ ExcelUtil<AiSipCallOutboundCdr> util = new ExcelUtil<>(AiSipCallOutboundCdr.class);
|
|
|
+ return util.exportExcel(list, "aiSIP手动外呼通话记录数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取aiSIP手动外呼通话记录详细信息
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:query')")
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") String id)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(aiSipCallOutboundCdrService.selectAiSipCallOutboundCdrById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增aiSIP手动外呼通话记录
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:add')")
|
|
|
+ @Log(title = "aiSIP手动外呼通话记录", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody AiSipCallOutboundCdr aiSipCallOutboundCdr)
|
|
|
+ {
|
|
|
+ return toAjax(aiSipCallOutboundCdrService.insertAiSipCallOutboundCdr(aiSipCallOutboundCdr));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改aiSIP手动外呼通话记录
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:edit')")
|
|
|
+ @Log(title = "aiSIP手动外呼通话记录", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody AiSipCallOutboundCdr aiSipCallOutboundCdr)
|
|
|
+ {
|
|
|
+ return toAjax(aiSipCallOutboundCdrService.updateAiSipCallOutboundCdr(aiSipCallOutboundCdr));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除aiSIP手动外呼通话记录
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:remove')")
|
|
|
+ @Log(title = "aiSIP手动外呼通话记录", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable String[] ids)
|
|
|
+ {
|
|
|
+ return toAjax(aiSipCallOutboundCdrService.deleteAiSipCallOutboundCdrByIds(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取手动外呼客户沟通信息
|
|
|
+ * @param phoneNum 手机号
|
|
|
+ * @param callType 类型 1呼入 2外呼
|
|
|
+ * @param uuid 通话uuid
|
|
|
+ */
|
|
|
+ @GetMapping("/getCustCommunicationInfo")
|
|
|
+ public AjaxResult getCustCommunicationInfo(@RequestParam("phoneNum") String phoneNum, @RequestParam("callType") Integer callType, @RequestParam("uuid") String uuid) {
|
|
|
+ return aiSipCallOutboundCdrService.getCustCommunicationInfo(phoneNum,callType,uuid);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增保存手动外呼沟通记录
|
|
|
+ */
|
|
|
+ @PostMapping("/add/custcallrecord")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult addCustcallrecord(@RequestBody CcCustInfo ccCustInfo)
|
|
|
+ {
|
|
|
+ return aiSipCallOutboundCdrService.addCustcallrecord(ccCustInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手动拉取今天aiSIP外呼通话记录列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('aiSipCall:outboundCdr:manualPull')")
|
|
|
+ @GetMapping("/manualPull")
|
|
|
+ public AjaxResult manualPull()
|
|
|
+ {
|
|
|
+ log.info("开始拉取 人工外呼通话记录");
|
|
|
+ long strat = System.currentTimeMillis();
|
|
|
+ String msg = aiSipCallOutboundCdrService.scheduledGetCallRecord().join();
|
|
|
+ log.info("结束拉取 人工外呼通话记录,耗时:{}ms,结果:{}",System.currentTimeMillis()-strat,msg);
|
|
|
+ return AjaxResult.success(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步aiSIP外呼通话记录
|
|
|
+ */
|
|
|
+ @PostMapping("/syncByUuid")
|
|
|
+ public AjaxResult syncByUuid(@RequestBody ApiCallRecordByUuidQueryParams req) {
|
|
|
+ if (req == null || StringUtils.isBlank(req.getUuid())) {
|
|
|
+ return AjaxResult.error("uuid不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(req.getCallType())) {
|
|
|
+ req.setCallType("03");
|
|
|
+ }
|
|
|
+
|
|
|
+ int rows = aiSipCallOutboundCdrService.syncByUuid(req);
|
|
|
+ if (rows > 0) {
|
|
|
+ return AjaxResult.success("同步成功");
|
|
|
+ }
|
|
|
+ return AjaxResult.error("未查到对应通话记录或同步失败");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|