Sfoglia il codice sorgente

优化文章历史流程加载并修复招聘公告数据

- 将文章查看/变动的历史流程查询由逐条审计子查询改为批量查询
- 增加 apply、audit 和文章 URL 查询索引
- 保存文章时校验站内图片文件真实存在并阻止重复正文 URL
- 修复招聘公告重复文章、6条自动越过未收口流程及有效正文路径
- 本地增加索引初始化和问题验收报告

Validation:
- Java 服务编译通过
- 本地索引计划从全表扫描变为索引范围扫描
- 42 篇带历史流程文章旧新查询结果逐项对比无差异
- 本地一键启动和后台文章变动弹窗通过
非繁 1 settimana fa
parent
commit
cc34b9e6af

+ 9 - 0
LOCAL_RUN_NOTES.md

@@ -1426,3 +1426,12 @@ order by ifnull(n.parent_nid,0),n.sort_number,n.navigationid;
 - `local-run/bin/start-full-local.sh` 已接入卫健本地预览与组件绑定 SQL,并修复共享 `ffkjxingong1` 配置后信工模板修复 SQL 的重复 `id_code` 问题。
 - 本地验证:55/55 栏目、154/154 站内文章、三档视口均通过;信工本地预览站保持蓝色主题。
 - 详细报告:`local-run/reports/weijian-template-20261118/README.md`。
+
+## 2026-11-19 人事处招聘公告后台卡顿优化
+
+- 根因:文章查看/变动同步加载全部流程历史,`apply`、`audit` 缺少索引且逐条执行关联子查询;招聘公告旧查询超过 120 秒。
+- 已将历史流程改为两条批量查询,并新增文章流程、审计和重复 URL 查询索引。
+- 保存文章时新增站内正文图片文件存在性校验,并阻止同站点重复正文 URL。
+- 新增生产数据修复迁移,保留 `49656` 最新元数据、接回有效正文文件、软停用 `20557`,并收口 6 条自动越过流程。
+- 本地编译、索引计划、旧新查询结果逐项对比和后台变动弹窗均通过。
+- 报告:`local-run/reports/hr-recruit-article-optimization-20261119/README.md`。

+ 10 - 0
local-run/bin/start-full-local.sh

@@ -493,6 +493,15 @@ SQL
 	fi
 }
 
