Przeglądaj źródła

修复: 解决海康请假补偿SQL重复命名参数导致的本地启动异常

1. 调整 HkLeaveAuthServ.selPendingLeaveAuthItemRowList 的 SQL 绑定参数,将重复复用的 :nowTs 拆分为 :priorityNowTs 与 :retryNowTs,避免当前 SqlCmd/Oracle 组合下出现缺少 IN/OUT 参数异常。

2. 补充 docs/2026-06-16_海康请假补偿批次优先级修复.md,记录本次本地启动报错现象、根因和补充修复口径,方便后续定位同类定时任务异常。

3. 验证:已本地重新编译 HkLeaveAuthServ.java,通过;本次修复针对分钟补偿任务启动 SQL 绑定异常,未改动海康 add/search/delete 主链路。
“gaohp” 5 miesięcy temu
rodzic
commit
bf2d3bc72c

+ 20 - 0
docs/2026-06-16_海康请假补偿批次优先级修复.md

@@ -53,3 +53,23 @@
 ## 说明
 ## 说明
 
 
 本次改动只修补偿批次优先级,不改变海康 `auth_config/add/search/delete` 主链路,不影响请假回收和销假联动逻辑。
 本次改动只修补偿批次优先级,不改变海康 `auth_config/add/search/delete` 主链路,不影响请假回收和销假联动逻辑。
+
+## 2026-06-16 补充修复
+
+首次落地后,本地启动在执行 `hkkq_leave_auth_pending` 时出现 Oracle 绑定参数异常:
+
+- `java.sql.SQLException: 缺少 IN 或 OUT 参数:: 1`
+
+原因不是业务筛选条件本身,而是 `SqlCmd/Db` 在当前环境下对同名命名参数的重复绑定处理不稳定。本次 SQL 同时在 `case` 和 `where` 中多次复用了 `:nowTs`,导致 Oracle 预编译执行时出现参数缺失。
+
+补充处理:
+
+1. 将重复使用的 `:nowTs` 拆成独立参数名:
+   - `:priorityNowTs`
+   - `:retryNowTs`
+2. 保留原筛选语义不变,只修正参数绑定口径
+
+补充验证:
+
+- 已本地重新编译 `HkLeaveAuthServ.java`,通过
+- 该修复用于消除本地/正式环境分钟任务启动时的 SQL 绑定异常

+ 4 - 2
src/biz/kq/HkLeaveAuthServ.java

@@ -3558,7 +3558,7 @@ public class HkLeaveAuthServ extends Serv {
                 + " case"
                 + " case"
                 + " when nvl(item.SYNC_STAGE,'pending')='pending' then 0"
                 + " when nvl(item.SYNC_STAGE,'pending')='pending' then 0"
                 + " when item.NEXT_RETRY_TIME is null then 1"
                 + " when item.NEXT_RETRY_TIME is null then 1"
-                + " when item.NEXT_RETRY_TIME<=:nowTs then 2"
+                + " when item.NEXT_RETRY_TIME<=:priorityNowTs then 2"
                 + " else 9 end pendingPriority"
                 + " else 9 end pendingPriority"
                 + " from RCHKLA_ITEM item"
                 + " from RCHKLA_ITEM item"
                 + " join RC rc on rc.RCID=item.RCID"
                 + " join RC rc on rc.RCID=item.RCID"
@@ -3567,11 +3567,13 @@ public class HkLeaveAuthServ extends Serv {
                 + " and nvl(item.DELETE_CONFIRMED,0)=0"
                 + " and nvl(item.DELETE_CONFIRMED,0)=0"
                 + " and (nvl(item.PLATFORM_CONFIG_CONFIRMED,0)=0 or nvl(item.CONFIG_SEARCH_MATCHED,0)=0)"
                 + " and (nvl(item.PLATFORM_CONFIG_CONFIRMED,0)=0 or nvl(item.CONFIG_SEARCH_MATCHED,0)=0)"
                 + " and nvl(item.SYNC_STAGE,'pending') in ('pending','accepted','retrying')"
                 + " and nvl(item.SYNC_STAGE,'pending') in ('pending','accepted','retrying')"
-                + " and (nvl(item.SYNC_STAGE,'pending')='pending' or item.NEXT_RETRY_TIME is null or item.NEXT_RETRY_TIME<=:nowTs)"
+                + " and (nvl(item.SYNC_STAGE,'pending')='pending' or item.NEXT_RETRY_TIME is null or item.NEXT_RETRY_TIME<=:retryNowTs)"
                 + " order by pendingPriority asc,item.AUTH_BEG asc,item.ITEM_ID asc"
                 + " order by pendingPriority asc,item.AUTH_BEG asc,item.ITEM_ID asc"
                 + " ) where rownum<=:limit";
                 + " ) where rownum<=:limit";
         SqlCmd sqlCmd = new SqlCmd(sql);
         SqlCmd sqlCmd = new SqlCmd(sql);
         sqlCmd.wrTimeParm("nowTs", now);
         sqlCmd.wrTimeParm("nowTs", now);
+        sqlCmd.wrTimeParm("priorityNowTs", now);
+        sqlCmd.wrTimeParm("retryNowTs", now);
         sqlCmd.wrTimeParm("windowEndTs", windowEnd);
         sqlCmd.wrTimeParm("windowEndTs", windowEnd);
         sqlCmd.wrIntParm("limit", Math.max(1, limit));
         sqlCmd.wrIntParm("limit", Math.max(1, limit));
         List<Map<String, Object>> rowList = gdba.doSelMapListByC(sqlCmd);
         List<Map<String, Object>> rowList = gdba.doSelMapListByC(sqlCmd);