派生自 projectDept/qhighschool

EricsHu
2022-12-05 068fc7f2e81178e55fa191a13709af64b1a163f6
src/main/java/com/qxueyou/scc/school/service/impl/RankMsgDealService.java
@@ -47,7 +47,7 @@
   private static Logger log = LogManager.getLogger("ONSExceptionLogService");
   
   /**
    * 排名更新时间,默认60秒
    * 排名更新时间,默认60秒
    */
   @SuppressWarnings("unused")
   private int updateRankMinutes = 60;
@@ -70,10 +70,10 @@
//         String scopeType = msg.getUserProperties("scopeType");
//         String scopeId = msg.getUserProperties("scopeId");
//         
//         // 判断哪些需要更新排名
//         // 判断哪些需要更新排名
//         List<SchRank> rankLst = getRankLstNeedUpdate(userId,rankType,scopeType,scopeId);
//         
//         // 如果有,则更新排名
//         // 如果有,则更新排名
//         updateRankLst(rankLst);
//         
//      }catch(Exception e){
@@ -84,7 +84,7 @@
//               ";scopeType:" + msg.getUserProperties("scopeType") + 
//               ";scopeId:" + msg.getUserProperties("scopeId") ;
//
//         log.error( businessId + " :排名消息发送失败:" + e , e);
//         log.error( businessId + " :排名消息发送失败:" + e , e);
//         onsExceptionLogService.logSaveExceptionLog(cfg.getConfigByEnv("ons-common-topic"), "SCH_RANK", businessId , desp );
//      }
//      
@@ -92,7 +92,7 @@
//   }
   /**
    * 更新排名
    * 更新排名
    * 
    * @param rankLst
    */
@@ -106,16 +106,16 @@
   }
   /**
    * 更新排名
    * 更新排名
    * 
    * @param rank
    */
   private void updateRank(SchRank rank) {
      // 查询所有待排名实时数据列表
      // 查询所有待排名实时数据列表
      List<SchRank> rankLst = querySchRankLstByRank(rank);
      // 按value排序
      // 按value排序
      Collections.sort(rankLst, new Comparator<SchRank>() {
         @Override
         public int compare(SchRank r1, SchRank r2) {
@@ -129,19 +129,19 @@
         }
      });
      // 新建版本记录
      // 新建版本记录
      SchRankVer version = insertRankVersion(rank);
      // 插入rank_his数据
      // 插入rank_his数据
      saveRankHisData(version, rankLst);
      // 插入缓存记录,标记本次更新排名时间
      // 插入缓存记录,标记本次更新排名时间
      updateUpdateTime(rank);
   }
   /**
    * 插入缓存记录,标记本次更新排名时间
    * 插入缓存记录,标记本次更新排名时间
    * 
    * @param rank
    */
@@ -150,7 +150,7 @@
   }
   /**
    * 获取cacheId
    * 获取cacheId
    * 
    * @param rank
    * @return
@@ -163,14 +163,14 @@
   }
   /**
    * 创建新的版本记录
    * 创建新的版本记录
    * 
    * @param rank
    * @return
    */
   private SchRankVer insertRankVersion(SchRank rank) {
      // 更新旧的最新版本
      // 更新旧的最新版本
      String hql = "from SchRankVer where rankType=? and scopeId=? and scopeType=? and latest is true order by version desc";
      List<SchRankVer> oldLastestVerLst = dao.find(hql, CollectionUtils.newList(
            rank.getRankType(), rank.getScopeId(), rank.getScopeType()),
@@ -184,7 +184,7 @@
         dao.saveOrUpdate(oldVer);
      }
      // 创建新的版本
      // 创建新的版本
      SchRankVer ver = new SchRankVer();
      TraceUtils.setCreateTrace(ver);
@@ -204,7 +204,7 @@
   }
   /**
    * 根据任何一条排名数据查询所有待排名实时数据列表
    * 根据任何一条排名数据查询所有待排名实时数据列表
    * 
    * @param rank
    * @return
@@ -222,7 +222,7 @@
   }
   /**
    * 判断哪些需要更新排名
    * 判断哪些需要更新排名
    * 
    * @param userId
    * @return
@@ -231,11 +231,11 @@
   private List<SchRank> getRankLstNeedUpdate(String userId,String rankType,String scopeType,String scopeId) {
      StringBuffer sb = new StringBuffer("from SchRank where userId=? and rankType = ? and scopeType = ? ");
      // 参数集合
      // 参数集合
      List<Object> args = CollectionUtils.newList(userId,rankType,scopeType);
      
      if(!SchRank.SCOPE_TYPE_QXUEYOU.equals(scopeType) 
            && StringUtils.isNotBlank(scopeId)){// qxueyou排名 不需要
            && StringUtils.isNotBlank(scopeId)){// qxueyou排名 不需要
         sb.append(" and scopeId = ?");
         args.add(scopeId);
      }
@@ -257,7 +257,7 @@
   }
   /**
    * 插入rank_his数据
    * 插入rank_his数据
    * 
    * @param version
    * @param rankLst
@@ -272,7 +272,7 @@
      for (SchRank rank : rankLst) {
         // Q学友只处理前一百名
         // Q学友只处理前一百名
         if (i > 100
               && SchRank.SCOPE_TYPE_QXUEYOU.equals(rank.getScopeType())) {
            break;