Commit 79abf0116570070b72a0b4512fee5b35a3baf0c6

Authored by 陈杰
1 parent b971c436
Exists in master

博冠人脸机

Showing 65 changed files with 3962 additions and 392 deletions   Show diff stats
cloud/common/pom.xml
@@ -22,6 +22,17 @@ @@ -22,6 +22,17 @@
22 22
23 <dependencies> 23 <dependencies>
24 <dependency> 24 <dependency>
  25 + <groupId>cn.rongcloud.im</groupId>
  26 + <artifactId>server-sdk-java</artifactId>
  27 + <version>3.1.4</version>
  28 + </dependency>
  29 + <!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
  30 + <dependency>
  31 + <groupId>com.sun.mail</groupId>
  32 + <artifactId>javax.mail</artifactId>
  33 + <version>1.6.2</version>
  34 + </dependency>
  35 + <dependency>
25 <groupId>com.nimbusds</groupId> 36 <groupId>com.nimbusds</groupId>
26 <artifactId>nimbus-jose-jwt</artifactId> 37 <artifactId>nimbus-jose-jwt</artifactId>
27 <version>6.0</version> 38 <version>6.0</version>
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SZ_AttendanceDto.java
@@ -26,6 +26,16 @@ public class SZ_AttendanceDto { @@ -26,6 +26,16 @@ public class SZ_AttendanceDto {
26 private String ip ; 26 private String ip ;
27 private int port ; 27 private int port ;
28 28
  29 + private int outOrIn ;
  30 +
  31 + public int getOutOrIn() {
  32 + return outOrIn;
  33 + }
  34 +
  35 + public void setOutOrIn(int outOrIn) {
  36 + this.outOrIn = outOrIn;
  37 + }
  38 +
29 public String getIp() { 39 public String getIp() {
30 return ip; 40 return ip;
31 } 41 }
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentBean.java 0 → 100644
@@ -0,0 +1,307 @@ @@ -0,0 +1,307 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +
  6 +public class StudentBean implements Serializable {
  7 +
  8 + private String teacher_id;
  9 +
  10 + private String parent_id;
  11 +
  12 + private long ID;
  13 +
  14 + private String UserId;
  15 +
  16 + private String CustomerId;
  17 +
  18 + private int StudentType;
  19 +
  20 + private int UserType;
  21 +
  22 + private String name;
  23 +
  24 + private int ClassId;
  25 +
  26 + private String ClassName;
  27 +
  28 + private String OldCard;
  29 +
  30 + private String Card;
  31 +
  32 + private int SchoolId;
  33 +
  34 + private int school_id;
  35 +
  36 + private int IsNew;
  37 +
  38 + private int UpdateType;
  39 +
  40 + private Date AddTime;
  41 +
  42 + private int Sex;
  43 +
  44 + private String Face;
  45 +
  46 + private String studentcode;
  47 +
  48 + private String student_num;
  49 +
  50 + private String student_id;
  51 +
  52 + private String user_id;
  53 +
  54 + private String photo;
  55 +
  56 + private String teacher_num;
  57 +
  58 + private String num;
  59 +
  60 + public String getNum() {
  61 + return num;
  62 + }
  63 +
  64 + public void setNum(String num) {
  65 + this.num = num;
  66 + }
  67 +
  68 + public String getTeacher_num() {
  69 + return teacher_num;
  70 + }
  71 +
  72 + public void setTeacher_num(String teacher_num) {
  73 + this.teacher_num = teacher_num;
  74 + }
  75 +
  76 + public String getPhoto() {
  77 + return photo;
  78 + }
  79 +
  80 + public void setPhoto(String photo) {
  81 + this.photo = photo;
  82 + }
  83 +
  84 + public String getUser_id() {
  85 + return user_id;
  86 + }
  87 +
  88 + public void setUser_id(String user_id) {
  89 + this.user_id = user_id;
  90 + }
  91 +
  92 + public String getStudentcode() {
  93 + return studentcode;
  94 + }
  95 +
  96 + public void setStudentcode(String studentcode) {
  97 + this.studentcode = studentcode;
  98 + }
  99 +
  100 + public String getUserId() {
  101 + return UserId;
  102 + }
  103 +
  104 + public void setUserId(String userId) {
  105 + UserId = userId;
  106 + }
  107 +
  108 + public String getCustomerId() {
  109 + return CustomerId;
  110 + }
  111 +
  112 + public void setCustomerId(String customerId) {
  113 + CustomerId = customerId;
  114 + }
  115 +
  116 + public int getStudentType() {
  117 + return StudentType;
  118 + }
  119 +
  120 + public void setStudentType(int studentType) {
  121 + StudentType = studentType;
  122 + }
  123 +
  124 + public int getUserType() {
  125 + return UserType;
  126 + }
  127 +
  128 + public String getTeacher_id() {
  129 + return teacher_id;
  130 + }
  131 +
  132 + public String getParent_id() {
  133 + return parent_id;
  134 + }
  135 +
  136 + public void setParent_id(String parent_id) {
  137 + this.parent_id = parent_id;
  138 + }
  139 +
  140 + public void setTeacher_id(String teacher_id) {
  141 + this.teacher_id = teacher_id;
  142 + }
  143 +
  144 + public void setUserType(int userType) {
  145 + UserType = userType;
  146 + }
  147 +
  148 + public String getName() {
  149 + return name;
  150 + }
  151 +
  152 + public void setName(String name) {
  153 + this.name = name;
  154 + }
  155 +
  156 + public int getClassId() {
  157 + return ClassId;
  158 + }
  159 +
  160 + public void setClassId(int classId) {
  161 + ClassId = classId;
  162 + }
  163 +
  164 + public String getClassName() {
  165 + return ClassName;
  166 + }
  167 +
  168 + public void setClassName(String className) {
  169 + ClassName = className;
  170 + }
  171 +
  172 + public String getOldCard() {
  173 + return OldCard;
  174 + }
  175 +
  176 + public void setOldCard(String oldCard) {
  177 + OldCard = oldCard;
  178 + }
  179 +
  180 + public String getCard() {
  181 + return Card;
  182 + }
  183 +
  184 + public int getSchool_id() {
  185 + return school_id;
  186 + }
  187 +
  188 + public void setSchool_id(int school_id) {
  189 + this.school_id = school_id;
  190 + }
  191 +
  192 + public String getStudent_num() {
  193 + return student_num;
  194 + }
  195 +
  196 + public void setStudent_num(String student_num) {
  197 + this.student_num = student_num;
  198 + }
  199 +
  200 + public void setCard(String card) {
  201 + Card = card;
  202 + }
  203 +
  204 + public int getSchoolId() {
  205 + return SchoolId;
  206 + }
  207 +
  208 + public void setSchoolId(int schoolId) {
  209 + SchoolId = schoolId;
  210 + }
  211 +
  212 + public int getIsNew() {
  213 + return IsNew;
  214 + }
  215 +
  216 + public void setIsNew(int isNew) {
  217 + IsNew = isNew;
  218 + }
  219 +
  220 + public int getUpdateType() {
  221 + return UpdateType;
  222 + }
  223 +
  224 + public void setUpdateType(int updateType) {
  225 + UpdateType = updateType;
  226 + }
  227 +
  228 + public Date getAddTime() {
  229 + return AddTime;
  230 + }
  231 +
  232 + public void setAddTime(Date addTime) {
  233 + AddTime = addTime;
  234 + }
  235 +
  236 + public int getSex() {
  237 + return Sex;
  238 + }
  239 +
  240 + public void setSex(int sex) {
  241 + Sex = sex;
  242 + }
  243 +
  244 + public String getFace() {
  245 + return Face;
  246 + }
  247 +
  248 + public void setFace(String face) {
  249 + Face = face;
  250 + }
  251 +
  252 + public String getStudentCode() {
  253 + return studentcode;
  254 + }
  255 +
  256 + public void setStudentCode(String studentCode) {
  257 + this.studentcode = studentCode;
  258 + }
  259 +
  260 + public long getID() {
  261 + return ID;
  262 + }
  263 +
  264 + public void setID(long ID) {
  265 + this.ID = ID;
  266 + }
  267 +
  268 + public String getStudent_id() {
  269 + return student_id;
  270 + }
  271 +
  272 + public void setStudent_id(String student_id) {
  273 + this.student_id = student_id;
  274 + }
  275 +
  276 + @Override
  277 + public String toString() {
  278 + return "StudentBean{" +
  279 + "teacher_id='" + teacher_id + '\'' +
  280 + ", parent_id='" + parent_id + '\'' +
  281 + ", ID=" + ID +
  282 + ", UserId='" + UserId + '\'' +
  283 + ", CustomerId='" + CustomerId + '\'' +
  284 + ", StudentType=" + StudentType +
  285 + ", UserType=" + UserType +
  286 + ", name='" + name + '\'' +
  287 + ", ClassId=" + ClassId +
  288 + ", ClassName='" + ClassName + '\'' +
  289 + ", OldCard='" + OldCard + '\'' +
  290 + ", Card='" + Card + '\'' +
  291 + ", SchoolId=" + SchoolId +
  292 + ", school_id=" + school_id +
  293 + ", IsNew=" + IsNew +
  294 + ", UpdateType=" + UpdateType +
  295 + ", AddTime=" + AddTime +
  296 + ", Sex=" + Sex +
  297 + ", Face='" + Face + '\'' +
  298 + ", studentcode='" + studentcode + '\'' +
  299 + ", student_num='" + student_num + '\'' +
  300 + ", student_id='" + student_id + '\'' +
  301 + ", user_id='" + user_id + '\'' +
  302 + ", photo='" + photo + '\'' +
  303 + ", teacher_num='" + teacher_num + '\'' +
  304 + ", num='" + num + '\'' +
  305 + '}';
  306 + }
  307 +}
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SzVSchoolStudent.java 0 → 100644
@@ -0,0 +1,235 @@ @@ -0,0 +1,235 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class SzVSchoolStudent {
  6 + private Integer schoolId;
  7 +
  8 + private Integer classId;
  9 +
  10 + private Integer studentId;
  11 +
  12 + private String userId;
  13 +
  14 + private String studentNum;
  15 +
  16 + private String name;
  17 +
  18 + private String num;
  19 +
  20 + private String photo;
  21 +
  22 + private Integer ismonitor;
  23 +
  24 + private Integer classState;
  25 +
  26 + private Integer roleState;
  27 +
  28 + private String modifystate;
  29 +
  30 + private String mobile;
  31 +
  32 + private String className;
  33 +
  34 + private Integer studentType;
  35 +
  36 + private String matrikelnummer;
  37 +
  38 + private String studentcode;
  39 +
  40 + private String sex;
  41 +
  42 + private String parentmobile;
  43 +
  44 + private String othername;
  45 +
  46 + private Date activetime;
  47 +
  48 + private Integer active;
  49 +
  50 + private String pass;
  51 +
  52 + public Integer getSchoolId() {
  53 + return schoolId;
  54 + }
  55 +
  56 + public void setSchoolId(Integer schoolId) {
  57 + this.schoolId = schoolId;
  58 + }
  59 +
  60 + public Integer getClassId() {
  61 + return classId;
  62 + }
  63 +
  64 + public void setClassId(Integer classId) {
  65 + this.classId = classId;
  66 + }
  67 +
  68 + public Integer getStudentId() {
  69 + return studentId;
  70 + }
  71 +
  72 + public void setStudentId(Integer studentId) {
  73 + this.studentId = studentId;
  74 + }
  75 +
  76 + public String getUserId() {
  77 + return userId;
  78 + }
  79 +
  80 + public void setUserId(String userId) {
  81 + this.userId = userId;
  82 + }
  83 +
  84 + public String getStudentNum() {
  85 + return studentNum;
  86 + }
  87 +
  88 + public void setStudentNum(String studentNum) {
  89 + this.studentNum = studentNum;
  90 + }
  91 +
  92 + public String getName() {
  93 + return name;
  94 + }
  95 +
  96 + public void setName(String name) {
  97 + this.name = name;
  98 + }
  99 +
  100 + public String getNum() {
  101 + return num;
  102 + }
  103 +
  104 + public void setNum(String num) {
  105 + this.num = num;
  106 + }
  107 +
  108 + public String getPhoto() {
  109 + return photo;
  110 + }
  111 +
  112 + public void setPhoto(String photo) {
  113 + this.photo = photo;
  114 + }
  115 +
  116 + public Integer getIsmonitor() {
  117 + return ismonitor;
  118 + }
  119 +
  120 + public void setIsmonitor(Integer ismonitor) {
  121 + this.ismonitor = ismonitor;
  122 + }
  123 +
  124 + public Integer getClassState() {
  125 + return classState;
  126 + }
  127 +
  128 + public void setClassState(Integer classState) {
  129 + this.classState = classState;
  130 + }
  131 +
  132 + public Integer getRoleState() {
  133 + return roleState;
  134 + }
  135 +
  136 + public void setRoleState(Integer roleState) {
  137 + this.roleState = roleState;
  138 + }
  139 +
  140 + public String getModifystate() {
  141 + return modifystate;
  142 + }
  143 +
  144 + public void setModifystate(String modifystate) {
  145 + this.modifystate = modifystate;
  146 + }
  147 +
  148 + public String getMobile() {
  149 + return mobile;
  150 + }
  151 +
  152 + public void setMobile(String mobile) {
  153 + this.mobile = mobile;
  154 + }
  155 +
  156 + public String getClassName() {
  157 + return className;
  158 + }
  159 +
  160 + public void setClassName(String className) {
  161 + this.className = className;
  162 + }
  163 +
  164 + public Integer getStudentType() {
  165 + return studentType;
  166 + }
  167 +
  168 + public void setStudentType(Integer studentType) {
  169 + this.studentType = studentType;
  170 + }
  171 +
  172 + public String getMatrikelnummer() {
  173 + return matrikelnummer;
  174 + }
  175 +
  176 + public void setMatrikelnummer(String matrikelnummer) {
  177 + this.matrikelnummer = matrikelnummer;
  178 + }
  179 +
  180 + public String getStudentcode() {
  181 + return studentcode;
  182 + }
  183 +
  184 + public void setStudentcode(String studentcode) {
  185 + this.studentcode = studentcode;
  186 + }
  187 +
  188 + public String getSex() {
  189 + return sex;
  190 + }
  191 +
  192 + public void setSex(String sex) {
  193 + this.sex = sex;
  194 + }
  195 +
  196 + public String getParentmobile() {
  197 + return parentmobile;
  198 + }
  199 +
  200 + public void setParentmobile(String parentmobile) {
  201 + this.parentmobile = parentmobile;
  202 + }
  203 +
  204 + public String getOthername() {
  205 + return othername;
  206 + }
  207 +
  208 + public void setOthername(String othername) {
  209 + this.othername = othername;
  210 + }
  211 +
  212 + public Date getActivetime() {
  213 + return activetime;
  214 + }
  215 +
  216 + public void setActivetime(Date activetime) {
  217 + this.activetime = activetime;
  218 + }
  219 +
  220 + public Integer getActive() {
  221 + return active;
  222 + }
  223 +
  224 + public void setActive(Integer active) {
  225 + this.active = active;
  226 + }
  227 +
  228 + public String getPass() {
  229 + return pass;
  230 + }
  231 +
  232 + public void setPass(String pass) {
  233 + this.pass = pass;
  234 + }
  235 +}
0 \ No newline at end of file 236 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SzVSchoolTeacher.java 0 → 100644
@@ -0,0 +1,173 @@ @@ -0,0 +1,173 @@
  1 +package com.sincere.common.dto.smartCampus;
  2 +
  3 +public class SzVSchoolTeacher {
  4 + private Integer schoolId;
  5 +
  6 + private Integer classId;
  7 +
  8 + private Integer teacherId;
  9 +
  10 + private String userId;
  11 +
  12 + private String name;
  13 +
  14 + private String face;
  15 +
  16 + private String num;
  17 +
  18 + private String teacherNum;
  19 +
  20 + private String teacherMobile;
  21 +
  22 + private String mobile;
  23 +
  24 + private Integer classState;
  25 +
  26 + private Integer roleState;
  27 +
  28 + private Integer iskaoqin;
  29 +
  30 + private String openid;
  31 +
  32 + private String pass;
  33 +
  34 + private String dinguserid;
  35 +
  36 + private String qiyehaouserid;
  37 +
  38 + public Integer getSchoolId() {
  39 + return schoolId;
  40 + }
  41 +
  42 + public void setSchoolId(Integer schoolId) {
  43 + this.schoolId = schoolId;
  44 + }
  45 +
  46 + public Integer getClassId() {
  47 + return classId;
  48 + }
  49 +
  50 + public void setClassId(Integer classId) {
  51 + this.classId = classId;
  52 + }
  53 +
  54 + public Integer getTeacherId() {
  55 + return teacherId;
  56 + }
  57 +
  58 + public void setTeacherId(Integer teacherId) {
  59 + this.teacherId = teacherId;
  60 + }
  61 +
  62 + public String getUserId() {
  63 + return userId;
  64 + }
  65 +
  66 + public void setUserId(String userId) {
  67 + this.userId = userId;
  68 + }
  69 +
  70 + public String getName() {
  71 + return name;
  72 + }
  73 +
  74 + public void setName(String name) {
  75 + this.name = name;
  76 + }
  77 +
  78 + public String getFace() {
  79 + return face;
  80 + }
  81 +
  82 + public void setFace(String face) {
  83 + this.face = face;
  84 + }
  85 +
  86 + public String getNum() {
  87 + return num;
  88 + }
  89 +
  90 + public void setNum(String num) {
  91 + this.num = num;
  92 + }
  93 +
  94 + public String getTeacherNum() {
  95 + return teacherNum;
  96 + }
  97 +
  98 + public void setTeacherNum(String teacherNum) {
  99 + this.teacherNum = teacherNum;
  100 + }
  101 +
  102 + public String getTeacherMobile() {
  103 + return teacherMobile;
  104 + }
  105 +
  106 + public void setTeacherMobile(String teacherMobile) {
  107 + this.teacherMobile = teacherMobile;
  108 + }
  109 +
  110 + public String getMobile() {
  111 + return mobile;
  112 + }
  113 +
  114 + public void setMobile(String mobile) {
  115 + this.mobile = mobile;
  116 + }
  117 +
  118 + public Integer getClassState() {
  119 + return classState;
  120 + }
  121 +
  122 + public void setClassState(Integer classState) {
  123 + this.classState = classState;
  124 + }
  125 +
  126 + public Integer getRoleState() {
  127 + return roleState;
  128 + }
  129 +
  130 + public void setRoleState(Integer roleState) {
  131 + this.roleState = roleState;
  132 + }
  133 +
  134 + public Integer getIskaoqin() {
  135 + return iskaoqin;
  136 + }
  137 +
  138 + public void setIskaoqin(Integer iskaoqin) {
  139 + this.iskaoqin = iskaoqin;
  140 + }
  141 +
  142 + public String getOpenid() {
  143 + return openid;
  144 + }
  145 +
  146 + public void setOpenid(String openid) {
  147 + this.openid = openid;
  148 + }
  149 +
  150 + public String getPass() {
  151 + return pass;
  152 + }
  153 +
  154 + public void setPass(String pass) {
  155 + this.pass = pass;
  156 + }
  157 +
  158 + public String getDinguserid() {
  159 + return dinguserid;
  160 + }
  161 +
  162 + public void setDinguserid(String dinguserid) {
  163 + this.dinguserid = dinguserid;
  164 + }
  165 +
  166 + public String getQiyehaouserid() {
  167 + return qiyehaouserid;
  168 + }
  169 +
  170 + public void setQiyehaouserid(String qiyehaouserid) {
  171 + this.qiyehaouserid = qiyehaouserid;
  172 + }
  173 +}
0 \ No newline at end of file 174 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/FaceRecoder.java 0 → 100644
@@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class FaceRecoder {
  6 + private String deviceid;
  7 +
  8 + private String userId;
  9 +
  10 + private String name;
  11 +
  12 + private String imgurl;
  13 +
  14 + private Integer inorout;
  15 +
  16 + private Date time;
  17 +
  18 + private String cardnum;
  19 +
  20 + public String getDeviceid() {
  21 + return deviceid;
  22 + }
  23 +
  24 + public void setDeviceid(String deviceid) {
  25 + this.deviceid = deviceid;
  26 + }
  27 +
  28 + public String getUserId() {
  29 + return userId;
  30 + }
  31 +
  32 + public void setUserId(String userId) {
  33 + this.userId = userId;
  34 + }
  35 +
  36 + public String getName() {
  37 + return name;
  38 + }
  39 +
  40 + public void setName(String name) {
  41 + this.name = name;
  42 + }
  43 +
  44 + public String getImgurl() {
  45 + return imgurl;
  46 + }
  47 +
  48 + public void setImgurl(String imgurl) {
  49 + this.imgurl = imgurl;
  50 + }
  51 +
  52 + public Integer getInorout() {
  53 + return inorout;
  54 + }
  55 +
  56 + public void setInorout(Integer inorout) {
  57 + this.inorout = inorout;
  58 + }
  59 +
  60 + public Date getTime() {
  61 + return time;
  62 + }
  63 +
  64 + public void setTime(Date time) {
  65 + this.time = time;
  66 + }
  67 +
  68 + public String getCardnum() {
  69 + return cardnum;
  70 + }
  71 +
  72 + public void setCardnum(String cardnum) {
  73 + this.cardnum = cardnum;
  74 + }
  75 +}
0 \ No newline at end of file 76 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/FaceSendfail.java 0 → 100644
@@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +public class FaceSendfail {
  4 + private String deviceid;
  5 +
  6 + private String customerid;
  7 +
  8 + private String num;
  9 +
  10 + private String name;
  11 +
  12 + private String time;
  13 +
  14 + private String schoolname;
  15 +
  16 + private String imgpath;
  17 +
  18 + private Integer schoolid;
  19 +
  20 + private String failcontent;
  21 +
  22 + private Integer failtype;
  23 +
  24 + private Integer usertype;
  25 +
  26 + private Integer devicetype;
  27 +
  28 + public String getDeviceid() {
  29 + return deviceid;
  30 + }
  31 +
  32 + public void setDeviceid(String deviceid) {
  33 + this.deviceid = deviceid;
  34 + }
  35 +
  36 + public String getCustomerid() {
  37 + return customerid;
  38 + }
  39 +
  40 + public void setCustomerid(String customerid) {
  41 + this.customerid = customerid;
  42 + }
  43 +
  44 + public String getNum() {
  45 + return num;
  46 + }
  47 +
  48 + public void setNum(String num) {
  49 + this.num = num;
  50 + }
  51 +
  52 + public String getName() {
  53 + return name;
  54 + }
  55 +
  56 + public void setName(String name) {
  57 + this.name = name;
  58 + }
  59 +
  60 + public String getTime() {
  61 + return time;
  62 + }
  63 +
  64 + public void setTime(String time) {
  65 + this.time = time;
  66 + }
  67 +
  68 + public String getSchoolname() {
  69 + return schoolname;
  70 + }
  71 +
  72 + public void setSchoolname(String schoolname) {
  73 + this.schoolname = schoolname;
  74 + }
  75 +
  76 + public String getImgpath() {
  77 + return imgpath;
  78 + }
  79 +
  80 + public void setImgpath(String imgpath) {
  81 + this.imgpath = imgpath;
  82 + }
  83 +
  84 + public Integer getSchoolid() {
  85 + return schoolid;
  86 + }
  87 +
  88 + public void setSchoolid(Integer schoolid) {
  89 + this.schoolid = schoolid;
  90 + }
  91 +
  92 + public String getFailcontent() {
  93 + return failcontent;
  94 + }
  95 +
  96 + public void setFailcontent(String failcontent) {
  97 + this.failcontent = failcontent;
  98 + }
  99 +
  100 + public Integer getFailtype() {
  101 + return failtype;
  102 + }
  103 +
  104 + public void setFailtype(Integer failtype) {
  105 + this.failtype = failtype;
  106 + }
  107 +
  108 + public Integer getUsertype() {
  109 + return usertype;
  110 + }
  111 +
  112 + public void setUsertype(Integer usertype) {
  113 + this.usertype = usertype;
  114 + }
  115 +
  116 + public Integer getDevicetype() {
  117 + return devicetype;
  118 + }
  119 +
  120 + public void setDevicetype(Integer devicetype) {
  121 + this.devicetype = devicetype;
  122 + }
  123 +}
0 \ No newline at end of file 124 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/dto/xiaoan/FaceSendsuccess.java 0 → 100644
@@ -0,0 +1,105 @@ @@ -0,0 +1,105 @@
  1 +package com.sincere.common.dto.xiaoan;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class FaceSendsuccess {
  6 + private String deviceid;
  7 +
  8 + private String customerid;
  9 +
  10 + private String num;
  11 +
  12 + private String name;
  13 +
  14 + private Date time;
  15 +
  16 + private String schoolname;
  17 +
  18 + private String imgpath;
  19 +
  20 + private Integer schoolid;
  21 +
  22 + private Integer usertype;
  23 +
  24 + private Integer devicetype;
  25 +
  26 + public String getDeviceid() {
  27 + return deviceid;
  28 + }
  29 +
  30 + public void setDeviceid(String deviceid) {
  31 + this.deviceid = deviceid;
  32 + }
  33 +
  34 + public String getCustomerid() {
  35 + return customerid;
  36 + }
  37 +
  38 + public void setCustomerid(String customerid) {
  39 + this.customerid = customerid;
  40 + }
  41 +
  42 + public String getNum() {
  43 + return num;
  44 + }
  45 +
  46 + public void setNum(String num) {
  47 + this.num = num;
  48 + }
  49 +
  50 + public String getName() {
  51 + return name;
  52 + }
  53 +
  54 + public void setName(String name) {
  55 + this.name = name;
  56 + }
  57 +
  58 + public Date getTime() {
  59 + return time;
  60 + }
  61 +
  62 + public void setTime(Date time) {
  63 + this.time = time;
  64 + }
  65 +
  66 + public String getSchoolname() {
  67 + return schoolname;
  68 + }
  69 +
  70 + public void setSchoolname(String schoolname) {
  71 + this.schoolname = schoolname;
  72 + }
  73 +
  74 + public String getImgpath() {
  75 + return imgpath;
  76 + }
  77 +
  78 + public void setImgpath(String imgpath) {
  79 + this.imgpath = imgpath;
  80 + }
  81 +
  82 + public Integer getSchoolid() {
  83 + return schoolid;
  84 + }
  85 +
  86 + public void setSchoolid(Integer schoolid) {
  87 + this.schoolid = schoolid;
  88 + }
  89 +
  90 + public Integer getUsertype() {
  91 + return usertype;
  92 + }
  93 +
  94 + public void setUsertype(Integer usertype) {
  95 + this.usertype = usertype;
  96 + }
  97 +
  98 + public Integer getDevicetype() {
  99 + return devicetype;
  100 + }
  101 +
  102 + public void setDevicetype(Integer devicetype) {
  103 + this.devicetype = devicetype;
  104 + }
  105 +}
0 \ No newline at end of file 106 \ No newline at end of file
cloud/common/src/main/java/com/sincere/common/util/DateUtils.java
@@ -28,6 +28,13 @@ public class DateUtils { @@ -28,6 +28,13 @@ public class DateUtils {
28 return System.currentTimeMillis(); 28 return System.currentTimeMillis();
29 } 29 }
30 30
  31 + public static Date getByLong(String lo){
  32 + long time = Long.parseLong(lo);
  33 + Date date = new Date(time);
  34 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  35 + return string2Date(sd.format(date),format2);
  36 + }
  37 +
31 public static String date2String(Date date, String format) { 38 public static String date2String(Date date, String format) {
32 SimpleDateFormat sdf = new SimpleDateFormat(format); 39 SimpleDateFormat sdf = new SimpleDateFormat(format);
33 return sdf.format(date); 40 return sdf.format(date);
cloud/common/src/main/java/com/sincere/common/util/HttpClientUtils.java
1 package com.sincere.common.util; 1 package com.sincere.common.util;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import io.rong.RongCloud;
  5 +import io.rong.methods.user.User;
  6 +import io.rong.models.response.TokenResult;
  7 +import io.rong.models.user.UserModel;
4 import org.apache.commons.httpclient.HttpClient; 8 import org.apache.commons.httpclient.HttpClient;
5 import org.apache.commons.httpclient.methods.InputStreamRequestEntity; 9 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
6 import org.apache.commons.httpclient.methods.PostMethod; 10 import org.apache.commons.httpclient.methods.PostMethod;
@@ -40,17 +44,49 @@ public class HttpClientUtils { @@ -40,17 +44,49 @@ public class HttpClientUtils {
40 requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000).build(); 44 requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000).build();
41 } 45 }
42 46
43 -// public static void main(String[] args){  
44 -//// String url = "http://http://zhktest.114school.com.cn/szkjapi/toyxy/addTeacherOrg" ;  
45 -//// String json = "{\"name\": \"子部门\",\"groupname\": \"父部门\",\"schoolid\": \"16\",\"token\": \"05719991\"}" ;  
46 -//// JSONObject jsonObject = HttpClientUtils.httpPostJson(url,json);  
47 -//// System.out.println(jsonObject.toJSONString());  
48 -//  
49 -// String url = "http://campus.myjxt.com/api/Room/GetListPageRoom" ;  
50 -// String json = "PageIndex=1&roomId=6583&pageSize=9999" ;  
51 -// JSONObject jsonObject = HttpClientUtils.httpPost(url,json); 47 + public static void main(String[] args) throws Exception {
  48 +// String url = "http://http://zhktest.114school.com.cn/szkjapi/toyxy/addTeacherOrg" ;
  49 +// String json = "{\"name\": \"子部门\",\"groupname\": \"父部门\",\"schoolid\": \"16\",\"token\": \"05719991\"}" ;
  50 +// JSONObject jsonObject = HttpClientUtils.httpPostJson(url,json);
52 // System.out.println(jsonObject.toJSONString()); 51 // System.out.println(jsonObject.toJSONString());
53 -// } 52 +
  53 + String url = "http://39.100.248.170:8080/recv" ;
  54 + String json = "{\n" +
  55 + " \"appKey\":\"c9kqb3rdc2j9j\",\n" +
  56 + " \"channelId\":\"12\",\n" +
  57 + " \"event\":2,\n" +
  58 + " \"userId\":\"hHjap87\",\n" +
  59 + " \"timestamp\":"+System.currentTimeMillis()+",\n" +
  60 + " \"token\":\"y6f/aqQ2uJy9cgB4iKxxBNAX/fjWZa8YqXq8ZvODQXbnQpU4ylueQGbBvhBzsKU5camPO4XrURpN73+6paUtbPDbI+qinUYn\",\n" +
  61 + " \"extra\":\"xxxx\",\n" +
  62 + " \"members\":\n" +
  63 + " [{\n" +
  64 + " \"userId\": \"hHjap87\",\n" +
  65 + " \"data\":{\n" +
  66 + " \"key1\":\"value1\"\n" +
  67 + " }\n" +
  68 + " }\n" +
  69 + "}" ;
  70 + JSONObject jsonObject = HttpClientUtils.httpPostJson(url,json);
  71 + System.out.println(jsonObject.toJSONString());
  72 +// String appKey = "c9kqb3rdc2j9j";
  73 +// String appSecret = "L2ven2G1fB5";
  74 +//
  75 +// RongCloud rongCloud = RongCloud.getInstance(appKey, appSecret);
  76 +// User user = rongCloud.user;
  77 +//
  78 +// /**
  79 +// * API 文档: http://www.rongcloud.cn/docs/server_sdk_api/user/user.html#register
  80 +// *
  81 +// * 注册用户,生成用户在融云的唯一身份标识 Token
  82 +// */
  83 +// UserModel userModel = new UserModel()
  84 +// .setId("hHjap87")
  85 +// .setName("RongCloud")
  86 +// .setPortrait("http://www.rongcloud.cn/images/logo.png");
  87 +// TokenResult result = user.register(userModel);
  88 +// System.out.println("getToken: " + result.toString());
  89 + }
54 90
55 /** 91 /**
56 * post请求传输json参数 92 * post请求传输json参数
cloud/lapi/pom.xml 0 → 100644
@@ -0,0 +1,191 @@ @@ -0,0 +1,191 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>cloud</artifactId>
  7 + <groupId>com.sincere</groupId>
  8 + <version>1.0.0</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>lapi</artifactId>
  13 + <properties>
  14 + <java.version>1.8</java.version>
  15 + <swagger-version>2.9.2</swagger-version>
  16 + </properties>
  17 +
  18 + <dependencies>
  19 + <dependency>
  20 + <groupId>org.springframework.boot</groupId>
  21 + <artifactId>spring-boot-starter-web</artifactId>
  22 + <version>2.2.5.RELEASE</version>
  23 + </dependency>
  24 + <dependency>
  25 + <groupId>com.sincere</groupId>
  26 + <artifactId>common</artifactId>
  27 + <version>1.0.0</version>
  28 + </dependency>
  29 +
  30 + <dependency>
  31 + <groupId>org.springframework.boot</groupId>
  32 + <artifactId>spring-boot-starter-test</artifactId>
  33 + <version>2.2.5.RELEASE</version>
  34 + <scope>test</scope>
  35 + </dependency>
  36 +
  37 + <dependency>
  38 + <groupId>io.netty</groupId>
  39 + <artifactId>netty-all</artifactId>
  40 + <version>4.1.2.Final</version>
  41 + </dependency>
  42 +
  43 + <dependency>
  44 + <groupId>com.alibaba</groupId>
  45 + <artifactId>fastjson</artifactId>
  46 + <version>1.2.67</version>
  47 + </dependency>
  48 +
  49 + <dependency>
  50 + <groupId>org.apache.commons</groupId>
  51 + <artifactId>commons-lang3</artifactId>
  52 + <version>3.9</version>
  53 + </dependency>
  54 + <!-- <dependency>-->
  55 + <!-- <groupId>org.springframework</groupId>-->
  56 + <!-- <artifactId>spring-test</artifactId>-->
  57 + <!-- <version>5.1.6.RELEASE</version>-->
  58 + <!-- <scope>compile</scope>-->
  59 + <!-- </dependency>-->
  60 + <dependency>
  61 + <groupId>org.springframework.cloud</groupId>
  62 + <artifactId>spring-cloud-starter-feign</artifactId>
  63 + <version>1.3.6.RELEASE</version>
  64 + </dependency>
  65 + <dependency>
  66 + <groupId>org.springframework.cloud</groupId>
  67 + <artifactId>spring-cloud-openfeign-core</artifactId>
  68 + <version>2.1.2.RELEASE</version>
  69 + </dependency>
  70 + <dependency>
  71 + <groupId>org.apache.httpcomponents</groupId>
  72 + <artifactId>httpclient</artifactId>
  73 + <version>4.5.12</version>
  74 + </dependency>
  75 +
  76 + <dependency>
  77 + <groupId>org.apache.httpcomponents</groupId>
  78 + <artifactId>httpcore</artifactId>
  79 + <version>4.4.13</version>
  80 + </dependency>
  81 +
  82 + <dependency>
  83 + <groupId>org.apache.httpcomponents</groupId>
  84 + <artifactId>httpmime</artifactId>
  85 + <version>4.5.12</version>
  86 + </dependency>
  87 + <dependency>
  88 + <groupId>org.springframework</groupId>
  89 + <artifactId>spring-test</artifactId>
  90 + <version>5.2.4.RELEASE</version>
  91 + <scope>compile</scope>
  92 + </dependency>
  93 +
  94 + <dependency>
  95 + <groupId>io.springfox</groupId>
  96 + <artifactId>springfox-swagger-ui</artifactId>
  97 + <version>${swagger-version}</version>
  98 + </dependency>
  99 + <dependency>
  100 + <groupId>io.springfox</groupId>
  101 + <artifactId>springfox-swagger2</artifactId>
  102 + <version>${swagger-version}</version>
  103 + </dependency>
  104 +
  105 + </dependencies>
  106 +
  107 + <build>
  108 + <!--打包文件名-->
  109 + <finalName>boguan_server</finalName>
  110 + <!--打包方式-->
  111 + <plugins>
  112 + <!-- 设置编译版本 -->
  113 + <plugin>
  114 + <groupId>org.apache.maven.plugins</groupId>
  115 + <artifactId>maven-compiler-plugin</artifactId>
  116 + <version>3.1</version>
  117 + <configuration>
  118 + <source>1.8</source>
  119 + <target>1.8</target>
  120 + <encoding>UTF-8</encoding>
  121 + </configuration>
  122 + </plugin>
  123 + <!-- 打包jar文件时,配置manifest文件,加入lib包的jar依赖 -->
  124 + <!-- 本地启动需要注释-->
  125 + <plugin>
  126 + <groupId>org.apache.maven.plugins</groupId>
  127 + <artifactId>maven-jar-plugin</artifactId>
  128 + <configuration>
  129 + <archive>
  130 + <manifest>
  131 + <mainClass>com.sincere.lapi.LapiDemoApplication</mainClass>
  132 + <addClasspath>true</addClasspath>
  133 + <classpathPrefix>lib/</classpathPrefix>
  134 + </manifest>
  135 + <manifestEntries>
  136 + <Class-Path>./config/</Class-Path>
  137 + </manifestEntries>
  138 + </archive>
  139 + <excludes>
  140 + <exclude>config/**</exclude>
  141 + </excludes>
  142 + <classesDirectory></classesDirectory>
  143 + </configuration>
  144 + </plugin>
  145 + <!-- 拷贝依赖的jar包到lib目录 -->
  146 + <plugin>
  147 + <groupId>org.apache.maven.plugins</groupId>
  148 + <artifactId>maven-dependency-plugin</artifactId>
  149 + <executions>
  150 + <execution>
  151 + <id>copy</id>
  152 + <phase>package</phase>
  153 + <goals>
  154 + <goal>copy-dependencies</goal>
  155 + </goals>
  156 + <configuration>
  157 + <outputDirectory>
  158 + ${project.build.directory}/lib
  159 + </outputDirectory>
  160 + </configuration>
  161 + </execution>
  162 + </executions>
  163 + </plugin>
  164 + <!-- 解决资源文件的编码问题 -->
  165 + <plugin>
  166 + <groupId>org.apache.maven.plugins</groupId>
  167 + <artifactId>maven-resources-plugin</artifactId>
  168 + <version>2.5</version>
  169 + <configuration>
  170 + <encoding>UTF-8</encoding>
  171 + </configuration>
  172 + </plugin>
  173 + <!-- 打包source文件为jar文件 -->
  174 + <plugin>
  175 + <artifactId>maven-source-plugin</artifactId>
  176 + <version>2.2</version>
  177 + <configuration>
  178 + <attach>true</attach>
  179 + </configuration>
  180 + <executions>
  181 + <execution>
  182 + <phase>compile</phase>
  183 + <goals>
  184 + <goal>jar</goal>
  185 + </goals>
  186 + </execution>
  187 + </executions>
  188 + </plugin>
  189 + </plugins>
  190 + </build>
  191 +</project>
0 \ No newline at end of file 192 \ No newline at end of file
cloud/lapi/src/main/java/com/sincere/lapi/LapiDemoApplication.java 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +package com.sincere.lapi;
  2 +
  3 +import com.sincere.lapi.server.ServerRun;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +import org.springframework.cloud.openfeign.EnableFeignClients;
  7 +
  8 +@EnableFeignClients(basePackages = "com.sincere.lapi.feign")
  9 +@SpringBootApplication
  10 +public class LapiDemoApplication {
  11 +
  12 + public static void main(String[] args) {
  13 + SpringApplication.run(LapiDemoApplication.class, args);
  14 + ServerRun serverRun = new ServerRun();
  15 + serverRun.start(5300);
  16 + }
  17 +
  18 +}
cloud/lapi/src/main/java/com/sincere/lapi/Swagger2.java 0 → 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +package com.sincere.lapi;
  2 +
  3 +import org.springframework.context.annotation.Bean;
  4 +import org.springframework.context.annotation.Configuration;
  5 +import springfox.documentation.builders.ApiInfoBuilder;
  6 +import springfox.documentation.builders.ParameterBuilder;
  7 +import springfox.documentation.builders.PathSelectors;
  8 +import springfox.documentation.builders.RequestHandlerSelectors;
  9 +import springfox.documentation.schema.ModelRef;
  10 +import springfox.documentation.service.ApiInfo;
  11 +import springfox.documentation.service.Parameter;
  12 +import springfox.documentation.spi.DocumentationType;
  13 +import springfox.documentation.spring.web.plugins.Docket;
  14 +import springfox.documentation.swagger2.annotations.EnableSwagger2;
  15 +
  16 +import java.util.ArrayList;
  17 +import java.util.List;
  18 +
  19 +@EnableSwagger2
  20 +@Configuration //让Spring来加载该类配置
  21 +public class Swagger2 {
  22 +
  23 + @Bean
  24 + public Docket createRestApi() {
  25 + ParameterBuilder ticketPar = new ParameterBuilder();
  26 + return new Docket(DocumentationType.SWAGGER_2)
  27 + .apiInfo(apiInfo())
  28 + .enableUrlTemplating(true)
  29 + .select()
  30 + // 扫描所有有注解的api,用这种方式更灵活
  31 + .apis(RequestHandlerSelectors.basePackage("com.sincere.lapi.controller"))
  32 + .paths(PathSelectors.any())
  33 + .build();
  34 +
  35 + }
  36 + private ApiInfo apiInfo() {
  37 + return new ApiInfoBuilder()
  38 + .title("Spring Boot中使用Swagger2构建RESTful APIs")
  39 + .description("接口文档")
  40 + .termsOfServiceUrl("")
  41 + .version("1.0")
  42 + .build();
  43 + }
  44 +}
cloud/lapi/src/main/java/com/sincere/lapi/Utils/FileUtils.java 0 → 100644
@@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
  1 +package com.sincere.lapi.Utils;
  2 +
  3 +import org.apache.tomcat.util.http.fileupload.IOUtils;
  4 +
  5 +import javax.imageio.ImageIO;
  6 +import java.awt.image.BufferedImage;
  7 +import java.io.*;
  8 +import java.net.HttpURLConnection;
  9 +import java.net.MalformedURLException;
  10 +import java.net.URL;
  11 +import java.net.URLConnection;
  12 +
  13 +public class FileUtils {
  14 +
  15 + public static String img_url = "c:\\\\lapi\\" ;
  16 + public static String zip_url = "c:\\\\lapi\\zip\\" ;
  17 +
  18 + public static byte[] getBytes(String filePath){
  19 + try{
  20 + String dir = download(filePath);
  21 + String fName = dir.trim();
  22 + String temp[] = fName.split("\\\\");
  23 + String fileName = temp[temp.length-1];
  24 + String zipUrl = CompressPic(dir,zip_url+fileName);
  25 + File file = new File(zipUrl);
  26 + long fileSize = file.length();
  27 + if (fileSize > Integer.MAX_VALUE) {
  28 + System.out.println("file too big...");
  29 + return null;
  30 + }
  31 + byte[] buffer = null;
  32 + FileInputStream fi = new FileInputStream(file);
  33 + buffer = new byte[(int) fileSize];
  34 + int offset = 0;
  35 + int numRead = 0;
  36 + while (offset < buffer.length
  37 + && (numRead = fi.read(buffer, offset, buffer.length - offset)) >= 0) {
  38 + offset += numRead;
  39 + }
  40 + // 确保所有数据均被读取
  41 + if (offset != buffer.length) {
  42 + throw new IOException("Could not completely read file "
  43 + + file.getName());
  44 + }
  45 + return buffer;
  46 + }catch (Exception e){
  47 +
  48 + }
  49 + return null ;
  50 + }
  51 +
  52 + public static String download(String urlPath){
  53 + File file = null;
  54 + String fName = urlPath.trim();
  55 + String temp[] = fName.split("\\/");
  56 + String fileName = temp[temp.length-1];
  57 + try {
  58 + // 统一资源
  59 + URL url = new URL(urlPath);
  60 + // 连接类的父类,抽象类
  61 + URLConnection urlConnection = url.openConnection();
  62 + // http的连接类
  63 + HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;
  64 + //设置超时
  65 + httpURLConnection.setConnectTimeout(1000*5);
  66 + //设置请求方式,默认是GET
  67 + httpURLConnection.setRequestMethod("GET");
  68 + // 设置字符编码
  69 + httpURLConnection.setRequestProperty("Charset", "UTF-8");
  70 + // 打开到此 URL引用的资源的通信链接(如果尚未建立这样的连接)。
  71 + httpURLConnection.connect();
  72 +
  73 + BufferedInputStream bin = new BufferedInputStream(httpURLConnection.getInputStream());
  74 + // 指定存放位置(有需求可以自定义)
  75 + String path = img_url + "lapi.jpg";
  76 + file = new File(path);
  77 + // 校验文件夹目录是否存在,不存在就创建一个目录
  78 + if (!file.getParentFile().exists()) {
  79 + file.getParentFile().mkdirs();
  80 + }
  81 + FileOutputStream fos = new FileOutputStream(file);
  82 + IOUtils.copy(bin, fos);
  83 + IOUtils.closeQuietly(fos);
  84 + return path;
  85 + } catch (MalformedURLException e) {
  86 + e.printStackTrace();
  87 + } catch (IOException e) {
  88 + e.printStackTrace();
  89 + }
  90 + return null ;
  91 + }
  92 +
  93 + public static String CompressPic(String srcPath, String targetPath) throws Exception {
  94 + double cutPercent = 0.2;
  95 + File file = new File(srcPath.trim());
  96 + FileInputStream fileInputStream = new FileInputStream(file);
  97 + BufferedImage bufferedImage = ImageIO.read(fileInputStream);
  98 + int width = bufferedImage.getWidth(null);
  99 + int height = bufferedImage.getHeight(null);
  100 + long fileLength = file.length();
  101 + if ((fileLength / 1024) < 100) {
  102 + writeImgToFile(bufferedImage, width, height, targetPath);
  103 + } else
  104 + while ((fileLength / 1024) >= 100) {
  105 + width = (int) (width * (1 - cutPercent));
  106 + height = (int) (height * (1 - cutPercent));
  107 +
  108 + writeImgToFile(bufferedImage, width, height, targetPath);
  109 +
  110 + File file1 = new File(targetPath);
  111 + FileInputStream fileInputStream1 = new FileInputStream(file1);
  112 + BufferedImage bufferedImage1 = ImageIO.read(fileInputStream1);
  113 + width = bufferedImage1.getWidth(null);
  114 + height = bufferedImage1.getHeight(null);
  115 + fileLength = file1.length();
  116 + fileInputStream1.close();
  117 + }
  118 +// System.out.printf("图片大小:"+fileLength/1024);
  119 + fileInputStream.close();
  120 + return targetPath;
  121 + }
  122 +
  123 + private static void writeImgToFile(BufferedImage bufferedImage, int width, int height, String targetPath) {
  124 + try {
  125 +
  126 + BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
  127 + tag.getGraphics().drawImage(bufferedImage, 0, 0, width, height, null); // 绘制缩小后的图
  128 + FileOutputStream deskImage = new FileOutputStream(targetPath); // 输出到文件流
  129 + boolean write = ImageIO.write(tag, "jpg", deskImage);
  130 + deskImage.close();
  131 + } catch (Exception e) {
  132 + e.printStackTrace();
  133 + }
  134 + }
  135 +
  136 +}
cloud/lapi/src/main/java/com/sincere/lapi/Utils/SpringContextHolder.java 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +package com.sincere.lapi.Utils;
  2 +
  3 +import com.sincere.lapi.service.request.AttendanceService;
  4 +import com.sincere.lapi.service.request.TerminalHttpCall;
  5 +import org.springframework.beans.BeansException;
  6 +import org.springframework.context.ApplicationContext;
  7 +import org.springframework.context.ApplicationContextAware;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +/**
  11 + * @author chen
  12 + * @version 1.0
  13 + * @date 2019/10/29 0029 16:35
  14 + */
  15 +@Component
  16 +public class SpringContextHolder implements ApplicationContextAware {
  17 +
  18 + private static ApplicationContext applicationContext;
  19 +
  20 + @Override
  21 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  22 + SpringContextHolder.applicationContext = applicationContext;
  23 + }
  24 +
  25 + public static TerminalHttpCall getTerminalHttpCall(){
  26 + return (TerminalHttpCall) applicationContext.getBean("terminalHttpCall");
  27 + }
  28 +
  29 + public static AttendanceService getAttendanceService(){
  30 + return (AttendanceService) applicationContext.getBean("attendanceService");
  31 + }
  32 +}
