Ver código fonte

会员转移列表逻辑调整

wangxy 1 dia atrás
pai
commit
6a8e8b1c30

+ 13 - 12
fs-service/src/main/java/com/fs/his/service/impl/FsUserServiceImpl.java

@@ -717,17 +717,19 @@ public class FsUserServiceImpl implements IFsUserService {
         List<UserProjectPair> pairs = fsUserPageListVOS.stream()
                 .map(user -> new UserProjectPair(user.getUserId(), user.getProjectId()))
                 .collect(Collectors.toList());
-        List<Map<String, Object>> mapList = fsUserMapper.selectLastWatchTimeByUserAndProject(pairs);
         Map<Object, Date> watchTimeMap = new HashMap<>();
-        if (!CollectionUtils.isEmpty(mapList)) {
-            watchTimeMap = mapList.stream()
-                    .collect(HashMap::new,
-                            (map, item) -> map.put(
-                                    item.get("userProjectKey"),
-                                    (Date) item.get("lastWatchTime")
-                            ),
-                            HashMap::putAll
-                    );
+        if(CollectionUtils.isNotEmpty(pairs)){
+            List<Map<String, Object>> mapList = fsUserMapper.selectLastWatchTimeByUserAndProject(pairs);
+            if (!CollectionUtils.isEmpty(mapList)) {
+                watchTimeMap = mapList.stream()
+                        .collect(HashMap::new,
+                                (map, item) -> map.put(
+                                        item.get("userProjectKey"),
+                                        (Date) item.get("lastWatchTime")
+                                ),
+                                HashMap::putAll
+                        );
+            }
         }
         for (FsUserPageListVO item : fsUserPageListVOS) {
             if (item.getCompanyUserId() != null) {
@@ -757,8 +759,7 @@ public class FsUserServiceImpl implements IFsUserService {
 //                    item.setCourseCountStatus(byUserId.getStatus());
                     item.setStopWatchDays(byUserId.getStopWatchDays());
                     item.setCompleteWatchDate(byUserId.getCompleteWatchDate());
-
-                    item.setLastWatchDate(watchTimeMap.get(item.getUserId() + "_" + item.getProjectId()));
+                    item.setLastWatchDate(watchTimeMap.getOrDefault(item.getUserId() + "_" + item.getProjectId(),null));
                 }
                 FsUserLastCount fsUserCourseCount = countMap.get(item.getUserId());
                 if (fsUserCourseCount != null) {