diff --git a/cloud/dahua/src/main/java/com/example/dahua/bean/StudentBean.java b/cloud/dahua/src/main/java/com/example/dahua/bean/StudentBean.java
index db156d2..7bde583 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/bean/StudentBean.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/bean/StudentBean.java
@@ -39,7 +39,7 @@ public class StudentBean implements Serializable {
 
     private String Face;
 
-    private String StudentCode;
+//    private String StudentCode;
 
     private String student_num;
 
@@ -201,13 +201,13 @@ public class StudentBean implements Serializable {
         Face = face;
     }
 
-    public String getStudentCode() {
-        return StudentCode;
-    }
-
-    public void setStudentCode(String studentCode) {
-        StudentCode = studentCode;
-    }
+//    public String getStudentCode() {
+//        return StudentCode;
+//    }
+//
+//    public void setStudentCode(String studentCode) {
+//        StudentCode = studentCode;
+//    }
 
     public long getID() {
         return ID;
@@ -245,7 +245,7 @@ public class StudentBean implements Serializable {
                 ", AddTime=" + AddTime +
                 ", Sex=" + Sex +
                 ", Face='" + Face + '\'' +
-                ", StudentCode='" + StudentCode + '\'' +
+//                ", StudentCode='" + StudentCode + '\'' +
                 ", student_num='" + student_num + '\'' +
                 ", student_id='" + student_id + '\'' +
                 ", user_id='" + user_id + '\'' +
diff --git a/cloud/dahua/src/main/java/com/example/dahua/control/FaceUnifyController.java b/cloud/dahua/src/main/java/com/example/dahua/control/FaceUnifyController.java
index d6dd919..32922d6 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/control/FaceUnifyController.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/control/FaceUnifyController.java
@@ -44,4 +44,12 @@ public class FaceUnifyController {
         return JSON.toJSONString(permissFaceService.getPermissions(schoolId));
     }
 
+
+    @RequestMapping(value = "addFace",method = RequestMethod.POST)
+    @ApiOperation("上传学生/老师人脸")
+    public String addFace(@RequestParam("imgUrl")String imgUrl,@RequestParam("userId")String userId) throws UnsupportedEncodingException {
+        return JSON.toJSONString(permissFaceService.addFace(imgUrl,userId));
+    }
+
+
 }
diff --git a/cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java b/cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
index 78e8bba..3e50435 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/control/UserControl.java
@@ -115,186 +115,15 @@ public class UserControl {
     @RequestMapping(value = "checkFace", method = RequestMethod.GET)
     @ApiOperation("在线活体检测")
     public boolean checkFace(@RequestParam("url") String httpurl) {
-        // 请求url
-        String url = "https://aip.baidubce.com/rest/2.0/face/v3/faceverify";
-        try {
-
-            List list = new ArrayList();
-            Map<String, String> map = new HashMap<>();
-            String image_type = "";
-            String imgFilePath = httpurl;
-            File target = new File("./huoti/");
-            if (!target.exists()) target.mkdirs();
-            File target1 = new File(target.getAbsolutePath(), new File(httpurl).getName());
-            if (httpurl.startsWith("http")) image_type = "URL";
-            else {
-                CompressPic.CompressPic(httpurl, target1.getAbsolutePath(), "");//压缩后的图片
-                image_type = "BASE64";
-                httpurl = Base64Util.encode(image2byte(target1.getAbsolutePath()));
-            }
-            map.put("image", httpurl);
-            map.put("image_type", image_type);
-//            map.put("face_field","");
-//            map.put("option","GATE");
-            list.add(map);
-            String param = GsonUtils.toJson(list);
-            // 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
-            String accessToken = getAuth();
-
-            String result1 = HttpUtil.post(url, accessToken, "application/json", param);
-            JSONObject jsonObject = new JSONObject(result1);
-            String error_msg = jsonObject.optString("error_msg");
-            JSONObject result = jsonObject.optJSONObject("result");
-            if (error_msg.equals("SUCCESS")) {
-                double face_liveness = result.optDouble("face_liveness", 0.00);//活体分数值
-                JSONArray face_list = result.optJSONArray("face_list");
-                JSONObject location = face_list.optJSONObject(0).optJSONObject("location");
-                double rotation = location.optDouble("rotation", 0.0);//竖直方向旋转角度
-                System.out.println(" face_liveness:" + face_liveness);
-                if (face_liveness > 0.4) {
-                    int angel = 0;
-                    if (45 < rotation && rotation < 135) {//右向横图,需要旋转270度
-                        System.out.println("旋转270度");
-                        angel = 270;
-                    } else if (rotation > -135 && rotation < -45) {//左向横图,需要旋转90度
-                        System.out.println("旋转90度");
-                        angel = 90;
-                    } else if (rotation >= -180 && rotation <= -135 || rotation >= 135 && rotation <= 180) {//倒向图片,需要旋转180度
-                        System.out.println("旋转180度");
-                        angel = 180;
-                    }
-                    System.out.println("图片检验成功");
-                    FileUtils.getInstance().writeLogs("检测成功:" + imgFilePath, FileUtils.checkSuc);
-                    //E:\wwwhtdocs\SmartCampus\face17e50\School
-                    //http://campus.myjxt.com//face17e5/School861/Student/GBZX20171134.jpg
-                    //F:\wwwroot\smartcampus\face17e5
-//                    imgFilePath =httpurl.replace("http://campus.myjxt.com","E:\\wwwhtdocs\\SmartCampus");
-//                    imgFilePath = httpurl.replace("http://60.190.202.57:1000","F:\\wwwroot\\smartcampus");
-//                    System.out.println("图片是否存在:" + imgFilePath);
-                    if (angel != 0)
-                        ImageUtils.rotatePhonePhoto(imgFilePath, angel);
-                    return true;
-                } else {
-                    FileUtils.getInstance().writeLogs("检测失败,活体分数:" + face_liveness + " " + imgFilePath, FileUtils.checkFail);
-                    System.out.println("图片不合格" + imgFilePath);
-                    deleteImgFile(imgFilePath);
-                    return false;
-                }
-            } else {
-                System.out.println("检测失败");
-                FileUtils.getInstance().writeLogs("检测失败:" + error_msg + imgFilePath, FileUtils.checkFail);
-                deleteImgFile(imgFilePath);
-                return false;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return true;
-    }
 
-    private boolean deleteImgFile(String imgFilePath) {
-        imgFilePath = imgFilePath.replace("http://campus.myjxt.com", "E:\\wwwhtdocs\\SmartCampus");
-        File file = new File(imgFilePath);
-        if (file.exists()) {
-            return file.delete();
-        }
-        return false;
-    }
+       return BaiduUtils.getBaiduUtils().checkImg(httpurl);
 
-    //图片到byte数组
-    public byte[] image2byte(String path) {
-        byte[] data = null;
-        FileImageInputStream input = null;
-        try {
-            input = new FileImageInputStream(new File(path));
-            ByteArrayOutputStream output = new ByteArrayOutputStream();
-            byte[] buf = new byte[1024];
-            int numBytesRead = 0;
-            while ((numBytesRead = input.read(buf)) != -1) {
-                output.write(buf, 0, numBytesRead);
-            }
-            data = output.toByteArray();
-            output.close();
-            input.close();
-        } catch (FileNotFoundException ex1) {
-            ex1.printStackTrace();
-        } catch (IOException ex1) {
-            ex1.printStackTrace();
-        }
-        return data;
     }
 
-    /**
-     * 获取权限token
-     *
-     * @return 返回示例:
-     * {
-     * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",
-     * "expires_in": 2592000
-     * }
-     */
-    public String getAuth() {
-        // 官网获取的 API Key 更新为你注册的
-        String clientId = "u6rV4YxRZmwzKj56N0DCW8eO";
-        // 官网获取的 Secret Key 更新为你注册的
-        String clientSecret = "Krp3KhmIBdnNEsRa1LavMHuZl0KhQGVm";
-        return getAuth(clientId, clientSecret);
-    }
 
-    /**
-     * 获取API访问token
-     * 该token有一定的有效期,需要自行管理,当失效时需重新获取.
-     *
-     * @param ak - 百度云官网获取的 API Key
-     * @param sk - 百度云官网获取的 Securet Key
-     * @return assess_token 示例:
-     * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
-     */
-    public static String getAuth(String ak, String sk) {
-        // 获取token地址
-        String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
-        String getAccessTokenUrl = authHost
-                // 1. grant_type为固定参数
-                + "grant_type=client_credentials"
-                // 2. 官网获取的 API Key
-                + "&client_id=" + ak
-                // 3. 官网获取的 Secret Key
-                + "&client_secret=" + sk;
-        try {
-            URL realUrl = new URL(getAccessTokenUrl);
-            // 打开和URL之间的连接
-            HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
-            connection.setRequestMethod("GET");
-            connection.connect();
-            // 获取所有响应头字段
-            Map<String, List<String>> map = connection.getHeaderFields();
-            // 遍历所有的响应头字段
-//            for (String key : map.keySet()) {
-//                System.err.println(key + "--->" + map.get(key));
-//            }
-            // 定义 BufferedReader输入流来读取URL的响应
-            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-            String result = "";
-            String line;
-            while ((line = in.readLine()) != null) {
-                result += line;
-            }
-            /**
-             * 返回结果示例
-             */
-//            System.err.println("result:" + result);
-            JSONObject jsonObject = new JSONObject(result);
-            String access_token = jsonObject.getString("access_token");
-            return access_token;
-        } catch (Exception e) {
-            System.err.printf("获取token失败!");
-            e.printStackTrace(System.err);
-        }
-        return null;
-    }
 
 
-    @RequestMapping(value = "tranpic", method = RequestMethod.GET)
+    /*@RequestMapping(value = "tranpic", method = RequestMethod.GET)
     @ApiOperation("旋转图片")
     public void tranPic(@RequestParam("path") String httpurl) {
         // 请求url
@@ -366,7 +195,7 @@ public class UserControl {
         } catch (Exception e) {
             e.printStackTrace();
         }
-    }
+    }*/
 
 //    @RequestMapping(value = "deleteFace", method = RequestMethod.GET)
 //    @ApiOperation("删除人脸")
@@ -377,7 +206,7 @@ public class UserControl {
 //    }
 
 
-    @RequestMapping(value = "FaceSearch", method = RequestMethod.POST)
+  /*  @RequestMapping(value = "FaceSearch", method = RequestMethod.POST)
     @ApiOperation("人脸搜索")
     public String FaceSearch(@RequestPart("file") MultipartFile file) {
 
@@ -401,7 +230,7 @@ public class UserControl {
         }
         return null;
 
-    }
+    }*/
 
 
     @RequestMapping(value = "movePic", method = RequestMethod.GET)
@@ -451,7 +280,7 @@ public class UserControl {
 
     }
 
-    @RequestMapping(value = "translatePic", method = RequestMethod.POST)
+   /* @RequestMapping(value = "translatePic", method = RequestMethod.POST)
     @ApiOperation("图片转文字")
     public String translatePic(@RequestPart MultipartFile file) {
         try {
@@ -479,13 +308,13 @@ public class UserControl {
             e.printStackTrace();
         }
         return "解析失败";
-    }
+    }*/
 
 
     private String url = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=" + AuthService.getAuth();
 //            + AuthService.getAuth();
 
-    private String getAnswer(String imgUrl, int type) {
+   /* private String getAnswer(String imgUrl, int type) {
         RestTemplate restTemplate = new RestTemplate();
 
         HttpHeaders headers = new HttpHeaders();
@@ -521,6 +350,6 @@ public class UserControl {
             System.out.println("result:" + stringBuilder.toString());
         }
         return stringBuilder.toString().equals("") ? "" : stringBuilder.toString();
-    }
+    }*/
 
 }
diff --git a/cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java b/cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
index 965bb80..8e639d2 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
@@ -23,6 +23,9 @@ public interface UserDao {
     @Select(" select Top(1)* from SZ_V_School_Student where school_id = #{school_id} and studentcode = #{studentcode}")
     UserInfoBean getUserInfo(@Param("school_id") String school_id, @Param("studentcode") String studentcode);
 
+    @Select("select * from SZ_V_School_Student where school_id = 1066 and class_id between 78506 and 78514")
+    List<UserInfoBean> getStuUserInfos();
+
     @Select(" select Top(1)* from SZ_V_School_Teacher where school_id = #{school_id} and num = #{num}")
     TeacherBean getTeacher(@Param("school_id") String school_id, @Param("num") String num);
 
@@ -88,6 +91,9 @@ public interface UserDao {
     @Select("select * from SZ_Attendance where clint_type = #{clint_type} and school_id = #{school_id}")
     List<AttendanceBean> selectDeviceWithschool_id(@Param("clint_type") String clint_type, @Param("school_id") String school_id);
 
+    @Select("select * from SZ_Attendance where school_id = #{school_id}")
+    List<AttendanceBean> getAllDevices(@Param("school_id") String school_id);
+
     @Select("select * from SZ_V_School_Student where school_id = #{school_id} and len(photo)>0 and len(student_num)>0")
     List<StudentBean> getAllStudentsWithSchoolId(@Param("school_id") String school_id);
 
@@ -118,4 +124,13 @@ public interface UserDao {
 
     @Select(" select * from SZ_V_School_Teacher where school_id = #{school_id}")
     List<TeacherBean> getTeachers(@Param("school_id") String school_id);
+
+    @Select("select * from SZ_User where user_id =#{userId} and state = 1")
+    void getUserWidthUserId(@Param("userId") String userId);
+
+    @Select("select * from SZ_V_School_Student where user_id = #{userId}")
+    List<StudentBean> getStudentWithUserId(@Param("userId")String userId);
+
+    @Select("select * from SZ_V_School_Teacher where user_id = #{userId}")
+    List<TeacherBean> getTeaWithUserId(@Param("userId")String userId);
 }
diff --git a/cloud/dahua/src/main/java/com/example/dahua/service/PermissFaceService.java b/cloud/dahua/src/main/java/com/example/dahua/service/PermissFaceService.java
index 9cd6910..6d99566 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/service/PermissFaceService.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/service/PermissFaceService.java
@@ -16,4 +16,5 @@ public interface PermissFaceService {
     public ResponseBeanList<PermissionFaceBean> getPermissionDetail(int permissionId);
 
 
+    ResponseBean<String> addFace(String imgUrl, String userId);
 }
diff --git a/cloud/dahua/src/main/java/com/example/dahua/service/imp/PermissFaceServiceImp.java b/cloud/dahua/src/main/java/com/example/dahua/service/imp/PermissFaceServiceImp.java
index 88067cd..00b3ae7 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/service/imp/PermissFaceServiceImp.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/service/imp/PermissFaceServiceImp.java
@@ -5,12 +5,22 @@ import com.example.dahua.bean.*;
 import com.example.dahua.dao.PermissionFaceDao;
 import com.example.dahua.dao.UserDao;
 import com.example.dahua.service.PermissFaceService;
+import com.example.dahua.utils.BaiduUtils;
+import com.example.dahua.utils.HttpUtil;
 import com.example.dahua.utils.HttpUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
+import org.springframework.web.client.RestTemplate;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.List;
 
 @Slf4j
@@ -114,8 +124,6 @@ public class PermissFaceServiceImp implements PermissFaceService {
     }
 
 
-
-
     @Override
     public ResponseBeanList<PermissionFaceBean> getPermissions(int schoolId) {
         ResponseBeanList responseBeanList = new ResponseBeanList();
@@ -149,4 +157,93 @@ public class PermissFaceServiceImp implements PermissFaceService {
         }
         return responseBeanList;
     }
+
+    @Override
+    public ResponseBean<String> addFace(String imgUrl, String userId) {
+
+        RestTemplate restTemplate = new RestTemplate();
+        try {
+            URI uri = new URI(imgUrl);
+            ResponseEntity<byte[]> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, byte[].class);
+
+            byte[] bytes = responseEntity.getBody();
+
+            String savePath = "./imgsave/";
+            File saveFile = new File(savePath);
+            if (!saveFile.exists()) saveFile.mkdirs();
+            File saveImgFile = new File(savePath, System.currentTimeMillis() + ".jpg");
+            if (!saveImgFile.exists()) saveImgFile.createNewFile();
+            FileOutputStream fileOutputStream = new FileOutputStream(saveImgFile);
+
+            fileOutputStream.write(bytes);
+
+            //检测图片
+            BaiduUtils.getBaiduUtils().checkImg(saveImgFile.getAbsolutePath());
+
+            List<StudentBean> studentBeans = userDao.getStudentWithUserId(userId);
+
+            if (null != studentBeans && studentBeans.size() > 0) {
+                log.error("学生下发");
+                for (int i = 0; i < studentBeans.size(); i++) {
+                    StudentBean studentBean = studentBeans.get(i);
+                    int schoolId = studentBean.getSchool_id();
+                    uploadImgs(saveImgFile, schoolId + "", studentBean.getStudentcode(), 2, studentBean.getCard(), studentBean.getName());
+                }
+
+            } else {
+                List<TeacherBean> teacherBeans = userDao.getTeaWithUserId(userId);
+log.error("教师下发");
+                if (null != teacherBeans && teacherBeans.size() > 0) {
+
+                    for (int i = 0; i < teacherBeans.size(); i++) {
+                        TeacherBean teacherBean = teacherBeans.get(i);
+
+                        String schoolId = teacherBean.getSchool_id();
+                        uploadImgs(saveImgFile, schoolId, teacherBean.getNum(), 1, teacherBean.getTeacher_num(), teacherBean.getName());
+
+                    }
+
+                }
+
+            }
+
+            fileOutputStream.close();
+        } catch (URISyntaxException | IOException e) {
+            e.printStackTrace();
+        }
+
+//        userDao.getUserWidthUserId(userId);
+
+//        HttpUtils.uploadImgs()
+
+        ResponseBean responseBean = new ResponseBean();
+
+        responseBean.setData(1);
+        responseBean.setMessage("下发成功");
+        responseBean.setData(true);
+
+        return responseBean;
+    }
+
+    private void uploadImgs(File saveImgFile, String schoolId, String studentcode, int userType, String card, String name) {
+        List<AttendanceBean> attendanceBeanList = userDao.getAllDevices(schoolId + "");
+        if (null != attendanceBeanList && attendanceBeanList.size() > 0)
+            for (int i = 0; i < attendanceBeanList.size(); i++) {
+                AttendanceBean attendanceBean = attendanceBeanList.get(i);
+
+                String clintType = attendanceBean.getClint_type();
+                //根据设备类型上传人脸
+                log.error("设备:{}",clintType);
+                if (clintType.equals("18") || clintType.equals("28")) {
+                    HttpUtils.uploadImg2HK(saveImgFile.getAbsolutePath(), card, name, attendanceBean.getClint_id(), String.valueOf(userType));
+
+                } else if (clintType.equals("22") || clintType.equals("29")) {
+                    HttpUtils.uploadImgs(saveImgFile, schoolId, studentcode
+                            , clintType, userType);
+                }
+
+            }
+
+
+    }
 }
diff --git a/cloud/dahua/src/main/java/com/example/dahua/utils/BaiduUtils.java b/cloud/dahua/src/main/java/com/example/dahua/utils/BaiduUtils.java
new file mode 100644
index 0000000..9ef0ac1
--- /dev/null
+++ b/cloud/dahua/src/main/java/com/example/dahua/utils/BaiduUtils.java
@@ -0,0 +1,211 @@
+package com.example.dahua.utils;
+
+import com.example.dahua.async.ImageUtils;
+import com.example.dahua.lib.CompressPic;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import javax.imageio.stream.FileImageInputStream;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class BaiduUtils {
+
+    private static BaiduUtils baiduUtils;
+
+    public static BaiduUtils getBaiduUtils(){
+
+        if (null==baiduUtils){
+            synchronized (BaiduUtils.class){
+                if (null==baiduUtils)baiduUtils=new BaiduUtils();
+            }
+        }
+        return baiduUtils;
+    }
+
+
+    public boolean checkImg(String httpurl){
+        // 请求url
+        String url = "https://aip.baidubce.com/rest/2.0/face/v3/faceverify";
+        try {
+
+            List list = new ArrayList();
+            Map<String, String> map = new HashMap<>();
+            String image_type = "";
+            String imgFilePath = httpurl;
+            File target = new File("./huoti/");
+            if (!target.exists()) target.mkdirs();
+            File target1 = new File(target.getAbsolutePath(), new File(httpurl).getName());
+            if (httpurl.startsWith("http")) image_type = "URL";
+            else {
+                CompressPic.CompressPic(httpurl, target1.getAbsolutePath(), "");//压缩后的图片
+                image_type = "BASE64";
+                httpurl = Base64Util.encode(image2byte(target1.getAbsolutePath()));
+            }
+            map.put("image", httpurl);
+            map.put("image_type", image_type);
+//            map.put("face_field","");
+//            map.put("option","GATE");
+            list.add(map);
+            String param = GsonUtils.toJson(list);
+            // 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
+            String accessToken = getAuth();
+
+            String result1 = HttpUtil.post(url, accessToken, "application/json", param);
+            JSONObject jsonObject = new JSONObject(result1);
+            String error_msg = jsonObject.optString("error_msg");
+            JSONObject result = jsonObject.optJSONObject("result");
+            if (error_msg.equals("SUCCESS")) {
+                double face_liveness = result.optDouble("face_liveness", 0.00);//活体分数值
+                JSONArray face_list = result.optJSONArray("face_list");
+                JSONObject location = face_list.optJSONObject(0).optJSONObject("location");
+                double rotation = location.optDouble("rotation", 0.0);//竖直方向旋转角度
+                System.out.println(" face_liveness:" + face_liveness);
+                if (face_liveness > 0.4) {
+                    int angel = 0;
+                    if (45 < rotation && rotation < 135) {//右向横图,需要旋转270度
+                        System.out.println("旋转270度");
+                        angel = 270;
+                    } else if (rotation > -135 && rotation < -45) {//左向横图,需要旋转90度
+                        System.out.println("旋转90度");
+                        angel = 90;
+                    } else if (rotation >= -180 && rotation <= -135 || rotation >= 135 && rotation <= 180) {//倒向图片,需要旋转180度
+                        System.out.println("旋转180度");
+                        angel = 180;
+                    }
+                    System.out.println("图片检验成功");
+                    FileUtils.getInstance().writeLogs("检测成功:" + imgFilePath, FileUtils.checkSuc);
+                    //E:\wwwhtdocs\SmartCampus\face17e50\School
+                    //http://campus.myjxt.com//face17e5/School861/Student/GBZX20171134.jpg
+                    //F:\wwwroot\smartcampus\face17e5
+//                    imgFilePath =httpurl.replace("http://campus.myjxt.com","E:\\wwwhtdocs\\SmartCampus");
+//                    imgFilePath = httpurl.replace("http://60.190.202.57:1000","F:\\wwwroot\\smartcampus");
+//                    System.out.println("图片是否存在:" + imgFilePath);
+                    if (angel != 0)
+                        ImageUtils.rotatePhonePhoto(imgFilePath, angel);
+                    return true;
+                } else {
+                    FileUtils.getInstance().writeLogs("检测失败,活体分数:" + face_liveness + " " + imgFilePath, FileUtils.checkFail);
+                    System.out.println("图片不合格" + imgFilePath);
+                    deleteImgFile(imgFilePath);
+                    return false;
+                }
+            } else {
+                System.out.println("检测失败");
+                FileUtils.getInstance().writeLogs("检测失败:" + error_msg + imgFilePath, FileUtils.checkFail);
+                deleteImgFile(imgFilePath);
+                return false;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    //图片到byte数组
+    public byte[] image2byte(String path) {
+        byte[] data = null;
+        FileImageInputStream input = null;
+        try {
+            input = new FileImageInputStream(new File(path));
+            ByteArrayOutputStream output = new ByteArrayOutputStream();
+            byte[] buf = new byte[1024];
+            int numBytesRead = 0;
+            while ((numBytesRead = input.read(buf)) != -1) {
+                output.write(buf, 0, numBytesRead);
+            }
+            data = output.toByteArray();
+            output.close();
+            input.close();
+        } catch (FileNotFoundException ex1) {
+            ex1.printStackTrace();
+        } catch (IOException ex1) {
+            ex1.printStackTrace();
+        }
+        return data;
+    }
+
+    private boolean deleteImgFile(String imgFilePath) {
+        imgFilePath = imgFilePath.replace("http://campus.myjxt.com", "E:\\wwwhtdocs\\SmartCampus");
+        File file = new File(imgFilePath);
+        if (file.exists()) {
+            return file.delete();
+        }
+        return false;
+    }
+
+    /**
+     * 获取权限token
+     *
+     * @return 返回示例:
+     * {
+     * "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",
+     * "expires_in": 2592000
+     * }
+     */
+    public String getAuth() {
+        // 官网获取的 API Key 更新为你注册的
+        String clientId = "u6rV4YxRZmwzKj56N0DCW8eO";
+        // 官网获取的 Secret Key 更新为你注册的
+        String clientSecret = "Krp3KhmIBdnNEsRa1LavMHuZl0KhQGVm";
+        return getAuth(clientId, clientSecret);
+    }
+
+    /**
+     * 获取API访问token
+     * 该token有一定的有效期,需要自行管理,当失效时需重新获取.
+     *
+     * @param ak - 百度云官网获取的 API Key
+     * @param sk - 百度云官网获取的 Securet Key
+     * @return assess_token 示例:
+     * "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
+     */
+    public static String getAuth(String ak, String sk) {
+        // 获取token地址
+        String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
+        String getAccessTokenUrl = authHost
+                // 1. grant_type为固定参数
+                + "grant_type=client_credentials"
+                // 2. 官网获取的 API Key
+                + "&client_id=" + ak
+                // 3. 官网获取的 Secret Key
+                + "&client_secret=" + sk;
+        try {
+            URL realUrl = new URL(getAccessTokenUrl);
+            // 打开和URL之间的连接
+            HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
+            connection.setRequestMethod("GET");
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 遍历所有的响应头字段
+//            for (String key : map.keySet()) {
+//                System.err.println(key + "--->" + map.get(key));
+//            }
+            // 定义 BufferedReader输入流来读取URL的响应
+            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+            String result = "";
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+            /**
+             * 返回结果示例
+             */
+//            System.err.println("result:" + result);
+            JSONObject jsonObject = new JSONObject(result);
+            String access_token = jsonObject.getString("access_token");
+            return access_token;
+        } catch (Exception e) {
+            System.err.printf("获取token失败!");
+            e.printStackTrace(System.err);
+        }
+        return null;
+    }
+
+}
diff --git a/cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java b/cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
index 5058908..a4f810c 100644
--- a/cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
+++ b/cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
@@ -63,6 +63,20 @@ public class HttpUtils {
     }
 
 
+    public static String uploadImg2HK(String filePath,String card,String name,String deviceId,String userType){
+
+        String url = String.format("http://114.55.30.100:8089/facereco/sendCardAndImg1?filePath=%s&card=%s&name=%s&userType=%s&deviceId=%s",
+                filePath,card,name,userType,deviceId);
+
+        RestTemplate restTemplate = new RestTemplate();
+
+        ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class);
+
+        System.out.println("responseEntity:" + responseEntity.getBody());
+        return responseEntity.getBody();
+    }
+
+
     public static boolean imgsSend(String schoolId, int type) {
         String url = "http://121.40.109.21:8991/file/imgsSend?schoolId=" + schoolId + "&type=" + type;
         RestTemplate restTemplate = new RestTemplate();
diff --git a/cloud/dahua/src/test/java/com/example/dahua/DahuaApplicationTests.java b/cloud/dahua/src/test/java/com/example/dahua/DahuaApplicationTests.java
index 2eed71d..7bb3d31 100644
--- a/cloud/dahua/src/test/java/com/example/dahua/DahuaApplicationTests.java
+++ b/cloud/dahua/src/test/java/com/example/dahua/DahuaApplicationTests.java
@@ -23,6 +23,7 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.test.context.junit4.SpringRunner;
 import org.springframework.web.client.RestTemplate;
 
+import java.io.*;
 import java.util.*;
 
 @RunWith(SpringRunner.class)
@@ -368,7 +369,7 @@ public class DahuaApplicationTests {
                     sendCards.setStartTime("2020-06-23 00:07:59");
                     sendCards.setType("1");
 
-                    Map<String, String> body = new HashMap<String,String>();
+                    Map<String, String> body = new HashMap<String, String>();
                     body.put("cardNo", teacherBean.getTeacher_num());
                     body.put("endTime", "2030-06-23T00:07:59");
                     body.put("id", "5");
@@ -413,7 +414,7 @@ public class DahuaApplicationTests {
                 for (int j = 0; j < deviceids.length; j++) {
                     String deviceId = deviceids[j];
 
-                    Map<String, String> body = new HashMap<String,String>();
+                    Map<String, String> body = new HashMap<String, String>();
                     body.put("cardNo", teacherBean.getStudent_num());
                     body.put("id", "8");
                     body.put("sn", deviceId);
@@ -454,7 +455,7 @@ public class DahuaApplicationTests {
                 for (int j = 0; j < deviceids.length; j++) {
                     String deviceId = deviceids[j];
 
-                    Map<String, String> body = new HashMap<String,String>();
+                    Map<String, String> body = new HashMap<String, String>();
                     body.put("cardNo", teacherBean.getStudent_num());
                     body.put("id", "8");
                     body.put("sn", deviceId);
@@ -486,14 +487,37 @@ public class DahuaApplicationTests {
 //
 //        System.out.println("list:" + list.toString());
 
-        List<AttendanceBean> attendanceBeanList = userDao.getAttendanceBeans("479","4");
+//        List<AttendanceBean> attendanceBeanList = userDao.getAttendanceBeans("479","4");
+//
+//        for (int i = 0; i < attendanceBeanList.size(); i++) {
+//            AttendanceBean attendanceBean = attendanceBeanList.get(i);
+//
+//
+//        }
 
-        for (int i = 0; i < attendanceBeanList.size(); i++) {
-            AttendanceBean attendanceBean = attendanceBeanList.get(i);
+        File file = new File("D:\\新七年级\\名字.txt");
 
+        try {
+            FileReader fileReader = new FileReader(file);
+            BufferedReader bufferedReader = new BufferedReader(fileReader);
+            List<UserInfoBean> userInfoBeans = userDao.getStuUserInfos();
+            String content = null;
+            while ((content = bufferedReader.readLine()) != null) {
 
-        }
+                for (int i = 0; i < userInfoBeans.size(); i++) {
+                    UserInfoBean userInfoBean = userInfoBeans.get(i);
+                    if (content.equals(userInfoBean.getName())){
+                        System.out.println(userInfoBean.getStudentcode()+"\t");
+                    }
+                }
+
+            }
 
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
 
 
     }
@@ -506,7 +530,7 @@ public class DahuaApplicationTests {
 
         mqttManager.init();
 
-        List<String> stringList = userDao.getAllDecWithSch(479);
+        List<String> stringList = userDao.getAllDecWithSch(27);
         System.out.println("stringList:" + stringList.size());
         for (int i = 0; i < stringList.size(); i++) {
             String devId = stringList.get(i);
diff --git a/cloud/haikangface/mvnw b/cloud/haikangface/mvnw
index 8b9da3b..a16b543 100644
--- a/cloud/haikangface/mvnw
+++ b/cloud/haikangface/mvnw
@@ -19,7 +19,7 @@
 # ----------------------------------------------------------------------------
 
 # ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
+# Maven Start Up Batch script
 #
 # Required ENV vars:
 # ------------------
@@ -114,7 +114,6 @@ if $mingw ; then
     M2_HOME="`(cd "$M2_HOME"; pwd)`"
   [ -n "$JAVA_HOME" ] &&
     JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
-  # TODO classpath?
 fi
 
 if [ -z "$JAVA_HOME" ]; then
@@ -212,7 +211,11 @@ else
     if [ "$MVNW_VERBOSE" = true ]; then
       echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
     fi
-    jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    fi
     while IFS="=" read key value; do
       case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
       esac
@@ -221,22 +224,38 @@ else
       echo "Downloading from: $jarUrl"
     fi
     wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
 
     if command -v wget > /dev/null; then
         if [ "$MVNW_VERBOSE" = true ]; then
           echo "Found wget ... using wget"
         fi
-        wget "$jarUrl" -O "$wrapperJarPath"
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+        fi
     elif command -v curl > /dev/null; then
         if [ "$MVNW_VERBOSE" = true ]; then
           echo "Found curl ... using curl"
         fi
-        curl -o "$wrapperJarPath" "$jarUrl"
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+
     else
         if [ "$MVNW_VERBOSE" = true ]; then
           echo "Falling back to using Java to download"
         fi
         javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
         if [ -e "$javaClass" ]; then
             if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                 if [ "$MVNW_VERBOSE" = true ]; then
@@ -277,6 +296,11 @@ if $cygwin; then
     MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
 fi
 
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
 WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
 
 exec "$JAVACMD" \
diff --git a/cloud/haikangface/mvnw.cmd b/cloud/haikangface/mvnw.cmd
index fef5a8f..c8d4337 100644
--- a/cloud/haikangface/mvnw.cmd
+++ b/cloud/haikangface/mvnw.cmd
@@ -18,7 +18,7 @@
 @REM ----------------------------------------------------------------------------
 
 @REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
+@REM Maven Start Up Batch script
 @REM
 @REM Required ENV vars:
 @REM JAVA_HOME - location of a JDK home dir
@@ -26,7 +26,7 @@
 @REM Optional ENV vars
 @REM M2_HOME - location of maven2's installed home dir
 @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
 @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
 @REM     e.g. to debug Maven itself, use
 @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -37,7 +37,7 @@
 @echo off
 @REM set title of command window
 title %0
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
 @if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
 
 @REM set %HOME% to equivalent of $HOME
@@ -120,23 +120,44 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
 set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
 set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
 
-set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
-FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
-	IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
 )
 
 @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
 @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
 if exist %WRAPPER_JAR% (
-    echo Found %WRAPPER_JAR%
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
 ) else (
-    echo Couldn't find %WRAPPER_JAR%, downloading it ...
-	echo Downloading from: %DOWNLOAD_URL%
-    powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
-    echo Finished downloading %WRAPPER_JAR%
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
 )
 @REM End of extension
 
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
 %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
 if ERRORLEVEL 1 goto error
 goto end
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
index 70f91a3..3f75ff4 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
@@ -1,8 +1,10 @@
 package com.sincere.haikangface;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.sincere.haikangface.bean.*;
+import com.sincere.haikangface.bean.face.BaiduUserInfoBean;
 import com.sincere.haikangface.bean.xiaoan.Face_Recoder;
 import com.sincere.haikangface.dao.DeviceDao;
 import com.sincere.haikangface.dao.UserDao;
@@ -21,8 +23,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
 import org.springframework.util.StringUtils;
 import org.springframework.web.client.RestTemplate;
 
@@ -30,6 +38,8 @@ import java.io.*;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
+import java.text.DecimalFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -54,8 +64,8 @@ public class CMSServer implements ApplicationRunner {
     //114.55.30.100
     //120.26.116.253
 //    private String ip_cloud = "120.26.116.253";
-    private String ip_cloud = "172.16.2.53";
-    //        private String ip_cloud = "114.55.30.100";
+//    private String ip_cloud = "192.168.71.242";
+            private String ip_cloud = "114.55.30.100";
     private String ip;
 
     {
@@ -144,6 +154,7 @@ public class CMSServer implements ApplicationRunner {
                 pInBuffer.dwSize = pInBuffer.size();
                 AttendanceBean attendanceBean = new AttendanceBean();
                 attendanceBean.setClint_id(deviceId);
+
                 if (deviceId.startsWith("ytj"))
                     attendanceBean.setClint_type("28");
                 else
@@ -291,6 +302,7 @@ public class CMSServer implements ApplicationRunner {
     public class PSS_Storage_Callback implements HCEHomeSS.EHomeSSStorageCallBack {
 
         public boolean invoke(NativeLong iHandle, String pFileName, Pointer pFileBuf, int dwFileLen, Pointer pFilePath, Pointer pUser) {
+            log.error("图片进来:{}" , pFileName);
             String strPath = "C://EhomePicServer/";
 //            System.out.println("pFileName:" + pFileName);
             pFileName = pFileName.replace("_", "");
@@ -335,6 +347,9 @@ public class CMSServer implements ApplicationRunner {
                     buffers.get(bytes);
                     fout.write(bytes);
                     fout.close();
+
+                    sendToKB(strFilePathFile);
+
                 } catch (FileNotFoundException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
@@ -354,6 +369,77 @@ public class CMSServer implements ApplicationRunner {
         }
     }
 
+    /**
+     * 发送人脸到看板
+     *
+     * @param strFilePathFile
+     */
+    public void sendToKB(File strFilePathFile) {
+        try {
+
+        log.error("开始识别.....");
+        String url = "http://120.26.116.253:9214/baiduapi/search/16";
+
+        RestTemplate restTemplate = new RestTemplate();
+
+        HttpHeaders headers = new HttpHeaders();
+        MediaType mediaType = MediaType.parseMediaType(MediaType.MULTIPART_FORM_DATA_VALUE);
+        headers.setContentType(mediaType);
+        MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
+        FileSystemResource fileSystemResource = new FileSystemResource(strFilePathFile);
+
+        multiValueMap.add("file ", fileSystemResource);
+        HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, headers);
+
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
+            log.error("识别结果:{}" , responseEntity.getBody());
+        JSONObject jsonObject = JSON.parseObject(responseEntity.getBody());
+
+       String face = jsonObject.getString("data");
+       if (face.startsWith("face"))return;
+
+        JSONObject data = jsonObject.getJSONObject("data");
+        String error_msg = data.getString("error_msg");
+
+        if (error_msg.equals("SUCCESS")) {//识别成功
+            JSONObject result = data.getJSONObject("result");
+            JSONArray user_list = result.getJSONArray("user_list");
+
+            if (user_list != null && user_list.size() > 0) {
+
+                for (int i = 0; i < user_list.size(); i++) {
+                    JSONObject user = user_list.getJSONObject(i);
+
+                    String user_id = user.getString("user_id");
+                    String score = user.getString("score");
+                    double sc = Double.valueOf(score.split("\\.")[0]);
+                    if (sc >= 60) {
+                        System.out.println("user_id:" + user_id);
+                        TeacherBean teacherBean = userDao.getTeacherWithUserId1(user_id);
+                        if (null != teacherBean) {
+                            if (TextUtils.isEmpty(teacherBean.getTeacer_num()))teacherBean.setTeacer_num(user_id);
+                            MqtUtils.getInstance().sendMsg("09EA8EB5142F2964", 1, teacherBean.toString());
+                        } else {
+                            System.out.println("用户身份信息不存在");
+                        }
+                    }else {
+                        System.out.println("用户身份信息不存在"+score);
+                    }
+
+                }
+
+            }
+        } else {
+            System.out.println("识别失败:" + error_msg);
+        }
+        log.error("发送成功.....");
+//        System.out.println("responseEntity:"+responseEntity.getBody());
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+
     HCEHomeAlarm.NET_EHOME_ALARM_LISTEN_PARAM net_ehome_alarm_listen_param = new HCEHomeAlarm.NET_EHOME_ALARM_LISTEN_PARAM();
     EHomeMsgCallBack cbEHomeMsgCallBack;
     ;//报警监听回调函数实现
@@ -420,8 +506,8 @@ public class CMSServer implements ApplicationRunner {
                 strXMLData.read();
 
                 String strXML = new String(strXMLData.byValue);
-                System.out.println(strXML);
-
+//                System.out.println(strXML);
+//                log.error("报警监听:{}",strXML);
                 if (null == alarmUtils) {
                     alarmUtils = new AlarmUtils(deviceDao);
                     alarmUtils.setCallBack(new AlarmUtils.AlarmCallBack() {
@@ -477,7 +563,7 @@ public class CMSServer implements ApplicationRunner {
                 cardNo = sendRecoderUtils.getCard(card);
 
                 StudentBean studentBean = userDao.getStudentWithCard(cardNo);
-
+                log.error("studentBean:{}",studentBean);
                 if (null != studentBean) {
                     FileUtils.getInstance().writeLogs(studentBean.getName() + " " + cardNo, FileUtils.facerecoder);
 
@@ -501,7 +587,6 @@ public class CMSServer implements ApplicationRunner {
                 } else {
                     //教师点名
                     isTeacher(cardNo, deviceID);
-                    FileUtils.getInstance().writeLogs("card:" + card, FileUtils.faceSuccess);
                 }
 
                 if (deviceID.startsWith("qj")) {//枪击 用来抓拍人脸考勤用
@@ -529,10 +614,12 @@ public class CMSServer implements ApplicationRunner {
     public void isTeacher(String cardNo, String deviceID) {
 
         List<String> devLists = userDao.getDeviceRoomRelation(deviceID);
+        log.error("cardNo:{},devLists{}",cardNo,devLists);
 
         if (null != devLists && devLists.size() > 0) {
 
             StudentBean teacher = userDao.getTeacherWithCard(cardNo);
+            FileUtils.getInstance().writeLogs("teacher:" + teacher+"----"+cardNo, "教师点名.txt");
             if (null != teacher) {
                 String url = String.format("http://campus.myjxt.com/api/RollCall/AddRollCallPersonnelRecord?userId=%s&deviceId=%s", teacher.getUser_id(), deviceID);
 
@@ -540,7 +627,7 @@ public class CMSServer implements ApplicationRunner {
 
                 String res = restTemplate.getForObject(url, String.class);
                 JSONObject jsonObject = JSON.parseObject(res);
-
+                FileUtils.getInstance().writeLogs("card:" + res, "教师点名.txt");
                 System.out.println("result:" + res + "------url:" + jsonObject.getBoolean("data"));
 
             }
@@ -657,11 +744,11 @@ public class CMSServer implements ApplicationRunner {
                 "<password>MTIzNDU2</password>\r\n" +
                 "<maxSwipeTime></maxSwipeTime>\r\n" +
                 "<swipeTime></swipeTime>\r\n" +
-                "<groupNo>5</groupNo>\r\n" +
+                "<groupNo></groupNo>\r\n" +
                 "<name>";
         String nameAfter = "</name>\r\n" +
                 "<employeeNo>" + employeeNo + "</employeeNo>\r\n" +
-                "<departmentNo>3</departmentNo>\r\n" +
+                "<departmentNo></departmentNo>\r\n" +
                 "<schedulePlanNo></schedulePlanNo>\r\n" +
                 "<schedulePlanType></schedulePlanType>\r\n" +
                 "</CardCfg>\r\n" +
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
index 907f0e2..9650fac 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/async/SendUserAsync.java
@@ -105,7 +105,7 @@ public class SendUserAsync {
             if (weekDay.getDeviceIds() != null && weekDay.getDeviceIds().size() > 0) {
                 permissionBean.setDeviceIds(weekDay.getDeviceIds());
             }
-            List<String> deviceIds = permissionBean.getDeviceIds();
+            List<String> deviceIds = weekDay.getDeviceIds();
             List<String> cardNumList = new ArrayList<>();
             String sex = weekDay.getSex();
             if (userType.equals("1")) {
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/TeacherBean.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/TeacherBean.java
index 4132478..b472248 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/TeacherBean.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/TeacherBean.java
@@ -10,6 +10,16 @@ public class TeacherBean implements Serializable {
 
     private String num;
 
+    private String face;
+
+    public String getTeacher_num() {
+        return teacher_num;
+    }
+
+    public void setTeacher_num(String teacher_num) {
+        this.teacher_num = teacher_num;
+    }
+
     public String getNum() {
         return num;
     }
@@ -33,4 +43,20 @@ public class TeacherBean implements Serializable {
     public void setTeacer_num(String teacer_num) {
         this.teacher_num = teacer_num;
     }
+
+    public String getFace() {
+        return face;
+    }
+
+    public void setFace(String face) {
+        this.face = face;
+    }
+
+    @Override
+    public String toString() {
+        return "{\"name\":\"" + name + '\"' +
+                ", \"teacher_num\":\"" + teacher_num + '\"' +
+                ", \"num\":\"" + num + '\"' +
+                ", \"face\":\"" + face + '\"' +"}";
+    }
 }
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoBean.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoBean.java
new file mode 100644
index 0000000..bd2c7ce
--- /dev/null
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoBean.java
@@ -0,0 +1,45 @@
+package com.sincere.haikangface.bean.face;
+
+import java.io.Serializable;
+
+public class BaiduUserInfoBean implements Serializable {
+
+    private int status;
+
+    private String message;
+
+    private BaiduUserInfoDataBean data;
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public BaiduUserInfoDataBean getData() {
+        return data;
+    }
+
+    public void setData(BaiduUserInfoDataBean data) {
+        this.data = data;
+    }
+
+    @Override
+    public String toString() {
+        return "BaiduUserInfoBean{" +
+                "status=" + status +
+                ", message='" + message + '\'' +
+                ", data=" + data +
+                '}';
+    }
+}
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoDataBean.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoDataBean.java
new file mode 100644
index 0000000..f6ef17c
--- /dev/null
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoDataBean.java
@@ -0,0 +1,45 @@
+package com.sincere.haikangface.bean.face;
+
+import java.io.Serializable;
+
+public class BaiduUserInfoDataBean implements Serializable {
+
+    private String error_msg;
+
+    private int error_code;
+
+    private BaiduUserInfoResultBean data;
+
+    public String getError_msg() {
+        return error_msg;
+    }
+
+    public void setError_msg(String error_msg) {
+        this.error_msg = error_msg;
+    }
+
+    public int getError_code() {
+        return error_code;
+    }
+
+    public void setError_code(int error_code) {
+        this.error_code = error_code;
+    }
+
+    public BaiduUserInfoResultBean getData() {
+        return data;
+    }
+
+    public void setData(BaiduUserInfoResultBean data) {
+        this.data = data;
+    }
+
+    @Override
+    public String toString() {
+        return "BaiduUserInfoDataBean{" +
+                "error_msg='" + error_msg + '\'' +
+                ", error_code=" + error_code +
+                ", data=" + data +
+                '}';
+    }
+}
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoListBean.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoListBean.java
new file mode 100644
index 0000000..02ab2a3
--- /dev/null
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoListBean.java
@@ -0,0 +1,23 @@
+package com.sincere.haikangface.bean.face;
+
+import java.io.Serializable;
+
+public class BaiduUserInfoListBean implements Serializable {
+
+    private String user_id;
+
+    public String getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(String user_id) {
+        this.user_id = user_id;
+    }
+
+    @Override
+    public String toString() {
+        return "BaiduUserInfoListBean{" +
+                "user_id='" + user_id + '\'' +
+                '}';
+    }
+}
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoResultBean.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoResultBean.java
new file mode 100644
index 0000000..4fd999b
--- /dev/null
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/bean/face/BaiduUserInfoResultBean.java
@@ -0,0 +1,24 @@
+package com.sincere.haikangface.bean.face;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class BaiduUserInfoResultBean implements Serializable {
+
+    private List<BaiduUserInfoListBean> user_list;
+
+    public List<BaiduUserInfoListBean> getUser_list() {
+        return user_list;
+    }
+
+    public void setUser_list(List<BaiduUserInfoListBean> user_list) {
+        this.user_list = user_list;
+    }
+
+    @Override
+    public String toString() {
+        return "BaiduUserInfoResultBean{" +
+                "user_list=" + user_list +
+                '}';
+    }
+}
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/control/FileControl.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/control/FileControl.java
index 9127325..ca5bc12 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/control/FileControl.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/control/FileControl.java
@@ -81,7 +81,7 @@ public class FileControl {
             String filePath = dest.getAbsolutePath();
             FileUtils.getInstance().writeLogs("filePath:" + filePath + " card:" + card + " name:" + name + " deviceId:" + deviceId, FileUtils.sendUserInfo);
             long time = System.currentTimeMillis();
-            if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
+//            if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
             if (new File(filePath.trim()).exists()) {
                 String targetPath = FileUtils.picPathComp + new File(filePath).getName().replace(".png", ".jpg");
 
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
index 701385e..00d34af 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
@@ -67,6 +67,7 @@ public class UserControl {
     @ApiOperation("下发权限给设备")
     public boolean sendPermiss(@RequestBody PermissionBean permissionBean) {
         log.error("permissionBean:{}", JSON.toJSONString(permissionBean));
+        FileUtils.getInstance().writeLogs("传入权限模板:"+JSON.toJSONString(permissionBean),"设置权限内容.txt");
         if (!StringUtils.isEmpty(permissionBean.getDeviceIds())) {
 //            List<String> cardNumList = userDao.getStudentCardsWidthSchoolId(permissionBean.getSchoolId());
             return sendUserAsync.sendPermiss(permissionBean, 0);
@@ -97,6 +98,16 @@ public class UserControl {
         }
     }
 
+    @RequestMapping(value = "sendToKB", method = RequestMethod.GET)
+    @ApiOperation("发送数据到看板")
+    public void sendToKB(@RequestParam("filePath") String filePath) {
+        try {
+            cmsServer.sendToKB(new File(filePath));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 
     @RequestMapping(value = "sendStuCardAndImg", method = RequestMethod.GET)
     @ApiOperation("下发人脸给设备")
@@ -106,10 +117,18 @@ public class UserControl {
         return sendImg2Device(filePath, card, name, deviceId, userType);
     }
 
+    @RequestMapping(value = "sendCardAndImg1", method = RequestMethod.GET)
+    @ApiOperation("下发人脸给设备")
+    public boolean sendCardAndImg1(@RequestParam("filePath") String filePath, @RequestParam("card") String card
+            , @RequestParam("name") String name, @RequestParam("deviceId") String deviceId, @RequestParam("userType") String userType) {
+        log.error("sendCardAndImg1:---------------------------------");
+        return sendImg2Device(filePath, card, name, deviceId, userType);
+    }
+
     private boolean sendImg2Device(String filePath, String card, String name, String deviceId, String userType) {
         try {
 
-            if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
+//            if (filePath.contains(".jpg")) filePath = filePath.replace(".jpg", ".png");
             if (new File(filePath.trim()).exists()) {
                 String targetPath = FileUtils.picPathComp + new File(filePath).getName();
                 try {
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
index 73b3d16..886f3b5 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
@@ -239,6 +239,9 @@ public interface UserDao {
     @Select("select Top(1) * from SZ_V_School_Teacher where user_id = #{userId} and teacher_num<>''")
     TeacherBean getTeacherWithUserId(@Param("userId") String userId);
 
+    @Select("select Top(1) * from SZ_V_School_Teacher where user_id = #{userId}")
+    TeacherBean getTeacherWithUserId1(@Param("userId") String userId);
+
 
     List<String> getStudentWiSidAndSex(@Param("schoolId") String schoolId, @Param("sexs") List<String> sexs);
 
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/mqtt/MqttManager.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/mqtt/MqttManager.java
index 7878de4..f58239c 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/mqtt/MqttManager.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/mqtt/MqttManager.java
@@ -20,6 +20,22 @@ public class MqttManager {
 
     private static int qosLevel;
 
+    private static MqttManager mqttManager;
+
+//    public static MqttManager getInstance(){
+//
+//        if (null==mqttManager){
+//            synchronized (MqttManager.class){
+//                if (null==mqttManager) {
+//                    mqttManager = new MqttManager();
+//                    init();
+//                }
+//            }
+//        }
+//        return mqttManager;
+//    }
+
+
     public void init() {
         final String brokerUrl = "tcp://post-cn-4590mq2hr03.mqtt.aliyuncs.com:1883";
         groupId = "GID_HFJSIURFHAQO110";
@@ -95,7 +111,7 @@ public class MqttManager {
     public void sendMq(String deviceId, int cmd, String msg) {
         String recvClientId = groupId + "@@@" + deviceId;
         final String p2pSendTopic = topic + "/p2p/" + recvClientId;
-        String content = "{\"cmd\":\"" + cmd + "\",\"clientId\":\"\",\"data\": \"" + msg + "\"}";
+        String content = "{\"cmd\":\"" + cmd + "\",\"clientId\":\"\",\"data\": " + msg + "}";
         MqttMessage message = new MqttMessage(content.getBytes());
         message.setQos(qosLevel);
         System.out.println("发送内容:" + p2pSendTopic + " msg:---------" + msg);
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java
index da2450e..1553fb3 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/CompressPic.java
@@ -22,10 +22,10 @@ public class CompressPic {
         int width = bufferedImage.getWidth(null);
         int height = bufferedImage.getHeight(null);
         long fileLength = file.length();
-        System.out.println("fileLength:" + fileLength);
-        System.out.println("原始宽高:" + "width:" + width + "--height:" + height);
+//        System.out.println("fileLength:" + fileLength);
+//        System.out.println("原始宽高:" + "width:" + width + "--height:" + height);
         if ((fileLength / 1024) < 200) {
-            System.out.println("小于200k压缩:" + "width:" + width + "--height:" + height);
+//            System.out.println("小于200k压缩:" + "width:" + width + "--height:" + height);
             writeImgToFile(bufferedImage, width, height, targetPath);
         } else {
             while ((fileLength / 1024) >= 200) {
@@ -40,8 +40,8 @@ public class CompressPic {
                 width = bufferedImage1.getWidth(null);
                 height = bufferedImage1.getHeight(null);
                 fileLength = file1.length();
-                System.out.println("最终宽高:" + "width:" + width + "--height:" + height);
-                System.out.println("fileLength1:" + fileLength);
+//                System.out.println("最终宽高:" + "width:" + width + "--height:" + height);
+//                System.out.println("fileLength1:" + fileLength);
                 fileInputStream.close();
             }
         }
diff --git a/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java b/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
index 6fef96f..4122469 100644
--- a/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
+++ b/cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
@@ -124,7 +124,7 @@ public class HttpUtil {
 
         ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
 
-        System.out.println("responseEntity:" + responseEntity.getBody());
+        System.out.println("responseEntity:" + responseEntity.getBody()+name);
         return responseEntity.getBody().equals("1");
     }
 
diff --git a/cloud/haikangface/src/main/resources/mapper/usermapper.xml b/cloud/haikangface/src/main/resources/mapper/usermapper.xml
index d707dde..9811174 100644
--- a/cloud/haikangface/src/main/resources/mapper/usermapper.xml
+++ b/cloud/haikangface/src/main/resources/mapper/usermapper.xml
@@ -19,7 +19,7 @@
     </select>
 
     <select id="getDeviceRoomRelation" resultType="java.lang.String">
-        select clint_id from SZ_DeviceRoomRelation where clint_id = #{clint_id};
+        select clint_id from SZ_DeviceRoomRelation where clint_id = #{clint_id} and state = 1;
     </select>
 
 </mapper>
diff --git a/cloud/mypulsar/src/main/java/com/example/mypulsar/MyRunnerableInt.java b/cloud/mypulsar/src/main/java/com/example/mypulsar/MyRunnerableInt.java
index 608a9e4..de4e90d 100644
--- a/cloud/mypulsar/src/main/java/com/example/mypulsar/MyRunnerableInt.java
+++ b/cloud/mypulsar/src/main/java/com/example/mypulsar/MyRunnerableInt.java
@@ -40,7 +40,7 @@ public class MyRunnerableInt implements ApplicationRunner {
 
     @Override
     public void run(ApplicationArguments args) throws Exception {
-        initMqConsumer();
+//        initMqConsumer();
     }
 
     /**
--
libgit2 0.21.0