报告生成器判断如果未上传附件,则不生成文件夹
This commit is contained in:
parent
0428f7eb9b
commit
12143b9853
Binary file not shown.
@ -256,78 +256,89 @@ public class Report1Gener {
|
||||
if(HighSecurityUtil.isON()){
|
||||
PALRepositoryQueryAPIManager.getInstance().upFileSecurityFilter(this.userContext,search);
|
||||
}
|
||||
boolean isFile=false;
|
||||
if (search != null && search.size() > 0) {
|
||||
//创建附件目录及复制附件
|
||||
fileName = fileName + "_file";
|
||||
file = new File(docPath, fileName);
|
||||
if (!file.exists()) {
|
||||
log.info("创建附件");
|
||||
file.mkdir();
|
||||
|
||||
for (UpfileModel oneupfileModel : search) {
|
||||
if ("f".equals(oneupfileModel.getType())) {// 文件
|
||||
isFile=true;
|
||||
//创建附件目录及复制附件
|
||||
fileName = fileName + "_file";
|
||||
file = new File(docPath, fileName);
|
||||
if (!file.exists()) {
|
||||
log.info("创建附件");
|
||||
file.mkdir();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JSONArray fileTable = new JSONArray(); //流程附件Table
|
||||
//文件属性附件处理
|
||||
int fileIndex = 1;
|
||||
ArrayList<String> isNumberAscArray = new ArrayList<String>();
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
continue;
|
||||
}
|
||||
// 复制doccenter下的文件
|
||||
DCContext dcContext = null;
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
if (dcProfile != null) {
|
||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||
}
|
||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
try {
|
||||
UtilFile.copyFile(sourceFile, targetFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= upfileModel.getFileName();
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
if(isFile){
|
||||
JSONArray fileTable = new JSONArray(); //流程附件Table
|
||||
//文件属性附件处理
|
||||
int fileIndex = 1;
|
||||
ArrayList<String> isNumberAscArray = new ArrayList<String>();
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
if (!"f".equals(upfileModel.getType())) {// 文件
|
||||
continue;
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&UtilString.isNotEmpty(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
object.put("file_number", fileNumber);
|
||||
// 复制doccenter下的文件
|
||||
DCContext dcContext = null;
|
||||
DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE);
|
||||
if (dcProfile != null) {
|
||||
dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName());
|
||||
}
|
||||
File sourceFile = new UtilFile(dcContext.getFilePath());
|
||||
File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName());
|
||||
try {
|
||||
UtilFile.copyFile(sourceFile, targetFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= upfileModel.getFileName();
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)&&UtilString.isNotEmpty(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
object.put("file_number", fileNumber);
|
||||
}else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
String file_name;
|
||||
if(upfileModel.getFileName().contains("--")){
|
||||
file_name=upfileModel.getFileName().replaceAll("--+|---", "-");
|
||||
}else{
|
||||
file_name=upfileModel.getFileName();
|
||||
}
|
||||
object.put("file_name", file_name);
|
||||
object.put("file_name", file_name);
|
||||
String link = fileName + File.separator + upfileModel.getFileName();
|
||||
object.put("link", link);
|
||||
fileTable.add(object);
|
||||
fileIndex++;
|
||||
}
|
||||
|
||||
}else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
String file_name;
|
||||
if(upfileModel.getFileName().contains("--")){
|
||||
file_name=upfileModel.getFileName().replaceAll("--+|---", "-");
|
||||
}else{
|
||||
file_name=upfileModel.getFileName();
|
||||
}
|
||||
object.put("file_name", file_name);
|
||||
object.put("file_name", file_name);
|
||||
String link = fileName + File.separator + upfileModel.getFileName();
|
||||
object.put("link", link);
|
||||
fileTable.add(object);
|
||||
fileIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user