hurixing 6 dagar sedan
förälder
incheckning
99b4da5e72

+ 15 - 7
hcp-core/src/main/java/com/yingyangfly/core/recommend/RecommendFacade.java

@@ -394,19 +394,23 @@ public class RecommendFacade {
      */
     public List<Game> recommendationA(AppUser appUser){
         String tags = appUser.getTags();
+        // 用户认知障碍 标签
+        List<String> tagList = new ArrayList<>();
         if (ObjectUtils.isNull(tags)){
-            return null;
+            List<SysDictData> sysDictDataList = sysDictDataService.selectByDictType("game_type", "0");
+            tagList = sysDictDataList.stream().map(SysDictData::getDictValue).collect(Collectors.toList());
+        }else {
+            tagList = Arrays.stream(tags.split(",")).collect(Collectors.toList());
         }
         List<Game> gameList = new ArrayList<>();
-        // 用户认知障碍 标签
-        List<String> tagLsis = Arrays.stream(tags.split(",")).collect(Collectors.toList());
+
         // 获取游戏难度
 //        String difficultyLevel = difficultyLevel(appUser);
         // 获取游戏
-        for (String tag : tagLsis) {
+        for (String tag : tagList) {
             LambdaQueryWrapper<Game> gameLambdaQueryWrapper = new LambdaQueryWrapper<>();
             gameLambdaQueryWrapper.eq(Game::getGameType,tag);
-//            gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
+            gameLambdaQueryWrapper.eq(Game::getStatus,0);
             List<Game> list = gameService.list(gameLambdaQueryWrapper);
             // 大于等于4时去掉上次推荐的游戏
             if (list.size() >= 4){
@@ -451,17 +455,21 @@ public class RecommendFacade {
      */
     public List<Game> recommendationB(AppUser appUser) {
         String tags = appUser.getTags();
+        List<String> tagList = new ArrayList<>();
         if (ObjectUtils.isNull(tags)){
-            return null;
+            List<SysDictData> sysDictDataList = sysDictDataService.selectByDictType("game_type", "0");
+            tagList = sysDictDataList.stream().map(SysDictData::getDictValue).collect(Collectors.toList());
+        }else {
+            tagList = Arrays.stream(tags.split(",")).collect(Collectors.toList());
         }
         List<Game> gameList = new ArrayList<>();
-        List<String> tagList = Arrays.stream(tags.split(",")).collect(Collectors.toList());
         // 获取游戏难度
 //        String difficultyLevel = difficultyLevel(appUser);
 
         // 获取所以游戏 并按认知域进行划分
         LambdaQueryWrapper<Game> gameLambdaQueryWrapper = new LambdaQueryWrapper<>();
 //        gameLambdaQueryWrapper.eq(Game::getGameDifficulty,difficultyLevel);
+        gameLambdaQueryWrapper.eq(Game::getStatus,0);
         List<Game> games = gameService.list(gameLambdaQueryWrapper);
         Map<String, List<Game>> typeToGameMap = games.stream().collect(Collectors.groupingBy(Game::getGameType));
 

+ 0 - 14
hcp-core/src/main/java/com/yingyangfly/core/service/impl/AppUserService.java

@@ -743,14 +743,6 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         if (appUser == null) {
             return ResultResponse.fail("患者不存在");
         }
-        if ("app".equals(appType)){
-            if (ObjectUtils.isNull(appUser.getOrderEndTime())){
-                return ResultResponse.success(false);
-            }
-            if (LocalDate.parse(appUser.getOrderEndTime()).isBefore(LocalDate.now())){
-                return ResultResponse.success(false);
-            }
-        }
         Random rand = new Random();
         int randomNumber = rand.nextInt(1000000);
         String random = "";
@@ -791,12 +783,6 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         if (appUser == null) {
             return ResultResponse.fail("患者不存在");
         }
-        if (ObjectUtils.isNull(appUser.getOrderEndTime())){
-            return ResultResponse.success(false);
-        }
-        if (LocalDate.parse(appUser.getOrderEndTime()).isBefore(LocalDate.now())){
-            return ResultResponse.success(false);
-        }
         Random rand = new Random();
         int randomNumber = rand.nextInt(1000000);
         String random = "";