Просмотр исходного кода

feature: 学员自助
1.增加注释及格式化

luoyb 1 год назад
Родитель
Сommit
2ac842e82a

+ 28 - 10
ruoyi-modules/ruoyi-backstage/src/main/java/org/dromara/backstage/business/self/TraineeBusiness.java

@@ -151,16 +151,6 @@ public class TraineeBusiness {
         return R.ok();
     }
 
-    public void getGuestInfo(YcTraineeBo bo, String userOtherId, String deptOtherId) {
-
-        R<RemoteGuestVo> getGuestVo = kfGuestService.selectGuestByOtherId(userOtherId);
-        bo.setGuestId(getGuestVo.getData().getId());
-
-        RemoteTeamBo teamBo = new RemoteTeamBo().setOtherId(deptOtherId);
-        R<RemoteTeamVo> getTeamVo = kfTeamService.selectTeamByBo(teamBo);
-        bo.setTeamId(getTeamVo.getData().getId());
-    }
-
     /**
      * 获取指定正在进行的班级列表
      *
@@ -171,6 +161,11 @@ public class TraineeBusiness {
         return remoteDeptService.selectDoingClass(doingDate);
     }
 
+    /**
+     * 获取指定日期正在进行的团客
+     * @param doingDate 指定日期
+     * @return List<RemoteDeptVo> 团客列表
+     */
     public List<RemoteTeamVo> selectDoingTeam(Date doingDate) {
         R<List<RemoteTeamVo>> result = kfTeamService.selectDoingTeam(doingDate);
         if (R.isSuccess(result)) {
@@ -200,17 +195,40 @@ public class TraineeBusiness {
         if (CollectionUtil.isNotEmpty(classList)) {
             classList.parallelStream().forEach(p -> {
                 String redisKey = CacheNames.CLASS_ROOM + "_" + p.getId();
+                //清除已有的缓存数据
+                if (ObjectUtil.isNotEmpty(RedisUtils.getCacheObject(redisKey))) {
+                    RedisUtils.deleteObject(redisKey);
+                }
                 List<RemoteOrderVo> orderVos = this.selectTeamLockRoom(p.getId());
                 if (CollectionUtil.isNotEmpty(orderVos)) {
                     LinkedBlockingQueue<String> concurrentLinkedQueue = new LinkedBlockingQueue<>();
                     orderVos.forEach(k -> concurrentLinkedQueue.add(k.getRoomCode()));
+                    //重新设置锁房的缓存
                     RedisUtils.setCacheObject(redisKey, concurrentLinkedQueue);
                 }
             });
         }
         return R.ok();
     }
+    /**
+     * 获取学员对应的客人与团客信息
+     * @param bo 学员业务对象
+     * @param userOtherId 学员唯一标识
+     * @param deptOtherId 班级唯一标识
+     */
+    private void getGuestInfo(YcTraineeBo bo, String userOtherId, String deptOtherId) {
+        R<RemoteGuestVo> getGuestVo = kfGuestService.selectGuestByOtherId(userOtherId);
+        bo.setGuestId(getGuestVo.getData().getId());
+
+        RemoteTeamBo teamBo = new RemoteTeamBo().setOtherId(deptOtherId);
+        R<RemoteTeamVo> getTeamVo = kfTeamService.selectTeamByBo(teamBo);
+        bo.setTeamId(getTeamVo.getData().getId());
+    }
 
+    /**
+     * 设置学员的卡片信息
+     * @param traineeVo 学员数据视图
+     */
     private void setTraineeCardInfo(YcTraineeVo traineeVo) {
         List<PtCardVo> cardVos = cardService.queryList(new PtCardBo().setUserId(Long.valueOf(traineeVo.getUserId())));
         List<YcCardVo> ycCardVos = new ArrayList<>();