From b8c494d4c56e0af1a660f5c12a0a5d278f627b0f Mon Sep 17 00:00:00 2001 From: "zhaokaiyao@91isoft.com" <6922339zky> Date: Wed, 29 Dec 2021 15:55:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E5=86=85=E5=A4=96excel=E5=AF=BC?= =?UTF-8?q?=E5=87=BAcode=E8=BD=AC=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SarStandardsInfoServiceImpl.java | 97 ++++++++++--------- .../mybatis/mapper/sys/DicTypeEOMapper.xml | 5 + 2 files changed, 56 insertions(+), 46 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java index aab3ee7c..5a211419 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java @@ -714,12 +714,9 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl sarlist) throws Exception { + public void attrInfoShowExport(List sarlist,Map dicMap) throws Exception { + - List dicInfo = dicTypeEODao.getDicInfo("dic_type_code", "dic_type_name"); - Map dicMap = - dicInfo.stream() - .collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getDicTypeName,(value1, value2 )->value2)); for (SarStandardsInfo row : sarlist) { @@ -732,26 +729,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl 0 && InitStandAttrUtil.fileFieldList.contains(name)) { - value = entry.getValue().toString(); - if (StringUtils.isNotBlank(value)) { - List fileObj = attFileEOService.getMultiFileInfos(value); - entry.setValue(fileObj); - } - } else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) { - value = entry.getValue().toString(); - if ("GZZXX".equals(name)) { - value = sysInfoEOService.getGroupNamesByIds(value); - } else { - String selVal = InitStandAttrUtil.selectFieldMap.get(name); - if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal) || SelectionTypeEnum.USERLIST.getValue().equals(selVal) || SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) { - if (getAttrMap.get(name + "Name") != null) { - value = String.valueOf(getAttrMap.get(name + "Name")); + } +// else if (entry.getValue() != null && InitStandAttrUtil.fileFieldList != null && InitStandAttrUtil.fileFieldList.size() > 0 && InitStandAttrUtil.fileFieldList.contains(name)) { +// value = entry.getValue().toString(); +// if (StringUtils.isNotBlank(value)) { +// List fileObj = attFileEOService.getMultiFileInfos(value); +// entry.setValue(fileObj); +// } +// } + else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) { +// value = entry.getValue().toString(); +// String selVal = InitStandAttrUtil.selectFieldMap.get(name); +// if (SelectionTypeEnum.ORGLIST.getValue().equals(selVal) || SelectionTypeEnum.USERLIST.getValue().equals(selVal) || SelectionTypeEnum.ROLELIST.getValue().equals(selVal)) { +// if (getAttrMap.get(name + "Name") != null) { +// value = String.valueOf(getAttrMap.get(name + "Name")); +// } +// +// +// } else { + /** + *============================ 对getAttrMap的value赋值中文名称=============================== + */ + if(entry.getValue()!=null) { + StringBuilder builder = new StringBuilder(""); + for (String s : entry.getValue().toString().split(",")) { + if (dicMap.containsKey(s) && !"ZRBM".equals(name)){ + builder.append(dicMap.get(s)+" "); + } + + } + + + if (builder.toString().isEmpty()){ + getAttrMap.put(name, entry.getValue().toString()); + }else { + getAttrMap.put(name, builder.toString()); + } } - } else { - List valArr = Arrays.asList(value.split(",")); - value = dicTypeEODao.getDicNamesByCodes(valArr); - } - } - entry.setValue(value); + /** + *============================ 对getAttrMap的value赋值中文名称=============================== + */ +// } + +// entry.setValue(value); } } getAttrMap.put("SVPPSTips", svppsTip); @@ -1705,7 +1704,13 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl getList = dao.getSarStandardsExportInfo(page); - attrInfoShowExport(getList); + + //查询字典表,形成Hash映射提升速度 + List dicInfo = dicTypeEODao.getDicInfo("dic_type_code", "dic_type_name"); + Map dicMap = dicInfo.stream() + .filter(item-> !item.getDicTypeCode().isEmpty()) + .collect(Collectors.toMap(DicTypeEO::getDicTypeCode,DicTypeEO::getDicTypeName,(value1, value2 )->value2)); + attrInfoShowExport(getList,dicMap); return getList; } diff --git a/adc-da-sys/src/main/resources/mybatis/mapper/sys/DicTypeEOMapper.xml b/adc-da-sys/src/main/resources/mybatis/mapper/sys/DicTypeEOMapper.xml index 8cc364d0..af630bc2 100644 --- a/adc-da-sys/src/main/resources/mybatis/mapper/sys/DicTypeEOMapper.xml +++ b/adc-da-sys/src/main/resources/mybatis/mapper/sys/DicTypeEOMapper.xml @@ -602,6 +602,11 @@ FROM TS_DICTYPE + + + ${item} is not NULL + +