cloud/lapi/src/main/java/com/sincere/lapi/controller/LapiController.java 0 → 100644
@@ -0,0 +1,274 @@ @@ -0,0 +1,274 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/7
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.controller;
  18 +
  19 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  20 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  21 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  22 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  23 +import com.sincere.lapi.Utils.FileUtils;
  24 +import com.sincere.lapi.feign.ScFeign;
  25 +import com.sincere.lapi.feign.XaFeign;
  26 +import com.sincere.lapi.pojo.*;
  27 +import com.sincere.lapi.server.UrlParam;
  28 +import com.sincere.lapi.service.request.TerminalHttpCall;
  29 +import io.swagger.annotations.ApiOperation;
  30 +import org.apache.commons.lang3.StringUtils;
  31 +import org.springframework.beans.factory.annotation.Autowired;
  32 +import org.springframework.web.bind.annotation.RequestMapping;
  33 +import org.springframework.web.bind.annotation.RequestMethod;
  34 +import org.springframework.web.bind.annotation.RequestParam;
  35 +import org.springframework.web.bind.annotation.RestController;
  36 +import sun.misc.BASE64Encoder;
  37 +
  38 +import java.util.ArrayList;
  39 +import java.util.HashMap;
  40 +import java.util.List;
  41 +import java.util.Map;
  42 +
  43 +/**
  44 + * description
  45 + *
  46 + * @author dW5565
  47 + */
  48 +@RestController
  49 +public class LapiController {
  50 +
  51 + @Autowired
  52 + ScFeign scFeign ;
  53 +
  54 + @Autowired
  55 + XaFeign xaFeign ;
  56 +
  57 + @Autowired
  58 + TerminalHttpCall terminalHttpCall = new TerminalHttpCall();
  59 +
  60 + /**
  61 + * 下发整个学校
  62 + * @param deviceIds 多个设备用,隔开
  63 + * @param schoolId
  64 + * @param userType 1 老师 2 学生
  65 + */
  66 + @RequestMapping(value = "sendFaces", method = RequestMethod.GET)
  67 + @ApiOperation(value = "下发学校下所有人脸给指定设备", notes = "下发所有人脸给指定设备")
  68 + public void sendFaces(@RequestParam("deviceIds") String deviceIds, @RequestParam("schoolId") String schoolId, @RequestParam("userType") String userType) {
  69 + String[] deviceList = deviceIds.split(",");
  70 + if(userType.equals("1")){
  71 + List<SzVSchoolTeacher> list = scFeign.selectTeacherBySchoolId(schoolId) ;
  72 + for(String deviceId :deviceList){
  73 + sendTeacherBatch(list,deviceId);
  74 + }
  75 + }else if( userType.equals("2")){
  76 + List<SzVSchoolStudent> list = scFeign.selectStudentBySchoolId(schoolId) ;
  77 + for(String deviceId :deviceList){
  78 + sendStudentBatch(list,deviceId);
  79 + }
  80 + }
  81 + }
  82 +
  83 +
  84 +
  85 + //下发单张人脸到设备
  86 + @RequestMapping(value = "sendStuCardAndImg", method = RequestMethod.GET)
  87 + @ApiOperation("下发人脸给设备")
  88 + public boolean sendCardAndImg( @RequestParam("deviceId") String deviceId, @RequestParam("customerId") int customerId, @RequestParam("userType") String userType){
  89 + if(userType.equals("1")){
  90 + SzVSchoolTeacher teacher = scFeign.selectByTeacherId(customerId) ;
  91 + sendTeacher(teacher,deviceId);
  92 + }else if( userType.equals("2")){
  93 + SzVSchoolStudent student = scFeign.selectByStudentId(customerId) ;
  94 + sendStudent(student,deviceId);
  95 + }
  96 + return true;
  97 + }
  98 +
  99 + private void sendStudentBatch( List<SzVSchoolStudent> list , String deviceId){
  100 + for(SzVSchoolStudent student : list){
  101 + if(StringUtils.isNotBlank(student.getPhoto())){
  102 + sendStudent(student,deviceId);
  103 + }
  104 + }
  105 + }
  106 +
  107 + private void sendStudent(SzVSchoolStudent student , String deviceId){
  108 + try{
  109 + LAPIResponse response = sendImg(Long.valueOf(student.getStudentId()),student.getName(),student.getStudentNum(),student.getPhoto(),deviceId);
  110 + System.out.println("接收到的json-------"+response.toString());
  111 + terminalHttpCall.removeKey(deviceId);
  112 + if(response.getStatusString().equals("Succeed")){
  113 + insertSuccess(deviceId,student.getStudentId(),student.getStudentNum(),student.getName(),student.getPhoto(),student.getSchoolId(),2);
  114 + }else {
  115 + insertFail(deviceId,student.getStudentId(),student.getStudentNum(),student.getName(),student.getPhoto(),student.getSchoolId(),2,response.getStatusCode());
  116 + }
  117 + }catch (Exception e){
  118 + e.printStackTrace();
  119 + }
  120 +
  121 + }
  122 +
  123 + private void sendTeacherBatch( List<SzVSchoolTeacher> list , String deviceId){
  124 + for(SzVSchoolTeacher teacher : list){
  125 + if(StringUtils.isNotBlank(teacher.getFace())){
  126 + sendTeacher(teacher,deviceId);
  127 + }
  128 + }
  129 + }
  130 +
  131 + private void sendTeacher(SzVSchoolTeacher teacher , String deviceId){
  132 + try{
  133 + LAPIResponse response = sendImg(Long.valueOf(teacher.getTeacherId()),teacher.getName(),teacher.getTeacherNum(),teacher.getFace(),deviceId);
  134 + terminalHttpCall.removeKey(deviceId);
  135 + if(response.getStatusString().equals("Succeed")){
  136 + insertSuccess(deviceId,teacher.getTeacherId(),teacher.getTeacherNum(),teacher.getName(),teacher.getFace(),teacher.getSchoolId(),1);
  137 + }else {
  138 + insertFail(deviceId,teacher.getTeacherId(),teacher.getTeacherNum(),teacher.getName(),teacher.getFace(),teacher.getSchoolId(),1,response.getStatusCode());
  139 + }
  140 + }catch (Exception e){
  141 + e.printStackTrace();
  142 + }
  143 +
  144 + }
  145 +
  146 + private LAPIResponse sendImg(long personId , String name , String code , String fileUrl , String deviceId){
  147 + LAPIResponse response = new LAPIResponse() ;
  148 + PersonInfoList personInfoList = new PersonInfoList();
  149 + List<PersonInfo> list1 = new ArrayList<PersonInfo>();
  150 + personInfoList.setPersonInfoList(list1);
  151 + PersonInfo personInfo = new PersonInfo();
  152 + list1.add(personInfo);
  153 + personInfoList.setNum(list1.size());
  154 +
  155 + personInfo.setPersonID(personId);
  156 + personInfo.setLastChange(System.currentTimeMillis() / 1000);
  157 + personInfo.setPersonName(name);
  158 + personInfo.setGender(1);
  159 +
  160 + PersonTimeTemplateInfo personTimeTemplateInfo = new PersonTimeTemplateInfo();
  161 + personTimeTemplateInfo.setBeginTime(System.currentTimeMillis() / 1000);
  162 + personTimeTemplateInfo.setEndTime((System.currentTimeMillis() + 10 * 365 * 24 * 60 * 60 * 1000L) / 1000);
  163 + personTimeTemplateInfo.setIndex(0);
  164 + personInfo.setTimeTemplate(personTimeTemplateInfo);
  165 +
  166 + List<IdentificationInfo> list = new ArrayList<IdentificationInfo>();
  167 + IdentificationInfo identificationInfo = new IdentificationInfo();
  168 + list.add(identificationInfo);
  169 + identificationInfo.setNumber(Long.parseLong(getCard(code), 16)+"");
  170 + identificationInfo.setType(1);
  171 + personInfo.setIdentificationList(list);
  172 + personInfo.setIdentificationNum(list.size());
  173 +
  174 + List<PersonImageInfo> imageList = new ArrayList<PersonImageInfo>();
  175 + try{
  176 + PersonImageInfo personImageInfo = new PersonImageInfo();
  177 + String picture = new BASE64Encoder().encode(FileUtils.getBytes(fileUrl));
  178 + picture = picture.replaceAll("\n", "").replaceAll("\r", "");
  179 + personImageInfo.setData(picture);
  180 + personImageInfo.setFaceID(1L);
  181 + //personImageInfo.setName("1.jpg");
  182 + personImageInfo.setSize(picture.length());
  183 + imageList.add(personImageInfo);
  184 + personInfo.setImageList(imageList);
  185 + personInfo.setImageNum(imageList.size());
  186 + terminalHttpCall.addPerson(deviceId, personInfoList);
  187 +
  188 + Thread.sleep(2000);
  189 + try{
  190 + response = terminalHttpCall.getResponse(deviceId);
  191 + response.getStatusString();
  192 + }catch (Exception e){
  193 + Thread.sleep(5000);
  194 + response = terminalHttpCall.getResponse(deviceId);
  195 + }
  196 +
  197 + } catch(Exception e) {
  198 + System.out.println("下发失败"+e.getMessage());
  199 + }
  200 + return response ;
  201 + }
  202 +
  203 +
  204 + private String getCard(String card) {
  205 +
  206 + if (card.length() == 8) {
  207 + int length = card.length();
  208 + String result = card.substring(length - 2, length) + card.substring(length - 4, length - 2) + card.substring(length - 6, length - 4)
  209 + + card.substring(length - 8, length - 6);
  210 + return result;
  211 +
  212 + } else {
  213 + System.out.println("卡号位数不对:" + card);
  214 + return "";
  215 + }
  216 +
  217 + }
  218 +
  219 + private void insertSuccess(String deviceId , int customerId , String num , String name , String imgPath , int schoolId ,int userType){
  220 + FaceSendsuccess send = new FaceSendsuccess();
  221 + send.setDeviceid(deviceId);
  222 + send.setCustomerid(customerId+"");
  223 + send.setDevicetype(25);
  224 + send.setImgpath(imgPath);
  225 + send.setSchoolid(schoolId);
  226 + send.setUsertype(userType);
  227 + send.setName(name);
  228 + send.setNum(num);
  229 + xaFeign.insertFaceSuccess(send);
  230 + }
  231 +
  232 + private void insertFail(String deviceId , int customerId , String num , String name , String imgPath , int schoolId ,int userType , int failType ){
  233 + FaceSendfail send = new FaceSendfail();
  234 + send.setDeviceid(deviceId);
  235 + send.setCustomerid(customerId+"");
  236 + send.setDevicetype(25);
  237 + send.setImgpath(imgPath);
  238 + send.setSchoolid(schoolId);
  239 + send.setUsertype(userType);
  240 + send.setName(name);
  241 + send.setNum(num);
  242 + send.setFailtype(failType);
  243 + send.setFailcontent(failMap.get(failType+""));
  244 + xaFeign.insertFaceFail(send);
  245 + }
  246 +
  247 +
  248 + public static Map<String,String> failMap = new HashMap<>();
  249 +
  250 + static {
  251 + failMap.put("1000","算法初始化失败");
  252 + failMap.put("1001","人脸检测失败");
  253 + failMap.put("1002","图片未检测到人脸");
  254 + failMap.put("1003","jpeg照片解码失败");
  255 + failMap.put("1004","图片质量分数不满足");
  256 + failMap.put("1005","图片缩放失败");
  257 + failMap.put("1006","未启用智能");
  258 + failMap.put("1007","导入图片过小");
  259 + failMap.put("1008","导入图片过大");
  260 + failMap.put("1009","导入图片分辨率超过1920*1080");
  261 + failMap.put("1010","导入图片不存在");
  262 + failMap.put("1011","人脸元素个数已达到上限");
  263 + failMap.put("1012",":智能棒算法模型不匹配");
  264 + failMap.put("1013","人脸导入库成员证件号非法");
  265 + failMap.put("1014","人脸导入库成员图片格式错误");
  266 + failMap.put("1015","通道布控已达设备能力上限");
  267 + failMap.put("1016","其它客户端正在进行操作人脸库");
  268 + failMap.put("1017","人脸库文件正在更新中");
  269 + failMap.put("1018","Json反序列化失败");
  270 + failMap.put("1019","Base64解码失败");
  271 + failMap.put("1020","人脸照片,编码后的大小和实际接收到的长度不一致");
  272 +
  273 + }
  274 +}
