提交 1c380238 authored 作者: 林业通's avatar 林业通

指纹锁修改

上级 f66d8bf1
......@@ -61,12 +61,6 @@ public class SmartLockParse implements IParse {
redisUtils.set(datas.get("mac").toUpperCase(), datas.toString(), 180);//3分钟有效
//校验设备时钟
new Thread(() -> {
logger.info("start checkDeviceTime");
timeParseUtils.checkDeviceTime2(datas.get("receiveId"), datas.get("content"), "10");
}).start();
return datas;
}else if("01".equals(datas.get("cmd"))) {//数据上报
//数据上报
......@@ -94,6 +88,11 @@ public class SmartLockParse implements IParse {
}*/
otherShDeviceService.updateDeviceData(JSON.toJSONString(map), device.getId());
//校验设备时钟
new Thread(() -> {
logger.info("start checkDeviceTime");
timeParseUtils.checkDeviceTime2(datas.get("receiveId"), datas.get("content"), "10");
}).start();
}
} else if("20".equals(datas.get("cmd")) && datas.get("content").substring(0, 2).equals("04")) {//远程开锁请求
......
......@@ -124,6 +124,7 @@ public class TimeParseUtils {
Date date1 = DateUtils.stringToDate(date, DateUtils.DATE_TIME_PATTERN);
long diff = new Date().getTime() - date1.getTime();//这样得到的差值是毫秒级别
long min = diff / (1000 * 60);
logger.info("指纹锁相差使时间 : " + min);
//校验相差20分钟
if(min > 2 || min < -2) {
logger.info("update-time : {}", DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论