Explorar o código

修正文章流程状态与审核人员展示

修正流程页签字段映射,显示发起人、当前审核人和自动完成流程说明。\n避免自动完成流程被重新覆盖为审核中,并增加幂等迁移修复历史错误状态。\n\nValidation:\n- Java 编译通过\n- 本地完整后台、MySQL、Redis 均运行正常\n- http://localhost:4188/ 返回 HTTP 200\n- 本地流程状态不一致数据为 0
非繁 hai 4 meses
pai
achega
947c532802

+ 12 - 10
WebRoot/web/subassembly/app/pc/10021/10106/1002110106_run.jsp

@@ -480,18 +480,23 @@
 							<div class="article-flow-toolbar">
 								<el-select v-model="activeFlowApplyid" class="article-flow-select" size="small">
 									<el-option v-for="item in articleFlowList" :key="item.applyid"
-										:label="item.flowName + ' · ' + item.statusName + ' · ' + item.createTime"
+										:label="item.flowname + ' · ' + item.statusname + ' · ' + item.createtime"
 										:value="String(item.applyid)">
 									</el-option>
 								</el-select>
-								<el-tag v-if="activeFlow" :type="activeFlow.statusType" effect="plain" size="small">
-									{{activeFlow.statusName}}
+								<el-tag v-if="activeFlow" :type="activeFlow.statustype" effect="plain" size="small">
+									{{activeFlow.statusname}}
 								</el-tag>
 								<span v-if="activeFlow" class="article-flow-time">
-									发起:{{activeFlow.createTime}}<span v-if="activeFlow.endTime"> 结束:{{activeFlow.endTime}}</span>
+									发起人:{{activeFlow.initiatorname}} 发起:{{activeFlow.createtime}}<span v-if="activeFlow.endtime"> 结束:{{activeFlow.endtime}}</span>
+									<span v-if="activeFlow.currentauditors"> 当前审核人:{{activeFlow.currentauditors}}</span>
 								</span>
 							</div>
 							<iframe v-if="activeFlowUrl" class="article-flow-frame" :src="activeFlowUrl" frameborder="0"></iframe>
+							<div v-else class="article-flow-empty">
+								<i class="el-icon-time"></i>
+								<span>{{Number(activeFlow.ascode) === 11 ? '当前流程尚未生成审核节点' : '该流程由系统自动完成,无人工审核记录'}}</span>
+							</div>
 						</template>
 						<div v-else class="article-flow-empty">
 							<i class="el-icon-time"></i><span>该文章尚未发起审核流程</span>