cloud/lapi/src/main/java/com/sincere/lapi/feign/ScFeign.java 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +package com.sincere.lapi.feign;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto;
  4 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  5 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  6 +import org.springframework.cloud.openfeign.FeignClient;
  7 +import org.springframework.web.bind.annotation.RequestBody;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * @author chen
  16 + * @version 1.0
  17 + * @date 2019/11/28 0028 9:17
  18 + */
  19 +@FeignClient("smartCampusSearch")
  20 +public interface ScFeign {
  21 +
  22 + @RequestMapping(value = "/attendance/addAttendance", method = RequestMethod.POST)
  23 + void addAttendance(@RequestBody SZ_AttendanceDto attendanceDto);
  24 +
  25 + @RequestMapping(method = RequestMethod.GET, value = "/attendance/selectAttendaceWithId")
  26 + SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id);
  27 +
  28 + @RequestMapping(value = "/sm/user/selectTeacherBySchoolId",method = RequestMethod.GET)
  29 + List<SzVSchoolTeacher> selectTeacherBySchoolId(@RequestParam("schoolId") String schoolId);
  30 +
  31 + @RequestMapping(value = "/sm/user/selectStudentBySchoolId",method = RequestMethod.GET)
  32 + List<SzVSchoolStudent> selectStudentBySchoolId(@RequestParam("schoolId") String schoolId);
  33 +
  34 + @RequestMapping(value = "/sm/user/selectByTeacherId",method = RequestMethod.GET)
  35 + SzVSchoolTeacher selectByTeacherId(@RequestParam("teacherId") int teacherId);
  36 +
  37 + @RequestMapping(value = "/sm/user/selectByStudentId",method = RequestMethod.GET)
  38 + SzVSchoolStudent selectByStudentId(@RequestParam("studentId") int studentId);
  39 +}
