认证-参数项导出中英文切换
This commit is contained in:
+23
-5
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.CommonAPI;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecgframework.dict.service.AutoPoiDictServiceI;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -31,7 +32,8 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
|
||||
|
||||
/**
|
||||
* 通过字典查询easypoi,所需字典文本
|
||||
*
|
||||
*
|
||||
* 特殊说明:英文文本对应dicCode格式:dicCode_en,且dicTable为空
|
||||
* @Author:scott
|
||||
* @since:2019-04-09
|
||||
* @return
|
||||
@@ -42,7 +44,11 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
|
||||
List<DictModel> dictList = null;
|
||||
// step.1 如果没有字典表则使用系统字典表
|
||||
if (oConvertUtils.isEmpty(dicTable)) {
|
||||
dictList = commonAPI.queryDictItemsByCode(dicCode);
|
||||
if("en".equals(dicCode.substring(dicCode.lastIndexOf("_")+1))) {
|
||||
dictList = commonAPI.queryDictItemsByCode(dicCode.substring(0, dicCode.lastIndexOf("_")));
|
||||
} else {
|
||||
dictList = commonAPI.queryDictItemsByCode(dicCode);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
dicText = oConvertUtils.getString(dicText, dicCode);
|
||||
@@ -51,9 +57,21 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
for (DictModel t : dictList) {
|
||||
if(t!=null){
|
||||
dictReplaces.add(t.getText() + "_" + t.getValue());
|
||||
if("en".equals(dicCode.substring(dicCode.lastIndexOf("_")+1))) { // 显示英文文本
|
||||
for (DictModel t : dictList) {
|
||||
if (t != null) {
|
||||
if(StringUtils.isBlank(t.getTextEn())){ // 字典值对应英文文本为空,则显示中文
|
||||
dictReplaces.add(t.getText() + "_" + t.getValue());
|
||||
} else {
|
||||
dictReplaces.add(t.getTextEn() + "_" + t.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { // 显示中文文本
|
||||
for (DictModel t : dictList) {
|
||||
if (t != null) {
|
||||
dictReplaces.add(t.getText() + "_" + t.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dictReplaces != null && dictReplaces.size() != 0) {
|
||||
|
||||
Reference in New Issue
Block a user