فهرست منبع

益寿缘-销售端-优化短信记录的展示逻辑

cgp 17 ساعت پیش
والد
کامیت
4c9365851e
21فایلهای تغییر یافته به همراه302 افزوده شده و 27 حذف شده
  1. 18 5
      fs-company/src/main/java/com/fs/company/controller/company/CompanySmsLogsController.java
  2. 9 1
      fs-company/src/main/java/com/fs/company/controller/qw/QwAcquisitionAssistantController.java
  3. 2 1
      fs-service/src/main/java/com/fs/common/service/ISmsService.java
  4. 12 6
      fs-service/src/main/java/com/fs/common/service/impl/SmsServiceImpl.java
  5. 23 0
      fs-service/src/main/java/com/fs/company/dto/CompanySmsLogsQueryDTO.java
  6. 9 0
      fs-service/src/main/java/com/fs/company/mapper/CompanySmsLogsMapper.java
  7. 7 0
      fs-service/src/main/java/com/fs/company/service/ICompanySmsLogsService.java
  8. 19 0
      fs-service/src/main/java/com/fs/company/service/impl/CompanySmsLogsServiceImpl.java
  9. 25 0
      fs-service/src/main/java/com/fs/company/vo/CompanySmsLogsQueryVO.java
  10. 34 0
      fs-service/src/main/java/com/fs/qw/bo/SendMsgLogBo.java
  11. 5 1
      fs-service/src/main/java/com/fs/qw/domain/QwAcquisitionSendMsgLog.java
  12. 12 0
      fs-service/src/main/java/com/fs/qw/domain/QwCourseLinkSendMsgLog.java
  13. 2 1
      fs-service/src/main/java/com/fs/qw/service/IQwAcquisitionAssistantService.java
  14. 4 2
      fs-service/src/main/java/com/fs/qw/service/impl/QwAcquisitionAssistantServiceImpl.java
  15. 9 1
      fs-service/src/main/java/com/fs/qw/service/impl/SmsLinkRemindCourseServiceImpl.java
  16. 4 3
      fs-service/src/main/java/com/fs/qw/strategy/impl/AcquisitionLinkLogStrategyImpl.java
  17. 7 3
      fs-service/src/main/java/com/fs/qw/strategy/impl/CourseLinkLogStrategyImpl.java
  18. 1 1
      fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java
  19. 78 0
      fs-service/src/main/resources/mapper/company/CompanySmsLogsMapper.xml
  20. 6 1
      fs-service/src/main/resources/mapper/qw/QwAcquisitionSendMsgLogMapper.xml
  21. 16 1
      fs-service/src/main/resources/mapper/qw/QwCourseLinkSendMsgLogMapper.xml

+ 18 - 5
fs-company/src/main/java/com/fs/company/controller/company/CompanySmsLogsController.java

@@ -9,9 +9,11 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.CompanySmsLogs;
+import com.fs.company.dto.CompanySmsLogsQueryDTO;
 import com.fs.company.param.CompanySmsLogsListQueryParam;
 import com.fs.company.service.ICompanySmsLogsService;
 import com.fs.company.vo.CompanySmsLogsListQueryVO;
