Commit cd07eb23600d62680cafeae7ee2515e859d234fb
1 parent
d80bdd42
Exists in
master
增加网关负载
Showing
17 changed files
with
106 additions
and
66 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/mqtt/MqttManager.java
| @@ -96,7 +96,7 @@ public class MqttManager { | @@ -96,7 +96,7 @@ public class MqttManager { | ||
| 96 | public void sendMq(String deviceId, String cmd) { | 96 | public void sendMq(String deviceId, String cmd) { |
| 97 | String recvClientId = groupId + "@@@" + deviceId; | 97 | String recvClientId = groupId + "@@@" + deviceId; |
| 98 | final String p2pSendTopic = topic + "/p2p/" + recvClientId; | 98 | final String p2pSendTopic = topic + "/p2p/" + recvClientId; |
| 99 | - String content = "{\"cmd\":\"" + cmd + "\",\"clientId\":\"" + deviceId + "\",\"data\": \"http://update.myjxt.com/CloundWindowYueQing.apk\"}"; | 99 | + String content = "{\"cmd\":\"" + cmd + "\",\"clientId\":\"" + deviceId + "\",\"data\": \"http://update.myjxt.com/CloundWindow.apk\"}"; |
| 100 | MqttMessage message = new MqttMessage(content.getBytes()); | 100 | MqttMessage message = new MqttMessage(content.getBytes()); |
| 101 | message.setQos(qosLevel); | 101 | message.setQos(qosLevel); |
| 102 | System.out.println("发送内容:" + p2pSendTopic); | 102 | System.out.println("发送内容:" + p2pSendTopic); |
cloud/dahua/src/test/java/com/example/dahua/DahuaApplicationTests.java
| @@ -478,13 +478,23 @@ public class DahuaApplicationTests { | @@ -478,13 +478,23 @@ public class DahuaApplicationTests { | ||
| 478 | @Test | 478 | @Test |
| 479 | public void test1() { | 479 | public void test1() { |
| 480 | 480 | ||
| 481 | - List<StudentBean> list = userDao.getStudentUserIdsWith(); | 481 | +// List<StudentBean> list = userDao.getStudentUserIdsWith(); |
| 482 | +// | ||
| 483 | +// for (int i = 0; i < list.size(); i++) { | ||
| 484 | +// StudentBean studentBean = list.get(i); | ||
| 485 | +// } | ||
| 486 | +// | ||
| 487 | +// System.out.println("list:" + list.toString()); | ||
| 488 | + | ||
| 489 | + List<AttendanceBean> attendanceBeanList = userDao.getAttendanceBeans("479","4"); | ||
| 490 | + | ||
| 491 | + for (int i = 0; i < attendanceBeanList.size(); i++) { | ||
| 492 | + AttendanceBean attendanceBean = attendanceBeanList.get(i); | ||
| 493 | + | ||
| 482 | 494 | ||
| 483 | - for (int i = 0; i < list.size(); i++) { | ||
| 484 | - StudentBean studentBean = list.get(i); | ||
| 485 | } | 495 | } |
| 486 | 496 | ||
| 487 | - System.out.println("list:" + list.toString()); | 497 | + |
| 488 | 498 | ||
| 489 | } | 499 | } |
| 490 | 500 | ||
| @@ -496,7 +506,7 @@ public class DahuaApplicationTests { | @@ -496,7 +506,7 @@ public class DahuaApplicationTests { | ||
| 496 | 506 | ||
| 497 | mqttManager.init(); | 507 | mqttManager.init(); |
| 498 | 508 | ||
| 499 | - List<String> stringList = userDao.getAllDecWithSch(13); | 509 | + List<String> stringList = userDao.getAllDecWithSch(479); |
| 500 | System.out.println("stringList:" + stringList.size()); | 510 | System.out.println("stringList:" + stringList.size()); |
| 501 | for (int i = 0; i < stringList.size(); i++) { | 511 | for (int i = 0; i < stringList.size(); i++) { |
| 502 | String devId = stringList.get(i); | 512 | String devId = stringList.get(i); |
cloud/haikangface/.gitignore
| 1 | HELP.md | 1 | HELP.md |
| 2 | target/ | 2 | target/ |
| 3 | !.mvn/wrapper/maven-wrapper.jar | 3 | !.mvn/wrapper/maven-wrapper.jar |
| 4 | -!**/src/main/** | ||
| 5 | -!**/src/test/** | 4 | +!**/src/main/**/target/ |
| 5 | +!**/src/test/**/target/ | ||
| 6 | 6 | ||
| 7 | ### STS ### | 7 | ### STS ### |
| 8 | .apt_generated | 8 | .apt_generated |
| @@ -26,6 +26,8 @@ target/ | @@ -26,6 +26,8 @@ target/ | ||
| 26 | /nbdist/ | 26 | /nbdist/ |
| 27 | /.nb-gradle/ | 27 | /.nb-gradle/ |
| 28 | build/ | 28 | build/ |
| 29 | +!**/src/main/**/build/ | ||
| 30 | +!**/src/test/**/build/ | ||
| 29 | 31 | ||
| 30 | ### VS Code ### | 32 | ### VS Code ### |
| 31 | .vscode/ | 33 | .vscode/ |
cloud/haikangface/.mvn/wrapper/MavenWrapperDownloader.java
| 1 | /* | 1 | /* |
| 2 | -Licensed to the Apache Software Foundation (ASF) under one | ||
| 3 | -or more contributor license agreements. See the NOTICE file | ||
| 4 | -distributed with this work for additional information | ||
| 5 | -regarding copyright ownership. The ASF licenses this file | ||
| 6 | -to you under the Apache License, Version 2.0 (the | ||
| 7 | -"License"); you may not use this file except in compliance | ||
| 8 | -with the License. You may obtain a copy of the License at | 2 | + * Copyright 2007-present the original author or authors. |
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 9 | 16 | ||
| 10 | - https://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | - | ||
| 12 | -Unless required by applicable law or agreed to in writing, | ||
| 13 | -software distributed under the License is distributed on an | ||
| 14 | -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 15 | -KIND, either express or implied. See the License for the | ||
| 16 | -specific language governing permissions and limitations | ||
| 17 | -under the License. | ||
| 18 | -*/ | ||
| 19 | - | ||
| 20 | -import java.io.File; | ||
| 21 | -import java.io.FileInputStream; | ||
| 22 | -import java.io.FileOutputStream; | ||
| 23 | -import java.io.IOException; | ||
| 24 | -import java.net.URL; | ||
| 25 | -import java.nio.channels.Channels; | ||
| 26 | -import java.nio.channels.ReadableByteChannel; | 17 | +import java.net.*; |
| 18 | +import java.io.*; | ||
| 19 | +import java.nio.channels.*; | ||
| 27 | import java.util.Properties; | 20 | import java.util.Properties; |
| 28 | 21 | ||
| 29 | public class MavenWrapperDownloader { | 22 | public class MavenWrapperDownloader { |
| 30 | 23 | ||
| 24 | + private static final String WRAPPER_VERSION = "0.5.6"; | ||
| 31 | /** | 25 | /** |
| 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. | 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| 33 | */ | 27 | */ |
| 34 | - private static final String DEFAULT_DOWNLOAD_URL = | ||
| 35 | - "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; | 28 | + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| 29 | + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; | ||
| 36 | 30 | ||
| 37 | /** | 31 | /** |
| 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to | 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| @@ -80,13 +74,13 @@ public class MavenWrapperDownloader { | @@ -80,13 +74,13 @@ public class MavenWrapperDownloader { | ||
| 80 | } | 74 | } |
| 81 | } | 75 | } |
| 82 | } | 76 | } |
| 83 | - System.out.println("- Downloading from: : " + url); | 77 | + System.out.println("- Downloading from: " + url); |
| 84 | 78 | ||
| 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| 86 | if (!outputFile.getParentFile().exists()) { | 80 | if (!outputFile.getParentFile().exists()) { |
| 87 | if (!outputFile.getParentFile().mkdirs()) { | 81 | if (!outputFile.getParentFile().mkdirs()) { |
| 88 | System.out.println( | 82 | System.out.println( |
| 89 | - "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); | 83 | + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| 90 | } | 84 | } |
| 91 | } | 85 | } |
| 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); | 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| @@ -102,6 +96,16 @@ public class MavenWrapperDownloader { | @@ -102,6 +96,16 @@ public class MavenWrapperDownloader { | ||
| 102 | } | 96 | } |
| 103 | 97 | ||
| 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| 99 | + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { | ||
| 100 | + String username = System.getenv("MVNW_USERNAME"); | ||
| 101 | + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); | ||
| 102 | + Authenticator.setDefault(new Authenticator() { | ||
| 103 | + @Override | ||
| 104 | + protected PasswordAuthentication getPasswordAuthentication() { | ||
| 105 | + return new PasswordAuthentication(username, password); | ||
| 106 | + } | ||
| 107 | + }); | ||
| 108 | + } | ||
| 105 | URL website = new URL(urlString); | 109 | URL website = new URL(urlString); |
| 106 | ReadableByteChannel rbc; | 110 | ReadableByteChannel rbc; |
| 107 | rbc = Channels.newChannel(website.openStream()); | 111 | rbc = Channels.newChannel(website.openStream()); |
cloud/haikangface/.mvn/wrapper/maven-wrapper.jar
No preview for this file type
cloud/haikangface/.mvn/wrapper/maven-wrapper.properties
| 1 | -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip | 1 | +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| 2 | +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
| @@ -10,10 +10,12 @@ import com.sincere.haikangface.haikanglibs.HCEHomeAlarm; | @@ -10,10 +10,12 @@ import com.sincere.haikangface.haikanglibs.HCEHomeAlarm; | ||
| 10 | import com.sincere.haikangface.haikanglibs.HCEHomeCMS; | 10 | import com.sincere.haikangface.haikanglibs.HCEHomeCMS; |
| 11 | import com.sincere.haikangface.haikanglibs.HCEHomeSS; | 11 | import com.sincere.haikangface.haikanglibs.HCEHomeSS; |
| 12 | import com.sincere.haikangface.mqtt.MqtUtils; | 12 | import com.sincere.haikangface.mqtt.MqtUtils; |
| 13 | +import com.sincere.haikangface.mqtt.MqttManager; | ||
| 13 | import com.sincere.haikangface.utils.*; | 14 | import com.sincere.haikangface.utils.*; |
| 14 | import com.sincere.haikangface.xiananDao.SendRecordDao; | 15 | import com.sincere.haikangface.xiananDao.SendRecordDao; |
| 15 | import com.sun.jna.NativeLong; | 16 | import com.sun.jna.NativeLong; |
| 16 | import com.sun.jna.Pointer; | 17 | import com.sun.jna.Pointer; |
| 18 | +import lombok.extern.slf4j.Slf4j; | ||
| 17 | import org.apache.http.util.TextUtils; | 19 | import org.apache.http.util.TextUtils; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.beans.factory.annotation.Value; | 21 | import org.springframework.beans.factory.annotation.Value; |
| @@ -36,6 +38,7 @@ import java.util.Map; | @@ -36,6 +38,7 @@ import java.util.Map; | ||
| 36 | import java.util.regex.Pattern; | 38 | import java.util.regex.Pattern; |
| 37 | 39 | ||
| 38 | @Component | 40 | @Component |
| 41 | +@Slf4j | ||
| 39 | public class CMSServer implements ApplicationRunner { | 42 | public class CMSServer implements ApplicationRunner { |
| 40 | 43 | ||
| 41 | @Autowired | 44 | @Autowired |
| @@ -50,9 +53,9 @@ public class CMSServer implements ApplicationRunner { | @@ -50,9 +53,9 @@ public class CMSServer implements ApplicationRunner { | ||
| 50 | 53 | ||
| 51 | //114.55.30.100 | 54 | //114.55.30.100 |
| 52 | //120.26.116.253 | 55 | //120.26.116.253 |
| 53 | - private String ip_cloud = "120.26.116.253"; | ||
| 54 | - // private String ip_cloud = "172.16.2.56"; | ||
| 55 | -// private String ip_cloud = "114.55.30.100"; | 56 | +// private String ip_cloud = "120.26.116.253"; |
| 57 | + private String ip_cloud = "172.16.2.53"; | ||
| 58 | + // private String ip_cloud = "114.55.30.100"; | ||
| 56 | private String ip; | 59 | private String ip; |
| 57 | 60 | ||
| 58 | { | 61 | { |
| @@ -126,7 +129,7 @@ public class CMSServer implements ApplicationRunner { | @@ -126,7 +129,7 @@ public class CMSServer implements ApplicationRunner { | ||
| 126 | public class FRegisterCallBack implements HCEHomeCMS.DEVICE_REGISTER_CB { | 129 | public class FRegisterCallBack implements HCEHomeCMS.DEVICE_REGISTER_CB { |
| 127 | public boolean invoke(NativeLong lUserID, int dwDataType, Pointer pOutBuffer, int dwOutLen, HCEHomeCMS.NET_EHOME_SERVER_INFO pInBuffer, int dwInLen, Pointer pUser) { | 130 | public boolean invoke(NativeLong lUserID, int dwDataType, Pointer pOutBuffer, int dwOutLen, HCEHomeCMS.NET_EHOME_SERVER_INFO pInBuffer, int dwInLen, Pointer pUser) { |
| 128 | String deviceId = ""; | 131 | String deviceId = ""; |
| 129 | -// System.out.println("dwDataType:" + dwDataType); | 132 | + System.out.println("dwDataType:" + dwDataType); |
| 130 | if (dwDataType == 0) { | 133 | if (dwDataType == 0) { |
| 131 | HCEHomeCMS.NET_EHOME_DEV_REG_INFO strDevRegInfo = new HCEHomeCMS.NET_EHOME_DEV_REG_INFO(); | 134 | HCEHomeCMS.NET_EHOME_DEV_REG_INFO strDevRegInfo = new HCEHomeCMS.NET_EHOME_DEV_REG_INFO(); |
| 132 | strDevRegInfo.write(); | 135 | strDevRegInfo.write(); |
| @@ -169,10 +172,12 @@ public class CMSServer implements ApplicationRunner { | @@ -169,10 +172,12 @@ public class CMSServer implements ApplicationRunner { | ||
| 169 | // byte[] byIP = ip.getBytes(); | 172 | // byte[] byIP = ip.getBytes(); |
| 170 | byte[] byIP = ip_cloud.getBytes(); | 173 | byte[] byIP = ip_cloud.getBytes(); |
| 171 | System.arraycopy(byIP, 0, pInBuffer.struUDPAlarmSever.szIP, 0, byIP.length); | 174 | System.arraycopy(byIP, 0, pInBuffer.struUDPAlarmSever.szIP, 0, byIP.length); |
| 175 | + // TODO: 2020/8/27 人脸机类型为0 | ||
| 172 | pInBuffer.dwAlarmServerType = 0; //报警服务器类型:0- 只支持UDP协议上报,1- 支持UDP、TCP两种协议上报 | 176 | pInBuffer.dwAlarmServerType = 0; //报警服务器类型:0- 只支持UDP协议上报,1- 支持UDP、TCP两种协议上报 |
| 173 | pInBuffer.struTCPAlarmSever.wPort = 7661; | 177 | pInBuffer.struTCPAlarmSever.wPort = 7661; |
| 174 | pInBuffer.struUDPAlarmSever.wPort = 7662; | 178 | pInBuffer.struUDPAlarmSever.wPort = 7662; |
| 175 | 179 | ||
| 180 | + // TODO: 2020/8/27 人脸存储类型为3 | ||
| 176 | pInBuffer.dwPicServerType = 3; | 181 | pInBuffer.dwPicServerType = 3; |
| 177 | System.arraycopy(byIP, 0, pInBuffer.struPictureSever.szIP, 0, byIP.length); | 182 | System.arraycopy(byIP, 0, pInBuffer.struPictureSever.szIP, 0, byIP.length); |
| 178 | pInBuffer.struPictureSever.wPort = 8081; | 183 | pInBuffer.struPictureSever.wPort = 8081; |
| @@ -296,6 +301,7 @@ public class CMSServer implements ApplicationRunner { | @@ -296,6 +301,7 @@ public class CMSServer implements ApplicationRunner { | ||
| 296 | pFileName = pFileName.split("T")[0] + ".jpg"; | 301 | pFileName = pFileName.split("T")[0] + ".jpg"; |
| 297 | isZhuaPai = true; | 302 | isZhuaPai = true; |
| 298 | } | 303 | } |
| 304 | + | ||
| 299 | String strFilePath = strPath + pFileName; | 305 | String strFilePath = strPath + pFileName; |
| 300 | FileUtils.getInstance().writeLogs("文件名:" + pFileName, FileUtils.fileName); | 306 | FileUtils.getInstance().writeLogs("文件名:" + pFileName, FileUtils.fileName); |
| 301 | //保存抓拍到的人脸图片,比对通过后的图片资源 | 307 | //保存抓拍到的人脸图片,比对通过后的图片资源 |
| @@ -365,9 +371,11 @@ public class CMSServer implements ApplicationRunner { | @@ -365,9 +371,11 @@ public class CMSServer implements ApplicationRunner { | ||
| 365 | } | 371 | } |
| 366 | 372 | ||
| 367 | net_ehome_alarm_listen_param.struAddress.szIP = ip.getBytes(); | 373 | net_ehome_alarm_listen_param.struAddress.szIP = ip.getBytes(); |
| 374 | + // TODO: 2020/8/27 人脸端口号为7662 | ||
| 368 | net_ehome_alarm_listen_param.struAddress.wPort = 7662; | 375 | net_ehome_alarm_listen_param.struAddress.wPort = 7662; |
| 369 | net_ehome_alarm_listen_param.fnMsgCb = cbEHomeMsgCallBack; | 376 | net_ehome_alarm_listen_param.fnMsgCb = cbEHomeMsgCallBack; |
| 370 | net_ehome_alarm_listen_param.pUserData = null; | 377 | net_ehome_alarm_listen_param.pUserData = null; |
| 378 | + // TODO: 2020/8/27 人脸类型为1 | ||
| 371 | net_ehome_alarm_listen_param.byProtocolType = 1; //协议类型:0- TCP,1- UDP | 379 | net_ehome_alarm_listen_param.byProtocolType = 1; //协议类型:0- TCP,1- UDP |
| 372 | net_ehome_alarm_listen_param.byUseCmsPort = 0; //是否复用CMS端口:0- 不复用,非0- 复用 | 380 | net_ehome_alarm_listen_param.byUseCmsPort = 0; //是否复用CMS端口:0- 不复用,非0- 复用 |
| 373 | //如果复用cms端口,协议类型字段无效,此时AMS的本地监听信息struAddress填本地回环地址, | 381 | //如果复用cms端口,协议类型字段无效,此时AMS的本地监听信息struAddress填本地回环地址, |
| @@ -378,18 +386,18 @@ public class CMSServer implements ApplicationRunner { | @@ -378,18 +386,18 @@ public class CMSServer implements ApplicationRunner { | ||
| 378 | System.out.println("NET_EALARM_StartListen失败, error code:" + hCEhomeCMS.NET_ECMS_GetLastError()); | 386 | System.out.println("NET_EALARM_StartListen失败, error code:" + hCEhomeCMS.NET_ECMS_GetLastError()); |
| 379 | return; | 387 | return; |
| 380 | } else { | 388 | } else { |
| 381 | - /*复用CMS端口接收设备上传报警信息的时候需要调用以下接口配置 | ||
| 382 | - HCEHomeCMS.NET_EHOME_AMS_ADDRESS struAMSAddr= new HCEHomeCMS.NET_EHOME_AMS_ADDRESS(); | 389 | + /*复用CMS端口接收设备上传报警信息的时候需要调用以下接口配置*/ |
| 390 | + /*HCEHomeCMS.NET_EHOME_AMS_ADDRESS struAMSAddr= new HCEHomeCMS.NET_EHOME_AMS_ADDRESS(); | ||
| 383 | struAMSAddr.dwSize = struAMSAddr.size(); | 391 | struAMSAddr.dwSize = struAMSAddr.size(); |
| 384 | struAMSAddr.byEnable = 1;//是否启用:0-关闭CMS接收报警功能,1-开启CMS接收报警功能 | 392 | struAMSAddr.byEnable = 1;//是否启用:0-关闭CMS接收报警功能,1-开启CMS接收报警功能 |
| 385 | - String strAmsAddr = "10.17.36.25"; | 393 | + String strAmsAddr = ip_cloud; |
| 386 | System.arraycopy(strAmsAddr.getBytes(), 0, struAMSAddr.struAddress.szIP, 0, strAmsAddr.length()); | 394 | System.arraycopy(strAmsAddr.getBytes(), 0, struAMSAddr.struAddress.szIP, 0, strAmsAddr.length()); |
| 387 | struAMSAddr.struAddress.wPort = 7662; //和报警服务器监听端口需要一致 | 395 | struAMSAddr.struAddress.wPort = 7662; //和报警服务器监听端口需要一致 |
| 388 | struAMSAddr.write(); | 396 | struAMSAddr.write(); |
| 389 | 397 | ||
| 390 | if(!hCEhomeCMS.NET_ECMS_SetSDKLocalCfg(1, struAMSAddr.getPointer())) | 398 | if(!hCEhomeCMS.NET_ECMS_SetSDKLocalCfg(1, struAMSAddr.getPointer())) |
| 391 | { | 399 | { |
| 392 | - JOptionPane.showMessageDialog(null, "NET_ECMS_SetSDKLocalCfg failed, error code:" + hCEhomeCMS.NET_ECMS_GetLastError()); | 400 | + System.out.println("NET_ECMS_SetSDKLocalCfg failed, error code:" + hCEhomeCMS.NET_ECMS_GetLastError()); |
| 393 | }*/ | 401 | }*/ |
| 394 | System.out.println("启动报警监听成功"); | 402 | System.out.println("启动报警监听成功"); |
| 395 | } | 403 | } |
| @@ -412,7 +420,7 @@ public class CMSServer implements ApplicationRunner { | @@ -412,7 +420,7 @@ public class CMSServer implements ApplicationRunner { | ||
| 412 | strXMLData.read(); | 420 | strXMLData.read(); |
| 413 | 421 | ||
| 414 | String strXML = new String(strXMLData.byValue); | 422 | String strXML = new String(strXMLData.byValue); |
| 415 | -// System.out.println(strXML); | 423 | + System.out.println(strXML); |
| 416 | 424 | ||
| 417 | if (null == alarmUtils) { | 425 | if (null == alarmUtils) { |
| 418 | alarmUtils = new AlarmUtils(deviceDao); | 426 | alarmUtils = new AlarmUtils(deviceDao); |
| @@ -496,6 +504,10 @@ public class CMSServer implements ApplicationRunner { | @@ -496,6 +504,10 @@ public class CMSServer implements ApplicationRunner { | ||
| 496 | FileUtils.getInstance().writeLogs("card:" + card, FileUtils.faceSuccess); | 504 | FileUtils.getInstance().writeLogs("card:" + card, FileUtils.faceSuccess); |
| 497 | } | 505 | } |
| 498 | 506 | ||
| 507 | + if (deviceID.startsWith("qj")) {//枪击 用来抓拍人脸考勤用 | ||
| 508 | + initQJ(deviceID, cardNo, studentBean == null); | ||
| 509 | + } | ||
| 510 | + | ||
| 499 | } | 511 | } |
| 500 | 512 | ||
| 501 | } catch (Exception e) { | 513 | } catch (Exception e) { |
| @@ -503,8 +515,18 @@ public class CMSServer implements ApplicationRunner { | @@ -503,8 +515,18 @@ public class CMSServer implements ApplicationRunner { | ||
| 503 | } | 515 | } |
| 504 | } | 516 | } |
| 505 | 517 | ||
| 506 | - public void isTeacher(String cardNo, String deviceID) { | 518 | + /** |
| 519 | + * @param deviceID | ||
| 520 | + * @param cardNo | ||
| 521 | + * @param isTeacher true:教师 false:学生 | ||
| 522 | + */ | ||
| 523 | + private void initQJ(String deviceID, String cardNo, boolean isTeacher) { | ||
| 524 | + | ||
| 525 | +// MqtUtils.getInstance().sendMsg(); | ||
| 526 | + | ||
| 527 | + } | ||
| 507 | 528 | ||
| 529 | + public void isTeacher(String cardNo, String deviceID) { | ||
| 508 | 530 | ||
| 509 | List<String> devLists = userDao.getDeviceRoomRelation(deviceID); | 531 | List<String> devLists = userDao.getDeviceRoomRelation(deviceID); |
| 510 | 532 | ||
| @@ -512,14 +534,14 @@ public class CMSServer implements ApplicationRunner { | @@ -512,14 +534,14 @@ public class CMSServer implements ApplicationRunner { | ||
| 512 | 534 | ||
| 513 | StudentBean teacher = userDao.getTeacherWithCard(cardNo); | 535 | StudentBean teacher = userDao.getTeacherWithCard(cardNo); |
| 514 | if (null != teacher) { | 536 | if (null != teacher) { |
| 515 | - String url = String.format("http://60.190.202.57:1000/api/RollCall/AddRollCallPersonnelRecord?userId=%s&deviceId=%s", teacher.getUser_id(), deviceID); | 537 | + String url = String.format("http://campus.myjxt.com/api/RollCall/AddRollCallPersonnelRecord?userId=%s&deviceId=%s", teacher.getUser_id(), deviceID); |
| 516 | 538 | ||
| 517 | RestTemplate restTemplate = new RestTemplate(); | 539 | RestTemplate restTemplate = new RestTemplate(); |
| 518 | 540 | ||
| 519 | - | ||
| 520 | String res = restTemplate.getForObject(url, String.class); | 541 | String res = restTemplate.getForObject(url, String.class); |
| 542 | + JSONObject jsonObject = JSON.parseObject(res); | ||
| 521 | 543 | ||
| 522 | - System.out.println("result:" + res + "------url:" + url); | 544 | + System.out.println("result:" + res + "------url:" + jsonObject.getBoolean("data")); |
| 523 | 545 | ||
| 524 | } | 546 | } |
| 525 | } | 547 | } |
cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
| @@ -204,7 +204,7 @@ public class SendUserAsync { | @@ -204,7 +204,7 @@ public class SendUserAsync { | ||
| 204 | String weekPlanTime = HKXmlUtils.getInstance().SetCardWeekPlanTime(stringBuffer.toString(), "" + week); | 204 | String weekPlanTime = HKXmlUtils.getInstance().SetCardWeekPlanTime(stringBuffer.toString(), "" + week); |
| 205 | String serCardRightCfg = HKXmlUtils.getInstance().SetCardRightCfg(cardNum); | 205 | String serCardRightCfg = HKXmlUtils.getInstance().SetCardRightCfg(cardNum); |
| 206 | // log.error("serCardRightCfg:{}", serCardRightCfg); | 206 | // log.error("serCardRightCfg:{}", serCardRightCfg); |
| 207 | - FileUtils.getInstance().writeLogs(weekPlanTime,"设置卡权限周计划时间.txt"); | 207 | + FileUtils.getInstance().writeLogs(weekPlanTime, "设置卡权限周计划时间.txt"); |
| 208 | cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, weekPlanTime, "设置卡权限周计划时间"); | 208 | cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, weekPlanTime, "设置卡权限周计划时间"); |
| 209 | cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, serCardRightCfg, "设置卡权限"); | 209 | cmsServer.SetCardWeekPlan(deviceId, cardNum, userType, serCardRightCfg, "设置卡权限"); |
| 210 | 210 |
cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/WeekDay.java
| @@ -19,6 +19,7 @@ public class WeekDay implements Serializable { | @@ -19,6 +19,7 @@ public class WeekDay implements Serializable { | ||
| 19 | private String userIds; | 19 | private String userIds; |
| 20 | 20 | ||
| 21 | private List<String> deviceIds; | 21 | private List<String> deviceIds; |
| 22 | + | ||
| 22 | public List<String> getDeviceIds() { | 23 | public List<String> getDeviceIds() { |
| 23 | return deviceIds; | 24 | return deviceIds; |
| 24 | } | 25 | } |
cloud/haikangface/src/main/java/com/sincere/haikangface/control/FileControl.java
| @@ -54,7 +54,7 @@ public class FileControl { | @@ -54,7 +54,7 @@ public class FileControl { | ||
| 54 | public boolean sendPermiss(@RequestBody PermissionBean permissionBean) { | 54 | public boolean sendPermiss(@RequestBody PermissionBean permissionBean) { |
| 55 | log.error("permissionBean:{}", JSON.toJSONString(permissionBean)); | 55 | log.error("permissionBean:{}", JSON.toJSONString(permissionBean)); |
| 56 | if (!StringUtils.isEmpty(permissionBean)) { | 56 | if (!StringUtils.isEmpty(permissionBean)) { |
| 57 | - return sendUserAsync.sendPermiss(permissionBean,1); | 57 | + return sendUserAsync.sendPermiss(permissionBean, 1); |
| 58 | } | 58 | } |
| 59 | return false; | 59 | return false; |
| 60 | } | 60 | } |
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
| @@ -78,7 +78,7 @@ public class UserControl { | @@ -78,7 +78,7 @@ public class UserControl { | ||
| 78 | @ApiOperation("下发指定教师用户权限给设备") | 78 | @ApiOperation("下发指定教师用户权限给设备") |
| 79 | public boolean sendUsersAndPermiss(@RequestBody UserAndPermission userAndPermission) { | 79 | public boolean sendUsersAndPermiss(@RequestBody UserAndPermission userAndPermission) { |
| 80 | log.error("sendUsersAndPermiss:{}", JSON.toJSONString(userAndPermission)); | 80 | log.error("sendUsersAndPermiss:{}", JSON.toJSONString(userAndPermission)); |
| 81 | - FileUtils.getInstance().writeLogs(JSON.toJSONString(userAndPermission),"下发指定教师用户权限给设备.txt"); | 81 | + FileUtils.getInstance().writeLogs(JSON.toJSONString(userAndPermission), "下发指定教师用户权限给设备.txt"); |
| 82 | PermissionBean permissionBean = new PermissionBean(); | 82 | PermissionBean permissionBean = new PermissionBean(); |
| 83 | permissionBean.setSchoolId(userAndPermission.getSchoolId()); | 83 | permissionBean.setSchoolId(userAndPermission.getSchoolId()); |
| 84 | permissionBean.setUserType(String.valueOf(userAndPermission.getUserType())); | 84 | permissionBean.setUserType(String.valueOf(userAndPermission.getUserType())); |
| @@ -91,8 +91,8 @@ public class UserControl { | @@ -91,8 +91,8 @@ public class UserControl { | ||
| 91 | @ApiOperation("测试教师点名") | 91 | @ApiOperation("测试教师点名") |
| 92 | public void isTeacher(@RequestParam("deviceId") String deviceId, @RequestParam("cardNo") String cardNo) { | 92 | public void isTeacher(@RequestParam("deviceId") String deviceId, @RequestParam("cardNo") String cardNo) { |
| 93 | try { | 93 | try { |
| 94 | - cmsServer.isTeacher(cardNo,deviceId); | ||
| 95 | - }catch (Exception e){ | 94 | + cmsServer.isTeacher(cardNo, deviceId); |
| 95 | + } catch (Exception e) { | ||
| 96 | e.printStackTrace(); | 96 | e.printStackTrace(); |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
| @@ -240,10 +240,10 @@ public interface UserDao { | @@ -240,10 +240,10 @@ public interface UserDao { | ||
| 240 | TeacherBean getTeacherWithUserId(@Param("userId") String userId); | 240 | TeacherBean getTeacherWithUserId(@Param("userId") String userId); |
| 241 | 241 | ||
| 242 | 242 | ||
| 243 | - List<String> getStudentWiSidAndSex(@Param("schoolId")String schoolId , @Param("sexs")List<String> sexs); | 243 | + List<String> getStudentWiSidAndSex(@Param("schoolId") String schoolId, @Param("sexs") List<String> sexs); |
| 244 | 244 | ||
| 245 | 245 | ||
| 246 | - List<String> getDeviceRoomRelation(@Param("clint_id")String clint_id); | 246 | + List<String> getDeviceRoomRelation(@Param("clint_id") String clint_id); |
| 247 | 247 | ||
| 248 | 248 | ||
| 249 | } | 249 | } |
cloud/haikangface/src/main/java/com/sincere/haikangface/mqtt/MqtUtils.java
| @@ -20,9 +20,9 @@ public class MqtUtils { | @@ -20,9 +20,9 @@ public class MqtUtils { | ||
| 20 | mqttManager.init(); | 20 | mqttManager.init(); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | - public void sendMsg(String msg) { | 23 | + public void sendMsg(String deviceId, int cmd, String msg) { |
| 24 | 24 | ||
| 25 | - mqttManager.sendMq("123456789", 51, msg); | 25 | + mqttManager.sendMq(deviceId, cmd, msg); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | 28 |
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java
| @@ -55,7 +55,7 @@ public class CompressPic { | @@ -55,7 +55,7 @@ public class CompressPic { | ||
| 55 | File targetFile = new File(targetPath); | 55 | File targetFile = new File(targetPath); |
| 56 | if (!targetFile.exists()) targetFile.createNewFile(); | 56 | if (!targetFile.exists()) targetFile.createNewFile(); |
| 57 | 57 | ||
| 58 | - if (width>height){ | 58 | + if (width > height) { |
| 59 | int width1 = width; | 59 | int width1 = width; |
| 60 | width = height; | 60 | width = height; |
| 61 | height = width1; | 61 | height = width1; |
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
| @@ -182,7 +182,7 @@ public class HttpUtil { | @@ -182,7 +182,7 @@ public class HttpUtil { | ||
| 182 | 182 | ||
| 183 | HttpEntity<PermissionBean> httpEntity = new HttpEntity<>(permissionBean, headers); | 183 | HttpEntity<PermissionBean> httpEntity = new HttpEntity<>(permissionBean, headers); |
| 184 | 184 | ||
| 185 | - System.out.println("PermissionBean:"+JSON.toJSONString(permissionBean)); | 185 | + System.out.println("PermissionBean:" + JSON.toJSONString(permissionBean)); |
| 186 | 186 | ||
| 187 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class); | 187 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class); |
| 188 | 188 |
cloud/haikangface/src/main/resources/application.yaml
| @@ -10,10 +10,10 @@ spring: | @@ -10,10 +10,10 @@ spring: | ||
| 10 | password: RQminVCJota3H1u8bBYH | 10 | password: RQminVCJota3H1u8bBYH |
| 11 | jdbc-url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus | 11 | jdbc-url: jdbc:sqlserver://116.62.155.137:33419;database=SmartCampus |
| 12 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 12 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| 13 | -# username: SZJXTUSER | ||
| 14 | -# password: xst200919 | ||
| 15 | -# jdbc-url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ | ||
| 16 | -# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | 13 | + # username: SZJXTUSER |
| 14 | + # password: xst200919 | ||
| 15 | + # jdbc-url: jdbc:sqlserver://60.190.202.57:14333;database=SmartCampusSZ | ||
| 16 | + # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver | ||
| 17 | xiaoan: | 17 | xiaoan: |
| 18 | jdbc-url: jdbc:sqlserver://116.62.241.27:33419;database=xiaoanhxy | 18 | jdbc-url: jdbc:sqlserver://116.62.241.27:33419;database=xiaoanhxy |
| 19 | username: szjxtuser | 19 | username: szjxtuser |
cloud/pom.xml
| @@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
| 33 | <module>haikang</module> | 33 | <module>haikang</module> |
| 34 | <!-- <module>dahua</module>--> | 34 | <!-- <module>dahua</module>--> |
| 35 | <!-- <module>consumer</module>--> | 35 | <!-- <module>consumer</module>--> |
| 36 | - <!-- <module>haikangface</module>--> | 36 | + <module>haikangface</module> |
| 37 | <!-- <module>search_independence</module>--> | 37 | <!-- <module>search_independence</module>--> |
| 38 | <!-- <module>search_smartCampus</module>--> | 38 | <!-- <module>search_smartCampus</module>--> |
| 39 | <!-- <module>search_xiaoan</module>--> | 39 | <!-- <module>search_xiaoan</module>--> |