bug修复

This commit is contained in:
GUO 2024-05-05 23:01:33 +08:00
parent 58bdefaea5
commit 3cd0c79227
2 changed files with 112 additions and 112 deletions

View File

@ -108,17 +108,17 @@ public class AsyncHikvision {
} }
private void sendNoticeForWorker(WorkerInfo workerInfo, Exception e, String action) { private void sendNoticeForWorker(WorkerInfo workerInfo, Exception e, String action) {
String title = action + "人员到海康isc失败";
String type = "23";
String msg;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:下发异常";
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
String title = action + "人员到海康isc失败";
String type = "23";
String msg;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:下发异常";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
} }
} }
@ -164,17 +164,17 @@ public class AsyncHikvision {
} }
private void sendNoticeForCar(CarInfo carInfo, Exception e, String action) { private void sendNoticeForCar(CarInfo carInfo, Exception e, String action) {
String title = action + "车辆到海康isc失败";
String type = "24";
String msg = null;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:下发异常";
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
String title = action + "车辆到海康isc失败";
String type = "24";
String msg = null;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,车牌号:" + carInfo.getCarNumber() + "。失败原因:下发异常";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
} }
} }
@ -231,17 +231,17 @@ public class AsyncHikvision {
} }
private void sendNoticeForOrg(String name, Exception e, String action) { private void sendNoticeForOrg(String name, Exception e, String action) {
String title = action + "组织到海康isc失败";
String type = "23";
String msg;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,组织名称:" + name + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,组织名称:" + name + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,组织名称:" + name + "。失败原因:下发异常";
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
String title = action + "组织到海康isc失败";
String type = "23";
String msg;
if (HttpUtils.isTimeOut(e)) {
msg = "同步失败,组织名称:" + name + "。失败原因平台连接isc网络异常";
} else if (e instanceof OpenPromptException) {
msg = "同步失败,组织名称:" + name + "。失败原因:" + e.getMessage();
} else {
msg = "同步失败,组织名称:" + name + "。失败原因:下发异常";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
} }
} }
@ -427,20 +427,20 @@ public class AsyncHikvision {
return; return;
} }
String title = "人员下发设备提醒";
String type = "1";
String msg = "";
String sucSbStr = sucSb.toString();
if (StringUtils.isNotBlank(sucSbStr)) {
sucSbStr = "下发权限成功:" + sucSbStr;
msg += sucSbStr;
}
String failSbStr = failSb.toString();
if (StringUtils.isNotBlank(failSbStr)) {
failSbStr = "下发权限失败:" + failSbStr;
msg += failSbStr;
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
String title = "人员下发设备提醒";
String type = "1";
String msg = "";
String sucSbStr = sucSb.toString();
if (StringUtils.isNotBlank(sucSbStr)) {
sucSbStr = "下发权限成功:" + sucSbStr;
msg += sucSbStr;
}
String failSbStr = failSb.toString();
if (StringUtils.isNotBlank(failSbStr)) {
failSbStr = "下发权限失败:" + failSbStr;
msg += failSbStr;
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), StringUtils.substring(msg, 0, msg.length() - 1), title, type);
} }
} catch (Exception e) { } catch (Exception e) {
@ -489,20 +489,20 @@ public class AsyncHikvision {
return; return;
} }
String title = "人员下发设备提醒";
String type = "1";
String msg = "";
String sucSbStr = sucSb.toString();
if (StringUtils.isNotBlank(sucSbStr)) {
sucSbStr = "移除权限成功:" + sucSbStr;
msg += sucSbStr + "";
}
String failSbStr = failSb.toString();
if (StringUtils.isNotBlank(failSbStr)) {
failSbStr = "移除权限失败:" + failSbStr;
msg += failSbStr + "";
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
String title = "人员下发设备提醒";
String type = "1";
String msg = "";
String sucSbStr = sucSb.toString();
if (StringUtils.isNotBlank(sucSbStr)) {
sucSbStr = "移除权限成功:" + sucSbStr;
msg += sucSbStr + "";
}
String failSbStr = failSb.toString();
if (StringUtils.isNotBlank(failSbStr)) {
failSbStr = "移除权限失败:" + failSbStr;
msg += failSbStr + "";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -879,25 +879,25 @@ public class HikvisionCall {
if (StringUtils.isBlank(rs)) { if (StringUtils.isBlank(rs)) {
return; return;
} }
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { boolean success = HikvisionUtil.isSuccess(rs);
boolean success = HikvisionUtil.isSuccess(rs); String msg = "";
String msg = ""; if (success) {
if (success) { msg = "同步成功,车牌号码:" + carInfo.getCarNumber();
title += "成功";
setSuccessByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
} else {
JSONObject jo = JSONObject.parseObject(rs);
String code = jo.getString("code");
if (Objects.equals(code, "0x00072202")) {
msg = "同步成功,车牌号码:" + carInfo.getCarNumber(); msg = "同步成功,车牌号码:" + carInfo.getCarNumber();
title += "成功"; title += "成功";
setSuccessByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null); setSuccessByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
} else { } else {
JSONObject jo = JSONObject.parseObject(rs); msg = "同步失败,车牌号码:" + carInfo.getCarNumber() + "。失败原因:下发异常";
String code = jo.getString("code"); title += "失败";
if (Objects.equals(code, "0x00072202")) {
msg = "同步成功,车牌号码:" + carInfo.getCarNumber();
title += "成功";
setSuccessByNow(carInfo.getProjectSn(), carInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
} else {
msg = "同步失败,车牌号码:" + carInfo.getCarNumber() + "。失败原因:下发异常";
title += "失败";
}
} }
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "24"); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "24");
} }
} }
@ -906,58 +906,58 @@ public class HikvisionCall {
if (StringUtils.isBlank(rs)) { if (StringUtils.isBlank(rs)) {
return; return;
} }
boolean success = HikvisionUtil.isSuccess(rs);
String msg = "";
String type = "25";
if (success) {
msg = "同步成功,组织名称:" + orgName;
title += "成功";
} else {
msg = "同步失败,组织名称:" + orgName + "。失败原因:" + rs;
title += "失败";
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
boolean success = HikvisionUtil.isSuccess(rs);
String msg = "";
String type = "25";
if (success) {
msg = "同步成功,组织名称:" + orgName;
title += "成功";
} else {
msg = "同步失败,组织名称:" + orgName + "。失败原因:" + rs;
title += "失败";
}
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
} }
} }
private void sendNoticeForWorker(String title, String rs, WorkerInfo workerInfo, int type, int operate) { private void sendNoticeForWorker(String title, String rs, WorkerInfo workerInfo, int type, int operate) {
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) { boolean success = HikvisionUtil.isSuccess(rs);
boolean success = HikvisionUtil.isSuccess(rs); String msg = "";
String msg = ""; String noticeType = "23";
String noticeType = "23"; if (success) {
if (success) { setSuccessByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
setSuccessByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null); msg = "同步成功,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard();
msg = "同步成功,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard(); title += "成功";
title += "成功"; } else {
} else { JSONObject jo = JSONObject.parseObject(rs);
JSONObject jo = JSONObject.parseObject(rs); String code = jo.getString("code");
String code = jo.getString("code"); if (Objects.equals(code, "0x00072002")) {
if (Objects.equals(code, "0x00072002")) { msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:人脸照片校验失败";
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:人脸照片校验失败"; title += "失败";
title += "失败"; } else if (Objects.equals(code, "0x00052301")) {
} else if (Objects.equals(code, "0x00052301")) { String msg1 = jo.getString("msg");
String msg1 = jo.getString("msg"); if (Objects.equals(msg1, "OrgIndexCode Not Exists")) {
if (Objects.equals(msg1, "OrgIndexCode Not Exists")) { String pN = "";
String pN = ""; if (Objects.equals(workerInfo.getPersonType(), 1)) {
if (Objects.equals(workerInfo.getPersonType(), 1)) { pN = "班组";
pN = "班组"; } else if (Objects.equals(workerInfo.getPersonType(), 2)) {
} else if (Objects.equals(workerInfo.getPersonType(), 2)) { pN = "部门";
pN = "部门";
}
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:" + pN + "未同步成功";
title += "失败";
} else if (Objects.equals(msg1, "PersonId Already In Db")) {
//成功
setSuccessByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
msg = "同步成功,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard();
title += "成功";
} }
} else { msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:" + pN + "未同步成功";
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:下发异常";
title += "失败"; title += "失败";
} else if (Objects.equals(msg1, "PersonId Already In Db")) {
//成功
setSuccessByNow(workerInfo.getProjectSn(), workerInfo.getId(), type, operate, ThreadLocalUtil.getNotNull().getDate("now"), null);
msg = "同步成功,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard();
title += "成功";
} }
} else {
msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:下发异常";
title += "失败";
} }
}
if (SecurityUtils.getUser() != null && SecurityUtils.getUser().getUserId() != null) {
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, noticeType); noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, noticeType);
} }
} }