|
@@ -17,9 +17,7 @@ import shop.alien.mapper.LifeMessageMapper;
|
|
|
import shop.alien.mapper.LifeNoticeMapper;
|
|
import shop.alien.mapper.LifeNoticeMapper;
|
|
|
import shop.alien.store.service.LifeNoticeService;
|
|
import shop.alien.store.service.LifeNoticeService;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Comparator;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -42,17 +40,23 @@ public class LifeNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNot
|
|
|
// IPage<LifeNotice> lifeNoticeList = lifeNoticeMapper.selectPage(ipage, queryWrapper);
|
|
// IPage<LifeNotice> lifeNoticeList = lifeNoticeMapper.selectPage(ipage, queryWrapper);
|
|
|
|
|
|
|
|
List<String> senderIdList = new ArrayList<>();
|
|
List<String> senderIdList = new ArrayList<>();
|
|
|
|
|
+ Map<String, List<String>> collect = new HashMap<>();
|
|
|
if (CollectionUtil.isNotEmpty(lifeNoticeList)) {
|
|
if (CollectionUtil.isNotEmpty(lifeNoticeList)) {
|
|
|
- senderIdList = lifeNoticeList.stream()
|
|
|
|
|
|
|
+ collect = lifeNoticeList.stream()
|
|
|
.map(LifeNotice::getSenderId)
|
|
.map(LifeNotice::getSenderId)
|
|
|
.filter(item -> item != null && !"system".equals(item) && item.contains("_"))
|
|
.filter(item -> item != null && !"system".equals(item) && item.contains("_"))
|
|
|
- .map(item -> item.split("_")[1])
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
|
|
+ item -> item.split("_")[0], // 按原始senderId的第一部分分组
|
|
|
|
|
+ Collectors.mapping(
|
|
|
|
|
+ item -> item.split("_")[1], // 提取每个分组中的第二部分
|
|
|
|
|
+ Collectors.toList()
|
|
|
|
|
+ )));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- String senderIds = "'" + String.join("','", senderIdList) + "'";
|
|
|
|
|
- List<LifeMessageVo> userList = lifeMessageMapper.getLifeUserAndStoreUserByPhone(senderIds, "''");
|
|
|
|
|
|
|
+ String storePhones = collect.containsKey("store")?"'" + String.join("','", collect.get("store")) + "'":"''";
|
|
|
|
|
+ String userPhones = collect.containsKey("user")?"'" + String.join("','", collect.get("user")) + "'":"''";
|
|
|
|
|
+ List<LifeMessageVo> userList = lifeMessageMapper.getLifeUserAndStoreUserByPhone(storePhones, userPhones);
|
|
|
|
|
|
|
|
List<LifeNoticeVo> noticeVoList = new ArrayList<>();
|
|
List<LifeNoticeVo> noticeVoList = new ArrayList<>();
|
|
|
if (CollectionUtil.isNotEmpty(lifeNoticeList)) {
|
|
if (CollectionUtil.isNotEmpty(lifeNoticeList)) {
|