+ensure_zq_local_article_flow_indexes() {
+	log "检查文章历史流程查询索引..."
+	local index_sql="${PROJECT_ROOT}/local-run/repairs/2026-11-19-article-flow-history-indexes.sql"
+	if [[ -f "${index_sql}" ]]; then
+		local_mysql_exec -e "source ${index_sql}"
+	fi
+	log "文章历史流程查询索引已就绪。"
+}
+
 ensure_zq_local_personnel_schema() {
 	log "校准 ZQ 本地人员表兼容字段..."
 	local_mysql_exec spaceappsv1 <<'SQL'
@@ -3368,6 +3377,7 @@ main() {
 		init_mysql_if_needed
 		start_mysql
 		ensure_database_imported
+		ensure_zq_local_article_flow_indexes
 		ensure_zq_local_personnel_schema
 		ensure_zq_local_admin_credentials
 		ensure_zq_local_article_direct_release_flow

+ 54 - 0
local-run/migrations/hxcs-mig-next/2026-11-19-007-optimize-article-flow-history.sql

@@ -0,0 +1,54 @@
+-- 优化文章查看/变动时的历史流程查询与重复 URL 校验。
+-- 本迁移由 HXCS 发布脚本在 core 库上下文执行,表名必须显式指向 apps 库。
+SET NAMES utf8mb4;
+
+SET @apps_schema := 'sp_gzhx_apps_mig_next';
+
+SET @sql := IF(
+  EXISTS(
+    SELECT 1 FROM information_schema.statistics
+    WHERE table_schema = @apps_schema
+      AND table_name = 'apply'
+      AND index_name = 'idx_apply_article_history'
+  ),
+  'SELECT 1',
+  'ALTER TABLE `sp_gzhx_apps_mig_next`.`apply` ADD INDEX `idx_apply_article_history` (`table_name`(64), `table_key`(64), `table_key_value`, `dcode`, `create_time`)'
+);
+PREPARE stmt FROM @sql;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+SET @sql := IF(
+  EXISTS(
+    SELECT 1 FROM information_schema.statistics
+    WHERE table_schema = @apps_schema
+      AND table_name = 'audit'
+      AND index_name = 'idx_audit_apply_history'
+  ),
+  'SELECT 1',
+  'ALTER TABLE `sp_gzhx_apps_mig_next`.`audit` ADD INDEX `idx_audit_apply_history` (`applyid`, `dcode`, `acode`, `audit_time`, `steps`)'
+);
+PREPARE stmt FROM @sql;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+SET @sql := IF(
+  EXISTS(
+    SELECT 1 FROM information_schema.statistics
+    WHERE table_schema = @apps_schema
+      AND table_name = 'article'
+      AND index_name = 'idx_article_website_url'
+  ),
+  'SELECT 1',
+  'ALTER TABLE `sp_gzhx_apps_mig_next`.`article` ADD INDEX `idx_article_website_url` (`websiteid`, `url`(128), `dcode`, `articleid`)'
+);
+PREPARE stmt FROM @sql;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+SELECT table_name, index_name, GROUP_CONCAT(column_name ORDER BY seq_in_index) AS columns
+FROM information_schema.statistics
+WHERE table_schema = @apps_schema
+  AND index_name IN ('idx_apply_article_history', 'idx_audit_apply_history', 'idx_article_website_url')
+GROUP BY table_name, index_name
+ORDER BY table_name, index_name;

+ 79 - 0
local-run/migrations/hxcs-mig-next/2026-11-19-008-repair-hr-recruit-article.sql

@@ -0,0 +1,79 @@
+-- 修复人事处招聘公告重复记录和 6 条未收口的自动越过流程。
+-- 保留 49656 的最新元数据;正文暂接回 20557 的真实存在文件,再软停用 20557。
+SET NAMES utf8mb4;
+
+CREATE TABLE IF NOT EXISTS sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_article_backup
+LIKE sp_gzhx_apps_mig_next.article;
+
+INSERT IGNORE INTO sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_article_backup
+SELECT * FROM sp_gzhx_apps_mig_next.article WHERE articleid IN (20557, 49656);
+
+CREATE TABLE IF NOT EXISTS sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_apply_backup
+LIKE sp_gzhx_apps_mig_next.apply;
+
+INSERT IGNORE INTO sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_apply_backup
+SELECT ap.*
+FROM sp_gzhx_apps_mig_next.apply ap
+WHERE ap.table_name = 'article' AND ap.table_key = 'articleid'
+  AND ap.table_key_value IN ('20557', '49656');
+
+CREATE TABLE IF NOT EXISTS sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_audit_backup
+LIKE sp_gzhx_apps_mig_next.audit;
+
+INSERT IGNORE INTO sp_gzhx_apps_mig_next.hotfix_20261119_hr_recruit_audit_backup
+SELECT au.*
+FROM sp_gzhx_apps_mig_next.audit au
+JOIN sp_gzhx_apps_mig_next.apply ap ON ap.applyid = au.applyid
+WHERE ap.table_name = 'article' AND ap.table_key = 'articleid'
+  AND ap.table_key_value IN ('20557', '49656');
+
+START TRANSACTION;
+
+UPDATE sp_gzhx_apps_mig_next.article latest
+JOIN sp_gzhx_apps_mig_next.article legacy ON legacy.articleid = 20557
+SET latest.content = legacy.content,
+    latest.edit_content = legacy.edit_content,
+    latest.read_count = GREATEST(IFNULL(latest.read_count, 0), IFNULL(legacy.read_count, 0)),
+    latest.thumbnail = CASE
+      WHEN latest.thumbnail IS NULL OR latest.thumbnail = '' THEN legacy.thumbnail
+      ELSE latest.thumbnail
+    END
+WHERE latest.articleid = 49656
+  AND latest.dcode = 61
+  AND legacy.dcode = 61;
+
+UPDATE sp_gzhx_apps_mig_next.apply ap
+JOIN (
+  SELECT ap2.applyid, MAX(au.audit_time) AS end_time
+  FROM sp_gzhx_apps_mig_next.apply ap2
+  JOIN sp_gzhx_apps_mig_next.audit au ON au.applyid = ap2.applyid AND au.dcode <> 72
+  WHERE ap2.applyid IN (1040729, 1040747, 1040876, 1040882, 1040883, 1040892)
+  GROUP BY ap2.applyid
+  HAVING COUNT(*) = 1
+     AND SUM(au.acode = 111) = 1
+     AND SUM(au.audit_time IS NULL) = 0
+) repaired ON repaired.applyid = ap.applyid
+SET ap.ascode = 41,
+    ap.end_time = repaired.end_time
+WHERE ap.ascode = 11;
+
+UPDATE sp_gzhx_apps_mig_next.article_copy
+SET dcode = 72
+WHERE articleid = 20557 AND dcode <> 72;
+
+UPDATE sp_gzhx_apps_mig_next.article
+SET dcode = 72,
+    last_change_time = NOW()
+WHERE articleid = 20557 AND dcode <> 72;
+
+COMMIT;
+
+SELECT 'active_articles' AS check_name, articleid, dcode, ascode, title, content, edit_content, thumbnail
+FROM sp_gzhx_apps_mig_next.article
+WHERE articleid IN (20557, 49656)
+ORDER BY articleid;
+
+SELECT 'active_flows' AS check_name, COUNT(*) AS count
+FROM sp_gzhx_apps_mig_next.apply ap
+WHERE ap.table_name = 'article' AND ap.table_key = 'articleid'
+  AND ap.table_key_value = '49656' AND ap.dcode <> 72 AND ap.ascode = 11;

+ 31 - 0
local-run/repairs/2026-11-19-article-flow-history-indexes.sql

@@ -0,0 +1,31 @@
+-- 本地 ZQ:文章历史流程与重复 URL 查询索引。
+USE spaceappsv1;
+SET NAMES utf8mb4;
+
+SET @sql := IF(
+  EXISTS(SELECT 1 FROM information_schema.statistics WHERE table_schema='spaceappsv1' AND table_name='apply' AND index_name='idx_apply_article_history'),
+  'SELECT 1',
+  'ALTER TABLE `spaceappsv1`.`apply` ADD INDEX `idx_apply_article_history` (`table_name`(64), `table_key`(64), `table_key_value`, `dcode`, `create_time`)'
+);
+PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
+
+SET @sql := IF(
+  EXISTS(SELECT 1 FROM information_schema.statistics WHERE table_schema='spaceappsv1' AND table_name='audit' AND index_name='idx_audit_apply_history'),
+  'SELECT 1',
+  'ALTER TABLE `spaceappsv1`.`audit` ADD INDEX `idx_audit_apply_history` (`applyid`, `dcode`, `acode`, `audit_time`, `steps`)'
+);
+PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
+
+SET @sql := IF(
+  EXISTS(SELECT 1 FROM information_schema.statistics WHERE table_schema='spaceappsv1' AND table_name='article' AND index_name='idx_article_website_url'),
+  'SELECT 1',
+  'ALTER TABLE `spaceappsv1`.`article` ADD INDEX `idx_article_website_url` (`websiteid`, `url`(128), `dcode`, `articleid`)'
+);
+PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
+
+SELECT table_name,index_name,GROUP_CONCAT(column_name ORDER BY seq_in_index) columns
+FROM information_schema.statistics
+WHERE table_schema='spaceappsv1'
+  AND index_name IN ('idx_apply_article_history','idx_audit_apply_history','idx_article_website_url')
+GROUP BY table_name,index_name
+ORDER BY table_name,index_name;

+ 45 - 0
local-run/reports/hr-recruit-article-optimization-20261119/README.md

@@ -0,0 +1,45 @@
+# 人事处招聘公告后台卡顿与图片恢复
+
+日期:2026-11-19
+环境:本地 ZQ、华夏正式生产环境
+
+## 问题
+
+文章《广州华夏职业学院2026年秋季招聘公告》在后台“查看”和“变动”时长时间转圈,正文招聘图片及应聘申请表附件返回 404。
+
+## 根因
+
+- `ArticleService.info()` 会同步加载文章全部历史流程。
+- 原 `getArticleFlowList()` 对每条 `apply` 分别执行两个 `audit` 关联子查询。
+- 生产环境 `apply` 约 2.4 万行、`audit` 约 40 万行,缺少文章历史查询和 `audit.applyid` 索引。
+- `EXPLAIN` 显示 `apply` 扫描 24,157 行、`audit` 扫描 328,140 行。
+- 文章 `20557` 的旧完整查询实测超过 120 秒仍未返回。
+- 同一 URL 存在 `20557`、`49656` 两条文章;`49656` 有 6 条“自动越过”但未收口的流程,且今天保存的正文文件不存在。
+- 图片 `1793256541377015428.png` 和附件 `1789085492068045266.doc` 在旧站暂存快照中存在,但未恢复到当前双节点。
+
+## 修改
+
+- 后台历史流程改为两条批量查询:先取 `apply`,再按文章一次性取 `audit`,在 Java 内组装当前审核人和最新审计节点。
+- 新增索引:
+  - `apply(table_name, table_key, table_key_value, dcode, create_time)`
+  - `audit(applyid, dcode, acode, audit_time, steps)`
+  - `article(websiteid, url, dcode, articleid)`
+- 保存文章时校验 `/web/upload/` 图片文件真实存在。
+- 保存文章时阻止同一网站出现重复正文 URL。
+- 数据修复保留 `49656` 的最新元数据,正文暂接回 `20557` 的有效文件,并软停用重复记录 `20557`。
+- 将 6 条仅包含 `acode=111` 自动越过、且无待办任务的流程标记为自动越过结束。
+
+## 待恢复文件
+
+旧站暂存快照中的有效文件:
+
+- 图片:586,228 bytes,SHA-256 `e4e1b8d91d2fbef59ae48f57f15f23bb08e36f97cfe10203c891f193e0518e95`
+- 附件:51,200 bytes,SHA-256 `334f70f7c833a71ec18a39e4845dc68401e5988429c790db23b8563cfbd9f208`
+
+## 本地验证
+
+- Java 服务编译通过。
+- 本地索引创建成功,执行计划已使用新增索引。
+- 本地 42 篇带历史流程文章执行旧查询与新批量化算法逐项对比,字段差异 0。
+- 一键启动通过,后台登录和文章“变动”弹窗正常打开。
+- 本地文章变动请求约 134 ms。

+ 158 - 16
src/space/apps/moudules/website/services/ArticleService.java

@@ -1,6 +1,7 @@
 package space.apps.moudules.website.services;
 
 import java.io.File;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.sql.Timestamp;
@@ -13,6 +14,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.regex.Pattern;
 
 import com.google.gson.JsonObject;
@@ -227,6 +229,67 @@ public class ArticleService extends BaseTransaction {
                 setResponsePackage(getResponseWarningMsgPackage("正文中存在未上传完成或失效的图片,请重新上传"));
                 return false;
             }
+
+            String effectiveSource = StringUtil.notNull(src) && !src.startsWith("data:") ? src : originalSrc;
+            String localPath = extractLocalUploadPath(effectiveSource);
+            if (StringUtil.notNull(localPath)) {
+                File imageFile = new File(getWebRootPath() + localPath);
+                if (!imageFile.exists() || !imageFile.isFile()) {
+                    setResponsePackage(getResponseWarningMsgPackage("正文图片文件不存在,请重新上传:" + localPath));
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    private String extractLocalUploadPath(String source) {
+        if (StringUtil.isNull(source)) {
+            return null;
+        }
+        String value = source.trim();
+        if (!value.startsWith("/web/upload/")) {
+            return null;
+        }
+        int queryIndex = value.indexOf('?');
+        if (queryIndex >= 0) {
+            value = value.substring(0, queryIndex);
+        }
+        int fragmentIndex = value.indexOf('#');
+        if (fragmentIndex >= 0) {
+            value = value.substring(0, fragmentIndex);
+        }
+        try {
+            return URLDecoder.decode(value, "UTF-8");
+        } catch (Exception e) {
+            return value;
+        }
+    }
+
+    private boolean verifyArticleUrlUnique(GeneralDBAccess gdba, Article article, WebsiteNavigation navigation)
+            throws Exception {
+        if (navigation == null || article == null || article.getAjtcode() == null
+                || article.getAjtcode().equals(10020L) || StringUtil.isNull(article.getUrl())) {
+            return true;
+        }
+        String sql = " select articleid, title from article"
+                + " where websiteid = :websiteid and dcode = 61 and url = :url";
+        if (article.getArticleid() != null) {
+            sql += " and articleid <> :articleid";
+        }
+        sql += " limit 1";
+        SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
+        sqlCmd.setString("websiteid", navigation.getWebsiteid());
+        sqlCmd.setString("url", article.getUrl());
+        if (article.getArticleid() != null) {
+            sqlCmd.setString("articleid", article.getArticleid());
+        }
+        Map<String, Object> duplicate = gdba.selectAsMap(sqlCmd);
+        if (duplicate != null) {
+            setResponsePackage(getResponseWarningMsgPackage("同一网站已存在相同正文地址的文章:"
+                    + firstNotBlank(duplicate.get("title"), article.getUrl())
+                    + ",请先处理重复文章后再保存"));
+            return false;
         }
         return true;
     }
@@ -293,6 +356,9 @@ public class ArticleService extends BaseTransaction {
         if (!article.getAjtcode().equals(10020L)) {
             article.setUrl(WebsiteTemplateArticleUtil.getArticleURL(wn));
         }
+        if (!verifyArticleUrlUnique(gdba, article, wn)) {
+            return DEFAULT_FORWARD;
+        }
 
 //		if (StringUtil.isNull(article.getReleaseTime())) {
 //			article.setReleaseTime(nowTimestamp);
@@ -439,6 +505,9 @@ public class ArticleService extends BaseTransaction {
         }
 
         verifyArticleUrl(article, a2, wn);
+        if (!verifyArticleUrlUnique(gdba, article, wn)) {
+            return DEFAULT_FORWARD;
+        }
 
         saveArticleDesc(article, content);
 
@@ -688,6 +757,9 @@ public class ArticleService extends BaseTransaction {
                 buildArticleChangeLogContent(a2, nowTimestamp));
 
         verifyArticleUrl(article, a2, wn);
+        if (!verifyArticleUrlUnique(gdba, article, wn)) {
+            return DEFAULT_FORWARD;
+        }
 
         saveArticleContentFiles(article, content);
 
@@ -995,13 +1067,9 @@ public class ArticleService extends BaseTransaction {
     }
 
     private List<Map<String, Object>> getArticleFlowList(GeneralDBAccess gdba, Long articleid) throws Exception {
-        String sql = " select ap.applyid, ap.ascode, "
+        String applySql = " 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 '停用审核' "
@@ -1016,23 +1084,97 @@ public class ArticleService extends BaseTransaction {
                 + "   else 'info' "
                 + " end as statusType, "
                 + " date_format(ap.create_time, '%Y-%m-%d %H:%i:%s') as createTime, "
-                + " ifnull(date_format(ap.end_time, '%Y-%m-%d %H:%i:%s'), '') as endTime, "
-                + " 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.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 "
+                + " ifnull(date_format(ap.end_time, '%Y-%m-%d %H:%i:%s'), '') as endTime "
                 + " 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 ";
-        SqlCommandImpl sqlCmd = new SqlCommandImpl(sql);
-        sqlCmd.setString("articleid", articleid);
-        return gdba.selectAsMapList(sqlCmd);
+        SqlCommandImpl applyCmd = new SqlCommandImpl(applySql);
+        applyCmd.setString("articleid", articleid);
+        List<Map<String, Object>> applyList = gdba.selectAsMapList(applyCmd);
+        if (applyList == null || applyList.isEmpty()) {
+            return new ArrayList<Map<String, Object>>();
+        }
+
+        String auditSql = " select au.applyid, au.auditid, au.dcode, au.acode, au.audit_time, au.steps, "
+                + " cp.name as auditorName "
+                + " from audit au "
+                + " join apply ap on ap.applyid = au.applyid "
+                + " left join person cp on cp.personid = au.personid "
+                + " where ap.dcode <> 72 and ap.table_name = 'article' and ap.table_key = 'articleid' "
+                + " and ap.table_key_value = :articleid and au.dcode <> 72 "
+                + " order by au.applyid, au.auditid ";
+        SqlCommandImpl auditCmd = new SqlCommandImpl(auditSql);
+        auditCmd.setString("articleid", articleid);
+        List<Map<String, Object>> auditList = gdba.selectAsMapList(auditCmd);
+        Map<Long, List<Map<String, Object>>> auditsByApply = new HashMap<Long, List<Map<String, Object>>>();
+        if (auditList != null) {
+            for (Map<String, Object> audit : auditList) {
+                Long applyId = parseLong(audit.get("applyid"));
+                if (applyId == null) {
+                    continue;
+                }
+                List<Map<String, Object>> audits = auditsByApply.get(applyId);
+                if (audits == null) {
+                    audits = new ArrayList<Map<String, Object>>();
+                    auditsByApply.put(applyId, audits);
+                }
+                audits.add(audit);
+            }
+        }
+
+        for (Map<String, Object> apply : applyList) {
+            Long applyId = parseLong(apply.get("applyid"));
+            String applyStatus = firstNotBlank(apply.get("ascode"), "");
+            List<Map<String, Object>> audits = auditsByApply.get(applyId);
+            TreeSet<String> auditorNames = new TreeSet<String>();
+            Long latestAuditId = 0L;
+            int latestPriority = Integer.MAX_VALUE;
+            long latestSteps = Long.MIN_VALUE;
+
+            if (audits != null) {
+                for (Map<String, Object> audit : audits) {
+                    String auditDcode = firstNotBlank(audit.get("dcode"), "");
+                    String auditAcode = firstNotBlank(audit.get("acode"), "");
+                    boolean waitingAudit = "11".equals(applyStatus) && "31".equals(auditDcode)
+                            && audit.get("audit_time") == null
+                            && ("51".equals(auditAcode) || "101".equals(auditAcode));
+                    if (waitingAudit) {
+                        String auditorName = firstNotBlank(audit.get("auditorName"), "");
+                        if (!auditorName.isEmpty()) {
+                            auditorNames.add(auditorName);
+                        }
+                    }
+
+                    int priority = audit.get("audit_time") != null ? 1 : 2;
+                    if (waitingAudit) {
+                        priority = 0;
+                    }
+                    long steps = 0L;
+                    Long stepValue = parseLong(audit.get("steps"));
+                    if (stepValue != null) {
+                        steps = stepValue.longValue();
+                    }
+                    Long auditId = parseLong(audit.get("auditid"));
+                    long auditIdValue = auditId == null ? 0L : auditId.longValue();
+                    long latestAuditIdValue = latestAuditId == null ? 0L : latestAuditId.longValue();
+                    if (priority < latestPriority
+                            || (priority == latestPriority && steps > latestSteps)
+                            || (priority == latestPriority && steps == latestSteps
+                                    && auditIdValue > latestAuditIdValue)) {
+                        latestPriority = priority;
+                        latestSteps = steps;
+                        latestAuditId = auditId;
+                    }
+                }
+            }
+
+            apply.put("currentAuditors", String.join("、", auditorNames));
+            apply.put("auditid", latestAuditId == null ? 0L : latestAuditId);
+        }
+        return applyList;
     }
 
     /**