lmx 4 часов назад
Родитель
Сommit
a6b1649208

+ 79 - 0
fs-admin-saas/src/main/java/com/fs/communication/controller/CallLogController.java

@@ -0,0 +1,79 @@
+package com.fs.communication.controller;
+
+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.ParseUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.communication.service.ICompanyCallGatewayLogService;
+import com.fs.company.param.CompanyVoiceLogsParam;
+import com.fs.company.vo.CompanyVoiceLogsVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * Gateway call log controller (company_comm_gateway_log, api_type=call).
+ */
+@RestController
+@Validated
+@RequestMapping("/admin/companyVoiceLogs")
+public class CallLogController extends BaseController {
+
+    @Autowired
+    private ICompanyCallGatewayLogService companyCallGatewayLogService;
+
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanyVoiceLogsParam param) {
+        startPage();
+        List<CompanyVoiceLogsVO> list = companyCallGatewayLogService.selectCallGatewayLogList(param);
+        maskSensitiveFields(list);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:export')")
+    @Log(title = "通话记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanyVoiceLogsParam param) {
+        List<CompanyVoiceLogsVO> list = companyCallGatewayLogService.selectCallGatewayLogList(param);
+        maskSensitiveFields(list);
+        ExcelUtil<CompanyVoiceLogsVO> util = new ExcelUtil<>(CompanyVoiceLogsVO.class);
+        return util.exportExcel(list, "companyVoiceLogs");
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companyVoiceLogs:query')")
+    @GetMapping("/{voiceId}")
+    public AjaxResult getInfo(@PathVariable("voiceId") Long voiceId) {
+        CompanyVoiceLogsVO vo = companyCallGatewayLogService.selectCallGatewayLogById(voiceId);
+        if (vo != null) {
+            maskSensitiveFields(java.util.Collections.singletonList(vo));
+        }
+        return AjaxResult.success(vo);
+    }
+
+    private void maskSensitiveFields(List<CompanyVoiceLogsVO> list) {
+        if (list == null) {
+            return;
+        }
+        for (CompanyVoiceLogsVO vo : list) {
+            vo.setCalleePhone(ParseUtils.parsePhone(vo.getCalleePhone()));
+            vo.setCallerPhone(ParseUtils.parsePhone(vo.getCallerPhone()));
+            vo.setDisplayCalleeNumber(ParseUtils.parsePhone(vo.getDisplayCalleeNumber()));
+            vo.setDisplayCallerNumber(ParseUtils.parsePhone(vo.getDisplayCallerNumber()));
+            if (vo.getRemark() != null && vo.getRemark().length() > 11) {
+                vo.setRemark(new StringBuilder(vo.getRemark())
+                        .replace(vo.getRemark().length() - 8, vo.getRemark().length() - 4, "*****")
+                        .toString());
+            }
+        }
+    }
+}

+ 72 - 0
fs-admin-saas/src/main/java/com/fs/communication/controller/SmsLogController.java

@@ -0,0 +1,72 @@
+package com.fs.communication.controller;
+
+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.poi.ExcelUtil;
+import com.fs.communication.service.ICompanySmsGatewayLogService;
+import com.fs.company.param.CompanySmsLogsListQueryParam;
+import com.fs.company.vo.CompanySmsLogsListQueryVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * Gateway SMS log controller (company_comm_gateway_log, api_type=sms).
+ */
+@RestController
+@Validated
+@RequestMapping("/admin/companySmsLogs")
+public class SmsLogController extends BaseController {
+
+    @Autowired
+    private ICompanySmsGatewayLogService companySmsGatewayLogService;
+
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CompanySmsLogsListQueryParam param) {
+        startPage();
+        List<CompanySmsLogsListQueryVO> list = companySmsGatewayLogService.selectSmsGatewayLogList(param);
+        maskPhone(list);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:export')")
+    @Log(title = "短信发送记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(CompanySmsLogsListQueryParam param) {
+        List<CompanySmsLogsListQueryVO> list = companySmsGatewayLogService.selectSmsGatewayLogList(param);
+        maskPhone(list);
+        ExcelUtil<CompanySmsLogsListQueryVO> util = new ExcelUtil<>(CompanySmsLogsListQueryVO.class);
+        return util.exportExcel(list, "companySmsLogs");
+    }
+
+    @PreAuthorize("@ss.hasPermi('company:companySmsLogs:query')")
+    @GetMapping("/{logsId}")
+    public AjaxResult getInfo(@PathVariable("logsId") Long logsId) {
+        CompanySmsLogsListQueryVO vo = companySmsGatewayLogService.selectSmsGatewayLogById(logsId);
+        if (vo != null && vo.getPhone() != null) {
+            vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+        }
+        return AjaxResult.success(vo);
+    }
+
+    private void maskPhone(List<CompanySmsLogsListQueryVO> list) {
+        if (list == null) {
+            return;
+        }
+        for (CompanySmsLogsListQueryVO vo : list) {
+            if (vo.getPhone() != null) {
+                vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+            }
+        }
+    }
+}

+ 17 - 0
fs-service/src/main/java/com/fs/communication/mapper/CompanyCallGatewayLogMapper.java

@@ -0,0 +1,17 @@
+package com.fs.communication.mapper;
+
+import com.fs.company.param.CompanyVoiceLogsParam;
+import com.fs.company.vo.CompanyVoiceLogsVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Gateway call log query (company_comm_gateway_log, api_type=call).
+ */
+public interface CompanyCallGatewayLogMapper {
+
+    List<CompanyVoiceLogsVO> selectCallGatewayLogList(@Param("maps") CompanyVoiceLogsParam param);
+
+    CompanyVoiceLogsVO selectCallGatewayLogById(@Param("logId") Long logId);
+}

+ 17 - 0
fs-service/src/main/java/com/fs/communication/mapper/CompanySmsGatewayLogMapper.java

@@ -0,0 +1,17 @@
+package com.fs.communication.mapper;
+
+import com.fs.company.param.CompanySmsLogsListQueryParam;
+import com.fs.company.vo.CompanySmsLogsListQueryVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 短信网关调用记录(company_comm_gateway_log,api_type=sms)
+ */
+public interface CompanySmsGatewayLogMapper {
+
+    List<CompanySmsLogsListQueryVO> selectSmsGatewayLogList(@Param("maps") CompanySmsLogsListQueryParam param);
+
+    CompanySmsLogsListQueryVO selectSmsGatewayLogById(@Param("logId") Long logId);
+}

+ 16 - 0
fs-service/src/main/java/com/fs/communication/service/ICompanyCallGatewayLogService.java

@@ -0,0 +1,16 @@
+package com.fs.communication.service;
+
+import com.fs.company.param.CompanyVoiceLogsParam;
+import com.fs.company.vo.CompanyVoiceLogsVO;
+
+import java.util.List;
+
+/**
+ * Gateway call log query service (company_comm_gateway_log).
+ */
+public interface ICompanyCallGatewayLogService {
+
+    List<CompanyVoiceLogsVO> selectCallGatewayLogList(CompanyVoiceLogsParam param);
+
+    CompanyVoiceLogsVO selectCallGatewayLogById(Long logId);
+}

+ 16 - 0
fs-service/src/main/java/com/fs/communication/service/ICompanySmsGatewayLogService.java

@@ -0,0 +1,16 @@
+package com.fs.communication.service;
+
+import com.fs.company.param.CompanySmsLogsListQueryParam;
+import com.fs.company.vo.CompanySmsLogsListQueryVO;
+
+import java.util.List;
+
+/**
+ * 短信网关调用记录查询(company_comm_gateway_log)
+ */
+public interface ICompanySmsGatewayLogService {
+
+    List<CompanySmsLogsListQueryVO> selectSmsGatewayLogList(CompanySmsLogsListQueryParam param);
+
+    CompanySmsLogsListQueryVO selectSmsGatewayLogById(Long logId);
+}

+ 27 - 0
fs-service/src/main/java/com/fs/communication/service/impl/CompanyCallGatewayLogServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fs.communication.service.impl;
+
+import com.fs.communication.mapper.CompanyCallGatewayLogMapper;
+import com.fs.communication.service.ICompanyCallGatewayLogService;
+import com.fs.company.param.CompanyVoiceLogsParam;
+import com.fs.company.vo.CompanyVoiceLogsVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CompanyCallGatewayLogServiceImpl implements ICompanyCallGatewayLogService {
+
+    @Autowired
+    private CompanyCallGatewayLogMapper companyCallGatewayLogMapper;
+
+    @Override
+    public List<CompanyVoiceLogsVO> selectCallGatewayLogList(CompanyVoiceLogsParam param) {
+        return companyCallGatewayLogMapper.selectCallGatewayLogList(param);
+    }
+
+    @Override
+    public CompanyVoiceLogsVO selectCallGatewayLogById(Long logId) {
+        return companyCallGatewayLogMapper.selectCallGatewayLogById(logId);
+    }
+}

+ 27 - 0
fs-service/src/main/java/com/fs/communication/service/impl/CompanySmsGatewayLogServiceImpl.java

@@ -0,0 +1,27 @@
+package com.fs.communication.service.impl;
+
+import com.fs.communication.mapper.CompanySmsGatewayLogMapper;
+import com.fs.communication.service.ICompanySmsGatewayLogService;
+import com.fs.company.param.CompanySmsLogsListQueryParam;
+import com.fs.company.vo.CompanySmsLogsListQueryVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CompanySmsGatewayLogServiceImpl implements ICompanySmsGatewayLogService {
+
+    @Autowired
+    private CompanySmsGatewayLogMapper companySmsGatewayLogMapper;
+
+    @Override
+    public List<CompanySmsLogsListQueryVO> selectSmsGatewayLogList(CompanySmsLogsListQueryParam param) {
+        return companySmsGatewayLogMapper.selectSmsGatewayLogList(param);
+    }
+
+    @Override
+    public CompanySmsLogsListQueryVO selectSmsGatewayLogById(Long logId) {
+        return companySmsGatewayLogMapper.selectSmsGatewayLogById(logId);
+    }
+}

+ 2 - 0
fs-service/src/main/java/com/fs/company/param/CompanyVoiceLogsParam.java

@@ -43,6 +43,8 @@ public class CompanyVoiceLogsParam extends BaseEntity
 
     private Integer source;
 
+    /** Outbound voice API (company_voice_api.api_id, maps to gateway log gateway_id) */
+    private Long gatewayId;
 
     private String[] createTimeList;
 

+ 7 - 7
fs-service/src/main/java/com/fs/company/service/impl/call/node/WorkflowExecErrorMessages.java

@@ -8,11 +8,11 @@ import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.StringUtils;
 
 /**
- * 工作流节点执行失败原因展示文案处理
+ * 宸ヤ綔娴佽妭鐐规墽琛屽け璐ュ師鍥犲睍绀烘枃妗堝�鐞�
  */
 public final class WorkflowExecErrorMessages {
 
-    public static final String SYSTEM_ERROR_DISPLAY_MSG = "系统异常,请联系管理员";
+    public static final String SYSTEM_ERROR_DISPLAY_MSG = "绯荤粺寮傚父锛岃�鑱旂郴绠$悊鍛�";
 
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
@@ -20,7 +20,7 @@ public final class WorkflowExecErrorMessages {
     }
 
     /**
-     * 根据异常类型解析对用户展示的错误信息:业务异常原样,系统异常脱敏
+     * 鏍规嵁寮傚父绫诲瀷瑙f瀽瀵圭敤鎴峰睍绀虹殑閿欒�淇℃伅锛氫笟鍔″紓甯稿師鏍凤紝绯荤粺寮傚父鑴辨晱
      */
     public static String resolveExecutionErrorMessage(Throwable ex) {
         if (ex == null) {
@@ -33,17 +33,17 @@ public final class WorkflowExecErrorMessages {
                     && StringUtils.isNotBlank(blacklistEx.getCheckResult().getReason())) {
                 return blacklistEx.getCheckResult().getReason();
             }
-            return StringUtils.defaultIfBlank(root.getMessage(), "被叫人命中外呼黑名单");
+            return StringUtils.defaultIfBlank(root.getMessage(), "琚�彨浜哄懡涓��鍛奸粦鍚嶅崟");
         }
         if (root instanceof ServiceException || root instanceof CustomException) {
             String message = root.getMessage();
-            return StringUtils.isNotBlank(message) ? message : "业务处理失败";
+            return StringUtils.isNotBlank(message) ? message : "涓氬姟澶勭悊澶辫触";
         }
         return SYSTEM_ERROR_DISPLAY_MSG;
     }
 
     /**
-     * 存量日志兜底:从 output_data JSON 中提取 error 字段
+     * 瀛橀噺鏃ュ織鍏滃簳锛氫粠 output_data JSON 涓�彁鍙� error 瀛楁�
      */
     public static String extractErrorFromOutputData(String outputData) {
         if (StringUtils.isBlank(outputData)) {
@@ -66,7 +66,7 @@ public final class WorkflowExecErrorMessages {
     }
 
     /**
-     * 对展示文案做脱敏:技术类错误统一为系统异常提示
+     * 瀵瑰睍绀烘枃妗堝仛鑴辨晱锛氭妧鏈�被閿欒�缁熶竴涓虹郴缁熷紓甯告彁绀�
      */
     public static String sanitizeForDisplay(String message) {
         if (StringUtils.isBlank(message)) {

+ 17 - 12
fs-service/src/main/resources/db/tenant-initTable.sql

@@ -2420,21 +2420,26 @@ DROP TABLE IF EXISTS `company_voice_api`;
 CREATE TABLE `company_voice_api`
 (
     `api_id`      int NOT NULL AUTO_INCREMENT COMMENT 'ID',
-    `api_name`    varchar(100)   NULL DEFAULT NULL COMMENT 'API接口名',
-    `api_type`    varchar(50)   NULL DEFAULT NULL COMMENT 'KEY',
-    `api_json`    varchar(2000)   NULL DEFAULT NULL COMMENT '接口配置JSON',
+    `api_name`    varchar(100) NULL DEFAULT NULL COMMENT 'API接口名',
+    `api_type`    varchar(50) NULL DEFAULT NULL COMMENT 'KEY',
+    `api_json`    varchar(2000) NULL DEFAULT NULL COMMENT '接口地址',
     `status`      tinyint(1) NULL DEFAULT NULL COMMENT '状态',
-    `remark`      varchar(2000)   NULL DEFAULT NULL,
-    `priority`    int NULL DEFAULT 1 COMMENT '优先级(数字越小越靠前)',
-    `selectable`  tinyint NULL DEFAULT 0 COMMENT '允许手动选择(0否1是)',
-    `sale_price`  decimal(10, 4) NULL DEFAULT NULL COMMENT '租户售价(元/分钟)',
-    `is_primary`  tinyint NULL DEFAULT 0 COMMENT '是否主线路(0否1是)',
-    `api_url`     varchar(500)   NULL DEFAULT NULL COMMENT '接口地址',
-    `dialog_url`  varchar(500)   NULL DEFAULT NULL COMMENT '话术跳转地址',
-    `is_del`      tinyint(1) NULL DEFAULT 0 COMMENT '是否删除(0否1是)',
+    `remark`      varchar(2000)  NULL DEFAULT NULL,
+    `priority`    tinyint NULL DEFAULT NULL COMMENT '优先级',
+    `selectable`  tinyint NULL DEFAULT NULL COMMENT '是否可选:0:不可以;1:可以',
+    `sale_price`  decimal(10, 2) NULL DEFAULT NULL COMMENT '售价',
+    `is_primary`  tinyint NULL DEFAULT NULL COMMENT '是否主线路',
     `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+    `is_del`      tinyint NULL DEFAULT 0 COMMENT '是否删除,0否 1是',
+    `provider`    varchar(255)  NULL DEFAULT NULL COMMENT '服务商',
+    `cost_price`  decimal(10, 2) NULL DEFAULT NULL COMMENT '成本价',
+    `account`     varchar(100) NULL DEFAULT NULL COMMENT '账户',
+    `password`    varchar(100) NULL DEFAULT NULL COMMENT '密码',
+    `api_url`     varchar(500) NULL DEFAULT NULL COMMENT 'api地址',
+    `dialog_url`  varchar(500) NULL DEFAULT NULL COMMENT '话术跳转地址',
+    `update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
     PRIMARY KEY (`api_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '呼叫接口' ROW_FORMAT = DYNAMIC;
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '呼叫接口' ROW_FORMAT = DYNAMIC;
 
 -- ----------------------------
 -- Table structure for company_voice_api_tiantian

+ 78 - 0
fs-service/src/main/resources/mapper/communication/CompanyCallGatewayLogMapper.xml

@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.communication.mapper.CompanyCallGatewayLogMapper">
+
+    <sql id="callGatewayLogSelect">
+        select g.log_id as voice_id,
+               g.company_id,
+               g.company_user_id,
+               cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned) as customer_id,
+               u.nick_name as user_nick_name,
+               crm.customer_name,
+               null as voice_url,
+               g.create_time as start_time,
+               null as finish_time,
+               g.caller_phone,
+               g.callee_phone,
+               coalesce(floor(g.duration_ms / 1000), 0) as times,
+               coalesce(g.billing_quantity, 0) as billing_time,
+               g.caller_phone as display_caller_number,
+               g.callee_phone as display_callee_number,
+               g.result_msg as remark,
+               crm.source,
+               g.create_time as create_time,
+               case when g.success = 1 then 1 else -1 end as status
+        from company_comm_gateway_log g
+                 left join company_user u on u.user_id = g.company_user_id
+                 left join crm_customer crm
+                           on crm.customer_id = cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned)
+        where g.api_type = 'call'
+    </sql>
+
+    <select id="selectCallGatewayLogList" resultType="com.fs.company.vo.CompanyVoiceLogsVO">
+        <include refid="callGatewayLogSelect"/>
+        <if test="maps.companyId != null">
+            and g.company_id = #{maps.companyId}
+        </if>
+        <if test="maps.customerId != null">
+            and cast(json_unquote(json_extract(g.request_body, '$.calleeId')) as unsigned) = #{maps.customerId}
+        </if>
+        <if test="maps.userNickName != null and maps.userNickName != ''">
+            and u.nick_name like concat('%', #{maps.userNickName}, '%')
+        </if>
+        <if test="maps.calleePhone != null and maps.calleePhone != ''">
+            and g.callee_phone like concat('%', #{maps.calleePhone}, '%')
+        </if>
+        <if test="maps.gatewayId != null">
+            and (g.gateway_id = #{maps.gatewayId}
+                or cast(json_unquote(json_extract(g.request_body, '$.gatewayId')) as unsigned) = #{maps.gatewayId})
+        </if>
+        <if test="maps.status != null">
+            <choose>
+                <when test="maps.status == 1">
+                    and g.success = 1
+                </when>
+                <when test="maps.status == 0">
+                    and 1 = 0
+                </when>
+                <otherwise>
+                    and g.success = 0
+                </otherwise>
+            </choose>
+        </if>
+        <if test="maps.params != null and maps.params.beginTime != null and maps.params.beginTime != ''">
+            and date_format(g.create_time, '%y%m%d') &gt;= date_format(#{maps.params.beginTime}, '%y%m%d')
+            and date_format(g.create_time, '%y%m%d') &lt;= date_format(#{maps.params.endTime}, '%y%m%d')
+        </if>
+        <if test="maps.params != null and maps.params.dataScope != null and maps.params.dataScope != ''">
+            ${maps.params.dataScope}
+        </if>
+        order by g.log_id desc
+    </select>
+
+    <select id="selectCallGatewayLogById" resultType="com.fs.company.vo.CompanyVoiceLogsVO">
+        <include refid="callGatewayLogSelect"/>
+        and g.log_id = #{logId}
+    </select>
+
+</mapper>

+ 81 - 0
fs-service/src/main/resources/mapper/communication/CompanySmsGatewayLogMapper.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.communication.mapper.CompanySmsGatewayLogMapper">
+
+    <sql id="smsGatewayLogSelect">
+        select g.log_id as logs_id,
+               g.company_id,
+               g.company_user_id,
+               cast(json_unquote(json_extract(g.request_body, '$.customerId')) as unsigned) as customer_id,
+               c.customer_code,
+               c.customer_name,
+               g.callee_phone as phone,
+               coalesce(nullif(g.result_msg, ''), g.api_path) as content,
+               u.nick_name as company_user_nick_name,
+               g.create_time,
+               case when g.success = 1 then g.create_time else null end as send_time,
+               case when g.success = 1 then 1 else 2 end as status,
+               g.result_msg as stat,
+               null as reply_content
+        from company_comm_gateway_log g
+                 left join crm_customer c on c.customer_id = cast(json_unquote(json_extract(g.request_body, '$.customerId')) as unsigned)
+                 left join company_user u on u.user_id = g.company_user_id
+        where g.api_type = 'sms'
+    </sql>
+
+    <select id="selectSmsGatewayLogList" resultType="com.fs.company.vo.CompanySmsLogsListQueryVO">
+        <include refid="smsGatewayLogSelect"/>
+        <if test="maps.companyId != null">
+            and g.company_id = #{maps.companyId}
+        </if>
+        <if test="maps.customerId != null">
+            and cast(json_unquote(json_extract(g.request_body, '$.customerId')) as unsigned) = #{maps.customerId}
+        </if>
+        <if test="maps.status != null">
+            <choose>
+                <when test="maps.status == 1">
+                    and g.success = 1
+                </when>
+                <when test="maps.status == 0">
+                    and 1 = 0
+                </when>
+                <otherwise>
+                    and g.success = 0
+                </otherwise>
+            </choose>
+        </if>
+        <if test="maps.isReply != null and maps.isReply == 1">
+            and 1 = 0
+        </if>
+        <if test="maps.customerCode != null and maps.customerCode != ''">
+            and c.customer_code = #{maps.customerCode}
+        </if>
+        <if test="maps.customerName != null and maps.customerName != ''">
+            and c.customer_name = #{maps.customerName}
+        </if>
+        <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
+            and u.nick_name = #{maps.companyUserNickName}
+        </if>
+        <if test="maps.phone != null and maps.phone != ''">
+            and g.callee_phone = #{maps.phone}
+        </if>
+        <if test="maps.params != null and maps.params.beginTime != null and maps.params.beginTime != ''">
+            and date_format(g.create_time, '%y%m%d') &gt;= date_format(#{maps.params.beginTime}, '%y%m%d')
+            and date_format(g.create_time, '%y%m%d') &lt;= date_format(#{maps.params.endTime}, '%y%m%d')
+        </if>
+        <if test="maps.deptId != null">
+            and (u.dept_id = #{maps.deptId}
+                or u.dept_id in (select t.dept_id from company_dept t where find_in_set(#{maps.deptId}, ancestors)))
+        </if>
+        <if test="maps.params != null and maps.params.dataScope != null and maps.params.dataScope != ''">
+            ${maps.params.dataScope}
+        </if>
+        order by g.log_id desc
+    </select>
+
+    <select id="selectSmsGatewayLogById" resultType="com.fs.company.vo.CompanySmsLogsListQueryVO">
+        <include refid="smsGatewayLogSelect"/>
+        and g.log_id = #{logId}
+    </select>
+
+</mapper>