Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

yfh 3 napja
szülő
commit
3658e3a929

+ 26 - 11
fs-admin/src/main/java/com/fs/course/controller/FsCourseRedPacketLogController.java

@@ -1,8 +1,6 @@
 package com.fs.course.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-
+import java.util.*;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.fs.common.core.domain.R;
@@ -23,14 +21,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -94,6 +85,30 @@ public class FsCourseRedPacketLogController extends BaseController
         return R.ok().put("data",new PageInfo<>(list));
     }
 
+    /**
+     * 查询短链课程看课记录列表分页
+     * 与上面请求方式不同,list集合数据在get传输掉包
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseRedPacketLog:pageList')")
+    @PostMapping("/pageList")
+    public R pageList(@RequestBody FsCourseRedPacketLogParam fsCourseRedPacketLog)
+    {
+
+        if (fsCourseRedPacketLog.getPhoneMk() != null && fsCourseRedPacketLog.getPhoneMk() != "") {
+            fsCourseRedPacketLog.setPhone(encryptPhone(fsCourseRedPacketLog.getPhoneMk()));
+        }
+
+        PageHelper.startPage(fsCourseRedPacketLog.getPageNum(), fsCourseRedPacketLog.getPageSize());
+
+        List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
+        for (FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO : list) {
+
+            fsCourseRedPacketLogListPVO.setPhone(PhoneUtil.decryptAutoPhoneMk(fsCourseRedPacketLogListPVO.getPhone()));
+        }
+
+        return R.ok().put("data", new PageInfo<>(list));
+    }
+
     /**
      * 导出短链课程看课记录列表
      */

+ 24 - 10
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -2,7 +2,10 @@ package com.fs.course.controller;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.fs.common.constant.HttpStatus;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
@@ -55,20 +58,31 @@ public class FsCourseWatchLogController extends BaseController
      * 查询短链课程看课记录列表
      */
     @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
