diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java index a0ad6f55..5fc811b6 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java @@ -1,8 +1,16 @@ package com.actionsoft.apps.coe.pal.output.pr.report1; +import static com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil.specialCharTransfer; + import java.io.File; import java.sql.Timestamp; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import com.actionsoft.apps.coe.pal.constant.CoEConstant; import com.actionsoft.apps.coe.pal.output.pr.util.PrReportComment; @@ -16,7 +24,6 @@ import com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil; import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryPropertyCache; -import com.actionsoft.apps.coe.pal.pal.repository.designer.realtime.model.ListenEvent; import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.DesignerShapeRelationCache; import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.dao.DesignerShapeRelationDao; import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel; @@ -34,6 +41,7 @@ import com.actionsoft.bpms.server.DispatcherRequest; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.fs.DCContext; import com.actionsoft.bpms.server.fs.dc.DCProfileManager; +import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.UtilDate; import com.actionsoft.bpms.util.UtilFile; import com.actionsoft.bpms.util.UtilString; @@ -43,11 +51,6 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import static com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil.specialCharTransfer; -import static com.actionsoft.apps.coe.pal.pal.repository.constant.CoeProcessLevelConstant.LINK_PREFIX; -import static com.alibaba.druid.util.FnvHash.Constants.NVARCHAR2; - - /** * 生成流程手册-步骤横表横表的入口 * @@ -490,52 +493,87 @@ public class Report1Gener { //支持文件 - JSONArray supportfiles = new JSONArray(); //组织职责Table - List relationList = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "support_files"); - - - relationList.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText)); - - int index = 0; - for (DesignerShapeRelationModel relation : relationList) { - String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID - PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); - if (model != null) { - index++; - String name = model.getName(); - JSONObject tmp = new JSONObject(); - tmp.put("name", name); - tmp.put("desc", index); - + JSONArray supportfiles = new JSONArray(); + try { + int count = 0; + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'support_files'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + String[] names = fileNames.split(","); + for (String name : names) { + count++; + JSONObject tmp = new JSONObject(); + tmp.put("name", name); + tmp.put("desc", count); + supportfiles.add(tmp); + } + } - supportfiles.add(tmp); } + } catch (Exception e) { + // TODO: handle exception } + + + /* + * List relationList = + * DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", + * "support_files"); + * relationList.sort(Comparator.comparing(DesignerShapeRelationModel:: + * getShapeText)); int index = 0; for (DesignerShapeRelationModel relation : + * relationList) { String relationFileId = relation.getRelationFileId();// + * 支持或相关文件的ID PALRepositoryModel model = + * PALRepositoryCache.getCache().get(relationFileId); if (model != null) { + * index++; String name = model.getName(); JSONObject tmp = new JSONObject(); + * tmp.put("name", name); tmp.put("desc", index); + * + * + * supportfiles.add(tmp); } } + */ //相关文件 R_relevant_flies - JSONArray relevant_flies = new JSONArray(); //组织职责Table - List relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "R_relevant_flies"); - - relationList2.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText)); - - int count = 0; - for (DesignerShapeRelationModel relation : relationList2) { - String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID - PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); - if (model != null) { - count++; - String name = model.getName(); - JSONObject tmp = new JSONObject(); - tmp.put("name", name); - tmp.put("desc", count); - - relevant_flies.add(tmp); + JSONArray relevant_flies = new JSONArray(); + try { + int count = 0; + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'R_relevant_flies'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + String[] names = fileNames.split(","); + for (String name : names) { + count++; + JSONObject tmp = new JSONObject(); + tmp.put("name", name); + tmp.put("desc", count); + relevant_flies.add(tmp); + } + } + } + } catch (Exception e) { + // TODO: handle exception } + + /* + * List relationList2 = + * DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", + * "R_relevant_flies"); + * relationList2.sort(Comparator.comparing(DesignerShapeRelationModel:: + * getShapeText)); int count = 0; for (DesignerShapeRelationModel relation : + * relationList2) { String relationFileId = relation.getRelationFileId();// + * 支持或相关文件的ID PALRepositoryModel model = + * PALRepositoryCache.getCache().get(relationFileId); if (model != null) { + * count++; String name = model.getName(); JSONObject tmp = new JSONObject(); + * tmp.put("name", name); tmp.put("desc", count); //relevant_flies.add(tmp); } } + */ // 修订记录 dataMap.put("version_history_table", getVersionHistoryTable(repositoryModel)); - // 附则处理 List T_supplementary_articles_table = new ArrayList<>(); String [] tmp = dataMap.getString("pl_T_supplementary_articles").split("\n"); diff --git a/com.awspaas.user.apps.coe.pal.output.zd/src/com/awspaas/apps/coe/pal/output/zd/report1/Report1Gener.java b/com.awspaas.user.apps.coe.pal.output.zd/src/com/awspaas/apps/coe/pal/output/zd/report1/Report1Gener.java index bf9f88c0..7f61a983 100644 --- a/com.awspaas.user.apps.coe.pal.output.zd/src/com/awspaas/apps/coe/pal/output/zd/report1/Report1Gener.java +++ b/com.awspaas.user.apps.coe.pal.output.zd/src/com/awspaas/apps/coe/pal/output/zd/report1/Report1Gener.java @@ -33,6 +33,7 @@ import com.actionsoft.bpms.server.DispatcherRequest; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.fs.DCContext; import com.actionsoft.bpms.server.fs.dc.DCProfileManager; +import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.UtilDate; import com.actionsoft.bpms.util.UtilFile; import com.actionsoft.bpms.util.UtilString; @@ -244,12 +245,12 @@ public class Report1Gener { String path = dcContextpdf.getPath(); String fileName = dcContextpdf.getFileName(); //创建实例,加载doc测试文档 + String s = path+fileName; com.spire.doc.Document docs = new com.spire.doc.Document(); - docs.loadFromFile("/"+path+fileName); + docs.loadFromFile(path+fileName); //保存为xml格式 - //nas/awsinst/doccenter/com.actionsoft.apps.coe.pal/COE_Upfile/03e55104-3ac6-4298-8a9f-6d1c03cad06b/obj_2ebe57d0f9b84bdeb7cf697945d3c5ab/液态奶事业部食品安全委员会运行管理规定.doc String substring = fileName.substring(0, fileName.lastIndexOf(".doc")); - docs.saveToFile("/"+path+substring+".xml",FileFormat.Word_ML); + docs.saveToFile(path+substring+".xml",FileFormat.Word_ML); dcContextpdf = new DCContext(userContext, dcProfile, CoEConstant.APP_ID, upfileModel.getPl_uuid(), upfileModel.getShape_uuid(), substring+".xml"); break; } @@ -689,46 +690,87 @@ public class Report1Gener { //支持文件 - JSONArray support_files = new JSONArray(); //组织职责Table - List relationList = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "support_files"); - - relationList.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText)); - - int index = 0; - for (DesignerShapeRelationModel relation : relationList) { - String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID - PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); - if (model != null) { - index++; - String name = model.getName(); - JSONObject tmp = new JSONObject(); - tmp.put("name", name); - tmp.put("desc", index); - support_files.add(tmp); + JSONArray support_files = new JSONArray(); + try { + int count = 0; + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'support_files'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + String[] names = fileNames.split(","); + for (String name : names) { + count++; + JSONObject tmp = new JSONObject(); + tmp.put("name", name); + tmp.put("desc", count); + support_files.add(tmp); + } + } + } + } catch (Exception e) { + // TODO: handle exception } + + /* + * JSONArray support_files = new JSONArray(); //组织职责Table + * List relationList = + * DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", + * "support_files"); + * + * relationList.sort(Comparator.comparing(DesignerShapeRelationModel:: + * getShapeText)); + * + * int index = 0; for (DesignerShapeRelationModel relation : relationList) { + * String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID + * PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); + * if (model != null) { index++; String name = model.getName(); JSONObject tmp = + * new JSONObject(); tmp.put("name", name); tmp.put("desc", index); + * support_files.add(tmp); } } + */ //相关文件 related_files - JSONArray related_files = new JSONArray(); //组织职责Table - List relationList2 = DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", "related_files"); - - - relationList2.sort(Comparator.comparing(DesignerShapeRelationModel::getShapeText)); - - int count = 0; - for (DesignerShapeRelationModel relation : relationList2) { - String relationFileId = relation.getRelationFileId();// 支持或相关文件的ID - //System.err.println("生成手册时相关文件id=======>"+relationFileId); - PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); - if (model != null) { - count++; - String name = model.getName(); - JSONObject tmp = new JSONObject(); - tmp.put("name", name); - tmp.put("desc", count); - related_files.add(tmp); + JSONArray related_files = new JSONArray(); + try { + int count = 0; + String sql = "select PROPERTYVALUE from APP_ACT_COE_PAL_PROP where PLID = '"+repositoryModel.getId()+"' and PROPERTYID = 'relevant_flies'"; + String relatFileJson = DBSql.getString(sql); + if(UtilString.isNotEmpty(relatFileJson)) { + JSONObject parseObject = JSONObject.parseObject(relatFileJson); + String fileNames = parseObject.getString("relationShapeText"); + if(UtilString.isNotEmpty(fileNames)) { + String[] names = fileNames.split(","); + for (String name : names) { + count++; + JSONObject tmp = new JSONObject(); + tmp.put("name", name); + tmp.put("desc", count); + related_files.add(tmp); + } + } + } + } catch (Exception e) { + // TODO: handle exception } + + + /* + * JSONArray related_files = new JSONArray(); //组织职责Table + * List relationList2 = + * DesignerShapeRelationCache.getListByAttrId(repositoryModel.getId(), "", + * "related_files"); + * relationList2.sort(Comparator.comparing(DesignerShapeRelationModel:: + * getShapeText)); int count = 0; for (DesignerShapeRelationModel relation : + * relationList2) { String relationFileId = relation.getRelationFileId();// + * 支持或相关文件的ID //System.err.println("生成手册时相关文件id=======>"+relationFileId); + * PALRepositoryModel model = PALRepositoryCache.getCache().get(relationFileId); + * if (model != null) { count++; String name = model.getName(); JSONObject tmp = + * new JSONObject(); tmp.put("name", name); tmp.put("desc", count); + * related_files.add(tmp); } } + */ //术语 dataMap.put("term_table", termTable);//table4