Commit 410a48a6cd0261bbbd8f41125375b37e1773ae42

Authored by 徐泉
1 parent 9df247c3
Exists in master

考勤设备ID获取

cloud/dahua/src/main/java/com/example/dahua/MyTask.java
@@ -74,11 +74,6 @@ public class MyTask implements ApplicationRunner { @@ -74,11 +74,6 @@ public class MyTask implements ApplicationRunner {
74 //自注册 74 //自注册
75 autoRegister(); 75 autoRegister();
76 76
77 - /**  
78 - * 考勤监听  
79 - */  
80 - kaoQinRecord();  
81 -  
82 // System.out.println(" sendRecordDao:"+sendRecordDao.getSenSuccess()); 77 // System.out.println(" sendRecordDao:"+sendRecordDao.getSenSuccess());
83 } 78 }
84 79
@@ -105,8 +100,6 @@ public class MyTask implements ApplicationRunner { @@ -105,8 +100,6 @@ public class MyTask implements ApplicationRunner {
105 if (!StringUtils.isEmpty(deviceId)) { 100 if (!StringUtils.isEmpty(deviceId)) {
106 attendanceService.updateConnectStateWithDevid(0, deviceId); 101 attendanceService.updateConnectStateWithDevid(0, deviceId);
107 GateModule.stopRealLoadPic(lLongMap.get(deviceId)); 102 GateModule.stopRealLoadPic(lLongMap.get(deviceId));
108 - //人脸识别、人脸检测事件  
109 - FaceRecognitionModule.stopRealLoadPicture(lLongMap.get(deviceId));  
110 lLongMap.remove(deviceId); 103 lLongMap.remove(deviceId);
111 // devMap.remove(deviceId); 104 // devMap.remove(deviceId);
112 removeDevice(deviceId); 105 removeDevice(deviceId);
@@ -249,7 +242,7 @@ public class MyTask implements ApplicationRunner { @@ -249,7 +242,7 @@ public class MyTask implements ApplicationRunner {
249 for (DeviceInfoBean dev : 242 for (DeviceInfoBean dev :
250 deviceInfoBeans) { 243 deviceInfoBeans) {
251 if (lLongMap.get(dev.getDevcieId()).intValue() > 0) { 244 if (lLongMap.get(dev.getDevcieId()).intValue() > 0) {
252 - NetSDKLib.LLong lLong = GateModule.realLoadPic(0, analyzerCallback, lLongMap.get(dev.getDevcieId())); 245 + NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId());
253 // System.out.println("监听成功:"+dev.getDevcieId()); 246 // System.out.println("监听成功:"+dev.getDevcieId());
254 // if (lLong.intValue() != -1) { 247 // if (lLong.intValue() != -1) {
255 // //deviceInfoBeans.remove(dev); 248 // //deviceInfoBeans.remove(dev);
@@ -260,22 +253,6 @@ public class MyTask implements ApplicationRunner { @@ -260,22 +253,6 @@ public class MyTask implements ApplicationRunner {
260 } 253 }
261 } 254 }
262 255
263 - /**  
264 - * 考勤监听  
265 - */  
266 - public synchronized void kaoQinRecord() {  
267 - isHasNewDevice = false;  
268 - if (null != deviceInfoBeans && deviceInfoBeans.size() > 0) {  
269 - for (DeviceInfoBean dev :  
270 - deviceInfoBeans) {  
271 - if (lLongMap.get(dev.getDevcieId()).intValue() > 0) {  
272 - //人脸识别、人脸检测事件监听  
273 - NetSDKLib.LLong lLong = FaceRecognitionModule.realLoadPicture(0, analyzerCallback);  
274 - }  
275 - }  
276 - }  
277 - }  
278 -  
279 256
280 //智能订阅 257 //智能订阅
281 private AnalyzerDataCB analyzerCallback = new AnalyzerDataCB(); 258 private AnalyzerDataCB analyzerCallback = new AnalyzerDataCB();
@@ -300,12 +277,19 @@ public class MyTask implements ApplicationRunner { @@ -300,12 +277,19 @@ public class MyTask implements ApplicationRunner {
300 path.mkdir(); 277 path.mkdir();
301 } 278 }
302 279
  280 + //设备ID获取
  281 + NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
  282 + ToolKits.GetPointerData(dwUser, deviceInfo);
  283 +
  284 + String szSn = new String(deviceInfo.sSerialNumber).trim();
  285 +
303 ///< 门禁事件 286 ///< 门禁事件
304 if (dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) { 287 if (dwAlarmType == NetSDKLib.EVENT_IVS_ACCESS_CTL) {
305 NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO msg = new NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO(); 288 NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO msg = new NetSDKLib.DEV_EVENT_ACCESS_CTL_INFO();
306 ToolKits.GetPointerData(pAlarmInfo, msg); 289 ToolKits.GetPointerData(pAlarmInfo, msg);
307 //卡号 290 //卡号
308 String card = new String(msg.szCardNo).trim(); 291 String card = new String(msg.szCardNo).trim();
  292 +
309 System.out.println("sda:" + card + " 抓拍照片存储地址:"); 293 System.out.println("sda:" + card + " 抓拍照片存储地址:");
310 294
311 try { 295 try {
@@ -329,11 +313,11 @@ public class MyTask implements ApplicationRunner { @@ -329,11 +313,11 @@ public class MyTask implements ApplicationRunner {
329 if (null != cardBean && cardBean.getType() == 0) { 313 if (null != cardBean && cardBean.getType() == 0) {
330 //老师人脸信息,保存人脸记录表 314 //老师人脸信息,保存人脸记录表
331 TeacherBean teacherBean = userDao.getTeacherWithId(cardBean.getUser_id()); 315 TeacherBean teacherBean = userDao.getTeacherWithId(cardBean.getUser_id());
332 - sendRecordDao.addFaceRecoder("", teacherBean.getUser_id(), teacherBean.getName(), snapPicPath, 1, time, card,""); 316 + sendRecordDao.addFaceRecoder(szSn, teacherBean.getUser_id(), teacherBean.getName(), snapPicPath, 1, time, card,"");
333 } else if (null != cardBean && cardBean.getType() == 2) { 317 } else if (null != cardBean && cardBean.getType() == 2) {
334 //学生人脸信息,保存人脸记录表 318 //学生人脸信息,保存人脸记录表
335 UserInfoBean userInfoBean = userDao.getStudentWithid(cardBean.getUser_id()); 319 UserInfoBean userInfoBean = userDao.getStudentWithid(cardBean.getUser_id());
336 - sendRecordDao.addFaceRecoder("", userInfoBean.getUser_id(), userInfoBean.getName(), snapPicPath, 1, time, card,""); 320 + sendRecordDao.addFaceRecoder(szSn, userInfoBean.getUser_id(), userInfoBean.getName(), snapPicPath, 1, time, card,"");
337 } 321 }
338 322
339 // TODO 考勤记录 323 // TODO 考勤记录
@@ -344,7 +328,7 @@ public class MyTask implements ApplicationRunner { @@ -344,7 +328,7 @@ public class MyTask implements ApplicationRunner {
344 //刷卡时间 328 //刷卡时间
345 String eventTime = msg.UTC.toStringTime(); 329 String eventTime = msg.UTC.toStringTime();
346 //保存考勤记录 330 //保存考勤记录
347 - kaoQinRecord(status,eventType,card,"",eventTime,snapPicPath); 331 + kaoQinRecord(status,eventType,card,szSn,eventTime,snapPicPath);
348 } 332 }
349 333
350 } catch (IOException e2) { 334 } catch (IOException e2) {
cloud/dahua/src/main/java/com/example/dahua/module/GateModule.java
@@ -18,10 +18,12 @@ import com.example.dahua.lib.NetSDKLib.*; @@ -18,10 +18,12 @@ import com.example.dahua.lib.NetSDKLib.*;
18 import com.example.dahua.lib.ToolKits; 18 import com.example.dahua.lib.ToolKits;
19 import com.sun.jna.Memory; 19 import com.sun.jna.Memory;
20 import com.sun.jna.ptr.IntByReference; 20 import com.sun.jna.ptr.IntByReference;
  21 +import lombok.extern.slf4j.Slf4j;
21 22
22 import javax.imageio.ImageIO; 23 import javax.imageio.ImageIO;
23 24
24 25
  26 +@Slf4j
25 public class GateModule { 27 public class GateModule {
26 // 查询句柄 28 // 查询句柄
27 private static LLong m_lFindHandle = new LLong(0); 29 private static LLong m_lFindHandle = new LLong(0);
@@ -50,6 +52,33 @@ public class GateModule { @@ -50,6 +52,33 @@ public class GateModule {
50 return m_hAttachHandle; 52 return m_hAttachHandle;
51 } 53 }
52 54
  55 + public static LLong realLoadPic2(int ChannelId, NetSDKLib.fAnalyzerDataCallBack m_AnalyzerDataCB, LLong lLong,String devcieId) {
  56 +
  57 + final NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
  58 +
  59 + // 设备ID
  60 + System.arraycopy(devcieId.getBytes(), 0, deviceInfo.sSerialNumber, 0, devcieId.getBytes().length);
  61 +
  62 + /**
  63 + * 说明:
  64 + * 通道数可以在有登录是返回的信息 m_stDeviceInfo.byChanNum 获取
  65 + * 下列仅订阅了0通道的智能事件.
  66 + */
  67 + int bNeedPicture = 1; // 是否需要图片
  68 + deviceInfo.write();
  69 + LLong m_hAttachHandle = LoginModule.netsdk.CLIENT_RealLoadPictureEx(lLong, ChannelId, NetSDKLib.EVENT_IVS_ALL,
  70 + bNeedPicture, m_AnalyzerDataCB, deviceInfo.getPointer(), null);
  71 + deviceInfo.read();
  72 + if (m_hAttachHandle.longValue() != 0) {
  73 + System.out.println("CLIENT_RealLoadPictureEx Success ChannelId : \n" + ChannelId);
  74 + } else {
  75 + System.err.println("CLIENT_RealLoadPictureEx Failed!" + ToolKits.getErrorCodePrint());
  76 + return null;
  77 + }
  78 +
  79 + return m_hAttachHandle;
  80 + }
  81 +
53 /** 82 /**
54 * 停止上传智能分析数据-图片 83 * 停止上传智能分析数据-图片
55 */ 84 */
@@ -169,6 +198,7 @@ public class GateModule { @@ -169,6 +198,7 @@ public class GateModule {
169 // return true; 198 // return true;
170 } 199 }
171 200
  201 +
172 public static synchronized int insertCard(String cardNo, String userId, String cardName, String cardPwd, 202 public static synchronized int insertCard(String cardNo, String userId, String cardName, String cardPwd,
173 int cardStatus, int cardType, int useTimes, int isFirstEnter, 203 int cardStatus, int cardType, int useTimes, int isFirstEnter,
174 int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) { 204 int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) {
@@ -254,24 +284,25 @@ public class GateModule { @@ -254,24 +284,25 @@ public class GateModule {
254 accessCardInfo.read(); 284 accessCardInfo.read();
255 285
256 if(!bRet) { 286 if(!bRet) {
257 - //System.err.println("添加卡信息失败." + ToolKits.getErrorCodePrint());  
258 String ret=ToolKits.getErrorCodePrint(); 287 String ret=ToolKits.getErrorCodePrint();
259 - System.err.println("添加卡信息失败." + ret);  
260 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); 288 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
261 - if(number.equals("21")||number.equals("146"))//146用户已存在,21对返回数据的校验出错,1162未知错误 number.equals("1162")||  
262 - { 289 + log.info("添加卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
  290 + //146用户已存在,21对返回数据的校验出错,1162未知错误 number.equals("1162")||
  291 + if(number.equals("21")||number.equals("146")) {
  292 + //用户已存在/返回数据校验出错时,执行删除用户
263 deleteUser( userId, lLong); 293 deleteUser( userId, lLong);
  294 + //重新下发卡至设备
264 return insertCard( cardNo, userId, cardName, cardPwd, 295 return insertCard( cardNo, userId, cardName, cardPwd,
265 cardStatus, cardType, useTimes, isFirstEnter, 296 cardStatus, cardType, useTimes, isFirstEnter,
266 isValid, startValidTime, endValidTime, lLong, userType); 297 isValid, startValidTime, endValidTime, lLong, userType);
267 } 298 }
  299 + //其他错误码,返回-1
268 return -1; 300 return -1;
269 } else { 301 } else {
270 - System.out.println("添加卡信息成功,卡信息记录集编号 : " + insert.stuCtrlRecordSetResult.nRecNo); 302 + log.info("添加卡信息成功,卡信息记录集编号 : "+ insert.stuCtrlRecordSetResult.nRecNo);
271 return insert.stuCtrlRecordSetResult.nRecNo; 303 return insert.stuCtrlRecordSetResult.nRecNo;
272 } 304 }
273 305
274 -  
275 // return true; 306 // return true;
276 } 307 }
277 308
@@ -378,7 +409,8 @@ public class GateModule { @@ -378,7 +409,8 @@ public class GateModule {
378 409
379 CFG_ACCESS_TIMESCHEDULE_INFO msg = new CFG_ACCESS_TIMESCHEDULE_INFO(); 410 CFG_ACCESS_TIMESCHEDULE_INFO msg = new CFG_ACCESS_TIMESCHEDULE_INFO();
380 String strCmd = NetSDKLib.CFG_CMD_ACCESSTIMESCHEDULE; 411 String strCmd = NetSDKLib.CFG_CMD_ACCESSTIMESCHEDULE;
381 - int nChannel = 120; // 通道号 412 + // 通道号
  413 + int nChannel = 120;
382 // msg.stuTimeWeekDay[0].stuTimeSection[0].dwRecordMask 414 // msg.stuTimeWeekDay[0].stuTimeSection[0].dwRecordMask
383 String name = "3"; 415 String name = "3";
384 System.arraycopy(name.getBytes(), 0, msg.szName, 0, name.getBytes().length); 416 System.arraycopy(name.getBytes(), 0, msg.szName, 0, name.getBytes().length);
@@ -387,13 +419,11 @@ public class GateModule { @@ -387,13 +419,11 @@ public class GateModule {
387 List<WeekDay> weekDays = permissionBean.getWeekDays(); 419 List<WeekDay> weekDays = permissionBean.getWeekDays();
388 Map<Integer, List<WeekTime>> map = new HashMap<>(); 420 Map<Integer, List<WeekTime>> map = new HashMap<>();
389 421
390 - for (WeekDay weekDay :  
391 - weekDays) { 422 + for (WeekDay weekDay : weekDays) {
392 //整理时间 423 //整理时间
393 initWeedayAndTimes(weekDay, map); 424 initWeedayAndTimes(weekDay, map);
394 //设置周计划信息 425 //设置周计划信息
395 - for (Map.Entry<Integer, List<WeekTime>> entry :  
396 - map.entrySet()) { 426 + for (Map.Entry<Integer, List<WeekTime>> entry : map.entrySet()) {
397 427
398 int weekDayIndex = entry.getKey(); 428 int weekDayIndex = entry.getKey();
399 429
@@ -632,7 +662,25 @@ public class GateModule { @@ -632,7 +662,25 @@ public class GateModule {
632 return true; 662 return true;
633 } 663 }
634 664
635 - public static int modifyCard(int recordNo, String cardNo, String userId, String cardName, String cardPwd, 665 + /**
  666 + * 修改设备卡信息
  667 + * @param recordNo
  668 + * @param cardNo
  669 + * @param userId
  670 + * @param cardName
  671 + * @param cardPwd
  672 + * @param cardStatus
  673 + * @param cardType
  674 + * @param useTimes
  675 + * @param isFirstEnter
  676 + * @param isValid
  677 + * @param startValidTime
  678 + * @param endValidTime
  679 + * @param lLong
  680 + * @param userType
  681 + * @return
  682 + */
  683 + public static boolean modifyCard(int recordNo, String cardNo, String userId, String cardName, String cardPwd,
636 int cardStatus, int cardType, int useTimes, int isFirstEnter, 684 int cardStatus, int cardType, int useTimes, int isFirstEnter,
637 int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) { 685 int isValid, String startValidTime, String endValidTime, LLong lLong,String userType) {
638 /** 686 /**
@@ -717,28 +765,24 @@ public class GateModule { @@ -717,28 +765,24 @@ public class GateModule {
717 CtrlType.CTRLTYPE_CTRL_RECORDSET_UPDATE, update.getPointer(), 5000); 765 CtrlType.CTRLTYPE_CTRL_RECORDSET_UPDATE, update.getPointer(), 5000);
718 update.read(); 766 update.read();
719 accessCardInfo.read(); 767 accessCardInfo.read();
720 - 768 + // 返回值:1成功,否则返回
721 if (!bRet) { 769 if (!bRet) {
722 - //System.err.println("修改卡信息失败." + ToolKits.getErrorCodePrint());  
723 String ret=ToolKits.getErrorCodePrint(); 770 String ret=ToolKits.getErrorCodePrint();
724 - System.err.println("修改卡信息失败." + ret); 771 + //结果码
725 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); 772 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
726 - if(number.equals("21")||number.equals("147"))//147用户不存在,21对返回数据的校验出错  
727 - {  
728 -// newRecordNo= insertCard( cardNo, userId, cardName, cardPwd,  
729 -// cardStatus, cardType, useTimes, isFirstEnter,  
730 -// isValid, startValidTime, endValidTime, lLong, userType);  
731 - }  
732 - if(number.equals("1091")||number.equals("1147"))//未知错误  
733 - {  
734 - return Integer.parseInt(number);  
735 - }  
736 - return 0;  
737 - } else {  
738 - System.out.println("修改卡信息成功 "); 773 + //147用户不存在,21对返回数据的校验出错
  774 +// if(number.equals("21")||number.equals("147")) {
  775 +//
  776 +// }
  777 +// if(number.equals("1091")||number.equals("1147"))//未知错误
  778 +// {
  779 +// return Integer.parseInt(number);
  780 +// }
  781 + log.error("修改卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
  782 + return false;
739 } 783 }
740 -  
741 - return 1; 784 + log.info("修改卡信息成功!");
  785 + return true;
742 } 786 }
743 787
744 /** 788 /**
@@ -778,8 +822,7 @@ public class GateModule { @@ -778,8 +822,7 @@ public class GateModule {
778 msg.pBuf = new IntByReference(recordNo).getPointer(); 822 msg.pBuf = new IntByReference(recordNo).getPointer();
779 823
780 msg.write(); 824 msg.write();
781 - boolean bRet = LoginModule.netsdk.CLIENT_ControlDevice(lLong,  
782 - CtrlType.CTRLTYPE_CTRL_RECORDSET_REMOVE, msg.getPointer(), 5000); 825 + boolean bRet = LoginModule.netsdk.CLIENT_ControlDevice(lLong, CtrlType.CTRLTYPE_CTRL_RECORDSET_REMOVE, msg.getPointer(), 5000);
783 msg.read(); 826 msg.read();
784 827
785 if (!bRet) { 828 if (!bRet) {
@@ -1035,12 +1078,10 @@ public class GateModule { @@ -1035,12 +1078,10 @@ public class GateModule {
1035 * 打印具体的信息 1078 * 打印具体的信息
1036 */ 1079 */
1037 for (int i = 0; i < nMaxNum; i++) { 1080 for (int i = 0; i < nMaxNum; i++) {
1038 - System.out.println("[" + i + "]删除用户结果:"  
1039 - + failCodes[i].nFailCode); 1081 + log.info("[" + i + "]删除用户结果:" + failCodes[i].nFailCode);
1040 } 1082 }
1041 } else { 1083 } else {
1042 - //System.err.println("删除用户失败, " + getErrorCode());  
1043 - System.err.println("删除用户失败, " + ToolKits.getErrorCodePrint()); 1084 + log.error("添加卡信息失败"+ ToolKits.getErrorCodePrint());
1044 } 1085 }
1045 1086
1046 stIn.read(); 1087 stIn.read();
@@ -1128,23 +1169,21 @@ public class GateModule { @@ -1128,23 +1169,21 @@ public class GateModule {
1128 stIn.read(); 1169 stIn.read();
1129 stOut.read(); 1170 stOut.read();
1130 if (bRet) { 1171 if (bRet) {
1131 - System.out.println("添加人脸成功!"); 1172 + log.info("添加人脸成功!");
1132 } else { 1173 } else {
1133 -// System.err.println("添加人脸失败!" + ToolKits.getErrorCodePrint());  
1134 String ret=ToolKits.getErrorCodePrint(); 1174 String ret=ToolKits.getErrorCodePrint();
1135 - System.err.println("添加人脸失败!" + ret);  
1136 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); 1175 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
1137 - if(number.equals("1031"))//照片已存在  
1138 - {  
1139 - return modifyFaceInfo( userId, memory, lLong)==1?true:false; 1176 + log.error("修改卡信息失败,错误信息:{} ,错误码:{} ",ret,number);
  1177 + //number = 1031:照片已存在;number = 1029 :用户ID不存在
  1178 + if(number.equals("1031")){
  1179 + return modifyFaceInfo( userId, memory, lLong);
1140 } 1180 }
1141 - if(number.equals("1029"))//照片已存在 1181 + if(number.equals("1029"))
1142 { 1182 {
1143 return addFaceInfo( userId, memory, lLong); 1183 return addFaceInfo( userId, memory, lLong);
1144 } 1184 }
1145 return false; 1185 return false;
1146 } 1186 }
1147 -  
1148 return true; 1187 return true;
1149 } 1188 }
1150 1189
@@ -1186,7 +1225,7 @@ public class GateModule { @@ -1186,7 +1225,7 @@ public class GateModule {
1186 stIn.read(); 1225 stIn.read();
1187 stOut.read(); 1226 stOut.read();
1188 if (bRet) { 1227 if (bRet) {
1189 - System.out.println("修改人脸成功!"); 1228 + log.info("修改人脸成功!");
1190 } else { 1229 } else {
1191 // System.err.println("修改人脸失败!" + ToolKits.getErrorCodePrint()); 1230 // System.err.println("修改人脸失败!" + ToolKits.getErrorCodePrint());
1192 String ret=ToolKits.getErrorCodePrint(); 1231 String ret=ToolKits.getErrorCodePrint();
@@ -1199,7 +1238,7 @@ public class GateModule { @@ -1199,7 +1238,7 @@ public class GateModule {
1199 } 1238 }
1200 1239
1201 1240
1202 - public static int modifyFaceInfo(String userId, Memory memory, LLong lLong) { 1241 + public static boolean modifyFaceInfo(String userId, Memory memory, LLong lLong) {
1203 int emType = EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_UPDATE; // 修改 1242 int emType = EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_UPDATE; // 修改
1204 1243
1205 /** 1244 /**
@@ -1229,22 +1268,16 @@ public class GateModule { @@ -1229,22 +1268,16 @@ public class GateModule {
1229 boolean bRet = LoginModule.netsdk.CLIENT_FaceInfoOpreate(lLong, emType, stIn.getPointer(), stOut.getPointer(), 5000); 1268 boolean bRet = LoginModule.netsdk.CLIENT_FaceInfoOpreate(lLong, emType, stIn.getPointer(), stOut.getPointer(), 5000);
1230 stIn.read(); 1269 stIn.read();
1231 stOut.read(); 1270 stOut.read();
  1271 +
1232 if (bRet) { 1272 if (bRet) {
1233 - System.out.println("修改人脸成功!"); 1273 + log.info("修改人脸成功!");
1234 } else { 1274 } else {
1235 -// System.err.println("修改人脸失败!" + ToolKits.getErrorCodePrint());  
1236 String ret=ToolKits.getErrorCodePrint(); 1275 String ret=ToolKits.getErrorCodePrint();
1237 - System.err.println("修改人脸失败!" + ret);  
1238 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")")); 1276 String number = ret.substring(ret.indexOf("|") + 1, ret.indexOf(")"));
1239 - if(number.equals("1029"))//1029用户ID不存在  
1240 - {  
1241 - //return addFaceInfo(userId, memory, lLong);  
1242 - return Integer.parseInt(number);  
1243 - }  
1244 - return 0; 1277 + log.error("修改人脸失败,错误信息:{} ,错误码:{} ",ret,number);
  1278 + return false;
1245 } 1279 }
1246 -  
1247 - return 1; 1280 + return true;
1248 } 1281 }
1249 1282
1250 /** 1283 /**
cloud/dahua/src/main/java/com/example/dahua/service/UserService.java
@@ -54,6 +54,12 @@ public interface UserService { @@ -54,6 +54,12 @@ public interface UserService {
54 */ 54 */
55 boolean sendPermission(PermissionBean permissionBean); 55 boolean sendPermission(PermissionBean permissionBean);
56 56
  57 + /**
  58 + * 根据学籍号、学校id获取用户id
  59 + * @param code
  60 + * @param schoolId
  61 + * @return
  62 + */
57 String getUserId(String code,String schoolId); 63 String getUserId(String code,String schoolId);
58 64
59 65