Răsfoiți Sursa

修复 hxcs 文章流程发布版本冲突

yzw 4 luni în urmă
părinte
comite
6349315b28

+ 1 - 0
local-run/bin/compile-hxcs-deploy-classes.sh

@@ -30,6 +30,7 @@ SOURCES=(
 	"${PROJECT_ROOT}/src/space/apps/moudules/personnel/services/GuestAccountService.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/util/SecurePdfTokenUtil.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/services/SecurePdfService.java"
+	"${PROJECT_ROOT}/src/space/apps/moudules/basic/services/FlowService.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/services/flow/ArticleFlowService.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/services/ArticleService.java"
 )

+ 8 - 3
local-run/bin/sync-to-hxcs-prod.sh

@@ -323,7 +323,8 @@ sync_static_files() {
 		"web/subassembly/app/pc/10012/10033/1001210033_run.jsp" \
 		"web/subassembly/app/pc/10012/10213/1001210213_run.jsp" \
 		"web/subassembly/app/pc/10013/10531/1001310531_run.jsp" \
-		"web/subassembly/app/pc/10013/10531/1001310531_edit.jsp"; do
+		"web/subassembly/app/pc/10013/10531/1001310531_edit.jsp" \
+		"web/subassembly/app/pc/10017/10070/1001710070_run.jsp"; do
 		local src="${PROJECT_ROOT}/WebRoot/${jsp}"
 		[[ -f "${src}" ]] && rsync_to "${host}" "${password}" "${webapp}/${jsp}" "${src}"
 	done
@@ -366,8 +367,12 @@ sync_static_files() {
 	local guest_account_service="${PROJECT_ROOT}/WebRoot/WEB-INF/classes/space/apps/moudules/personnel/services/GuestAccountService.class"
 	[[ -f "${guest_account_service}" ]] && rsync_to "${host}" "${password}" "${webapp}/WEB-INF/classes/space/apps/moudules/personnel/services/" "${guest_account_service}"
 
-	# 文章流程 Java 类(发起/列表查询)
-	for flow_class in ArticleFlowService ArticleService; do
+	# 流程发布服务(修复 JBPM 发布版本时流程名冲突)
+	local flow_service="${PROJECT_ROOT}/WebRoot/WEB-INF/classes/space/apps/moudules/basic/services/FlowService.class"
+	[[ -f "${flow_service}" ]] && rsync_to "${host}" "${password}" "${webapp}/WEB-INF/classes/space/apps/moudules/basic/services/" "${flow_service}"
+
+	# 网站服务与文章流程 Java 类
+	for flow_class in ArticleFlowService ArticleService WebsiteService; do
 		local flow_dir="space/apps/moudules/website/services"
 		if [[ "${flow_class}" == "ArticleFlowService" ]]; then
 			flow_dir="${flow_dir}/flow"

+ 39 - 0
local-run/migrations/2026-07-16-007-fix-article-release-process-name.sql

@@ -0,0 +1,39 @@
+-- hxcs 生产:修复文章发布子流程名称乱码导致 JBPM 发布版本失败(2026-07-16)
+-- 现象:
+--   basic_flow_release_version 报 invalid name '1-10004-文章发布'
+--   Existing process has name '1-10004-发布' and key 'website.articleRelease2021hKBGHZ'
+-- 原则:只修流程配置元数据,不覆盖正式文章、申请、审核数据。
+
+USE sp_gzhx_core;
+
+-- 1. 恢复文章发布子流程的中文名称,避免新生成 json/jpdl 继续带乱码。
+UPDATE bpm_lc SET
+  mc = '发布',
+  xgsj = NOW()
+WHERE lcid = 10014
+  AND `key` = 'articleRelease2021hKBGHZ'
+  AND (mc IS NULL OR mc <> '发布');
+
+-- 2. 重申当前可用发布版本指针。该版本对应线上已有的 articleRelease/71 文件,
+--    用于让新增版本发布时能从历史发布版继承稳定的 JBPM process name。
+UPDATE bpm_lctfbjl SET
+  json_wjlj = '/WEB-INF/apps/website/bpm/articleRelease/71/articleRelease.json',
+  jpdl_wjlj = '/WEB-INF/apps/website/bpm/articleRelease/71/articleRelease.jpdl.xml'
+WHERE lcid = 10014
+  AND bbh = 71;
+
+UPDATE bpm_lc SET
+  bbh = 71
+WHERE lcid = 10014
+  AND `key` = 'articleRelease2021hKBGHZ'
+  AND (bbh IS NULL OR bbh < 71);
+
+SELECT 'article_release_child_flow' AS check_name, lcid, sjlcid, mkid, jlztm, bbh, `key`, mc, wjml, fbwjml
+FROM bpm_lc
+WHERE lcid IN (10009, 10014);
+
+SELECT 'article_release_child_release' AS check_name, lcid, bbh, json_wjlj, jpdl_wjlj
+FROM bpm_lctfbjl
+WHERE lcid = 10014
+ORDER BY bbh DESC
+LIMIT 5;

+ 26 - 8
src/space/apps/moudules/basic/services/FlowService.java

@@ -427,15 +427,16 @@ public class FlowService extends BaseTransaction {
 		// 因此这里在生成发布版 jpdl 前,先将结束节点的消息配置剔除,保持与当前线上可运行的历史流程结构一致。
 		stripUnsupportedEndNodeMessageConfig(nodeReferDataList);
 		String jpdlXmlContent = JpdlXmlUtil.createJpdlXmlContent(mk, FileUtil.readFile(jsonFilePath), nodeReferDataList, bpmLc.getLcid(), bigBpmLc.getMc(), bigBpmLc.getKey());
-		jpdlXmlContent = alignProcessNameWithReleasedVersion(getGdbaInstance(DBNameVars.BASE), mk.getMkid(), bigBpmLc, bpmLc, jpdlXmlContent);
+		jpdlXmlContent = alignProcessNameWithReleasedVersion(getGdbaInstance(DBNameVars.BASE), mk.getMkid(), bigBpmLc, bpmLc, bpmLctfbjl, jpdlXmlContent);
 		
 		FileUtil.writeFile(jpdlXmlContent, getWebRootPath() + bpmLctfbjl.getJpdlWjlj());
 		FileUtil.copyFile(jsonFilePath, getWebRootPath() + bpmLctfbjl.getJsonWjlj());
 		
 	}
 
-	String alignProcessNameWithReleasedVersion(GeneralDBAccess baseGdba, Long mkid, BpmLc bigBpmLc, BpmLc bpmLc, String jpdlXmlContent) throws Exception {
-		String targetProcessName = getReleasedProcessName(baseGdba, mkid, bpmLc.getLcid());
+	String alignProcessNameWithReleasedVersion(GeneralDBAccess baseGdba, Long mkid, BpmLc bigBpmLc, BpmLc bpmLc, BpmLctfbjl currentRelease, String jpdlXmlContent) throws Exception {
+		Long beforeBbh = currentRelease != null ? currentRelease.getBbh() : null;
+		String targetProcessName = getReleasedProcessName(baseGdba, mkid, bpmLc.getLcid(), beforeBbh);
 		if (StringUtil.isNull(targetProcessName)) {
 			Long lclbid = StringUtil.notNull(bigBpmLc.getLclbid()) ? bigBpmLc.getLclbid() : bpmLc.getLclbid();
 			targetProcessName = mkid + "-" + lclbid + "-" + bpmLc.getMc();
@@ -449,8 +450,8 @@ public class FlowService extends BaseTransaction {
 				"$1" + Matcher.quoteReplacement(targetProcessName) + "$2");
 	}
 
-	String getReleasedProcessName(GeneralDBAccess baseGdba, Long mkid, Long lcid) throws Exception {
-		String releasedJpdlPath = getLatestReleasedJpdlPath(baseGdba, mkid, lcid);
+	String getReleasedProcessName(GeneralDBAccess baseGdba, Long mkid, Long lcid, Long beforeBbh) throws Exception {
+		String releasedJpdlPath = getLatestReleasedJpdlPath(baseGdba, mkid, lcid, beforeBbh);
 		if (StringUtil.isNull(releasedJpdlPath)) {
 			return null;
 		}
@@ -461,14 +462,24 @@ public class FlowService extends BaseTransaction {
 		}
 		
 		String processName = extractProcessName(FileUtil.readFile(resolvedPath));
-		return StringUtil.notNull(processName) ? processName : null;
+		if (StringUtil.isNull(processName) || looksMojibakeProcessName(processName)) {
+			return null;
+		}
+		return processName;
 	}
 
-	String getLatestReleasedJpdlPath(GeneralDBAccess baseGdba, Long mkid, Long lcid) throws Exception {
-		String sql = "select fbjl.jpdl_wjlj from bpm_lctfbjl fbjl where fbjl.mkid = :mkid and fbjl.lcid = :lcid order by fbjl.bbh desc limit 1 ";
+	String getLatestReleasedJpdlPath(GeneralDBAccess baseGdba, Long mkid, Long lcid, Long beforeBbh) throws Exception {
+		String sql = "select fbjl.jpdl_wjlj from bpm_lctfbjl fbjl where fbjl.mkid = :mkid and fbjl.lcid = :lcid ";
+		if (StringUtil.notNull(beforeBbh)) {
+			sql += "and fbjl.bbh < :beforeBbh ";
+		}
+		sql += "order by fbjl.bbh desc limit 1 ";
 		SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
 		sqlCmd.setInt("mkid", mkid);
 		sqlCmd.setInt("lcid", lcid);
+		if (StringUtil.notNull(beforeBbh)) {
+			sqlCmd.setInt("beforeBbh", beforeBbh);
+		}
 		
 		Map<String, Object> releaseMap = baseGdba.selectAsMap(sqlCmd);
 		if (StringUtil.isNull(releaseMap)) {
@@ -488,6 +499,13 @@ public class FlowService extends BaseTransaction {
 		return matcher.find() ? matcher.group(1) : null;
 	}
 
+	boolean looksMojibakeProcessName(String processName) {
+		return processName.indexOf("æ") >= 0
+				|| processName.indexOf("Ã") >= 0
+				|| processName.indexOf("Â") >= 0
+				|| processName.indexOf("�") >= 0;
+	}
+
 	@SuppressWarnings("unchecked")
 	void stripUnsupportedEndNodeMessageConfig(List<Map<String, List<Map<String, Object>>>> nodeReferDataList) {
 		if (StringUtil.isNull(nodeReferDataList) || nodeReferDataList.isEmpty()) {