|
|
@@ -0,0 +1,111 @@
|
|
|
+package com.fs.company.controller.crm;
|
|
|
+
|
|
|
+import com.fs.common.core.controller.BaseController;
|
|
|
+import com.fs.common.core.domain.AjaxResult;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
+import com.fs.company.domain.CrmCustomerCallLog;
|
|
|
+import com.fs.company.service.ICrmCustomerCallLogService;
|
|
|
+import com.fs.framework.security.LoginUser;
|
|
|
+import com.fs.framework.security.SecurityUtils;
|
|
|
+import com.fs.his.utils.PhoneUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 手动外呼通话记录Controller
|
|
|
+ *
|
|
|
+ * @author MixLiu
|
|
|
+ * @date 2026/5/25 18:23
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/crm/manualOutboundCallLog")
|
|
|
+public class ManualOutboundCallLogController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICrmCustomerCallLogService crmCustomerCallLogService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询手动外呼通话记录列表(管理员-查看公司全部)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('crm:manualOutboundCall:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(CrmCustomerCallLog crmCustomerCallLog) {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ crmCustomerCallLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ encryptCallerNum(crmCustomerCallLog);
|
|
|
+ startPage();
|
|
|
+ List<CrmCustomerCallLog> list = crmCustomerCallLogService.selectCrmCustomerCallLogList(crmCustomerCallLog);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询我的手动外呼通话记录列表(个人-只看自己)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('crm:manualOutboundCall:myList')")
|
|
|
+ @GetMapping("/myList")
|
|
|
+ public TableDataInfo myList(CrmCustomerCallLog crmCustomerCallLog) {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ crmCustomerCallLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ crmCustomerCallLog.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ encryptCallerNum(crmCustomerCallLog);
|
|
|
+ startPage();
|
|
|
+ List<CrmCustomerCallLog> list = crmCustomerCallLogService.selectCrmCustomerCallLogList(crmCustomerCallLog);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询手动外呼通话记录计费分钟数总和(管理员-查看公司全部)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('crm:manualOutboundCall:list')")
|
|
|
+ @GetMapping("/sumBillingMinute")
|
|
|
+ public AjaxResult sumBillingMinute(CrmCustomerCallLog crmCustomerCallLog) {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ crmCustomerCallLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ encryptCallerNum(crmCustomerCallLog);
|
|
|
+ Long sum = crmCustomerCallLogService.selectSumBillingMinute(crmCustomerCallLog);
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("sumBillingMinute", sum);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询我的手动外呼通话记录计费分钟数总和(个人-只看自己)
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('crm:manualOutboundCall:myList')")
|
|
|
+ @GetMapping("/mySumBillingMinute")
|
|
|
+ public AjaxResult mySumBillingMinute(CrmCustomerCallLog crmCustomerCallLog) {
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ crmCustomerCallLog.setCompanyId(loginUser.getCompany().getCompanyId());
|
|
|
+ crmCustomerCallLog.setCompanyUserId(loginUser.getUser().getUserId());
|
|
|
+ encryptCallerNum(crmCustomerCallLog);
|
|
|
+ Long sum = crmCustomerCallLogService.selectSumBillingMinute(crmCustomerCallLog);
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("sumBillingMinute", sum);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理客户号码查询参数,区分明文和加密两种匹配方式:
|
|
|
+ * 1. 手机(callerNum):输入明文号码,不加密,直接匹配 caller_num 字段(匹配历史明文数据)
|
|
|
+ * 2. 加密手机(encryptedCallerNum):输入明文号码,加密后设为 callerNum 匹配密文数据,
|
|
|
+ * 同时将原始明文保留到 plainCallerNum 匹配历史明文数据(OR条件覆盖两种存储格式)
|
|
|
+ * Mapper SQL: AND (caller_num = #{callerNum} OR caller_num = #{plainCallerNum})
|
|
|
+ */
|
|
|
+ private void encryptCallerNum(CrmCustomerCallLog param) {
|
|
|
+ if (StringUtils.isNotBlank(param.getEncryptedCallerNum())) {
|
|
|
+ // 加密手机输入:加密后匹配密文,原始明文保留匹配历史明文(OR覆盖)
|
|
|
+ param.setPlainCallerNum(param.getEncryptedCallerNum());
|
|
|
+ param.setCallerNum(PhoneUtil.encryptPhone(param.getEncryptedCallerNum()));
|
|
|
+ param.setEncryptedCallerNum(null);
|
|
|
+ }
|
|
|
+ // 手机输入:不加密,直接传明文匹配历史明文数据
|
|
|
+ }
|
|
|
+}
|