Commit c3235b53c9278b9b5b35e2f36d649304b4029a90

Authored by 邱一成
1 parent e422f752
Exists in master

大华一体机考勤和时段设置完成

cloud/dahua/src/main/java/com/example/dahua/MyTask.java
@@ -288,7 +288,6 @@ public class MyTask implements ApplicationRunner { @@ -288,7 +288,6 @@ public class MyTask implements ApplicationRunner {
288 String card = new String(msg.szCardNo).trim(); 288 String card = new String(msg.szCardNo).trim();
289 //开门错误码 289 //开门错误码
290 int messageCode = msg.nErrorCode; 290 int messageCode = msg.nErrorCode;
291 - System.out.println("sda:" + card + " 抓拍照片存储地址:");  
292 291
293 //设备ID获取 292 //设备ID获取
294 NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex(); 293 NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
@@ -307,13 +306,22 @@ public class MyTask implements ApplicationRunner { @@ -307,13 +306,22 @@ public class MyTask implements ApplicationRunner {
307 if (gateBufferedImage != null) { 306 if (gateBufferedImage != null) {
308 ImageIO.write(gateBufferedImage, "png", new File(snapPicPath)); 307 ImageIO.write(gateBufferedImage, "png", new File(snapPicPath));
309 } 308 }
  309 + log.info("设备ID: {},卡号: {},抓拍照片存储地址:{}" ,szSn,card,snapPicPath);
310 if(isMatch(REGEX_POSITIVE_Symbol, szSn)){//验证设备id是否存在特殊字符 310 if(isMatch(REGEX_POSITIVE_Symbol, szSn)){//验证设备id是否存在特殊字符
311 - log.info("设备ID: {},卡号: {}",szSn,card); 311 + log.info("—设备ID异常: {},卡号: {}",szSn,card);
312 return 0; 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 card = cardNo(card); 325 card = cardNo(card);
318 } 326 }
319 //根据卡号获取卡身份信息 327 //根据卡号获取卡身份信息
@@ -333,16 +341,19 @@ public class MyTask implements ApplicationRunner { @@ -333,16 +341,19 @@ public class MyTask implements ApplicationRunner {
333 time, card,messageCode ==32?EnumSendFaceType.TIME_INTERVAL_ERROR.message:""); 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 } catch (IOException e2) { 359 } catch (IOException e2) {
cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
@@ -234,7 +234,7 @@ public class MyScheduledTask { @@ -234,7 +234,7 @@ public class MyScheduledTask {
234 isInitMQ = true; 234 isInitMQ = true;
235 235
236 } 236 }
237 - 237 +
238 private void sendMQMess(String content) { 238 private void sendMQMess(String content) {
239 String cardNum = content.substring(content.indexOf("卡号") + 3, content.indexOf("卡号") + 11); 239 String cardNum = content.substring(content.indexOf("卡号") + 3, content.indexOf("卡号") + 11);
240 240
cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
@@ -14,7 +14,7 @@ public interface UserDao { @@ -14,7 +14,7 @@ public interface UserDao {
14 public String getStudentNum(@Param("school_id") String school_id, @Param("studentcode") String studentcode); 14 public String getStudentNum(@Param("school_id") String school_id, @Param("studentcode") String studentcode);
15 15
16 @Select("select school_id from SZ_Attendance where clint_id = #{clint_id} ") 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 @Select("select * from SZ_Attendance where school_id = #{school_id} and clint_type = #{clint_type}") 19 @Select("select * from SZ_Attendance where school_id = #{school_id} and clint_type = #{clint_type}")
20 List<AttendanceBean> getAttendanceBeans(@Param("school_id") String school_id, @Param("clint_type") String clint_type); 20 List<AttendanceBean> getAttendanceBeans(@Param("school_id") String school_id, @Param("clint_type") String clint_type);