审批流通知发起人

This commit is contained in:
GUO 2024-06-17 23:43:19 +08:00
parent 004dcc5f43
commit 6fc496adda
2 changed files with 19 additions and 15 deletions

View File

@ -491,7 +491,7 @@ public class AsyncHikvision {
} }
public void sendBatchWorkerInfo(List<UfaceDev> allDevList, List<WorkerInfo> workerList, List<JSONObject> workerAndDevSnList, Long userId, String projectSn, boolean isRetry) { public void sendBatchWorkerInfo(List<UfaceDev> allDevList, List<WorkerInfo> workerList, List<JSONObject> workerAndDevSnList, Long userId, String projectSn, boolean isRetry) {
this.sendBatchWorkerInfoAsync(allDevList, workerList, workerAndDevSnList, userId, projectSn, false, true); this.sendBatchWorkerInfoAsync(allDevList, workerList, workerAndDevSnList, userId, projectSn, false, true, null);
} }
/** /**
@ -503,9 +503,10 @@ public class AsyncHikvision {
* @param userId 批量下发的通知的人 * @param userId 批量下发的通知的人
* @param checkEditWorkers * @param checkEditWorkers
* @param sendNotice * @param sendNotice
* @param flowStartUser
*/ */
@Async("workerAuthHkExecutor") @Async("workerAuthHkExecutor")
public void sendBatchWorkerInfoAsync(List<UfaceDev> allDevList, List<WorkerInfo> workerList, List<JSONObject> workerAndDevSnList, Long userId, String projectSn, boolean checkEditWorkers, boolean sendNotice) { public void sendBatchWorkerInfoAsync(List<UfaceDev> allDevList, List<WorkerInfo> workerList, List<JSONObject> workerAndDevSnList, Long userId, String projectSn, boolean checkEditWorkers, boolean sendNotice, Long flowStartUser) {
try { try {
if (CollUtil.isNotEmpty(workerAndDevSnList)) { if (CollUtil.isNotEmpty(workerAndDevSnList)) {
ProjectInfoExtVo project = projectService.getProjectInfoBySn(projectSn); ProjectInfoExtVo project = projectService.getProjectInfoBySn(projectSn);
@ -540,7 +541,7 @@ public class AsyncHikvision {
})); }));
futures = new ArrayList<>(); futures = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> entry : devSnToJoMap.entrySet()) { for (Map.Entry<String, List<JSONObject>> entry : devSnToJoMap.entrySet()) {
Future future = asyncHikvision.sendBatchWorkersForOneDevAsync(workerIdMap, devSnMap, project, devSnToIscDevSnMap, entry, projectSn, sendNotice, workerList); Future future = asyncHikvision.sendBatchWorkersForOneDevAsync(workerIdMap, devSnMap, project, devSnToIscDevSnMap, entry, projectSn, sendNotice, workerList,flowStartUser);
futures.add(future); futures.add(future);
} }
for (Future future : futures) { for (Future future : futures) {
@ -567,7 +568,7 @@ public class AsyncHikvision {
log.error("批量下发权限失败:", e); log.error("批量下发权限失败:", e);
hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, workerList, 1, 1); hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, workerList, 1, 1);
hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, workerList, 1, 3); hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, workerList, 1, 3);
sendExcNotice(e, workerList, null, projectSn); sendExcNotice(e, workerList, null, projectSn,flowStartUser);
} }
} }
@ -578,8 +579,9 @@ public class AsyncHikvision {
* @param workerList * @param workerList
* @param dev * @param dev
* @param projectSn * @param projectSn
* @param flowStartUser
*/ */
private void sendExcNotice(Exception e, List<WorkerInfo> workerList, UfaceDev dev, String projectSn) { private void sendExcNotice(Exception e, List<WorkerInfo> workerList, UfaceDev dev, String projectSn, Long flowStartUser) {
String exc; String exc;
if (HttpUtils.isTimeOut(e)) { if (HttpUtils.isTimeOut(e)) {
exc = "连接ISC网络异常"; exc = "连接ISC网络异常";
@ -593,7 +595,7 @@ public class AsyncHikvision {
.in(WorkerInfo::getId, workerList.stream().map(WorkerInfo::getId).collect(Collectors.toList())) .in(WorkerInfo::getId, workerList.stream().map(WorkerInfo::getId).collect(Collectors.toList()))
); );
for (WorkerInfo workerInfo : failWorkers) { for (WorkerInfo workerInfo : failWorkers) {
Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(workerInfo.getNoticeUserId(), workerInfo.getProjectSn()); Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(flowStartUser, workerInfo.getProjectSn());
for (Long noticeUserId : noticeUserIds) { for (Long noticeUserId : noticeUserIds) {
noticeService.addUserNotice(noticeUserId, noticeService.addUserNotice(noticeUserId,
StrUtil.format("[{}]下发{}设备权限失败{}", workerInfo.getWorkerName(), dev != null ? "[" + dev.getDevName() + "]" : "有些", exc), StrUtil.format("[{}]下发{}设备权限失败{}", workerInfo.getWorkerName(), dev != null ? "[" + dev.getDevName() + "]" : "有些", exc),
@ -650,9 +652,10 @@ public class AsyncHikvision {
* @param devSnToJoEntry * @param devSnToJoEntry
* @param sendNotice * @param sendNotice
* @param workerList * @param workerList
* @param flowStartUser
*/ */
@Async("workerBeWaitHkExecutor") @Async("workerBeWaitHkExecutor")
public Future sendBatchWorkersForOneDevAsync(Map<String, WorkerInfo> workerIdMap, Map<String, UfaceDev> devSnMap, ProjectInfoExtVo project, Map<String, JSONObject> devSnToIscDevSnMap, Map.Entry<String, List<JSONObject>> devSnToJoEntry, String projectSn, boolean sendNotice, List<WorkerInfo> workerList) { public Future sendBatchWorkersForOneDevAsync(Map<String, WorkerInfo> workerIdMap, Map<String, UfaceDev> devSnMap, ProjectInfoExtVo project, Map<String, JSONObject> devSnToIscDevSnMap, Map.Entry<String, List<JSONObject>> devSnToJoEntry, String projectSn, boolean sendNotice, List<WorkerInfo> workerList, Long flowStartUser) {
String devSn = devSnToJoEntry.getKey(); String devSn = devSnToJoEntry.getKey();
UfaceDev dev = devSnMap.get(devSn); UfaceDev dev = devSnMap.get(devSn);
try { try {
@ -687,7 +690,7 @@ public class AsyncHikvision {
Set<String> rtWorkerIdSet; Set<String> rtWorkerIdSet;
if (CollUtil.isNotEmpty(qaiList)) { if (CollUtil.isNotEmpty(qaiList)) {
for (int i = 0; i < qaiList.size(); i++) { for (int i = 0; i < qaiList.size(); i++) {
handlerBatchWorkersResult(workerIdMap, qaiList, i, devSn, projectSn, addAuthWorkerIds, sendNotice, dev); handlerBatchWorkersResult(workerIdMap, qaiList, i, devSn, projectSn, addAuthWorkerIds, sendNotice, dev,flowStartUser);
} }
rtWorkerIdSet = qaiList.stream().map(o -> ((JSONObject) o).getString("personId")).collect(Collectors.toSet()); rtWorkerIdSet = qaiList.stream().map(o -> ((JSONObject) o).getString("personId")).collect(Collectors.toSet());
} else { } else {
@ -705,7 +708,7 @@ public class AsyncHikvision {
continue; continue;
} }
hikvisionCall.updateSuccessStatus(projectSn, Long.valueOf(workerId), 3, 3, devSn); hikvisionCall.updateSuccessStatus(projectSn, Long.valueOf(workerId), 3, 3, devSn);
Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(workerIdMap.get(workerId).getNoticeUserId(), projectSn); Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(flowStartUser, projectSn);
for (Long noticeUserId : noticeUserIds) { for (Long noticeUserId : noticeUserIds) {
noticeService.addUserNotice(noticeUserId, noticeService.addUserNotice(noticeUserId,
StrUtil.format("[{}]取消下发到[{}]{}", StrUtil.format("[{}]取消下发到[{}]{}",
@ -720,7 +723,7 @@ public class AsyncHikvision {
log.error("批量下发权限失败:", e); log.error("批量下发权限失败:", e);
hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, new ArrayList<>(workerIdMap.values()), 1, 1); hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, new ArrayList<>(workerIdMap.values()), 1, 1);
hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, new ArrayList<>(workerIdMap.values()), 1, 3); hikvisionCall.updateAllFailStatusIfNullForAuth(projectSn, new ArrayList<>(workerIdMap.values()), 1, 3);
sendExcNotice(e, workerList, dev, projectSn); sendExcNotice(e, workerList, dev, projectSn, flowStartUser);
} }
return null; return null;
} }
@ -761,8 +764,9 @@ public class AsyncHikvision {
* @param addAuthWorkerIds * @param addAuthWorkerIds
* @param sendNotice * @param sendNotice
* @param dev * @param dev
* @param flowStartUser
*/ */
public void handlerBatchWorkersResult(Map<String, WorkerInfo> workerIdMap, JSONArray qaiList, int i, String devSn, String projectSn, List<String> addAuthWorkerIds, boolean sendNotice, UfaceDev dev) { public void handlerBatchWorkersResult(Map<String, WorkerInfo> workerIdMap, JSONArray qaiList, int i, String devSn, String projectSn, List<String> addAuthWorkerIds, boolean sendNotice, UfaceDev dev, Long flowStartUser) {
JSONObject jo = qaiList.getJSONObject(i); JSONObject jo = qaiList.getJSONObject(i);
String personId = jo.getString("personId"); String personId = jo.getString("personId");
//人脸状态 //人脸状态
@ -787,7 +791,7 @@ public class AsyncHikvision {
} else { } else {
hikvisionCall.updateFailStatus(projectSn, Long.valueOf(personId), 3, 1, dev.getDevSn()); hikvisionCall.updateFailStatus(projectSn, Long.valueOf(personId), 3, 1, dev.getDevSn());
} }
Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(workerIdMap.get(personId).getNoticeUserId(), projectSn); Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(flowStartUser, projectSn);
for (Long noticeUserId : noticeUserIds) { for (Long noticeUserId : noticeUserIds) {
noticeService.addUserNotice(noticeUserId, noticeService.addUserNotice(noticeUserId,
StrUtil.format("[{}]下发到[{}]{}", StrUtil.format("[{}]下发到[{}]{}",
@ -803,7 +807,7 @@ public class AsyncHikvision {
} else { } else {
hikvisionCall.updateFailStatus(projectSn, Long.valueOf(personId), 3, 3, dev.getDevSn()); hikvisionCall.updateFailStatus(projectSn, Long.valueOf(personId), 3, 3, dev.getDevSn());
} }
Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(workerIdMap.get(personId).getNoticeUserId(), projectSn); Set<Long> noticeUserIds = hikvisionCall.getNoticeUserIds(flowStartUser, projectSn);
for (Long noticeUserId : noticeUserIds) { for (Long noticeUserId : noticeUserIds) {
noticeService.addUserNotice(noticeUserId, noticeService.addUserNotice(noticeUserId,
StrUtil.format("[{}]取消下发到[{}]{}", StrUtil.format("[{}]取消下发到[{}]{}",

View File

@ -535,7 +535,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
} }
} }
asyncHikvision.sendBatchWorkerInfoAsync(allDevList, workerList, workerAndDevSnList, userId, projectUfaceConfig.getProjectSn(), true, true); asyncHikvision.sendBatchWorkerInfoAsync(allDevList, workerList, workerAndDevSnList, userId, projectUfaceConfig.getProjectSn(), true, true, null);
} }
/** /**
@ -585,7 +585,7 @@ public class ProjectUfaceConfigServiceImpl extends ServiceImpl<ProjectUfaceConfi
log.info("未找到设备,无需下发,人员:{}", workerInfo.getWorkerName()); log.info("未找到设备,无需下发,人员:{}", workerInfo.getWorkerName());
return; return;
} }
asyncHikvision.sendBatchWorkerInfoAsync(allDevList, Collections.singletonList(workerInfo), workerAndDevSnList, null, projectSn, false, sendNotice); asyncHikvision.sendBatchWorkerInfoAsync(allDevList, Collections.singletonList(workerInfo), workerAndDevSnList, null, projectSn, false, sendNotice,workerInfo.getNoticeUserId());
} }
/** /**