diff --git a/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java b/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java index 2dab5639d..9fdb44652 100644 --- a/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java +++ b/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java @@ -146,7 +146,7 @@ public class AsyncHikvision { if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), msg, title, type); } - hikvisionCall.updateAllFailStatusIfNullByNow(workerInfo.getProjectSn(), workerInfo.getId(), 1, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); + hikvisionCall.updateAllFailStatusIfNull(workerInfo.getProjectSn(), workerInfo.getId(), 1); } @Async("hikvisionExecutor") @@ -192,7 +192,7 @@ public class AsyncHikvision { if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), msg, title, type); } - hikvisionCall.updateAllFailStatusIfNullByNow(carInfo.getProjectSn(), carInfo.getId(), 4, getSyncTimeWithInitIfAbsent(2, carInfo.getId())); + hikvisionCall.updateAllFailStatusIfNull(carInfo.getProjectSn(), carInfo.getId(), 4); } @Async("carInfoExecutor") @@ -359,7 +359,7 @@ public class AsyncHikvision { } else { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), e.getMessage(), "人员下发设备提醒", "1"); } - hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); + hikvisionCall.updateAllFailStatusIfNullForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); return; } @@ -379,7 +379,7 @@ public class AsyncHikvision { if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type); } - hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); + hikvisionCall.updateAllFailStatusIfNullForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 1, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); } catch (Exception e) { log.error("海康:", e); } @@ -422,7 +422,7 @@ public class AsyncHikvision { } else { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), e.getMessage(), "人员下发设备提醒", "1"); } - hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); + hikvisionCall.updateAllFailStatusIfNullForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); return; } @@ -442,7 +442,7 @@ public class AsyncHikvision { if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) { noticeService.addUserNotice(ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class).getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type); } - hikvisionCall.updateAllFailStatusIfNullByNowForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); + hikvisionCall.updateAllFailStatusIfNullForAuth(workerInfo.getProjectSn(), workerInfo.getId(), 3, 3, getSyncTimeWithInitIfAbsent(1, workerInfo.getId())); } catch (Exception e) { log.error("海康:", e); } diff --git a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java index 29b27eb55..b9cf2a4ff 100644 --- a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java +++ b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java @@ -1001,9 +1001,9 @@ public class HikvisionCall { } if (setSuc) { - updateSuccessStatusByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); + updateSuccessStatus(carInfo.getProjectSn(), carInfo.getId(), type, operate, null); } else { - updateFailStatusByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); + updateFailStatus(carInfo.getProjectSn(), carInfo.getId(), type, operate, null); } xzHikvisionCompareDataService.compareRetryStatus(carInfo, type, operate, setSuc); @@ -1125,10 +1125,10 @@ public class HikvisionCall { } } if (success) { - updateSuccessStatusByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); + updateSuccessStatus(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, null); xzHikvisionCompareDataService.compareRetryStatus(); } else { - updateFailStatusByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); + updateFailStatus(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, null); xzHikvisionCompareDataService.compareRetryFail(); } if (ThreadLocalUtil.getByKey(Cts.TL_AUTH_USER, UserInfo.class) != null) { @@ -1136,7 +1136,7 @@ public class HikvisionCall { } } - public void updateAllFailStatusIfNullByNowForAuth(String projectSn, Long whoId, Integer bigType, Integer operate, Date now) { + public void updateAllFailStatusIfNullForAuth(String projectSn, Long whoId, Integer bigType, Integer operate, Date now) { xzHikvisionSyncMapper.update(null, new LambdaUpdateWrapper() .set(XzHikvisionSync::getIsSuccess, 0) .isNull(XzHikvisionSync::getIsSuccess) @@ -1146,42 +1146,33 @@ public class HikvisionCall { .eq(XzHikvisionSync::getWhoId, whoId) .eq(XzHikvisionSync::getCreateDate, now) ); - updateTotalStatus(projectSn, whoId, bigType, now); + updateTotalStatus(projectSn, whoId, bigType); } - public void updateAllFailStatusIfNullByNow(String projectSn, Long whoId, Integer bigType, Date now) { + public void updateAllFailStatusIfNull(String projectSn, Long whoId, Integer bigType) { xzHikvisionSyncMapper.update(null, new LambdaUpdateWrapper() .set(XzHikvisionSync::getIsSuccess, 0) .isNull(XzHikvisionSync::getIsSuccess) .eq(XzHikvisionSync::getProjectSn, projectSn) .eq(XzHikvisionSync::getWhoId, whoId) - .eq(XzHikvisionSync::getCreateDate, now) + .eq(XzHikvisionSync::getBigType, bigType) ); - updateTotalStatus(projectSn, whoId, bigType, now); + updateTotalStatus(projectSn, whoId, bigType); } - public void updateFailStatusByNow(String projectSn, Long whoId, Integer type, Date now, String deviceSn) { - updateFailStatusByNow(projectSn, whoId, type, null, now, deviceSn); + public void updateFailStatus(String projectSn, Long whoId, Integer type, Integer operate, String deviceSn) { + updateStatus(projectSn, whoId, type, operate, deviceSn, false); } - public void updateFailStatusByNow(String projectSn, Long whoId, Integer type, Integer operate, Date now, String deviceSn) { - updateStatusByNow(projectSn, whoId, type, operate, now, deviceSn, false); + public void updateSuccessStatus(String projectSn, Long whoId, Integer type, Integer operate, String deviceSn) { + updateStatus(projectSn, whoId, type, operate, deviceSn, true); } - public void updateSuccessStatusByNow(String projectSn, Long whoId, Integer type, Date now, String deviceSn) { - updateSuccessStatusByNow(projectSn, whoId, type, null, now, deviceSn); - } - - public void updateSuccessStatusByNow(String projectSn, Long whoId, Integer type, Integer operate, Date now, String deviceSn) { - updateStatusByNow(projectSn, whoId, type, operate, now, deviceSn, true); - } - - private void updateStatusByNow(String projectSn, Long whoId, Integer type, Integer operate, Date now, String deviceSn, Boolean isSuccess) { + private void updateStatus(String projectSn, Long whoId, Integer type, Integer operate, String deviceSn, Boolean isSuccess) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(XzHikvisionSync::getProjectSn, projectSn) .eq(XzHikvisionSync::getWhoId, whoId) .eq(XzHikvisionSync::getType, type) - .eq(XzHikvisionSync::getCreateDate, now) .eq(StringUtils.isNotBlank(deviceSn), XzHikvisionSync::getDeviceSn, deviceSn); if (operate != null) { if (operate == 3) { @@ -1197,14 +1188,14 @@ public class HikvisionCall { xzHikvisionSync.setIsSuccess(isSuccess ? 1 : 0); xzHikvisionSyncMapper.updateById(xzHikvisionSync); - updateTotalStatus(projectSn, whoId, type, now); + updateTotalStatus(projectSn, whoId, xzHikvisionSync.getBigType()); } - public void updateTotalStatus(String projectSn, Long whoId, Integer bigType, Date now) { + public void updateTotalStatus(String projectSn, Long whoId, Integer bigType) { List xzHikvisionSyncs = xzHikvisionSyncMapper.selectList(new LambdaQueryWrapper() .eq(XzHikvisionSync::getProjectSn, projectSn) .eq(XzHikvisionSync::getWhoId, whoId) - .eq(XzHikvisionSync::getCreateDate, now) + .eq(XzHikvisionSync::getBigType, bigType) ); Integer sendSuccessStatus = null; if (CollUtil.isEmpty(xzHikvisionSyncs)) { @@ -1218,7 +1209,7 @@ public class HikvisionCall { } else { sendSuccessStatus = 3; } - if (bigType >= 4) { + if (Objects.equals(bigType, 2)) { carInfoMapper.update(null, new LambdaUpdateWrapper() .eq(CarInfo::getId, whoId) .set(CarInfo::getSendSuccessStatus, sendSuccessStatus) @@ -2199,7 +2190,7 @@ public class HikvisionCall { } private void updateSucForUpdatePersonAuth(WorkerInfo workerInfo, String devSn, int i) { - updateSuccessStatusByNow(workerInfo.getProjectSn(), workerInfo.getId(), 3, i == 0 ? 1 : 3, AsyncHikvision.getSyncTime(), devSn); + updateSuccessStatus(workerInfo.getProjectSn(), workerInfo.getId(), 3, i == 0 ? 1 : 3, devSn); } } diff --git a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java index de9b3e42b..703a7729a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/worker/service/impl/WorkerInfoServiceImpl.java @@ -475,7 +475,7 @@ public class WorkerInfoServiceImpl extends ServiceImpl= 4) { + //车辆 CarInfo carInfo = carInfoMapper.selectById(whoId); if (carInfo == null) { return; @@ -196,6 +194,7 @@ public class XzHikvisionSyncServiceImpl extends ServiceImpl() .eq(Project::getProjectSn, workerInfo.getProjectSn())