Commit 3f84e4b0a33aadd8d2f9b800372bdda08bea854f
1 parent
7fc4b9b6
Exists in
master
优化
Showing
5 changed files
with
60 additions
and
17 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
| @@ -228,7 +228,7 @@ public class MyTask implements ApplicationRunner { | @@ -228,7 +228,7 @@ public class MyTask implements ApplicationRunner { | ||
| 228 | break; | 228 | break; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | - return 1; | 231 | + return 0; |
| 232 | } | 232 | } |
| 233 | } | 233 | } |
| 234 | 234 | ||
| @@ -277,7 +277,24 @@ public class MyTask implements ApplicationRunner { | @@ -277,7 +277,24 @@ public class MyTask implements ApplicationRunner { | ||
| 277 | if (dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) { | 277 | if (dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) { |
| 278 | NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO msg = new NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO(); | 278 | NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO msg = new NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO(); |
| 279 | ToolKits.GetPointerData(pAlarmInfo, msg); | 279 | ToolKits.GetPointerData(pAlarmInfo, msg); |
| 280 | - System.out.println("sda:" + new String(msg.szCardNo) + " 抓拍照片存储地址:"); | 280 | + |
| 281 | +// String b =new String(msg.szSN); | ||
| 282 | +// System.out.println("readid: "+new String(msg.szReaderID)); | ||
| 283 | +// System.out.println("imageurl: "+new String(msg.szSnapURL)); | ||
| 284 | +// NetSDKLib.ALARM_ACCESS_CTL_STATUS_INFO msg1 = new NetSDKLib.ALARM_ACCESS_CTL_STATUS_INFO(); | ||
| 285 | +// ToolKits.GetPointerData(pBuffer, msg1); | ||
| 286 | +// try{ | ||
| 287 | +// String a =new String(msg1.szSerialNumber,"utf-8").trim(); | ||
| 288 | +// System.out.println("无线设备序列号: "+ a); | ||
| 289 | +// } catch (UnsupportedEncodingException e) { | ||
| 290 | +// e.printStackTrace(); | ||
| 291 | +// } | ||
| 292 | +// System.out.println("sda:" + new String(msg.szCardNo) + " 抓拍照片存储地址:"); | ||
| 293 | +// NetSDKLib.ALARM_ACCESS_CTL_EVENT_INFO msg2 = new NetSDKLib.ALARM_ACCESS_CTL_EVENT_INFO(); | ||
| 294 | +// ToolKits.GetPointerData(pBuffer, msg2); | ||
| 295 | +// String c =new String(msg2.szSN); | ||
| 296 | +// System.out.println("智能锁序列号 " +c); | ||
| 297 | + | ||
| 281 | try { | 298 | try { |
| 282 | String card = new String(msg.szCardNo).trim(); | 299 | String card = new String(msg.szCardNo).trim(); |
| 283 | if (!StringUtils.isEmpty(card)) { | 300 | if (!StringUtils.isEmpty(card)) { |
cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
| @@ -262,8 +262,9 @@ public class MyScheduledTask { | @@ -262,8 +262,9 @@ public class MyScheduledTask { | ||
| 262 | 262 | ||
| 263 | } else { | 263 | } else { |
| 264 | 264 | ||
| 265 | -// String schoolId = userDao.getSchoolIdWidthCardNum(cardNum); | ||
| 266 | - List<String> clintIds = userDao.getClintIds("4"); | 265 | + String schoolId = userDao.getSchoolIdWidthCardNum(cardNum); |
| 266 | + if(StringUtils.isEmpty(schoolId)||Integer.parseInt(schoolId) <=0)return; | ||
| 267 | + List<String> clintIds = userDao.getClintIds(schoolId); | ||
| 267 | for (int i = 0; i < clintIds.size(); i++) { | 268 | for (int i = 0; i < clintIds.size(); i++) { |
| 268 | String clintId = clintIds.get(i); | 269 | String clintId = clintIds.get(i); |
| 269 | String data = "{\"cmd\":\"" + 34 + "\",\"clientId\":\"" + clintId + "\",\"data\":{\"cardNum\":\"" + cardNum + "\",\"inOrOut\":\"" + inOrOut + "\"}}"; | 270 | String data = "{\"cmd\":\"" + 34 + "\",\"clientId\":\"" + clintId + "\",\"data\":{\"cardNum\":\"" + cardNum + "\",\"inOrOut\":\"" + inOrOut + "\"}}"; |
cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask.java
| @@ -311,7 +311,14 @@ public class SendUserInfoTask { | @@ -311,7 +311,14 @@ public class SendUserInfoTask { | ||
| 311 | } else { | 311 | } else { |
| 312 | boolean bFaceFalgs = false; | 312 | boolean bFaceFalgs = false; |
| 313 | 313 | ||
| 314 | - String cardNum = cardNo(student_num); | 314 | + String cardNum = ""; |
| 315 | + //大华一体机,刷卡开门需要平台十六进制反读直接下发才可正常开门,因这两所学校已下发完成且不用刷卡,所以不做处理, | ||
| 316 | + // 以后使用大华一体机,下发卡号统一处理直接下发,不做取反处理 | ||
| 317 | + if(attendanceBean.getClint_id().startsWith("ytj") | ||
| 318 | + &&Integer.parseInt(attendanceBean.getSchool_id())!=126 | ||
| 319 | + &&Integer.parseInt(attendanceBean.getSchool_id())!=393) | ||
| 320 | + {cardNum = student_num;} | ||
| 321 | + else{cardNum =cardNo(student_num);} | ||
| 315 | // GateModule.getFace(user_id, loginHandleLong); | 322 | // GateModule.getFace(user_id, loginHandleLong); |
| 316 | // GateModule.getUser(user_id, loginHandleLong); | 323 | // GateModule.getUser(user_id, loginHandleLong); |
| 317 | // GateModule.getCard(cardNum, loginHandleLong); | 324 | // GateModule.getCard(cardNum, loginHandleLong); |
| @@ -321,17 +328,33 @@ public class SendUserInfoTask { | @@ -321,17 +328,33 @@ public class SendUserInfoTask { | ||
| 321 | 328 | ||
| 322 | newRecordNo=GateModule.modifyCard(bCardFlags, cardNum, user_id, name, "123456", Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), | 329 | newRecordNo=GateModule.modifyCard(bCardFlags, cardNum, user_id, name, "123456", Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), |
| 323 | 0, 0, 1, startTime, endTime, loginHandleLong, userType); | 330 | 0, 0, 1, startTime, endTime, loginHandleLong, userType); |
| 324 | - if(newRecordNo==1){ | ||
| 325 | - userDao.updateRecordNo(user_id, bCardFlags, attendanceBean.getClint_id());} | 331 | + |
| 332 | + if(newRecordNo==1) { | ||
| 333 | + | ||
| 334 | + userDao.updateRecordNo(user_id, bCardFlags, attendanceBean.getClint_id()); | ||
| 326 | 335 | ||
| 327 | bFaceFalgsInt = GateModule.modifyFaceInfo(user_id, memory, loginHandleLong); | 336 | bFaceFalgsInt = GateModule.modifyFaceInfo(user_id, memory, loginHandleLong); |
| 328 | - if(bFaceFalgsInt==1) {//1照片修改成功 | ||
| 329 | - bFaceFalgs=true; | 337 | + if (bFaceFalgsInt == 1) {//1照片修改成功 |
| 338 | + bFaceFalgs = true; | ||
| 339 | + } | ||
| 340 | +// else if (bFaceFalgsInt == 1029)//问题,编辑人脸提示用户id不存在,故此增加此 | ||
| 341 | +// { | ||
| 342 | +// bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456" | ||
| 343 | +// , Res.string().getCardStatusInt(1), Res.string().getCardTypeInt(1), 0, 1 | ||
| 344 | +// , 1, startTime, endTime, loginHandleLong, userType); | ||
| 345 | +// if (bCardFlags != -1) { | ||
| 346 | +// userDao.updateRecordNo(user_id, bCardFlags, attendanceBean.getClint_id()); | ||
| 347 | +// } | ||
| 348 | +// //添加人脸 | ||
| 349 | +// bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong); | ||
| 350 | +// } | ||
| 351 | + else { | ||
| 352 | + bFaceFalgs = false; | ||
| 330 | } | 353 | } |
| 331 | - else{bFaceFalgs=false;} | ||
| 332 | //卡号添加成功,但是人脸不成功的话,就需要新增人脸 | 354 | //卡号添加成功,但是人脸不成功的话,就需要新增人脸 |
| 333 | if (!bFaceFalgs) | 355 | if (!bFaceFalgs) |
| 334 | bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong); | 356 | bFaceFalgs = GateModule.addFaceInfo(user_id, memory, loginHandleLong); |
| 357 | + } | ||
| 335 | else{ | 358 | else{ |
| 336 | userDao.deleteRecordNo(user_id, bCardFlags); | 359 | userDao.deleteRecordNo(user_id, bCardFlags); |
| 337 | bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456" | 360 | bCardFlags = GateModule.insertCard(cardNum, user_id, name, "123456" |
| @@ -417,6 +440,7 @@ public class SendUserInfoTask { | @@ -417,6 +440,7 @@ public class SendUserInfoTask { | ||
| 417 | } catch (Exception e) { | 440 | } catch (Exception e) { |
| 418 | e.printStackTrace(); | 441 | e.printStackTrace(); |
| 419 | } | 442 | } |
| 443 | + System.out.println("\n"); | ||
| 420 | } | 444 | } |
| 421 | 445 | ||
| 422 | //人脸发送失败信息添加 | 446 | //人脸发送失败信息添加 |
cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
| @@ -51,9 +51,9 @@ public class UserControl { | @@ -51,9 +51,9 @@ public class UserControl { | ||
| 51 | 51 | ||
| 52 | @RequestMapping(value = "uploadImgAndUserInfo", method = RequestMethod.GET) | 52 | @RequestMapping(value = "uploadImgAndUserInfo", method = RequestMethod.GET) |
| 53 | @ApiOperation(value = "上传用户信息") | 53 | @ApiOperation(value = "上传用户信息") |
| 54 | - public boolean uploadImgAndUserInfo(@RequestParam("file") String file, @RequestParam("schoolId") String schoolId, @RequestParam("studentCode") String studentCode, @RequestParam("clint_type") String clint_type) { | 54 | + public boolean uploadImgAndUserInfo(@RequestParam("file") String file, @RequestParam("schoolId") String schoolId, @RequestParam("studentCode") String studentCode, @RequestParam("clint_type") String clint_type,@RequestParam(value = "deviceId",required = false) String deviceId) { |
| 55 | // return userService.uploadImgAndUserInfo(file, schoolId, studentCode, clint_type); | 55 | // return userService.uploadImgAndUserInfo(file, schoolId, studentCode, clint_type); |
| 56 | - return HttpUtils.uploadImgs(new File(file), schoolId, studentCode, clint_type, file.contains("Teacher") ? 1 : 2,""); | 56 | + return HttpUtils.uploadImgs(new File(file), schoolId, studentCode, clint_type, file.contains("Teacher") ? 1 : 2,deviceId); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | @RequestMapping(value = "sendPermission", method = RequestMethod.POST) | 59 | @RequestMapping(value = "sendPermission", method = RequestMethod.POST) |
cloud/dahua/src/main/java/com/example/dahua/module/GateModule.java
| @@ -380,7 +380,7 @@ public class GateModule { | @@ -380,7 +380,7 @@ public class GateModule { | ||
| 380 | String strCmd = NetSDKLib.CFG_CMD_ACCESSTIMESCHEDULE; | 380 | String strCmd = NetSDKLib.CFG_CMD_ACCESSTIMESCHEDULE; |
| 381 | int nChannel = 120; // 通道号 | 381 | int nChannel = 120; // 通道号 |
| 382 | // msg.stuTimeWeekDay[0].stuTimeSection[0].dwRecordMask | 382 | // msg.stuTimeWeekDay[0].stuTimeSection[0].dwRecordMask |
| 383 | - String name = "3"; | 383 | + String name = "4"; |
| 384 | System.arraycopy(name.getBytes(), 0, msg.szName, 0, name.getBytes().length); | 384 | System.arraycopy(name.getBytes(), 0, msg.szName, 0, name.getBytes().length); |
| 385 | msg.bEnable = 1; | 385 | msg.bEnable = 1; |
| 386 | 386 | ||
| @@ -721,8 +721,8 @@ public class GateModule { | @@ -721,8 +721,8 @@ public class GateModule { | ||
| 721 | if (!bRet) { | 721 | if (!bRet) { |
| 722 | //System.err.println("修改卡信息失败." + ToolKits.getErrorCodePrint()); | 722 | //System.err.println("修改卡信息失败." + ToolKits.getErrorCodePrint()); |
| 723 | String ret=ToolKits.getErrorCodePrint(); | 723 | String ret=ToolKits.getErrorCodePrint(); |
| 724 | - System.err.println("修改卡信息失败." + ret); | ||
| 725 | String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); | 724 | String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); |
| 725 | + System.err.println("修改卡信息失败." + ret+" "+number); | ||
| 726 | if(number.equals("21")||number.equals("147"))//147用户不存在,21对返回数据的校验出错 | 726 | if(number.equals("21")||number.equals("147"))//147用户不存在,21对返回数据的校验出错 |
| 727 | { | 727 | { |
| 728 | // newRecordNo= insertCard( cardNo, userId, cardName, cardPwd, | 728 | // newRecordNo= insertCard( cardNo, userId, cardName, cardPwd, |
| @@ -734,7 +734,8 @@ public class GateModule { | @@ -734,7 +734,8 @@ public class GateModule { | ||
| 734 | return Integer.parseInt(number); | 734 | return Integer.parseInt(number); |
| 735 | } | 735 | } |
| 736 | return 0; | 736 | return 0; |
| 737 | - } else { | 737 | + } |
| 738 | + else { | ||
| 738 | System.out.println("修改卡信息成功 "); | 739 | System.out.println("修改卡信息成功 "); |
| 739 | } | 740 | } |
| 740 | 741 | ||
| @@ -1138,9 +1139,9 @@ public class GateModule { | @@ -1138,9 +1139,9 @@ public class GateModule { | ||
| 1138 | { | 1139 | { |
| 1139 | return modifyFaceInfo( userId, memory, lLong)==1?true:false; | 1140 | return modifyFaceInfo( userId, memory, lLong)==1?true:false; |
| 1140 | } | 1141 | } |
| 1141 | - if(number.equals("1029"))//照片已存在 | 1142 | + if(number.equals("1029"))//用户ID不存在 |
| 1142 | { | 1143 | { |
| 1143 | - return addFaceInfo( userId, memory, lLong); | 1144 | + //return addFaceInfo( userId, memory, lLong); |
| 1144 | } | 1145 | } |
| 1145 | return false; | 1146 | return false; |
| 1146 | } | 1147 | } |