From a6caecb9afdf0804fe7398cce4edb1e50f2ac5bd Mon Sep 17 00:00:00 2001 From: caihaohan Date: Wed, 27 Sep 2023 09:48:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B8=A6=E6=96=87=E4=BB=B6=E5=AF=BC?= =?UTF-8?q?=E5=87=BA-=E6=96=87=E4=BB=B6=E5=AD=97=E6=AE=B5=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=94=99=E8=AF=AFBug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/impl/LawsCommonServiceImpl.java | 12 +++++++++--- .../service/impl/LawsStandardFileServiceImpl.java | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index 33e46434..57159293 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -204,7 +204,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { IPage> infoPage = lawsCommonMapper.getCommonPage(page, tableName, selectField, selectCondition); // 对返回的数据做处理 // 做字段翻译和拼接 - infoPage.setRecords(processResultMapPageList(infoPage.getRecords(), fieldListSelect)); + infoPage.setRecords(processResultMapPageList(infoPage.getRecords(), fieldList)); // 待处理 return infoPage; } @@ -1039,7 +1039,10 @@ public class LawsCommonServiceImpl implements ILawsCommonService { for (int j = 0; j < headers.size(); j++) { Cell dataCell = dataRow.createCell(j); - Object value = dataRowMap.get(headers.get(j).getDbFieldName()); + LawsTag lawsTag = headers.get(j); + // 如果有翻译字典的就用翻译字典 + Object dictValue = dataRowMap.get(lawsTag.getDbFieldName() + FieldCommon._DICT_TEXT); + Object value = dictValue == null ? dataRowMap.get(lawsTag.getDbFieldName()) : dictValue; if (value != null) { dataCell.setCellValue(value.toString()); } @@ -1099,7 +1102,10 @@ public class LawsCommonServiceImpl implements ILawsCommonService { for (int j = 0; j < headers.size(); j++) { Cell dataCell = dataRow.createCell(j); - Object value = dataRowMap.get(headers.get(j).getDbFieldName()); + LawsTag lawsTag = headers.get(j); + // 如果有翻译字典的就用翻译字典 + Object dictValue = dataRowMap.get(lawsTag.getDbFieldName() + FieldCommon._DICT_TEXT); + Object value = dictValue == null ? dataRowMap.get(lawsTag.getDbFieldName()) : dictValue; if (value != null) { dataCell.setCellValue(value.toString()); } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsStandardFileServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsStandardFileServiceImpl.java index 1d3e5e8a..cf906be3 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsStandardFileServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/standard/service/impl/LawsStandardFileServiceImpl.java @@ -3,6 +3,7 @@ package com.jero.modules.laws.standard.service.impl; import cn.hutool.core.io.FileUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.jero.common.exception.JeroBootException; +import com.jero.modules.laws.common.constant.FieldCommon; import com.jero.modules.laws.standard.service.ILawsStandardFileService; import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.service.IOSSFileService; @@ -53,7 +54,7 @@ public class LawsStandardFileServiceImpl implements ILawsStandardFileService { // 遍历每个记录 for (Map record : records) { - String standardNo = (String) record.get("standard_number"); + String standardNo = (String) record.get(FieldCommon.STANDARD_NUMBER); for (LawsTag tag : fileHeaders) { String fileName = tag.getDbFieldTxt(); String key = standardNo + "-" + tag.getDbFieldName(); @@ -65,17 +66,17 @@ public class LawsStandardFileServiceImpl implements ILawsStandardFileService { // 遍历找到的结果 if (lawsStandardFiles.size() == 1) { String fileExtension = "." + FileUtil.extName(lawsStandardFiles.get(0).getFileName()); - allFileName = new StringBuilder(standardNo + "/" + fileName + fileExtension); + allFileName = new StringBuilder(standardNo.replace("/", "") + "/" + fileName + fileExtension); } else { for (int i = 1; i <= lawsStandardFiles.size(); i++) { String fileExtension = "." + FileUtil.extName(lawsStandardFiles.get(0).getFileName()); - allFileName.append(standardNo).append("/").append(fileName).append(i).append(fileExtension).append(","); + allFileName.append(standardNo.replace("/", "")).append("/").append(fileName).append(i).append(fileExtension).append(","); } // 去除最后一个, allFileName = new StringBuilder(allFileName.substring(0, allFileName.length() - 1)); } // 最终设置 - record.put(tag.getDbFieldName(), allFileName.toString()); + record.put(tag.getDbFieldName() + FieldCommon._DICT_TEXT, allFileName.toString()); } } }