pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/constant/YamlProperties.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/controller/FaceController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/util/FaceIdentifyUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/config/application-dev.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/config/application-prod.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/lib/8611-11H3-Z13R-7HL1.dat | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/lib/WIN64PRO/libarcsoft_face.dll | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/lib/WIN64PRO/libarcsoft_face_engine.dll | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/lib/WIN64PRO/libarcsoft_face_engine_jni.dll | 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/lib/arcsoft-sdk-face-3.1.1.0.jar | 补丁 | 查看 | 原始文档 | blame | 历史 |
pom.xml
@@ -166,13 +166,14 @@ <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <!--外部引入--> <!--外部引入-人脸识别sdk--> <dependency> <groupId>com.whyc</groupId> <artifactId>face</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${pom.basedir}/src/main/resources/lib/arcsoft-sdk-face-3.0.0.0.jar</systemPath> <!-- <systemPath>${pom.basedir}/src/main/resources/lib/arcsoft-sdk-face-3.1.1.0.jar</systemPath>--> </dependency> <dependency> <groupId>com.whyc</groupId> src/main/java/com/whyc/constant/YamlProperties.java
@@ -37,6 +37,7 @@ public static String appId4Linux; public static String sdkKey4Linux; public static String activeKey; public static Integer faceType; /**告警工单开关*/ public static String alarmTaskSwitch; @@ -124,6 +125,11 @@ YamlProperties.activeKey = activeKey; } @Value("${custom.face.type}") public static void setFaceType(Integer faceType) { YamlProperties.faceType = faceType; } @Value("${configFile.type}") public void setRunModel(Integer runModel) { YamlProperties.runModel = runModel; src/main/java/com/whyc/controller/FaceController.java
@@ -50,21 +50,7 @@ @ApiOperation(value = "在线激活人脸识别引擎",notes = "只需要刚开始时调用一次,会导致appId与硬件设备绑定,必须有外部网络,否则激活会失败!" + "后续使用无需再调用激活,可以离线使用") public Response activeOnline(){ Response model = new Response(); boolean b = FaceIdentifyUtil.active(1); if(b){ return new Response().set(1,true,"引擎激活成功"); }else{ return new Response().set(1,false,"引擎激活失败,请检查网络是否为外网并确认appId和key是否正确!"); } } @GetMapping("activeOnlinePro") @ApiOperation(value = "在线激活人脸识别引擎,增值版使用",notes = "只需要刚开始时调用一次,会导致appId与硬件设备绑定,必须有外部网络,否则激活会失败!" + "后续使用无需再调用激活,可以离线使用") public Response activeOnlinePro(){ Response model = new Response(); boolean b = FaceIdentifyUtil.active(11); if(b){ return new Response().set(1,true,"引擎激活成功"); }else{ @@ -75,8 +61,7 @@ @GetMapping("activeOffline") @ApiOperation(value = "离线激活人脸识别引擎,增值版使用") public Response activeOffline(){ Response model = new Response(); boolean b = FaceIdentifyUtil.active(12); boolean b = FaceIdentifyUtil.active(2); if(b){ return new Response().set(1,true,"引擎激活成功"); }else{ src/main/java/com/whyc/util/FaceIdentifyUtil.java
@@ -25,6 +25,7 @@ String appId=""; String sdkKey=""; String activeKey = YamlProperties.activeKey; Integer faceType = YamlProperties.faceType; FaceEngine faceEngine =null; /*//从官网我的应用中获取 @@ -46,31 +47,43 @@ String realPath = CommonUtil.classesPath(); System.out.println("========realPath=========:"+realPath); System.out.println("========faceEngine dll 路径=========:"+realPath+ File.separator+"lib"+File.separator+"WIN64"); //判断是什么系统 //FaceEngine获取,判断是什么系统和什么版本 if(System.getProperty("os.name").toLowerCase().contains("window")){ appId=appId4Win; sdkKey=sdkKey4Win; faceEngine = new FaceEngine(realPath+ File.separator+"lib"+File.separator+"WIN64"); appId = appId4Win; sdkKey = sdkKey4Win; if(faceType == 1 //免费版 ) { faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "WIN64"); }else{ //付费版永久 faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "WIN64PRO"); } }else{ appId=appId4Linux; sdkKey=sdkKey4Linux; faceEngine = new FaceEngine(realPath+ File.separator+"WEB-INF"+File.separator+"lib"+File.separator+"LINUX64"); if(faceType == 1 //免费版 ) { faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "LINUX64"); }else{ //付费版永久 faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "LINUX64PRO"); } } //激活引擎,只需一次就行,后续无需再激活 int errorCode = 666; //需要免费版的依赖包才能调用 if(activeType == 1){ errorCode = faceEngine.activeOnline(appId, sdkKey); } //需要增值版的依赖包才能调用 /*else if(activeType == 11){ /**========需要免费版的依赖包才能调用 Start========*/ errorCode = faceEngine.activeOnline(appId, sdkKey); /**========需要免费版的依赖包才能调用 End========*/ /**========需要增值版的依赖包才能调用 Start========*/ /*if(activeType == 1){ //在线激活 errorCode = faceEngine.activeOnline(appId,sdkKey,activeKey); }else if(activeType == 12){ //离线.dat文件在服务器指定的C盘下即可 errorCode = faceEngine.activeOffline("C:\\"+activeKey+".dat"); }else if(activeType == 2){ //离线激活 //先服务器生成离线授权文件,离线.dat文件放在 lib下即可 errorCode = faceEngine.activeOffline(realPath + File.separator + "lib" + File.separator + activeKey+".dat"); }*/ /**========需要增值版的依赖包才能调用 End========*/ if (errorCode != ErrorInfo.MOK.getValue() && errorCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) { //激活失败 }else{ @@ -85,9 +98,19 @@ FaceEngine faceEngine=null; String realPath = CommonUtil.classesPath(); if(System.getProperty("os.name").toLowerCase().contains("window")) { faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "WIN64"); if(YamlProperties.faceType == 1 //免费版 ) { faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "WIN64"); }else{ //付费版永久 faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "WIN64PRO"); } }else{ faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "LINUX64"); if(YamlProperties.faceType == 1 //免费版 ) { faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "LINUX64"); }else{ //付费版永久 faceEngine = new FaceEngine(realPath + File.separator + "lib" + File.separator + "LINUX64PRO"); } } //引擎配置 EngineConfiguration engineConfiguration = new EngineConfiguration(); src/main/resources/config/application-dev.yml
@@ -72,6 +72,8 @@ custom: #人脸 face: #type=1 免费版,type=2 增值版永久 faceType: 1 threshold: 0.8 appId4Win: AafPX5afzycEnTqH3v79gY3VozNVTSNqT8kzSmP7b48q sdkKey4Win: GsYwWhxzuQEE1WE34J3Fo8d2QppjkqYGojyc4625JhKb src/main/resources/config/application-prod.yml
@@ -73,6 +73,8 @@ custom: #人脸 face: #type=1 免费版,type=2 增值版永久 type: 1 threshold: 0.8 appId4Win: AafPX5afzycEnTqH3v79gY3VozNVTSNqT8kzSmP7b48q sdkKey4Win: GsYwWhxzuQEE1WE34J3Fo8d2QppjkqYGojyc4625JhKb src/main/resources/lib/8611-11H3-Z13R-7HL1.dat
src/main/resources/lib/WIN64PRO/libarcsoft_face.dllBinary files differ
src/main/resources/lib/WIN64PRO/libarcsoft_face_engine.dllBinary files differ
src/main/resources/lib/WIN64PRO/libarcsoft_face_engine_jni.dllBinary files differ
src/main/resources/lib/arcsoft-sdk-face-3.1.1.0.jarBinary files differ