cloud/lapi/src/main/java/com/sincere/lapi/feign/XaFeign.java 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +package com.sincere.lapi.feign;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  4 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  5 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  6 +import org.springframework.cloud.openfeign.FeignClient;
  7 +import org.springframework.web.bind.annotation.RequestBody;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +
  11 +@FeignClient("xiaoanSearch")
  12 +public interface XaFeign {
  13 +
  14 + @RequestMapping(value = "/xa/face/success",method = RequestMethod.POST)
  15 + void insertFaceSuccess(@RequestBody FaceSendsuccess faceSendsuccess);
  16 +
  17 + @RequestMapping(value = "/xa/face/fail",method = RequestMethod.POST)
  18 + void insertFaceFail(@RequestBody FaceSendfail faceSendfail);
  19 +
  20 + @RequestMapping(value = "/xa/face/insertRecode",method = RequestMethod.POST)
  21 + void insertRecode(@RequestBody FaceRecoder faceRecoder);
  22 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/HeartInfo.java 0 → 100644
@@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
  1 +package com.sincere.lapi.pojo;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +//心跳
  8 +public class HeartInfo implements Serializable {
  9 +
  10 + @JSONField(name = "RefId", ordinal = 1)
  11 + private String refId ;
  12 + @JSONField(name = "Time", ordinal = 2)
  13 + private String time ;
  14 + @JSONField(name = "NextTime", ordinal = 3)
  15 + private String nextTime ;
  16 + @JSONField(name = "DeviceCode", ordinal = 4)
  17 + private String deviceCode ;
  18 + @JSONField(name = "DeviceType", ordinal = 5)
  19 + private int deviceType ;
  20 +
  21 + public String getRefId() {
  22 + return refId;
  23 + }
  24 +
  25 + public void setRefId(String refId) {
  26 + this.refId = refId;
  27 + }
  28 +
  29 + public String getTime() {
  30 + return time;
  31 + }
  32 +
  33 + public void setTime(String time) {
  34 + this.time = time;
  35 + }
  36 +
  37 + public String getNextTime() {
  38 + return nextTime;
  39 + }
  40 +
  41 + public void setNextTime(String nextTime) {
  42 + this.nextTime = nextTime;
  43 + }
  44 +
  45 + public String getDeviceCode() {
  46 + return deviceCode;
  47 + }
  48 +
  49 + public void setDeviceCode(String deviceCode) {
  50 + this.deviceCode = deviceCode;
  51 + }
  52 +
  53 + public int getDeviceType() {
  54 + return deviceType;
  55 + }
  56 +
  57 + public void setDeviceType(int deviceType) {
  58 + this.deviceType = deviceType;
  59 + }
  60 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/IdentificationInfo.java 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/13
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +/**
  22 + * description
  23 + *
  24 + * @author dW5565
  25 + */
  26 +public class IdentificationInfo {
  27 +
  28 + @JSONField(name = "Type", ordinal = 1)
  29 + private Integer type;
  30 + @JSONField(name = "Number", ordinal = 2)
  31 + private String number;
  32 +
  33 + public Integer getType() {
  34 + return type;
  35 + }
  36 +
  37 + public void setType(Integer type) {
  38 + this.type = type;
  39 + }
  40 +
  41 + public String getNumber() {
  42 + return number;
  43 + }
  44 +
  45 + public void setNumber(String number) {
  46 + this.number = number;
  47 + }
  48 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/LAPI.java 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +package com.sincere.lapi.pojo;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +
  5 +public class LAPI {
  6 +
  7 + @JSONField(name = "Response", ordinal = 1)
  8 + private LAPIResponse response ;
  9 +
  10 + public LAPIResponse getResponse() {
  11 + return response;
  12 + }
  13 +
  14 + public void setResponse(LAPIResponse response) {
  15 + this.response = response;
  16 + }
  17 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/LAPIResponse.java 0 → 100644
@@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
  1 +package com.sincere.lapi.pojo;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +/**
  8 + * @author wW4799
  9 + * @date 2018/10/18.
  10 + */
  11 +public class LAPIResponse implements Serializable {
  12 + /**
  13 + * 响应URL
  14 + */
  15 + @JSONField(name = "ResponseURL", ordinal = 1)
  16 + private String responseUrl;
  17 +
  18 + /**
  19 + * 创建Id
  20 + */
  21 + @JSONField(name = "CreatedID", ordinal = 2)
  22 + private int createdId;
  23 +
  24 + /**
  25 + * 状态编码
  26 + */
  27 + @JSONField(name = "StatusCode", ordinal = 3)
  28 + private int statusCode;
  29 +
  30 + /**
  31 + * 状态描述
  32 + */
  33 + @JSONField(name = "StatusString", ordinal = 4)
  34 + private String statusString;
  35 +
  36 + /**
  37 + * 返回数据
  38 + */
  39 + @JSONField(name = "Data", ordinal = 5)
  40 + private String data;
  41 +
  42 + public String getResponseUrl() {
  43 + return responseUrl;
  44 + }
  45 +
  46 + public void setResponseUrl(String responseUrl) {
  47 + this.responseUrl = responseUrl;
  48 + }
  49 +
  50 +
  51 + public int getCreatedId() {
  52 + return createdId;
  53 + }
  54 +
  55 + public void setCreatedId(int createdId) {
  56 + this.createdId = createdId;
  57 + }
  58 +
  59 +
  60 + public int getStatusCode() {
  61 + return statusCode;
  62 + }
  63 +
  64 + public void setStatusCode(int statusCode) {
  65 + this.statusCode = statusCode;
  66 + }
  67 +
  68 +
  69 + public String getStatusString() {
  70 + return statusString;
  71 + }
  72 +
  73 + public void setStatusString(String statusString) {
  74 + this.statusString = statusString;
  75 + }
  76 +
  77 +
  78 + public String getData() {
  79 + return data;
  80 + }
  81 +
  82 + public void setData(String data) {
  83 + this.data = data;
  84 + }
  85 +
  86 + @Override
  87 + public String toString() {
  88 + return "LAPIResponse{" +
  89 + "responseUrl='" + responseUrl + '\'' +
  90 + ", createdId=" + createdId +
  91 + ", statusCode=" + statusCode +
  92 + ", statusString='" + statusString + '\'' +
  93 + ", data='" + data + '\'' +
  94 + '}';
  95 + }
  96 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonImageInfo.java 0 → 100644
@@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/13
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +/**
  22 + * description
  23 + *
  24 + * @author dW5565
  25 + */
  26 +public class PersonImageInfo {
  27 + @JSONField(name = "FaceID", ordinal = 1)
  28 + private Long faceID;
  29 + @JSONField(name = "Name", ordinal = 2)
  30 + private String name;
  31 + @JSONField(name = "Size", ordinal = 3)
  32 + private Integer size;
  33 + @JSONField(name = "Data", ordinal = 4)
  34 + private String data;
  35 +
  36 + public Long getFaceID() {
  37 + return faceID;
  38 + }
  39 +
  40 + public void setFaceID(Long faceID) {
  41 + this.faceID = faceID;
  42 + }
  43 +
  44 + public String getName() {
  45 + return name;
  46 + }
  47 +
  48 + public void setName(String name) {
  49 + this.name = name;
  50 + }
  51 +
  52 + public Integer getSize() {
  53 + return size;
  54 + }
  55 +
  56 + public void setSize(Integer size) {
  57 + this.size = size;
  58 + }
  59 +
  60 + public String getData() {
  61 + return data;
  62 + }
  63 +
  64 + public void setData(String data) {
  65 + this.data = data;
  66 + }
  67 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonInfo.java 0 → 100644
@@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/13
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +import java.util.List;
  22 +
  23 +/**
  24 + * description
  25 + *
  26 + * @author dW5565
  27 + */
  28 +public class PersonInfo {
  29 +
  30 + @JSONField(name = "PersonID", ordinal = 1)
  31 + private Long personID;
  32 + @JSONField(name = "LastChange", ordinal = 2)
  33 + private Long lastChange;
  34 + @JSONField(name = "PersonName", ordinal = 3)
  35 + private String personName;
  36 + @JSONField(name = "Gender", ordinal = 4)
  37 + private Integer gender;
  38 + @JSONField(name = "TimeTemplate", ordinal = 5)
  39 + private PersonTimeTemplateInfo timeTemplate;
  40 + @JSONField(name = "IdentificationNum", ordinal = 6)
  41 + private Integer identificationNum;
  42 + @JSONField(name = "IdentificationList", ordinal = 7)
  43 + private List<IdentificationInfo> identificationList;
  44 + @JSONField(name = "ImageNum", ordinal = 8)
  45 + private Integer imageNum;
  46 + @JSONField(name = "ImageList", ordinal = 9)
  47 + private List<PersonImageInfo> imageList;
  48 +
  49 + public Long getPersonID() {
  50 + return personID;
  51 + }
  52 +
  53 + public void setPersonID(Long personID) {
  54 + this.personID = personID;
  55 + }
  56 +
  57 + public Long getLastChange() {
  58 + return lastChange;
  59 + }
  60 +
  61 + public void setLastChange(Long lastChange) {
  62 + this.lastChange = lastChange;
  63 + }
  64 +
  65 + public String getPersonName() {
  66 + return personName;
  67 + }
  68 +
  69 + public void setPersonName(String personName) {
  70 + this.personName = personName;
  71 + }
  72 +
  73 + public Integer getGender() {
  74 + return gender;
  75 + }
  76 +
  77 + public void setGender(Integer gender) {
  78 + this.gender = gender;
  79 + }
  80 +
  81 + public PersonTimeTemplateInfo getTimeTemplate() {
  82 + return timeTemplate;
  83 + }
  84 +
  85 + public void setTimeTemplate(PersonTimeTemplateInfo timeTemplate) {
  86 + this.timeTemplate = timeTemplate;
  87 + }
  88 +
  89 + public Integer getIdentificationNum() {
  90 + return identificationNum;
  91 + }
  92 +
  93 + public void setIdentificationNum(Integer identificationNum) {
  94 + this.identificationNum = identificationNum;
  95 + }
  96 +
  97 + public List<IdentificationInfo> getIdentificationList() {
  98 + return identificationList;
  99 + }
  100 +
  101 + public void setIdentificationList(List<IdentificationInfo> identificationList) {
  102 + this.identificationList = identificationList;
  103 + }
  104 +
  105 + public Integer getImageNum() {
  106 + return imageNum;
  107 + }
  108 +
  109 + public void setImageNum(Integer imageNum) {
  110 + this.imageNum = imageNum;
  111 + }
  112 +
  113 + public List<PersonImageInfo> getImageList() {
  114 + return imageList;
  115 + }
  116 +
  117 + public void setImageList(List<PersonImageInfo> imageList) {
  118 + this.imageList = imageList;
  119 + }
  120 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonInfoList.java 0 → 100644
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/13
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +import java.util.List;
  22 +
  23 +/**
  24 + * description
  25 + *
  26 + * @author dW5565
  27 + */
  28 +public class PersonInfoList {
  29 +
  30 + @JSONField(name = "Num", ordinal = 1)
  31 + private Integer num;
  32 + @JSONField(name = "PersonInfoList", ordinal = 2)
  33 + private List<PersonInfo> personInfoList;
  34 +
  35 + public Integer getNum() {
  36 + return num;
  37 + }
  38 +
  39 + public void setNum(Integer num) {
  40 + this.num = num;
  41 + }
  42 +
  43 + public List<PersonInfo> getPersonInfoList() {
  44 + return personInfoList;
  45 + }
  46 +
  47 + public void setPersonInfoList(List<PersonInfo> personInfoList) {
  48 + this.personInfoList = personInfoList;
  49 + }
  50 +}
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonTimeTemplateInfo.java 0 → 100644
@@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/13
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +/**
  22 + * description
  23 + *
  24 + * @author dW5565
  25 + */
  26 +public class PersonTimeTemplateInfo {
  27 +
  28 +
  29 + @JSONField(name = "BeginTime", ordinal = 1)
  30 + private Long beginTime;
  31 +
  32 + @JSONField(name = "EndTime", ordinal = 2)
  33 + private Long endTime;
  34 +
  35 + @JSONField(name = "Index", ordinal = 3)
  36 + private Integer index;
  37 +
  38 + public Long getBeginTime() {
  39 + return beginTime;
  40 + }
  41 +
  42 + public void setBeginTime(Long beginTime) {
  43 + this.beginTime = beginTime;
  44 + }
  45 +
  46 + public Long getEndTime() {
  47 + return endTime;
  48 + }
  49 +
  50 + public void setEndTime(Long endTime) {
  51 + this.endTime = endTime;
  52 + }
  53 +
  54 + public Integer getIndex() {
  55 + return index;
  56 + }
  57 +
  58 + public void setIndex(Integer index) {
  59 + this.index = index;
  60 + }
  61 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/ServerRun.java 0 → 100644
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/7
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.server;
  18 +
  19 +import com.sincere.lapi.server.thread.ServerThread;
  20 +
  21 +/**
  22 + * description
  23 + *
  24 + * @author dW5565
  25 + */
  26 +public class ServerRun {
  27 + public void start(int port){
  28 + try {
  29 + Thread runthread = new Thread(new ServerThread(port),"LapiServer");
  30 + runthread.start();
  31 + } catch (Exception e) {
  32 + System.out.println("Fail to create loop for:" + e);
  33 + }
  34 + }
  35 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/UrlParam.java 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +package com.sincere.lapi.server;
  2 +
  3 +public class UrlParam {
  4 +
  5 + //远程开门
  6 + public static String remote_open = "/LAPI/V1.0/PACS/Controller/RemoteOpened" ;
  7 + //默认员工库 添加员工 默认员工库id=3
  8 + public static String person_add = "/LAPI/V1.0/PeopleLibraries/3/People" ;
  9 + //设备在线
  10 + public static String keep_alive = "/LAPI/V1.0/System/KeepAlive" ;
  11 +
  12 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/handler/HttpClientHandler.java 0 → 100644
@@ -0,0 +1,107 @@ @@ -0,0 +1,107 @@
  1 +package com.sincere.lapi.server.handler;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.sincere.common.util.DateUtils;
  5 +import com.sincere.lapi.Utils.SpringContextHolder;
  6 +import com.sincere.lapi.pojo.HeartInfo;
  7 +import com.sincere.lapi.pojo.LAPI;
  8 +import com.sincere.lapi.pojo.LAPIResponse;
  9 +import com.sincere.lapi.server.UrlParam;
  10 +import com.sincere.lapi.server.pojo.HeartBack;
  11 +import com.sincere.lapi.service.request.AttendanceService;
  12 +import com.sincere.lapi.service.request.TerminalHttpCall;
  13 +import io.netty.buffer.ByteBuf;
  14 +import io.netty.channel.Channel;
  15 +import io.netty.channel.ChannelHandlerContext;
  16 +import io.netty.channel.ChannelInboundHandlerAdapter;
  17 +import io.netty.handler.codec.http.*;
  18 +import io.netty.util.CharsetUtil;
  19 +import org.apache.commons.lang3.StringUtils;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +
  23 +import java.text.SimpleDateFormat;
  24 +import java.util.Date;
  25 +
  26 +import static io.netty.buffer.Unpooled.copiedBuffer;
  27 +
  28 +/**
  29 + * description
  30 + *
  31 + * @author dW5565
  32 + */
  33 +public class HttpClientHandler extends ChannelInboundHandlerAdapter {
  34 +
  35 + Logger logger = LoggerFactory.getLogger(HttpClientHandler.class);
  36 +
  37 + @Override
  38 + public void channelRead(ChannelHandlerContext ctx, Object msg)
  39 + throws Exception {
  40 + TerminalHttpCall call = SpringContextHolder.getTerminalHttpCall();
  41 + AttendanceService attendanceService = SpringContextHolder.getAttendanceService();
  42 + String content = (String) msg;
  43 + logger.info(content);
  44 + if (content.contains("/LAPI/V1.0/PACS/Controller/HeartReportInfo")) {
  45 + HeartInfo heartInfo = JSONObject.parseObject(getJson(content),HeartInfo.class);
  46 + call.addChannel(heartInfo.getDeviceCode(),ctx);
  47 + attendanceService.addAttendance(heartInfo.getDeviceCode());
  48 + }
  49 + // 记录推送
  50 + if (content.contains("/LAPI/V1.0/System/Event/Notification/PersonVerification")) {
  51 + String faceInfo = content.substring(content.indexOf("FaceInfoList"));
  52 + String timeInfo = faceInfo.substring(faceInfo.indexOf("Timestamp"));
  53 + String time = timeInfo.substring(11,timeInfo.indexOf(",")).trim();
  54 + String deviceString = content.substring(content.indexOf("DeviceCode"));
  55 + String deviceCode = deviceString.substring(15,deviceString.indexOf(","));
  56 + deviceCode = deviceCode.substring(0,deviceCode.length()-1);
  57 + call.setDeviceTime(deviceCode,time);
  58 + }else if (StringUtils.contains(content, "Response")) {
  59 + LAPIResponse lapiResponse = JSONObject.parseObject(content, LAPI.class).getResponse();
  60 + if(lapiResponse.getResponseUrl().equals(UrlParam.person_add)){
  61 + //人脸添加
  62 + call.putResponse(call.getDeviceCodeByChannel(ctx),lapiResponse);
  63 + }
  64 + }else if(content.contains("MatchPersonID")){
  65 + String personIdString = content.substring(content.indexOf("MatchPersonID"));
  66 + String personId = personIdString.substring(15,personIdString.indexOf(",")).trim();
  67 + String deviceCode = call.getDeviceCodeByChannel(ctx);
  68 + String time = call.getDeviceTime(deviceCode);
  69 + attendanceService.insertRecode(personId,deviceCode,time);
  70 + }
  71 + ctx.flush();
  72 + }
  73 +
  74 + public String getJson(String context){
  75 + String msg = context.substring(context.indexOf("{"),context.indexOf("}")+1);
  76 + return msg ;
  77 + }
  78 +
  79 + //心跳回包
  80 + @Override
  81 + public void channelActive(ChannelHandlerContext ctx) throws Exception {
  82 + super.channelActive(ctx);
  83 + HeartBack heartBack =new HeartBack();
  84 + heartBack.setCode(0);
  85 + heartBack.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
  86 + ByteBuf myContent = copiedBuffer(heartBack.toString(), CharsetUtil.UTF_8);
  87 + FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, myContent);
  88 +
  89 + response.headers().set(HttpHeaderNames.CONTENT_LENGTH, heartBack.toString().length());
  90 + response.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN);
  91 + //开启长连接
  92 + response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
  93 + response.headers().set("X-Frame-Options", "SAMEORIGIN");
  94 +
  95 + //ChannelFuture future = ctx.writeAndFlush(response);
  96 + // System.out.println(future.isSuccess());
  97 + }
  98 +
  99 + @Override
  100 + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  101 + //super.exceptionCaught(ctx, cause);
  102 + Channel incoming = ctx.channel();
  103 + System.out.println("SimpleChatClient:" + incoming.remoteAddress()+"异常 : "+ cause);
  104 + //异常出现就关闭连接
  105 + if(incoming.isActive())ctx.close();
  106 + }
  107 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/init/LapiServerInitializer.java 0 → 100644
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/8
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.server.init;
  18 +
  19 +import com.sincere.lapi.server.handler.HttpClientHandler;
  20 +import io.netty.channel.ChannelInitializer;
  21 +import io.netty.channel.ChannelPipeline;
  22 +import io.netty.channel.socket.SocketChannel;
  23 +import io.netty.handler.codec.rtsp.RtspEncoder;
  24 +import io.netty.handler.codec.string.StringDecoder;
  25 +import io.netty.handler.timeout.ReadTimeoutHandler;
  26 +
  27 +
  28 +
  29 +/**
  30 + * description
  31 + *
  32 + * @author dW5565
  33 + */
  34 +public class LapiServerInitializer extends ChannelInitializer<SocketChannel> {
  35 +
  36 + @Override
  37 + protected void initChannel(SocketChannel ch) throws Exception {
  38 + ChannelPipeline pipeline = ch.pipeline();
  39 +
  40 + pipeline.addLast(new StringDecoder());
  41 +// pipeline.addLast(new HttpRequestEncoder());
  42 + //pipeline.addLast(new HttpResponseEncoder());
  43 + //可以进行请求、响应编码
  44 + pipeline.addLast(new RtspEncoder());
  45 + //保活超时时间
  46 + pipeline.addLast(new ReadTimeoutHandler(600));
  47 + //处理
  48 + pipeline.addLast(new HttpClientHandler());
  49 + }
  50 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/init/NettyFactory.java 0 → 100644
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/8
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.server.init;
  18 +
  19 +import io.netty.bootstrap.ServerBootstrap;
  20 +import io.netty.channel.ChannelFuture;
  21 +import io.netty.channel.ChannelOption;
  22 +import io.netty.channel.EventLoopGroup;
  23 +import io.netty.channel.nio.NioEventLoopGroup;
  24 +import io.netty.channel.socket.nio.NioServerSocketChannel;
  25 +
  26 +/**
  27 + * description
  28 + *
  29 + * @author dW5565
  30 + */
  31 +public class NettyFactory {
  32 +
  33 + public void createNetty(int port) {
  34 + //Group:群组,Loop:循环,Event:事件,这几个东西联在一起,相比大家也大概明白它的用途了。
  35 + //Netty内部都是通过线程在处理各种数据,EventLoopGroup就是用来管理调度他们的,注册Channel,管理他们的生命周期。
  36 + //NioEventLoopGroup是一个处理I/O操作的多线程事件循环
  37 + //bossGroup作为boss,接收传入连接
  38 + //因为bossGroup仅接收客户端连接,不做复杂的逻辑处理,为了尽可能减少资源的占用,取值越小越好
  39 + EventLoopGroup bossGroup = new NioEventLoopGroup(1);
  40 + //workerGroup作为worker,处理boss接收的连接的流量和将接收的连接注册进入这个worker
  41 + EventLoopGroup workerGroup = new NioEventLoopGroup();
  42 + try {
  43 + ServerBootstrap b = new ServerBootstrap();
  44 + b.group(bossGroup, workerGroup);
  45 + b.channel(NioServerSocketChannel.class);
  46 + //服务初始化通道处理
  47 + b.childHandler(new LapiServerInitializer());
  48 + //等待处理的队列大小
  49 + b.option(ChannelOption.SO_BACKLOG, 128);
  50 + // b.option(ChannelOption.SO_RCVBUF,1024*1024*10);
  51 + //是否启用心跳保活机制。在双方TCP套接字建立连接后(即都进入ESTABLISHED状态)并且在两个小时左右上层没有任何数据传输的情况下,这套机制才会被激活。
  52 + //childOption是用来给父级ServerChannel之下的Channels设置参数的
  53 + b.childOption(ChannelOption.SO_KEEPALIVE, true);
  54 + // 绑定端口
  55 + ChannelFuture f = b.bind(port).sync();
  56 + //sync()会同步等待连接操作结果,用户线程将在此wait(),直到连接操作完成之后,线程被notify(),用户代码继续执行
  57 + //closeFuture()当Channel关闭时返回一个ChannelFuture,用于链路检测
  58 + f.channel().closeFuture().sync();
  59 + } catch (Exception e) {
  60 + System.out.println(e);
  61 + } finally {
  62 + //资源优雅释放
  63 + bossGroup.shutdownGracefully();
  64 + workerGroup.shutdownGracefully();
  65 + }
  66 + }
  67 +
  68 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/pojo/HeartBack.java 0 → 100644
@@ -0,0 +1,82 @@ @@ -0,0 +1,82 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/9
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.server.pojo;
  18 +
  19 +import com.alibaba.fastjson.annotation.JSONField;
  20 +
  21 +/**
  22 + * 本用例未做心跳回包,请自行回包
  23 + *
  24 + * @author dW5565
  25 + */
  26 +public class HeartBack {
  27 +
  28 + @JSONField(name = "ResponseURL", ordinal = 1)
  29 + private String responseURL;
  30 + @JSONField(name = "Code", ordinal = 1)
  31 + private int code = 0;
  32 + @JSONField(name = "Data", ordinal = 1)
  33 + private String time;
  34 +
  35 + //private class Data{
  36 + // @JSONField(name = "Time", ordinal = 1)
  37 + //private String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
  38 +
  39 + public String getTime() {
  40 + return time;
  41 + }
  42 +
  43 + public void setTime(String time) {
  44 + this.time = time;
  45 + }
  46 + //}
  47 +
  48 + public String getResponseURL() {
  49 + return responseURL;
  50 + }
  51 +
  52 + public void setResponseURL(String responseURL) {
  53 + this.responseURL = responseURL;
  54 + }
  55 +
  56 + public int getCode() {
  57 + return code;
  58 + }
  59 +
  60 + public void setCode(int code) {
  61 + this.code = code;
  62 + }
  63 +
  64 + //public Data getData() {
  65 + //return data;
  66 + //}
  67 +
  68 + //public void setData(Data data) {
  69 + //this.data = data;
  70 + //}
  71 +
  72 + @Override
  73 + public String toString() {
  74 + return "{\n" +
  75 + "\"ResponseURL\": \"/LAPI/V1.0/PACS/Controller/HeartReportInfo\", \n" +
  76 + "\"Code\": 0, \n" +
  77 + "\"Data\": {\n" +
  78 + " \"Time\": \"" + time + "\"\n" +
  79 + "}\n" +
  80 + "}\n";
  81 + }
  82 +}
cloud/lapi/src/main/java/com/sincere/lapi/server/thread/ServerThread.java 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +/*
  2 + * Copyright (c) 2018, ZheJiang Uniview Technologies Co., Ltd. All rights reserved.
  3 + * <http://www.uniview.com/>
  4 + *------------------------------------------------------------------------------
  5 + * Product : 速通门
  6 + * Module Name : com.unv.fastgate.server.service
  7 + * Date Created: 2019/5/7
  8 + * Creator : dW5565 dongchenghao
  9 + * Description :
  10 + *
  11 + *------------------------------------------------------------------------------
  12 + * Modification History
  13 + * DATE NAME DESCRIPTION
  14 + *------------------------------------------------------------------------------
  15 + *------------------------------------------------------------------------------
  16 + */
  17 +package com.sincere.lapi.server.thread;
  18 +
  19 +import com.sincere.lapi.server.init.NettyFactory;
  20 +
  21 +
  22 +/**
  23 + * description
  24 + *
  25 + * @author dW5565
  26 + */
  27 +public class ServerThread implements Runnable {
  28 + private int port;
  29 +
  30 + public ServerThread(int port) {
  31 + this.port = port;
  32 + }
  33 +
  34 + @Override
  35 + public void run() {
  36 + NettyFactory nettyFactory = new NettyFactory();
  37 + nettyFactory.createNetty(port);
  38 + }
  39 +}
cloud/lapi/src/main/java/com/sincere/lapi/service/request/AttendanceService.java 0 → 100644
@@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
  1 +package com.sincere.lapi.service.request;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto;
  4 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  5 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  6 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  7 +import com.sincere.common.util.DateUtils;
  8 +import com.sincere.lapi.feign.ScFeign;
  9 +import com.sincere.lapi.feign.XaFeign;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service("attendanceService")
  14 +public class AttendanceService {
  15 +
  16 + @Autowired
  17 + ScFeign scFeign ;
  18 +
  19 + @Autowired
  20 + XaFeign xaFeign ;
  21 +
  22 + public void addAttendance(String clientId){
  23 + SZ_AttendanceDto dto = new SZ_AttendanceDto();
  24 + dto.setClint_id(clientId);
  25 + dto.setClint_type("25");
  26 + scFeign.addAttendance(dto);
  27 + }
  28 +
  29 +
  30 + public void insertRecode(String customerId , String deviceCode , String time){
  31 + SZ_AttendanceDto attendanceDto = scFeign.selectAttendaceWithId(deviceCode);
  32 + FaceRecoder faceRecoder = new FaceRecoder();
  33 + faceRecoder.setDeviceid(deviceCode);
  34 + faceRecoder.setInorout(attendanceDto.getOutOrIn());
  35 + faceRecoder.setTime(DateUtils.getByLong(time));
  36 + SzVSchoolTeacher teacher = scFeign.selectByTeacherId(Integer.valueOf(customerId));
  37 + if(teacher == null){
  38 + SzVSchoolStudent student = scFeign.selectByStudentId(Integer.valueOf(customerId));
  39 + faceRecoder.setName(student.getName());
  40 + faceRecoder.setImgurl(student.getPhoto());
  41 + faceRecoder.setUserId(customerId);
  42 + faceRecoder.setCardnum(student.getStudentNum());
  43 + }else {
  44 + faceRecoder.setCardnum(teacher.getTeacherNum());
  45 + faceRecoder.setUserId(customerId);
  46 + faceRecoder.setImgurl(teacher.getFace());
  47 + faceRecoder.setName(teacher.getName());
  48 + }
  49 + xaFeign.insertRecode(faceRecoder);
  50 + }
  51 +
  52 +}
cloud/lapi/src/main/java/com/sincere/lapi/service/request/TerminalHttpCall.java 0 → 100644
@@ -0,0 +1,152 @@ @@ -0,0 +1,152 @@
  1 +package com.sincere.lapi.service.request;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.sincere.common.util.DateUtils;
  5 +import com.sincere.lapi.pojo.LAPIResponse;
  6 +import com.sincere.lapi.pojo.PersonInfoList;
  7 +import com.sincere.lapi.server.UrlParam;
  8 +import io.netty.buffer.Unpooled;
  9 +import io.netty.channel.ChannelHandlerContext;
  10 +import io.netty.handler.codec.http.*;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +import java.net.URI;
  14 +import java.util.Map;
  15 +import java.util.concurrent.ConcurrentHashMap;
  16 +
  17 +/**
  18 + * 终端http调用
  19 + *
  20 + * @author dW5565
  21 + */
  22 +@Component("terminalHttpCall")
  23 +public class TerminalHttpCall {
  24 +
  25 +
  26 + //设备号 对应 通道
  27 + private Map<String, ChannelHandlerContext> channelMap = new ConcurrentHashMap<String, ChannelHandlerContext>();
  28 +
  29 + //通道 对应 设备
  30 + private Map<ChannelHandlerContext , String> channelCodeMap = new ConcurrentHashMap<ChannelHandlerContext , String>();
  31 + //key=deviceCode
  32 + private Map<String , LAPIResponse> responseMap = new ConcurrentHashMap<>();
  33 + //设备刷脸时间
  34 + private Map<String,String> device2TimeMap = new ConcurrentHashMap<>();
  35 +
  36 + public void setDeviceTime(String deviceCode , String time){
  37 + //给的是s 转ms
  38 + device2TimeMap.put(deviceCode,time+"000");
  39 + }
  40 +
  41 + public String getDeviceTime(String deviceCode){
  42 + String time = device2TimeMap.get(deviceCode);
  43 + device2TimeMap.remove(deviceCode);
  44 + return time ;
  45 + }
  46 +
  47 +
  48 + public void putResponse(String key , LAPIResponse lapiResponse){
  49 + responseMap.put(key,lapiResponse);
  50 + }
  51 +
  52 + public LAPIResponse getResponse(String key){
  53 + return responseMap.get(key);
  54 + }
  55 +
  56 + public void removeKey(String key){
  57 + responseMap.remove(key);
  58 + }
  59 +
  60 + public void addChannel(String deviceCode , ChannelHandlerContext channelHandlerContext){
  61 + channelMap.put(deviceCode, channelHandlerContext);
  62 + channelCodeMap.put(channelHandlerContext,deviceCode);
  63 + }
  64 +
  65 + public ChannelHandlerContext getChannel(String deviceCode) {
  66 + ChannelHandlerContext channelHandlerContext = channelMap.get(deviceCode);
  67 + if (channelHandlerContext.channel().isActive()) {
  68 + return channelHandlerContext;
  69 + }
  70 + return null;
  71 + }
  72 +
  73 + public String getDeviceCodeByChannel(ChannelHandlerContext channelHandlerContext){
  74 + return channelCodeMap.get(channelHandlerContext);
  75 + }
  76 +
  77 + public boolean addPerson(String deviceCode , PersonInfoList personInfoList){
  78 + return add(deviceCode, UrlParam.person_add,personInfoList);
  79 + }
  80 +
  81 + public boolean keepAlive(String deviceCode){
  82 + return get(deviceCode,UrlParam.keep_alive);
  83 + }
  84 +
  85 +
  86 + private <E> boolean put(String deviceCode , String prefixUrl) {
  87 + try {
  88 + URI url = new URI(prefixUrl);
  89 + //配置HttpRequest的请求数据和一些配置信息
  90 + FullHttpRequest request = new DefaultFullHttpRequest(
  91 + HttpVersion.HTTP_1_1, HttpMethod.PUT, url.toASCIIString());
  92 + request.headers()
  93 + .set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON)
  94 + .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
  95 + ChannelHandlerContext ctx = this.getChannel(deviceCode);
  96 + if(ctx == null){
  97 + return false;
  98 + }
  99 + ctx.writeAndFlush(request);
  100 + }catch (Exception e){
  101 + System.out.println( e);
  102 + return false;
  103 + }
  104 + return true;
  105 + }
  106 +
  107 + private boolean get(String deviceCode , String prefixUrl) {
  108 + try {
  109 + URI url = new URI(prefixUrl);
  110 + //配置HttpRequest的请求数据和一些配置信息
  111 + FullHttpRequest request = new DefaultFullHttpRequest(
  112 + HttpVersion.HTTP_1_1, HttpMethod.GET, url.toASCIIString());
  113 + request.headers()
  114 + .set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON)
  115 + .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
  116 + ChannelHandlerContext ctx = this.getChannel(deviceCode);
  117 + if(ctx == null){
  118 + return false;
  119 + }
  120 + ctx.writeAndFlush(request);
  121 + }catch (Exception e){
  122 + System.out.println( e);
  123 + return false;
  124 + }
  125 + return true;
  126 + }
  127 +
  128 + private <E> boolean add(String deviceCode , String prefixUrl , E e) {
  129 + try {
  130 + URI url = new URI(prefixUrl);
  131 + //配置HttpRequest的请求数据和一些配置信息
  132 + FullHttpRequest request = new DefaultFullHttpRequest(
  133 + HttpVersion.HTTP_1_1, HttpMethod.POST, url.toASCIIString(), Unpooled.wrappedBuffer(JSON.toJSONString(e).getBytes("UTF-8")));
  134 + request.headers()
  135 + .set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON)
  136 + //开启长连接
  137 + .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE)
  138 + //设置传递请求内容的长度
  139 + .set(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes());
  140 + ChannelHandlerContext ctx = this.getChannel(deviceCode);
  141 + if(ctx == null){
  142 + return false;
  143 + }
  144 + ctx.writeAndFlush(request);
  145 + return true;
  146 + }catch (Exception exc){
  147 + System.out.println(exc);
  148 + }
  149 + return false;
  150 + }
  151 +
  152 +}
cloud/lapi/src/main/resources/application.yml 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +server:
  2 + port: 9006
  3 +spring:
  4 + application:
  5 + name: bo_guan_server
  6 +ribbon:
  7 + ReadTimeout: 50000
  8 + ConnectTimeout: 5000
  9 +eureka:
  10 + client:
  11 + serviceUrl:
  12 + defaultZone: http://127.0.0.1:8761/eureka/,http://127.0.0.1:8762/eureka/
  13 + registry-fetch-interval-seconds: 5
  14 + instance-info-replication-interval-seconds: 10
  15 + instance:
  16 + instance-id: ${spring.application.name}
  17 + lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测
  18 + lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除
  19 + hostname: 127.0.0.1
0 \ No newline at end of file 20 \ No newline at end of file
cloud/lapi/src/main/resources/logback.xml 0 → 100644
@@ -0,0 +1,95 @@ @@ -0,0 +1,95 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<configuration debug="true">
  3 +     <!-- 项目名称 -->
  4 +    
  5 + <property name="PROJECT_NAME" value="bo_guan"/>
  6 +
  7 +     <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
  8 + <property name="LOG_HOME" value="C://log"/>
  9 +
  10 +     <!-- 控制台输出 -->
  11 +    
  12 + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
  13 +         <!--<withJansi>true</withJansi>-->
  14 +        
  15 + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  16 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  17 +            
  18 + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %highlight([%-5level] %logger{50} - %msg%n)</pattern>
  19 +            
  20 + <charset>UTF-8</charset>
  21 +        
  22 + </encoder>
  23 +    
  24 + </appender>
  25 +
  26 +     <!-- 按照每天生成日志文件 -->
  27 +    
  28 + <appender name="SYSTEM_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  29 +         <!-- 过滤器,只打印ERROR级别的日志 -->
  30 +        
  31 + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  32 +             <!--日志文件输出的文件名-->
  33 +            
  34 + <FileNamePattern>${LOG_HOME}/${PROJECT_NAME}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
  35 +             <!--日志文件保留天数-->
  36 +            
  37 + <MaxHistory>30</MaxHistory>
  38 +             <!--日志文件最大的大小-->
  39 +            
  40 + <MaxFileSize>100MB</MaxFileSize>
  41 +        
  42 + </rollingPolicy>
  43 +
  44 +        
  45 + <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  46 +             <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
  47 +            
  48 + <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] [%-5level] %logger{50} - %msg%n</pattern>
  49 +            
  50 + <charset>UTF-8</charset>
  51 +        
  52 + </encoder>
  53 +    
  54 + </appender>
  55 +    
  56 + <logger name="system_error" additivity="true">
  57 +        
  58 + <appender-ref ref="SYSTEM_FILE"/>
  59 +    
  60 + </logger>
  61 +
  62 +     <!-- 设置Spring&Hibernate日志输出级别 -->
  63 +    
  64 + <logger name="org.springframework" level="WARN"/>
  65 +    
  66 + <logger name="org.mybatis" level="WARN"/>
  67 +    
  68 + <logger name="com.ibatis" level="DEBUG"/>
  69 +    
  70 + <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG"/>
  71 +    
  72 + <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG"/>
  73 +    
  74 + <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG"/>
  75 +
  76 +
  77 +    
  78 + <logger name="java.sql.Connection" level="DEBUG"/>
  79 +    
  80 + <logger name="java.sql.Statement" level="DEBUG"/>
  81 +    
  82 + <logger name="java.sql.PreparedStatement" level="DEBUG"/>
  83 +    
  84 + <logger name="com.sincere.smartSearch.mapper" level="DEBUG"/>
  85 +     <!-- 开发环境下的日志配置 -->
  86 +    
  87 + <root level="INFO">
  88 +        
  89 + <appender-ref ref="CONSOLE"/>
  90 +        
  91 + <appender-ref ref="SYSTEM_FILE"/>
  92 +    
  93 + </root>
  94 +
  95 +</configuration>
cloud/quartz/src/main/java/com/sincere/quartz/Test.java
@@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
1 -package com.sincere.quartz;  
2 -  
3 -import com.alibaba.fastjson.JSONObject;  
4 -import com.netflix.ribbon.proxy.annotation.Http;  
5 -import com.sincere.common.util.HttpClientUtils;  
6 -  
7 -public class Test {  
8 -  
9 - public static void main(String[] args){  
10 - for(int i = 1 ; i < 5000 ; i++){  
11 -  
12 - String infoUrl = "https://static-data.eol.cn/www/2.0/school/"+i+"/info.json" ;  
13 - String gradePointUrl = "https://api.eol.cn/gkcx/api/?access_token=&local_province_id=33&local_type_id=3&page=1&school_id="+i+"&signsafe=&size=10&uri=apidata/api/gk/score/province&year=" ;  
14 - String prefessionUrl = "https://static-data.eol.cn/www/2.0/school/"+i+"/pc_special.json" ;  
15 -  
16 - JSONObject infoResult = HttpClientUtils.httpGet(infoUrl) ;  
17 - JSONObject gradePointResult = HttpClientUtils.httpGet(gradePointUrl);  
18 - JSONObject prefessionResult = HttpClientUtils.httpGet(prefessionUrl);  
19 -  
20 - System.out.println(1);  
21 - }  
22 - }  
23 -}  
cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java
@@ -20,7 +20,7 @@ public class SyncJob { @@ -20,7 +20,7 @@ public class SyncJob {
20 @Autowired 20 @Autowired
21 YXYReadService yxyReadService ; 21 YXYReadService yxyReadService ;
22 22
23 - @Scheduled(cron = "0 0 23 * * ? ") 23 + @Scheduled(cron = "0 0 22 * * ?")
24 public void Sync(){ 24 public void Sync(){
25 //翼校通的同步 之后还有钉钉的同步等等 25 //翼校通的同步 之后还有钉钉的同步等等
26 yxyWriteService.sync(); 26 yxyWriteService.sync();
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYReadService.java
@@ -9,6 +9,7 @@ import com.sincere.quartz.model.YxyAgency; @@ -9,6 +9,7 @@ import com.sincere.quartz.model.YxyAgency;
9 import com.sincere.quartz.model.YxyStudent; 9 import com.sincere.quartz.model.YxyStudent;
10 import com.sincere.quartz.model.YxyTeacher; 10 import com.sincere.quartz.model.YxyTeacher;
11 import com.sincere.quartz.service.YxyService; 11 import com.sincere.quartz.service.YxyService;
  12 +import com.sincere.quartz.utils.ThreadUtils;
12 import org.apache.commons.lang3.StringUtils; 13 import org.apache.commons.lang3.StringUtils;
13 import org.slf4j.Logger; 14 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
@@ -20,6 +21,8 @@ import java.security.MessageDigest; @@ -20,6 +21,8 @@ import java.security.MessageDigest;
20 import java.util.ArrayList; 21 import java.util.ArrayList;
21 import java.util.Date; 22 import java.util.Date;
22 import java.util.List; 23 import java.util.List;
  24 +import java.util.concurrent.ExecutorService;
  25 +import java.util.concurrent.TimeUnit;
23 26
24 @Service 27 @Service
25 public class YXYReadService { 28 public class YXYReadService {
@@ -46,6 +49,10 @@ public class YXYReadService { @@ -46,6 +49,10 @@ public class YXYReadService {
46 private Logger logger = LoggerFactory.getLogger(YXYReadService.class); 49 private Logger logger = LoggerFactory.getLogger(YXYReadService.class);
47 50
48 public void sync(){ 51 public void sync(){
  52 + ExecutorService pool = ThreadUtils.newFixedThreadPool(8);
  53 + yxyService.updateAgency();
  54 + yxyService.updateStudent();
  55 + yxyService.updateTeacher();
49 List<String> areaCodeList = new ArrayList<>(); 56 List<String> areaCodeList = new ArrayList<>();
50 areaCodeList.add("0571") ; 57 areaCodeList.add("0571") ;
51 areaCodeList.add("0572") ; 58 areaCodeList.add("0572") ;
@@ -56,11 +63,7 @@ public class YXYReadService { @@ -56,11 +63,7 @@ public class YXYReadService {
56 areaCodeList.add("0577") ; 63 areaCodeList.add("0577") ;
57 areaCodeList.add("0578") ; 64 areaCodeList.add("0578") ;
58 areaCodeList.add("0579") ; 65 areaCodeList.add("0579") ;
59 - areaCodeList.add("0580") ;  
60 -  
61 - yxyService.updateAgency();  
62 - yxyService.updateStudent();  
63 - yxyService.updateTeacher(); 66 + List<String> schoolList = new ArrayList<>();
64 for(String areaCode : areaCodeList){ 67 for(String areaCode : areaCodeList){
65 try{ 68 try{
66 // 先获取学校,部门,年级 班级 69 // 先获取学校,部门,年级 班级
@@ -74,34 +77,48 @@ public class YXYReadService { @@ -74,34 +77,48 @@ public class YXYReadService {
74 String method = getALlDept_method; 77 String method = getALlDept_method;
75 JSONArray jsonArray = getMessage(wsdl, ns, method, list); 78 JSONArray jsonArray = getMessage(wsdl, ns, method, list);
76 if(jsonArray != null){ 79 if(jsonArray != null){
77 - List<String> schoolList = new ArrayList<>(); 80 + logger.info("市编码:" + areaCode);
78 for(int i = 0 ; i < jsonArray.size() ; i++){ 81 for(int i = 0 ; i < jsonArray.size() ; i++){
79 - logger.info("市编码:" + areaCode);  
80 JSONObject object = (JSONObject) jsonArray.get(i) ; 82 JSONObject object = (JSONObject) jsonArray.get(i) ;
81 YxyAgency agency = new YxyAgency() ; 83 YxyAgency agency = new YxyAgency() ;
82 agency.setDeptId(object.get("deptID").toString()); 84 agency.setDeptId(object.get("deptID").toString());
83 agency.setDeptName(object.get("deptName").toString()); 85 agency.setDeptName(object.get("deptName").toString());
84 agency.setSuperDeptId(object.get("superDeptID").toString()); 86 agency.setSuperDeptId(object.get("superDeptID").toString());
85 if(areaCode.equals(object.get("superDeptID").toString())){ 87 if(areaCode.equals(object.get("superDeptID").toString())){
86 - logger.info("学校:" + object.get("deptName").toString()); 88 + logger.info("学校:" + object.get("deptName").toString() +";编码"+object.get("deptID").toString());
87 schoolList.add(object.get("deptID").toString()) ; 89 schoolList.add(object.get("deptID").toString()) ;
88 } 90 }
89 yxyService.insertAgency(agency); 91 yxyService.insertAgency(agency);
90 } 92 }
91 - for(String schoolId : schoolList){  
92 - syncTeacher(schoolId) ;  
93 - syncStudent(schoolId) ;  
94 - }  
95 } 93 }
96 }catch (Exception e){ 94 }catch (Exception e){
97 e.printStackTrace(); 95 e.printStackTrace();
98 } 96 }
99 - 97 + }
  98 + for(String schoolId : schoolList){
  99 + pool.execute(initSchool(schoolId));
  100 + }
  101 + try {
  102 + boolean loop = true;
  103 + do { //等待所有任务完成
  104 + loop = !pool.awaitTermination(2, TimeUnit.SECONDS); //阻塞,直到线程池里所有任务结束
  105 + } while(loop);
  106 + } catch (InterruptedException e) {
  107 + e.printStackTrace();
100 } 108 }
101 } 109 }
102 110
103 111
104 - private void syncStudent(String schoolId){ 112 + private Runnable initSchool(String schoolId){
  113 + Runnable runnable = () -> {
  114 + syncStudent(schoolId);
  115 + syncTeacher(schoolId);
  116 + };
  117 + return runnable ;
  118 + }
  119 +
  120 +
  121 + public void syncStudent(String schoolId){
105 List list = new ArrayList(); 122 List list = new ArrayList();
106 list.add(SI); 123 list.add(SI);
107 list.add(getPassword(SI_CODE)); 124 list.add(getPassword(SI_CODE));
@@ -110,21 +127,30 @@ public class YXYReadService { @@ -110,21 +127,30 @@ public class YXYReadService {
110 String ns = nameSpace; 127 String ns = nameSpace;
111 String method = getALlStudent_method; 128 String method = getALlStudent_method;
112 JSONArray jsonArray = getMessage(wsdl, ns, method, list); 129 JSONArray jsonArray = getMessage(wsdl, ns, method, list);
113 - logger.info("学校ID为:"+schoolId + "共有学生" + jsonArray.size() +"人");  
114 - if(jsonArray != null){  
115 - for(int i = 0 ; i < jsonArray.size() ; i++){  
116 - JSONObject object = (JSONObject) jsonArray.get(i) ;  
117 - YxyStudent student = new YxyStudent();  
118 - student.setClassId(object.get("classID").toString());  
119 - student.setAccount(object.get("account").toString());  
120 - student.setName(object.get("name").toString());  
121 - student.setUserId(object.get("userID").toString());  
122 - yxyService.insertStudent(student); 130 + try{
  131 + logger.info("学校ID为:"+schoolId + "共有学生" + jsonArray.size() +"人");
  132 + if(jsonArray != null){
  133 + for(int i = 0 ; i < jsonArray.size() ; i++){
  134 + JSONObject object = (JSONObject) jsonArray.get(i) ;
  135 + YxyStudent student = new YxyStudent();
  136 + try{
  137 + student.setClassId(object.get("classID").toString());
  138 + student.setAccount(object.get("account").toString());
  139 + student.setName(object.get("name").toString());
  140 + student.setUserId(object.get("userID").toString());
  141 + }catch (Exception e){
  142 + }
  143 + yxyService.insertStudent(student);
  144 + }
123 } 145 }
  146 + }catch (Exception e){
  147 + logger.info(e.toString());
  148 + logger.info("学校ID为:"+schoolId + "学生数据没返回");
124 } 149 }
  150 +
125 } 151 }
126 152
127 - private void syncTeacher(String schoolId){ 153 + public void syncTeacher(String schoolId){
128 List list = new ArrayList(); 154 List list = new ArrayList();
129 list.add(SI); 155 list.add(SI);
130 list.add(getPassword(SI_CODE)); 156 list.add(getPassword(SI_CODE));
@@ -133,32 +159,45 @@ public class YXYReadService { @@ -133,32 +159,45 @@ public class YXYReadService {
133 String ns = nameSpace; 159 String ns = nameSpace;
134 String method = getAllTeacher_method; 160 String method = getAllTeacher_method;
135 JSONArray jsonArray = getMessage(wsdl, ns, method, list); 161 JSONArray jsonArray = getMessage(wsdl, ns, method, list);
136 - logger.info("学校ID为:"+schoolId + "共有老师" + jsonArray.size() +"人");  
137 - if(jsonArray != null){  
138 - for(int i = 0 ; i < jsonArray.size() ; i++){  
139 - JSONObject object = (JSONObject) jsonArray.get(i) ;  
140 - YxyTeacher teacher = new YxyTeacher();  
141 - teacher.setDeptId(object.get("classID").toString());  
142 - teacher.setAccount(object.get("account").toString());  
143 - teacher.setName(object.get("name").toString());  
144 - teacher.setUserId(object.get("userID").toString());  
145 - yxyService.insertTeacher(teacher); 162 + try{
  163 + logger.info("学校ID为:"+schoolId + "共有老师" + jsonArray.size() +"人");
  164 + if(jsonArray != null){
  165 + for(int i = 0 ; i < jsonArray.size() ; i++){
  166 + JSONObject object = (JSONObject) jsonArray.get(i) ;
  167 + YxyTeacher teacher = new YxyTeacher();
  168 + try {
  169 + teacher.setDeptId(object.get("classID").toString());
  170 + teacher.setAccount(object.get("account").toString());
  171 + teacher.setName(object.get("name").toString());
  172 + teacher.setUserId(object.get("userID").toString());
  173 + }catch (Exception e){
  174 + }
  175 + yxyService.insertTeacher(teacher);
  176 + }
146 } 177 }
  178 + }catch (Exception e){
  179 + logger.info(e.toString());
  180 + logger.info("学校ID为:"+schoolId + "老师数据没返回");
147 } 181 }
  182 +
148 } 183 }
149 184
150 private JSONArray getMessage(String wsdl, String ns, String method, List<String> list){ 185 private JSONArray getMessage(String wsdl, String ns, String method, List<String> list){
151 String resultXml = HttpClientUtils.invoiceWebService(wsdl,ns,method,list); 186 String resultXml = HttpClientUtils.invoiceWebService(wsdl,ns,method,list);
152 - if(StringUtils.isNotBlank(resultXml)){  
153 - resultXml = resultXml.replaceAll("&lt;", "<");  
154 - resultXml = resultXml.replaceAll("&gt;", ">");  
155 - int begin = resultXml.indexOf("<JXT");  
156 - int end = resultXml.indexOf("</JXT");  
157 - String str = resultXml.substring(begin, end+6);  
158 - JSONObject json = Xml2JsonUtils.xml2Json(str);  
159 - if(json != null){  
160 - return (JSONArray)json.get("resultInfo") ; 187 + try {
  188 + if (StringUtils.isNotBlank(resultXml)) {
  189 + resultXml = resultXml.replaceAll("&lt;", "<");
  190 + resultXml = resultXml.replaceAll("&gt;", ">");
  191 + int begin = resultXml.indexOf("<JXT");
  192 + int end = resultXml.indexOf("</JXT");
  193 + String str = resultXml.substring(begin, end + 6);
  194 + JSONObject json = Xml2JsonUtils.xml2Json(str);
  195 + if (json != null) {
  196 + return (JSONArray) json.get("resultInfo");
  197 + }
161 } 198 }
  199 + }catch (Exception e){
  200 + logger.info("获取信息报错"+e.getMessage());
162 } 201 }
163 return null ; 202 return null ;
164 } 203 }
cloud/quartz/src/main/java/com/sincere/quartz/utils/ThreadUtils.java 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +package com.sincere.quartz.utils;
  2 +
  3 +import com.google.common.util.concurrent.ThreadFactoryBuilder;
  4 +
  5 +import java.util.concurrent.ExecutorService;
  6 +import java.util.concurrent.LinkedBlockingQueue;
  7 +import java.util.concurrent.ThreadPoolExecutor;
  8 +import java.util.concurrent.TimeUnit;
  9 +
  10 +public class ThreadUtils {
  11 + public static ExecutorService newFixedThreadPool(int nThreads) {
  12 + ThreadPoolExecutor pool = new ThreadPoolExecutor(nThreads, 2*nThreads,
  13 + 0L, TimeUnit.MILLISECONDS,
  14 + new LinkedBlockingQueue<>(1024),
  15 + new ThreadFactoryBuilder().setNameFormat("pool-%d").build(),
  16 + new ThreadPoolExecutor.AbortPolicy());
  17 + return pool ;
  18 + }
  19 +}
cloud/search_smartCampus/pom.xml
@@ -126,6 +126,15 @@ @@ -126,6 +126,15 @@
126 <finalName>search_smartCampus</finalName> 126 <finalName>search_smartCampus</finalName>
127 <!--打包方式--> 127 <!--打包方式-->
128 <plugins> 128 <plugins>
  129 + <plugin>
  130 + <groupId>org.mybatis.generator</groupId>
  131 + <artifactId>mybatis-generator-maven-plugin</artifactId>
  132 + <version>1.3.5</version>
  133 + <configuration>
  134 + <verbose>true</verbose>
  135 + <overwrite>true</overwrite>
  136 + </configuration>
  137 + </plugin>
129 <!-- 设置编译版本 --> 138 <!-- 设置编译版本 -->
130 <plugin> 139 <plugin>
131 <groupId>org.apache.maven.plugins</groupId> 140 <groupId>org.apache.maven.plugins</groupId>
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/AttendanceController.java
@@ -6,7 +6,6 @@ import com.sincere.smartSearch.service.AttendacenService; @@ -6,7 +6,6 @@ import com.sincere.smartSearch.service.AttendacenService;
6 import com.sincere.smartSearch.service.DeviceService; 6 import com.sincere.smartSearch.service.DeviceService;
7 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
8 import io.swagger.annotations.ApiOperation; 8 import io.swagger.annotations.ApiOperation;
9 -import org.apache.ibatis.annotations.Param;  
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
12 11
@@ -24,6 +23,27 @@ public class AttendanceController { @@ -24,6 +23,27 @@ public class AttendanceController {
24 @Autowired 23 @Autowired
25 DeviceService deviceService; 24 DeviceService deviceService;
26 25
  26 + /**
  27 + * 没有就新增,有就更新在线时间
  28 + * @param attendanceDto
  29 + */
  30 + @RequestMapping(value = "addAttendance", method = RequestMethod.POST)
  31 + public void addAttendance(@RequestBody SZ_AttendanceDto attendanceDto){
  32 + SZ_AttendanceDto attendance = attendacenService.selectDevice(attendanceDto.getClint_id());
  33 + if(attendance != null){
  34 + attendacenService.updateAttendance(attendance.getClint_id());
  35 + }else {
  36 + attendanceDto.setState(1);
  37 + attendanceDto.setSchool_id("0");
  38 + try {
  39 + attendanceDto.setIntime(DateUtils.getToday(DateUtils.format2));
  40 + }catch (Exception e){
  41 +
  42 + }
  43 + attendacenService.insertAttendance(attendanceDto);
  44 + }
  45 + }
  46 +
27 @RequestMapping(method = RequestMethod.GET, value = "selectAttendaceWithId") 47 @RequestMapping(method = RequestMethod.GET, value = "selectAttendaceWithId")
28 public SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id) { 48 public SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id) {
29 return attendacenService.selectDevice(clint_id); 49 return attendacenService.selectDevice(clint_id);
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/UserController.java
1 package com.sincere.smartSearch.controller; 1 package com.sincere.smartSearch.controller;
2 2
  3 +import com.sincere.common.dto.smartCampus.StudentBean;
  4 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  5 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
3 import com.sincere.smartSearch.service.UserService; 6 import com.sincere.smartSearch.service.UserService;
4 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
@@ -7,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -7,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
7 import org.springframework.web.bind.annotation.RequestParam; 10 import org.springframework.web.bind.annotation.RequestParam;
8 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
9 12
  13 +import java.util.List;
  14 +
10 /** 15 /**
11 * @author chen 16 * @author chen
12 * @version 1.0 17 * @version 1.0
@@ -27,15 +32,33 @@ public class UserController { @@ -27,15 +32,33 @@ public class UserController {
27 32
28 33
29 @RequestMapping(value = "getStudent_NumWitdCode",method = RequestMethod.GET) 34 @RequestMapping(value = "getStudent_NumWitdCode",method = RequestMethod.GET)
30 - String getStudent_NumWitdCode(@RequestParam("studentcode") String studentcode){ 35 + StudentBean getStudent_NumWitdCode(@RequestParam("studentcode") String studentcode){
31 return userService.getStudent_NumWitdCode(studentcode); 36 return userService.getStudent_NumWitdCode(studentcode);
32 } 37 }
33 38
34 39
35 @RequestMapping(value = "getTeacherWithstudentcode",method = RequestMethod.GET) 40 @RequestMapping(value = "getTeacherWithstudentcode",method = RequestMethod.GET)
36 - String getTeacherWithstudentcode(@RequestParam("num") String num,@RequestParam("schoolId") String schoolId){ 41 + StudentBean getTeacherWithstudentcode(@RequestParam("num") String num,@RequestParam("schoolId") String schoolId){
37 return userService.getTeacherWithstudentcode(num,schoolId); 42 return userService.getTeacherWithstudentcode(num,schoolId);
38 } 43 }
39 44
  45 + @RequestMapping(value = "selectTeacherBySchoolId",method = RequestMethod.GET)
  46 + List<SzVSchoolTeacher> selectTeacherBySchoolId(@RequestParam("schoolId") String schoolId){
  47 + return userService.selectTeacherBySchool(Integer.valueOf(schoolId));
  48 + }
  49 +
  50 + @RequestMapping(value = "selectStudentBySchoolId",method = RequestMethod.GET)
  51 + List<SzVSchoolStudent> selectStudentBySchoolId(@RequestParam("schoolId") String schoolId){
  52 + return userService.selectStudentBySchool(Integer.valueOf(schoolId));
  53 + }
40 54
  55 + @RequestMapping(value = "selectByTeacherId",method = RequestMethod.GET)
  56 + SzVSchoolTeacher selectByTeacherId(@RequestParam("teacherId") int teacherId){
  57 + return userService.selectByTeacherId(teacherId);
  58 + }
  59 +
  60 + @RequestMapping(value = "selectByStudentId",method = RequestMethod.GET)
  61 + SzVSchoolStudent selectByStudentId(@RequestParam("studentId") int studentId){
  62 + return userService.selectByStudentId(studentId);
  63 + }
41 } 64 }
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SzVSchoolStudentMapper.java 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +package com.sincere.smartSearch.mapper;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface SzVSchoolStudentMapper {
  8 +
  9 + List<SzVSchoolStudent> selectBySchool(int schoolId);
  10 +
  11 + SzVSchoolStudent selectByStudentId(int studentId);
  12 +
  13 + int insert(SzVSchoolStudent record);
  14 +
  15 + int insertSelective(SzVSchoolStudent record);
  16 +}
0 \ No newline at end of file 17 \ No newline at end of file
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SzVSchoolTeacherMapper.java 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +package com.sincere.smartSearch.mapper;
  2 +
  3 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface SzVSchoolTeacherMapper {
  8 +
  9 + List<SzVSchoolTeacher> selectBySchool(int schoolId);
  10 +
  11 + SzVSchoolTeacher selectByTeacherId(int teacherId);
  12 +
  13 + int insert(SzVSchoolTeacher record);
  14 +
  15 + int insertSelective(SzVSchoolTeacher record);
  16 +}
0 \ No newline at end of file 17 \ No newline at end of file
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/UserMapper.java
1 package com.sincere.smartSearch.mapper; 1 package com.sincere.smartSearch.mapper;
2 2
  3 +import com.sincere.common.dto.smartCampus.StudentBean;
  4 +import org.apache.ibatis.annotations.Param;
  5 +import org.apache.ibatis.annotations.Select;
  6 +
  7 +import java.util.List;
  8 +
3 /** 9 /**
4 * @author chen 10 * @author chen
5 * @version 1.0 11 * @version 1.0
@@ -12,9 +18,10 @@ public interface UserMapper { @@ -12,9 +18,10 @@ public interface UserMapper {
12 @Select("select Top(1)*\n" + 18 @Select("select Top(1)*\n" +
13 "from SZ_V_School_Teacher\n" + 19 "from SZ_V_School_Teacher\n" +
14 "where num = #{num} and school_id = #{schoolId}") 20 "where num = #{num} and school_id = #{schoolId}")
15 - StudentBean getTeacherWithstudentcode(@Param("num") String num,@Param("schoolId")String schoolId); 21 + StudentBean getTeacherWithstudentcode(@Param("num") String num, @Param("schoolId")String schoolId);
16 22
17 @Select("select Top(1) * from SZ_V_School_Student where studentcode = #{studentcode}") 23 @Select("select Top(1) * from SZ_V_School_Student where studentcode = #{studentcode}")
18 StudentBean getStudent_NumWitdCode(@Param("studentcode") String studentcode); 24 StudentBean getStudent_NumWitdCode(@Param("studentcode") String studentcode);
19 25
  26 +
20 } 27 }
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/model/StudentBean.java
@@ -1,307 +0,0 @@ @@ -1,307 +0,0 @@
1 -package com.sincere.haikangface.bean;  
2 -  
3 -import java.io.Serializable;  
4 -import java.util.Date;  
5 -  
6 -public class StudentBean implements Serializable {  
7 -  
8 - private String teacher_id;  
9 -  
10 - private String parent_id;  
11 -  
12 - private long ID;  
13 -  
14 - private String UserId;  
15 -  
16 - private String CustomerId;  
17 -  
18 - private int StudentType;  
19 -  
20 - private int UserType;  
21 -  
22 - private String name;  
23 -  
24 - private int ClassId;  
25 -  
26 - private String ClassName;  
27 -  
28 - private String OldCard;  
29 -  
30 - private String Card;  
31 -  
32 - private int SchoolId;  
33 -  
34 - private int school_id;  
35 -  
36 - private int IsNew;  
37 -  
38 - private int UpdateType;  
39 -  
40 - private Date AddTime;  
41 -  
42 - private int Sex;  
43 -  
44 - private String Face;  
45 -  
46 - private String studentcode;  
47 -  
48 - private String student_num;  
49 -  
50 - private String student_id;  
51 -  
52 - private String user_id;  
53 -  
54 - private String photo;  
55 -  
56 - private String teacher_num;  
57 -  
58 - private String num;  
59 -  
60 - public String getNum() {  
61 - return num;  
62 - }  
63 -  
64 - public void setNum(String num) {  
65 - this.num = num;  
66 - }  
67 -  
68 - public String getTeacher_num() {  
69 - return teacher_num;  
70 - }  
71 -  
72 - public void setTeacher_num(String teacher_num) {  
73 - this.teacher_num = teacher_num;  
74 - }  
75 -  
76 - public String getPhoto() {  
77 - return photo;  
78 - }  
79 -  
80 - public void setPhoto(String photo) {  
81 - this.photo = photo;  
82 - }  
83 -  
84 - public String getUser_id() {  
85 - return user_id;  
86 - }  
87 -  
88 - public void setUser_id(String user_id) {  
89 - this.user_id = user_id;  
90 - }  
91 -  
92 - public String getStudentcode() {  
93 - return studentcode;  
94 - }  
95 -  
96 - public void setStudentcode(String studentcode) {  
97 - this.studentcode = studentcode;  
98 - }  
99 -  
100 - public String getUserId() {  
101 - return UserId;  
102 - }  
103 -  
104 - public void setUserId(String userId) {  
105 - UserId = userId;  
106 - }  
107 -  
108 - public String getCustomerId() {  
109 - return CustomerId;  
110 - }  
111 -  
112 - public void setCustomerId(String customerId) {  
113 - CustomerId = customerId;  
114 - }  
115 -  
116 - public int getStudentType() {  
117 - return StudentType;  
118 - }  
119 -  
120 - public void setStudentType(int studentType) {  
121 - StudentType = studentType;  
122 - }  
123 -  
124 - public int getUserType() {  
125 - return UserType;  
126 - }  
127 -  
128 - public String getTeacher_id() {  
129 - return teacher_id;  
130 - }  
131 -  
132 - public String getParent_id() {  
133 - return parent_id;  
134 - }  
135 -  
136 - public void setParent_id(String parent_id) {  
137 - this.parent_id = parent_id;  
138 - }  
139 -  
140 - public void setTeacher_id(String teacher_id) {  
141 - this.teacher_id = teacher_id;  
142 - }  
143 -  
144 - public void setUserType(int userType) {  
145 - UserType = userType;  
146 - }  
147 -  
148 - public String getName() {  
149 - return name;  
150 - }  
151 -  
152 - public void setName(String name) {  
153 - this.name = name;  
154 - }  
155 -  
156 - public int getClassId() {  
157 - return ClassId;  
158 - }  
159 -  
160 - public void setClassId(int classId) {  
161 - ClassId = classId;  
162 - }  
163 -  
164 - public String getClassName() {  
165 - return ClassName;  
166 - }  
167 -  
168 - public void setClassName(String className) {  
169 - ClassName = className;  
170 - }  
171 -  
172 - public String getOldCard() {  
173 - return OldCard;  
174 - }  
175 -  
176 - public void setOldCard(String oldCard) {  
177 - OldCard = oldCard;  
178 - }  
179 -  
180 - public String getCard() {  
181 - return Card;  
182 - }  
183 -  
184 - public int getSchool_id() {  
185 - return school_id;  
186 - }  
187 -  
188 - public void setSchool_id(int school_id) {  
189 - this.school_id = school_id;  
190 - }  
191 -  
192 - public String getStudent_num() {  
193 - return student_num;  
194 - }  
195 -  
196 - public void setStudent_num(String student_num) {  
197 - this.student_num = student_num;  
198 - }  
199 -  
200 - public void setCard(String card) {  
201 - Card = card;  
202 - }  
203 -  
204 - public int getSchoolId() {  
205 - return SchoolId;  
206 - }  
207 -  
208 - public void setSchoolId(int schoolId) {  
209 - SchoolId = schoolId;  
210 - }  
211 -  
212 - public int getIsNew() {  
213 - return IsNew;  
214 - }  
215 -  
216 - public void setIsNew(int isNew) {  
217 - IsNew = isNew;  
218 - }  
219 -  
220 - public int getUpdateType() {  
221 - return UpdateType;  
222 - }  
223 -  
224 - public void setUpdateType(int updateType) {  
225 - UpdateType = updateType;  
226 - }  
227 -  
228 - public Date getAddTime() {  
229 - return AddTime;  
230 - }  
231 -  
232 - public void setAddTime(Date addTime) {  
233 - AddTime = addTime;  
234 - }  
235 -  
236 - public int getSex() {  
237 - return Sex;  
238 - }  
239 -  
240 - public void setSex(int sex) {  
241 - Sex = sex;  
242 - }  
243 -  
244 - public String getFace() {  
245 - return Face;  
246 - }  
247 -  
248 - public void setFace(String face) {  
249 - Face = face;  
250 - }  
251 -  
252 - public String getStudentCode() {  
253 - return studentcode;  
254 - }  
255 -  
256 - public void setStudentCode(String studentCode) {  
257 - this.studentcode = studentCode;  
258 - }  
259 -  
260 - public long getID() {  
261 - return ID;  
262 - }  
263 -  
264 - public void setID(long ID) {  
265 - this.ID = ID;  
266 - }  
267 -  
268 - public String getStudent_id() {  
269 - return student_id;  
270 - }  
271 -  
272 - public void setStudent_id(String student_id) {  
273 - this.student_id = student_id;  
274 - }  
275 -  
276 - @Override  
277 - public String toString() {  
278 - return "StudentBean{" +  
279 - "teacher_id='" + teacher_id + '\'' +  
280 - ", parent_id='" + parent_id + '\'' +  
281 - ", ID=" + ID +  
282 - ", UserId='" + UserId + '\'' +  
283 - ", CustomerId='" + CustomerId + '\'' +  
284 - ", StudentType=" + StudentType +  
285 - ", UserType=" + UserType +  
286 - ", name='" + name + '\'' +  
287 - ", ClassId=" + ClassId +  
288 - ", ClassName='" + ClassName + '\'' +  
289 - ", OldCard='" + OldCard + '\'' +  
290 - ", Card='" + Card + '\'' +  
291 - ", SchoolId=" + SchoolId +  
292 - ", school_id=" + school_id +  
293 - ", IsNew=" + IsNew +  
294 - ", UpdateType=" + UpdateType +  
295 - ", AddTime=" + AddTime +  
296 - ", Sex=" + Sex +  
297 - ", Face='" + Face + '\'' +  
298 - ", studentcode='" + studentcode + '\'' +  
299 - ", student_num='" + student_num + '\'' +  
300 - ", student_id='" + student_id + '\'' +  
301 - ", user_id='" + user_id + '\'' +  
302 - ", photo='" + photo + '\'' +  
303 - ", teacher_num='" + teacher_num + '\'' +  
304 - ", num='" + num + '\'' +  
305 - '}';  
306 - }  
307 -}  
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/UserService.java
1 package com.sincere.smartSearch.service; 1 package com.sincere.smartSearch.service;
2 2
  3 +import com.sincere.common.dto.smartCampus.StudentBean;
  4 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  5 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  6 +
  7 +import java.util.List;
  8 +
3 /** 9 /**
4 * @author chen 10 * @author chen
5 * @version 1.0 11 * @version 1.0
@@ -9,8 +15,16 @@ public interface UserService { @@ -9,8 +15,16 @@ public interface UserService {
9 15
10 String selectStudentNumByStudentId(int studentId); 16 String selectStudentNumByStudentId(int studentId);
11 17
12 - StudentBean getTeacherWithstudentcode(String num,String schoolId); 18 + StudentBean getTeacherWithstudentcode(String num, String schoolId);
13 19
14 StudentBean getStudent_NumWitdCode(String studentcode); 20 StudentBean getStudent_NumWitdCode(String studentcode);
15 21
  22 + List<SzVSchoolTeacher> selectTeacherBySchool(int schoolId);
  23 +
  24 + List<SzVSchoolStudent> selectStudentBySchool(int schoolId);
  25 +
  26 + SzVSchoolTeacher selectByTeacherId(int teacherId);
  27 +
  28 + SzVSchoolStudent selectByStudentId(int studentId);
  29 +
16 } 30 }
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/UserServiceImpl.java
1 package com.sincere.smartSearch.service.impl; 1 package com.sincere.smartSearch.service.impl;
2 2
  3 +import com.sincere.common.dto.smartCampus.SzVSchoolStudent;
  4 +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher;
  5 +import com.sincere.smartSearch.mapper.SzVSchoolStudentMapper;
  6 +import com.sincere.smartSearch.mapper.SzVSchoolTeacherMapper;
3 import com.sincere.smartSearch.mapper.UserMapper; 7 import com.sincere.smartSearch.mapper.UserMapper;
  8 +import com.sincere.common.dto.smartCampus.StudentBean;
4 import com.sincere.smartSearch.service.UserService; 9 import com.sincere.smartSearch.service.UserService;
5 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
7 12
  13 +import java.util.List;
  14 +
8 /** 15 /**
9 * @author chen 16 * @author chen
10 * @version 1.0 17 * @version 1.0
@@ -16,6 +23,12 @@ public class UserServiceImpl implements UserService { @@ -16,6 +23,12 @@ public class UserServiceImpl implements UserService {
16 @Autowired 23 @Autowired
17 UserMapper userMapper ; 24 UserMapper userMapper ;
18 25
  26 + @Autowired
  27 + SzVSchoolStudentMapper szVSchoolStudentMapper;
  28 +
  29 + @Autowired
  30 + SzVSchoolTeacherMapper szVSchoolTeacherMapper;
  31 +
19 @Override 32 @Override
20 public String selectStudentNumByStudentId(int studentId) { 33 public String selectStudentNumByStudentId(int studentId) {
21 return userMapper.selectStudentNumByStudentId(studentId); 34 return userMapper.selectStudentNumByStudentId(studentId);
@@ -33,4 +46,23 @@ public class UserServiceImpl implements UserService { @@ -33,4 +46,23 @@ public class UserServiceImpl implements UserService {
33 return userMapper.getTeacherWithstudentcode(num,schoolId); 46 return userMapper.getTeacherWithstudentcode(num,schoolId);
34 } 47 }
35 48
  49 + @Override
  50 + public List<SzVSchoolTeacher> selectTeacherBySchool(int schoolId) {
  51 + return szVSchoolTeacherMapper.selectBySchool(schoolId);
  52 + }
  53 +
  54 + @Override
  55 + public List<SzVSchoolStudent> selectStudentBySchool(int schoolId) {
  56 + return szVSchoolStudentMapper.selectBySchool(schoolId);
  57 + }
  58 +
  59 + @Override
  60 + public SzVSchoolTeacher selectByTeacherId(int teacherId) {
  61 + return szVSchoolTeacherMapper.selectByTeacherId(teacherId);
  62 + }
  63 +
  64 + @Override
  65 + public SzVSchoolStudent selectByStudentId(int studentId) {
  66 + return szVSchoolStudentMapper.selectByStudentId(studentId);
  67 + }
36 } 68 }
cloud/search_smartCampus/src/main/resources/mapper/AttendanceMapper.xml
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <result column="isConnection" property="isConnection"/> 12 <result column="isConnection" property="isConnection"/>
13 <result column="state" property="state"/> 13 <result column="state" property="state"/>
14 <result column="IsKaoqin" property="IsKaoqin"/> 14 <result column="IsKaoqin" property="IsKaoqin"/>
15 - 15 + <result column="OutOrIn" property="outOrIn"/>
16 </resultMap> 16 </resultMap>
17 17
18 <select id="selectDevice" resultMap="BaseResultMap"> 18 <select id="selectDevice" resultMap="BaseResultMap">
cloud/search_smartCampus/src/main/resources/mapper/SzVSchoolStudentMapper.xml 0 → 100644
@@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.smartSearch.mapper.SzVSchoolStudentMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.common.dto.smartCampus.SzVSchoolStudent">
  5 + <result column="school_id" jdbcType="INTEGER" property="schoolId" />
  6 + <result column="class_id" jdbcType="INTEGER" property="classId" />
  7 + <result column="student_id" jdbcType="INTEGER" property="studentId" />
  8 + <result column="user_id" jdbcType="VARCHAR" property="userId" />
  9 + <result column="student_num" jdbcType="VARCHAR" property="studentNum" />
  10 + <result column="name" jdbcType="VARCHAR" property="name" />
  11 + <result column="num" jdbcType="VARCHAR" property="num" />
  12 + <result column="photo" jdbcType="VARCHAR" property="photo" />
  13 + <result column="ismonitor" jdbcType="INTEGER" property="ismonitor" />
  14 + <result column="class_state" jdbcType="INTEGER" property="classState" />
  15 + <result column="role_state" jdbcType="INTEGER" property="roleState" />
  16 + <result column="modifystate" jdbcType="CHAR" property="modifystate" />
  17 + <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  18 + <result column="class_name" jdbcType="VARCHAR" property="className" />
  19 + <result column="student_type" jdbcType="INTEGER" property="studentType" />
  20 + <result column="matrikelnummer" jdbcType="VARCHAR" property="matrikelnummer" />
  21 + <result column="studentcode" jdbcType="VARCHAR" property="studentcode" />
  22 + <result column="sex" jdbcType="VARCHAR" property="sex" />
  23 + <result column="ParentMobile" jdbcType="VARCHAR" property="parentmobile" />
  24 + <result column="othername" jdbcType="VARCHAR" property="othername" />
  25 + <result column="activetime" jdbcType="TIMESTAMP" property="activetime" />
  26 + <result column="active" jdbcType="INTEGER" property="active" />
  27 + <result column="pass" jdbcType="VARCHAR" property="pass" />
  28 + </resultMap>
  29 +
  30 + <select id="selectBySchool" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  31 + select * from SZ_V_School_Student where school_id = #{schoolId}
  32 + </select>
  33 +
  34 + <select id="selectByStudentId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  35 + select top 1 * from SZ_V_School_Student where student_id = #{studentId}
  36 + </select>
  37 +
  38 + <insert id="insert" parameterType="com.sincere.common.dto.smartCampus.SzVSchoolStudent">
  39 + insert into SZ_V_School_Student (school_id, class_id, student_id,
  40 + user_id, student_num, name,
  41 + num, photo, ismonitor,
  42 + class_state, role_state, modifystate,
  43 + mobile, class_name, student_type,
  44 + matrikelnummer, studentcode, sex,
  45 + ParentMobile, othername, activetime,
  46 + active, pass)
  47 + values (#{schoolId,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER}, #{studentId,jdbcType=INTEGER},
  48 + #{userId,jdbcType=VARCHAR}, #{studentNum,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  49 + #{num,jdbcType=VARCHAR}, #{photo,jdbcType=VARCHAR}, #{ismonitor,jdbcType=INTEGER},
  50 + #{classState,jdbcType=INTEGER}, #{roleState,jdbcType=INTEGER}, #{modifystate,jdbcType=CHAR},
  51 + #{mobile,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR}, #{studentType,jdbcType=INTEGER},
  52 + #{matrikelnummer,jdbcType=VARCHAR}, #{studentcode,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR},
  53 + #{parentmobile,jdbcType=VARCHAR}, #{othername,jdbcType=VARCHAR}, #{activetime,jdbcType=TIMESTAMP},
  54 + #{active,jdbcType=INTEGER}, #{pass,jdbcType=VARCHAR})
  55 + </insert>
  56 + <insert id="insertSelective" parameterType="com.sincere.common.dto.smartCampus.SzVSchoolStudent">
  57 + insert into SZ_V_School_Student
  58 + <trim prefix="(" suffix=")" suffixOverrides=",">
  59 + <if test="schoolId != null">
  60 + school_id,
  61 + </if>
  62 + <if test="classId != null">
  63 + class_id,
  64 + </if>
  65 + <if test="studentId != null">
  66 + student_id,
  67 + </if>
  68 + <if test="userId != null">
  69 + user_id,
  70 + </if>
  71 + <if test="studentNum != null">
  72 + student_num,
  73 + </if>
  74 + <if test="name != null">
  75 + name,
  76 + </if>
  77 + <if test="num != null">
  78 + num,
  79 + </if>
  80 + <if test="photo != null">
  81 + photo,
  82 + </if>
  83 + <if test="ismonitor != null">
  84 + ismonitor,
  85 + </if>
  86 + <if test="classState != null">
  87 + class_state,
  88 + </if>
  89 + <if test="roleState != null">
  90 + role_state,
  91 + </if>
  92 + <if test="modifystate != null">
  93 + modifystate,
  94 + </if>
  95 + <if test="mobile != null">
  96 + mobile,
  97 + </if>
  98 + <if test="className != null">
  99 + class_name,
  100 + </if>
  101 + <if test="studentType != null">
  102 + student_type,
  103 + </if>
  104 + <if test="matrikelnummer != null">
  105 + matrikelnummer,
  106 + </if>
  107 + <if test="studentcode != null">
  108 + studentcode,
  109 + </if>
  110 + <if test="sex != null">
  111 + sex,
  112 + </if>
  113 + <if test="parentmobile != null">
  114 + ParentMobile,
  115 + </if>
  116 + <if test="othername != null">
  117 + othername,
  118 + </if>
  119 + <if test="activetime != null">
  120 + activetime,
  121 + </if>
  122 + <if test="active != null">
  123 + active,
  124 + </if>
  125 + <if test="pass != null">
  126 + pass,
  127 + </if>
  128 + </trim>
  129 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  130 + <if test="schoolId != null">
  131 + #{schoolId,jdbcType=INTEGER},
  132 + </if>
  133 + <if test="classId != null">
  134 + #{classId,jdbcType=INTEGER},
  135 + </if>
  136 + <if test="studentId != null">
  137 + #{studentId,jdbcType=INTEGER},
  138 + </if>
  139 + <if test="userId != null">
  140 + #{userId,jdbcType=VARCHAR},
  141 + </if>
  142 + <if test="studentNum != null">
  143 + #{studentNum,jdbcType=VARCHAR},
  144 + </if>
  145 + <if test="name != null">
  146 + #{name,jdbcType=VARCHAR},
  147 + </if>
  148 + <if test="num != null">
  149 + #{num,jdbcType=VARCHAR},
  150 + </if>
  151 + <if test="photo != null">
  152 + #{photo,jdbcType=VARCHAR},
  153 + </if>
  154 + <if test="ismonitor != null">
  155 + #{ismonitor,jdbcType=INTEGER},
  156 + </if>
  157 + <if test="classState != null">
  158 + #{classState,jdbcType=INTEGER},
  159 + </if>
  160 + <if test="roleState != null">
  161 + #{roleState,jdbcType=INTEGER},
  162 + </if>
  163 + <if test="modifystate != null">
  164 + #{modifystate,jdbcType=CHAR},
  165 + </if>
  166 + <if test="mobile != null">
  167 + #{mobile,jdbcType=VARCHAR},
  168 + </if>
  169 + <if test="className != null">
  170 + #{className,jdbcType=VARCHAR},
  171 + </if>
  172 + <if test="studentType != null">
  173 + #{studentType,jdbcType=INTEGER},
  174 + </if>
  175 + <if test="matrikelnummer != null">
  176 + #{matrikelnummer,jdbcType=VARCHAR},
  177 + </if>
  178 + <if test="studentcode != null">
  179 + #{studentcode,jdbcType=VARCHAR},
  180 + </if>
  181 + <if test="sex != null">
  182 + #{sex,jdbcType=VARCHAR},
  183 + </if>
  184 + <if test="parentmobile != null">
  185 + #{parentmobile,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="othername != null">
  188 + #{othername,jdbcType=VARCHAR},
  189 + </if>
  190 + <if test="activetime != null">
  191 + #{activetime,jdbcType=TIMESTAMP},
  192 + </if>
  193 + <if test="active != null">
  194 + #{active,jdbcType=INTEGER},
  195 + </if>
  196 + <if test="pass != null">
  197 + #{pass,jdbcType=VARCHAR},
  198 + </if>
  199 + </trim>
  200 + </insert>
  201 +</mapper>
0 \ No newline at end of file 202 \ No newline at end of file
cloud/search_smartCampus/src/main/resources/mapper/SzVSchoolTeacherMapper.xml 0 → 100644
@@ -0,0 +1,155 @@ @@ -0,0 +1,155 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.smartSearch.mapper.SzVSchoolTeacherMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.common.dto.smartCampus.SzVSchoolTeacher">
  5 + <result column="school_id" jdbcType="INTEGER" property="schoolId" />
  6 + <result column="class_id" jdbcType="INTEGER" property="classId" />
  7 + <result column="teacher_id" jdbcType="INTEGER" property="teacherId" />
  8 + <result column="user_id" jdbcType="VARCHAR" property="userId" />
  9 + <result column="name" jdbcType="VARCHAR" property="name" />
  10 + <result column="face" jdbcType="VARCHAR" property="face" />
  11 + <result column="num" jdbcType="VARCHAR" property="num" />
  12 + <result column="teacher_num" jdbcType="VARCHAR" property="teacherNum" />
  13 + <result column="teacher_mobile" jdbcType="VARCHAR" property="teacherMobile" />
  14 + <result column="mobile" jdbcType="VARCHAR" property="mobile" />
  15 + <result column="class_state" jdbcType="INTEGER" property="classState" />
  16 + <result column="role_state" jdbcType="INTEGER" property="roleState" />
  17 + <result column="IsKaoQin" jdbcType="INTEGER" property="iskaoqin" />
  18 + <result column="OpenId" jdbcType="VARCHAR" property="openid" />
  19 + <result column="pass" jdbcType="VARCHAR" property="pass" />
  20 + <result column="DingUserId" jdbcType="VARCHAR" property="dinguserid" />
  21 + <result column="QiYeHaoUserId" jdbcType="VARCHAR" property="qiyehaouserid" />
  22 + </resultMap>
  23 +
  24 + <select id="selectBySchool" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  25 + select * from SZ_V_School_Teacher where school_id = #{schoolId}
  26 + </select>
  27 +
  28 + <select id="selectByTeacherId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  29 + select top 1 * from SZ_V_School_Teacher where teacher_id = #{teacherId}
  30 + </select>
  31 +
  32 + <insert id="insert" parameterType="com.sincere.common.dto.smartCampus.SzVSchoolTeacher">
  33 + insert into SZ_V_School_Teacher (school_id, class_id, teacher_id,
  34 + user_id, name, face,
  35 + num, teacher_num, teacher_mobile,
  36 + mobile, class_state, role_state,
  37 + IsKaoQin, OpenId, pass,
  38 + DingUserId, QiYeHaoUserId)
  39 + values (#{schoolId,jdbcType=INTEGER}, #{classId,jdbcType=INTEGER}, #{teacherId,jdbcType=INTEGER},
  40 + #{userId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{face,jdbcType=VARCHAR},
  41 + #{num,jdbcType=VARCHAR}, #{teacherNum,jdbcType=VARCHAR}, #{teacherMobile,jdbcType=VARCHAR},
  42 + #{mobile,jdbcType=VARCHAR}, #{classState,jdbcType=INTEGER}, #{roleState,jdbcType=INTEGER},
  43 + #{iskaoqin,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{pass,jdbcType=VARCHAR},
  44 + #{dinguserid,jdbcType=VARCHAR}, #{qiyehaouserid,jdbcType=VARCHAR})
  45 + </insert>
  46 + <insert id="insertSelective" parameterType="com.sincere.common.dto.smartCampus.SzVSchoolTeacher">
  47 + insert into SZ_V_School_Teacher
  48 + <trim prefix="(" suffix=")" suffixOverrides=",">
  49 + <if test="schoolId != null">
  50 + school_id,
  51 + </if>
  52 + <if test="classId != null">
  53 + class_id,
  54 + </if>
  55 + <if test="teacherId != null">
  56 + teacher_id,
  57 + </if>
  58 + <if test="userId != null">
  59 + user_id,
  60 + </if>
  61 + <if test="name != null">
  62 + name,
  63 + </if>
  64 + <if test="face != null">
  65 + face,
  66 + </if>
  67 + <if test="num != null">
  68 + num,
  69 + </if>
  70 + <if test="teacherNum != null">
  71 + teacher_num,
  72 + </if>
  73 + <if test="teacherMobile != null">
  74 + teacher_mobile,
  75 + </if>
  76 + <if test="mobile != null">
  77 + mobile,
  78 + </if>
  79 + <if test="classState != null">
  80 + class_state,
  81 + </if>
  82 + <if test="roleState != null">
  83 + role_state,
  84 + </if>
  85 + <if test="iskaoqin != null">
  86 + IsKaoQin,
  87 + </if>
  88 + <if test="openid != null">
  89 + OpenId,
  90 + </if>
  91 + <if test="pass != null">
  92 + pass,
  93 + </if>
  94 + <if test="dinguserid != null">
  95 + DingUserId,
  96 + </if>
  97 + <if test="qiyehaouserid != null">
  98 + QiYeHaoUserId,
  99 + </if>
  100 + </trim>
  101 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  102 + <if test="schoolId != null">
  103 + #{schoolId,jdbcType=INTEGER},
  104 + </if>
  105 + <if test="classId != null">
  106 + #{classId,jdbcType=INTEGER},
  107 + </if>
  108 + <if test="teacherId != null">
  109 + #{teacherId,jdbcType=INTEGER},
  110 + </if>
  111 + <if test="userId != null">
  112 + #{userId,jdbcType=VARCHAR},
  113 + </if>
  114 + <if test="name != null">
  115 + #{name,jdbcType=VARCHAR},
  116 + </if>
  117 + <if test="face != null">
  118 + #{face,jdbcType=VARCHAR},
  119 + </if>
  120 + <if test="num != null">
  121 + #{num,jdbcType=VARCHAR},
  122 + </if>
  123 + <if test="teacherNum != null">
  124 + #{teacherNum,jdbcType=VARCHAR},
  125 + </if>
  126 + <if test="teacherMobile != null">
  127 + #{teacherMobile,jdbcType=VARCHAR},
  128 + </if>
  129 + <if test="mobile != null">
  130 + #{mobile,jdbcType=VARCHAR},
  131 + </if>
  132 + <if test="classState != null">
  133 + #{classState,jdbcType=INTEGER},
  134 + </if>
  135 + <if test="roleState != null">
  136 + #{roleState,jdbcType=INTEGER},
  137 + </if>
  138 + <if test="iskaoqin != null">
  139 + #{iskaoqin,jdbcType=INTEGER},
  140 + </if>
  141 + <if test="openid != null">
  142 + #{openid,jdbcType=VARCHAR},
  143 + </if>
  144 + <if test="pass != null">
  145 + #{pass,jdbcType=VARCHAR},
  146 + </if>
  147 + <if test="dinguserid != null">
  148 + #{dinguserid,jdbcType=VARCHAR},
  149 + </if>
  150 + <if test="qiyehaouserid != null">
  151 + #{qiyehaouserid,jdbcType=VARCHAR},
  152 + </if>
  153 + </trim>
  154 + </insert>
  155 +</mapper>
0 \ No newline at end of file 156 \ No newline at end of file
cloud/search_xiaoan/pom.xml
@@ -127,6 +127,17 @@ @@ -127,6 +127,17 @@
127 <finalName>search_xiaoan</finalName> 127 <finalName>search_xiaoan</finalName>
128 <!--打包方式--> 128 <!--打包方式-->
129 <plugins> 129 <plugins>
  130 +
  131 + <plugin>
  132 + <groupId>org.mybatis.generator</groupId>
  133 + <artifactId>mybatis-generator-maven-plugin</artifactId>
  134 + <version>1.3.5</version>
  135 + <configuration>
  136 + <verbose>true</verbose>
  137 + <overwrite>true</overwrite>
  138 + </configuration>
  139 + </plugin>
  140 +
130 <!-- 设置编译版本 --> 141 <!-- 设置编译版本 -->
131 <plugin> 142 <plugin>
132 <groupId>org.apache.maven.plugins</groupId> 143 <groupId>org.apache.maven.plugins</groupId>
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/controller/FaceController.java 0 → 100644
@@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
  1 +package com.sincere.xiaoanSearch.controller;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  4 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  5 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  6 +import com.sincere.xiaoanSearch.service.FaceService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.RequestBody;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +@RestController
  14 +@RequestMapping("/xa/face")
  15 +public class FaceController {
  16 +
  17 + @Autowired
  18 + FaceService faceService ;
  19 +
  20 +
  21 + @RequestMapping(value = "success",method = RequestMethod.POST)
  22 + void insertFaceSuccess(@RequestBody FaceSendsuccess faceSendsuccess){
  23 + faceService.insertFaceSuccess(faceSendsuccess);
  24 + }
  25 +
  26 + @RequestMapping(value = "fail",method = RequestMethod.POST)
  27 + void insertFaceFail(@RequestBody FaceSendfail faceSendfail){
  28 + faceService.insertFaceFail(faceSendfail);
  29 + }
  30 +
  31 + @RequestMapping(value = "insertRecode",method = RequestMethod.POST)
  32 + void insertRecode(@RequestBody FaceRecoder faceRecoder){
  33 + faceService.insertRecode(faceRecoder);
  34 + }
  35 +}
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FaceRecoderMapper.java 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +package com.sincere.xiaoanSearch.mapper;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  4 +
  5 +public interface FaceRecoderMapper {
  6 + int insert(FaceRecoder record);
  7 +
  8 + int insertSelective(FaceRecoder record);
  9 +}
0 \ No newline at end of file 10 \ No newline at end of file
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FaceSendfailMapper.java 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +package com.sincere.xiaoanSearch.mapper;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  4 +
  5 +public interface FaceSendfailMapper {
  6 +
  7 + int insert(FaceSendfail record);
  8 +
  9 + void deleteById(FaceSendfail faceSendfail);
  10 +}
0 \ No newline at end of file 11 \ No newline at end of file
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FaceSendsuccessMapper.java 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +package com.sincere.xiaoanSearch.mapper;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  4 +
  5 +public interface FaceSendsuccessMapper {
  6 +
  7 + int insert(FaceSendsuccess record);
  8 +
  9 + void deleteById(FaceSendsuccess faceSendsuccess);
  10 +}
0 \ No newline at end of file 11 \ No newline at end of file
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/FaceService.java 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +package com.sincere.xiaoanSearch.service;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  4 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  5 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  6 +
  7 +public interface FaceService {
  8 +
  9 + void insertFaceSuccess(FaceSendsuccess faceSendsuccess);
  10 +
  11 + void insertFaceFail(FaceSendfail faceSendfail);
  12 +
  13 + void insertRecode(FaceRecoder faceRecoder);
  14 +}
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/service/impl/FaceServiceImpl.java 0 → 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +package com.sincere.xiaoanSearch.service.impl;
  2 +
  3 +import com.sincere.common.dto.xiaoan.FaceRecoder;
  4 +import com.sincere.xiaoanSearch.mapper.FaceRecoderMapper;
  5 +import com.sincere.xiaoanSearch.mapper.FaceSendfailMapper;
  6 +import com.sincere.xiaoanSearch.mapper.FaceSendsuccessMapper;
  7 +import com.sincere.common.dto.xiaoan.FaceSendfail;
  8 +import com.sincere.common.dto.xiaoan.FaceSendsuccess;
  9 +import com.sincere.xiaoanSearch.service.FaceService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class FaceServiceImpl implements FaceService {
  15 +
  16 + @Autowired
  17 + FaceSendfailMapper faceSendfailMapper ;
  18 +
  19 + @Autowired
  20 + FaceSendsuccessMapper faceSendsuccessMapper ;
  21 +
  22 + @Autowired
  23 + FaceRecoderMapper faceRecoderMapper;
  24 +
  25 + @Override
  26 + public void insertFaceSuccess(FaceSendsuccess faceSendsuccess) {
  27 + FaceSendfail faceSendfail = new FaceSendfail();
  28 + faceSendfail.setCustomerid(faceSendsuccess.getCustomerid());
  29 + faceSendfail.setDeviceid(faceSendsuccess.getDeviceid());
  30 + faceSendfailMapper.deleteById(faceSendfail);
  31 + faceSendsuccessMapper.deleteById(faceSendsuccess);
  32 +
  33 + faceSendsuccessMapper.insert(faceSendsuccess);
  34 + }
  35 +
  36 + @Override
  37 + public void insertFaceFail(FaceSendfail faceSendfail) {
  38 + FaceSendsuccess faceSendsuccess = new FaceSendsuccess();
  39 + faceSendsuccess.setCustomerid(faceSendfail.getCustomerid());
  40 + faceSendsuccess.setDeviceid(faceSendfail.getDeviceid());
  41 + faceSendfailMapper.deleteById(faceSendfail);
  42 + faceSendsuccessMapper.deleteById(faceSendsuccess);
  43 +
  44 + faceSendfailMapper.insert(faceSendfail);
  45 + }
  46 +
  47 + @Override
  48 + public void insertRecode(FaceRecoder faceRecoder) {
  49 + faceRecoderMapper.insert(faceRecoder);
  50 + }
  51 +}
cloud/search_xiaoan/src/main/resources/application.yml
@@ -7,6 +7,9 @@ spring: @@ -7,6 +7,9 @@ spring:
7 username: szjxtuser 7 username: szjxtuser
8 password: RQminVCJota3H1u8bBYH 8 password: RQminVCJota3H1u8bBYH
9 url: jdbc:sqlserver://116.62.241.27:33419;database=xiaoanhxy 9 url: jdbc:sqlserver://116.62.241.27:33419;database=xiaoanhxy
  10 +# username: SZJXTUSER
  11 +# password: xst200919
  12 +# url: jdbc:sqlserver://60.190.202.57:14333;database=xiaoanhxy
10 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver 13 driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
11 ##mybatis 14 ##mybatis
12 mybatis: 15 mybatis:
cloud/search_xiaoan/src/main/resources/logback.xml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6     <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> 6     <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
7 <!--    <property name="LOG_HOME" value="/opt/web/log/" />--> 7 <!--    <property name="LOG_HOME" value="/opt/web/log/" />-->
8 - <property name="LOG_HOME" value="D://xiaoanSearch//log"/> 8 + <property name="LOG_HOME" value="C://log"/>
9 9
10     <!-- 控制台输出 --> 10     <!-- 控制台输出 -->
11     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> 11     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
cloud/search_xiaoan/src/main/resources/mapper/FaceRecoderMapper.xml 0 → 100644
@@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.xiaoanSearch.mapper.FaceRecoderMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.common.dto.xiaoan.FaceRecoder">
  5 + <result column="deviceId" jdbcType="VARCHAR" property="deviceid" />
  6 + <result column="user_id" jdbcType="VARCHAR" property="userId" />
  7 + <result column="name" jdbcType="VARCHAR" property="name" />
  8 + <result column="imgurl" jdbcType="VARCHAR" property="imgurl" />
  9 + <result column="inOrOut" jdbcType="INTEGER" property="inorout" />
  10 + <result column="time" jdbcType="TIMESTAMP" property="time" />
  11 + <result column="cardNum" jdbcType="VARCHAR" property="cardnum" />
  12 + </resultMap>
  13 + <insert id="insert" parameterType="com.sincere.common.dto.xiaoan.FaceRecoder">
  14 + insert into Face_Recoder (deviceId, user_id, name,
  15 + imgurl, inOrOut, time,
  16 + cardNum)
  17 + values (#{deviceid,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
  18 + #{imgurl,jdbcType=VARCHAR}, #{inorout,jdbcType=INTEGER}, #{time,jdbcType=TIMESTAMP},
  19 + #{cardnum,jdbcType=VARCHAR})
  20 + </insert>
  21 + <insert id="insertSelective" parameterType="com.sincere.common.dto.xiaoan.FaceRecoder">
  22 + insert into Face_Recoder
  23 + <trim prefix="(" suffix=")" suffixOverrides=",">
  24 + <if test="deviceid != null">
  25 + deviceId,
  26 + </if>
  27 + <if test="userId != null">
  28 + user_id,
  29 + </if>
  30 + <if test="name != null">
  31 + name,
  32 + </if>
  33 + <if test="imgurl != null">
  34 + imgurl,
  35 + </if>
  36 + <if test="inorout != null">
  37 + inOrOut,
  38 + </if>
  39 + <if test="time != null">
  40 + time,
  41 + </if>
  42 + <if test="cardnum != null">
  43 + cardNum,
  44 + </if>
  45 + </trim>
  46 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  47 + <if test="deviceid != null">
  48 + #{deviceid,jdbcType=VARCHAR},
  49 + </if>
  50 + <if test="userId != null">
  51 + #{userId,jdbcType=VARCHAR},
  52 + </if>
  53 + <if test="name != null">
  54 + #{name,jdbcType=VARCHAR},
  55 + </if>
  56 + <if test="imgurl != null">
  57 + #{imgurl,jdbcType=VARCHAR},
  58 + </if>
  59 + <if test="inorout != null">
  60 + #{inorout,jdbcType=INTEGER},
  61 + </if>
  62 + <if test="time != null">
  63 + #{time,jdbcType=TIMESTAMP},
  64 + </if>
  65 + <if test="cardnum != null">
  66 + #{cardnum,jdbcType=VARCHAR},
  67 + </if>
  68 + </trim>
  69 + </insert>
  70 +</mapper>
0 \ No newline at end of file 71 \ No newline at end of file
cloud/search_xiaoan/src/main/resources/mapper/FaceSendfailMapper.xml 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.xiaoanSearch.mapper.FaceSendfailMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.common.dto.xiaoan.FaceSendfail">
  5 + <result column="deviceID" jdbcType="VARCHAR" property="deviceid" />
  6 + <result column="customerid" jdbcType="VARCHAR" property="customerid" />
  7 + <result column="Num" jdbcType="VARCHAR" property="num" />
  8 + <result column="Name" jdbcType="VARCHAR" property="name" />
  9 + <result column="time" jdbcType="VARCHAR" property="time" />
  10 + <result column="schoolName" jdbcType="VARCHAR" property="schoolname" />
  11 + <result column="imgPath" jdbcType="VARCHAR" property="imgpath" />
  12 + <result column="schoolId" jdbcType="INTEGER" property="schoolid" />
  13 + <result column="failContent" jdbcType="VARCHAR" property="failcontent" />
  14 + <result column="failType" jdbcType="INTEGER" property="failtype" />
  15 + <result column="userType" jdbcType="INTEGER" property="usertype" />
  16 + <result column="deviceType" jdbcType="INTEGER" property="devicetype" />
  17 + </resultMap>
  18 + <insert id="insert" parameterType="com.sincere.common.dto.xiaoan.FaceSendfail">
  19 + insert into Face_SendFail (deviceID, customerid, Num,
  20 + Name, time, schoolName,
  21 + imgPath, schoolId, failContent,
  22 + failType, userType, deviceType
  23 + )
  24 + values (#{deviceid,jdbcType=VARCHAR}, #{customerid,jdbcType=VARCHAR}, #{num,jdbcType=VARCHAR},
  25 + #{name,jdbcType=VARCHAR}, GETDATE(), #{schoolname,jdbcType=VARCHAR},
  26 + #{imgpath,jdbcType=VARCHAR}, #{schoolid,jdbcType=INTEGER}, #{failcontent,jdbcType=VARCHAR},
  27 + #{failtype,jdbcType=INTEGER}, #{usertype,jdbcType=INTEGER}, #{devicetype,jdbcType=INTEGER}
  28 + )
  29 + </insert>
  30 +
  31 +
  32 + <delete id="deleteById" parameterType="com.sincere.common.dto.xiaoan.FaceSendfail">
  33 + delete Face_SendFail where deviceID = #{deviceid} and customerid = #{customerid}
  34 + </delete>
  35 +
  36 +</mapper>
0 \ No newline at end of file 37 \ No newline at end of file
cloud/search_xiaoan/src/main/resources/mapper/FaceSendsuccessMapper.xml 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.xiaoanSearch.mapper.FaceSendsuccessMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.common.dto.xiaoan.FaceSendsuccess">
  5 + <result column="deviceID" jdbcType="VARCHAR" property="deviceid" />
  6 + <result column="customerid" jdbcType="VARCHAR" property="customerid" />
  7 + <result column="Num" jdbcType="VARCHAR" property="num" />
  8 + <result column="Name" jdbcType="VARCHAR" property="name" />
  9 + <result column="time" jdbcType="TIMESTAMP" property="time" />
  10 + <result column="schoolName" jdbcType="VARCHAR" property="schoolname" />
  11 + <result column="imgPath" jdbcType="VARCHAR" property="imgpath" />
  12 + <result column="schoolId" jdbcType="INTEGER" property="schoolid" />
  13 + <result column="userType" jdbcType="INTEGER" property="usertype" />
  14 + <result column="deviceType" jdbcType="INTEGER" property="devicetype" />
  15 + </resultMap>
  16 + <insert id="insert" parameterType="com.sincere.common.dto.xiaoan.FaceSendsuccess">
  17 + insert into Face_SendSuccess (deviceID, customerid, Num,
  18 + Name, time, schoolName,
  19 + imgPath, schoolId, userType,
  20 + deviceType)
  21 + values (#{deviceid,jdbcType=VARCHAR}, #{customerid,jdbcType=VARCHAR}, #{num,jdbcType=VARCHAR},
  22 + #{name,jdbcType=VARCHAR}, GETDATE(), #{schoolname,jdbcType=VARCHAR},
  23 + #{imgpath,jdbcType=VARCHAR}, #{schoolid,jdbcType=INTEGER}, #{usertype,jdbcType=INTEGER},
  24 + #{devicetype,jdbcType=INTEGER})
  25 + </insert>
  26 +
  27 + <delete id="deleteById" parameterType="com.sincere.common.dto.xiaoan.FaceSendsuccess">
  28 + delete Face_SendSuccess where deviceID = #{deviceid} and customerid = #{customerid}
  29 + </delete>
  30 +
  31 +
  32 +</mapper>
0 \ No newline at end of file 33 \ No newline at end of file