diff --git a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar index a4bbea22..267eed9a 100644 Binary files a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar and b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar differ 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 1131197b..964c7516 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 @@ -3,6 +3,9 @@ package com.actionsoft.apps.coe.pal.output.pr.report1; import static com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil.specialCharTransfer; import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.sql.Timestamp; import java.util.*; import java.util.function.Function; @@ -107,7 +110,28 @@ public class Report1Gener { OutputAppProfile appModel = OutputAppManager.getProfile(model.getProfileId()); String tempPath = appModel.getAppContext().getPath(); //String tempName = "步骤横表-流程手册.xml"; - String tempName = "步骤横表-流程手册4.xml"; + + + //增加判断文件类型逻辑,因为可能有多个,取其中第一个文件,判断文件类型 + String targetFileId = ""; + String[] targetFileIds = jsonObj.getString("targetFileId").split(","); + for (String fileId : targetFileIds) { + if(UtilString.isNotEmpty(fileId)){ + targetFileId = fileId; + break; + } + } + + + String tempName; + String methodId=PALRepositoryCache.getCache().get(targetFileId).getMethodId(); + if(methodId.equals("process.oaApprove")){ + tempName = "步骤横表-流程手册5.xml"; + }else { + tempName = "步骤横表-流程手册4.xml"; + } + + log.info("begin..."); log.info("-------------------"); // ----文件处理----- @@ -144,6 +168,8 @@ public class Report1Gener { if(repositoryModel1.getMethodId().equals("process.framework")){ continue; } + + String methodId=repositoryModel1.getMethodId(); PALRepositoryModel model = PALRepositoryQueryAPIManager.getInstance().queryPalRepositoryModelByPalId(repositoryId); if (model != null) { //获取文件扩展属性 @@ -195,12 +221,22 @@ public class Report1Gener { } JSONObject dataMap = getData(repositoryId, wizardJsonData, docPath, fileName); if (dataMap != null) { - OutputWordUtil.createDoc2(dataMap, tempPath, tempName, docName, repositoryId); + if(methodId.equals("process.oaApprove")){ + OutputWordUtil.createOAApproveDoc(dataMap, tempPath, tempName, docName, repositoryId); + }else{ + OutputWordUtil.createDoc2(dataMap, tempPath, tempName, docName, repositoryId); + } + } } } } + + + + + /** * 获取文档数据 * @param repositoryId diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java index 7675f707..0ae0b878 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/util/PrReportComment.java @@ -27,11 +27,12 @@ import com.actionsoft.bpms.util.*; import com.actionsoft.sdk.local.SDK; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import jodd.util.StringUtil; import static com.actionsoft.apps.coe.pal.pal.output.util.OutputWordUtil.specialCharTransfer; public class PrReportComment { - public static String TARGET_METHOD_SCOPE = "process.bpmn2,process.epc,process.flowchart,process.framework"; + public static String TARGET_METHOD_SCOPE = "process.bpmn2,process.epc,process.flowchart,process.framework,process.oaApprove"; public static String PROCESS_STEP = "userTask,serviceTask,manualTask,receiveTask,sendTask,scriptTask,businessRuleTask,callActivityCallingProcess,method,process,predefinedProcess,decision"; //word换行符 @@ -288,9 +289,7 @@ public class PrReportComment { dataMap.put("pl_" + propertyObj.getString("key"), OutputWordUtil.specialCharTransfer(propertyObj.getString("value"))); } }else if (propertyObj.getString("key").equals("T_supplementary_articles")) { - if (propertyObj.getString("value").equals("")) { - dataMap.put("pl_" + propertyObj.getString("key"), "无"); - }else{ + if (StringUtil.isNotEmpty(propertyObj.getString("value"))) { dataMap.put("pl_" + propertyObj.getString("key"), OutputWordUtil.specialCharTransfer(propertyObj.getString("value"))); } }else if("P_versions".equals(propertyObj.getString("key"))) { diff --git a/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册4.xml b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册4.xml index 904ec564..b6f13d78 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册4.xml +++ b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册4.xml @@ -3915,6 +3915,12 @@ + + + + + + @@ -3922,6 +3928,14 @@ + + + + + + + + @@ -4212,6 +4226,7 @@ + @@ -7020,7 +7035,7 @@ - + <#if (relevant_table_count >0 )> @@ -7249,7 +7264,7 @@ - + <#if (T_supplementary_articles_count >0)> @@ -7305,6 +7320,8 @@ + + @@ -7583,4 +7600,4 @@ - \ No newline at end of file + diff --git a/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册5.xml b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册5.xml new file mode 100644 index 00000000..1ce4be4f --- /dev/null +++ b/com.actionsoft.apps.coe.pal.output.pr/步骤横表-流程手册5.xml @@ -0,0 +1,5813 @@ + + + + + + 洪继程 + Microsoft Office User + 2 + 1 + 2022-09-15T03:11:00Z + 2022-09-15T03:11:00Z + 8 + 378 + 2161 + 18 + 5 + 2534 + 16 + + + 2052-11.8.2.8053 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${COMPANYNAME} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文件编码: + + + + + + + + + + ${pl_file_number} + + + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${repository_name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${HEADERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${HEADERLOGO} + + + + + + + + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${FOOTERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAGE + + + + + + + + + + + + + + + + + + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 基本信息 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文件名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${repository_name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文件编码 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_file_number} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 流程架构 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + L1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_Process_Architecture_L1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 版 本 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_P_versions} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + L2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_Process_Architecture_L2} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 生效日期 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_effective_date} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + L3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_Process_Architecture_L3} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 适用范围 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_application} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + L4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_Process_Architecture_L4} + + + + + + + + + + + + + + + + + + + + + + + + 修订记录 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 版本 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 发布部门 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 拟制人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 拟制日期 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 审核人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 复核人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 审批人 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 修订内容及理由 + + + + + <#list version_history_table as table8> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.P_versions} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.Issuing_department} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.Drafted_and_revised_by} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.Drafted_and_revised_date} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.auditor} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.reviewer} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.approver} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table8.Contents_and_reasons_for_revision} + + + + + + + <#if (goal_table_count >0 )> + + + + + + + + + + + + + + + + + + + + + 目的 + + + + <#list goal_table as table1> + + + + + + + + + + + + + + ${table1} + + + + + +<#if (term_table_count>0 )> + + + + + + + + + + + + + 术语 + + + +<#if (term_table_count ==0 )> + + + + + + + + + + + + + + + +<#else> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 说明 + + + + + <#list term_table as table4> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table4.name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table4.desc} + + + + + + + + + + + + + + +<#if (organization_table_count >0 )> + + + + + + + + + + + + 组织/角色与职责 + + + +<#if (organization_table_count ==0 )> + + + + + + + + + + + + + + + +<#else> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 组织/角色 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 职责 + + + + + <#list organization_table as table5> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table5.name} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table5.desc} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${HEADERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${FOOTERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAGE + + + + + + + + + + + + + + + + + + + + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 流程图 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${pl_diagram} + + + + + + + + + + + + + + + + + + + + +<#if (metrics_count >0 )> + + + + + + + + + + + + + + + 流程绩效指标 + + + + <#if (metrics_count ==0 )> + + + + + + + + + + + + + + + + <#else> + + + + + + + + + + + + + + + + + + + + <#list pl_process_kpi_list as proKpis> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指标名称 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_Name_process_performance_indicator} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 设置目的 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_set_the_purpose} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 指标定义 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_Index_definition} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 计算公式 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_computational_formula} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 数据来源 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_data_sources} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 计量单位 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_unit_measurement} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 统计周期 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_statistical_period} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 说明 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${proKpis.pl_explain} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<#if (related_support_files_table_count >0 )> + + + + + + + + + + + + + + + + + 相关/支持文件 + + + +<#if (related_support_files_table_count ==0 )> + + + + + + + + + + + + + + + +<#else> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文件名称 + + + + + <#list related_support_files_table as table7> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table7.desc} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table7.name} + + + + + + + + + + + + + + + + + + + + +<#if (relevant_table_count >0 )> + + + + + + + + + + + + + + + + + 外部相关文件 + + + +<#if (relevant_table_count ==0 )> + + + + + + + + + + + + + + + +<#else> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 序号 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文件名称 + + + + + <#list relevant_table as table7> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table7.desc} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${table7.name} + + + + + + + + + + + + + + + + + + + + +<#if (T_supplementary_articles_count >0)> + + + + + + + + + + + + + + + + + + + + + + 附则 + + + +<#list T_supplementary_articles_table as table1> + + + + + + + + + + + + + + ${table1} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${HEADERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + ──────────────────────────────────────────────────────────── + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${FOOTERFONT} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PAGE + + + + + + + + + + + + + + + + + + + + 9 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index bd09b488..fbb5b7c1 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java index 1de022ac..3c5ca9bd 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java @@ -2597,13 +2597,14 @@ public class CoEPALController { // @Mapping("COE_PAL_OUTPUTREPORT_OUTPUT_PROCESS_CREATE") @Mapping("com.actionsoft.apps.coe.pal_outputreport_output_process_create") public String COEPALOUTPUTREPORTOutputProcessCreate(UserContext me, String wsId, String teamId, String fileId) { - PALRepositoryModel model = PALRepositoryCache.getCache().get(fileId); + PALRepositoryModel model = PALRepositoryCache.getCache().get(fileId); String methodId = model.getMethodId(); - if ("data.form".equals(methodId)) { - return PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, me.getUID(), teamId, fileId); + + if ("data.form".equals(methodId)) { + return PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, me.getUID(), teamId, fileId); //方案手册走制度手册逻辑 } else if ("control.policy".equals(methodId) ||"process.scheme".equals(methodId) || "engineering.standard".equals(methodId)) { - return PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, me.getUID(), teamId, fileId); + return PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, me.getUID(), teamId, fileId); } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java index b1c5bbd7..a7a844b7 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/util/OutputWordUtil.java @@ -55,6 +55,7 @@ import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import org.apache.commons.lang.StringUtils; +import org.apache.pdfbox.text.TextPosition; import java.awt.*; import java.io.*; @@ -463,12 +464,17 @@ public class OutputWordUtil { } - - - - + /** + * oa审批审批流程创建word + * @param dataMap + * @param tempPath + * @param tempName + * @param docName + * @param repositoryId + * @throws FileNotFoundException + */ public static void createOAApproveDoc(JSONObject dataMap, String tempPath, String tempName, String docName,String repositoryId) throws FileNotFoundException { - Configuration configuration = new Configuration(); + Configuration configuration = new Configuration(); configuration.setDefaultEncoding("UTF-8"); // 设置模本装置方法和路径 @@ -508,13 +514,68 @@ public class OutputWordUtil { } + BO oaapprovalBO = SDK.getBOAPI().getByKeyField("BO_EU_OA_APPROVAL_TEMPLATE_TJ", "FILEUUID", repositoryId); + if (null == oaapprovalBO || !"1".equals(oaapprovalBO.getString("STATUS"))) { + return; + } + + List processfile = SDK.getBOAPI().getFiles(oaapprovalBO.getId(), "PROCESSFILE"); + if (processfile.isEmpty()) { + return; + } + FormFile formFile = processfile.get(0); + DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile); + + // 加载目标文件和待合并文档2 + Document docs1 = new Document(); + docs1.loadFromFile(outFile.getPath()); + Document docs2 = new Document(); + System.out.println("fileDCContext.getFilePath()======="+fileDCContext.getFilePath()); + docs2.loadFromFile(fileDCContext.getFilePath()); + Section lastSection1 = docs1.getLastSection(); + + // 删除最后一个节 + docs1.getSections().remove(lastSection1); + System.out.println("嘻嘻嘻嘻嘻嘻休息休息="); + // 提取所有表格 + List allTables = extractAllTables(docs2); + System.out.println("找到11111111 " + allTables.size() + " 个表格"); + + if (allTables.size() >= 4) { + // 拆分表格:前2个表格,后2个表格 + List
firstTwoTables = allTables.subList(0, 1); + + TextPosition position = findTextPosition(docs1, "流程图"); + + if (position != null) { + // 在前面插入前2个表格 + insertTablesBeforeText(docs1, firstTwoTables, position); + + // 6. 获取docs2中剩余的内容(除了前两个表格) + List remainingContent = extractRemainingContent(docs2, firstTwoTables.size()); + + // 7. 将剩余内容插入到docs1的最后一节 + insertContentToLastSection(docs1, remainingContent); + + + // 保存合并后的文档 + docs1.saveToFile(outFile.getPath(), FileFormat.Docx); + System.out.println("文档合并成功!"); + } else { + System.out.println("未找到文本'流程图'"); + } + } else { + System.out.println("源文档中的表格数量不足4个,当前只有: " + allTables.size()); + } + + docs1.dispose(); + docs2.dispose(); - Document doc = new Document(outFile.getPath()); @@ -522,6 +583,155 @@ public class OutputWordUtil { + + /** + * 提取剩余内容(除了前n个表格) + */ + private static List extractRemainingContent(Document document, int tablesToSkip) { + List remainingContent = new ArrayList<>(); + int skippedTables = 0; + + for (int i = 0; i < document.getSections().getCount(); i++) { + Section section = document.getSections().get(i); + for (int j = 0; j < section.getBody().getChildObjects().getCount(); j++) { + DocumentObject obj = section.getBody().getChildObjects().get(j); + + if (obj instanceof Table) { + if (skippedTables < tablesToSkip) { + skippedTables++; + continue; // 跳过前n个表格 + } + } + + // 克隆对象以避免重复引用问题 + remainingContent.add(obj.deepClone()); + } + } + return remainingContent; + } + + + + + /** + * 将内容插入到最后一节 + */ + private static void insertContentToLastSection(Document docs1, List content) { + int lastSectionIndex = docs1.getSections().getCount() - 1; + Section lastSection = docs1.getSections().get(lastSectionIndex); + + // 在插入前添加分页符(可选) + Paragraph pageBreak = new Paragraph(docs1); + pageBreak.appendBreak(BreakType.Page_Break); + lastSection.getBody().getChildObjects().add(pageBreak); + + // 插入剩余内容 + for (DocumentObject obj : content) { + lastSection.getBody().getChildObjects().add(obj); + } + } + + + + + /** + * 提取文档中的所有表格 + */ + private static List
extractAllTables(Document doc) { + List
tables = new ArrayList<>(); + + for (Object sectionObj : doc.getSections()) { + Section section = (Section) sectionObj; + + for (Object obj : section.getBody().getChildObjects()) { + if (obj instanceof Table) { + tables.add((Table) obj); + } + } + } + + return tables; + } + + /** + * 查找文本位置 + */ + private static TextPosition findTextPosition(Document doc, String targetText) { + for (int s = 0; s < doc.getSections().getCount(); s++) { + Section section = doc.getSections().get(s); + + for (int p = 0; p < section.getParagraphs().getCount(); p++) { + Paragraph paragraph = section.getParagraphs().get(p); + String paragraphText = paragraph.getText(); + + if (paragraphText.contains(targetText)) { + return new TextPosition(s, p, paragraphText.indexOf(targetText)); + } + } + } + return null; + } + + /** + * 在指定文本前插入表格 + */ + private static void insertTablesBeforeText(Document mainDoc, List
tables, TextPosition position) { + Section mainSection = mainDoc.getSections().get(position.getSectionIndex()); + Paragraph targetParagraph = mainSection.getParagraphs().get(position.getParagraphIndex()); + int insertIndex = mainSection.getBody().getChildObjects().indexOf(targetParagraph); + + // 在前方插入表格(反向插入以保持顺序) + for (int i = tables.size() - 1; i >= 0; i--) { + Table clonedTable = tables.get(i).deepClone(); + mainSection.getBody().getChildObjects().insert(insertIndex, clonedTable); + + // 在每个表格前添加一个空段落作为间隔 + Paragraph spacingPara = new Paragraph(mainDoc); + mainSection.getBody().getChildObjects().insert(insertIndex, spacingPara); + } + } + + /** + * 在指定文本后插入表格 + */ + private static void insertTablesAfterText(Document mainDoc, List
tables, TextPosition position) { + Section mainSection = mainDoc.getSections().get(position.getSectionIndex()); + Paragraph targetParagraph = mainSection.getParagraphs().get(position.getParagraphIndex()); + int insertIndex = mainSection.getBody().getChildObjects().indexOf(targetParagraph) + 1; + + // 在后方插入表格 + for (Table table : tables) { + Table clonedTable = table.deepClone(); + mainSection.getBody().getChildObjects().insert(insertIndex, clonedTable); + insertIndex++; + + // 在每个表格后添加一个空段落作为间隔 + Paragraph spacingPara = new Paragraph(mainDoc); + mainSection.getBody().getChildObjects().insert(insertIndex, spacingPara); + insertIndex++; + } + } + + /** + * 文本位置信息类 + */ + static class TextPosition { + private int sectionIndex; + private int paragraphIndex; + private int textOffset; + + public TextPosition(int sectionIndex, int paragraphIndex, int textOffset) { + this.sectionIndex = sectionIndex; + this.paragraphIndex = paragraphIndex; + this.textOffset = textOffset; + } + + public int getSectionIndex() { return sectionIndex; } + public int getParagraphIndex() { return paragraphIndex; } + public int getTextOffset() { return textOffset; } + } + + /** * 生成word文件 * @@ -982,8 +1192,7 @@ public class OutputWordUtil { //页眉文字 TableCell cell = table.getRows().get(0).getCells().get(0); String text = cell.getParagraphs().get(0).getText();// 假设单元格中只有一个TextRange - System.out.println("HEADERFONT = " + text); - cell.getParagraphs().get(0).setText(dataMap.getString("HEADERFONT")); + cell.getParagraphs().get(0).setText(dataMap.getString("HEADERFONT")); //页眉logo String logoUrl = dataMap.getString("LOGOURL"); TableCell cellImg = table.getRows().get(0).getCells().get(1); @@ -1018,8 +1227,7 @@ public class OutputWordUtil { TableCell cell = table.getRows().get(0).getCells().get(0); // 修改单元格中的文本 String text = cell.getParagraphs().get(0).getText();// 假设单元格中只有一个TextRange - System.out.println("FOOTERFONT = " + text); - cell.getParagraphs().get(0).setText(dataMap.getString("FOOTERFONT")); + cell.getParagraphs().get(0).setText(dataMap.getString("FOOTERFONT")); } DocumentObject obj = sourceFooter.getChildObjects().get(j).deepClone(); targetFooter.getChildObjects().add(obj); @@ -3106,6 +3314,47 @@ public class OutputWordUtil { break; } } + + + + // 插入文档2内容(保持格式与文件协调) + Section doc2Sec = docs2.getSections().get(0); + boolean isFirstPara = true; + for (Object obj : doc2Sec.getParagraphs()) { + Paragraph doc2Para = (Paragraph) obj; + Paragraph clonedPara = (Paragraph) doc2Para.deepClone(); + ParagraphFormat format = clonedPara.getFormat(); + + // 核心格式:确保同页且不挤压 + format.setPageBreakBefore(false); + format.setPageBreakAfter(false); + format.setKeepLines(true); + format.setKeepFollow(true); + format.setLineSpacingRule(LineSpacingRule.At_Least); + format.setLineSpacing(12f); // 适配文件中行高 + + // 第一段与表格保持6磅间距(避免贴紧表格底部) + if (isFirstPara) { + float beforeSpacing = format.getBeforeSpacing(); + format.setBeforeSpacing(beforeSpacing > 0 ? beforeSpacing : 6f); + isFirstPara = false; + } + + // 插入到目标位置(表格下方) + targetSection.getParagraphs().insert(targetParaIndex, clonedPara); + } + + // 调整后续段落(如矩阵标题)与插入内容的间距 + ParagraphFormat targetFormat = targetPara.getFormat(); + targetFormat.setBeforeSpacing(6f); // 与插入内容保持6磅间距 + targetFormat.setPageBreakBefore(false); + + // 保存文档 + docs1.saveToFile(filePath, FileFormat.Docx_2013); + docs1.dispose(); + docs2.dispose(); + + } else if ("活动说明后".equals(text)) { @@ -3140,157 +3389,38 @@ public class OutputWordUtil { if (targetPara != null) break; } - } - // 未找到目标位置则退出 - if (targetPara == null || targetSection == null) { - return; - } + // 在目标文档末尾添加分节符,确保新节可以有不同的页面设置 + Section lastSection=docs1.addSection(); + + lastSection.getPageSetup().setOrientation(PageOrientation.Portrait); + + lastSection.getHeadersFooters().setLinkToPrevious(false); // 关键步骤! + //获取该节的页眉,移除其中的内容,然后在其中添加一个空白段落 + // 克隆源文档的所有节内容到目标文档的最后一节 + for (Object sectionObj : docs2.getSections()) { + Section sourceSection = (Section) sectionObj; + for (Object docObj2 : sourceSection.getParagraphs()) { + Paragraph doc2Para = (Paragraph) docObj2; + Paragraph clonedPara = (Paragraph) doc2Para.deepClone(); + // 将克隆的内容添加到目标文档的最后一节 + lastSection.getBody().getChildObjects().add(clonedPara); - - // 在目标文档末尾添加分节符,确保新节可以有不同的页面设置 - Section lastSection=docs1.addSection(); - - lastSection.getPageSetup().setOrientation(PageOrientation.Portrait); - - lastSection.getHeadersFooters().setLinkToPrevious(false); // 关键步骤! - - - //获取该节的页眉,移除其中的内容,然后在其中添加一个空白段落 - // 克隆源文档的所有节内容到目标文档的最后一节 - for (Object sectionObj : docs2.getSections()) { - Section sourceSection = (Section) sectionObj; - for (Object docObj2 : sourceSection.getParagraphs()) { - Paragraph doc2Para = (Paragraph) docObj2; - Paragraph clonedPara = (Paragraph) doc2Para.deepClone(); - - // 将克隆的内容添加到目标文档的最后一节 - lastSection.getBody().getChildObjects().add(clonedPara); - - } - - } - - - - - - - /* Section doc2Sec = docs2.getSections().get(0); - for (Object obj : doc2Sec.getParagraphs()) { - Paragraph doc2Para = (Paragraph) obj; - Paragraph clonedPara = (Paragraph) doc2Para.deepClone(); - ParagraphFormat format = clonedPara.getFormat(); - - - - - // 核心格式:确保同页且不挤压 - format.setPageBreakBefore(false); - format.setPageBreakAfter(false); - format.setKeepLines(true); - format.setKeepFollow(true); - format.setLineSpacingRule(LineSpacingRule.At_Least); - format.setLineSpacing(12f); // 适配文件中行高 - - // 第一段与表格保持6磅间距(避免贴紧表格底部) -// if (isFirstPara) { -// float beforeSpacing = format.getBeforeSpacing(); -// format.setBeforeSpacing(beforeSpacing > 0 ? beforeSpacing : 6f); -// isFirstPara = false; -// } - - // 插入到目标位置(表格下方) - targetSection.getParagraphs().insert(targetParaIndex, clonedPara); - targetParaIndex++; - } - - // 调整后续段落(如矩阵标题)与插入内容的间距 - ParagraphFormat targetFormat = targetPara.getFormat(); - targetFormat.setBeforeSpacing(6f); // 与插入内容保持6磅间距 - targetFormat.setPageBreakBefore(false);*/ - - - - - - // 保存文档 - docs1.saveToFile(filePath, FileFormat.Docx_2013); - docs1.dispose(); - docs2.dispose(); - - } - - - - public static List extractAllTables(String filePath) { - List tablesContent = new ArrayList<>(); - Document doc = new Document(); - doc.loadFromFile(filePath); - for (Object obj : doc.getSections()) { - Section sec = (Section) obj; - for (Object table : sec.getTables()) { - System.out.println("talble=" + table); - Table table1 = (Table) obj; - tablesContent.add(extractTableContent(table1)); - } - } - return tablesContent; - } - - - private static String extractTableContent(Table table) { - StringBuilder tableContent = new StringBuilder(); - int rowCount = table.getRows().getCount(); - int colCount = 0; - if (rowCount > 0) - colCount = table.getRows().get(0).getCells().getCount(); - tableContent.append("(").append(rowCount).append("").append(colCount).append("\n"); - for (int i = 0; i < rowCount; i++) { - TableRow row = table.getRows().get(i); - for (int j = 0; j < row.getCells().getCount(); j++) { - TableCell cell = row.getCells().get(j); - String cellText = extractCellContent(cell); - System.out.println("cellText====" + cellText); - tableContent.append(cellText); - if (j < row.getCells().getCount() - 1) - tableContent.append("\t"); - } - tableContent.append("\n"); - } - return tableContent.toString(); - } - - - private static String extractCellContent(TableCell cell) { - StringBuilder cellContent = new StringBuilder(); - for (int k = 0; k < cell.getParagraphs().getCount(); k++) { - Paragraph para = cell.getParagraphs().get(k); - cellContent.append(para.getText()); - if (k < cell.getParagraphs().getCount() - 1) - cellContent.append("\n"); - } - return cellContent.toString(); - } - - - // 新增:清除文档中的分页符(针对文档2) - private static void clearPageBreaks(Document doc) { - for (Object obj : doc.getSections()) { - Section section= (Section) obj; - // 遍历段落,移除手动分页符(假设分页符以特殊字符或元素存在) - for (Object obj1 : section.getParagraphs()) { - Paragraph para = (Paragraph) obj1; - String paraText = para.getText(); - if (paraText.contains("\f")) { - para.setText(paraText.replace("\f", "")); // 清除分页符字符 } + } + // 保存文档 + docs1.saveToFile(filePath, FileFormat.Docx_2013); + docs1.dispose(); + docs2.dispose(); } + } + + } diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm index 96fce86a..26de24b4 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm @@ -450,6 +450,7 @@ var teamId = "<#teamId>"; var jssdk; var mrStatus = "0"; + var apprivalStatus = "0"; @@ -601,7 +602,7 @@ } // 只有epc和泳道图显示切换按钮 - if (methodId !== 'process.epc' && methodId !== 'process.flowchart' && methodId !== 'process.oaApprove') { + if (methodId !== 'process.epc' && methodId !== 'process.flowchart') { $("#switchMRViews").css('display', 'none'); } @@ -1228,8 +1229,7 @@ $("#dock").css("right", 0); openWpsOaApprovalUrl(); } else { - //先判断是否要更新管理办法的生效状态 - updateMrStatus(); + $("#wpsPage").css('display', 'none'); $("#shape_panel").css('display', 'block'); $("#shape_panel_more_shape").css('display', 'block'); @@ -1366,7 +1366,7 @@ url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.previewUrl_oaApproval&palId=" + ruuid, type: 'GET', success: function (data) { - mrStatus = data.data.mrStatus; + apprivalStatus = data.data.approvalStatus; if (data.data.content.code === 200) { //换一种打开方式 console.log('引入后可以开始使用 JSSDK 了~'); diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.html b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.html index decda1ea..25a732b2 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.html +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.html @@ -1806,7 +1806,7 @@ 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 a3d94a3f..a6aa1e25 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 @@ -432,6 +432,8 @@ public class Report1Gener { dataMap.put("CNAMEFONTSIZE",changeValueToDouble(bo.getString("CNAMEFONTSIZE"))); dataMap.put("HEADERFONT",bo.getString("HEADERFONT")); dataMap.put("FOOTERFONT",bo.getString("FOOTERFONT")); + //dataMap.put("HEADERBOTTOMLINE1","───────────────────────────────────────────────────"); + //dataMap.put("HEADERBOTTOMLINE1","───────────────────────────────────────────────────────────────────────────────────────────────────────────────"); List headerlogo = SDK.getBOAPI().getFiles(bo.getId(), "HEADERLOGO"); if(headerlogo.size()>0){ FormFile formFile = headerlogo.get(0); diff --git a/com.awspaas.user.apps.coe.pal.output.zd/制度-手册5.xml b/com.awspaas.user.apps.coe.pal.output.zd/制度-手册5.xml index cb32512c..68b7c8bf 100644 --- a/com.awspaas.user.apps.coe.pal.output.zd/制度-手册5.xml +++ b/com.awspaas.user.apps.coe.pal.output.zd/制度-手册5.xml @@ -2955,7 +2955,7 @@ - + @@ -2969,8 +2969,8 @@ - - + + @@ -2979,7 +2979,7 @@ - + @@ -3005,7 +3005,7 @@ - + diff --git a/com.awspaas.user.apps.yiliwps/lib/com.awspaas.user.apps.yiliwps.jar b/com.awspaas.user.apps.yiliwps/lib/com.awspaas.user.apps.yiliwps.jar index bb365966..5bf7081a 100644 Binary files a/com.awspaas.user.apps.yiliwps/lib/com.awspaas.user.apps.yiliwps.jar and b/com.awspaas.user.apps.yiliwps/lib/com.awspaas.user.apps.yiliwps.jar differ diff --git a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/constant/YiliWpsConst.java b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/constant/YiliWpsConst.java index 4e4b6353..00cd3c8d 100644 --- a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/constant/YiliWpsConst.java +++ b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/constant/YiliWpsConst.java @@ -27,4 +27,13 @@ public class YiliWpsConst { public static final String APP_ACT_COE_PAL_UPFILE = "APP_ACT_COE_PAL_UPFILE"; + public static final String BO_EU_OA_APPROVAL_TEMPLATE = "BO_EU_OA_APPROVAL_TEMPLATE"; + + public static final String BO_EU_OA_APPROVAL_TEMPLATE_TJ = "BO_EU_OA_APPROVAL_TEMPLATE_TJ"; + + + + + + } diff --git a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/controller/YiliWpsController.java b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/controller/YiliWpsController.java index 454f7248..4133ec5e 100644 --- a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/controller/YiliWpsController.java +++ b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/controller/YiliWpsController.java @@ -41,6 +41,21 @@ public class YiliWpsController { return web.getWPSMROnlineFilePreviewUrl(palId); } + + /** + * 打开可编辑的页面(oa审批流程) + * @param me + * @param palId + * @return + * @throws Exception + */ + @Mapping("com.awspaas.user.apps.yiliwps.previewUrl_oaApproval") + public String getWPSOnlineFilePreviewUrloaApproval(UserContext me,String palId) throws Exception{ + WpsWeb web =new WpsWeb(me); + return web.getWPSOaApprovalOnlineFilePreviewUrl(palId); + } + + /** * 打开只读的页面(epc) * @param me @@ -54,6 +69,21 @@ public class YiliWpsController { return web.getWPSMROnlineFilePreviewReadUrl(palId); } + + /** + * 打开只读的页面(oaapproval) + * @param me + * @param palId + * @return + * @throws Exception + */ + @Mapping("com.awspaas.user.apps.yiliwps.previewUrl_oaApproval_read") + public String getWPSOnlineFilePreviewUrlOaApprovalRead(UserContext me,String palId) throws Exception{ + WpsWeb web =new WpsWeb(me); + return web.getWPSMROnlineFilePreviewOaApprovalReadUrl(palId); + } + + /** * 打开制度的页面 * @param me diff --git a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/web/WpsWeb.java b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/web/WpsWeb.java index 6932ddbe..824690c7 100644 --- a/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/web/WpsWeb.java +++ b/com.awspaas.user.apps.yiliwps/src/com/awspaas/user/apps/yiliwps/web/WpsWeb.java @@ -97,9 +97,13 @@ public class WpsWeb extends ActionWeb { JSONObject user = new JSONObject(); JSONObject user_acl = new JSONObject(); JSONObject watermark = new JSONObject(); - if("1".equals(isEPC)){ + + if("1".equals(isEPC)){ sourceDc = getFileDCContext(fileId,isEPC); file.put("id", fileId); + }else if("2".equals(isEPC)) { + sourceDc = getFileOAApprovalDCContext(fileId); + file.put("id", fileId); }else if(UtilString.isEmpty(filePreview)){ sourceDc = getFileDCContext(fileId); file.put("id", fileId.equals("")?"1":fileId); @@ -167,13 +171,20 @@ public class WpsWeb extends ActionWeb { //aslpUtil.callTranslateDocASLP(me,palId,fileName,fileInputStream); //只写入新文件 DCContext sourceDc; - if("1".equals(isEPC)){//EPC图 + if("1".equals(isEPC)){//EPC图 sourceDc = getFileDCContext(fileId,isEPC); sourceDc.setSession(me); BO mrBO = SDK.getBOAPI().getByKeyField(YiliWpsConst.BO_EU_PROCESS_MR, "FILEUUID", fileId); List systemfile = SDK.getBOAPI().getFiles(mrBO.getId(), "SYSTEMFILE"); FormFile formFile = systemfile.get(0); SDK.getBOAPI().upFile(formFile,fileInputStream); + }else if("2".equals(isEPC)){ + sourceDc = getFileOAApprovalDCContext(fileId); + sourceDc.setSession(me); + BO mrBO = SDK.getBOAPI().getByKeyField(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ, "FILEUUID", fileId); + List processfile = SDK.getBOAPI().getFiles(mrBO.getId(), "PROCESSFILE"); + FormFile formFile = processfile.get(0); + SDK.getBOAPI().upFile(formFile,fileInputStream); }else{//制度图 sourceDc = getFileDCContext(fileId); //在重新获取下fileId @@ -318,6 +329,24 @@ public class WpsWeb extends ActionWeb { return fileDCContext; } + + /** + * 获取附件的附件ID(流程图相关的逻辑) + * @param fileId + * @return + */ + public DCContext getFileOAApprovalDCContext(String fileId){ + //查询模版记录文件 + BO approvalBO = SDK.getBOAPI().getByKeyField(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ, "FILEUUID", fileId); + List processfile = SDK.getBOAPI().getFiles(approvalBO.getId(), "PROCESSFILE"); + FormFile formFile = processfile.get(0); + DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile); + fileDCContext.setSession(this.getContext()); + return fileDCContext; + } + + + /** * 获取附件的附件ID * @return @@ -451,9 +480,51 @@ public class WpsWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); ro.put("mrStatus",mrStatus); ro.put("content",content); + System.out.println("content1111111"+content); return ro.toString(); } + + + + + /** + * (编辑)打开OA审批流程图wps在线 + * @param palId + * @return + * @throws Exception + */ + public String getWPSOaApprovalOnlineFilePreviewUrl(String palId) throws Exception{ + //先判断流程是否已经编辑过 //先判断流程是否已经编辑过 + BO approvalBO = SDK.getBOAPI().getByKeyField(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ, "FILEUUID", palId); + if(null == approvalBO){//如果为空 + approvalBO = new BO(); + approvalBO.set("FILEUUID",palId); + approvalBO.set("STATUS","1");//默认无效 + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_f400aa120f0a4bceb31f0a354ea73fd7", this.getContext().getUID(), "新建OA审批流程文件"); + SDK.getBOAPI().create(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ, approvalBO, processInstance, this.getContext()); + //创建完BO后,把模版附件copy进去 + //先获取模版文件 + BO tplBO = SDK.getBOAPI().query(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE).addQuery("FILESTATE=", true).detail(); + SDK.getBOAPI().copyFileTo(tplBO.getId(),"PROCESSFILE",approvalBO.getId(),YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ,"PROCESSFILE",processInstance.getId(),null); + } + String approvalStatus = approvalBO.getString("STATUS");//获取管理办法状态 + DCContext sourceDc = getFileOAApprovalDCContext(palId); + WPS4Util.initAppInfo(YiliWpsConst.AK, YiliWpsConst.SK); + String url = String.format("/api/edit/v1/files/%s/link?type=%s&_w_third_sid=%s&_w_third_palId=%s&_w_third_queryFileId=%s&_w_third_fname=%s&_w_third_isEPC=%s",palId,"w",this.getContext().getSessionId(),palId,palId,URLEncoder.encode(sourceDc.getFileName()),"2"); + Map headers = WPS4Util.getSignatureHeaders(url, HttpMethod.GET,null, YiliWpsConst.CONTENT_TYPE); + logAPI.consoleInfo(">>>>>headers"+headers); + String content = HttpPostUtil.sendGetRequest(YiliWpsConst.HOST + "/open" + url, headers); + ResponseObject ro = ResponseObject.newOkResponse(); + ro.put("approvalStatus",approvalStatus); + ro.put("content",content); + return ro.toString(); + } + + + + + /** * (只读)打开流程图管理要求wps在线 * @param palId @@ -481,6 +552,39 @@ public class WpsWeb extends ActionWeb { return ro.toString(); } + + + /** + * (只读)打开流程图管理要求wps在线 + * @param palId + * @return + */ + public String getWPSMROnlineFilePreviewOaApprovalReadUrl(String palId) throws Exception { + //先判断流程是否已经编辑过 + BO mrBO = SDK.getBOAPI().getByKeyField(YiliWpsConst.BO_EU_OA_APPROVAL_TEMPLATE_TJ, "FILEUUID", palId); + if(null == mrBO) {//如果为空 + return ResponseObject.newErrResponse("未创建管理要求文件").toString(); + } + String approvalStatus = mrBO.getString("STATUS");//获取管理办法状态 + if("0".equals(approvalStatus)){ + return ResponseObject.newErrResponse("OA审批文件未生效").toString(); + } + DCContext sourceDc = getFileDCContext(palId,"1"); + WPS4Util.initAppInfo(YiliWpsConst.AK, YiliWpsConst.SK); + String url = String.format("/api/preview/v1/files/%s/link?type=%s&_w_third_sid=%s&_w_third_palId=%s&_w_third_queryFileId=%s&_w_third_fname=%s&_w_third_isEPC=%s",palId,"w",this.getContext().getSessionId(),palId,palId,URLEncoder.encode(sourceDc.getFileName()),"2"); + Map headers = WPS4Util.getSignatureHeaders(url, HttpMethod.GET,null, YiliWpsConst.CONTENT_TYPE); + logAPI.consoleInfo(">>>>>headers"+headers); + String content = HttpPostUtil.sendGetRequest(YiliWpsConst.HOST + "/open" + url, headers); + ResponseObject ro = ResponseObject.newOkResponse(); + ro.put("approvalStatus",approvalStatus); + ro.put("content",content); + return ro.toString(); + } + + + + + /** * 更新MR管理办法状态 * @param palId