Commit e422f75252329630bff59c922b5f3d5e965a7492

Authored by 邱一成
1 parent 44a47616
Exists in master

事件订阅回调中增加设备sn判断

cloud/dahua/src/main/java/com/example/dahua/MyTask.java
@@ -307,6 +307,10 @@ public class MyTask implements ApplicationRunner { @@ -307,6 +307,10 @@ public class MyTask implements ApplicationRunner {
307 if (gateBufferedImage != null) { 307 if (gateBufferedImage != null) {
308 ImageIO.write(gateBufferedImage, "png", new File(snapPicPath)); 308 ImageIO.write(gateBufferedImage, "png", new File(snapPicPath));
309 } 309 }
  310 + if(isMatch(REGEX_POSITIVE_Symbol, szSn)){//验证设备id是否存在特殊字符
  311 + log.info("设备ID: {},卡号: {}",szSn,card);
  312 + return 0;
  313 + }
310 int schoolId=userDao.getSchoolIdbyClint_id(szSn); 314 int schoolId=userDao.getSchoolIdbyClint_id(szSn);
311 //卡号取反(大写) 315 //卡号取反(大写)
312 if(!szSn.startsWith("ytj")&&schoolId==126&&schoolId==393){ 316 if(!szSn.startsWith("ytj")&&schoolId==126&&schoolId==393){
@@ -382,7 +386,7 @@ public class MyTask implements ApplicationRunner { @@ -382,7 +386,7 @@ public class MyTask implements ApplicationRunner {
382 386
383 } 387 }
384 public final static String REGEX_POSITIVE_INTEGER = "^\\+?[1-9]\\d*$"; 388 public final static String REGEX_POSITIVE_INTEGER = "^\\+?[1-9]\\d*$";
385 - 389 + public final static String REGEX_POSITIVE_Symbol = "\\\":?!.";
386 private boolean isMatch(String regex, String orginal) { 390 private boolean isMatch(String regex, String orginal) {
387 if (orginal == null || orginal.trim().equals("")) { //$NON-NLS-1$ 391 if (orginal == null || orginal.trim().equals("")) { //$NON-NLS-1$
388 return false; 392 return false;
cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
@@ -105,8 +105,8 @@ public class HttpUtils { @@ -105,8 +105,8 @@ public class HttpUtils {
105 * @return 105 * @return
106 */ 106 */
107 public static boolean sendPermission(PermissionBean permissionBean) { 107 public static boolean sendPermission(PermissionBean permissionBean) {
108 -// String url = "http://121.40.109.21:8991/file/sendPermission";  
109 - String url = "http://localhost:8991/file/sendPermission"; 108 + String url = "http://121.40.109.21:8991/file/sendPermission";
  109 +// String url = "http://localhost:8991/file/sendPermission";
110 RestTemplate restTemplate = new RestTemplate(); 110 RestTemplate restTemplate = new RestTemplate();
111 111
112 HttpHeaders headers = new HttpHeaders(); 112 HttpHeaders headers = new HttpHeaders();