From fcd8a514bb29527e6b21be0e7ba2687882424dd6 Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Tue, 10 May 2022 17:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=BA=93--=E8=AF=A6=E6=83=85?= =?UTF-8?q?(=E6=A0=87=E5=87=86=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BussDocumentLibraryEOServiceImpl.java | 488 +++++++++++++----- 1 file changed, 356 insertions(+), 132 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index 64ab6ab80..2e87c9296 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -726,6 +726,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl> getInfoById(String id, String cut) { + //字段属性 + List fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue()); + //标准选择字段 + List standardOnlCgformFieldList = fieldList.stream() + .filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList()); + List standFieldList = standardOnlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); //通过id查询数据 List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); @@ -738,129 +744,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); - //原始对应标准,代替标准,被代替标准(原始数据存的是iD) - String correspondingStandardId = ""; - String replaceStandardId = "";//代替标准 - if (!dataList.isEmpty()) { - correspondingStandardId = (String) dataList.get(0).get("corresponding_standard");//对应标准 - replaceStandardId = (String) dataList.get(0).get("replace_standard");//代替标准 - } - - //被代替标准 - List replacedStandardIdList = new ArrayList<>();//代替标准 - - //对应标准,代替标准,被代替标准对应的编码 - List correspondingStandardNameList = new ArrayList<>();//对应标准编码 - List replaceStandardNameList = new ArrayList<>();//代替标准编码 - List replacedStandardNameList = new ArrayList<>();//被代替标准编码 - - List> listCorrespondingStandard = new ArrayList<>(); - List> listReplaceStandard = new ArrayList<>(); - List> listReplacedStandard = new ArrayList<>(); - - - //处理被代替标准和对应标准 - for (Map map : mapList) { - Map stringObjectMap = new HashMap<>(); - //对应标准处理 - if (StringUtils.isNotBlank(correspondingStandardId) && correspondingStandardId.contains((String) map.get("id"))) { - for (String s : correspondingStandardId.split(",")) { - Map mapTemp = new HashMap<>(); - if (s.equals((String) map.get("id"))) { - correspondingStandardNameList.add((String) map.get("serial_number")); - mapTemp.put("title", (String) map.get("serial_number")); - mapTemp.put("id", (String) map.get("id")); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listCorrespondingStandard.add(mapTemp); - } - } else { - boolean flag = isId(s); - if (!flag && !correspondingStandardNameList.contains(s)) { - correspondingStandardNameList.add(s); - mapTemp.put("title", s); - mapTemp.put("id", ""); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listCorrespondingStandard.add(mapTemp); - } - } - } - } - } else { - if (StringUtils.isNotBlank(correspondingStandardId)) { - for (String s : correspondingStandardId.split(",")) { - Map mapTemp = new HashMap<>(); - boolean flag = isId(s); - if (!flag && !correspondingStandardNameList.contains(s)) { - correspondingStandardNameList.add(s); - mapTemp.put("title", s); - mapTemp.put("id", ""); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listCorrespondingStandard.add(mapTemp); - } - } - } - } - - } - //代替标准 - if (StringUtils.isNotBlank(replaceStandardId) && replaceStandardId.contains((String) map.get("id"))) { - for (String s : replaceStandardId.split(",")) { - Map mapTemp = new HashMap<>(); - if (s.equals((String) map.get("id"))) { - replaceStandardNameList.add((String) map.get("serial_number")); - mapTemp.put("title", (String) map.get("serial_number")); - mapTemp.put("id", (String) map.get("id")); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listReplaceStandard.add(mapTemp); - } - } else { - boolean flag = isId(s); - if (!flag && !replaceStandardNameList.contains(s)) { - replaceStandardNameList.add(s); - mapTemp.put("title", s); - mapTemp.put("id", ""); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listReplaceStandard.add(mapTemp); - } - } - } - } - } else { - if (StringUtils.isNotBlank(replaceStandardId)) { - for (String s : replaceStandardId.split(",")) { - Map mapTemp = new HashMap<>(); - boolean flag = isId(s); - if (!flag && !replaceStandardNameList.contains(s)) { - replaceStandardNameList.add(s); - mapTemp.put("title", s); - mapTemp.put("id", ""); - if (ObjectUtils.isNotEmpty(mapTemp)) { - listReplaceStandard.add(mapTemp); - } - } - } - } - } - //被代替标准 - String replaceStandard = (String) map.get("replace_standard"); - if (StringUtils.isNotBlank(replaceStandard) && replaceStandard.contains(id)) { - replacedStandardIdList.add((String) map.get("id")); - String serialNumber = (String) map.get("serial_number"); - replacedStandardNameList.add(serialNumber); - stringObjectMap.put("title", (String) map.get("serial_number")); - stringObjectMap.put("id", (String) map.get("id")); - if (ObjectUtils.isNotEmpty(stringObjectMap)) { - listReplacedStandard.add(stringObjectMap); - } - } - } - //区域管理 OnlCgformArea onlCgformArea = new OnlCgformArea(); onlCgformArea.setIsModel(ModuleEnum.DOCUMENT_LIBRARY.getValue()); List areaList = onlCgformAreaServiceImpl.queryList(onlCgformArea); - //字段属性 - List fieldList = onlCgformFieldService.getFieldList("1"); //过滤出下拉选 List onlCgformFieldList = fieldList.stream() @@ -1005,22 +892,34 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl standardNameList = new ArrayList<>();//对应标准编码 + List> listStandard = new ArrayList<>(); String finalValue = value; dataList.get(0).entrySet().forEach(entry -> { if (onlCgformField.getDbFieldName().equals(entry.getKey())) { - if (onlCgformField.getDbFieldName().equals("replace_standard")) { - //代替标准 - map.put("value", StringUtils.join(replaceStandardNameList, ",")); - map.put("list", listReplaceStandard); - } else if (onlCgformField.getDbFieldName().equals("replaced_standard")) { - //被代替标准 - map.put("value", StringUtils.join(replacedStandardNameList, ",")); - map.put("list", listReplacedStandard); - } else if (onlCgformField.getDbFieldName().equals("corresponding_standard")) { - //对应标准 - map.put("value", StringUtils.join(correspondingStandardNameList, ",")); - map.put("list", listCorrespondingStandard); - } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { + //标准类型字段处理 + if(standFieldList.contains(entry.getKey())){ + if(ObjectUtils.isNotEmpty(entry.getValue())){ + for (Map map1 : mapList) { + //对应标准处理 + if (ObjectUtils.isNotEmpty(entry.getValue())) { + for (String s : entry.getValue().toString().split(",")) { + Map mapTemp1 = new HashMap<>(); + if (s.equals((String) map1.get("serial_number"))) { + standardNameList.add((String) map1.get("serial_number")); + mapTemp1.put("title", (String) map1.get("serial_number")); + mapTemp1.put("id", (String) map1.get("id")); + if (ObjectUtils.isNotEmpty(mapTemp1)) { + listStandard.add(mapTemp1); + } + } + } + } + } + map.put("value", entry.getValue().toString()); + map.put("list", listStandard); + } + }else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { map.put("value", finalValue); } else { map.put("value", entry.getValue()); @@ -1050,6 +949,331 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl> getInfoById(String id, String cut) { +// //通过id查询数据 +// List> dataList = bussDocumentLibraryEOMapper.selectMapsAll(id); +// +// List> result = new ArrayList<>(); // 要返回的结果 +// if (dataList.isEmpty()){ +// // 取不到数据,直接返回空结果 +// return result; +// } +// +// //查询所有 +// List> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null); +// +// //原始对应标准,代替标准,被代替标准(原始数据存的是iD) +// String correspondingStandardId = ""; +// String replaceStandardId = "";//代替标准 +// if (!dataList.isEmpty()) { +// correspondingStandardId = (String) dataList.get(0).get("corresponding_standard");//对应标准 +// replaceStandardId = (String) dataList.get(0).get("replace_standard");//代替标准 +// } +// +// //被代替标准 +// List replacedStandardIdList = new ArrayList<>();//代替标准 +// +// //对应标准,代替标准,被代替标准对应的编码 +// List correspondingStandardNameList = new ArrayList<>();//对应标准编码 +// List replaceStandardNameList = new ArrayList<>();//代替标准编码 +// List replacedStandardNameList = new ArrayList<>();//被代替标准编码 +// +// List> listCorrespondingStandard = new ArrayList<>(); +// List> listReplaceStandard = new ArrayList<>(); +// List> listReplacedStandard = new ArrayList<>(); +// +// +// //处理被代替标准和对应标准 +// for (Map map : mapList) { +// Map stringObjectMap = new HashMap<>(); +// //对应标准处理 +// if (StringUtils.isNotBlank(correspondingStandardId) && correspondingStandardId.contains((String) map.get("id"))) { +// for (String s : correspondingStandardId.split(",")) { +// Map mapTemp = new HashMap<>(); +// if (s.equals((String) map.get("id"))) { +// correspondingStandardNameList.add((String) map.get("serial_number")); +// mapTemp.put("title", (String) map.get("serial_number")); +// mapTemp.put("id", (String) map.get("id")); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listCorrespondingStandard.add(mapTemp); +// } +// } else { +// boolean flag = isId(s); +// if (!flag && !correspondingStandardNameList.contains(s)) { +// correspondingStandardNameList.add(s); +// mapTemp.put("title", s); +// mapTemp.put("id", ""); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listCorrespondingStandard.add(mapTemp); +// } +// } +// } +// } +// } else { +// if (StringUtils.isNotBlank(correspondingStandardId)) { +// for (String s : correspondingStandardId.split(",")) { +// Map mapTemp = new HashMap<>(); +// boolean flag = isId(s); +// if (!flag && !correspondingStandardNameList.contains(s)) { +// correspondingStandardNameList.add(s); +// mapTemp.put("title", s); +// mapTemp.put("id", ""); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listCorrespondingStandard.add(mapTemp); +// } +// } +// } +// } +// +// } +// //代替标准 +// if (StringUtils.isNotBlank(replaceStandardId) && replaceStandardId.contains((String) map.get("id"))) { +// for (String s : replaceStandardId.split(",")) { +// Map mapTemp = new HashMap<>(); +// if (s.equals((String) map.get("id"))) { +// replaceStandardNameList.add((String) map.get("serial_number")); +// mapTemp.put("title", (String) map.get("serial_number")); +// mapTemp.put("id", (String) map.get("id")); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listReplaceStandard.add(mapTemp); +// } +// } else { +// boolean flag = isId(s); +// if (!flag && !replaceStandardNameList.contains(s)) { +// replaceStandardNameList.add(s); +// mapTemp.put("title", s); +// mapTemp.put("id", ""); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listReplaceStandard.add(mapTemp); +// } +// } +// } +// } +// } else { +// if (StringUtils.isNotBlank(replaceStandardId)) { +// for (String s : replaceStandardId.split(",")) { +// Map mapTemp = new HashMap<>(); +// boolean flag = isId(s); +// if (!flag && !replaceStandardNameList.contains(s)) { +// replaceStandardNameList.add(s); +// mapTemp.put("title", s); +// mapTemp.put("id", ""); +// if (ObjectUtils.isNotEmpty(mapTemp)) { +// listReplaceStandard.add(mapTemp); +// } +// } +// } +// } +// } +// //被代替标准 +// String replaceStandard = (String) map.get("replace_standard"); +// if (StringUtils.isNotBlank(replaceStandard) && replaceStandard.contains(id)) { +// replacedStandardIdList.add((String) map.get("id")); +// String serialNumber = (String) map.get("serial_number"); +// replacedStandardNameList.add(serialNumber); +// stringObjectMap.put("title", (String) map.get("serial_number")); +// stringObjectMap.put("id", (String) map.get("id")); +// if (ObjectUtils.isNotEmpty(stringObjectMap)) { +// listReplacedStandard.add(stringObjectMap); +// } +// } +// } +// +// //区域管理 +// OnlCgformArea onlCgformArea = new OnlCgformArea(); +// onlCgformArea.setIsModel(ModuleEnum.DOCUMENT_LIBRARY.getValue()); +// List areaList = onlCgformAreaServiceImpl.queryList(onlCgformArea); +// //字段属性 +// List fieldList = onlCgformFieldService.getFieldList("1"); +// +// //过滤出下拉选 +// List onlCgformFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.PULL_SINGLE.getValue().equals(e.getFieldShowType()) +// || FieldTypeEnum.PULL_MORE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// //过滤出树形字段 +// List treeFieldList = fieldList.stream() +// .filter(e -> FieldTypeEnum.TREE.getValue().equals(e.getFieldShowType())) +// .collect(Collectors.toList()); +// +// //下拉选字段 +// List fieldPullList = onlCgformFieldList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList()); +// +// //数据字典 +// List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); +// +// //树形数据字典 +// List categoryList = sysCategoryService.list(); +// //处理树形数据字典 +// dataList.get(0).entrySet().forEach(entry -> { +// //下拉选处理数据字典 +// treeDictItem(categoryList, entry, treeFieldList, cut,null); +// }); +// +// //下拉单选和下拉多选数据字典处理 +// List finalFieldList = fieldList; +// dataList.get(0).entrySet().forEach(entry -> { +// if (fieldPullList.contains(entry.getKey())) { +// //下拉选处理数据字典 +// dictItem(sysDictItems, entry, cut, finalFieldList,null); +// } +// }); +// +// if (fieldList.size() != 0) { +// //过滤出表单字段(is_show_form-->表单是否显示0否 1是) +// fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList()); +// } +// +// for (OnlCgformArea onlCgformAreaTemp : areaList) { +// String areaName = ""; +// if (CutEnum.CN.getValue().equals(cut)) { +// areaName = onlCgformAreaTemp.getShowArea(); +// } else { +// areaName = onlCgformAreaTemp.getEnName(); +// } +// Map mapTemp = new HashMap<>(); +// List> resultTemp = new ArrayList<>(); +// List fieldListTemp = fieldList.stream().filter(e -> onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList()); +// for (OnlCgformField onlCgformField : fieldListTemp) { +// //字段 +// String dbFieldName = onlCgformField.getDbFieldName(); +// //字段类型 +// String fieldShowType = onlCgformField.getFieldShowType(); +// String value = ""; +// if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldShowType)) { +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); +// if (ObjectUtils.isNotEmpty(dataList.get(0).get(dbFieldName))) { +// value = sdf.format(dataList.get(0).get(dbFieldName)); +// } +// } else { +// value = String.valueOf(dataList.get(0).get(dbFieldName)); +// if("null".equals(value)){ +// value = ""; +// } +// } +// Map map = new HashMap<>(); +// //处理文件 +// if (FieldTypeEnum.FILE.getValue().equals(fieldShowType)) { +// //处理文本信息和关联信息区域之外的区域中文件类型字段返归结果格式 +// if(!"文本信息".equals(onlCgformAreaTemp.getShowArea()) && !"关联信息".equals(onlCgformAreaTemp.getShowArea())){ +// List fileInfos = iOSSFileService.getFileInfosByConnectId(value); +// List fileIdList = fileInfos.stream().map(OSSFile::getId).collect(Collectors.toList()); +// Map mapNew = new HashMap<>(); +// mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); +// mapNew.put("value",fileIdList); +// resultTemp.add(mapNew); +// }else{ +// if (StringUtils.isNotBlank(value)) { +// List fileInfos = iOSSFileService.getFileInfosByConnectId(value); +// //多文件处理 +// if (fileInfos.size() > 1) { +// if (fileInfos.size() != 0) { +// int i = 0; +// for (OSSFile fileInfo : fileInfos) { +// if (i == 0) { +// Map mapNew = new HashMap<>(); +// mapNew.put("value", fileInfo); +// mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); +// mapNew.put("count", fileInfos.size()); +// // 添加标准分解单跳转 +// List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfo.getId()); +// if (CollectionUtil.isNotEmpty(infoEOList)) { +// mapNew.put("splitFlag", 1); +// mapNew.put("splitInfoId", infoEOList.get(0).getId()); +// } else{ +// mapNew.put("splitFlag", 0); +// } +// +// resultTemp.add(mapNew); +// i++; +// } else { +// Map mapNew = new HashMap<>(); +// mapNew.put("value", fileInfo); +// mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); +// // 添加标准分解单跳转 +// List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfo.getId()); +// if (CollectionUtil.isNotEmpty(infoEOList)) { +// mapNew.put("splitFlag", 1); +// mapNew.put("splitInfoId", infoEOList.get(0).getId()); +// } else{ +// mapNew.put("splitFlag", 0); +// } +// resultTemp.add(mapNew); +// } +// } +// } +// } else if (fileInfos.size() == 1) { +// //单个文件处理 +// Map mapNew = new HashMap<>(); +// mapNew.put("count", fileInfos.size()); +// mapNew.put("value", fileInfos.get(0)); +// mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); +// // 添加标准分解单跳转 +// List infoEOList = sarFileSplitInfoService.queryByFileId(fileInfos.get(0).getId()); +// if (CollectionUtil.isNotEmpty(infoEOList)) { +// mapNew.put("splitFlag", 1); +// mapNew.put("splitInfoId", infoEOList.get(0).getId()); +// } else{ +// mapNew.put("splitFlag", 0); +// } +// resultTemp.add(mapNew); +// } +// } else { +// Map mapNew = new HashMap<>(); +// mapNew.put("value", ""); +// mapPut(cut, mapNew, "field_show_type", onlCgformField.getFieldShowType(), "dict_field", onlCgformField.getDictField(), "db_field_name", onlCgformField.getDbFieldName(), "db_field_txt", onlCgformField.getDbFieldTxt(), "db_field_en_name", onlCgformField.getDbFieldEnName(), "area", areaName, null); +// resultTemp.add(mapNew); +// } +// } +// } else { +// //处理字段类型为文件之外的字段 +// if (dataList.size() != 0) { +// String finalValue = value; +// dataList.get(0).entrySet().forEach(entry -> { +// if (onlCgformField.getDbFieldName().equals(entry.getKey())) { +// if (onlCgformField.getDbFieldName().equals("replace_standard")) { +// //代替标准 +// map.put("value", StringUtils.join(replaceStandardNameList, ",")); +// map.put("list", listReplaceStandard); +// } else if (onlCgformField.getDbFieldName().equals("replaced_standard")) { +// //被代替标准 +// map.put("value", StringUtils.join(replacedStandardNameList, ",")); +// map.put("list", listReplacedStandard); +// } else if (onlCgformField.getDbFieldName().equals("corresponding_standard")) { +// //对应标准 +// map.put("value", StringUtils.join(correspondingStandardNameList, ",")); +// map.put("list", listCorrespondingStandard); +// } else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType())) { +// map.put("value", finalValue); +// } else { +// map.put("value", entry.getValue()); +// } +// } +// }); +// } +// mapPut(cut, map, "field_show_type", +// onlCgformField.getFieldShowType(), "dict_field", +// onlCgformField.getDictField(), "db_field_name", +// onlCgformField.getDbFieldName(), "db_field_txt", +// onlCgformField.getDbFieldTxt(), "db_field_en_name", +// onlCgformField.getDbFieldEnName(), "area", areaName, null); +// } +// if (map.size() != 0) { +// resultTemp.add(map); +// } +// } +// if (CutEnum.CN.getValue().equals(cut)) { +// areaName = onlCgformAreaTemp.getShowArea(); +// mapTemp.put(areaName, resultTemp); +// } else { +// areaName = onlCgformAreaTemp.getEnName(); +// mapTemp.put(areaName, resultTemp); +// } +// result.add(mapTemp); +// } +// return result; +// } private void mapPut(String cut, Map map, String field_show_type, String fieldShowType2, String dict_field, String dictField,