|
|
@@ -96,6 +96,14 @@ public class HkLeaveAuthServ extends Serv {
|
|
|
return ServC.SERV_notByA;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 2026-05-26:手工查询特殊人员权限下发结果,便于拿到配置后快速回查海康任务状态。
|
|
|
+ */
|
|
|
+ public String viewLeaveAuthSyncResult() {
|
|
|
+ super.wrJsonByResp(viewLeaveAuthSyncResultData());
|
|
|
+ return ServC.SERV_notByA;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 2026-05-26:预览态统一走同一套组装逻辑,便于和真实下发保持一致。
|
|
|
*/
|
|
|
@@ -302,6 +310,53 @@ public class HkLeaveAuthServ extends Serv {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 2026-05-26:单独开放结果查询口,避免每次都必须先真实下发才能查看海康侧异步结果。
|
|
|
+ */
|
|
|
+ private Map<String, Object> viewLeaveAuthSyncResultData() {
|
|
|
+ long rcid = rdReqLongParm("rcid");
|
|
|
+ if (rcid <= 0) {
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
+ result.put("ok", false);
|
|
|
+ result.put("msg", "缺少有效的 rcid 参数。");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> overrideParm = makeReqOverrideParm();
|
|
|
+ try {
|
|
|
+ Map<String, Object> result = buildLeaveAuthSyncResult(rcid, false, overrideParm);
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Map<String, Object> queryReq = (Map<String, Object>) result.get("authDownloadResultQueryReq");
|
|
|
+ if (queryReq == null) {
|
|
|
+ result.put("ok", false);
|
|
|
+ result.put("msg", "未能组装下发结果查询条件。");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> hkConnParm = rdHkConnParm();
|
|
|
+ if (hkConnParm == null) {
|
|
|
+ result.put("ok", false);
|
|
|
+ result.put("msg", "缺少海康连接配置,请补齐 hk.host / hk.appKey / hk.appSecret。");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ String tagId = rdCfgOrOverride(overrideParm, "tagId", CFG_TAG_ID, "HK_LEAVE_AUTH_TAG_ID");
|
|
|
+ if (StringUtils.isNotBlank(tagId))
|
|
|
+ hkConnParm.put("tagId", tagId);
|
|
|
+
|
|
|
+ result.put("mode", "viewResult");
|
|
|
+ result.put("authDownloadResultQueryResp",
|
|
|
+ HK_API_CLIENT.viewSpecialPersonAuthDownloadResult(hkConnParm, queryReq));
|
|
|
+ return result;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log4j.error("HkLeaveAuthServ.viewLeaveAuthSyncResultData() 异常,rcid={}", rcid, e);
|
|
|
+ Map<String, Object> result = new LinkedHashMap<>();
|
|
|
+ result.put("ok", false);
|
|
|
+ result.put("msg", e.getMessage());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 2026-05-26:统一组装请假权限同步结果,预览和真实执行共用这条链路。
|
|
|
*/
|
|
|
@@ -411,10 +466,16 @@ public class HkLeaveAuthServ extends Serv {
|
|
|
if (StringUtils.isBlank(effectiveTemplateId))
|
|
|
missingCfgList.add("templateId");
|
|
|
result.put("missingConfig", missingCfgList);
|
|
|
+ result.put("nextSteps", makeNextStepList(missingCfgList));
|
|
|
+ result.put("tagIdAdvice", "当前项目只做接口下发时,tagId 只要海康侧提供可用值即可;若还要求平台门禁管理可见,再评估是否改成 acs。");
|
|
|
+ result.put("templateIdAdvice", "templateId 需要海康侧在门禁权限模板中提供,当前 single/search 不能稳定自动探测。");
|
|
|
+ result.put("executeApiPath", "/artemis/api/acps/v1/authDownload/special/person/diy");
|
|
|
+ result.put("resultApiPath", "/artemis/api/acps/v1/authDownload/special/person/diy/result");
|
|
|
|
|
|
Map<String, Object> payload = makeSpecialAuthPayload(
|
|
|
ctx, personInfo, personId, resourceInfoList, tagId, callbackUrl, effectiveTemplateId, templateDimension);
|
|
|
result.put("payload", payload);
|
|
|
+ result.put("authDownloadResultQueryReq", makeAuthDownloadResultQueryReq(personId, resourceInfoList));
|
|
|
|
|
|
if (StringUtils.isBlank(tagId) || StringUtils.isBlank(effectiveTemplateId)) {
|
|
|
result.put("skipReason", "缺少海康下发配置,暂不执行 special/person/diy。");
|
|
|
@@ -617,6 +678,25 @@ public class HkLeaveAuthServ extends Serv {
|
|
|
return row;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 2026-05-26:把当前缺少的配置转换成可执行的下一步,减少联调时反复口头确认。
|
|
|
+ */
|
|
|
+ private static List<String> makeNextStepList(List<String> missingCfgList) {
|
|
|
+ List<String> nextStepList = new ArrayList<>();
|
|
|
+ if (missingCfgList == null || missingCfgList.isEmpty()) {
|
|
|
+ nextStepList.add("已具备海康下发参数,可直接调用 hkkq_leave_auth_execute 做人工联调。");
|
|
|
+ nextStepList.add("下发后可调用 hkkq_leave_auth_result 查看海康侧结果。");
|
|
|
+ return nextStepList;
|
|
|
+ }
|
|
|
+ if (missingCfgList.contains("tagId"))
|
|
|
+ nextStepList.add("联系海康侧提供当前合作方账号可用的 tagId。");
|
|
|
+ if (missingCfgList.contains("templateId"))
|
|
|
+ nextStepList.add("联系海康侧提供门禁权限模板 templateId,或在平台门禁权限模板中确认后填写。");
|
|
|
+ nextStepList.add("配置补齐前可继续使用 hkkq_leave_auth_preview / hkkq_leave_auth_diag 做联调。");
|
|
|
+ nextStepList.add("配置补齐后先调用 hkkq_leave_auth_execute,再调用 hkkq_leave_auth_result 回查。");
|
|
|
+ return nextStepList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 2026-05-26:single/search 需要“人员 + 单个门禁资源”的精确查询体。
|
|
|
* 2026-05-26:这里按海康文档只传最小查询字段,不再把 channelIndexCodes 混进 single/search。
|