Bläddra i källkod

update 优化发送app课程

ct 19 timmar sedan
förälder
incheckning
f6b482f7a0

+ 1 - 1
fs-ipad-task/src/main/java/com/fs/app/task/SendAppMsg.java

@@ -130,7 +130,7 @@ public class SendAppMsg {
         qwUserList.clear();
     }
 
-    @Scheduled(fixedDelay = 30000) // 每20秒执行一次
+    @Scheduled(fixedDelay = 60000) // 每20秒执行一次
     public void sendMsg2() {
         if (StringUtils.isEmpty(groupNo)) {
             log.error("corpId为空不执行");

+ 3 - 0
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -259,4 +259,7 @@ public class FsUser extends BaseEntity
     private BigDecimal totalCommission;
     // 已提现佣金
     private BigDecimal withdrawFinish;
+
+    // 是否注册im
+    private Integer isIm;
 }

+ 13 - 0
fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java

@@ -483,4 +483,17 @@ public interface FsUserMapper
     FsUser findUserByAppleKey(String appleKey);
 
     IntegralExchangeVo getWallet(Long userId);
+
+    /**
+     * 查询是否下载im
+     * @param userId
+     * @return
+     */
+    Integer  getIsIm(@Param("userId")Long userId);
+
+    /**
+     * 更新im注册状态
+     * @param userId
+     */
+    void updateFsUserIm(@Param("userId")Long userId);
 }

+ 12 - 1
fs-service/src/main/java/com/fs/im/service/impl/OpenIMServiceImpl.java

@@ -521,7 +521,14 @@ public class OpenIMServiceImpl implements OpenIMService {
         ObjectMapper objectMapper = new ObjectMapper();
         //userId = 61l;
         objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // 忽略null字段
-        checkAndImportFriendByDianBo(companyUserId,userId.toString(),cropId,true);
+        // 注册账号
+        //查询用户是否注册im
+        Integer isIm = fsUserMapper.getIsIm(userId);
+        if (isIm == null || isIm == 0){
+            //未注册im,注册账号
+            accountCheck("U" + userId, "1");
+        }
+//        checkAndImportFriendByDianBo(companyUserId,userId.toString(),cropId,true);
         OpenImMsgDTO.Content content = new OpenImMsgDTO.Content();
         OpenImMsgDTO.ImData imData = new OpenImMsgDTO.ImData();
         PayloadDTO payload = new PayloadDTO();
@@ -1014,6 +1021,10 @@ public class OpenIMServiceImpl implements OpenIMService {
             if (errCode==0){
                 JSONObject userData = userJson.getJSONObject("data");
                 String userToken = userData.getString("token");
+                if ("1".equals(type)){
+                    //用户注册im成功
+                    fsUserMapper.updateFsUserIm(Long.valueOf(userId));
+                }
                 return R.ok().put("token", userToken);
             }
 //            return R.error("注册失败");

+ 6 - 0
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -763,6 +763,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                        </if>
                        where user_id=#{userId}
     </update>
+    <update id="updateFsUserIm">
+        UPDATE fs_user SET is_im = 1 WHERE user_id = #{userId}
+    </update>
 
     <select id="selectUserListByMap" resultType="com.fs.his.vo.OptionsVO">
         select
@@ -2485,6 +2488,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getWallet" resultType="com.fs.his.vo.IntegralExchangeVo">
         SELECT user_id,integral, withdraw_integral, total_commission, withdraw_finish,may_withdraw FROM fs_user WHERE user_id = #{userId}
     </select>
+    <select id="getIsIm" resultType="java.lang.Integer">
+        SELECT is_im FROM fs_user WHERE user_id = #{userId}
+    </select>
 
 
 </mapper>