|
@@ -44,36 +44,6 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
|
|
|
@Override
|
|
@Override
|
|
|
public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception {
|
|
public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception {
|
|
|
try {
|
|
try {
|
|
|
- // 查询所有好友
|
|
|
|
|
-// QueryWrapper<LifeFansVo> wrapper = new QueryWrapper<>();
|
|
|
|
|
-// wrapper.groupBy("foll.phoneId");
|
|
|
|
|
-
|
|
|
|
|
-// if ("user".equals(receiverId.split("_")[0])) {
|
|
|
|
|
-// String myselfUserPhone = receiverId.split("_")[1];
|
|
|
|
|
-// blockerType = "2";
|
|
|
|
|
-// LifeUser myLifeUser = lifeUserService.getUserByPhone(myselfUserPhone);
|
|
|
|
|
-// blockerId = String.valueOf(myLifeUser.getId());
|
|
|
|
|
-// } else {
|
|
|
|
|
-// String myselfStorePhone = receiverId.split("_")[1];
|
|
|
|
|
-// blockerType = "1";
|
|
|
|
|
-// StoreUser myStoreUser = storeUserService.getUserByPhone(myselfStorePhone);
|
|
|
|
|
-// blockerId = String.valueOf(myStoreUser.getId());
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-// List<LifeFansVo> lifeFansList = lifeFansMapper.getMutualAttention(new Page<>(1, Integer.MAX_VALUE), receiverId, blockerType, blockerId, wrapper).getRecords();
|
|
|
|
|
-// List<String> friendsIds = lifeFansList.stream().map(LifeFansVo::getPhoneId).filter(item -> !item.equals(receiverId)).collect(Collectors.toList());
|
|
|
|
|
-// String friendsIdsStr = "'" + String.join("','", friendsIds) + "'";
|
|
|
|
|
-
|
|
|
|
|
-// wrapper = new QueryWrapper<>();
|
|
|
|
|
-// wrapper.eq("num", 1);
|
|
|
|
|
-// if (1 == friendType) {
|
|
|
|
|
-// // 当前用户的所有好友消息
|
|
|
|
|
-// wrapper.apply("(sender_id in (" + friendsIdsStr + ") or receiver_id in (" + friendsIdsStr + "))");
|
|
|
|
|
-// } else {
|
|
|
|
|
-// // 当前用户的所有未关注人消息
|
|
|
|
|
-// wrapper.apply("(sender_id not in (" + friendsIdsStr + ") and receiver_id not in (" + friendsIdsStr + "))");
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
String blockerType = "user".equals(Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType")) ? "2" : "1";
|
|
String blockerType = "user".equals(Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType")) ? "2" : "1";
|
|
|
String blockerId = JwtUtil.getCurrentUserInfo().getString("userId");
|
|
String blockerId = JwtUtil.getCurrentUserInfo().getString("userId");
|
|
|
QueryWrapper<LifeFansVo> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<LifeFansVo> wrapper = new QueryWrapper<>();
|
|
@@ -109,12 +79,8 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
|
|
|
")");
|
|
")");
|
|
|
}
|
|
}
|
|
|
wrapper.orderByDesc("message.created_time");
|
|
wrapper.orderByDesc("message.created_time");
|
|
|
-// IPage<LifeMessageVo> ipage = new Page<>(page, size);
|
|
|
|
|
List<LifeMessageVo> lifeMessagePageList = lifeMessageMapper.getLifeMessagePageByPhoneId(receiverId, wrapper);
|
|
List<LifeMessageVo> lifeMessagePageList = lifeMessageMapper.getLifeMessagePageByPhoneId(receiverId, wrapper);
|
|
|
if (!CollectionUtils.isEmpty(lifeMessagePageList)) {
|
|
if (!CollectionUtils.isEmpty(lifeMessagePageList)) {
|
|
|
- // 取出所有发送消息的用户
|
|
|
|
|
-// List<String> phoneIdList = lifeMessagePageList.stream().map(LifeMessageVo::getPhoneId).filter(item -> item.contains("_")).collect(Collectors.toList());
|
|
|
|
|
-
|
|
|
|
|
// 当前用户的所有关注
|
|
// 当前用户的所有关注
|
|
|
LambdaQueryWrapper<LifeFans> followWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<LifeFans> followWrapper = new LambdaQueryWrapper<>();
|
|
|
followWrapper.eq(LifeFans::getFansId, receiverId);
|
|
followWrapper.eq(LifeFans::getFansId, receiverId);
|
|
@@ -141,19 +107,7 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
|
|
|
notDisturbWrapper.eq("phone_id", receiverId);
|
|
notDisturbWrapper.eq("phone_id", receiverId);
|
|
|
List<String> notDisturbList = lifeMessageNotDisturbMapper.selectList(notDisturbWrapper).stream().map(LifeMessageNotDisturb::getNotDisturbId).collect(Collectors.toList());
|
|
List<String> notDisturbList = lifeMessageNotDisturbMapper.selectList(notDisturbWrapper).stream().map(LifeMessageNotDisturb::getNotDisturbId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
-// // 根据手机号查询发送人信息
|
|
|
|
|
-// List<String> storePhoneList = phoneIdList.stream().filter(item -> "store".equals(item.split("_")[0])).map(item -> item.split("_")[1]).collect(Collectors.toList());
|
|
|
|
|
-// List<String> userPhoneList = phoneIdList.stream().filter(item -> "user".equals(item.split("_")[0])).map(item -> item.split("_")[1]).collect(Collectors.toList());
|
|
|
|
|
-// String storePhones = "'" + String.join("','", storePhoneList) + "'";
|
|
|
|
|
-// String userPhones = "'" + String.join("','", userPhoneList) + "'";
|
|
|
|
|
-// List<LifeMessageVo> userList = lifeMessageMapper.getLifeUserAndStoreUserByPhone(storePhones, userPhones);
|
|
|
|
|
-
|
|
|
|
|
for (LifeMessageVo messageVo : lifeMessagePageList) {
|
|
for (LifeMessageVo messageVo : lifeMessagePageList) {
|
|
|
-// // 发送人信息
|
|
|
|
|
-// LifeMessageVo user = userList.stream().filter(item -> item.getPhoneId().equals(messageVo.getPhoneId())).findFirst().orElse(null);
|
|
|
|
|
-// messageVo.setUserName(null == user ? "" : user.getUserName());
|
|
|
|
|
-// messageVo.setUserImage(null == user ? "" : user.getUserImage());
|
|
|
|
|
-
|
|
|
|
|
// 免打扰
|
|
// 免打扰
|
|
|
if (notDisturbList.contains(messageVo.getPhoneId())) {
|
|
if (notDisturbList.contains(messageVo.getPhoneId())) {
|
|
|
messageVo.setIsNotDisturb("1");
|
|
messageVo.setIsNotDisturb("1");
|
|
@@ -219,7 +173,7 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
|
|
|
wrapper.apply("message.phoneId not in ( " +
|
|
wrapper.apply("message.phoneId not in ( " +
|
|
|
" select receiver_id " +
|
|
" select receiver_id " +
|
|
|
" from life_message " +
|
|
" from life_message " +
|
|
|
- " where sender_id = '" + receiverId + "'" +
|
|
|
|
|
|
|
+ " where sender_id = '" + receiverId + "' and delete_flag = 0 " +
|
|
|
" group by receiver_id " +
|
|
" group by receiver_id " +
|
|
|
")");
|
|
")");
|
|
|
wrapper.orderByDesc("message.created_time");
|
|
wrapper.orderByDesc("message.created_time");
|
|
@@ -325,7 +279,7 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- List<LifeMessageVo> lifeMessageVos = lifeMessageMapper.selectUserImageLists(receiverId, senderId);
|
|
|
|
|
|
|
+ List<LifeMessageVo> lifeMessageVos = lifeMessageMapper.getMessageListByReceiverId(receiverId, senderId);
|
|
|
for (LifeMessageVo lifeMessageVo : lifeMessageVos) {
|
|
for (LifeMessageVo lifeMessageVo : lifeMessageVos) {
|
|
|
if (lifeMessageVo.getReceiverId().equals(receiverId)) {
|
|
if (lifeMessageVo.getReceiverId().equals(receiverId)) {
|
|
|
if (null != lifeUser1) {
|
|
if (null != lifeUser1) {
|