Explorar el Código

fix:
未读消息数量不准确bug

18339543638 hace 2 años
padre
commit
f52be5265d

+ 1 - 1
nb-admin/src/main/resources/application.yml

@@ -7,7 +7,7 @@ spring:
   application:
     name: nb
   profiles:
-    active: dev
+    active: prod
   jackson:
     time-zone: GMT+8
 

+ 6 - 2
nb-im/src/main/java/com/nb/im/controller/ImRoomController.java

@@ -91,7 +91,11 @@ public class ImRoomController implements BaseSaveController<ImRoomEntity,String>
                 .eq(ImRoomEntity::getDoctorId, source.getDoctorId())
                 .eq(ImRoomEntity::getPatientId, source.getPatientId())
                 .in(ImRoomEntity::getStatus,ImStatusEnum.WAITING,ImStatusEnum.SUCCESS)
-                .gt(ImRoomEntity::getCreateTime,System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
+                .nested(r->
+                    r .gt(ImRoomEntity::getCreateTime,System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
+                            .or()
+                            .gt(ImRoomEntity::getSuccessTime,System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))
+                )
                 .orderByDesc(ImRoomEntity::getCreateTime)
                 .last("limit 1"));
         if(chatRoom==null&&source.isAutoCreate()){
@@ -120,7 +124,7 @@ public class ImRoomController implements BaseSaveController<ImRoomEntity,String>
         result.parallelStream().forEach(room->
                 room.setUnreadCount( roomOperatorManager.getRoomOperator(room)
                         .unReadCount(userId)
-        ));
+                ));
         return R.success(result);
     }
 

+ 2 - 1
nb-im/src/main/resources/mapper/im/ImRoomMapper.xml

@@ -90,7 +90,8 @@
         </if>
         <where>
             <if test="query.successTime != null">
-                and r.success_time &gt; #{query.successTime}
+                and (r.success_time &gt; #{query.successTime}
+                or r.create_time &gt; #{query.successTime})
             </if>
         </where>
         order by last_msg_time desc