From 85bea4d7d352b45acc91ba8e2c06034710434781 Mon Sep 17 00:00:00 2001 From: GUO <1923636941@qq.com> Date: Sat, 1 Jun 2024 17:04:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E6=B5=B7=E5=BA=B7=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zhgd/xmgl/async/AsyncHikvision.java | 42 +++---- .../com/zhgd/xmgl/call/HikvisionCall.java | 108 ++++++++++-------- .../car/service/impl/CarInfoServiceImpl.java | 1 + 3 files changed, 81 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java b/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java index 33fc484d7..f9988d87d 100644 --- a/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java +++ b/src/main/java/com/zhgd/xmgl/async/AsyncHikvision.java @@ -115,8 +115,8 @@ public class AsyncHikvision { public void addWorkerForHikvision(WorkerInfo workerInfo) { getSyncTimeWithInitIfAbsent(1, workerInfo.getId()); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(1).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(1).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(1).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); asyncHikvision.addWorkerForHikvisionAsync(workerInfo); } @@ -132,8 +132,8 @@ public class AsyncHikvision { public void editWorkerForHikvision(WorkerInfo workerInfo) { getSyncTimeWithInitIfAbsent(1, workerInfo.getId()); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(2).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(2).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(2).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); asyncHikvision.editWorkerForHikvisionAsync(workerInfo); } @@ -166,8 +166,8 @@ public class AsyncHikvision { public void deleteWorkerForHikvision(WorkerInfo workerInfo) { getSyncTimeWithInitIfAbsent(1, workerInfo.getId()); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(3).setWhoId(workerInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(1).setOperate(3).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(2).setOperate(3).setWhoId(workerInfo.getId()).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); asyncHikvision.deleteWorkerForHikvisionAsync(workerInfo); } @@ -176,12 +176,11 @@ public class AsyncHikvision { deleteCarInfoForHikvision(carInfo, true); } else { if (Objects.equals(carInfo.getCarModuleType(), 1)) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(1).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(1).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(1).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(1).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); } else if (Objects.equals(carInfo.getCarModuleType(), 2) || Objects.equals(carInfo.getCarModuleType(), 3)) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(1).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(1).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); } - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); asyncHikvision.addCarInfoForHikvisionAsyc(carInfo); } } @@ -223,17 +222,18 @@ public class AsyncHikvision { } public void editCarInfoForHikvision(CarInfo carInfo, CarInfo old) { - if (carInfo.getIsBlack() == 1) { deleteCarInfoForHikvision(carInfo, true); } else { if (Objects.equals(carInfo.getCarModuleType(), 1)) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(2).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(1).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(2).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(1).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); } else if (Objects.equals(carInfo.getCarModuleType(), 2) || Objects.equals(carInfo.getCarModuleType(), 3)) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(1).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(1).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + } + if (old.getIsBlack() == 1) { + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); } - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); asyncHikvision.editCarInfoForHikvisionAsync(carInfo, old); } } @@ -249,10 +249,10 @@ public class AsyncHikvision { } public void deleteCarInfoForHikvision(CarInfo carInfo, boolean isSetBlack) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(isSetBlack ? 1 : 3).setWhoId(carInfo.getId()).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(4).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(5).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(6).setOperate(3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(carInfo.getProjectSn()).setType(7).setOperate(isSetBlack ? 1 : 3).setWhoId(carInfo.getId()).setBigType(2).setCreateDate(getSyncTimeWithInitIfAbsent(2, carInfo.getId()))); asyncHikvision.deleteCarInfoForHikvisionAsync(carInfo, isSetBlack); } @@ -389,7 +389,7 @@ public class AsyncHikvision { getSyncTimeWithInitIfAbsent(1, workerInfo.getId()); String[] devSnArr = StringUtils.split(devSn, ","); for (String ds : devSnArr) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(1).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(1).setWhoId(workerInfo.getId()).setDeviceSn(ds).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); } asyncHikvision.addPersonAuthAsync(workerInfo, devSn); } @@ -449,7 +449,7 @@ public class AsyncHikvision { getSyncTimeWithInitIfAbsent(1, workerInfo.getId()); String[] devSnArr = StringUtils.split(devSns, ","); for (String ds : devSnArr) { - xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(3).setWhoId(workerInfo.getId()).setDeviceSn(ds).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); + xzHikvisionSyncMapper.insert(new XzHikvisionSync().setProjectSn(workerInfo.getProjectSn()).setType(3).setOperate(3).setWhoId(workerInfo.getId()).setDeviceSn(ds).setBigType(1).setCreateDate(getSyncTimeWithInitIfAbsent(1, workerInfo.getId()))); } asyncHikvision.deletePersonAuthAsync(workerInfo, devSns); } diff --git a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java index 39f9e788d..467c169c1 100644 --- a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java +++ b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java @@ -988,15 +988,11 @@ public class HikvisionCall { return rs; } - private void sendNoticeAndSetStatusForCarInfo(String title, String rs, CarInfo carInfo, Integer type, Integer operate) { - sendNoticeAndSetStatusForCarInfo(title, rs, carInfo, type, operate, null); - } - - public void sendNoticeAndSetStatusForCarInfo(String title, String rs, CarInfo carInfo, Integer type, Integer operate, Boolean success) { + public void sendNoticeAndSetStatusForCarInfo(String title, String rs, CarInfo carInfo, Integer type, Integer operate, Boolean setSuc, boolean isNotice) { String msg; - if (success == null) { + if (setSuc == null) { + setSuc = false; boolean callSuc = HikvisionUtil.isSuccess(rs); - success = false; JSONObject jo = JSONObject.parseObject(rs); String code = jo.getString("code"); if (callSuc) { @@ -1015,24 +1011,26 @@ public class HikvisionCall { } else { msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); title += "成功"; - success = true; + setSuc = true; } } else { msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); title += "成功"; - success = true; + setSuc = true; } } else { if (Objects.equals(code, "0x00072202")) { msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); title += "成功"; - success = true; + setSuc = true; + isNotice = false; } else if (Objects.equals(code, "0x02e33900")) { String msg1 = jo.getString("msg"); if (Objects.equals(msg1, "reservation record not existed or overdued!")) { msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); title += "成功"; - success = true; + setSuc = true; + isNotice = false; } else if (Objects.equals(msg1, "Car reservation failed! The plateNo has reserved in the parking!")) { msg = "同步失败,车牌号码:" + carInfo.getCarNumber() + "。失败原因:车辆预约记录已存在"; title += "失败"; @@ -1052,7 +1050,7 @@ public class HikvisionCall { } } } else { - if (success) { + if (setSuc) { msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); title += "成功"; } else { @@ -1061,19 +1059,21 @@ public class HikvisionCall { } } - if (success) { + if (setSuc) { updateSuccessStatusByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); } else { updateFailStatusByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, AsyncHikvision.getSyncTime(), null); } - if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { - noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "24"); - } else if (carInfo.getUserIds() != null && carInfo.getUserIds().size() > 0) { - for (String userId : carInfo.getUserIds()) { - noticeService.addUserNotice(Long.valueOf(userId), msg, title, "24"); + if (isNotice) { + if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { + noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "24"); + } else if (carInfo.getUserIds() != null && carInfo.getUserIds().size() > 0) { + for (String userId : carInfo.getUserIds()) { + noticeService.addUserNotice(Long.valueOf(userId), msg, title, "24"); + } + } else if (carInfo.getCreateBy() != null) { + noticeService.addUserNotice(carInfo.getCreateBy(), msg, title, "24"); } - } else if (carInfo.getCreateBy() != null) { - noticeService.addUserNotice(carInfo.getCreateBy(), msg, title, "24"); } } @@ -1434,11 +1434,11 @@ public class HikvisionCall { cancelCharge(project, carInfo); if (Objects.equals(carInfo.getCarModuleType(), 1)) { //删除预约车辆 - deleteReservationCarFromHttp(carInfo, project); + deleteReservationCarFromHttp(carInfo, project, true); saveFixedCar(carInfo, project); saveBindCategory(carInfo, project); } else if (Objects.equals(carInfo.getCarModuleType(), 2) || Objects.equals(carInfo.getCarModuleType(), 3)) { - bindCarOrNot(project, 2, carInfo); + unbindCar(project, carInfo); deleteFixedCarForHikvision(carInfo, project); saveReservationCar(project, carInfo); } @@ -1469,20 +1469,20 @@ public class HikvisionCall { addJo.put("driverPhone", c.getDriverTelephone()); addJo.put("plateNo", carInfo.getCarNumber()); JSONObject rs = addAlarmCarForHttp(project, addJo); - sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", rs.toJSONString(), carInfo, 7, null); + sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", rs.toJSONString(), carInfo, 7, null, null, true); } else { - sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", null, carInfo, 7, null, true); + sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", null, carInfo, 7, null, true, false); } } else { if (carInfo.getIsBlack() == 1) { - sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", null, carInfo, 7, null, true); + sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", null, carInfo, 7, null, true, true); } else { JSONObject joOne = listJa.getJSONObject(0); String alarmSyscode = joOne.getString("alarmSyscode"); JSONObject deleteJo = new JSONObject(); deleteJo.put("alarmSyscodes", alarmSyscode); JSONObject rs = this.deletionAlarmCarForHttp(project, deleteJo); - sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", rs.toJSONString(), carInfo, 7, null); + sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", rs.toJSONString(), carInfo, 7, null, null, true); } } } else { @@ -1495,9 +1495,9 @@ public class HikvisionCall { private void failAlarmNotice(CarInfo carInfo) { if (carInfo.getIsBlack() == 1) { - sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", new JSONObject().toJSONString(), carInfo, 7, null, false); + sendNoticeAndSetStatusForCarInfo("车辆布防(黑名单)到海康isc", new JSONObject().toJSONString(), carInfo, 7, null, false, true); } else { - sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", new JSONObject().toJSONString(), carInfo, 7, null, false); + sendNoticeAndSetStatusForCarInfo("车辆取消布防(取消黑名单)到海康isc", new JSONObject().toJSONString(), carInfo, 7, null, false, true); } } @@ -1584,8 +1584,7 @@ public class HikvisionCall { * @throws Exception */ private void saveBindCategory(CarInfo carInfo, Project project) throws Exception { - String categoryCode = getCategoryCode(project); - saveCarCategoryBind(project, categoryCode, carInfo.getHikvisionVehicleId(), carInfo); + bindCar(project, carInfo); } @NotNull @@ -1603,7 +1602,7 @@ public class HikvisionCall { ArrayList list = new ArrayList<>(); list.add(hikvisionCarInfo); String rs = HikvisionUtil.doPost(host, path, JSON.toJSONString(list), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()); - sendNoticeAndSetStatusForCarInfo("添加车辆白名单到海康isc", rs, carInfo, 4, 1); + sendNoticeAndSetStatusForCarInfo("添加车辆白名单到海康isc", rs, carInfo, 4, 1, null, true); } /** @@ -1754,20 +1753,31 @@ public class HikvisionCall { String host = "https://" + project.getArtemisConfigHost(); HikvisionCarInfo hikvisionCarInfo = getHikvisionCarInfo(carInfo); String rs = HikvisionUtil.doPost(host, path, JSON.toJSONString(hikvisionCarInfo), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()); - sendNoticeAndSetStatusForCarInfo("更新车辆白名单到海康isc", rs, carInfo, 4, 2); + sendNoticeAndSetStatusForCarInfo("更新车辆白名单到海康isc", rs, carInfo, 4, 2, null, true); } /** - * 绑定/解绑车辆群组 + * 解绑车辆群组 * * @param project - * @param operation 绑定操作类型,1绑定、2解绑 * @param carInfo * @throws Exception */ - private void bindCarOrNot(Project project, int operation, CarInfo carInfo) throws Exception { + private void unbindCar(Project project, CarInfo carInfo) throws Exception { String categoryCode = getCategoryCode(project); - bindOrNotCarCategory(project, operation, categoryCode, carInfo); + bindOrNotCarCategory(project, 2, categoryCode, carInfo); + } + + /** + * 解绑车辆群组 + * + * @param project + * @param carInfo + * @throws Exception + */ + private void bindCar(Project project, CarInfo carInfo) throws Exception { + String categoryCode = getCategoryCode(project); + bindOrNotCarCategory(project, 1, categoryCode, carInfo); } /** @@ -1801,9 +1811,9 @@ public class HikvisionCall { return; } cancelCharge(project, carInfo); - bindCarOrNot(project, 2, carInfo); + unbindCar(project, carInfo); deleteFixedCarForHikvision(carInfo, project); - deleteReservationCarFromHttp(carInfo, project); + deleteReservationCarFromHttp(carInfo, project, true); CarInfo c = new CarInfo(); BeanUtil.copyProperties(carInfo, c); c.setIsBlack(isSetBlack ? 1 : 0); @@ -1816,9 +1826,9 @@ public class HikvisionCall { if (oldCarInfo != null) { log.info("海康存在车辆,车牌号:{}", oldCarInfo.getString("plateNo")); String rs = deleteCarInfoByIdFromHttp(oldCarInfo.getString("vehicleId"), project); - sendNoticeAndSetStatusForCarInfo("删除车辆白名单到海康isc", rs, carInfo, 4, 3); + sendNoticeAndSetStatusForCarInfo("删除车辆白名单到海康isc", rs, carInfo, 4, 3, null, true); } else { - sendNoticeAndSetStatusForCarInfo("删除车辆白名单到海康isc", null, carInfo, 4, 3, true); + sendNoticeAndSetStatusForCarInfo("删除车辆白名单到海康isc", null, carInfo, 4, 3, true, false); } } @@ -1863,8 +1873,9 @@ public class HikvisionCall { * * @param carInfo * @param project + * @param isNotice */ - private void deleteReservationCarFromHttp(CarInfo carInfo, Project project) throws Exception { + private void deleteReservationCarFromHttp(CarInfo carInfo, Project project, boolean isNotice) throws Exception { final String ARTEMIS_PATH = "/artemis"; final String path = ARTEMIS_PATH + "/api/pms/v1/parkingSpace/reservations/deletion"; String host = "https://" + project.getArtemisConfigHost(); @@ -1876,10 +1887,10 @@ public class HikvisionCall { JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("reserveOrderNo", reserveOrderNo); String rs = HikvisionUtil.doPost(host, path, jsonObject1.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()); - sendNoticeAndSetStatusForCarInfo("取消车位预约到海康isc", rs, carInfo, 6, 3); + sendNoticeAndSetStatusForCarInfo("取消车位预约到海康isc", rs, carInfo, 6, 3, null, isNotice); } } else { - sendNoticeAndSetStatusForCarInfo("取消车位预约到海康isc", null, carInfo, 6, 3, true); + sendNoticeAndSetStatusForCarInfo("取消车位预约到海康isc", null, carInfo, 6, 3, true, false); } } @@ -2226,7 +2237,7 @@ public class HikvisionCall { */ public void saveReservationCar(Project project, CarInfo carInfo) throws Exception { //删除预约车辆 - deleteReservationCarFromHttp(carInfo, project); + deleteReservationCarFromHttp(carInfo, project, false); //临时车辆预约 reservationCarFromHttp(project, carInfo); } @@ -2250,7 +2261,7 @@ public class HikvisionCall { String host = "https://" + project.getArtemisConfigHost(); ParkReservation parkReservation = getParkReservation(project, carInfo); String rs = HikvisionUtil.doPost(host, path, JSON.toJSONString(parkReservation), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret()); - sendNoticeAndSetStatusForCarInfo("添加预约车辆到海康isc", rs, carInfo, 6, 1); + sendNoticeAndSetStatusForCarInfo("添加预约车辆到海康isc", rs, carInfo, 6, 1, null, true); } private ParkReservation getParkReservation(Project project, CarInfo carInfo) throws Exception { @@ -2314,11 +2325,10 @@ public class HikvisionCall { * * @param project * @param categoryCode - * @param vehicleIds * @param carInfo * @throws Exception */ - public void saveCarCategoryBind(Project project, String categoryCode, String vehicleIds, CarInfo carInfo) throws Exception { + public void saveCarCategoryBind(Project project, String categoryCode, CarInfo carInfo) throws Exception { bindOrNotCarCategory(project, 2, categoryCode, carInfo); bindOrNotCarCategory(project, 1, categoryCode, carInfo); } @@ -2340,9 +2350,9 @@ public class HikvisionCall { JSONObject jo = HikvisionUtil.bindCarCategory(project, param); String rs = jo.toJSONString(); if (Objects.equals(operation, 1)) { - sendNoticeAndSetStatusForCarInfo("绑定" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 1); + sendNoticeAndSetStatusForCarInfo("绑定" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 1, null, true); } else if (Objects.equals(operation, 2)) { - sendNoticeAndSetStatusForCarInfo("解绑" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 3); + sendNoticeAndSetStatusForCarInfo("解绑" + FIXED_CAR_GROUP_NAME + "到海康isc", rs, carInfo, 5, 3, null, true); } } diff --git a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java index 7986790d6..104dfdb6a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java @@ -90,6 +90,7 @@ public class CarInfoServiceImpl extends ServiceImpl impl queryWrapper.lambda().eq(CarInfo::getProjectSn, c.getProjectSn()) .eq(CarInfo::getCarNumber, c.getCarNumber()); CarInfo old = carInfoMapper.selectOne(queryWrapper); + c.setSendSuccessStatus(null); if (old != null) { if (Objects.equals(old.getCarModuleType(), 1)) { throw new OpenAlertException("该车辆已添加,请勿重复添加!");