-    @PostMapping("/list")
-    public R list(@RequestBody FsCourseWatchLogListParam param)
+    @GetMapping("/list")
+    public TableDataInfo list(FsCourseWatchLogListParam param)
     {
-        if(param.getPageNum() == null) {
-            param.setPageNum(1);
-        }
-        if(param.getPageSize() == null) {
-            param.setPageSize(10);
+        startPage();
+        if(CollectionUtil.isNotEmpty(param.getUserIds())){
+            param.setUserIds(param.getUserIds().stream()
+                    .filter(userId -> userId != null && userId.startsWith("user_"))
+                    .map(userId -> userId.substring(5))
+                    .collect(Collectors.toList())
+            );
         }
-        PageHelper.startPage(param.getPageNum(), param.getPageSize());
-
         List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        return getDataTable(list);
+    }
 
-        return R.ok().put("data",new PageInfo<>(list));
+    /**
+     * 查询短链课程看课记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:pageList')")
+    @PostMapping("/pageList")
+    public R pageList(@RequestBody FsCourseWatchLogListParam param)
+    {
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectFsCourseWatchLogListVO(param);
+        return R.ok().put("data", new PageInfo<>(list));
     }
 
     @GetMapping("/qwWatchLogAllStatisticsList")

+ 5 - 0
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -244,6 +244,11 @@ public class Task {
             String value = (String) cacheMap.get(key);
             //获取sessionId
             Long sessionId = Long.parseLong(key);
+            try {
+                Thread.sleep(800);
+            } catch (Exception e) {
+                log.error("定时消息处理异常,会话id:{},文本:{}",sessionId,value,e);
+            }
             try {
                 if (value != null && !value.isEmpty()) {
                     FastGptChatSession chatSession = fastGptChatSessionMapper.selectFastGptChatSessionBySessionId(sessionId);

+ 6 - 7
fs-service/src/main/java/com/fs/course/mapper/FsCourseRedPacketLogMapper.java

@@ -107,14 +107,13 @@ public interface FsCourseRedPacketLogMapper
     List<FsCourseRedPacketLogListPVO> selectRedPacketLogListVO(@Param("maps") FsCourseRedPacketLogParam param);
 
     @Select({"<script> " +
-            "select l.*,v.title,u.nick_name as fsNickName,u.avatar as fsAvatar,u.phone,cu.nick_name company_user_name,c.company_name,qu.qw_user_name,fuc.course_name,cd.dept_name,u.phone as phoneNumber   from fs_course_red_packet_log l  \n" +
+            "select l.*,v.title,u.nick_name as fsNickName,u.avatar as fsAvatar,u.phone,cu.nick_name company_user_name,c.company_name,qu.qw_user_name,fuc.course_name,cd.dept_name,u.phone as phoneNumber,cu.dept_id   from fs_course_red_packet_log l  \n" +
             "left join fs_user_course_video v on v.video_id = l.video_id \n" +
             "left join fs_user u on u.user_id = l.user_id \n" +
             "left join fs_user_course fuc on fuc.course_id = l.course_id \n" +
             "left join company_user cu on cu.user_id=l.company_user_id \n" +
-            "left join company c on c.company_id=l.company_id \n" +
-            "LEFT JOIN qw_user qu on qu.id= l.qw_user_id  " +
-            "LEFT JOIN company_dept cd on cd.dept_id= cu.dept_id  " +
+            "left join company c on c.company_id=cu.company_id \n" +
+            "LEFT JOIN qw_user qu on qu.id= l.qw_user_id  \n" +
             "where 1=1   " +
             "<if test = ' maps.userId !=null '> and l.user_id = #{maps.userId} </if>" +
             "<if test = ' maps.watchLogId !=null '> and l.watch_log_id = #{maps.watchLogId} </if>" +
@@ -130,10 +129,10 @@ public interface FsCourseRedPacketLogMapper
             "<if test = ' maps.qwUserId !=null '> and l.qw_user_id = #{maps.qwUserId} </if>" +
             "<if test=\"maps.sTime != null \">  and DATE(l.create_time) &gt;= DATE(#{maps.sTime})</if>\n" +
             "<if test=\"maps.eTime != null \">  and DATE(l.create_time) &lt;= DATE(#{maps.eTime})</if>\n" +
-            "            <if test=\"maps.companyUserIds != null and !maps.companyUserIds.isEmpty()\">\n" +
+            "<if test=\"maps.userIds != null and maps.userIds.size() > 0\">\n" +
             "                AND l.company_user_id IN\n" +
-            "                <foreach collection='maps.companyUserIds' item='item' open='(' separator=',' close=')'>\n" +
-            "                    #{item}\n" +
+            "                <foreach collection=\"maps.userIds\" open=\"(\" close=\")\" separator=\",\" item=\"item\">\n" +
+            "                    ${item}\n" +
             "                </foreach>\n" +
             "            </if>" +
             " order by l.log_id desc  "+

+ 24 - 24
fs-service/src/main/java/com/fs/course/param/FsCourseRedPacketLogParam.java

@@ -1,15 +1,15 @@
 package com.fs.course.param;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
-import java.util.ArrayList;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Data
-public class FsCourseRedPacketLogParam {
+public class FsCourseRedPacketLogParam implements Serializable {
 
     private Long userId;
 
@@ -43,31 +43,31 @@ public class FsCourseRedPacketLogParam {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date sTime;
 
-    @TableField(exist = false)
-    private List<String> companyUserIds=new ArrayList<>();
-
     private Integer pageNum;
     private Integer pageSize;
 
-    public List<String> getCompanyUserIds() {
-        if (companyUserIds == null || companyUserIds.isEmpty()) {
-            return companyUserIds;
-        }
+    private List<String> userIds;
 
-        // 直接在原始列表上修改
-        for (int i = 0; i < companyUserIds.size(); i++) {
-            String id = companyUserIds.get(i);
-            if (id != null) {
-                if (id.startsWith("dept_")) {
-                    companyUserIds.set(i, id.substring(5));
-                } else if (id.startsWith("company_")) {
-                    companyUserIds.set(i, id.substring(8));
-                } else if (id.startsWith("user_")) {
-                    companyUserIds.set(i, id.substring(5));
-                }
-            }
+    public List<String> getUserIds() {
+        if (userIds == null || userIds.isEmpty()) {
+            return userIds;
         }
-        return companyUserIds;
-    }
 
+        return userIds.stream()
+                .map(id -> {
+                    if (id == null) {
+                        return null;
+                    }
+                    // 去除前缀
+                    if (id.startsWith("dept_")) {
+                        return "0";
+                    } else if (id.startsWith("company_")) {
+                        return "0";
+                    } else if (id.startsWith("user_")) {
+                        return id.substring(5);
+                    }
+                    return "0";
+                })
+                .collect(Collectors.toList());
+    }
 }

+ 18 - 20
fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogListParam.java

@@ -1,13 +1,12 @@
 package com.fs.course.param;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Data
 public class FsCourseWatchLogListParam implements Serializable {
@@ -110,31 +109,30 @@ public class FsCourseWatchLogListParam implements Serializable {
     private List<Long> deptIds;
     private String ids;
 
-
     private Integer pageNum;
     private Integer pageSize;
-
-    @TableField(exist = false)
-    private List<String> userIds = new ArrayList<>();
+    private List<String> userIds;
 
     public List<String> getUserIds() {
         if (userIds == null || userIds.isEmpty()) {
             return userIds;
         }
 
-        // 直接在原始列表上修改
-        for (int i = 0; i < userIds.size(); i++) {
-            String id = userIds.get(i);
-            if (id != null) {
-                if (id.startsWith("dept_")) {
-                    userIds.set(i, id.substring(5));
-                } else if (id.startsWith("company_")) {
-                    userIds.set(i, id.substring(8));
-                } else if (id.startsWith("user_")) {
-                    userIds.set(i, id.substring(5));
-                }
-            }
-        }
-        return userIds;
+        return userIds.stream()
+                .map(id -> {
+                    if (id == null) {
+                        return null;
+                    }
+                    // 去除前缀
+                    if (id.startsWith("dept_")) {
+                        return "0";
+                    } else if (id.startsWith("company_")) {
+                        return "0";
+                    } else if (id.startsWith("user_")) {
+                        return id.substring(5);
+                    }
+                    return "0";
+                })
+                .collect(Collectors.toList());
     }
 }

+ 19 - 5
fs-service/src/main/java/com/fs/course/service/impl/FsCourseRedPacketLogServiceImpl.java

@@ -3,16 +3,16 @@ package com.fs.course.service.impl;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.cache.ICompanyDeptCacheService;
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyMoneyLogs;
 import com.fs.company.mapper.CompanyMapper;
@@ -62,6 +62,8 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
 
     @Autowired
     private ISysConfigService configService;
+    @Autowired
+    private ICompanyDeptCacheService companyDeptCacheService;
     /**
      * 查询短链课程看课记录
      *
@@ -162,7 +164,19 @@ public class FsCourseRedPacketLogServiceImpl implements IFsCourseRedPacketLogSer
 
     @Override
     public List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVO(FsCourseRedPacketLogParam fsCourseRedPacketLog) {
-        return fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
+        List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogMapper.selectFsCourseRedPacketLogListVO(fsCourseRedPacketLog);
+        // 应用到每个对象
+        if(CollectionUtil.isNotEmpty(list)){
+            list.forEach(item -> {
+                if(item.getDeptId() != null) {
+                    String deptNameById = companyDeptCacheService.getDeptNameById(item.getDeptId());
+                    if(StringUtils.isNotBlank(deptNameById)) {
+                        item.setDeptName(deptNameById);
+                    }
+                }
+            });
+        }
+        return list;
     }
 
     @Override

+ 19 - 6
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.course.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.json.JSONUtil;
@@ -13,6 +14,7 @@ import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.DictUtils;
 import com.fs.common.utils.date.DateUtil;
 import com.fs.company.cache.ICompanyCacheService;
+import com.fs.company.cache.ICompanyDeptCacheService;
 import com.fs.company.cache.ICompanyUserCacheService;
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
@@ -138,6 +140,9 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
     @Autowired
     private FsTagUpdateService fsTagUpdateService;
 
+    @Autowired
+    private ICompanyDeptCacheService companyDeptCacheService;
+
     /**
      * 查询短链课程看课记录
      *
@@ -677,12 +682,20 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
                 ));
 
         // 遍历并赋值
-        fsCourseWatchLogListVOS.forEach(vo -> {
-            String periodName = periodIdToNameMap.get(vo.getPeriodId());
-            if (periodName != null) {
-                vo.setPeriodIdName(periodName);
-            }
-        });
+        if(CollectionUtil.isNotEmpty(fsCourseWatchLogListVOS)){
+            fsCourseWatchLogListVOS.forEach(vo -> {
+                String periodName = periodIdToNameMap.get(vo.getPeriodId());
+                if (periodName != null) {
+                    vo.setPeriodIdName(periodName);
+                }
+                if(vo.getDeptId() != null) {
+                    String deptNameById = companyDeptCacheService.getDeptNameById(vo.getDeptId());
+                    if(com.fs.common.utils.StringUtils.isNotBlank(deptNameById)) {
+                        vo.setDeptName(deptNameById);
+                    }
+                }
+            });
+        }
 
         return fsCourseWatchLogListVOS;
     }

+ 3 - 1
fs-service/src/main/java/com/fs/course/vo/FsCourseRedPacketLogListPVO.java

@@ -23,7 +23,7 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
 
     @Excel(name = "会员id")
     private Long userId;
-
+    @Excel(name = "会员名称")
     private String fsNickName;
 
     private String fsAvatar;
@@ -101,4 +101,6 @@ public class FsCourseRedPacketLogListPVO extends BaseEntity
     @Excel(name = "播放时长")
     private String duration;
 
+    private Long deptId;
+    private Long companyId;
 }

+ 4 - 1
fs-service/src/main/java/com/fs/course/vo/FsCourseWatchLogListVO.java

@@ -85,6 +85,9 @@ public class FsCourseWatchLogListVO extends BaseEntity
     @Excel(name = "所属销售")
     private String companyUserName;
 
+    @Excel(name = "销售部门")
+    private String deptName;
+
     @Excel(name = "所属sop任务")
     private String sopId;
 
@@ -137,5 +140,5 @@ public class FsCourseWatchLogListVO extends BaseEntity
      */
     private Long imMsgSendDetailId;
 
-
+    private Long deptId;
 }

