文档库--详情数据字典处理

This commit is contained in:
zhn
2022-02-23 11:54:50 +08:00
parent c1892e145f
commit 6b6d6fc362
@@ -203,7 +203,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} }
/** /**
* 详情,编辑数据查询 * 编辑数据查询
* *
* @param id * @param id
* @return * @return
@@ -225,16 +225,35 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
*/ */
@Override @Override
public List<Map<String, Object>> getInfoById(String id) { public List<Map<String, Object>> getInfoById(String id) {
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
//通过id查询数据
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
//区域管理 //区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(new OnlCgformArea()); List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(new OnlCgformArea());
//字段属性 //字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1"); List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
//通过id查询数据
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
//过滤出下拉选
List<OnlCgformField> onlCgformFieldList = fieldList.stream()
.filter(e -> FieldTypeEnum.LIST.getValue().equals(e.getFieldShowType())
|| FieldTypeEnum.LIST_MULTI.getValue().equals(e.getFieldShowType()))
.collect(Collectors.toList());
//下拉选字段
List<String> fieldPullList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
//数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//下拉单选和下拉多选数据字典处理
dataList.get(0).entrySet().forEach(entry->{
if(fieldPullList.contains(entry.getKey())){
//下拉选处理数据字典
dictItem(sysDictItems, entry, onlCgformFieldList);
}
});
if (fieldList.size() != 0) { if (fieldList.size() != 0) {
//过滤出表单字段(is_show_form-->表单是否显示0否 1是) //过滤出表单字段(is_show_form-->表单是否显示0否 1是)
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList());
@@ -549,7 +568,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//数据字典 //数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll(); List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
//下拉选处理数据字典 //下拉选处理数据字典
List records = infoPage.getRecords(); List records = infoPage.getRecords();
for (Object record : records) { for (Object record : records) {
@@ -579,6 +597,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String value = (String) entry.getValue(); String value = (String) entry.getValue();
//数据字典中文 //数据字典中文
List<String> dictItemsCh = new ArrayList<>(); List<String> dictItemsCh = new ArrayList<>();
if(StringUtils.isNotBlank(value)){
for (String itemValue : value.split(",")) { for (String itemValue : value.split(",")) {
//字段的数据字典 //字段的数据字典
List<SysDictItem> dictItemList = sysDictItems.stream() List<SysDictItem> dictItemList = sysDictItems.stream()
@@ -594,6 +613,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} }
} }
} }
}
entry.setValue(StringUtils.join(dictItemsCh, ",")); entry.setValue(StringUtils.join(dictItemsCh, ","));
} }
} }