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

优化ipad封禁、半封禁发送逻辑

yjwang 1 hete
szülő
commit
8ca8f09dd5

+ 12 - 5
fs-ipad-task/src/main/java/com/fs/app/service/IpadSendServer.java

@@ -88,16 +88,23 @@ public class IpadSendServer {
                             // 根据用户绑定信息去查询用户信息
                             FsUser fsUser = fsUserMapper.getUserLookAppIdByuserId(qwExternalContact.getFsUserId());//优化升级获取用户登录的appId
                             // 判断用户是否有看过其他的小程序多个
-                            if(StringUtils.isNotEmpty(fsUser.getAppId())){
+                            if(fsUser != null && StringUtils.isNotEmpty(fsUser.getAppId()) && !"".equals( fsUser.getAppId())){
                                 // 获取用户看过的小程序ID集合
                                 List<String> miniAppList = Arrays.asList(fsUser.getAppId().split(","));
                                 // 根据小程序ID查询小程序列表
                                 List<FsCoursePlaySourceConfig> configList = playSourceConfigService.selectByAppIds(miniAppList);
-                                // 筛选出半封禁的小程序数据,得到这个数据然后优先发这个小程序
-                                Optional<FsCoursePlaySourceConfig> optional = configList.stream().filter(e -> e.getStatus() != null && e.getStatus() == 1).findFirst();
+                                //优先筛选半封禁的数据
+                                Optional<FsCoursePlaySourceConfig> optional = configList.stream()
+                                        .filter(e -> e.getStatus() != null && e.getStatus() == 1)
+                                        .findFirst();
+                                //如果没找到半封禁,再找 正常的
+                                if (!optional.isPresent()) {
+                                    optional = configList.stream()
+                                            .filter(e -> e.getStatus() != null && e.getStatus() == 0)
+                                            .findFirst();
+                                }
                                 // 判断是否找到
-                                if(optional.isPresent()){
-                                    // 找到半封禁并且在appid里面存在证明这个客户是打开过小程序,优先发送这个
+                                if (optional.isPresent()) {
                                     appid = optional.get().getAppid();
                                 }
                             }else{

+ 4 - 1
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -2271,7 +2271,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             fu.create_time
         FROM
             fs_user fu
-                INNER JOIN fs_user_wx fuw ON fu.user_id = fuw.fs_user_id
+                LEFT JOIN fs_user_wx fuw ON fu.user_id = fuw.fs_user_id
+                INNER JOIN fs_course_play_source_config sc ON fuw.app_id = sc.appid
+                AND sc.is_del = 0
+                AND sc.`status` != 2
         WHERE
             fu.user_id = #{userId}
     </select>