法规清单-关联平台件(处理项目名称)

This commit is contained in:
zhn
2023-10-18 11:23:00 +08:00
parent 16e6af6a1e
commit ebea60e23a
2 changed files with 49 additions and 1 deletions
@@ -0,0 +1,43 @@
package com.jero.modules.system.util;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.vo.DictModel;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @description
* @date 2023/10/18 10:59
* @auth zhn
*/
public class DictItemUtil {
public static String getDictItemText(String cut, String value, List<DictModel> dictModelAll) {
if (StringUtils.isBlank(value)) {
return "";
}
List<DictModel> dictModelList = new ArrayList<>();
for (String s : value.split(",")) {
List<DictModel> dictModelListTemp = dictModelAll.stream()
.filter(e -> s.equals(e.getValue())).collect(Collectors.toList());
dictModelList.addAll(dictModelListTemp);
}
String targetMarket = "";
if (dictModelList.size() != 0) {
StringBuilder sb = new StringBuilder();
for (DictModel dictModel : dictModelList) {
if (CutEnum.CN.getValue().equals(cut)) {
sb.append(dictModel.getText() + ",");
} else {
sb.append(dictModel.getTextEn() + ",");
}
}
if (com.jero.modules.system.util.StringUtils.isNotBlank(sb)) {
targetMarket = sb.substring(0, sb.length() - 1);
}
}
return targetMarket;
}
}