+ 6 - 0
fs-service/src/main/java/com/fs/his/mapper/FsIntegralOrderMapper.java

@@ -71,6 +71,12 @@ public interface FsIntegralOrderMapper extends BaseMapper<FsIntegralOrder>
     @Select({"<script> select order_id, order_code, user_id, user_name, user_phone, user_address, item_json, integral,pay_money,is_pay,pay_time,pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time,qw_user_id,company_user_id,company_id, remark from fs_integral_order " +
             "<where>  \n" +
             "            <if test=\"orderCode != null  and orderCode != ''\"> and order_code = #{orderCode}</if>\n" +
+            "            <if test=\"orderCodes != null and orderCodes.size > 0\"> " +
+            "                and order_code in " +
+            "                <foreach collection='orderCodes' item='orderCode' open='(' close=')' separator=','> " +
+            "                    #{orderCode} " +
+            "                </foreach> " +
+            "            </if>\n" +
             "            <if test=\"userName != null  and userName != ''\"> and user_name like concat('%', #{userName}, '%')</if>\n" +
             "            <if test=\"userPhone != null  and userPhone != ''\"> and user_phone = #{userPhone}</if>\n" +
             "            <if test=\"integral != null  and integral != ''\"> and integral = #{integral}</if>\n" +

+ 17 - 17
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreProductScrmMapper.java

@@ -75,8 +75,8 @@ public interface FsStoreProductScrmMapper
      */
     public int deleteFsStoreProductByIds(Long[] productIds);
     @Select({"<script> " +
-            "select p.*,pc.cate_name, fs_store.store_name from fs_store_product_scrm p left join fs_store_product_category_scrm pc on p.cate_id=pc.cate_id  " +
-            "left join fs_store on fs_store.store_id = p.store_id " +
+            "select p.*,pc.cate_name, fs.store_name from fs_store_product_scrm p left join fs_store_product_category_scrm pc on p.cate_id=pc.cate_id  " +
+            "left join fs_store fs on fs.store_id = p.store_id " +
             "where 1=1 " +
             "<if test = 'maps.productName != null and  maps.productName !=\"\"    '> " +
             "and p.product_name like CONCAT('%',#{maps.productName},'%') " +
@@ -97,53 +97,53 @@ public interface FsStoreProductScrmMapper
             "and p.store_id = #{maps.storeId} " +
             "</if>"+
             "<if test = 'maps.storeIds != null '>" +
-            "and store_id in " +
+            "and p.store_id in " +
             "<foreach collection='maps.storeIds'  item='item' index='index'  open='(' separator=',' close=')'> #{item} </foreach>" +
             "</if>" +
             "<if test = 'maps.isAudit != null '> " +
             "and p.is_audit = #{maps.isAudit} " +
             "</if>" +
             "<if test='maps.drugRegCertNo != null and maps.drugRegCertNo != \"\"'>" +
-            "            AND drug_reg_cert_no LIKE CONCAT('%', #{maps.drugRegCertNo}, '%')" +
+            "    AND p.drug_reg_cert_no LIKE CONCAT('%', #{maps.drugRegCertNo}, '%')" +
             "</if>" +
             "<if test='maps.commonName != null and maps.commonName != \"\"'>" +
-            "    AND common_name LIKE CONCAT('%', #{maps.commonName}, '%')" +
+            "    AND p.common_name LIKE CONCAT('%', #{maps.commonName}, '%')" +
             "</if>" +
             "<if test='maps.dosageForm != null and maps.dosageForm != \"\"'>" +
-            "    AND dosage_form LIKE CONCAT('%', #{maps.dosageForm}, '%')" +
+            "    AND p.dosage_form LIKE CONCAT('%', #{maps.dosageForm}, '%')" +
             "</if>" +
             "<if test='maps.unitPrice != null and maps.unitPrice != \"\"'>" +
-            "    AND unit_price = #{maps.unitPrice}" +
+            "    AND p.unit_price = #{maps.unitPrice}" +
             "</if>" +
             "<if test='maps.batchNumber != null and maps.batchNumber != \"\"'>" +
-            "    AND batch_number LIKE CONCAT('%', #{maps.batchNumber}, '%')" +
+            "    AND p.batch_number LIKE CONCAT('%', #{maps.batchNumber}, '%')" +
             "</if>" +
             "<if test='maps.mah != null and maps.mah != \"\"'>" +
-            "    AND mah LIKE CONCAT('%', #{maps.mah}, '%')" +
+            "    AND p.mah LIKE CONCAT('%', #{maps.mah}, '%')" +
             "</if>" +
             "<if test='maps.mahAddress != null and maps.mahAddress != \"\"'>" +
-            "    AND mah_address LIKE CONCAT('%', #{maps.mahAddress}, '%')" +
+            "    AND p.mah_address LIKE CONCAT('%', #{maps.mahAddress}, '%')" +
             "</if>" +
             "<if test='maps.manufacturer != null and maps.manufacturer != \"\"'>" +
-            "    AND manufacturer LIKE CONCAT('%', #{maps.manufacturer}, '%')" +
+            "    AND p.manufacturer LIKE CONCAT('%', #{maps.manufacturer}, '%')" +
             "</if>" +
             "<if test='maps.manufacturerAddress != null and maps.manufacturerAddress != \"\"'>" +
-            "    AND manufacturer_address LIKE CONCAT('%', #{maps.manufacturerAddress}, '%')" +
+            "    AND p.manufacturer_address LIKE CONCAT('%', #{maps.manufacturerAddress}, '%')" +
             " </if>" +
             " <if test='maps.indications != null and maps.indications != \"\"'>" +
-            "     AND indications LIKE CONCAT('%', #{maps.indications}, '%')" +
+            "     AND p.indications LIKE CONCAT('%', #{maps.indications}, '%')" +
             " </if>" +
             " <if test='maps.dosage != null and maps.dosage != \"\"'>" +
-            "     AND dosage LIKE CONCAT('%', #{maps.dosage}, '%')" +
+            "     AND p.dosage LIKE CONCAT('%', #{maps.dosage}, '%')" +
             " </if>" +
             " <if test='maps.adverseReactions != null and maps.adverseReactions != \"\"'>" +
-            "     AND adverse_reactions LIKE CONCAT('%', #{maps.adverseReactions}, '%')" +
+            "     AND p.adverse_reactions LIKE CONCAT('%', #{maps.adverseReactions}, '%')" +
             " </if>" +
             " <if test='maps.contraindications != null and maps.contraindications != \"\"'>" +
-            "     AND contraindications LIKE CONCAT('%', #{maps.contraindications}, '%')" +
+            "     AND p.contraindications LIKE CONCAT('%', #{maps.contraindications}, '%')" +
             " </if>" +
             " <if test='maps.precautions != null and maps.precautions != \"\"'>" +
-            "     AND precautions LIKE CONCAT('%', #{maps.precautions}, '%')" +
+            "     AND p.precautions LIKE CONCAT('%', #{maps.precautions}, '%')" +
             " </if>"+
             " order by p.product_id desc "+
             "</script>"})

+ 352 - 352
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
         cu.nick_name as company_user_name ,l.send_type,l.create_time,l.update_time,l.last_heartbeat_time,
         qu.qw_user_name,qec.name as external_user_name,c.company_id,u.avatar as fsAvatar,u.nick_name as fsNickName,qec.create_time as qec_create_time,
-        u.is_vip isVip,l.reward_type
+        u.is_vip isVip,l.reward_type,cu.dept_id
          from fs_course_watch_log l
          left join fs_user_course_video v on v.video_id = l.video_id
          left join fs_user_course uc on uc.course_id = l.course_id
@@ -172,358 +172,358 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-           <if test="maps.userIds != null and !maps.userIds.isEmpty()">
-            AND l.company_user_id IN
-               <foreach collection='maps.userIds' item='item' open='(' separator=',' close=')'>
-                  #{item}
-               </foreach>
-            </if>
-        </where>
-         order by l.finish_time desc,l.update_time desc,l.create_time desc
-    </select>
-
-    <select id="selectFsCourseWatchLogListByParam" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
-        select l.log_id,l.user_id,uc.course_name,v.title as video_name,u.nick_name as fsNickName, u.avatar as fsAvatar,
-        l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
-        cu.nick_name as company_user_name ,l.send_type,l.create_time, qu.qw_user_name,qec.name as external_user_name
-        from fs_course_watch_log l
-        left join fs_user_course_video v on v.video_id = l.video_id
-        left join fs_user_course uc on uc.course_id = l.course_id
-        left join fs_user u on u.user_id = l.user_id
-        left join company_user cu on cu.user_id = l.company_user_id
-        left join company c on c.company_id = l.company_id
-        LEFT JOIN qw_user qu on qu.id= l.qw_user_id
-        LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
-        <where>
-            <if test ='userId !=null'>
-                and l.user_id = #{userId}
-            </if>
-            <if test ='qwUserId !=null'>
-                and l.qw_user_id = #{qwUserId}
-            </if>
-            <if test ='courseId !=null'>
-                and l.course_id = #{courseId}
-            </if>
-            <if test ='videoId !=null'>
-                and l.video_id = #{videoId}
-            </if>
-            <if test ='logType !=null'>
-                and l.log_type = #{logType}
-            </if>
-            <if test ='companyId !=null'>
-                and l.company_id = #{companyId}
-            </if>
-            <if test ='companyUserId !=null'>
-                and l.company_user_id = #{companyUserId}
-            </if>
-            <if test ='companyUserName !=null and maps.companyUserName!=""'>
-                and cu.nick_name  like concat('%', #{companyUserName}, '%')
-            </if>
-            <if test ='nickName !=null and maps.nickName!=""'>
-                and u.nick_name  like concat('%', #{nickName}, '%')
-            </if>
-            <if test= 'sTime != null '>
-                and DATE(l.create_time) &gt;= DATE(#{sTime})
-            </if>
-            <if test='eTime != null '>
-                and DATE(l.create_time) &lt;= DATE(#{eTime})
-            </if>
-            <if test= 'maps.scheduleStartTime != null '>
-                and DATE(l.camp_period_time) &gt;= DATE(#{maps.scheduleStartTime})
-            </if>
-            <if test='maps.scheduleEndTime != null '>
-                and DATE(l.camp_period_time) &lt;= DATE(#{maps.scheduleEndTime})
-            </if>
-            <if test="sopIds != null and sopIds.size() > 0">
-                and l.sop_id in
-                <foreach item="sopId" index="index" collection="sopIds" open="(" separator="," close=")">
-                    #{sopId}
+            <if test="maps.userIds != null and !maps.userIds.isEmpty()">
+                AND cu.user_id IN
+                    <foreach collection='maps.userIds' item='item' open='(' separator=',' close=')'>
+                        #{item}
+                    </foreach>
+            </if>
+                </where>
+                 order by l.finish_time desc,l.update_time desc,l.create_time desc
+            </select>
+
+            <select id="selectFsCourseWatchLogListByParam" resultType="com.fs.course.vo.FsCourseWatchLogListVO">
+                select l.log_id,l.user_id,uc.course_name,v.title as video_name,u.nick_name as fsNickName, u.avatar as fsAvatar,
+                l.log_type,SEC_TO_TIME(l.duration) as duration,c.company_name,l.camp_period_time,l.finish_time,
+                cu.nick_name as company_user_name ,l.send_type,l.create_time, qu.qw_user_name,qec.name as external_user_name
+                from fs_course_watch_log l
+                left join fs_user_course_video v on v.video_id = l.video_id
+                left join fs_user_course uc on uc.course_id = l.course_id
+                left join fs_user u on u.user_id = l.user_id
+                left join company_user cu on cu.user_id = l.company_user_id
+                left join company c on c.company_id = l.company_id
+                LEFT JOIN qw_user qu on qu.id= l.qw_user_id
+                LEFT JOIN qw_external_contact qec on l.qw_external_contact_id = qec.id
+                <where>
+                    <if test ='userId !=null'>
+                        and l.user_id = #{userId}
+                    </if>
+                    <if test ='qwUserId !=null'>
+                        and l.qw_user_id = #{qwUserId}
+                    </if>
+                    <if test ='courseId !=null'>
+                        and l.course_id = #{courseId}
+                    </if>
+                    <if test ='videoId !=null'>
+                        and l.video_id = #{videoId}
+                    </if>
+                    <if test ='logType !=null'>
+                        and l.log_type = #{logType}
+                    </if>
+                    <if test ='companyId !=null'>
+                        and l.company_id = #{companyId}
+                    </if>
+                    <if test ='companyUserId !=null'>
+                        and l.company_user_id = #{companyUserId}
+                    </if>
+                    <if test ='companyUserName !=null and maps.companyUserName!=""'>
+                        and cu.nick_name  like concat('%', #{companyUserName}, '%')
+                    </if>
+                    <if test ='nickName !=null and maps.nickName!=""'>
+                        and u.nick_name  like concat('%', #{nickName}, '%')
+                    </if>
+                    <if test= 'sTime != null '>
+                        and DATE(l.create_time) &gt;= DATE(#{sTime})
+                    </if>
+                    <if test='eTime != null '>
+                        and DATE(l.create_time) &lt;= DATE(#{eTime})
+                    </if>
+                    <if test= 'maps.scheduleStartTime != null '>
+                        and DATE(l.camp_period_time) &gt;= DATE(#{maps.scheduleStartTime})
+                    </if>
+                    <if test='maps.scheduleEndTime != null '>
+                        and DATE(l.camp_period_time) &lt;= DATE(#{maps.scheduleEndTime})
+                    </if>
+                    <if test="sopIds != null and sopIds.size() > 0">
+                        and l.sop_id in
+                        <foreach item="sopId" index="index" collection="sopIds" open="(" separator="," close=")">
+                            #{sopId}
+                        </foreach>
+                    </if>
+                </where>
+                order by l.log_id desc
+            </select>
+            <insert id="insertFsCourseWatchLog" parameterType="FsCourseWatchLog" useGeneratedKeys="true" keyProperty="logId">
+                insert into fs_course_watch_log
+                <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="userId != null">user_id,</if>
+                    <if test="videoId != null">video_id,</if>
+                    <if test="logType != null">log_type,</if>
+                    <if test="createTime != null">create_time,</if>
+                    <if test="updateTime != null">update_time,</if>
+                    <if test="qwExternalContactId != null">qw_external_contact_id,</if>
+                    <if test="duration != null">duration,</if>
+                    <if test="qwUserId != null">qw_user_id,</if>
+                    <if test="companyUserId != null">company_user_id,</if>
+                    <if test="companyId != null">company_id,</if>
+                    <if test="courseId != null">course_id,</if>
+                    <if test="sendType != null">send_type,</if>
+                    <if test="rewardType != null">reward_type,</if>
+                    <if test="sopId != null">sop_id,</if>
+                    <if test="finishTime != null">finish_time,</if>
+                    <if test="sendFinishMsg != null">send_finish_msg,</if>
+                    <if test="campPeriodTime != null">camp_period_time,</if>
+                    <if test="periodId != null">period_id,</if>
+                    <if test="project != null">project,</if>
+                </trim>
+                <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="userId != null">#{userId},</if>
+                    <if test="videoId != null">#{videoId},</if>
+                    <if test="logType != null">#{logType},</if>
+                    <if test="createTime != null">#{createTime},</if>
+                    <if test="updateTime != null">#{updateTime},</if>
+                    <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
+                    <if test="duration != null">#{duration},</if>
+                    <if test="qwUserId != null">#{qwUserId},</if>
+                    <if test="companyUserId != null">#{companyUserId},</if>
+                    <if test="companyId != null">#{companyId},</if>
+                    <if test="courseId != null">#{courseId},</if>
+                    <if test="sendType != null">#{sendType},</if>
+                    <if test="rewardType != null">#{rewardType},</if>
+                    <if test="sopId != null">#{sopId},</if>
+                    <if test="finishTime != null">#{finishTime},</if>
+                    <if test="sendFinishMsg != null">#{sendFinishMsg},</if>
+                    <if test="campPeriodTime != null">#{campPeriodTime},</if>
+                    <if test="periodId != null">#{periodId},</if>
+                    <if test="project != null">#{project},</if>
+                </trim>
+            </insert>
+
+            <insert id="insertOrUpdateFsCourseWatchLog" parameterType="FsCourseWatchLog">
+                insert into fs_course_watch_log
+                <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="userId != null">user_id,</if>
+                    <if test="videoId != null">video_id,</if>
+                    <if test="logType != null">log_type,</if>
+                    <if test="createTime != null">create_time,</if>
+                    <if test="updateTime != null">update_time,</if>
+                    <if test="qwExternalContactId != null">qw_external_contact_id,</if>
+                    <if test="duration != null">duration,</if>
+                    <if test="qwUserId != null">qw_user_id,</if>
+                    <if test="companyUserId != null">company_user_id,</if>
+                    <if test="companyId != null">company_id,</if>
+                    <if test="courseId != null">course_id,</if>
+                    <if test="sendType != null">send_type,</if>
+                    <if test="rewardType != null">reward_type,</if>
+                    <if test="sopId != null">sop_id,</if>
+                    <if test="finishTime != null">finish_time,</if>
+                    <if test="sendFinishMsg != null">send_finish_msg,</if>
+                    <if test="campPeriodTime != null">camp_period_time,</if>
+                    <if test="project != null">project,</if>
+                </trim>
+                <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="userId != null">#{userId},</if>
+                    <if test="videoId != null">#{videoId},</if>
+                    <if test="logType != null">#{logType},</if>
+                    <if test="createTime != null">#{createTime},</if>
+                    <if test="updateTime != null">#{updateTime},</if>
+                    <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
+                    <if test="duration != null">#{duration},</if>
+                    <if test="qwUserId != null">#{qwUserId},</if>
+                    <if test="companyUserId != null">#{companyUserId},</if>
+                    <if test="companyId != null">#{companyId},</if>
+                    <if test="courseId != null">#{courseId},</if>
+                    <if test="sendType != null">#{sendType},</if>
+                    <if test="rewardType != null">#{rewardType},</if>
+                    <if test="sopId != null">#{sopId},</if>
+                    <if test="finishTime != null">#{finishTime},</if>
+                    <if test="sendFinishMsg != null">#{sendFinishMsg},</if>
+                    <if test="campPeriodTime != null">#{campPeriodTime},</if>
+                    <if test="project != null">#{project},</if>
+                </trim>
+                on duplicate key update
+                <trim suffixOverrides=",">
+                    <if test="updateTime != null">update_time = #{updateTime},</if>
+                </trim>
+
+            </insert>
+
+
+            <insert id="insertFsCourseWatchLogBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="logId">
+                INSERT INTO fs_course_watch_log (
+                user_id,
+                video_id,
+                log_type,
+                create_time,
+                update_time,
+                qw_external_contact_id,
+                duration,
+                qw_user_id,
+                company_user_id,
+                company_id,
+                course_id,
+                send_type,
+                reward_type,
+                sop_id,
+                camp_period_time,
+                project,
+                period_id,
+                im_msg_send_detail_id
+                )
+                VALUES
+                <foreach collection="watchLogs" item="log" separator=",">
+                    (
+                    #{log.userId},
+                    #{log.videoId},
+                    #{log.logType},
+                    #{log.createTime},
+                    #{log.updateTime},
+                    #{log.qwExternalContactId},
+                    #{log.duration},
+                    #{log.qwUserId},
+                    #{log.companyUserId},
+                    #{log.companyId},
+                    #{log.courseId},
+                    #{log.sendType},
+                    #{log.rewardType},
+                    #{log.sopId},
+                    #{log.campPeriodTime},
+                    #{log.project},
+                    #{log.periodId},
+                    #{log.imMsgSendDetailId}
+                    )
                 </foreach>
-            </if>
-        </where>
-        order by l.log_id desc
-    </select>
-    <insert id="insertFsCourseWatchLog" parameterType="FsCourseWatchLog" useGeneratedKeys="true" keyProperty="logId">
-        insert into fs_course_watch_log
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="userId != null">user_id,</if>
-            <if test="videoId != null">video_id,</if>
-            <if test="logType != null">log_type,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="qwExternalContactId != null">qw_external_contact_id,</if>
-            <if test="duration != null">duration,</if>
-            <if test="qwUserId != null">qw_user_id,</if>
-            <if test="companyUserId != null">company_user_id,</if>
-            <if test="companyId != null">company_id,</if>
-            <if test="courseId != null">course_id,</if>
-            <if test="sendType != null">send_type,</if>
-            <if test="rewardType != null">reward_type,</if>
-            <if test="sopId != null">sop_id,</if>
-            <if test="finishTime != null">finish_time,</if>
-            <if test="sendFinishMsg != null">send_finish_msg,</if>
-            <if test="campPeriodTime != null">camp_period_time,</if>
-            <if test="periodId != null">period_id,</if>
-            <if test="project != null">project,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="userId != null">#{userId},</if>
-            <if test="videoId != null">#{videoId},</if>
-            <if test="logType != null">#{logType},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
-            <if test="duration != null">#{duration},</if>
-            <if test="qwUserId != null">#{qwUserId},</if>
-            <if test="companyUserId != null">#{companyUserId},</if>
-            <if test="companyId != null">#{companyId},</if>
-            <if test="courseId != null">#{courseId},</if>
-            <if test="sendType != null">#{sendType},</if>
-            <if test="rewardType != null">#{rewardType},</if>
-            <if test="sopId != null">#{sopId},</if>
-            <if test="finishTime != null">#{finishTime},</if>
-            <if test="sendFinishMsg != null">#{sendFinishMsg},</if>
-            <if test="campPeriodTime != null">#{campPeriodTime},</if>
-            <if test="periodId != null">#{periodId},</if>
-            <if test="project != null">#{project},</if>
-        </trim>
-    </insert>
-
-    <insert id="insertOrUpdateFsCourseWatchLog" parameterType="FsCourseWatchLog">
-        insert into fs_course_watch_log
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="userId != null">user_id,</if>
-            <if test="videoId != null">video_id,</if>
-            <if test="logType != null">log_type,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="qwExternalContactId != null">qw_external_contact_id,</if>
-            <if test="duration != null">duration,</if>
-            <if test="qwUserId != null">qw_user_id,</if>
-            <if test="companyUserId != null">company_user_id,</if>
-            <if test="companyId != null">company_id,</if>
-            <if test="courseId != null">course_id,</if>
-            <if test="sendType != null">send_type,</if>
-            <if test="rewardType != null">reward_type,</if>
-            <if test="sopId != null">sop_id,</if>
-            <if test="finishTime != null">finish_time,</if>
-            <if test="sendFinishMsg != null">send_finish_msg,</if>
-            <if test="campPeriodTime != null">camp_period_time,</if>
-            <if test="project != null">project,</if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="userId != null">#{userId},</if>
-            <if test="videoId != null">#{videoId},</if>
-            <if test="logType != null">#{logType},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="qwExternalContactId != null">#{qwExternalContactId},</if>
-            <if test="duration != null">#{duration},</if>
-            <if test="qwUserId != null">#{qwUserId},</if>
-            <if test="companyUserId != null">#{companyUserId},</if>
-            <if test="companyId != null">#{companyId},</if>
-            <if test="courseId != null">#{courseId},</if>
-            <if test="sendType != null">#{sendType},</if>
-            <if test="rewardType != null">#{rewardType},</if>
-            <if test="sopId != null">#{sopId},</if>
-            <if test="finishTime != null">#{finishTime},</if>
-            <if test="sendFinishMsg != null">#{sendFinishMsg},</if>
-            <if test="campPeriodTime != null">#{campPeriodTime},</if>
-            <if test="project != null">#{project},</if>
-        </trim>
-        on duplicate key update
-        <trim suffixOverrides=",">
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-        </trim>
-
-    </insert>
-
-
-    <insert id="insertFsCourseWatchLogBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="logId">
-        INSERT INTO fs_course_watch_log (
-        user_id,
-        video_id,
-        log_type,
-        create_time,
-        update_time,
-        qw_external_contact_id,
-        duration,
-        qw_user_id,
-        company_user_id,
-        company_id,
-        course_id,
-        send_type,
-        reward_type,
-        sop_id,
-        camp_period_time,
-        project,
-        period_id,
-        im_msg_send_detail_id
-        )
-        VALUES
-        <foreach collection="watchLogs" item="log" separator=",">
-            (
-            #{log.userId},
-            #{log.videoId},
-            #{log.logType},
-            #{log.createTime},
-            #{log.updateTime},
-            #{log.qwExternalContactId},
-            #{log.duration},
-            #{log.qwUserId},
-            #{log.companyUserId},
-            #{log.companyId},
-            #{log.courseId},
-            #{log.sendType},
-            #{log.rewardType},
-            #{log.sopId},
-            #{log.campPeriodTime},
-            #{log.project},
-            #{log.periodId},
-            #{log.imMsgSendDetailId}
-            )
-        </foreach>
-        ON DUPLICATE KEY UPDATE
-        update_time = NOW(),
-        im_msg_send_detail_id = VALUES(im_msg_send_detail_id)
-    </insert>
-
-
-
-    <update id="updateFsCourseWatchLog" parameterType="FsCourseWatchLog">
-        update fs_course_watch_log
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="userId != null">user_id = #{userId},</if>
-            <if test="videoId != null">video_id = #{videoId},</if>
-            <if test="logType != null">log_type = #{logType},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="qwExternalContactId != null">qw_external_contact_id = #{qwExternalContactId},</if>
-            <if test="duration != null">duration = #{duration},</if>
-            <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
-            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
-            <if test="companyId != null">company_id = #{companyId},</if>
-            <if test="courseId != null">course_id = #{courseId},</if>
-            <if test="sendType != null">send_type = #{sendType},</if>
-            <if test="rewardType != null">reward_type = #{rewardType},</if>
-            <if test="sopId != null">sop_id = #{sopId},</if>
-            <if test="finishTime != null">finish_time = #{finishTime},</if>
-            <if test="sendFinishMsg != null">send_finish_msg = #{sendFinishMsg},</if>
-            <if test="lastHeartbeatTime != null">last_heartbeat_time = #{lastHeartbeatTime},</if>
-            <if test="periodId != null">period_id = #{periodId},</if>
-            <if test="project != null">project = #{project},</if>
-        </trim>
-        where log_id = #{logId}
-    </update>
-
-    <delete id="deleteFsCourseWatchLogByLogId" parameterType="Long">
-        delete from fs_course_watch_log where log_id = #{logId}
-    </delete>
-
-    <delete id="deleteFsCourseWatchLogByLogIds" parameterType="String">
-        delete from fs_course_watch_log where log_id in
-        <foreach item="logId" collection="array" open="(" separator="," close=")">
-            #{logId}
-        </foreach>
-    </delete>
-
-    <select id="selectFsCourseWatchLogByFinishTime" resultType="com.fs.course.param.FsCourseWatchLogByFinishTimeParam">
-        <![CDATA[
-        SELECT
-            fcwl.log_id,
-            fcwl.create_time,
-            fcwl.qw_external_contact_id,
-            fcwl.qw_user_id,
-            fcwl.user_id,
-            fcwl.company_user_id,
-            fcwl.company_id,
-            fcwl.sop_id,
-            fcwl.finish_time,
-            fcwl.camp_period_time,
-            qec.corp_id,
-            qec.external_user_id,
-            qec.tag_ids,
-            qec.user_id AS qw_user,
-            qec.name AS external_contact_name
-        FROM
-            fs_course_watch_log fcwl
-                LEFT JOIN qw_external_contact qec ON fcwl.qw_external_contact_id = qec.id
-        WHERE
-            DATE(fcwl.finish_time)= '2025-02-09'
-          and fcwl.camp_period_time is not NULL
-        ]]>
-    </select>
-    <select id="getWatchLogByFsUser" resultType="com.fs.course.domain.FsCourseWatchLog">
-        SELECT
-            log_id,
-            user_id,
-            video_id,
-            log_type,
-            create_time,
-            update_time,
-            duration,
-            company_user_id,
-            company_id,
-            course_id,
-            send_type,
-            reward_type,
-            last_heartbeat_time,
-            sop_id,
-            finish_time,
-            send_finish_msg,
-            camp_period_time
-        FROM
-            fs_course_watch_log
-        WHERE
-            send_type = 1
-          AND video_id = #{videoId}
-          AND user_id = #{fsUserId}
-          AND company_user_id = #{companyUserId}  order by log_id desc limit 1
-    </select>
-    <select id="selectFsCourseWatchLogStatisticsListVONew"
-            resultType="com.fs.course.vo.FsCourseWatchLogStatisticsListVO">
-        SELECT
-        o.company_user_id,o.user_id,DATE(o.create_time) create_time,
-        SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) AS type1,
-        SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) AS type2,
-        SUM(CASE WHEN o.log_type = '3' THEN 1 ELSE 0 END) AS type3,
-        SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END) AS type4,
-        o.project as project,
-        o.course_id as course_id,
-        o.video_id as video_id
-        FROM fs_course_watch_log o
-        <where>
-            send_type=1
-            <if test="companyId != null">
-                and o.company_id=#{companyId}
-            </if>
-            <if test= 'sTime != null '>
-                and DATE(o.create_time) &gt;= #{sTime}
-            </if>
-            <if test='eTime != null '>
-                and DATE(o.create_time) &lt;= #{eTime}
-            </if>
-            <if test ='courseId !=null'>
-                and o.course_id = #{courseId}
-            </if>
-            <if test ='videoId !=null'>
-                and o.video_id = #{videoId}
-            </if>
-            <if test="companyUserId != null">
-                and o.company_user_id = #{companyUserId}
-            </if>
-            <if test="project != null">
-                and o.project = #{project}
-            </if>
-            <if test="userId != null">
-                and o.user_id = #{userId}
-            </if>
-        </where>
-
-        GROUP BY o.video_id,o.user_id,DATE(o.create_time),o.project,o.course_id
-        ORDER BY o.video_id ,DATE(o.create_time)
-
-<!--        limit ${(pageNum-1)*pageSize},${pageSize}-->
+                ON DUPLICATE KEY UPDATE
+                update_time = NOW(),
+                im_msg_send_detail_id = VALUES(im_msg_send_detail_id)
+            </insert>
+
+
+
+            <update id="updateFsCourseWatchLog" parameterType="FsCourseWatchLog">
+                update fs_course_watch_log
+                <trim prefix="SET" suffixOverrides=",">
+                    <if test="userId != null">user_id = #{userId},</if>
+                    <if test="videoId != null">video_id = #{videoId},</if>
+                    <if test="logType != null">log_type = #{logType},</if>
+                    <if test="createTime != null">create_time = #{createTime},</if>
+                    <if test="updateTime != null">update_time = #{updateTime},</if>
+                    <if test="qwExternalContactId != null">qw_external_contact_id = #{qwExternalContactId},</if>
+                    <if test="duration != null">duration = #{duration},</if>
+                    <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
+                    <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+                    <if test="companyId != null">company_id = #{companyId},</if>
+                    <if test="courseId != null">course_id = #{courseId},</if>
+                    <if test="sendType != null">send_type = #{sendType},</if>
+                    <if test="rewardType != null">reward_type = #{rewardType},</if>
+                    <if test="sopId != null">sop_id = #{sopId},</if>
+                    <if test="finishTime != null">finish_time = #{finishTime},</if>
+                    <if test="sendFinishMsg != null">send_finish_msg = #{sendFinishMsg},</if>
+                    <if test="lastHeartbeatTime != null">last_heartbeat_time = #{lastHeartbeatTime},</if>
+                    <if test="periodId != null">period_id = #{periodId},</if>
+                    <if test="project != null">project = #{project},</if>
+                </trim>
+                where log_id = #{logId}
+            </update>
+
+            <delete id="deleteFsCourseWatchLogByLogId" parameterType="Long">
+                delete from fs_course_watch_log where log_id = #{logId}
+            </delete>
+
+            <delete id="deleteFsCourseWatchLogByLogIds" parameterType="String">
+                delete from fs_course_watch_log where log_id in
+                <foreach item="logId" collection="array" open="(" separator="," close=")">
+                    #{logId}
+                </foreach>
+            </delete>
+
+            <select id="selectFsCourseWatchLogByFinishTime" resultType="com.fs.course.param.FsCourseWatchLogByFinishTimeParam">
+                <![CDATA[
+                SELECT
+                    fcwl.log_id,
+                    fcwl.create_time,
+                    fcwl.qw_external_contact_id,
+                    fcwl.qw_user_id,
+                    fcwl.user_id,
+                    fcwl.company_user_id,
+                    fcwl.company_id,
+                    fcwl.sop_id,
+                    fcwl.finish_time,
+                    fcwl.camp_period_time,
+                    qec.corp_id,
+                    qec.external_user_id,
+                    qec.tag_ids,
+                    qec.user_id AS qw_user,
+                    qec.name AS external_contact_name
+                FROM
+                    fs_course_watch_log fcwl
+                        LEFT JOIN qw_external_contact qec ON fcwl.qw_external_contact_id = qec.id
+                WHERE
+                    DATE(fcwl.finish_time)= '2025-02-09'
+                  and fcwl.camp_period_time is not NULL
+                ]]>
+            </select>
+            <select id="getWatchLogByFsUser" resultType="com.fs.course.domain.FsCourseWatchLog">
+                SELECT
+                    log_id,
+                    user_id,
+                    video_id,
+                    log_type,
+                    create_time,
+                    update_time,
+                    duration,
+                    company_user_id,
+                    company_id,
+                    course_id,
+                    send_type,
+                    reward_type,
+                    last_heartbeat_time,
+                    sop_id,
+                    finish_time,
+                    send_finish_msg,
+                    camp_period_time
+                FROM
+                    fs_course_watch_log
+                WHERE
+                    send_type = 1
+                  AND video_id = #{videoId}
+                  AND user_id = #{fsUserId}
+                  AND company_user_id = #{companyUserId}  order by log_id desc limit 1
+            </select>
+            <select id="selectFsCourseWatchLogStatisticsListVONew"
+                    resultType="com.fs.course.vo.FsCourseWatchLogStatisticsListVO">
+                SELECT
+                o.company_user_id,o.user_id,DATE(o.create_time) create_time,
+                SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) AS type1,
+                SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) AS type2,
+                SUM(CASE WHEN o.log_type = '3' THEN 1 ELSE 0 END) AS type3,
+                SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END) AS type4,
+                o.project as project,
+                o.course_id as course_id,
+                o.video_id as video_id
+                FROM fs_course_watch_log o
+                <where>
+                    send_type=1
+                    <if test="companyId != null">
+                        and o.company_id=#{companyId}
+                    </if>
+                    <if test= 'sTime != null '>
+                        and DATE(o.create_time) &gt;= #{sTime}
+                    </if>
+                    <if test='eTime != null '>
+                        and DATE(o.create_time) &lt;= #{eTime}
+                    </if>
+                    <if test ='courseId !=null'>
+                        and o.course_id = #{courseId}
+                    </if>
+                    <if test ='videoId !=null'>
+                        and o.video_id = #{videoId}
+                    </if>
+                    <if test="companyUserId != null">
+                        and o.company_user_id = #{companyUserId}
+                    </if>
+                    <if test="project != null">
+                        and o.project = #{project}
+                    </if>
+                    <if test="userId != null">
+                        and o.user_id = #{userId}
+                    </if>
+                </where>
+
+                GROUP BY o.video_id,o.user_id,DATE(o.create_time),o.project,o.course_id
+                ORDER BY o.video_id ,DATE(o.create_time)
+
+        <!--        limit ${(pageNum-1)*pageSize},${pageSize}-->
     </select>
     <select id="selectFsCourseWatchLogStatisticsListVONewCount" resultType="java.lang.Long">
         SELECT COUNT(*)

+ 2 - 2
fs-service/src/main/resources/mapper/qw/CustomerTransferApprovalMapper.xml

@@ -40,8 +40,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="approverUserId != null "> and approver_user_id = #{approverUserId}</if>
             <if test="approvalRemark != null  and approvalRemark != ''"> and approval_remark = #{approvalRemark}</if>
             <if test="processedAt != null "> and processed_at = #{processedAt}</if>
-            <if test="createdAt != null "> and created_at = #{createdAt}</if>
-            <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
+            <if test="createdAt != null "> and date_format(created_at,'%y%m%d') = date_format(#{createdAt},'%y%m%d')</if>
+            <if test="updatedAt != null "> and date_format(updated_at,'%y%m%d') = date_format(#{updatedAt},'%y%m%d')</if>
         </where>
         order by id desc
     </select>