Authored by liangyi.chen@yoho.cn

fix

... ... @@ -2233,7 +2233,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
public List<GrassArticleBlock> handleContentWithAt(List<GrassArticleBlock> blockList){
List<GrassArticleBlock> textBlockList = blockList.stream().filter(articleBlock -> articleBlock.getTemplateKey().equals("text")).collect(Collectors.toList());
List<Integer> uids = Lists.newArrayList();
if(CollectionUtils.isEmpty(blockList)){
if(CollectionUtils.isEmpty(textBlockList)){
return blockList;
}
Pattern p = Pattern.compile("@[0-9]+#");
... ... @@ -2252,17 +2252,20 @@ public class GrassArticleServiceImpl implements IGrassArticleService {
userInfoMap.put(userInfoRspBO.getUid(), userInfoRspBO);
});
blockList.forEach(grassArticleBlock -> {
String content = grassArticleBlock.getContentData();
Matcher m = p.matcher(content);
while(m.find()){
String uidStr = m.group();
Integer uid = Integer.valueOf(uidStr.replaceAll("@","").replaceAll("#",""));
UserInfoRspBO userInfo = userInfoMap.get(uid);
if(userInfo != null){
content = content.replace(uidStr, "@"+userInfo.getNickName());
if(grassArticleBlock.getTemplateKey().equals("text")){
String content = grassArticleBlock.getContentData();
Matcher m = p.matcher(content);
while(m.find()){
String uidStr = m.group();
Integer uid = Integer.valueOf(uidStr.replaceAll("@","").replaceAll("#",""));
UserInfoRspBO userInfo = userInfoMap.get(uid);
if(userInfo != null){
content = content.replace(uidStr, "@"+userInfo.getNickName());
}
}
grassArticleBlock.setContentData(content);
}
grassArticleBlock.setContentData(content);
});
}
... ...