Commit c3235b53c9278b9b5b35e2f36d649304b4029a90
1 parent
e422f752
Exists in
master
大华一体机考勤和时段设置完成
Showing
3 changed files
with
26 additions
and
15 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
... | ... | @@ -288,7 +288,6 @@ public class MyTask implements ApplicationRunner { |
288 | 288 | String card = new String(msg.szCardNo).trim(); |
289 | 289 | //开门错误码 |
290 | 290 | int messageCode = msg.nErrorCode; |
291 | - System.out.println("sda:" + card + " 抓拍照片存储地址:"); | |
292 | 291 | |
293 | 292 | //设备ID获取 |
294 | 293 | NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex(); |
... | ... | @@ -307,13 +306,22 @@ public class MyTask implements ApplicationRunner { |
307 | 306 | if (gateBufferedImage != null) { |
308 | 307 | ImageIO.write(gateBufferedImage, "png", new File(snapPicPath)); |
309 | 308 | } |
309 | + log.info("设备ID: {},卡号: {},抓拍照片存储地址:{}" ,szSn,card,snapPicPath); | |
310 | 310 | if(isMatch(REGEX_POSITIVE_Symbol, szSn)){//验证设备id是否存在特殊字符 |
311 | - log.info("设备ID: {},卡号: {}",szSn,card); | |
311 | + log.info("—设备ID异常: {},卡号: {}",szSn,card); | |
312 | 312 | return 0; |
313 | 313 | } |
314 | - int schoolId=userDao.getSchoolIdbyClint_id(szSn); | |
314 | + int schoolId=0; | |
315 | + String schoolIdStr=userDao.getSchoolIdbyClint_id(szSn); | |
316 | + if(org.apache.commons.lang.StringUtils.isNotBlank(schoolIdStr)){ | |
317 | + schoolId=Integer.parseInt(schoolIdStr); | |
318 | + } | |
315 | 319 | //卡号取反(大写) |
316 | - if(!szSn.startsWith("ytj")&&schoolId==126&&schoolId==393){ | |
320 | + //if(!szSn.startsWith("ytj")||(szSn.startsWith("ytj")&&schoolId==126&&schoolId==393)){ | |
321 | + if(szSn.startsWith("ytj")&&schoolId!=126&&schoolId!=393){ | |
322 | + card = card; | |
323 | + } | |
324 | + else{ | |
317 | 325 | card = cardNo(card); |
318 | 326 | } |
319 | 327 | //根据卡号获取卡身份信息 |
... | ... | @@ -333,16 +341,19 @@ public class MyTask implements ApplicationRunner { |
333 | 341 | time, card,messageCode ==32?EnumSendFaceType.TIME_INTERVAL_ERROR.message:""); |
334 | 342 | } |
335 | 343 | |
336 | - // TODO 考勤记录 | |
337 | - //刷卡结果,1表示成功, 0表示失败 | |
338 | - int status = msg.bStatus; | |
339 | - //门禁事件类型:1进2出 | |
340 | - int eventType = msg.emEventType; | |
341 | - //刷卡时间 | |
342 | - String eventTime = DateUtils.date2String(new Date(), DateUtils.format2); | |
344 | + if(szSn.startsWith("ytj")) { | |
343 | 345 | |
344 | - //保存考勤记录 | |
345 | - kaoQinRecord(status,eventType,card,szSn,eventTime,snapPicPath,messageCode); | |
346 | + // TODO 考勤记录 | |
347 | + //刷卡结果,1表示成功, 0表示失败 | |
348 | + int status = msg.bStatus; | |
349 | + //门禁事件类型:1进2出 | |
350 | + int eventType = msg.emEventType; | |
351 | + //刷卡时间 | |
352 | + String eventTime = DateUtils.date2String(new Date(), DateUtils.format2); | |
353 | + | |
354 | + //保存考勤记录 | |
355 | + kaoQinRecord(status, eventType, card, szSn, eventTime, snapPicPath, messageCode); | |
356 | + } | |
346 | 357 | } |
347 | 358 | |
348 | 359 | } catch (IOException e2) { | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
... | ... | @@ -14,7 +14,7 @@ public interface UserDao { |
14 | 14 | public String getStudentNum(@Param("school_id") String school_id, @Param("studentcode") String studentcode); |
15 | 15 | |
16 | 16 | @Select("select school_id from SZ_Attendance where clint_id = #{clint_id} ") |
17 | - int getSchoolIdbyClint_id( @Param("clint_id") String clint_id); | |
17 | + String getSchoolIdbyClint_id( @Param("clint_id") String clint_id); | |
18 | 18 | |
19 | 19 | @Select("select * from SZ_Attendance where school_id = #{school_id} and clint_type = #{clint_type}") |
20 | 20 | List<AttendanceBean> getAttendanceBeans(@Param("school_id") String school_id, @Param("clint_type") String clint_type); | ... | ... |