mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.panzhihua.common.utlis;
 
import com.panzhihua.common.model.vos.community.ComMngPopulationCommunityTagsVo;
 
import java.util.List;
 
/**
 * @author lyq
 * 社区标签工具类
 */
public class LabelUtils {
 
    /**
     * 社区标签转换
     * @param communityTagsList 社区标签列表
     * @return  社区标签
     */
    public static String assembleLabel(List<ComMngPopulationCommunityTagsVo> communityTagsList){
        //创建用户拼接字符串
        StringBuilder sb = new StringBuilder();
        communityTagsList.forEach(tag -> {
            if(StringUtils.isNotEmpty(tag.getLabel())){
                sb.append(tag.getCommunityName());
                sb.append(":");
                sb.append(tag.getLabel());
                sb.append(";");
            }
        });
        String result = sb.toString();
        if(StringUtils.isNotEmpty(result)){
            result = result.substring(0,result.length() - 1);
        }
        return result;
    }
}