Sfoglia il codice sorgente

修复文章流程收回失败

补齐 Article 对 guest_access_flag 和 sort_number 字段的 Long 类型映射,避免公共撤回查询反射 setter 失败。

流程动态跳转直接使用当前任务持有的流程定义,避免兼容流程别名造成 uniqueResult 查询不唯一;同时将两个修复类纳入 hxcs 编译、同步及校验清单。

Validation:
- ./local-run/bin/compile-hxcs-deploy-classes.sh
- bash -n local-run/bin/compile-hxcs-deploy-classes.sh local-run/bin/sync-to-hxcs-prod.sh
- git diff --check
- javap 核对 Article setter 与 CustomDynamicTransition
非繁 4 mesi fa
parent
commit
b9e91c83d9

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

@@ -15,9 +15,11 @@ if [[ -z "${JAVA_HOME}" || ! -x "${JAVA_HOME}/bin/javac" ]]; then
 fi
 
 SOURCES=(
+	"${PROJECT_ROOT}/src/apps/pojo/Article.java"
 	"${PROJECT_ROOT}/src/apps/pojo/Person.java"
 	"${PROJECT_ROOT}/src/apps/pojo/Website.java"
 	"${PROJECT_ROOT}/src/apps/pojo/WebsiteTemplate.java"
+	"${PROJECT_ROOT}/src/space/core/apps/bpm/core/listener/CustomDynamicTransition.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/basic/util/SortOrderUtil.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/template/ffkjschool01/WebSiteArticleService.java"
 	"${PROJECT_ROOT}/src/space/apps/moudules/website/template/ffkjcollege1/WebSiteArticleService.java"

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

@@ -316,9 +316,11 @@ sync_static_files() {
 
 	# 全局排序序号相关 Java 类
 	for class_path in \
+		"apps/pojo/Article.class" \
 		"apps/pojo/Person.class" \
 		"apps/pojo/Website.class" \
 		"apps/pojo/WebsiteTemplate.class" \
+		"space/core/apps/bpm/core/listener/CustomDynamicTransition.class" \
 		"space/apps/moudules/basic/util/SortOrderUtil.class" \
 		"space/apps/moudules/personnel/services/PersonService.class" \
 		"space/apps/moudules/personnel/services/PersonSelectService.class" \
@@ -818,6 +820,12 @@ WHERE cftcode IN (
 	verify_remote_file_checksum "文章保存服务 Java 类已部署" \
 		"WEB-INF/classes/space/apps/moudules/website/services/ArticleService.class" \
 		"${PROJECT_ROOT}/WebRoot/WEB-INF/classes/space/apps/moudules/website/services/ArticleService.class"
+	verify_remote_file_checksum "文章实体排序字段 Java 类已部署" \
+		"WEB-INF/classes/apps/pojo/Article.class" \
+		"${PROJECT_ROOT}/WebRoot/WEB-INF/classes/apps/pojo/Article.class"
+	verify_remote_file_checksum "流程动态收回 Java 类已部署" \
+		"WEB-INF/classes/space/core/apps/bpm/core/listener/CustomDynamicTransition.class" \
+		"${PROJECT_ROOT}/WebRoot/WEB-INF/classes/space/core/apps/bpm/core/listener/CustomDynamicTransition.class"
 	verify_remote_file_checksum "文章变动流程 Java 类已部署" \
 		"WEB-INF/classes/space/apps/moudules/website/services/flow/ArticleFlowService.class" \
 		"${PROJECT_ROOT}/WebRoot/WEB-INF/classes/space/apps/moudules/website/services/flow/ArticleFlowService.class"

+ 326 - 0
src/apps/pojo/Article.java

@@ -0,0 +1,326 @@
+package apps.pojo;
+
+import java.sql.Timestamp;
+import java.util.HashMap;
+
+import space.core.db.bean.base.PageBean;
+
+public class Article extends PageBean {
+	public String clsInfo;
+	private static final HashMap ARTICLE_FIELDS_MAPPING = new HashMap();
+
+	private Long articleid;
+	private Long dcode;
+	private Long websiteid;
+	private Long unitid;
+	private Long ascode;
+	private Long navigationid;
+	private String title;
+	private Long ajtcode;
+	private String desc;
+	private String source;
+	private String thumbnail;
+	private Long sticktop;
+	private Timestamp sticktopEndTime;
+	private Long sticktopSchedulesid;
+	private Long release;
+	private Timestamp releaseTime;
+	private Long releaseTaskSchedulesid;
+	private String content;
+	private String editContent;
+	private String url;
+	private Long readCount;
+	private Timestamp createTime;
+	private Timestamp lastChangeTime;
+	private Long createPid;
+	private Long lastChangePid;
+	private Long guestAccessFlag;
+	private Long sortNumber;
+
+	public Article() {
+		this.clsInfo = " SpaceCore Compatible Version; Date: 2026/07/19;";
+		this.setObjName("Article");
+		this.setDbTableName("article");
+		if (ARTICLE_FIELDS_MAPPING.size() == 0) {
+			ARTICLE_FIELDS_MAPPING.put("articleid", new String[] { "articleid", "articleid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("dcode", new String[] { "dcode", "dcode", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("websiteid", new String[] { "websiteid", "websiteid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("unitid", new String[] { "unitid", "unitid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("ascode", new String[] { "ascode", "ascode", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("navigationid", new String[] { "navigationid", "navigationid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("title", new String[] { "title", "title", "String" });
+			ARTICLE_FIELDS_MAPPING.put("ajtcode", new String[] { "ajtcode", "ajtcode", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("desc", new String[] { "desc", "desc", "String" });
+			ARTICLE_FIELDS_MAPPING.put("source", new String[] { "source", "source", "String" });
+			ARTICLE_FIELDS_MAPPING.put("thumbnail", new String[] { "thumbnail", "thumbnail", "String" });
+			ARTICLE_FIELDS_MAPPING.put("sticktop", new String[] { "sticktop", "sticktop", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("sticktopEndTime", new String[] { "sticktop_end_time", "sticktopEndTime", "Timestamp" });
+			ARTICLE_FIELDS_MAPPING.put("sticktopSchedulesid", new String[] { "sticktop_schedulesid", "sticktopSchedulesid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("release", new String[] { "release", "release", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("releaseTime", new String[] { "release_time", "releaseTime", "Timestamp" });
+			ARTICLE_FIELDS_MAPPING.put("releaseTaskSchedulesid", new String[] { "release_task_schedulesid", "releaseTaskSchedulesid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("content", new String[] { "content", "content", "String" });
+			ARTICLE_FIELDS_MAPPING.put("editContent", new String[] { "edit_content", "editContent", "String" });
+			ARTICLE_FIELDS_MAPPING.put("url", new String[] { "url", "url", "String" });
+			ARTICLE_FIELDS_MAPPING.put("readCount", new String[] { "read_count", "readCount", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("createTime", new String[] { "create_time", "createTime", "Timestamp" });
+			ARTICLE_FIELDS_MAPPING.put("lastChangeTime", new String[] { "last_change_time", "lastChangeTime", "Timestamp" });
+			ARTICLE_FIELDS_MAPPING.put("createPid", new String[] { "create_pid", "createPid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("lastChangePid", new String[] { "last_change_pid", "lastChangePid", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("guestAccessFlag", new String[] { "guest_access_flag", "guestAccessFlag", "Long" });
+			ARTICLE_FIELDS_MAPPING.put("sortNumber", new String[] { "sort_number", "sortNumber", "Long" });
+		}
+	}
+
+	public HashMap getFieldMap() {
+		return ARTICLE_FIELDS_MAPPING;
+	}
+
+	public int getFieldMappingCount() {
+		return ARTICLE_FIELDS_MAPPING.size();
+	}
+
+	public Object[] getFieldMappingItems() {
+		return ARTICLE_FIELDS_MAPPING.values().toArray();
+	}
+
+	public String[] getFieldMappingItem(String key) {
+		return (String[]) ARTICLE_FIELDS_MAPPING.get(key);
+	}
+
+	public Long getDbObjectId() {
+		return articleid;
+	}
+
+	public void setDbObjectId(Long articleid) {
+		this.articleid = articleid;
+	}
+
+	public String getDbObjectIdName() {
+		return "articleid";
+	}
+
+	public String getObjectIdName() {
+		return "articleid";
+	}
+
+	public Long getArticleid() {
+		return articleid;
+	}
+
+	public void setArticleid(Long articleid) {
+		this.articleid = articleid;
+	}
+
+	public Long getDcode() {
+		return dcode;
+	}
+
+	public void setDcode(Long dcode) {
+		this.dcode = dcode;
+	}
+
+	public Long getWebsiteid() {
+		return websiteid;
+	}
+
+	public void setWebsiteid(Long websiteid) {
+		this.websiteid = websiteid;
+	}
+
+	public Long getUnitid() {
+		return unitid;
+	}
+
+	public void setUnitid(Long unitid) {
+		this.unitid = unitid;
+	}
+
+	public Long getAscode() {
+		return ascode;
+	}
+
+	public void setAscode(Long ascode) {
+		this.ascode = ascode;
+	}
+
+	public Long getNavigationid() {
+		return navigationid;
+	}
+
+	public void setNavigationid(Long navigationid) {
+		this.navigationid = navigationid;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public Long getAjtcode() {
+		return ajtcode;
+	}
+
+	public void setAjtcode(Long ajtcode) {
+		this.ajtcode = ajtcode;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+	public String getSource() {
+		return source;
+	}
+
+	public void setSource(String source) {
+		this.source = source;
+	}
+
+	public String getThumbnail() {
+		return thumbnail;
+	}
+
+	public void setThumbnail(String thumbnail) {
+		this.thumbnail = thumbnail;
+	}
+
+	public Long getSticktop() {
+		return sticktop;
+	}
+
+	public void setSticktop(Long sticktop) {
+		this.sticktop = sticktop;
+	}
+
+	public Timestamp getSticktopEndTime() {
+		return sticktopEndTime;
+	}
+
+	public void setSticktopEndTime(Timestamp sticktopEndTime) {
+		this.sticktopEndTime = sticktopEndTime;
+	}
+
+	public Long getSticktopSchedulesid() {
+		return sticktopSchedulesid;
+	}
+
+	public void setSticktopSchedulesid(Long sticktopSchedulesid) {
+		this.sticktopSchedulesid = sticktopSchedulesid;
+	}
+
+	public Long getRelease() {
+		return release;
+	}
+
+	public void setRelease(Long release) {
+		this.release = release;
+	}
+
+	public Timestamp getReleaseTime() {
+		return releaseTime;
+	}
+
+	public void setReleaseTime(Timestamp releaseTime) {
+		this.releaseTime = releaseTime;
+	}
+
+	public Long getReleaseTaskSchedulesid() {
+		return releaseTaskSchedulesid;
+	}
+
+	public void setReleaseTaskSchedulesid(Long releaseTaskSchedulesid) {
+		this.releaseTaskSchedulesid = releaseTaskSchedulesid;
+	}
+
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public String getEditContent() {
+		return editContent;
+	}
+
+	public void setEditContent(String editContent) {
+		this.editContent = editContent;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public Long getReadCount() {
+		return readCount;
+	}
+
+	public void setReadCount(Long readCount) {
+		this.readCount = readCount;
+	}
+
+	public Timestamp getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Timestamp createTime) {
+		this.createTime = createTime;
+	}
+
+	public Timestamp getLastChangeTime() {
+		return lastChangeTime;
+	}
+
+	public void setLastChangeTime(Timestamp lastChangeTime) {
+		this.lastChangeTime = lastChangeTime;
+	}
+
+	public Long getCreatePid() {
+		return createPid;
+	}
+
+	public void setCreatePid(Long createPid) {
+		this.createPid = createPid;
+	}
+
+	public Long getLastChangePid() {
+		return lastChangePid;
+	}
+
+	public void setLastChangePid(Long lastChangePid) {
+		this.lastChangePid = lastChangePid;
+	}
+
+	public Long getGuestAccessFlag() {
+		return guestAccessFlag;
+	}
+
+	public void setGuestAccessFlag(Long guestAccessFlag) {
+		this.guestAccessFlag = guestAccessFlag;
+	}
+
+	public Long getSortNumber() {
+		return sortNumber;
+	}
+
+	public void setSortNumber(Long sortNumber) {
+		this.sortNumber = sortNumber;
+	}
+
+	public String toString() {
+		return "Article[articleid=" + articleid + "]";
+	}
+}

+ 88 - 0
src/space/core/apps/bpm/core/listener/CustomDynamicTransition.java

@@ -0,0 +1,88 @@
+package space.core.apps.bpm.core.listener;
+
+import org.jbpm.api.TaskService;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.api.model.Activity;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+public class CustomDynamicTransition implements Command<String> {
+	private static final long serialVersionUID = 1L;
+
+	private final String taskId;
+	private final String state;
+
+	public CustomDynamicTransition(String taskId, String state) {
+		this.taskId = taskId;
+		this.state = state;
+	}
+
+	public String execute(Environment environment) throws Exception {
+		try {
+			TaskService taskService = environment.get(TaskService.class);
+			TaskImpl task = (TaskImpl) taskService.getTask(taskId);
+			if (task == null) {
+				throw new Exception("未找到待收回的流程任务");
+			}
+
+			ExecutionImpl processInstance = task.getProcessInstance();
+			if (processInstance == null) {
+				throw new Exception("未找到待收回的流程实例");
+			}
+
+			// 当前任务已经持有准确的流程定义,避免通过 deployprop 的兼容别名重复查询。
+			ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition();
+			if (processDefinition == null) {
+				throw new Exception("未找到待收回的流程定义");
+			}
+
+			ActivityImpl endActivity = findEndActivity(processDefinition);
+			if (endActivity == null) {
+				throw new Exception("流程定义缺少结束节点");
+			}
+
+			ActivityImpl currentActivity = processInstance.getActivity();
+			if (currentActivity != null) {
+				addWithdrawTransition(currentActivity, endActivity);
+			} else {
+				for (Activity activity : processDefinition.getActivities()) {
+					if ("task".equals(activity.getType())) {
+						addWithdrawTransition((ActivityImpl) activity, endActivity);
+					}
+				}
+			}
+
+			return endActivity.getDescription();
+		} catch (Exception e) {
+			e.printStackTrace();
+			String message = e.getMessage();
+			if (message == null || message.trim().length() == 0) {
+				message = e.getClass().getSimpleName();
+			}
+			throw new Exception("撤回失败:" + message, e);
+		}
+	}
+
+	private ActivityImpl findEndActivity(ProcessDefinitionImpl processDefinition) {
+		for (Activity activity : processDefinition.getActivities()) {
+			if ("end".equals(activity.getType())) {
+				return (ActivityImpl) activity;
+			}
+		}
+		return null;
+	}
+
+	private void addWithdrawTransition(ActivityImpl source, ActivityImpl destination) {
+		TransitionImpl transition = source.getOutgoingTransition(state);
+		if (transition == null) {
+			transition = source.createOutgoingTransition();
+			transition.setName(state);
+		}
+		transition.setSource(source);
+		transition.setDestination(destination);
+	}
+}