虚拟清单导入--交付物模板处理
This commit is contained in:
+1
-1
@@ -1032,7 +1032,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
|
||||
StringBuilder sb = new StringBuilder();
|
||||
fileTemplateName = fileTemplateName.replace(",",",");
|
||||
for (String fileName : fileTemplateName.split(",")) {
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(filepath, fileName);
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(filepath, fileName,null,null,null,null,null);
|
||||
if (nowFileList.size() == 0) {
|
||||
if(CutEnum.CN.getValue().equals(cut)) {
|
||||
errorMsg += "附件模板压缩包中没有" + fileName + "文件; ";
|
||||
|
||||
+1
-1
@@ -4342,7 +4342,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String fileName : value.split(",")) {
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName);
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,cut,errorMsg,null,key,key);
|
||||
if (nowFileList.size() == 0) {
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
errorMsg += key + "压缩包中没有" + fileName + "文件; ";
|
||||
|
||||
+7
-7
@@ -1087,14 +1087,14 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
||||
if (StringUtils.isNotBlank(designDeliverableTemplate)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String fileName : designDeliverableTemplate.split(",")) {
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName);
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,dummyInventoryInfoEO.getCut(),errorMsg,msgList,nameCn,nameEn);
|
||||
if (nowFileList.size() == 0) {
|
||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
errorMsg += "压缩包中没有" + fileName + "文件; ";
|
||||
}else{
|
||||
errorMsg += " Not in the zip package" + fileName + "file; ";
|
||||
}
|
||||
msgList.add(errorMsg);
|
||||
// if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||
// errorMsg += "压缩包中没有" + fileName + "文件; ";
|
||||
// }else{
|
||||
// errorMsg += " Not in the zip package" + fileName + "file; ";
|
||||
// }
|
||||
// msgList.add(errorMsg);
|
||||
} else {
|
||||
try {
|
||||
FileInputStream input = new FileInputStream(nowFileList.get(0));
|
||||
|
||||
+7
-7
@@ -2309,14 +2309,14 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
if (StringUtils.isNotBlank(designDeliverableTemplate)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String fileName : designDeliverableTemplate.split(",")) {
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName);
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(zipEntryName, fileName,projectLawsInventoryEO.getCut(),errorMsg,msgList,nameCn,nameEn);
|
||||
if (nowFileList.size() == 0) {
|
||||
if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
|
||||
errorMsg += "压缩包中没有" + fileName + "文件; ";
|
||||
}else{
|
||||
errorMsg += " Not in the zip package" + fileName + "file; ";
|
||||
}
|
||||
msgList.add(errorMsg);
|
||||
// if(CutEnum.CN.getValue().equals(projectLawsInventoryEO.getCut())){
|
||||
// errorMsg += "压缩包中没有" + fileName + "文件; ";
|
||||
// }else{
|
||||
// errorMsg += " Not in the zip package" + fileName + "file; ";
|
||||
// }
|
||||
// msgList.add(errorMsg);
|
||||
} else {
|
||||
try {
|
||||
FileInputStream input = new FileInputStream(nowFileList.get(0));
|
||||
|
||||
+36
-6
@@ -1,12 +1,18 @@
|
||||
package com.jero.modules.split.common;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.xkcoding.http.util.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
@@ -114,9 +120,18 @@ public class FileUnZip {
|
||||
* gaoyan
|
||||
* @param filename
|
||||
*/
|
||||
public static List<File> readFileByFilename(String path,String filename) {
|
||||
public static List<File> readFileByFilename(String path,
|
||||
String filename,
|
||||
String cut,
|
||||
String errorMsg,
|
||||
List<String> msgList,
|
||||
String nameCn,
|
||||
String nameEn) {
|
||||
String filenameOne = "";
|
||||
String filenameTwo = "";
|
||||
if(filename.contains("/")){
|
||||
filename = filename.split("/")[1];
|
||||
filenameOne = filename.split("/")[0];
|
||||
filenameTwo = filename.split("/")[1];
|
||||
}
|
||||
List<File> resultlist = new ArrayList<>();
|
||||
if (StringUtil.isNotEmpty(path)){
|
||||
@@ -128,20 +143,35 @@ public class FileUnZip {
|
||||
File[] filesTemp = fi.listFiles();
|
||||
for (File fileTemp : filesTemp) {
|
||||
// 对文件进行过滤
|
||||
if (fileTemp.getName().equals(filename)) {
|
||||
if (fileTemp.getName().equals(filenameTwo) && fileTemp.getPath().contains(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fileTemp);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// 对文件进行过滤
|
||||
if (fi.getName().equals(filename)) {
|
||||
if (fi.getName().equals(filenameTwo) && fi.getPath().contains(filenameOne) && StringUtils.isNotBlank(filenameOne)) {
|
||||
resultlist.add(fi);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(resultlist.size() == 0){
|
||||
String name = "";
|
||||
if(filename.contains("/")){
|
||||
name = filenameTwo;
|
||||
}else{
|
||||
name = filename;
|
||||
}
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
errorMsg += nameCn + name + "格式不正确或者压缩包中没有" + name + "文件,请参考模板下载中的说明";
|
||||
}else{
|
||||
errorMsg += nameEn + name + " Incorrect format or not present in compressed package " + name + " file please refer to the description in template download;";
|
||||
}
|
||||
if(msgList != null){
|
||||
msgList.add(errorMsg);
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
// public static List<File> readFileByFilename(String path,String filename) {
|
||||
|
||||
+4
-4
@@ -1217,7 +1217,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
String url = nowfilelist.get(0).getPath();
|
||||
MultipartFile multipartFile = createMfileByPath(url);
|
||||
@@ -1262,7 +1262,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
String url = nowfilelist.get(0).getPath();
|
||||
MultipartFile multipartFile = createMfileByPath(url);
|
||||
@@ -1311,7 +1311,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
String url = nowfilelist.get(0).getPath();
|
||||
MultipartFile multipartFile = createMfileByPath(url);
|
||||
@@ -2223,7 +2223,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
StringBuilder sb = new StringBuilder();
|
||||
value = value.replace(",",",");
|
||||
for (String fileName : value.split(",")) {
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(filepath, fileName);
|
||||
List<File> nowFileList = FileUnZip.readFileByFilename(filepath, fileName,null,null,null,null,null);
|
||||
if (nowFileList.size() == 0) {
|
||||
if(CutEnum.CN.getValue().equals(cut)) {
|
||||
errorMsg += fieldName + "压缩包中没有" + fileName + "文件; ";
|
||||
|
||||
+3
-3
@@ -993,7 +993,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl<SarFileSplitItem
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(nowfilelist.get(0).getName());
|
||||
@@ -1030,7 +1030,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl<SarFileSplitItem
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(nowfilelist.get(0).getName());
|
||||
@@ -1069,7 +1069,7 @@ public class SarFileSplitItemsEOServiceImpl extends ServiceImpl<SarFileSplitItem
|
||||
}
|
||||
}
|
||||
}
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i],null,null,null,null,null);
|
||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setFileName(nowfilelist.get(0).getName());
|
||||
|
||||
Reference in New Issue
Block a user