+import com.fs.company.vo.CompanySmsLogsQueryVO;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,10 +43,6 @@ public class CompanySmsLogsController extends BaseController
     public TableDataInfo list(CompanySmsLogsListQueryParam param)
     {
         startPage();
-        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
-        if (loginUser==null){
-            throw new CustomException("请登录");
-        }
         List<CompanySmsLogsListQueryVO> list = companySmsLogsService.selectCompanySmsLogsListQuery(param);
         if (list != null) {
             for (CompanySmsLogsListQueryVO vo : list) {
@@ -58,7 +56,22 @@ public class CompanySmsLogsController extends BaseController
     }
 
     /**
-     * 导出短信发送记录列表
+     * 查询短信发送记录列表
+     */
+    @PostMapping("/getCmsLogList")
+    public TableDataInfo getCmsLogList(@RequestBody CompanySmsLogsQueryDTO queryDTO)
+    {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        if (loginUser==null){
+            throw new CustomException("请登录");
+        }
+        startPage();
+        List<CompanySmsLogsQueryVO> list = companySmsLogsService.selectCompanySmsLogsListQueryYsytg(queryDTO);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出短信发送记录列表`111
      */
     @PreAuthorize("@ss.hasPermi('company:companySmsLogs:export')")
     @Log(title = "短信发送记录", businessType = BusinessType.EXPORT)

+ 9 - 1
fs-company/src/main/java/com/fs/company/controller/qw/QwAcquisitionAssistantController.java

@@ -9,6 +9,7 @@ import com.fs.common.utils.StringUtils;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
 import com.fs.his.dto.SendResultDetailDTO;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwCompany;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.dto.acquisition.AcquisitionListResponse;
@@ -62,8 +63,15 @@ public class QwAcquisitionAssistantController extends BaseController {
     @GetMapping("/sendAcquisitionMessage/{id}/{phone}")
     public AjaxResult sendAcquisitionMessage(@PathVariable Long id,@PathVariable String phone) {
         try {
+            LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+            if (loginUser==null||loginUser.getCompany()==null){
+                throw new CustomException("请登录");
+            }
+            SendMsgLogBo sendMsgLogBo=new SendMsgLogBo();
+            sendMsgLogBo.setCompanyId(loginUser.getCompany().getCompanyId());
+            sendMsgLogBo.setCompanyUserId(loginUser.getCompany().getUserId());
             validatePhone( phone);
-            SendResultDetailDTO sendResultDetailDTO = qwAcquisitionAssistantService.sendMessageAcquisition(phone, id);
+            SendResultDetailDTO sendResultDetailDTO = qwAcquisitionAssistantService.sendMessageAcquisition(phone, id,sendMsgLogBo);
             if (sendResultDetailDTO.isSuccess()){
                 return AjaxResult.success("发送成功");
             }else {

+ 2 - 1
fs-service/src/main/java/com/fs/common/service/ISmsService.java

@@ -5,6 +5,7 @@ import com.fs.company.domain.CompanySmsTemp;
 import com.fs.crm.param.SmsSendBatchParam;
 import com.fs.crm.param.SmsSendParam;
 import com.fs.crm.param.SmsSendUserParam;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.enums.SmsLogType;
 
 
@@ -34,6 +35,6 @@ public interface ISmsService
      *  @param content 内容
      *  @param temp 模板
      * */
-    R simpleSmsSend(String phone, String content, CompanySmsTemp temp, SmsLogType logType, Object contextObject);
+    R simpleSmsSend(String phone, String content, CompanySmsTemp temp, SmsLogType logType, SendMsgLogBo sendMsgLogBo);
 
 }

+ 12 - 6
fs-service/src/main/java/com/fs/common/service/impl/SmsServiceImpl.java

@@ -27,6 +27,7 @@ import com.fs.his.domain.FsStoreOrder;
 import com.fs.his.mapper.FsPackageOrderMapper;
 import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.vo.FsPackageOrderVO;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwAcquisitionSendMsgLog;
 import com.fs.qw.domain.QwCourseLinkSendMsgLog;
 import com.fs.qw.domain.QwSopSmsLogs;
@@ -860,11 +861,11 @@ public class SmsServiceImpl implements ISmsService
      * @param content 短信内容
      * @param temp 短信模板
      * @param logType 日志记录类型,用于区分调用方
-     * @param contextObject 特定业务的上下文对象,如qwAcquisitionId或externalContactId
+     * @param sendMsgLogBo 特定业务的上下文对象,如qwAcquisitionId或externalContactId
      * @return R 响应结果
      */
     @Override
-    public R simpleSmsSend(String phone, String content, CompanySmsTemp temp, SmsLogType logType, Object contextObject) {
+    public R simpleSmsSend(String phone, String content, CompanySmsTemp temp, SmsLogType logType, SendMsgLogBo sendMsgLogBo) {
         String urls = null;
         R response; // 存储最终响应
         Integer number = calculateSmsCount(content);
@@ -877,7 +878,7 @@ public class SmsServiceImpl implements ISmsService
             log.error("{}发送失败", phone, e);
             response = R.error("短信发送失败:" + e.getMessage());
             // 发送失败也要记录特定业务日志
-            smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, contextObject);
+            smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, sendMsgLogBo);
             return response;
         }
 
@@ -900,21 +901,26 @@ public class SmsServiceImpl implements ISmsService
                     logs.setType(sms.getType());
                     logs.setMid(itemVO.getMid());
                     logs.setNumber(number);
+                    logs.setCompanyId(sendMsgLogBo.getCompanyId());
+                    logs.setCompanyUserId(sendMsgLogBo.getCompanyUserId());
+                    logs.setCustomerId(sendMsgLogBo.getCustomerId());
                     smsLogsService.insertCompanySmsLogs(logs);
+                    //子记录表关联主表的id
+                    sendMsgLogBo.setCompanySmsLogsId(logs.getLogsId());
                 }
             }
             if(anySuccess) {
                 response = R.ok();
                 // 记录特定业务日志
-                smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, contextObject);
+                smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, sendMsgLogBo);
             } else {
                 response = R.error("发送短信失败,服务商返回无成功项!");
-                smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, contextObject);
+                smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, sendMsgLogBo);
             }
         } else {
             response = R.error("发送短信失败!状态码: " + vo.getStatus());
             // 发送失败也要记录特定业务日志
-            smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, contextObject);
+            smsLogStrategyManager.executeLogStrategy(logType, response, content, phone, temp.getTempId(), sms.getType(), number, sendMsgLogBo);
         }
         return response;
     }

+ 23 - 0
fs-service/src/main/java/com/fs/company/dto/CompanySmsLogsQueryDTO.java

@@ -0,0 +1,23 @@
+package com.fs.company.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 短信日志查询DTO
+ */
+@Data
+public class CompanySmsLogsQueryDTO {
+    private Integer optionType;        // 类型:1-课程链接 2-获客
+    private Long companyId;            // 公司ID
+    private Long companyUserId;        // 公司用户ID
+    private String phone;              // 手机号
+    private String tempCode;           // 模板编码
+    private Integer type;              // 短信类型
+    private Date beginCreateTime;      // 开始创建时间
+    private Date endCreateTime;        // 结束创建时间
+    private Long courseId;             // 课程ID(课程链接类型)
+    private Long videoId;              // 视频ID(课程链接类型)
+}

+ 9 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanySmsLogsMapper.java

@@ -5,11 +5,13 @@ import java.util.Map;
 
 import com.alibaba.fastjson.JSONObject;
 import com.fs.company.domain.CompanySmsLogs;
+import com.fs.company.dto.CompanySmsLogsQueryDTO;
 import com.fs.company.param.CompanySmsLogsListParam;
 import com.fs.company.param.CompanySmsLogsListQueryParam;
 import com.fs.company.param.CompanyStatisticsParam;
 import com.fs.company.vo.CompanySmsLogsListQueryVO;
 import com.fs.company.vo.CompanySmsLogsListVO;
+import com.fs.company.vo.CompanySmsLogsQueryVO;
 import com.fs.company.vo.CompanySmsLogsStatisticsVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -194,4 +196,11 @@ public interface CompanySmsLogsMapper
     List<CompanySmsLogsStatisticsVO> selectSmsLogsStatisticsList(@Param("maps") CompanyStatisticsParam param);
     @Select("select * from company_sms_logs where phone=#{mobile} order by logs_id desc limit 1")
     CompanySmsLogs selectCompanySmsLogsByMobile(String mobile);
+
+    /**
+     * 查询短信日志列表
+     * @param queryDTO 查询参数
+     * @return 查询结果列表
+     */
+    List<CompanySmsLogsQueryVO> selectCompanySmsLogsListQueryYsytg(@Param("dto") CompanySmsLogsQueryDTO queryDTO);
 }

+ 7 - 0
fs-service/src/main/java/com/fs/company/service/ICompanySmsLogsService.java

@@ -5,11 +5,13 @@ import java.util.Map;
 
 import com.alibaba.fastjson.JSONObject;
 import com.fs.company.domain.CompanySmsLogs;
+import com.fs.company.dto.CompanySmsLogsQueryDTO;
 import com.fs.company.param.CompanySmsLogsListParam;
 import com.fs.company.param.CompanySmsLogsListQueryParam;
 import com.fs.company.param.CompanyStatisticsParam;
 import com.fs.company.vo.CompanySmsLogsListQueryVO;
 import com.fs.company.vo.CompanySmsLogsListVO;
+import com.fs.company.vo.CompanySmsLogsQueryVO;
 import com.fs.company.vo.CompanySmsLogsStatisticsVO;
 
 /**
@@ -78,4 +80,9 @@ public interface ICompanySmsLogsService
     List<CompanySmsLogsStatisticsVO> selectSmsLogsStatisticsList(CompanyStatisticsParam param);
 
     CompanySmsLogs selectCompanySmsLogsByMobile(String mobile);
+
+    /**
+     * 查询短信发送记录(益寿缘分支)
+     * */
+    public List<CompanySmsLogsQueryVO> selectCompanySmsLogsListQueryYsytg(CompanySmsLogsQueryDTO queryDTO);
 }

+ 19 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanySmsLogsServiceImpl.java

@@ -1,17 +1,21 @@
 package com.fs.company.service.impl;
 
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.annotation.DataScope;
 import com.fs.common.utils.DateUtils;
+import com.fs.company.dto.CompanySmsLogsQueryDTO;
 import com.fs.company.param.CompanySmsLogsListParam;
 import com.fs.company.param.CompanySmsLogsListQueryParam;
 import com.fs.company.param.CompanyStatisticsParam;
 import com.fs.company.vo.CompanySmsLogsListQueryVO;
 import com.fs.company.vo.CompanySmsLogsListVO;
+import com.fs.company.vo.CompanySmsLogsQueryVO;
 import com.fs.company.vo.CompanySmsLogsStatisticsVO;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.fs.company.mapper.CompanySmsLogsMapper;
@@ -130,5 +134,20 @@ public class CompanySmsLogsServiceImpl implements ICompanySmsLogsService
         return companySmsLogsMapper.selectCompanySmsLogsByMobile(mobile);
     }
 
+    @Override
+    public List<CompanySmsLogsQueryVO> selectCompanySmsLogsListQueryYsytg(CompanySmsLogsQueryDTO queryDTO) {
+        List<CompanySmsLogsQueryVO> resultList = companySmsLogsMapper.selectCompanySmsLogsListQueryYsytg(queryDTO);
+        if (CollectionUtils.isEmpty(resultList)) {
+            return Collections.emptyList();
+        }
+        // 手机号脱敏
+        for (CompanySmsLogsQueryVO vo : resultList) {
+            if (vo.getPhone() != null) {
+                vo.setPhone(vo.getPhone().replaceAll("(\\d{3})\\d*(\\d{4})", "$1****$2"));
+            }
+        }
+        return resultList;
+    }
+
 
 }

+ 25 - 0
fs-service/src/main/java/com/fs/company/vo/CompanySmsLogsQueryVO.java

@@ -0,0 +1,25 @@
+package com.fs.company.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 短信日志查询VO
+ */
+
+@Data
+public class CompanySmsLogsQueryVO {
+    private Long logsId;           // 短信日志ID
+    private String companyName;    // 公司名称
+    private String companyUserName;       // 销售名称
+    private String tempCode;       // 模板编码
+    private String phone;          // 手机号
+    private String number;         // 发送号码
+    private Integer type;          // 类型
+    private String content;        // 内容
+    private String courseName;     // 课程名称(课程链接类型)
+    private String videoTitle;     // 视频标题(课程链接类型)
+    private Date createTime;       // 创建时间
+    private Date sendTime;         // 发送时间
+}

+ 34 - 0
fs-service/src/main/java/com/fs/qw/bo/SendMsgLogBo.java

@@ -0,0 +1,34 @@
+package com.fs.qw.bo;
+
+import lombok.Data;
+
+
+
+@Data
+public class SendMsgLogBo {
+
+    //短信发送记录id
+    private Long companySmsLogsId;
+
+    //获客链接主键
+    private Long qwAcquisitionId;
+
+    //公司id
+    private Long companyId;
+
+    //客户id
+    private Long customerId;
+
+    //公司用户id
+    private Long companyUserId;
+
+    //外部联系人id
+    private Long externalId;
+
+    // 课程id
+    private Long courseId;
+
+    // 视频id
+    private Long videoId;
+
+}

+ 5 - 1
fs-service/src/main/java/com/fs/qw/domain/QwAcquisitionSendMsgLog.java

@@ -17,9 +17,13 @@ public class QwAcquisitionSendMsgLog extends BaseEntity {
     /** 主键ID */
     private Long id;
 
+    /** 短信发送记录主键id */
+    @Excel(name = "短信发送记录主键id")
+    private Long companySmsLogsId;
+
     /** 获客链接管理ID */
     @Excel(name = "获客链接管理ID")
-    private String qwAcquisitionId;
+    private Long qwAcquisitionId;
 
     /** 客户电话 */
     @Excel(name = "客户电话")

+ 12 - 0
fs-service/src/main/java/com/fs/qw/domain/QwCourseLinkSendMsgLog.java

@@ -18,6 +18,18 @@ public class QwCourseLinkSendMsgLog extends BaseEntity
     /** 主键ID */
     private Long id;
 
+    /** 短信发送记录主键id */
+    @Excel(name = "短信发送记录主键id")
+    private Long companySmsLogsId;
+
+    /** 课程id */
+    @Excel(name = "课程id")
+    private Long courseId;
+
+    /** 视频id */
+    @Excel(name = "视频id")
+    private Long videoId;
+
     /** 短信数量,超过67个字符为2条短信 */
     @Excel(name = "短信数量")
     private Integer number;

+ 2 - 1
fs-service/src/main/java/com/fs/qw/service/IQwAcquisitionAssistantService.java

@@ -2,6 +2,7 @@ package com.fs.qw.service;
 
 import com.fs.common.exception.CustomException;
 import com.fs.his.dto.SendResultDetailDTO;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwAcquisitionAssistant;
 import com.fs.qw.dto.acquisition.AcquisitionListResponse;
 import com.fs.qw.vo.AcquisitionAssistantDetailVO;
@@ -31,7 +32,7 @@ public interface IQwAcquisitionAssistantService
      * @param qwAcquisitionId 获客链接Id
      * @return 结果
      */
-    public SendResultDetailDTO sendMessageAcquisition(String phone, Long qwAcquisitionId);
+    public SendResultDetailDTO sendMessageAcquisition(String phone, Long qwAcquisitionId, SendMsgLogBo sendMsgLogBo);
 
     /**
      * 从企微同步获客链接列表(全量拉取所有详情)

+ 4 - 2
fs-service/src/main/java/com/fs/qw/service/impl/QwAcquisitionAssistantServiceImpl.java

@@ -12,6 +12,7 @@ import com.fs.company.domain.CompanySmsTemp;
 import com.fs.company.service.ICompanySmsTempService;
 import com.fs.fastgptApi.util.HttpUtil;
 import com.fs.his.dto.SendResultDetailDTO;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwAcquisitionAssistant;
 import com.fs.qw.domain.QwCompany;
 import com.fs.qw.dto.acquisition.*;
@@ -259,7 +260,7 @@ public class QwAcquisitionAssistantServiceImpl implements IQwAcquisitionAssistan
     }
 
     @Override
-    public SendResultDetailDTO sendMessageAcquisition(String phone,Long qwAcquisitionId) {
+    public SendResultDetailDTO sendMessageAcquisition(String phone, Long qwAcquisitionId, SendMsgLogBo sendMsgLogBo) {
         log.info("发送获客链接短信,号码:{}", phone);
         CompanySmsTemp temp = smsTempService.selectCompanySmsTempByCode(SMS_LINK_TEMPLATE_CODE);
         if (temp == null) {
@@ -276,7 +277,8 @@ public class QwAcquisitionAssistantServiceImpl implements IQwAcquisitionAssistan
         String content = originalContent
                 .replace("${sms.friendLink}", replaceText);
         try {
-            R r = smsService.simpleSmsSend(phone, content, temp, SmsLogType.ACQUISITION_LINK, qwAcquisitionId.toString());
+            sendMsgLogBo.setQwAcquisitionId(acquisitionAssistant.getId());
+            R r = smsService.simpleSmsSend(phone, content, temp, SmsLogType.ACQUISITION_LINK, sendMsgLogBo);
 
             if (r != null && "200".equals(String.valueOf(r.get("code")))) {
                 return new SendResultDetailDTO(true, null, null);

+ 9 - 1
fs-service/src/main/java/com/fs/qw/service/impl/SmsLinkRemindCourseServiceImpl.java

@@ -12,6 +12,7 @@ import com.fs.course.config.CourseConfig;
 import com.fs.his.dto.SendResultDetailDTO;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.his.utils.PhoneUtil;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.dto.SmsLinkRemindCourseDTO;
 import com.fs.qw.enums.SmsLogType;
@@ -151,7 +152,14 @@ public class SmsLinkRemindCourseServiceImpl implements ISmsLinkRemindCourseServi
 
         // 7.2 发送短信
         try {
-            R result = smsService.simpleSmsSend(phone, messageContent, temp, SmsLogType.COURSE_LINK, externalId);
+            SendMsgLogBo sendMsgLogBo=new SendMsgLogBo();
+            sendMsgLogBo.setCourseId(Long.valueOf(courseId));
+            sendMsgLogBo.setVideoId(Long.valueOf(videoId));
+            sendMsgLogBo.setExternalId(externalId);
+            sendMsgLogBo.setCustomerId(fsUserId);
+            sendMsgLogBo.setCompanyId(Long.valueOf(companyId));
+            sendMsgLogBo.setCompanyUserId(Long.valueOf(companyUserId));
+            R result = smsService.simpleSmsSend(phone, messageContent, temp, SmsLogType.COURSE_LINK, sendMsgLogBo);
             if (result != null && "200".equals(String.valueOf(result.get("code")))) {
                 return new SendResultDetailDTO(true, null, null);
             } else {

+ 4 - 3
fs-service/src/main/java/com/fs/qw/strategy/impl/AcquisitionLinkLogStrategyImpl.java

@@ -1,6 +1,7 @@
 package com.fs.qw.strategy.impl;
 
 import com.fs.common.utils.DateUtils;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwAcquisitionSendMsgLog;
 import com.fs.qw.mapper.QwAcquisitionSendMsgLogMapper;
 import com.fs.qw.strategy.SmsLogStrategy;
@@ -16,11 +17,11 @@ public class AcquisitionLinkLogStrategyImpl implements SmsLogStrategy {
 
     @Override
     public void recordLog(R result, String content, String phone, Long tempId, String type, Integer number, Object contextObject) {
-        // contextObject 应该是 String 类型的 qwAcquisitionId
-        String qwAcquisitionId = (String) contextObject;
+        SendMsgLogBo sendMsgLogBo = (SendMsgLogBo) contextObject;
 
         QwAcquisitionSendMsgLog log = new QwAcquisitionSendMsgLog();
-        log.setQwAcquisitionId(qwAcquisitionId);
+        log.setCompanySmsLogsId(sendMsgLogBo.getCompanySmsLogsId());
+        log.setQwAcquisitionId(sendMsgLogBo.getQwAcquisitionId());
         log.setNumber(number);
         log.setType(type);
         log.setPhone(phone);

+ 7 - 3
fs-service/src/main/java/com/fs/qw/strategy/impl/CourseLinkLogStrategyImpl.java

@@ -1,6 +1,7 @@
 package com.fs.qw.strategy.impl;
 
 import com.fs.common.utils.DateUtils;
+import com.fs.qw.bo.SendMsgLogBo;
 import com.fs.qw.domain.QwCourseLinkSendMsgLog;
 import com.fs.qw.mapper.QwCourseLinkSendMsgLogMapper;
 import com.fs.qw.strategy.SmsLogStrategy;
@@ -16,11 +17,14 @@ public class CourseLinkLogStrategyImpl implements SmsLogStrategy {
 
     @Override
     public void recordLog(R result, String content, String phone, Long tempId, String type, Integer number, Object contextObject) {
-        // contextObject 应该是 Long 类型的 externalContactId
-        Long externalContactId = (Long) contextObject;
+
+        SendMsgLogBo sendMsgLogBo = (SendMsgLogBo) contextObject;
 
         QwCourseLinkSendMsgLog log = new QwCourseLinkSendMsgLog();
-        log.setExternalContactId(externalContactId);
+        log.setCompanySmsLogsId(sendMsgLogBo.getCompanySmsLogsId());
+        log.setExternalContactId(sendMsgLogBo.getExternalId());
+        log.setCourseId(sendMsgLogBo.getCourseId());
+        log.setVideoId(sendMsgLogBo.getVideoId());
         log.setNumber(number);
         log.setType(type);
         log.setPhone(phone);

+ 1 - 1
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -1185,7 +1185,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
             log.error("检测到未配置看课短信链接域名");
             return null;
         }
-        return "https://"+config.getSmsDomainName() + "/" + link.getLink();
+        return config.getSmsDomainName() + "/" + link.getLink();
     }
 
     private R processQwSopLogsBySendMsg(SendUserLogsInfoMsgParam param,Integer draftStrategy) {

+ 78 - 0
fs-service/src/main/resources/mapper/company/CompanySmsLogsMapper.xml

@@ -129,4 +129,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ) t
         GROUP BY t.type
     </select>
+    <select id="selectCompanySmsLogsListQueryYsytg" resultType="com.fs.company.vo.CompanySmsLogsQueryVO">
+        SELECT
+        csl.logs_id AS logsId,
+        c.company_name AS companyUserName,
+        cu.user_name AS userName,
+        csl.temp_code AS tempCode,
+        csl.phone AS phone,
+        csl.number AS number,
+        csl.type AS type,
+        csl.content AS content,
+        <!-- 根据optionType动态选择关联字段 -->
+        <choose>
+            <when test="dto.optionType == 1">
+                fuc.course_name AS courseName,
+                fucv.title AS videoTitle,
+            </when>
+            <otherwise>
+                NULL AS courseName,
+                NULL AS videoTitle,
+            </otherwise>
+        </choose>
+        csl.create_time AS createTime,
+        csl.send_time AS sendTime
+        FROM
+        company_sms_logs csl
+        LEFT JOIN company c ON csl.company_id = c.company_id
+        LEFT JOIN company_user cu ON csl.company_user_id = cu.user_id
+        <!-- 根据optionType动态关联不同的表 -->
+        <choose>
+            <when test="dto.optionType == 1">
+                LEFT JOIN qw_course_link_send_msg_log qclog ON csl.logs_id = qclog.company_sms_logs_id
+                LEFT JOIN fs_user_course fuc ON fuc.course_id = qclog.course_id
+                LEFT JOIN fs_user_course_video fucv ON fucv.video_id = qclog.video_id
+            </when>
+            <when test="dto.optionType == 2">
+                LEFT JOIN qw_acquisition_send_msg_log qalog ON csl.logs_id = qalog.company_sms_logs_id
+            </when>
+        </choose>
+        <where>
+            <if test="dto.companyId != null">
+                AND csl.company_id = #{dto.companyId}
+            </if>
+            <if test="dto.companyUserId != null">
+                AND csl.company_user_id = #{dto.companyUserId}
+            </if>
+            <if test="dto.phone != null and dto.phone != ''">
+                AND csl.phone LIKE CONCAT('%', #{dto.phone}, '%')
+            </if>
+            <if test="dto.tempCode != null and dto.tempCode != ''">
+                AND csl.temp_code = #{dto.tempCode}
+            </if>
+            <if test="dto.type != null">
+                AND csl.type = #{dto.type}
+            </if>
+            <if test="dto.beginCreateTime != null">
+                AND csl.create_time >= #{dto.beginCreateTime}
+            </if>
+            <if test="dto.endCreateTime != null">
+                AND csl.create_time &lt;= #{dto.endCreateTime}
+            </if>
+            <if test="dto.userIds != null and dto.userIds.size() > 0">
+                AND csl.company_user_id IN
+                <foreach collection="dto.userIds" item="userId" open="(" separator="," close=")">
+                    #{userId}
+                </foreach>
+            </if>
+            <!-- 课程链接类型特有查询条件 -->
+            <if test="dto.optionType == 1">
+                <if test="dto.courseId != null">
+                    AND fuc.course_id = #{dto.courseId}
+                </if>
+                <if test="dto.videoId != null">
+                    AND fucv.video_id = #{dto.videoId}
+                </if>
+            </if>
+        </where>
+        ORDER BY csl.create_time DESC
+    </select>
 </mapper>

+ 6 - 1
fs-service/src/main/resources/mapper/qw/QwAcquisitionSendMsgLogMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.fs.qw.domain.QwAcquisitionSendMsgLog" id="QwAcquisitionSendMsgLogResult">
         <result property="id"    column="id"    />
+        <result property="companySmsLogsId"    column="company_sms_logs_id"    />
         <result property="qwAcquisitionId"    column="qw_acquisition_id"    />
         <result property="phone"    column="phone"    />
         <result property="number"    column="number"    />
@@ -19,12 +20,13 @@
     </resultMap>
 
     <sql id="selectQwAcquisitionSendMsgLogVo">
-        select id, qw_acquisition_id, phone, number, temp_id, type, content, result, remark, create_by, create_time from qw_acquisition_send_msg_log
+        select id, company_sms_logs_id,qw_acquisition_id, phone, number, temp_id, type, content, result, remark, create_by, create_time from qw_acquisition_send_msg_log
     </sql>
 
     <select id="selectQwAcquisitionSendMsgLogList" parameterType="com.fs.qw.domain.QwAcquisitionSendMsgLog" resultMap="QwAcquisitionSendMsgLogResult">
         <include refid="selectQwAcquisitionSendMsgLogVo"/>
         <where>
+            <if test="companySmsLogsId != null  and companySmsLogsId != ''"> and company_sms_logs_id = #{companySmsLogsId}</if>
             <if test="qwAcquisitionId != null  and qwAcquisitionId != ''"> and qw_acquisition_id = #{qwAcquisitionId}</if>
             <if test="phone != null  and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
             <if test="number != null "> and number = #{number}</if>
@@ -45,6 +47,7 @@
     <insert id="insertQwAcquisitionSendMsgLog" parameterType="com.fs.qw.domain.QwAcquisitionSendMsgLog" useGeneratedKeys="true" keyProperty="id">
         insert into qw_acquisition_send_msg_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">company_sms_logs_id,</if>
             <if test="qwAcquisitionId != null and qwAcquisitionId != ''">qw_acquisition_id,</if>
             <if test="phone != null and phone != ''">phone,</if>
             <if test="number != null">number,</if>
@@ -57,6 +60,7 @@
             create_time,
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">#{companySmsLogsId},</if>
             <if test="qwAcquisitionId != null and qwAcquisitionId != ''">#{qwAcquisitionId},</if>
             <if test="phone != null and phone != ''">#{phone},</if>
             <if test="number != null">#{number},</if>
@@ -73,6 +77,7 @@
     <update id="updateQwAcquisitionSendMsgLog" parameterType="com.fs.qw.domain.QwAcquisitionSendMsgLog">
         update qw_acquisition_send_msg_log
         <trim prefix="SET" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">company_sms_logs_id = #{companySmsLogsId},</if>
             <if test="qwAcquisitionId != null and qwAcquisitionId != ''">qw_acquisition_id = #{qwAcquisitionId},</if>
             <if test="phone != null and phone != ''">phone = #{phone},</if>
             <if test="number != null">number = #{number},</if>

+ 16 - 1
fs-service/src/main/resources/mapper/qw/QwCourseLinkSendMsgLogMapper.xml

@@ -6,6 +6,9 @@
 
     <resultMap type="com.fs.qw.domain.QwCourseLinkSendMsgLog" id="QwCourseLinkSendMsgLogResult">
         <result property="id"    column="id"    />
+        <result property="companySmsLogsId"    column="company_sms_logs_id"    />
+        <result property="courseId"    column="course_id"    />
+        <result property="videoId"    column="video_id"    />
         <result property="number"    column="number"    />
         <result property="tempId"    column="temp_id"    />
         <result property="externalContactId"    column="external_contact_id"    />
@@ -19,12 +22,15 @@
     </resultMap>
 
     <sql id="selectQwCourseLinkSendMsgLogVo">
-        select id, number, temp_id, external_contact_id, type, phone, content, result, remark, create_by, create_time from qw_course_link_send_msg_log
+        select id,company_sms_logs_id,course_id,video_id, number, temp_id, external_contact_id, type, phone, content, result, remark, create_by, create_time from qw_course_link_send_msg_log
     </sql>
 
     <select id="selectQwCourseLinkSendMsgLogList" parameterType="com.fs.qw.domain.QwCourseLinkSendMsgLog" resultMap="QwCourseLinkSendMsgLogResult">
         <include refid="selectQwCourseLinkSendMsgLogVo"/>
         <where>
+            <if test="companySmsLogsId != null  and companySmsLogsId != ''"> and company_sms_logs_id = #{companySmsLogsId}</if>
+            <if test="courseId != null  and courseId != ''"> and course_id = #{courseId}</if>
+            <if test="videoId != null  and videoId != ''"> and video_id = #{videoId}</if>
             <if test="number != null "> and number = #{number}</if>
             <if test="tempId != null "> and temp_id = #{tempId}</if>
             <if test="externalContactId != null "> and external_contact_id = #{externalContactId}</if>
@@ -45,6 +51,9 @@
     <insert id="insertQwCourseLinkSendMsgLog" parameterType="com.fs.qw.domain.QwCourseLinkSendMsgLog" useGeneratedKeys="true" keyProperty="id">
         insert into qw_course_link_send_msg_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">company_sms_logs_id,</if>
+            <if test="courseId != null and courseId != ''">course_id,</if>
+            <if test="videoId != null and videoId != ''">video_id,</if>
             <if test="number != null">number,</if>
             <if test="tempId != null">temp_id,</if>
             <if test="externalContactId != null">external_contact_id,</if>
@@ -57,6 +66,9 @@
             create_time,
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">#{companySmsLogsId},</if>
+            <if test="courseId != null and courseId != ''">#{courseId},</if>
+            <if test="videoId != null and videoId != ''">#{videoId},</if>
             <if test="number != null">#{number},</if>
             <if test="tempId != null">#{tempId},</if>
             <if test="externalContactId != null">#{externalContactId},</if>
@@ -73,6 +85,9 @@
     <update id="updateQwCourseLinkSendMsgLog" parameterType="com.fs.qw.domain.QwCourseLinkSendMsgLog">
         update qw_course_link_send_msg_log
         <trim prefix="SET" suffixOverrides=",">
+            <if test="companySmsLogsId != null and companySmsLogsId != ''">company_sms_logs_id = #{companySmsLogsId},</if>
+            <if test="courseId != null and courseId != ''">course_id = #{courseId},</if>
+            <if test="videoId != null and videoId != ''">video_id = #{videoId},</if>
             <if test="number != null">number = #{number},</if>
             <if test="tempId != null">temp_id = #{tempId},</if>
             <if test="externalContactId != null">external_contact_id = #{externalContactId},</if>