Commit e422f75252329630bff59c922b5f3d5e965a7492
1 parent
44a47616
Exists in
master
事件订阅回调中增加设备sn判断
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
... | ... | @@ -307,6 +307,10 @@ public class MyTask implements ApplicationRunner { |
307 | 307 | if (gateBufferedImage != null) { |
308 | 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 | 314 | int schoolId=userDao.getSchoolIdbyClint_id(szSn); |
311 | 315 | //卡号取反(大写) |
312 | 316 | if(!szSn.startsWith("ytj")&&schoolId==126&&schoolId==393){ |
... | ... | @@ -382,7 +386,7 @@ public class MyTask implements ApplicationRunner { |
382 | 386 | |
383 | 387 | } |
384 | 388 | public final static String REGEX_POSITIVE_INTEGER = "^\\+?[1-9]\\d*$"; |
385 | - | |
389 | + public final static String REGEX_POSITIVE_Symbol = "\\\":?!."; | |
386 | 390 | private boolean isMatch(String regex, String orginal) { |
387 | 391 | if (orginal == null || orginal.trim().equals("")) { //$NON-NLS-1$ |
388 | 392 | return false; | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
... | ... | @@ -105,8 +105,8 @@ public class HttpUtils { |
105 | 105 | * @return |
106 | 106 | */ |
107 | 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 | 110 | RestTemplate restTemplate = new RestTemplate(); |
111 | 111 | |
112 | 112 | HttpHeaders headers = new HttpHeaders(); | ... | ... |