From 5739bcd41cb88e8e3207beebdac24e85f8aa1ccc Mon Sep 17 00:00:00 2001 From: yujh_java Date: Wed, 16 Jul 2025 16:42:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=9B=BE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9E=E6=B3=95wps=E5=9C=A8=E7=BA=BF=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pal/pal/output/util/OutputWordUtil.java | 62 +++++++++++++++++++ .../page/pal.pl.repository.designer.htm | 29 +++++++++ 2 files changed, 91 insertions(+) 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 a36069e1..28290618 100755 --- 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 @@ -22,6 +22,8 @@ import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; import com.actionsoft.apps.coe.pal.util.HttpPostUtil; import com.actionsoft.apps.coe.pal.util.WPS4Util; import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.commons.formfile.model.delegate.FormFile; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.org.model.DepartmentModel; import com.actionsoft.bpms.org.model.RoleModel; @@ -232,6 +234,8 @@ public class OutputWordUtil { e.printStackTrace(); } + //流程图新增逻辑,增加管理要求wps文件合并需求 + mergeMRWord(outFile.getPath(),repositoryId); Document doc = new Document(outFile.getPath()); Section section = doc.getLastSection(); @@ -2873,4 +2877,62 @@ public class OutputWordUtil { } } + /** + * 判断是否需求合并管理要求 + * @param uuid + */ + public static void mergeMRWord(String filePath, String uuid){ + Map stringJSONObjectMap = PALRepositoryQueryAPIManager.queryRepositoryAttributeById(uuid); + JSONObject attrJson = stringJSONObjectMap.get("management_requirements_Location"); + String text = attrJson.getString("text"); + if("不显示管理要求".equals(text)){ + return; + } + BO mrBO = SDK.getBOAPI().getByKeyField("BO_EU_PROCESS_MR", "FILEUUID", uuid); + if(null!=mrBO){ + String status = mrBO.getString("STATUS"); + if(status.equals("1")){//如果为生效状态 + //先获取管理要求附件 + List systemfile = SDK.getBOAPI().getFiles(mrBO.getId(), "SYSTEMFILE"); + FormFile formFile = systemfile.get(0); + DCContext fileDCContext = SDK.getBOAPI().getFileDCContext(formFile); + //开始合并 + Document docs1 = new Document(); + docs1.loadFromFile(filePath); + // 加载文档2 + Document docs2 = new Document(); + docs2.loadFromFile(fileDCContext.getFilePath()); + SectionCollection sections1 = docs1.getSections(); + //先确认要找到的段落 + int targetParagraphIndex = 0; + if("流程图前".equals(text)){ + for (int i = 1; i < sections1.getCount(); i++) { + Section section = sections1.get(i); + for (int j = 0; j < section.getParagraphs().getCount(); j++) { + Paragraph para = section.getParagraphs().get(j); + if (para.getText().contains("流程图")) { + targetParagraphIndex = i; + break; + } + } + } + }else if("活动说明后".equals(text)){ + for (int i = 1; i < sections1.getCount(); i++) { + Section section = sections1.get(i); + for (int j = 0; j < section.getParagraphs().getCount(); j++) { + Paragraph para = section.getParagraphs().get(j); + if (para.getText().contains("流程说明")) { + targetParagraphIndex = i+1; + break; + } + } + } + } + sections1.insert(targetParagraphIndex, docs2.getSections().get(0).deepClone()); + // 保存文档2 + docs1.saveToFile(filePath, FileFormat.Docx_2013); + docs1.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 d5abdf34..36ee9384 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 @@ -448,6 +448,7 @@ var pid = "<#parentChartId>"; var teamId = "<#teamId>"; var jssdk; + var mrStatus = "0"; @@ -1193,6 +1194,8 @@ $("#dock").css("right", 0); openWpsMRUrl(); } else { + //先判断是否要更新管理办法的生效状态 + updateMrStatus(); $("#wpsPage").css('display', 'none'); $("#shape_panel").css('display', 'block'); $("#shape_panel_more_shape").css('display', 'block'); @@ -1224,6 +1227,32 @@ } } + function updateMrStatus(){//更新管理办法的生效状态 + //先判断是否要更新管理办法的生效状态 + if(mrStatus == 0){//生效 + //先弹出二次确认框 + var options = { + title : "当前管理办法未生效,是否更新管理办法的生效状态?", + content:"确认生效", + onConfirm: function(){ + $.ajax({ + url: "./jd?sid=" + sid + "&cmd=com.awspaas.user.apps.yiliwps.updateMrStatus&palId=" + ruuid, + type: 'GET', + success: function (data) { + mrStatus = data.data.mrStatus; + } + }); + }, + onCancel : function(){ + $.simpleAlert("您选择了取消"); + } + }; + $.confirm(options); + + } + + } + //保存wps内容 async function saveWps() { try {