bug修复
This commit is contained in:
parent
bb3867ddf7
commit
d3f05dd7ee
@ -326,13 +326,14 @@ public class HikvisionCall {
|
||||
param.put("doorIndexCode", ufaceDev.getDevSn());
|
||||
param.put("pageNo", 1);
|
||||
Integer total = 0;
|
||||
JSONArray listJa = new JSONArray();
|
||||
do {
|
||||
String rs = getDoorEventsForHttp(project, param);
|
||||
JSONObject joData = HikvisionUtil.getJSONObjectData(rs);
|
||||
if (joData != null) {
|
||||
total = joData.getInteger("total");
|
||||
if (!Objects.equals(total, 0)) {
|
||||
JSONArray listJa = joData.getJSONArray("list");
|
||||
listJa = joData.getJSONArray("list");
|
||||
for (int i = 0; i < listJa.size(); i++) {
|
||||
JSONObject listJo = listJa.getJSONObject(i);
|
||||
String eventTime = listJo.getString("eventTime");
|
||||
@ -352,6 +353,7 @@ public class HikvisionCall {
|
||||
Integer count = workerAttendanceMapper.selectCount(new LambdaQueryWrapper<WorkerAttendance>()
|
||||
.eq(WorkerAttendance::getPersonSn, workerInfo.getPersonSn())
|
||||
.eq(WorkerAttendance::getCreateTime, time)
|
||||
.ne(WorkerAttendance::getImageUrl, "")
|
||||
);
|
||||
if (count != 0) {
|
||||
continue;
|
||||
@ -370,16 +372,35 @@ public class HikvisionCall {
|
||||
rq.setSvrIndexCode(svrIndexCode);
|
||||
map.put("faceUrl", saveToLocal(getHikvisionEventsPicture(rq, project.getArtemisConfigHost(), project.getArtemisConfigAppKey(), project.getArtemisConfigAppSecret())));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("主动获取人脸图片失败>", e);
|
||||
}
|
||||
try {
|
||||
List<WorkerAttendance> workerAttendanceList = workerAttendanceMapper.selectList(new LambdaQueryWrapper<WorkerAttendance>()
|
||||
.eq(WorkerAttendance::getPersonSn, workerInfo.getPersonSn())
|
||||
.eq(WorkerAttendance::getCreateTime, time)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(workerAttendanceList)) {
|
||||
for (WorkerAttendance workerAttendance : workerAttendanceList) {
|
||||
workerAttendance.setImageUrl(MapUtils.getString(map, "faceUrl"));
|
||||
workerAttendanceMapper.updateById(workerAttendance);
|
||||
}
|
||||
} else {
|
||||
workerAttendanceService.saveExternalPassRecord(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("主动保存人员失败,time:{},>", time, e);
|
||||
}
|
||||
workerAttendanceService.saveExternalPassRecord(map);
|
||||
}
|
||||
param.put("pageNo", param.getIntValue("pageNo") + 1);
|
||||
}
|
||||
}
|
||||
} while (total > 0);
|
||||
} while (total > 0 && listJa.size() > 0);
|
||||
}
|
||||
try {
|
||||
workerAttendancePresenceService.addNowAllWorkerAttendancePresence(projectSn);
|
||||
} catch (Exception e) {
|
||||
log.error("主动更新在场人员失败,projectSn:{},>", projectSn, e);
|
||||
}
|
||||
workerAttendancePresenceService.addNowAllWorkerAttendancePresence(projectSn);
|
||||
}
|
||||
log.info("服务挂了主动获取门禁点事件的人员通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
||||
if (SecurityUtils.getUser().getUserId() != null) {
|
||||
@ -428,13 +449,14 @@ public class HikvisionCall {
|
||||
}
|
||||
param.put("parkSyscode", projectParkCode);
|
||||
Integer total = 0;
|
||||
JSONArray listJa = new JSONArray();
|
||||
do {
|
||||
String rs = getCrossRecordsForHttp(project, param);
|
||||
JSONObject joData = HikvisionUtil.getJSONObjectData(rs);
|
||||
if (joData != null) {
|
||||
total = joData.getInteger("total");
|
||||
if (!Objects.equals(total, 0)) {
|
||||
JSONArray listJa = joData.getJSONArray("list");
|
||||
listJa = joData.getJSONArray("list");
|
||||
for (int i = 0; i < listJa.size(); i++) {
|
||||
JSONObject listJo = listJa.getJSONObject(i);
|
||||
String plateNo = listJo.getString("plateNo");
|
||||
@ -453,6 +475,8 @@ public class HikvisionCall {
|
||||
Integer count = carPassRecordMapper.selectCount(new LambdaQueryWrapper<CarPassRecord>()
|
||||
.eq(CarPassRecord::getCarNumber, plateNo)
|
||||
.eq(CarPassRecord::getPassTime, time)
|
||||
.ne(CarPassRecord::getImageUrl, "")
|
||||
.ne(CarPassRecord::getPanoramaUrl, "")
|
||||
);
|
||||
if (count != 0) {
|
||||
continue;
|
||||
@ -485,12 +509,22 @@ public class HikvisionCall {
|
||||
} else {
|
||||
entity.setIsOpen(0);
|
||||
}
|
||||
carPassRecordMapper.insert(entity);
|
||||
Integer count1 = carPassRecordMapper.selectCount(new LambdaQueryWrapper<CarPassRecord>()
|
||||
.eq(CarPassRecord::getCarNumber, plateNo)
|
||||
.eq(CarPassRecord::getPassTime, time)
|
||||
);
|
||||
if (count1 != 0) {
|
||||
carPassRecordMapper.update(entity, new LambdaQueryWrapper<CarPassRecord>()
|
||||
.eq(CarPassRecord::getCarNumber, plateNo)
|
||||
.eq(CarPassRecord::getPassTime, time));
|
||||
} else {
|
||||
carPassRecordMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
param.put("pageNo", param.getIntValue("pageNo") + 1);
|
||||
}
|
||||
}
|
||||
} while (total > 0);
|
||||
} while (total > 0 && listJa.size() > 0);
|
||||
}
|
||||
log.info("服务挂了主动获取车辆事件的车辆通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
||||
if (SecurityUtils.getUser().getUserId() != null) {
|
||||
|
||||
@ -2,21 +2,21 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.worker.mapper.WorkerAttendancePresenceMapper">
|
||||
<insert id="addNowAllPresenceWorkerAttendance">
|
||||
Insert into worker_attendance_presence(person_sn,create_time,project_sn)
|
||||
Insert into worker_attendance_presence(id,person_sn,create_time,project_sn)
|
||||
SELECT DISTINCT
|
||||
`b`.`person_sn` AS `person_sn`,
|
||||
`b`.`create_time` AS `create_time`,
|
||||
`b`.`project_sn` AS `project_sn`
|
||||
`b`.`id` AS `id`,
|
||||
`b`.`person_sn` AS `person_sn`,
|
||||
`b`.`create_time` AS `create_time`,
|
||||
`b`.`project_sn` AS `project_sn`
|
||||
FROM
|
||||
(SELECT `worker_attendance`.`person_sn` AS `person_sn`,max(`create_time`) AS `create_time`
|
||||
FROM `worker_attendance`
|
||||
WHERE `create_time` >= concat(date_format(now(), '%Y-%m-%d'),' 00:00:00')
|
||||
GROUP BY `worker_attendance`.`person_sn`
|
||||
) `tp`
|
||||
JOIN `worker_attendance` `b` ON (`tp`.`create_time` = `b`.`create_time` AND `tp`.`person_sn` = `b`.`person_sn`
|
||||
)
|
||||
(SELECT `worker_attendance`.`person_sn` AS `person_sn`,max(`create_time`) AS `create_time`
|
||||
FROM `worker_attendance`
|
||||
WHERE `create_time` >= concat(date_format(now(), '%Y-%m-%d'),' 00:00:00')
|
||||
GROUP BY `worker_attendance`.`person_sn`
|
||||
) `tp`
|
||||
JOIN `worker_attendance` `b` ON (`tp`.`create_time` = `b`.`create_time` AND `tp`.`person_sn` = `b`.`person_sn`)
|
||||
WHERE b.`create_time` >= concat(date_format(now(), '%Y-%m-%d'),' 00:00:00') AND (`b`.`pass_type` = 1)
|
||||
and `b`.`project_sn`=#{projectSn}
|
||||
and `b`.`project_sn`=#{projectSn}
|
||||
</insert>
|
||||
|
||||
<delete id="deleteAttendancePresence">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user