bug修复

This commit is contained in:
guo 2024-04-14 22:02:37 +08:00
parent 0fba7ba63d
commit 989c13a614
2 changed files with 20 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhgd.xmgl.call.HikvisionCall;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.car.entity.CarInfo;
import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
@ -17,6 +18,7 @@ import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@ -39,6 +41,8 @@ public class AsyncHikvision {
VideoItemMapper videoItemMapper;
@Autowired
ProjectVideoHkVqdMapper projectVideoHkVqdMapper;
@Autowired
private INoticeService noticeService;
/**
* 添加劳务人员-海康
@ -51,6 +55,7 @@ public class AsyncHikvision {
hikvisionCall.addWorkerForHikvision(workerInfo);
} catch (Exception e) {
log.error("海康:", e);
sendNoticeForWorker(workerInfo, e, "添加");
}
}
@ -60,6 +65,16 @@ public class AsyncHikvision {
hikvisionCall.editWorkerForHikvision(workerInfo);
} catch (Exception e) {
log.error("海康:", e);
sendNoticeForWorker(workerInfo, e, "更新");
}
}
private void sendNoticeForWorker(WorkerInfo workerInfo, Exception e, String action) {
if (SecurityUtils.getUser().getUserId() != null) {
String title = action + "人员到海康isc失败";
String type = "23";
String msg = "同步失败,人员名称:" + workerInfo.getWorkerName() + ",身份证号:" + workerInfo.getIdCard() + "。失败原因:" + e.getMessage();
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
}
}
@ -69,6 +84,7 @@ public class AsyncHikvision {
hikvisionCall.deleteWorkerForHikvision(workerInfo);
} catch (Exception e) {
log.error("海康:", e);
sendNoticeForWorker(workerInfo, e, "删除");
}
}

View File

@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.base.*;
import com.zhgd.xmgl.modules.basicdata.entity.HikvisionRequestRetry;
@ -982,6 +983,9 @@ public class HikvisionCall {
jo.put("paramName", "personId");
jo.put("paramValue", Arrays.asList(String.valueOf(workerInfo.getId())));
String rs = HikvisionUtil.doPost(host, path, jo.toJSONString(), null, project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret());
if (rs == null) {
throw new OpenAlertException("海康查询人员网络超时,名称:" + workerInfo.getWorkerName());
}
JSONObject joData = HikvisionUtil.getJSONObjectData(rs);
if (joData != null) {
Integer total = joData.getInteger("total");