@@ -549,14 +554,11 @@
 				});
 			},
 			activeFlowUrl: function() {
-				if (!this.activeFlow) {
+				if (!this.activeFlow || Number(this.activeFlow.auditid) <= 0) {
 					return '';
 				}
-				var url = '/app/flow/time/?applyid=' + encodeURIComponent(this.activeFlow.applyid);
-				if (Number(this.activeFlow.auditid) > 0) {
-					url += '&auditid=' + encodeURIComponent(this.activeFlow.auditid);
-				}
-				return url;
+				return '/app/flow/time/?applyid=' + encodeURIComponent(this.activeFlow.applyid)
+					+ '&auditid=' + encodeURIComponent(this.activeFlow.auditid);
 			}
 		},
 		methods: {

+ 37 - 0
local-run/migrations/2026-07-18-001-fix-auto-completed-article-status.sql

@@ -0,0 +1,37 @@
+-- 修复无需人工审批、已自动完成的文章流程被错误保留为“审核中”。
+-- 可重复执行:仅处理最新文章流程已结束、且文章仍为在用待审的数据。
+
+SET NAMES utf8mb4;
+USE sp_gzhx_apps;
+
+UPDATE article a
+JOIN (
+  SELECT table_key_value AS articleid, MAX(applyid) AS latest_applyid
+  FROM apply
+  WHERE dcode <> 72
+    AND table_name = 'article'
+    AND table_key = 'articleid'
+  GROUP BY table_key_value
+) latest ON latest.articleid = a.articleid
+JOIN apply ap ON ap.applyid = latest.latest_applyid
+SET a.dcode = 61
+WHERE a.dcode = 31
+  AND a.ascode = 10010
+  AND ap.ascode IN (41, 51)
+  AND ap.end_time IS NOT NULL;
+
+SELECT COUNT(*) AS remaining_inconsistent_articles
+FROM article a
+JOIN (
+  SELECT table_key_value AS articleid, MAX(applyid) AS latest_applyid
+  FROM apply
+  WHERE dcode <> 72
+    AND table_name = 'article'
+    AND table_key = 'articleid'
+  GROUP BY table_key_value
+) latest ON latest.articleid = a.articleid
+JOIN apply ap ON ap.applyid = latest.latest_applyid
+WHERE a.dcode = 31
+  AND a.ascode = 10010
+  AND ap.ascode IN (41, 51)
+  AND ap.end_time IS NOT NULL;

+ 7 - 1
src/space/apps/moudules/website/services/ArticleService.java

@@ -960,6 +960,11 @@ public class ArticleService extends BaseTransaction {
     private List<Map<String, Object>> getArticleFlowList(GeneralDBAccess gdba, Long articleid) throws Exception {
         String sql = " select ap.applyid, ap.ascode, "
                 + " coalesce(asc1.name, '未知状态') as statusName, "
+                + " coalesce(initp.name, '未知') as initiatorName, "
+                + " coalesce((select group_concat(distinct cp.name order by cp.name separator '、') "
+                + "   from audit cau join person cp on cp.personid = cau.personid "
+                + "   where ap.ascode = 11 and cau.applyid = ap.applyid and cau.dcode = 31 "
+                + "   and cau.audit_time is null and cau.acode in (51, 101)), '') as currentAuditors, "
                 + " case "
                 + "   when lower(ap.flow_key) like '%articlechange%' then '变动审核' "
                 + "   when lower(ap.flow_key) like '%articledisable%' then '停用审核' "
@@ -978,12 +983,13 @@ public class ArticleService extends BaseTransaction {
                 + " ifnull((select au.auditid from audit au "
                 + "   where au.applyid = ap.applyid and au.dcode <> 72 "
                 + "   order by case "
-                + "     when ap.ascode = 11 and au.audit_time is null and au.acode in (51, 101) then 0 "
+                + "     when ap.ascode = 11 and au.dcode = 31 and au.audit_time is null and au.acode in (51, 101) then 0 "
                 + "     when au.audit_time is not null then 1 "
                 + "     else 2 end, "
                 + "   ifnull(au.steps, 0) desc, au.auditid desc limit 1), 0) as auditid "
                 + " from apply ap "
                 + " left join apply_status_code asc1 on asc1.apply_status_code = ap.ascode "
+                + " left join person initp on initp.personid = ap.personid "
                 + " where ap.dcode <> 72 and ap.table_name = 'article' and ap.table_key = 'articleid' "
                 + " and ap.table_key_value = :articleid "
                 + " order by case when ap.ascode = 11 then 0 else 1 end, ap.create_time desc, ap.applyid desc ";

+ 1 - 1
src/space/apps/moudules/website/services/flow/ArticleFlowService.java

@@ -344,7 +344,7 @@ public class ArticleFlowService extends BaseTransaction {
 
 			// 录入(11)/待提交(12) 发起时 BpmProcessPageBeanUtil 只会写成 21,父列表仍显示可再次申请;统一落为审核中(31)
 			article = getArticleById(gdba, startProcess.getId());
-			if (!Long.valueOf(dataStatusCode.USE_AUDIT.getCode()).equals(article.getDcode())) {
+			if (Long.valueOf(dataStatusCode.INSERT_AUDIT.getCode()).equals(article.getDcode())) {
 				article.setDcode(dataStatusCode.USE_AUDIT.getCode());
 				Set<String> dcodeFields = new HashSet<String>();
 				dcodeFields.add("dcode");