Commit fb56ca7f72887a0edae799693a63afda18440ef5
1 parent
c95dfc74
Exists in
master
代码修改
Showing
3 changed files
with
20 additions
and
21 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
| @@ -73,22 +73,22 @@ public class MyTask implements ApplicationRunner { | @@ -73,22 +73,22 @@ public class MyTask implements ApplicationRunner { | ||
| 73 | 73 | ||
| 74 | public boolean isHasNewDevice = false;//判断是否有新设备上线 | 74 | public boolean isHasNewDevice = false;//判断是否有新设备上线 |
| 75 | 75 | ||
| 76 | - @Autowired | ||
| 77 | - private MyScheduledTask myScheduledTask; | ||
| 78 | - | ||
| 79 | @Override | 76 | @Override |
| 80 | public void run(ApplicationArguments args) throws Exception { | 77 | public void run(ApplicationArguments args) throws Exception { |
| 81 | - /** | ||
| 82 | - * 设备初始化、自注册 | ||
| 83 | - */ | ||
| 84 | - new MyTask(); | 78 | +// 121.40.109.21 |
| 79 | + // 打开工程,初始化 | ||
| 80 | + LoginModule.init(disConnect, haveReConnect); | ||
| 81 | + //自注册 | ||
| 82 | + autoRegister(); | ||
| 83 | + | ||
| 84 | +// System.out.println(" sendRecordDao:"+sendRecordDao.getSenSuccess()); | ||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | - private MyTask() { | ||
| 88 | - /** | ||
| 89 | - * 打开工程,初始化 | ||
| 90 | - */ | ||
| 91 | - LoginModule.init(disConnect, haveReConnect); | 87 | + |
| 88 | + /** | ||
| 89 | + * 设备自注册 | ||
| 90 | + */ | ||
| 91 | + private void autoRegister() { | ||
| 92 | 92 | ||
| 93 | /** | 93 | /** |
| 94 | * 开启监听服务 | 94 | * 开启监听服务 |
| @@ -102,7 +102,7 @@ public class MyTask implements ApplicationRunner { | @@ -102,7 +102,7 @@ public class MyTask implements ApplicationRunner { | ||
| 102 | // 设备断线回调: 通过 CLIENT_Init 设置该回调函数,当设备出现断线时,SDK会调用该函数 | 102 | // 设备断线回调: 通过 CLIENT_Init 设置该回调函数,当设备出现断线时,SDK会调用该函数 |
| 103 | private class DisConnect implements NetSDKLib.fDisConnect { | 103 | private class DisConnect implements NetSDKLib.fDisConnect { |
| 104 | public void invoke(NetSDKLib.LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { | 104 | public void invoke(NetSDKLib.LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { |
| 105 | - System.out.printf("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort); | 105 | + log.info("Device[%s] Port[%d] DisConnect!\n", pchDVRIP, nDVRPort); |
| 106 | String deviceId = getDeviceId(pchDVRIP, nDVRPort); | 106 | String deviceId = getDeviceId(pchDVRIP, nDVRPort); |
| 107 | if (!StringUtils.isEmpty(deviceId)) { | 107 | if (!StringUtils.isEmpty(deviceId)) { |
| 108 | attendanceService.updateConnectStateWithDevid(0, deviceId); | 108 | attendanceService.updateConnectStateWithDevid(0, deviceId); |
| @@ -123,7 +123,7 @@ public class MyTask implements ApplicationRunner { | @@ -123,7 +123,7 @@ public class MyTask implements ApplicationRunner { | ||
| 123 | public void invoke(NetSDKLib.LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { | 123 | public void invoke(NetSDKLib.LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) { |
| 124 | // 重连提示 | 124 | // 重连提示 |
| 125 | String deviceId = getDeviceId(pchDVRIP, nDVRPort); | 125 | String deviceId = getDeviceId(pchDVRIP, nDVRPort); |
| 126 | - System.out.printf("ReConnect Device[%s] IP[%S] Port[%d]\n", deviceId,pchDVRIP, nDVRPort); | 126 | + log.info("ReConnect Device[%s] IP[%S] Port[%d]\n", deviceId,pchDVRIP, nDVRPort); |
| 127 | if (!StringUtils.isEmpty(deviceId)) { | 127 | if (!StringUtils.isEmpty(deviceId)) { |
| 128 | attendanceService.updateConnectStateWithDevid(1, deviceId); | 128 | attendanceService.updateConnectStateWithDevid(1, deviceId); |
| 129 | // devMap.put(deviceId,""); | 129 | // devMap.put(deviceId,""); |
| @@ -199,15 +199,15 @@ public class MyTask implements ApplicationRunner { | @@ -199,15 +199,15 @@ public class MyTask implements ApplicationRunner { | ||
| 199 | } catch (UnsupportedEncodingException e) { | 199 | } catch (UnsupportedEncodingException e) { |
| 200 | e.printStackTrace(); | 200 | e.printStackTrace(); |
| 201 | } | 201 | } |
| 202 | - System.out.printf("Register Device Info [Device address %s][port %s][DeviceID %s] \n", pIp, wPort, deviceId); | 202 | + log.info("Register Device Info [Device address %s][port %s][DeviceID %s] \n", pIp, wPort, deviceId); |
| 203 | switch (lCommand) { | 203 | switch (lCommand) { |
| 204 | case NetSDKLib.EM_LISTEN_TYPE.NET_DVR_DISCONNECT: { // 验证期间设备断线回调 | 204 | case NetSDKLib.EM_LISTEN_TYPE.NET_DVR_DISCONNECT: { // 验证期间设备断线回调 |
| 205 | - System.out.println("EM_LISTEN_TYPE:验证期间设备断线回调"); | 205 | + log.info("EM_LISTEN_TYPE:验证期间设备断线回调"); |
| 206 | 206 | ||
| 207 | break; | 207 | break; |
| 208 | } | 208 | } |
| 209 | case NetSDKLib.EM_LISTEN_TYPE.NET_DVR_SERIAL_RETURN: { // 设备注册携带序列号 | 209 | case NetSDKLib.EM_LISTEN_TYPE.NET_DVR_SERIAL_RETURN: { // 设备注册携带序列号 |
| 210 | - System.out.println("EM_LISTEN_TYPE:设备注册携带序列号"); | 210 | + log.info("EM_LISTEN_TYPE:设备注册携带序列号"); |
| 211 | /** | 211 | /** |
| 212 | * 主动注册调用的登录接口,获取登录句柄 | 212 | * 主动注册调用的登录接口,获取登录句柄 |
| 213 | */ | 213 | */ |
| @@ -251,7 +251,7 @@ public class MyTask implements ApplicationRunner { | @@ -251,7 +251,7 @@ public class MyTask implements ApplicationRunner { | ||
| 251 | DeviceInfoBean dev = it.next(); | 251 | DeviceInfoBean dev = it.next(); |
| 252 | if (lLongMap.get(dev.getDevcieId()).intValue() > 0) { | 252 | if (lLongMap.get(dev.getDevcieId()).intValue() > 0) { |
| 253 | NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId()); | 253 | NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId()); |
| 254 | - System.out.println("监听成功:"+dev.getDevcieId()); | 254 | + log.info("监听成功:"+dev.getDevcieId()); |
| 255 | if (lLong.intValue() != -1) { | 255 | if (lLong.intValue() != -1) { |
| 256 | //it.remove(); | 256 | //it.remove(); |
| 257 | } | 257 | } |
cloud/dahua/src/main/java/com/example/dahua/service/imp/PermissFaceServiceImp.java
| @@ -87,7 +87,7 @@ public class PermissFaceServiceImp implements PermissFaceService { | @@ -87,7 +87,7 @@ public class PermissFaceServiceImp implements PermissFaceService { | ||
| 87 | permissionBean.setChannel(permissionFaceBean.getChannel()); | 87 | permissionBean.setChannel(permissionFaceBean.getChannel()); |
| 88 | } | 88 | } |
| 89 | if(!StringUtils.isEmpty(permissionFaceBean.getCustomName())){ | 89 | if(!StringUtils.isEmpty(permissionFaceBean.getCustomName())){ |
| 90 | - permissionBean.setChannel(permissionFaceBean.getCustomName()); | 90 | + permissionBean.setCustomName(permissionFaceBean.getCustomName()); |
| 91 | } | 91 | } |
| 92 | responseBean.setData(null); | 92 | responseBean.setData(null); |
| 93 | sendPermiss2Dev(permissionFaceBean); | 93 | sendPermiss2Dev(permissionFaceBean); |
cloud/dahua/src/main/resources/application.yml
| @@ -46,8 +46,7 @@ mybatis: | @@ -46,8 +46,7 @@ mybatis: | ||
| 46 | mapper-locations: classpath:xiaoanmapper/*.xml | 46 | mapper-locations: classpath:xiaoanmapper/*.xml |
| 47 | config-location: classpath:mybatis-config.xml | 47 | config-location: classpath:mybatis-config.xml |
| 48 | 48 | ||
| 49 | -#logging: | ||
| 50 | -# config: classpath:logback-spring.xml | 49 | + |
| 51 | 50 | ||
| 52 | #haikangpic: E:\wwwhtdocs\HFface\FaceLogs\ | 51 | #haikangpic: E:\wwwhtdocs\HFface\FaceLogs\ |
| 53 | 52 |