制度手册显示附件

This commit is contained in:
lihongyu 2022-10-23 22:32:46 +08:00
parent dad440b539
commit 4e0971d550

View File

@ -416,13 +416,46 @@ public class Report1Gener {
} }
if (search != null && search.size() > 0) { if (search != null && search.size() > 0) {
//创建附件目录及复制附件 //创建附件目录及复制附件
// fileName = fileName + "_file"; fileName = fileName + "_file";
// file = new File(docPath, fileName); file = new File(docPath, fileName);
// if (!file.exists()) { if (!file.exists()) {
// log.info("创建附件"); log.info("创建附件");
// file.mkdir(); file.mkdir();
// } }
} }
//文件属性附件
int fileIndex = 1;
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();
object.put("file_name", fileIndex + "." + upfileModel.getFileName());
String link = fileName + File.separator + upfileModel.getFileName();
object.put("link", link);
fileTable.add(object);
fileIndex++;
}
}
String controlShapeId = ""; String controlShapeId = "";
if (repositoryFileElements != null) { if (repositoryFileElements != null) {
int index = 1;// 流程步骤序号 int index = 1;// 流程步骤序号
@ -477,11 +510,11 @@ public class Report1Gener {
// System.out.println(e); // System.out.println(e);
// e.printStackTrace(); // e.printStackTrace();
// } // }
JSONObject object = new JSONObject(); /*
object.put("file_name", upfileModel.getFileName()); * JSONObject object = new JSONObject(); object.put("file_name",
String link = fileName + File.separator + upfileModel.getFileName(); * upfileModel.getFileName()); String link = fileName + File.separator +
object.put("link", link); * upfileModel.getFileName(); object.put("link", link); fileTable.add(object);
fileTable.add(object); */
} }
} }
if(shapeFileTable.size() == 0) {// 没有附件时给空值不然使用office打开会解析错误 if(shapeFileTable.size() == 0) {// 没有附件时给空值不然使用office打开会解析错误
@ -535,32 +568,29 @@ public class Report1Gener {
setTableValueOfKPI("kpi", repositoryId, KPITable, relationFileMap); setTableValueOfKPI("kpi", repositoryId, KPITable, relationFileMap);
if (search != null && search.size() > 0) { if (search != null && search.size() > 0) {
// 复制附件 // 复制附件
// int index = 1; int index = 1;
// for (UpfileModel upfileModel : search) { for (UpfileModel upfileModel : search) {
// if (!"f".equals(upfileModel.getType())) {// 文件 if (!"f".equals(upfileModel.getType())) {// 文件
// continue; continue;
// } }
// // 复制doccenter下的文件 // 复制doccenter下的文件
// DCContext dcContext = null; /*
// DCPluginProfile dcProfile = DCProfileManager.getDCProfile(CoEConstant.APP_ID, CoeFileConstant.COE_UPFILE); * DCContext dcContext = null; DCPluginProfile dcProfile =
// if (dcProfile != null) { * DCProfileManager.getDCProfile(CoEConstant.APP_ID,
// dcContext = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file", upfileModel.getPl_uuid(), upfileModel.getFileName()); * CoeFileConstant.COE_UPFILE); if (dcProfile != null) { dcContext = new
// } * DCContext(userContext, dcProfile, CoEConstant.APP_ID, "file",
// File sourceFile = new UtilFile(dcContext.getFilePath()); * upfileModel.getPl_uuid(), upfileModel.getFileName()); } File sourceFile = new
// File targetFile = new UtilFile(file.toString() + File.separator + dcContext.getFileName()); * UtilFile(dcContext.getFilePath()); File targetFile = new
// try { * UtilFile(file.toString() + File.separator + dcContext.getFileName()); try {
// UtilFile.copyFile(sourceFile, targetFile); * UtilFile.copyFile(sourceFile, targetFile); } catch (Exception e) {
// } catch (Exception e) { * System.out.println(e); e.printStackTrace(); } JSONObject object = new
// System.out.println(e); * JSONObject(); object.put("file_name", index + "." +
// e.printStackTrace(); * upfileModel.getFileName()); String link = fileName + File.separator +
// } * upfileModel.getFileName(); object.put("link", link);
// JSONObject object = new JSONObject(); * System.err.println("==1==>"+object); fileTable.add(object);
// object.put("file_name", index + "." + upfileModel.getFileName()); * System.err.println("==2==>"+fileTable); index++;
// String link = fileName + File.separator + upfileModel.getFileName(); */
// object.put("link", link); }
// fileTable.add(object);
// index++;
// }
} }
JSONArray termTable = new JSONArray(); //术语定义Table JSONArray termTable = new JSONArray(); //术语定义Table
// 属性特征 属性代码KEY // 属性特征 属性代码KEY
@ -667,8 +697,8 @@ public class Report1Gener {
dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable); dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable);
dataMap.put("file_table", fileTable); dataMap.put("file_table", fileTable);
// dataMap.put("file_table_count", fileTable.size()); dataMap.put("file_table_count", fileTable.size());
dataMap.put("file_table_count", 0);// 暂时置空 //dataMap.put("file_table_count", 0);// 暂时置空
dataMap.put(OutputWordUtil.TABLE_DANGER, dangerTable); dataMap.put(OutputWordUtil.TABLE_DANGER, dangerTable);
dataMap.put(OutputWordUtil.TABLE_REGULATE, regulateTable); dataMap.put(OutputWordUtil.TABLE_REGULATE, regulateTable);
dataMap.put(OutputWordUtil.TABLE_KPI, KPITable); dataMap.put(OutputWordUtil.TABLE_KPI, KPITable);