bug修复
This commit is contained in:
parent
3a6d1fdfe0
commit
255ed7fdad
@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.xmgl.base.*;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.HikvisionRequestRetry;
|
||||
@ -22,12 +23,11 @@ import com.zhgd.xmgl.modules.car.mapper.CarTypeMapper;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
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.modules.worker.entity.*;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.UfaceDevMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
||||
import com.zhgd.xmgl.modules.worker.service.impl.WorkerAttendanceServiceImpl;
|
||||
import com.zhgd.xmgl.util.Base64Util;
|
||||
import com.zhgd.xmgl.util.HikvisionUtil;
|
||||
import com.zhgd.xmgl.util.PathUtil;
|
||||
@ -79,7 +79,11 @@ public class HikvisionCall {
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CarInfoMapper carInfoMapper;
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private WorkerAttendanceServiceImpl workerAttendanceServiceImpl;
|
||||
@Autowired
|
||||
private UfaceDevMapper ufaceDevMapper;
|
||||
|
||||
@ApiOperation(value = "海康事件回调", notes = "海康事件回调", httpMethod = "POST")
|
||||
@PostMapping(value = "/eventCallback")
|
||||
@ -111,12 +115,20 @@ public class HikvisionCall {
|
||||
log.info("未配置,idCard:{},extEventCardNo:{}", idCard, extEventCardNo);
|
||||
return Result.error("未配置,idCard:" + idCard + ",extEventCardNo:" + extEventCardNo);
|
||||
}
|
||||
QueryWrapper<UfaceDev> devQueryWrapper = new QueryWrapper<>();
|
||||
devQueryWrapper.lambda().eq(UfaceDev::getDevSn, srcIndex).eq(UfaceDev::getProjectSn, workerInfo.getProjectSn());
|
||||
UfaceDev ufaceDev = ufaceDevMapper.selectOne(devQueryWrapper);
|
||||
if (ufaceDev == null) {
|
||||
log.error("请先上传对应设备信息,idCard:{},devSN:{}", idCard, srcIndex);
|
||||
return Result.error("请先上传对应设备信息,idCard:" + idCard + ",extEventCardNo:" + extEventCardNo);
|
||||
}
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("passTime", DateUtil.formatDateTime(DateUtil.parse(happenTime)));
|
||||
map.put("idCard", idCard);
|
||||
map.put("attendanceNumber", workerInfo.getAttendanceNumber());
|
||||
map.put("direction", getDirection(dataJo));
|
||||
int passType = workerAttendanceServiceImpl.getPassType(ufaceDev, DateUtil.formatDateTime(DateUtil.parse(happenTime)));
|
||||
map.put("direction", passType);
|
||||
map.put("passType", 2);
|
||||
map.put("projectCode", workerInfo.getProjectSn());
|
||||
map.put("devCode", srcIndex);
|
||||
@ -910,17 +922,6 @@ public class HikvisionCall {
|
||||
}
|
||||
|
||||
|
||||
private Integer getDirection(JSONObject dataJo) {
|
||||
Integer extEventInOut = dataJo.getInteger("ExtEventInOut");
|
||||
if (Objects.equals(extEventInOut, 0)) {
|
||||
return 2;
|
||||
} else if (Objects.equals(extEventInOut, 1)) {
|
||||
return 1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
*
|
||||
|
||||
@ -269,7 +269,7 @@ public class WorkerAttendanceServiceImpl extends ServiceImpl<WorkerAttendanceMap
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
private int getPassType(UfaceDev dev, String time) {
|
||||
public int getPassType(UfaceDev dev, String time) {
|
||||
int type = 0;
|
||||
int hour = Integer.valueOf(time.substring(11, 13));
|
||||
if (dev != null && dev.getIsEnter() != null && dev.getIsEnter() == 1 && dev.getIsOut() != null && dev.getIsOut() == 1) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user