认证-上报库-自定义导出-bug57359
This commit is contained in:
+67
-27
@@ -726,16 +726,6 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
|
||||
// 替换模板中的占位符
|
||||
try {
|
||||
//下载关联文件内容
|
||||
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
|
||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
||||
String exportFile = "导出文件";
|
||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||
exportFile = "Export file";
|
||||
}
|
||||
downLoadFileList(allRelevFileList,fileNowPath + File.separator + exportFile);
|
||||
}
|
||||
|
||||
// 拿取模板
|
||||
String repFileName = fileName.replaceAll("/","_");
|
||||
@@ -743,6 +733,35 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
if (CosBootUtil.doesObjectExist(templateUrl)) {
|
||||
InputStream wordTemplate = CosBootUtil.download(templateUrl);
|
||||
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(wordTemplate);
|
||||
|
||||
//下载关联文件内容
|
||||
List<Map<String, Object>> fileListAll = (List<Map<String, Object>>) allParamsInfoList.get(2).get("fileListAll");
|
||||
|
||||
if (fileListAll != null && !fileListAll.isEmpty()) {
|
||||
Map<String,String> paramsAfterFilter = WordUtil.filterParams(wordMLPackage, params);
|
||||
if (CollectionUtil.isNotEmpty(paramsAfterFilter)) {
|
||||
List<String> nioNumberList = paramsAfterFilter.keySet().stream().collect(Collectors.toList());
|
||||
List<OSSFile> allRelevFileList = new ArrayList<>();
|
||||
for (Map<String, Object> fileMap : fileListAll) {
|
||||
for (Map.Entry map : fileMap.entrySet()) {
|
||||
String key = (String) map.getKey();
|
||||
List<OSSFile> fileList = (List<OSSFile>) map.getValue();
|
||||
if (nioNumberList.contains(key)) {
|
||||
allRelevFileList.addAll(fileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(allRelevFileList)) {
|
||||
String exportFile = "导出文件";
|
||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||
exportFile = "Export file";
|
||||
}
|
||||
|
||||
downLoadFileList(allRelevFileList, fileNowPath + File.separator + exportFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 替换占位符内容
|
||||
WordUtil.replacePictureBatch(wordMLPackage, imgListAll);
|
||||
WordUtil.replaceVariable(wordMLPackage, params);
|
||||
@@ -837,29 +856,47 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
// 替换模板中的占位符
|
||||
try {
|
||||
|
||||
//下载关联文件内容
|
||||
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
|
||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
||||
String exportFile = "导出文件";
|
||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||
exportFile = "Export file";
|
||||
}
|
||||
downLoadFileList(allRelevFileList,fileNowPath + File.separator + exportFile);
|
||||
}
|
||||
|
||||
// 拿取模板
|
||||
String repFileName = fileName.replaceAll("/","_");
|
||||
wordOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
|
||||
if (CosBootUtil.doesObjectExist(templateUrl)) {
|
||||
InputStream wordTemplate = CosBootUtil.download(templateUrl);
|
||||
InputStream exceltemplateForDocx4j = CosBootUtil.download(templateUrl);
|
||||
// com.qcloud.cos.utils.IOUtils.copy(wordTemplate, wordOS);
|
||||
InputStream excelTemplateForPoi = CosBootUtil.download(templateUrl);
|
||||
|
||||
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.load(exceltemplateForDocx4j);
|
||||
|
||||
//下载关联文件内容
|
||||
List<Map<String, Object>> fileListAll = (List<Map<String, Object>>) allParamsInfoList.get(2).get("fileListAll");
|
||||
|
||||
if (fileListAll != null && !fileListAll.isEmpty()) {
|
||||
Map<String,String> paramsAfterFilter = ExcelUtil.filterParams(pkg, params);
|
||||
if (CollectionUtil.isNotEmpty(paramsAfterFilter)) {
|
||||
List<String> nioNumberList = paramsAfterFilter.keySet().stream().collect(Collectors.toList());
|
||||
List<OSSFile> allRelevFileList = new ArrayList<>();
|
||||
for (Map<String, Object> fileMap : fileListAll) {
|
||||
for (Map.Entry map : fileMap.entrySet()) {
|
||||
String key = (String) map.getKey();
|
||||
List<OSSFile> fileList = (List<OSSFile>) map.getValue();
|
||||
if (nioNumberList.contains(key)) {
|
||||
allRelevFileList.addAll(fileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(allRelevFileList)) {
|
||||
String exportFile = "导出文件";
|
||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||
exportFile = "Export file";
|
||||
}
|
||||
|
||||
downLoadFileList(allRelevFileList, fileNowPath + File.separator + exportFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 替换占位符内容
|
||||
// docx4j方式
|
||||
InputStream excelTemplate = CosBootUtil.download(templateUrl);
|
||||
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.load(wordTemplate);
|
||||
Workbook workbook = WorkbookFactory.create(excelTemplate);
|
||||
Workbook workbook = WorkbookFactory.create(excelTemplateForPoi);
|
||||
ExcelUtil.replacePictureBatchPOI(workbook, pkg, imgListAll, params);
|
||||
ExcelUtil.variableReplace(pkg, params);
|
||||
pkg.save(wordOS);
|
||||
@@ -1092,7 +1129,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
List<Map<String, Object>> imgListAll = new ArrayList<>(); // 存放图片信息
|
||||
List<OSSFile> fileListAll = new ArrayList<>(); // 存放文件
|
||||
List<Map<String, Object>> fileListAll = new ArrayList<>(); // 存放文件
|
||||
String fileTypeStr = ".png,.PNG,.jfif,.JFIF,.pjpeg,.PJPEG,.jpeg,.JPEG,.pjp,.PJP,.jpg,.JPG";
|
||||
// 查询配置列数据
|
||||
for (Map<String, Object> record1 : dataList) {
|
||||
@@ -1125,13 +1162,16 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
||||
fileNameList.add(ossFileList.get(0).getFileName());
|
||||
|
||||
fileList.addAll(ossFileList);
|
||||
|
||||
Map<String, Object> fileMap = new HashMap<>();
|
||||
fileMap.put(nioNumber, ossFileList);
|
||||
fileListAll.add(fileMap);
|
||||
} else {
|
||||
imgFileList.addAll(ossFileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fileListAll.addAll(fileList);
|
||||
|
||||
StringBuilder configDataBuilder = new StringBuilder(); // 重新组合配置数据
|
||||
if ((ControlTypeEnum.FILE.getValue().equals(controlType)
|
||||
|
||||
+33
@@ -246,6 +246,39 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
return updateById(paramsInfoEO);
|
||||
}
|
||||
|
||||
public void verifyForAddOrEdit (String paramsNumber, String paramsName, String cut) {
|
||||
|
||||
// 编号,参数名称校验
|
||||
if (StringUtils.isNotBlank(paramsNumber)) {
|
||||
String numberRegex = "^[A-Za-z0-9-/. ]+$";
|
||||
if (!paramsNumber.matches(numberRegex)) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("编号只能输入字母,数字,横杠(-),小数点(.),左斜杠,空格");
|
||||
} else {
|
||||
throw new JeroBootException("Number enter only letters, numbers, dash (-),dot (.),left slash,spaces");
|
||||
}
|
||||
}
|
||||
if (paramsNumber.length() > Long.parseLong("15")) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("编号不能超过15个字符");
|
||||
} else {
|
||||
throw new JeroBootException("Number can not exceed 15 chars");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(paramsName)) {
|
||||
if (paramsName.length() > Long.parseLong("100")) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("参数名称不能超过100个字符");
|
||||
} else {
|
||||
throw new JeroBootException("Params Name can not exceed 100 chars");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user