Browse Source

1、调整红包记录查询数据丢失
2、直播登录问题处理

yys 2 tuần trước cách đây
mục cha
commit
a5dd63c51b

+ 32 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseRedPacketLogMapper.java

@@ -113,7 +113,38 @@ public interface FsCourseRedPacketLogMapper
             " order by o.order_id desc  "+
             "</script>"})
     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,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=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.logId !=null '> and l.log_id = #{maps.logId} </if>" +
+            "<if test = ' maps.watchLogId !=null '> and l.watch_log_id = #{maps.watchLogId} </if>" +
+            "<if test = ' maps.companyId !=null '> and l.company_id = #{maps.companyId} </if>" +
+            "<if test = ' maps.companyUserId !=null '> and l.company_user_id = #{maps.companyUserId} </if>" +
+            "<if test = ' maps.companyUserName !=null '> and cu.nick_name  like concat('%', #{maps.companyUserName}, '%') </if>" +
+            "<if test = ' maps.nickName !=null '> and u.nick_name  like concat('%', #{maps.nickName}, '%') </if>" +
+            "<if test = ' maps.courseId !=null '> and l.course_id = #{maps.courseId} </if>" +
+            "<if test = ' maps.videoId !=null '> and l.video_id = #{maps.videoId} </if>" +
+            "<if test = ' maps.periodId !=null '> and l.period_id = #{maps.periodId} </if>" +
+            "<if test = ' maps.status !=null '> and l.status = #{maps.status} </if>" +
+            "<if test = \"maps.phone !=null and maps.phone != '' \"> and u.phone = #{maps.phone} </if>" +
+            "<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.userIds != null and maps.userIds.size() > 0\">\n" +
+            "                AND l.company_user_id IN\n" +
+            "                <foreach collection=\"maps.userIds\" open=\"(\" close=\")\" separator=\",\" item=\"item\">\n" +
+            "                    ${item}\n" +
+            "                </foreach>\n" +
+            "            </if>" +
+            " order by l.log_id desc  "+
+            "</script>"})
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVO(@Param("maps") FsCourseRedPacketLogParam fsCourseRedPacketLog);
 
     List<FsCourseRedPacketLogListPVO> selectFsCourseRedPacketLogListVOPage(@Param("maps") FsCourseRedPacketLogParam fsCourseRedPacketLog);

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

@@ -53,9 +53,12 @@ public class FsCourseRedPacketLogParam implements Serializable {
 
     private List<String> userIds;
 
-    public List<String> getUserIds() {
+    /**
+     * 获取转换后的userIds(去掉user_前缀,返回Long类型用于SQL IN查询)
+     */
+    public List<Long> getUserIdsConverted() {
         if (userIds == null || userIds.isEmpty()) {
-            return userIds;
+            return null;
         }
 
         return userIds.stream()
@@ -65,14 +68,20 @@ public class FsCourseRedPacketLogParam implements Serializable {
                     }
                     // 去除前缀
                     if (id.startsWith("dept_")) {
-                        return "0";
+                        return 0L;
                     } else if (id.startsWith("company_")) {
-                        return "0";
+                        return 0L;
                     } else if (id.startsWith("user_")) {
-                        return id.substring(5);
+                        return Long.parseLong(id.substring(5));
+                    }
+                    // 已经是纯数字,直接解析
+                    try {
+                        return Long.parseLong(id);
+                    } catch (NumberFormatException e) {
+                        return 0L;
                     }
-                    return "0";
                 })
+                .filter(id -> id != null && id > 0)
                 .collect(Collectors.toList());
     }
 }

+ 4 - 4
fs-service/src/main/resources/mapper/course/FsCourseRedPacketLogMapper.xml

@@ -417,9 +417,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="maps.qwUserId != null"> AND qw_user_id = #{maps.qwUserId} </if>
                 <if test="maps.sTime != null"> AND create_time &gt;= #{maps.sTime} </if>
                 <if test="maps.eTime != null"> AND create_time &lt;= #{maps.eTime} </if>
-                <if test="maps.userIds != null and maps.userIds.size() > 0">
+                <if test="maps.userIdsConverted != null and maps.userIdsConverted.size() > 0">
                     AND company_user_id IN
-                    <foreach collection="maps.userIds" open="(" close=")" separator="," item="item">${item}</foreach>
+                    <foreach collection="maps.userIdsConverted" open="(" close=")" separator="," item="item">#{item}</foreach>
                 </if>
             </where>
             ORDER BY log_id DESC
@@ -451,9 +451,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="maps.qwUserId != null"> AND qw_user_id = #{maps.qwUserId} </if>
             <if test="maps.sTime != null"> AND create_time &gt;= #{maps.sTime} </if>
             <if test="maps.eTime != null"> AND create_time &lt;= #{maps.eTime} </if>
-            <if test="maps.userIds != null and maps.userIds.size() > 0">
+            <if test="maps.userIdsConverted != null and maps.userIdsConverted.size() > 0">
                 AND company_user_id IN
-                <foreach collection="maps.userIds" open="(" close=")" separator="," item="item">${item}</foreach>
+                <foreach collection="maps.userIdsConverted" open="(" close=")" separator="," item="item">#{item}</foreach>
             </if>
         </where>
     </select>

+ 3 - 3
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java

@@ -509,7 +509,7 @@ public class AppLoginController extends AppBaseController{
 
         FsUser info=user.get(0);
 
-        if (isWechatInstalled && isInit()){
+        if (ObjectUtil.isNotEmpty(isWechatInstalled)&&isWechatInstalled && isInit()){
             return generateTokenAndReturn(info);
         }
         FsUser userMap = new FsUser();
@@ -756,7 +756,7 @@ public class AppLoginController extends AppBaseController{
         //当前手机号只绑定了单个微信,直接登录
         if (usersByPhone.size()==1){
             user = usersByPhone.get(0);
-            if (isWechatInstalled && isInit()){
+            if (ObjectUtil.isNotEmpty(isWechatInstalled)&&isWechatInstalled && isInit()){
                 return generateTokenAndReturn(user);
             }
             if (user.getUnionId()==null){
@@ -913,7 +913,7 @@ public class AppLoginController extends AppBaseController{
         }
         if (usersByPhone.size()==1){
             user = usersByPhone.get(0);
-            if (isWechatInstalled && isInit()){
+            if (ObjectUtil.isNotEmpty(isWechatInstalled)&&isWechatInstalled && isInit()){
                 return generateTokenAndReturn(user);
             }
             if (user.getUnionId()==null){