Commit 6879cd6296ccf13670ae050cdf7f47a8b369de9e
Exists in
master
Merge remote-tracking branch 'origin/master'
Showing
80 changed files
with
4265 additions
and
422 deletions
Show diff stats
cloud/common/pom.xml
... | ... | @@ -22,6 +22,17 @@ |
22 | 22 | |
23 | 23 | <dependencies> |
24 | 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 | 36 | <groupId>com.nimbusds</groupId> |
26 | 37 | <artifactId>nimbus-jose-jwt</artifactId> |
27 | 38 | <version>6.0</version> | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/CwStutemperaturereocrd.java
0 → 100644
... | ... | @@ -0,0 +1,106 @@ |
1 | +package com.sincere.common.dto.smartCampus; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.Date; | |
5 | + | |
6 | +public class CwStutemperaturereocrd { | |
7 | + private Integer id; | |
8 | + | |
9 | + private String userid; | |
10 | + | |
11 | + private Integer studentid; | |
12 | + | |
13 | + private String name; | |
14 | + | |
15 | + private Integer classid; | |
16 | + | |
17 | + private String classname; | |
18 | + | |
19 | + private BigDecimal temperature; | |
20 | + | |
21 | + private Integer type; | |
22 | + | |
23 | + private Integer schoolid; | |
24 | + | |
25 | + private Date intime; | |
26 | + | |
27 | + public Integer getId() { | |
28 | + return id; | |
29 | + } | |
30 | + | |
31 | + public void setId(Integer id) { | |
32 | + this.id = id; | |
33 | + } | |
34 | + | |
35 | + public String getUserid() { | |
36 | + return userid; | |
37 | + } | |
38 | + | |
39 | + public void setUserid(String userid) { | |
40 | + this.userid = userid; | |
41 | + } | |
42 | + | |
43 | + public Integer getStudentid() { | |
44 | + return studentid; | |
45 | + } | |
46 | + | |
47 | + public void setStudentid(Integer studentid) { | |
48 | + this.studentid = studentid; | |
49 | + } | |
50 | + | |
51 | + public String getName() { | |
52 | + return name; | |
53 | + } | |
54 | + | |
55 | + public void setName(String name) { | |
56 | + this.name = name; | |
57 | + } | |
58 | + | |
59 | + public Integer getClassid() { | |
60 | + return classid; | |
61 | + } | |
62 | + | |
63 | + public void setClassid(Integer classid) { | |
64 | + this.classid = classid; | |
65 | + } | |
66 | + | |
67 | + public String getClassname() { | |
68 | + return classname; | |
69 | + } | |
70 | + | |
71 | + public void setClassname(String classname) { | |
72 | + this.classname = classname; | |
73 | + } | |
74 | + | |
75 | + public BigDecimal getTemperature() { | |
76 | + return temperature; | |
77 | + } | |
78 | + | |
79 | + public void setTemperature(BigDecimal temperature) { | |
80 | + this.temperature = temperature; | |
81 | + } | |
82 | + | |
83 | + public Integer getType() { | |
84 | + return type; | |
85 | + } | |
86 | + | |
87 | + public void setType(Integer type) { | |
88 | + this.type = type; | |
89 | + } | |
90 | + | |
91 | + public Integer getSchoolid() { | |
92 | + return schoolid; | |
93 | + } | |
94 | + | |
95 | + public void setSchoolid(Integer schoolid) { | |
96 | + this.schoolid = schoolid; | |
97 | + } | |
98 | + | |
99 | + public Date getIntime() { | |
100 | + return intime; | |
101 | + } | |
102 | + | |
103 | + public void setIntime(Date intime) { | |
104 | + this.intime = intime; | |
105 | + } | |
106 | +} | |
0 | 107 | \ No newline at end of file | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/SZ_AttendanceDto.java
... | ... | @@ -26,6 +26,16 @@ public class SZ_AttendanceDto { |
26 | 26 | private String ip ; |
27 | 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 | 39 | public String getIp() { |
30 | 40 | return ip; |
31 | 41 | } | ... | ... |
cloud/common/src/main/java/com/sincere/common/dto/smartCampus/StudentBean.java
0 → 100644
... | ... | @@ -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 @@ |
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 | 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 @@ |
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 | 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 @@ |
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 | 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 @@ |
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 | 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 @@ |
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 | 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 | 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 | 38 | public static String date2String(Date date, String format) { |
32 | 39 | SimpleDateFormat sdf = new SimpleDateFormat(format); |
33 | 40 | return sdf.format(date); | ... | ... |
cloud/common/src/main/java/com/sincere/common/util/HttpClientUtils.java
1 | 1 | package com.sincere.common.util; |
2 | 2 | |
3 | 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 | 8 | import org.apache.commons.httpclient.HttpClient; |
5 | 9 | import org.apache.commons.httpclient.methods.InputStreamRequestEntity; |
6 | 10 | import org.apache.commons.httpclient.methods.PostMethod; |
... | ... | @@ -40,17 +44,49 @@ public class HttpClientUtils { |
40 | 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 | 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 | 92 | * post请求传输json参数 | ... | ... |
... | ... | @@ -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.LapiApplication</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 | 192 | \ No newline at end of file | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/LapiApplication.java
0 → 100644
... | ... | @@ -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 LapiApplication { | |
11 | + | |
12 | + public static void main(String[] args) { | |
13 | + SpringApplication.run(LapiApplication.class, args); | |
14 | + ServerRun serverRun = new ServerRun(); | |
15 | + serverRun.start(5300); | |
16 | + } | |
17 | + | |
18 | +} | ... | ... |
... | ... | @@ -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 @@ |
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 @@ |
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,182 @@ |
1 | +package com.sincere.lapi.controller; | |
2 | + | |
3 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
4 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
5 | +import com.sincere.lapi.Utils.FileUtils; | |
6 | +import com.sincere.lapi.feign.ScFeign; | |
7 | +import com.sincere.lapi.feign.XaFeign; | |
8 | +import com.sincere.lapi.logs.LogName; | |
9 | +import com.sincere.lapi.logs.LoggerUtils; | |
10 | +import com.sincere.lapi.pojo.*; | |
11 | +import com.sincere.lapi.service.request.TerminalHttpCall; | |
12 | +import io.swagger.annotations.ApiOperation; | |
13 | +import org.apache.commons.lang3.StringUtils; | |
14 | +import org.slf4j.Logger; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.web.bind.annotation.RequestMapping; | |
17 | +import org.springframework.web.bind.annotation.RequestMethod; | |
18 | +import org.springframework.web.bind.annotation.RequestParam; | |
19 | +import org.springframework.web.bind.annotation.RestController; | |
20 | +import sun.misc.BASE64Encoder; | |
21 | + | |
22 | +import java.util.*; | |
23 | + | |
24 | +/** | |
25 | + * @author chen | |
26 | + * @version 1.0 | |
27 | + * @date 2019/11/28 0028 9:17 | |
28 | + */ | |
29 | +@RestController | |
30 | +public class LapiController { | |
31 | + | |
32 | + @Autowired | |
33 | + ScFeign scFeign ; | |
34 | + | |
35 | + @Autowired | |
36 | + XaFeign xaFeign ; | |
37 | + | |
38 | + @Autowired | |
39 | + TerminalHttpCall terminalHttpCall = new TerminalHttpCall(); | |
40 | + | |
41 | + private static final Logger Log_operate = LoggerUtils.Logger(LogName.operate); | |
42 | + /** | |
43 | + * 下发整个学校 | |
44 | + * @param deviceIds 多个设备用,隔开 | |
45 | + * @param schoolId | |
46 | + * @param userType 1 老师 2 学生 | |
47 | + */ | |
48 | + @RequestMapping(value = "sendFaces", method = RequestMethod.GET) | |
49 | + @ApiOperation(value = "下发学校下所有人脸给指定设备", notes = "下发所有人脸给指定设备") | |
50 | + public boolean sendFaces(@RequestParam("deviceIds") String deviceIds, @RequestParam("schoolId") String schoolId, @RequestParam("userType") String userType) { | |
51 | + String[] deviceList = deviceIds.split(","); | |
52 | + if(userType.equals("1")){ | |
53 | + List<SzVSchoolTeacher> list = scFeign.selectTeacherBySchoolId(schoolId) ; | |
54 | + list = removeDuplicateCase(list); | |
55 | + for(String deviceId :deviceList){ | |
56 | + sendTeacherBatch(list,deviceId); | |
57 | + } | |
58 | + }else if( userType.equals("2")){ | |
59 | + List<SzVSchoolStudent> list = scFeign.selectStudentBySchoolId(schoolId) ; | |
60 | + for(String deviceId :deviceList){ | |
61 | + sendStudentBatch(list,deviceId); | |
62 | + } | |
63 | + } | |
64 | + return false ; | |
65 | + } | |
66 | + | |
67 | + private List<SzVSchoolTeacher> removeDuplicateCase(List<SzVSchoolTeacher> cases) { | |
68 | + Set<SzVSchoolTeacher> set = new TreeSet<>(new Comparator<SzVSchoolTeacher>() { | |
69 | + @Override | |
70 | + public int compare(SzVSchoolTeacher o1, SzVSchoolTeacher o2) { | |
71 | + return o1.getTeacherId().compareTo(o2.getTeacherId()); | |
72 | + } | |
73 | + }); | |
74 | + set.addAll(cases); | |
75 | + return new ArrayList<>(set); | |
76 | + } | |
77 | + | |
78 | + | |
79 | + | |
80 | + //下发单张人脸到设备 | |
81 | + @RequestMapping(value = "sendStuCardAndImg", method = RequestMethod.GET) | |
82 | + @ApiOperation("下发人脸给设备") | |
83 | + public boolean sendCardAndImg( @RequestParam("deviceId") String deviceId, @RequestParam("customerId") int customerId, @RequestParam("userType") String userType){ | |
84 | + if(userType.equals("1")){ | |
85 | + SzVSchoolTeacher teacher = scFeign.selectByTeacherId(customerId) ; | |
86 | + sendTeacher(teacher,deviceId); | |
87 | + }else if( userType.equals("2")){ | |
88 | + SzVSchoolStudent student = scFeign.selectByStudentId(customerId) ; | |
89 | + sendStudent(student,deviceId); | |
90 | + } | |
91 | + return true; | |
92 | + } | |
93 | + | |
94 | + private void sendStudentBatch( List<SzVSchoolStudent> list , String deviceId){ | |
95 | + for(SzVSchoolStudent student : list){ | |
96 | + if(StringUtils.isNotBlank(student.getPhoto())){ | |
97 | + sendStudent(student,deviceId); | |
98 | + } | |
99 | + } | |
100 | + } | |
101 | + | |
102 | + private void sendStudent(SzVSchoolStudent student , String deviceId){ | |
103 | + sendImg(Long.valueOf(student.getStudentId()),student.getName(),student.getStudentNum(),student.getPhoto(),deviceId,2); | |
104 | + } | |
105 | + | |
106 | + private void sendTeacherBatch( List<SzVSchoolTeacher> list , String deviceId){ | |
107 | + for(SzVSchoolTeacher teacher : list){ | |
108 | + if(StringUtils.isNotBlank(teacher.getFace())){ | |
109 | + sendTeacher(teacher,deviceId); | |
110 | + } | |
111 | + } | |
112 | + } | |
113 | + | |
114 | + private void sendTeacher(SzVSchoolTeacher teacher , String deviceId){ | |
115 | + sendImg(Long.valueOf(teacher.getTeacherId()),teacher.getName(),teacher.getTeacherNum(),teacher.getFace(),deviceId,1); | |
116 | + | |
117 | + } | |
118 | + | |
119 | + private void sendImg(long personId , String name , String code , String fileUrl , String deviceId , int userType){ | |
120 | + Log_operate.info("开始下发人脸----设备号:"+deviceId+"---姓名:"+name+"--fileUrl:"+fileUrl); | |
121 | + PersonInfoList personInfoList = new PersonInfoList(); | |
122 | + List<PersonInfo> list1 = new ArrayList<PersonInfo>(); | |
123 | + personInfoList.setPersonInfoList(list1); | |
124 | + PersonInfo personInfo = new PersonInfo(); | |
125 | + list1.add(personInfo); | |
126 | + personInfoList.setNum(list1.size()); | |
127 | + | |
128 | + personInfo.setPersonID(personId); | |
129 | + personInfo.setLastChange(System.currentTimeMillis() / 1000); | |
130 | + personInfo.setPersonName(name); | |
131 | + personInfo.setGender(1); | |
132 | + | |
133 | + PersonTimeTemplateInfo personTimeTemplateInfo = new PersonTimeTemplateInfo(); | |
134 | + personTimeTemplateInfo.setBeginTime(System.currentTimeMillis() / 1000); | |
135 | + personTimeTemplateInfo.setEndTime((System.currentTimeMillis() + 10 * 365 * 24 * 60 * 60 * 1000L) / 1000); | |
136 | + personTimeTemplateInfo.setIndex(0); | |
137 | + personInfo.setTimeTemplate(personTimeTemplateInfo); | |
138 | + | |
139 | + List<IdentificationInfo> list = new ArrayList<IdentificationInfo>(); | |
140 | + IdentificationInfo identificationInfo = new IdentificationInfo(); | |
141 | + list.add(identificationInfo); | |
142 | + identificationInfo.setNumber(Long.parseLong(getCard(code), 16)+""); | |
143 | + identificationInfo.setType(1); | |
144 | + personInfo.setIdentificationList(list); | |
145 | + personInfo.setIdentificationNum(list.size()); | |
146 | + | |
147 | + List<PersonImageInfo> imageList = new ArrayList<PersonImageInfo>(); | |
148 | + try{ | |
149 | + PersonImageInfo personImageInfo = new PersonImageInfo(); | |
150 | + String picture = new BASE64Encoder().encode(FileUtils.getBytes(fileUrl)); | |
151 | + picture = picture.replaceAll("\n", "").replaceAll("\r", ""); | |
152 | + personImageInfo.setData(picture); | |
153 | + personImageInfo.setFaceID(Long.valueOf(userType)); | |
154 | + //personImageInfo.setName("1.jpg"); | |
155 | + personImageInfo.setSize(picture.length()); | |
156 | + imageList.add(personImageInfo); | |
157 | + personInfo.setImageList(imageList); | |
158 | + personInfo.setImageNum(imageList.size()); | |
159 | + terminalHttpCall.addPerson(deviceId, personInfoList); | |
160 | + } catch(Exception e) { | |
161 | + System.out.println(e.getMessage()); | |
162 | + } | |
163 | + } | |
164 | + | |
165 | + | |
166 | + private String getCard(String card) { | |
167 | + if(StringUtils.isBlank(card)){ | |
168 | + return "0" ; | |
169 | + }else { | |
170 | + if (card.length() == 8) { | |
171 | + int length = card.length(); | |
172 | + String result = card.substring(length - 2, length) + card.substring(length - 4, length - 2) + card.substring(length - 6, length - 4) | |
173 | + + card.substring(length - 8, length - 6); | |
174 | + return result; | |
175 | + | |
176 | + } else { | |
177 | + return "0"; | |
178 | + } | |
179 | + } | |
180 | + } | |
181 | + | |
182 | + } | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/feign/ScFeign.java
0 → 100644
... | ... | @@ -0,0 +1,43 @@ |
1 | +package com.sincere.lapi.feign; | |
2 | + | |
3 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
4 | +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; | |
5 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
6 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
7 | +import org.springframework.cloud.openfeign.FeignClient; | |
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.RequestParam; | |
12 | + | |
13 | +import java.util.List; | |
14 | + | |
15 | +/** | |
16 | + * @author chen | |
17 | + * @version 1.0 | |
18 | + * @date 2019/11/28 0028 9:17 | |
19 | + */ | |
20 | +@FeignClient("smartCampusSearch") | |
21 | +public interface ScFeign { | |
22 | + | |
23 | + @RequestMapping(value = "/sm/user/insertTemperature",method = RequestMethod.POST) | |
24 | + int insertTemperature(@RequestBody CwStutemperaturereocrd record); | |
25 | + | |
26 | + @RequestMapping(value = "/attendance/addAttendance", method = RequestMethod.POST) | |
27 | + void addAttendance(@RequestBody SZ_AttendanceDto attendanceDto); | |
28 | + | |
29 | + @RequestMapping(method = RequestMethod.GET, value = "/attendance/selectAttendaceWithId") | |
30 | + SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id); | |
31 | + | |
32 | + @RequestMapping(value = "/sm/user/selectTeacherBySchoolId",method = RequestMethod.GET) | |
33 | + List<SzVSchoolTeacher> selectTeacherBySchoolId(@RequestParam("schoolId") String schoolId); | |
34 | + | |
35 | + @RequestMapping(value = "/sm/user/selectStudentBySchoolId",method = RequestMethod.GET) | |
36 | + List<SzVSchoolStudent> selectStudentBySchoolId(@RequestParam("schoolId") String schoolId); | |
37 | + | |
38 | + @RequestMapping(value = "/sm/user/selectByTeacherId",method = RequestMethod.GET) | |
39 | + SzVSchoolTeacher selectByTeacherId(@RequestParam("teacherId") int teacherId); | |
40 | + | |
41 | + @RequestMapping(value = "/sm/user/selectByStudentId",method = RequestMethod.GET) | |
42 | + SzVSchoolStudent selectByStudentId(@RequestParam("studentId") int studentId); | |
43 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/feign/XaFeign.java
0 → 100644
... | ... | @@ -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/logs/LogName.java
0 → 100644
... | ... | @@ -0,0 +1,36 @@ |
1 | +package com.sincere.lapi.logs; | |
2 | + | |
3 | +/** | |
4 | + * @author chen | |
5 | + * @version 1.0 | |
6 | + * @date 2019/10/12 0012 16:18 | |
7 | + */ | |
8 | +public enum LogName { | |
9 | + operate("operate"), | |
10 | + report("report"); | |
11 | + | |
12 | + private String logFileName; | |
13 | + | |
14 | + LogName(String fileName) { | |
15 | + this.logFileName = fileName; | |
16 | + } | |
17 | + | |
18 | + public String getLogFileName() { | |
19 | + return logFileName; | |
20 | + } | |
21 | + | |
22 | + public void setLogFileName(String logFileName) { | |
23 | + this.logFileName = logFileName; | |
24 | + } | |
25 | + | |
26 | + public static LogName getAwardTypeEnum(String value) { | |
27 | + LogName[] arr = values(); | |
28 | + for (LogName item : arr) { | |
29 | + if (null != item && !item.logFileName.equals("")) { | |
30 | + return item; | |
31 | + } | |
32 | + } | |
33 | + return null; | |
34 | + } | |
35 | +} | |
36 | + | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/logs/LoggerUtils.java
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +package com.sincere.lapi.logs; | |
2 | + | |
3 | +import org.slf4j.Logger; | |
4 | +import org.slf4j.LoggerFactory; | |
5 | + | |
6 | +/** | |
7 | + * @author chen | |
8 | + * @version 1.0 | |
9 | + * @date 2019/10/12 0012 16:19 | |
10 | + */ | |
11 | +public class LoggerUtils { | |
12 | + | |
13 | + public static <T> Logger Logger(Class<T> clazz) { | |
14 | + return LoggerFactory.getLogger(clazz); | |
15 | + } | |
16 | + | |
17 | + /** | |
18 | + * 打印到指定的文件下 | |
19 | + * | |
20 | + * @param desc 日志文件名称 | |
21 | + * @return | |
22 | + */ | |
23 | + public static Logger Logger(LogName desc) { | |
24 | + return LoggerFactory.getLogger(desc.getLogFileName()); | |
25 | + } | |
26 | + | |
27 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/logs/MyTimeBasedFileNamingAndTriggeringPolicy.java
0 → 100644
... | ... | @@ -0,0 +1,32 @@ |
1 | +package com.sincere.lapi.logs; | |
2 | + | |
3 | +import ch.qos.logback.core.joran.spi.NoAutoStart; | |
4 | +import ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy; | |
5 | + | |
6 | +/** | |
7 | + * @author chen | |
8 | + * @version 1.0 | |
9 | + * @date 2019/10/31 0031 13:42 | |
10 | + */ | |
11 | +@NoAutoStart | |
12 | +public class MyTimeBasedFileNamingAndTriggeringPolicy<E> extends DefaultTimeBasedFileNamingAndTriggeringPolicy<E> { | |
13 | + | |
14 | + //这个用来指定时间间隔 | |
15 | + private Integer multiple = 1; | |
16 | + | |
17 | + @Override | |
18 | + protected void computeNextCheck() { | |
19 | + nextCheck = rc.getEndOfNextNthPeriod(dateInCurrentPeriod, multiple).getTime(); | |
20 | + } | |
21 | + | |
22 | + public Integer getMultiple() { | |
23 | + return multiple; | |
24 | + } | |
25 | + | |
26 | + public void setMultiple(Integer multiple) { | |
27 | + if (multiple > 1) { | |
28 | + this.multiple = multiple; | |
29 | + } | |
30 | + } | |
31 | + | |
32 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/HeartInfo.java
0 → 100644
... | ... | @@ -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,27 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +public class IdentificationInfo { | |
6 | + | |
7 | + @JSONField(name = "Type", ordinal = 1) | |
8 | + private Integer type; | |
9 | + @JSONField(name = "Number", ordinal = 2) | |
10 | + private String number; | |
11 | + | |
12 | + public Integer getType() { | |
13 | + return type; | |
14 | + } | |
15 | + | |
16 | + public void setType(Integer type) { | |
17 | + this.type = type; | |
18 | + } | |
19 | + | |
20 | + public String getNumber() { | |
21 | + return number; | |
22 | + } | |
23 | + | |
24 | + public void setNumber(String number) { | |
25 | + this.number = number; | |
26 | + } | |
27 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/LAPI.java
0 → 100644
... | ... | @@ -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,92 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +import java.io.Serializable; | |
6 | + | |
7 | +public class LAPIResponse implements Serializable { | |
8 | + /** | |
9 | + * 响应URL | |
10 | + */ | |
11 | + @JSONField(name = "ResponseURL", ordinal = 1) | |
12 | + private String responseUrl; | |
13 | + | |
14 | + /** | |
15 | + * 创建Id | |
16 | + */ | |
17 | + @JSONField(name = "CreatedID", ordinal = 2) | |
18 | + private int createdId; | |
19 | + | |
20 | + /** | |
21 | + * 状态编码 | |
22 | + */ | |
23 | + @JSONField(name = "StatusCode", ordinal = 3) | |
24 | + private int statusCode; | |
25 | + | |
26 | + /** | |
27 | + * 状态描述 | |
28 | + */ | |
29 | + @JSONField(name = "StatusString", ordinal = 4) | |
30 | + private String statusString; | |
31 | + | |
32 | + /** | |
33 | + * 返回数据 | |
34 | + */ | |
35 | + @JSONField(name = "Data", ordinal = 5) | |
36 | + private String data; | |
37 | + | |
38 | + public String getResponseUrl() { | |
39 | + return responseUrl; | |
40 | + } | |
41 | + | |
42 | + public void setResponseUrl(String responseUrl) { | |
43 | + this.responseUrl = responseUrl; | |
44 | + } | |
45 | + | |
46 | + | |
47 | + public int getCreatedId() { | |
48 | + return createdId; | |
49 | + } | |
50 | + | |
51 | + public void setCreatedId(int createdId) { | |
52 | + this.createdId = createdId; | |
53 | + } | |
54 | + | |
55 | + | |
56 | + public int getStatusCode() { | |
57 | + return statusCode; | |
58 | + } | |
59 | + | |
60 | + public void setStatusCode(int statusCode) { | |
61 | + this.statusCode = statusCode; | |
62 | + } | |
63 | + | |
64 | + | |
65 | + public String getStatusString() { | |
66 | + return statusString; | |
67 | + } | |
68 | + | |
69 | + public void setStatusString(String statusString) { | |
70 | + this.statusString = statusString; | |
71 | + } | |
72 | + | |
73 | + | |
74 | + public String getData() { | |
75 | + return data; | |
76 | + } | |
77 | + | |
78 | + public void setData(String data) { | |
79 | + this.data = data; | |
80 | + } | |
81 | + | |
82 | + @Override | |
83 | + public String toString() { | |
84 | + return "LAPIResponse{" + | |
85 | + "responseUrl='" + responseUrl + '\'' + | |
86 | + ", createdId=" + createdId + | |
87 | + ", statusCode=" + statusCode + | |
88 | + ", statusString='" + statusString + '\'' + | |
89 | + ", data='" + data + '\'' + | |
90 | + '}'; | |
91 | + } | |
92 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonImageInfo.java
0 → 100644
... | ... | @@ -0,0 +1,46 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +public class PersonImageInfo { | |
6 | + @JSONField(name = "FaceID", ordinal = 1) | |
7 | + private Long faceID; | |
8 | + @JSONField(name = "Name", ordinal = 2) | |
9 | + private String name; | |
10 | + @JSONField(name = "Size", ordinal = 3) | |
11 | + private Integer size; | |
12 | + @JSONField(name = "Data", ordinal = 4) | |
13 | + private String data; | |
14 | + | |
15 | + public Long getFaceID() { | |
16 | + return faceID; | |
17 | + } | |
18 | + | |
19 | + public void setFaceID(Long faceID) { | |
20 | + this.faceID = faceID; | |
21 | + } | |
22 | + | |
23 | + public String getName() { | |
24 | + return name; | |
25 | + } | |
26 | + | |
27 | + public void setName(String name) { | |
28 | + this.name = name; | |
29 | + } | |
30 | + | |
31 | + public Integer getSize() { | |
32 | + return size; | |
33 | + } | |
34 | + | |
35 | + public void setSize(Integer size) { | |
36 | + this.size = size; | |
37 | + } | |
38 | + | |
39 | + public String getData() { | |
40 | + return data; | |
41 | + } | |
42 | + | |
43 | + public void setData(String data) { | |
44 | + this.data = data; | |
45 | + } | |
46 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonInfo.java
0 → 100644
... | ... | @@ -0,0 +1,99 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +public class PersonInfo { | |
8 | + | |
9 | + @JSONField(name = "PersonID", ordinal = 1) | |
10 | + private Long personID; | |
11 | + @JSONField(name = "LastChange", ordinal = 2) | |
12 | + private Long lastChange; | |
13 | + @JSONField(name = "PersonName", ordinal = 3) | |
14 | + private String personName; | |
15 | + @JSONField(name = "Gender", ordinal = 4) | |
16 | + private Integer gender; | |
17 | + @JSONField(name = "TimeTemplate", ordinal = 5) | |
18 | + private PersonTimeTemplateInfo timeTemplate; | |
19 | + @JSONField(name = "IdentificationNum", ordinal = 6) | |
20 | + private Integer identificationNum; | |
21 | + @JSONField(name = "IdentificationList", ordinal = 7) | |
22 | + private List<IdentificationInfo> identificationList; | |
23 | + @JSONField(name = "ImageNum", ordinal = 8) | |
24 | + private Integer imageNum; | |
25 | + @JSONField(name = "ImageList", ordinal = 9) | |
26 | + private List<PersonImageInfo> imageList; | |
27 | + | |
28 | + public Long getPersonID() { | |
29 | + return personID; | |
30 | + } | |
31 | + | |
32 | + public void setPersonID(Long personID) { | |
33 | + this.personID = personID; | |
34 | + } | |
35 | + | |
36 | + public Long getLastChange() { | |
37 | + return lastChange; | |
38 | + } | |
39 | + | |
40 | + public void setLastChange(Long lastChange) { | |
41 | + this.lastChange = lastChange; | |
42 | + } | |
43 | + | |
44 | + public String getPersonName() { | |
45 | + return personName; | |
46 | + } | |
47 | + | |
48 | + public void setPersonName(String personName) { | |
49 | + this.personName = personName; | |
50 | + } | |
51 | + | |
52 | + public Integer getGender() { | |
53 | + return gender; | |
54 | + } | |
55 | + | |
56 | + public void setGender(Integer gender) { | |
57 | + this.gender = gender; | |
58 | + } | |
59 | + | |
60 | + public PersonTimeTemplateInfo getTimeTemplate() { | |
61 | + return timeTemplate; | |
62 | + } | |
63 | + | |
64 | + public void setTimeTemplate(PersonTimeTemplateInfo timeTemplate) { | |
65 | + this.timeTemplate = timeTemplate; | |
66 | + } | |
67 | + | |
68 | + public Integer getIdentificationNum() { | |
69 | + return identificationNum; | |
70 | + } | |
71 | + | |
72 | + public void setIdentificationNum(Integer identificationNum) { | |
73 | + this.identificationNum = identificationNum; | |
74 | + } | |
75 | + | |
76 | + public List<IdentificationInfo> getIdentificationList() { | |
77 | + return identificationList; | |
78 | + } | |
79 | + | |
80 | + public void setIdentificationList(List<IdentificationInfo> identificationList) { | |
81 | + this.identificationList = identificationList; | |
82 | + } | |
83 | + | |
84 | + public Integer getImageNum() { | |
85 | + return imageNum; | |
86 | + } | |
87 | + | |
88 | + public void setImageNum(Integer imageNum) { | |
89 | + this.imageNum = imageNum; | |
90 | + } | |
91 | + | |
92 | + public List<PersonImageInfo> getImageList() { | |
93 | + return imageList; | |
94 | + } | |
95 | + | |
96 | + public void setImageList(List<PersonImageInfo> imageList) { | |
97 | + this.imageList = imageList; | |
98 | + } | |
99 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonInfoList.java
0 → 100644
... | ... | @@ -0,0 +1,29 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +public class PersonInfoList { | |
8 | + | |
9 | + @JSONField(name = "Num", ordinal = 1) | |
10 | + private Integer num; | |
11 | + @JSONField(name = "PersonInfoList", ordinal = 2) | |
12 | + private List<PersonInfo> personInfoList; | |
13 | + | |
14 | + public Integer getNum() { | |
15 | + return num; | |
16 | + } | |
17 | + | |
18 | + public void setNum(Integer num) { | |
19 | + this.num = num; | |
20 | + } | |
21 | + | |
22 | + public List<PersonInfo> getPersonInfoList() { | |
23 | + return personInfoList; | |
24 | + } | |
25 | + | |
26 | + public void setPersonInfoList(List<PersonInfo> personInfoList) { | |
27 | + this.personInfoList = personInfoList; | |
28 | + } | |
29 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/pojo/PersonTimeTemplateInfo.java
0 → 100644
... | ... | @@ -0,0 +1,40 @@ |
1 | +package com.sincere.lapi.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +public class PersonTimeTemplateInfo { | |
6 | + | |
7 | + | |
8 | + @JSONField(name = "BeginTime", ordinal = 1) | |
9 | + private Long beginTime; | |
10 | + | |
11 | + @JSONField(name = "EndTime", ordinal = 2) | |
12 | + private Long endTime; | |
13 | + | |
14 | + @JSONField(name = "Index", ordinal = 3) | |
15 | + private Integer index; | |
16 | + | |
17 | + public Long getBeginTime() { | |
18 | + return beginTime; | |
19 | + } | |
20 | + | |
21 | + public void setBeginTime(Long beginTime) { | |
22 | + this.beginTime = beginTime; | |
23 | + } | |
24 | + | |
25 | + public Long getEndTime() { | |
26 | + return endTime; | |
27 | + } | |
28 | + | |
29 | + public void setEndTime(Long endTime) { | |
30 | + this.endTime = endTime; | |
31 | + } | |
32 | + | |
33 | + public Integer getIndex() { | |
34 | + return index; | |
35 | + } | |
36 | + | |
37 | + public void setIndex(Integer index) { | |
38 | + this.index = index; | |
39 | + } | |
40 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/ServerRun.java
0 → 100644
... | ... | @@ -0,0 +1,15 @@ |
1 | +package com.sincere.lapi.server; | |
2 | + | |
3 | +import com.sincere.lapi.server.thread.ServerThread; | |
4 | + | |
5 | + | |
6 | +public class ServerRun { | |
7 | + public void start(int port){ | |
8 | + try { | |
9 | + Thread runthread = new Thread(new ServerThread(port),"LapiServer"); | |
10 | + runthread.start(); | |
11 | + } catch (Exception e) { | |
12 | + System.out.println("Fail to create loop for:" + e); | |
13 | + } | |
14 | + } | |
15 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/UrlParam.java
0 → 100644
... | ... | @@ -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,130 @@ |
1 | +package com.sincere.lapi.server.handler; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSONArray; | |
4 | +import com.alibaba.fastjson.JSONObject; | |
5 | +import com.sincere.common.util.DateUtils; | |
6 | +import com.sincere.lapi.Utils.SpringContextHolder; | |
7 | +import com.sincere.lapi.logs.LogName; | |
8 | +import com.sincere.lapi.logs.LoggerUtils; | |
9 | +import com.sincere.lapi.pojo.HeartInfo; | |
10 | +import com.sincere.lapi.pojo.LAPI; | |
11 | +import com.sincere.lapi.pojo.LAPIResponse; | |
12 | +import com.sincere.lapi.server.UrlParam; | |
13 | +import com.sincere.lapi.server.pojo.HeartBack; | |
14 | +import com.sincere.lapi.service.request.AttendanceService; | |
15 | +import com.sincere.lapi.service.request.TerminalHttpCall; | |
16 | +import io.netty.buffer.ByteBuf; | |
17 | +import io.netty.channel.Channel; | |
18 | +import io.netty.channel.ChannelHandlerContext; | |
19 | +import io.netty.channel.ChannelInboundHandlerAdapter; | |
20 | +import io.netty.handler.codec.http.*; | |
21 | +import io.netty.util.CharsetUtil; | |
22 | +import org.apache.commons.lang3.StringUtils; | |
23 | +import org.slf4j.Logger; | |
24 | +import org.slf4j.LoggerFactory; | |
25 | + | |
26 | +import java.math.BigDecimal; | |
27 | +import java.text.SimpleDateFormat; | |
28 | +import java.util.Date; | |
29 | + | |
30 | +import static io.netty.buffer.Unpooled.copiedBuffer; | |
31 | + | |
32 | +public class HttpClientHandler extends ChannelInboundHandlerAdapter { | |
33 | + | |
34 | + private static final Logger Log_report = LoggerUtils.Logger(LogName.report); | |
35 | + | |
36 | + @Override | |
37 | + public void channelRead(ChannelHandlerContext ctx, Object msg) | |
38 | + throws Exception { | |
39 | + TerminalHttpCall call = SpringContextHolder.getTerminalHttpCall(); | |
40 | + AttendanceService attendanceService = SpringContextHolder.getAttendanceService(); | |
41 | + String content = (String) msg; | |
42 | + Log_report.info(content); | |
43 | + //心跳 更新设备 | |
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 | + }else if (content.contains("Response")) { | |
49 | + try{ | |
50 | + LAPIResponse lapiResponse = JSONObject.parseObject(content.substring(content.indexOf("{")), LAPI.class).getResponse(); | |
51 | + if(lapiResponse.getResponseUrl().equals(UrlParam.person_add)){ | |
52 | + attendanceService.insertSend(lapiResponse,call.getDeviceCodeByChannel(ctx)); | |
53 | + } | |
54 | + }catch (Exception e){ | |
55 | + } | |
56 | + }else { | |
57 | + String deviceCode = call.getDeviceCodeByChannel(ctx); | |
58 | + if(content.contains("Content-Type")){ | |
59 | + //第一个包-- 则对之前数据进行处理 | |
60 | + StringBuffer data = call.getDeviceDataMap(deviceCode); | |
61 | + handleData(attendanceService,deviceCode,data.toString()); | |
62 | + //数据放入map中 | |
63 | + data = new StringBuffer(); | |
64 | + data.append(content); | |
65 | + call.setDeviceDataMap(deviceCode,data); | |
66 | + }else { | |
67 | + //分包数据 连接 | |
68 | + StringBuffer data = call.getDeviceDataMap(deviceCode); | |
69 | + data.append(content); | |
70 | + call.setDeviceDataMap(deviceCode,data); | |
71 | + } | |
72 | + } | |
73 | + ctx.flush(); | |
74 | + } | |
75 | + | |
76 | + public void handleData(AttendanceService attendanceService, | |
77 | + String deviceCode , String data){ | |
78 | + if (data.contains("/LAPI/V1.0/System/Event/Notification/PersonVerification")) { | |
79 | + try{ | |
80 | + data = data.substring(data.indexOf("{")); | |
81 | + JSONObject object = JSONObject.parseObject(data); | |
82 | + int timestamp = (Integer) object.get("Timestamp"); | |
83 | + JSONArray faceInfoList = (JSONArray) object.get("FaceInfoList"); | |
84 | + JSONObject faceInfo = faceInfoList.getJSONObject(0); | |
85 | + BigDecimal temperature = (BigDecimal) faceInfo.get("Temperature"); | |
86 | + JSONArray libMatInfoList = (JSONArray)object.get("LibMatInfoList"); | |
87 | + JSONObject person = libMatInfoList.getJSONObject(0); | |
88 | + int personId = (Integer) person.get("MatchPersonID") ; | |
89 | + int userType = (Integer) person.get("MatchFaceID"); | |
90 | + attendanceService.insertRecode(personId+"",deviceCode,timestamp+"000",temperature,userType); | |
91 | + }catch (Exception e){ | |
92 | + e.printStackTrace(); | |
93 | + } | |
94 | + } | |
95 | + } | |
96 | + | |
97 | + public String getJson(String context){ | |
98 | + String msg = context.substring(context.indexOf("{"),context.indexOf("}")+1); | |
99 | + return msg ; | |
100 | + } | |
101 | + | |
102 | + //心跳回包 | |
103 | + @Override | |
104 | + public void channelActive(ChannelHandlerContext ctx) throws Exception { | |
105 | + super.channelActive(ctx); | |
106 | + HeartBack heartBack =new HeartBack(); | |
107 | + heartBack.setCode(0); | |
108 | + heartBack.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()))); | |
109 | + ByteBuf myContent = copiedBuffer(heartBack.toString(), CharsetUtil.UTF_8); | |
110 | + FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, myContent); | |
111 | + | |
112 | + response.headers().set(HttpHeaderNames.CONTENT_LENGTH, heartBack.toString().length()); | |
113 | + response.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); | |
114 | + //开启长连接 | |
115 | + response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); | |
116 | + response.headers().set("X-Frame-Options", "SAMEORIGIN"); | |
117 | + | |
118 | + //ChannelFuture future = ctx.writeAndFlush(response); | |
119 | + // System.out.println(future.isSuccess()); | |
120 | + } | |
121 | + | |
122 | + @Override | |
123 | + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { | |
124 | + //super.exceptionCaught(ctx, cause); | |
125 | + Channel incoming = ctx.channel(); | |
126 | + System.out.println("SimpleChatClient:" + incoming.remoteAddress()+"异常 : "+ cause); | |
127 | + //异常出现就关闭连接 | |
128 | + if(incoming.isActive())ctx.close(); | |
129 | + } | |
130 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/init/LapiServerInitializer.java
0 → 100644
... | ... | @@ -0,0 +1,28 @@ |
1 | +package com.sincere.lapi.server.init; | |
2 | + | |
3 | +import com.sincere.lapi.server.handler.HttpClientHandler; | |
4 | +import io.netty.channel.ChannelInitializer; | |
5 | +import io.netty.channel.ChannelPipeline; | |
6 | +import io.netty.channel.socket.SocketChannel; | |
7 | +import io.netty.handler.codec.rtsp.RtspEncoder; | |
8 | +import io.netty.handler.codec.string.StringDecoder; | |
9 | +import io.netty.handler.timeout.ReadTimeoutHandler; | |
10 | + | |
11 | + | |
12 | +public class LapiServerInitializer extends ChannelInitializer<SocketChannel> { | |
13 | + | |
14 | + @Override | |
15 | + protected void initChannel(SocketChannel ch) throws Exception { | |
16 | + ChannelPipeline pipeline = ch.pipeline(); | |
17 | + | |
18 | + pipeline.addLast(new StringDecoder()); | |
19 | +// pipeline.addLast(new HttpRequestEncoder()); | |
20 | + //pipeline.addLast(new HttpResponseEncoder()); | |
21 | + //可以进行请求、响应编码 | |
22 | + pipeline.addLast(new RtspEncoder()); | |
23 | + //保活超时时间 | |
24 | + pipeline.addLast(new ReadTimeoutHandler(600)); | |
25 | + //处理 | |
26 | + pipeline.addLast(new HttpClientHandler()); | |
27 | + } | |
28 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/init/NettyFactory.java
0 → 100644
... | ... | @@ -0,0 +1,47 @@ |
1 | +package com.sincere.lapi.server.init; | |
2 | + | |
3 | +import io.netty.bootstrap.ServerBootstrap; | |
4 | +import io.netty.channel.ChannelFuture; | |
5 | +import io.netty.channel.ChannelOption; | |
6 | +import io.netty.channel.EventLoopGroup; | |
7 | +import io.netty.channel.nio.NioEventLoopGroup; | |
8 | +import io.netty.channel.socket.nio.NioServerSocketChannel; | |
9 | + | |
10 | +public class NettyFactory { | |
11 | + | |
12 | + public void createNetty(int port) { | |
13 | + //Group:群组,Loop:循环,Event:事件,这几个东西联在一起,相比大家也大概明白它的用途了。 | |
14 | + //Netty内部都是通过线程在处理各种数据,EventLoopGroup就是用来管理调度他们的,注册Channel,管理他们的生命周期。 | |
15 | + //NioEventLoopGroup是一个处理I/O操作的多线程事件循环 | |
16 | + //bossGroup作为boss,接收传入连接 | |
17 | + //因为bossGroup仅接收客户端连接,不做复杂的逻辑处理,为了尽可能减少资源的占用,取值越小越好 | |
18 | + EventLoopGroup bossGroup = new NioEventLoopGroup(1); | |
19 | + //workerGroup作为worker,处理boss接收的连接的流量和将接收的连接注册进入这个worker | |
20 | + EventLoopGroup workerGroup = new NioEventLoopGroup(); | |
21 | + try { | |
22 | + ServerBootstrap b = new ServerBootstrap(); | |
23 | + b.group(bossGroup, workerGroup); | |
24 | + b.channel(NioServerSocketChannel.class); | |
25 | + //服务初始化通道处理 | |
26 | + b.childHandler(new LapiServerInitializer()); | |
27 | + //等待处理的队列大小 | |
28 | + b.option(ChannelOption.SO_BACKLOG, 128); | |
29 | + // b.option(ChannelOption.SO_RCVBUF,1024*1024*10); | |
30 | + //是否启用心跳保活机制。在双方TCP套接字建立连接后(即都进入ESTABLISHED状态)并且在两个小时左右上层没有任何数据传输的情况下,这套机制才会被激活。 | |
31 | + //childOption是用来给父级ServerChannel之下的Channels设置参数的 | |
32 | + b.childOption(ChannelOption.SO_KEEPALIVE, true); | |
33 | + // 绑定端口 | |
34 | + ChannelFuture f = b.bind(port).sync(); | |
35 | + //sync()会同步等待连接操作结果,用户线程将在此wait(),直到连接操作完成之后,线程被notify(),用户代码继续执行 | |
36 | + //closeFuture()当Channel关闭时返回一个ChannelFuture,用于链路检测 | |
37 | + f.channel().closeFuture().sync(); | |
38 | + } catch (Exception e) { | |
39 | + System.out.println(e); | |
40 | + } finally { | |
41 | + //资源优雅释放 | |
42 | + bossGroup.shutdownGracefully(); | |
43 | + workerGroup.shutdownGracefully(); | |
44 | + } | |
45 | + } | |
46 | + | |
47 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/pojo/HeartBack.java
0 → 100644
... | ... | @@ -0,0 +1,61 @@ |
1 | +package com.sincere.lapi.server.pojo; | |
2 | + | |
3 | +import com.alibaba.fastjson.annotation.JSONField; | |
4 | + | |
5 | +public class HeartBack { | |
6 | + | |
7 | + @JSONField(name = "ResponseURL", ordinal = 1) | |
8 | + private String responseURL; | |
9 | + @JSONField(name = "Code", ordinal = 1) | |
10 | + private int code = 0; | |
11 | + @JSONField(name = "Data", ordinal = 1) | |
12 | + private String time; | |
13 | + | |
14 | + //private class Data{ | |
15 | + // @JSONField(name = "Time", ordinal = 1) | |
16 | + //private String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())); | |
17 | + | |
18 | + public String getTime() { | |
19 | + return time; | |
20 | + } | |
21 | + | |
22 | + public void setTime(String time) { | |
23 | + this.time = time; | |
24 | + } | |
25 | + //} | |
26 | + | |
27 | + public String getResponseURL() { | |
28 | + return responseURL; | |
29 | + } | |
30 | + | |
31 | + public void setResponseURL(String responseURL) { | |
32 | + this.responseURL = responseURL; | |
33 | + } | |
34 | + | |
35 | + public int getCode() { | |
36 | + return code; | |
37 | + } | |
38 | + | |
39 | + public void setCode(int code) { | |
40 | + this.code = code; | |
41 | + } | |
42 | + | |
43 | + //public Data getData() { | |
44 | + //return data; | |
45 | + //} | |
46 | + | |
47 | + //public void setData(Data data) { | |
48 | + //this.data = data; | |
49 | + //} | |
50 | + | |
51 | + @Override | |
52 | + public String toString() { | |
53 | + return "{\n" + | |
54 | + "\"ResponseURL\": \"/LAPI/V1.0/PACS/Controller/HeartReportInfo\", \n" + | |
55 | + "\"Code\": 0, \n" + | |
56 | + "\"Data\": {\n" + | |
57 | + " \"Time\": \"" + time + "\"\n" + | |
58 | + "}\n" + | |
59 | + "}\n"; | |
60 | + } | |
61 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/server/thread/ServerThread.java
0 → 100644
... | ... | @@ -0,0 +1,17 @@ |
1 | +package com.sincere.lapi.server.thread; | |
2 | + | |
3 | +import com.sincere.lapi.server.init.NettyFactory; | |
4 | + | |
5 | +public class ServerThread implements Runnable { | |
6 | + private int port; | |
7 | + | |
8 | + public ServerThread(int port) { | |
9 | + this.port = port; | |
10 | + } | |
11 | + | |
12 | + @Override | |
13 | + public void run() { | |
14 | + NettyFactory nettyFactory = new NettyFactory(); | |
15 | + nettyFactory.createNetty(port); | |
16 | + } | |
17 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/service/request/AttendanceService.java
0 → 100644
... | ... | @@ -0,0 +1,164 @@ |
1 | +package com.sincere.lapi.service.request; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSONArray; | |
4 | +import com.alibaba.fastjson.JSONObject; | |
5 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
6 | +import com.sincere.common.dto.smartCampus.SZ_AttendanceDto; | |
7 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
8 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
9 | +import com.sincere.common.dto.xiaoan.FaceRecoder; | |
10 | +import com.sincere.common.dto.xiaoan.FaceSendfail; | |
11 | +import com.sincere.common.dto.xiaoan.FaceSendsuccess; | |
12 | +import com.sincere.common.util.DateUtils; | |
13 | +import com.sincere.lapi.feign.ScFeign; | |
14 | +import com.sincere.lapi.feign.XaFeign; | |
15 | +import com.sincere.lapi.logs.LogName; | |
16 | +import com.sincere.lapi.logs.LoggerUtils; | |
17 | +import com.sincere.lapi.pojo.LAPIResponse; | |
18 | +import org.slf4j.Logger; | |
19 | +import org.springframework.beans.factory.annotation.Autowired; | |
20 | +import org.springframework.stereotype.Service; | |
21 | + | |
22 | +import java.math.BigDecimal; | |
23 | +import java.util.HashMap; | |
24 | +import java.util.Map; | |
25 | + | |
26 | +@Service("attendanceService") | |
27 | +public class AttendanceService { | |
28 | + | |
29 | + | |
30 | + private static final Logger Log_operate = LoggerUtils.Logger(LogName.operate); | |
31 | + | |
32 | + @Autowired | |
33 | + ScFeign scFeign ; | |
34 | + | |
35 | + @Autowired | |
36 | + XaFeign xaFeign ; | |
37 | + | |
38 | + private static Map<Integer,String> resultCodeMap = new HashMap<>(); | |
39 | + | |
40 | + static { | |
41 | + resultCodeMap.put(1,"通用执行失败"); | |
42 | + resultCodeMap.put(2,"初始化检测失败"); | |
43 | + resultCodeMap.put(3,"人脸检测失败"); | |
44 | + resultCodeMap.put(4,"图片未检测到人脸"); | |
45 | + resultCodeMap.put(5,"jpeg 照片解码失败"); | |
46 | + resultCodeMap.put(6,"人脸图片质量分数不满足"); | |
47 | + resultCodeMap.put(7,"图片缩放失败"); | |
48 | + resultCodeMap.put(8,"未启用智能"); | |
49 | + resultCodeMap.put(9,"图片不存在或过大/过小"); | |
50 | + } | |
51 | + | |
52 | + public void addAttendance(String clientId){ | |
53 | + SZ_AttendanceDto dto = new SZ_AttendanceDto(); | |
54 | + dto.setClint_id(clientId); | |
55 | + dto.setClint_type("25"); | |
56 | + scFeign.addAttendance(dto); | |
57 | + } | |
58 | + | |
59 | + public void insertRecode(String customerId , String deviceCode , String time , BigDecimal temperature ,int userType){ | |
60 | + //1 老师 2 学生 | |
61 | + SZ_AttendanceDto attendanceDto = scFeign.selectAttendaceWithId(deviceCode); | |
62 | + FaceRecoder faceRecoder = new FaceRecoder(); | |
63 | + faceRecoder.setDeviceid(deviceCode); | |
64 | + faceRecoder.setInorout(attendanceDto.getOutOrIn()); | |
65 | + faceRecoder.setTime(DateUtils.getByLong(time)); | |
66 | + if(userType == 1){ | |
67 | + SzVSchoolTeacher teacher = scFeign.selectByTeacherId(Integer.valueOf(customerId)); | |
68 | + faceRecoder.setCardnum(teacher.getTeacherNum()); | |
69 | + faceRecoder.setUserId(customerId); | |
70 | + faceRecoder.setImgurl(teacher.getFace()); | |
71 | + faceRecoder.setName(teacher.getName()); | |
72 | + }else { | |
73 | + SzVSchoolStudent student = scFeign.selectByStudentId(Integer.valueOf(customerId)); | |
74 | + faceRecoder.setName(student.getName()); | |
75 | + faceRecoder.setImgurl(student.getPhoto()); | |
76 | + faceRecoder.setUserId(customerId); | |
77 | + faceRecoder.setCardnum(student.getStudentNum()); | |
78 | + CwStutemperaturereocrd record = new CwStutemperaturereocrd(); | |
79 | + record.setClassid(student.getClassId()); | |
80 | + record.setClassname(student.getClassName()); | |
81 | + record.setIntime(DateUtils.getByLong(time)); | |
82 | + record.setName(student.getName()); | |
83 | + record.setStudentid(student.getStudentId()); | |
84 | + record.setTemperature(temperature); | |
85 | + record.setUserid(student.getUserId()); | |
86 | + record.setSchoolid(student.getSchoolId()); | |
87 | + scFeign.insertTemperature(record); | |
88 | + } | |
89 | + Log_operate.info("刷脸成功-----设备号:"+deviceCode+"---------"+"name:"+faceRecoder.getName()); | |
90 | + xaFeign.insertRecode(faceRecoder); | |
91 | + } | |
92 | + | |
93 | + public void insertSend(LAPIResponse response , String deviceCode){ | |
94 | + try{ | |
95 | + if(response.getStatusString().equals("Succeed")){ | |
96 | + JSONObject data = JSONObject.parseObject(response.getData()); | |
97 | + JSONArray personList = (JSONArray)data.get("PersonList") ; | |
98 | + JSONObject person = (JSONObject)personList.get(0) ; | |
99 | + int personId = (Integer) person.get("PersonID"); | |
100 | + | |
101 | + JSONArray faceList = (JSONArray) person.get("FaceList"); | |
102 | + JSONObject face = (JSONObject) faceList.get(0); | |
103 | + int code = (Integer) face.get("ResultCode") ; | |
104 | + int userType = (Integer)face.get("FaceID"); | |
105 | + String num , photo , name ; | |
106 | + int schoolId ; | |
107 | + if(userType == 1){ | |
108 | + SzVSchoolTeacher teacher = scFeign.selectByTeacherId(personId); | |
109 | + num = teacher.getTeacherNum(); | |
110 | + photo = teacher.getFace(); | |
111 | + name = teacher.getName(); | |
112 | + schoolId = teacher.getSchoolId(); | |
113 | + }else { | |
114 | + SzVSchoolStudent student = scFeign.selectByStudentId(personId); | |
115 | + num = student.getStudentNum(); | |
116 | + photo = student.getPhoto() ; | |
117 | + name = student.getName(); | |
118 | + schoolId = student.getSchoolId(); | |
119 | + } | |
120 | + if(code == 0){ | |
121 | + Log_operate.info("下发成功-----设备号:"+deviceCode+"---------"+"name:"+name); | |
122 | + insertSuccess(deviceCode,personId,num,name,photo,schoolId,userType); | |
123 | + }else { | |
124 | + Log_operate.info("下发失败-----设备号:"+deviceCode+"---------"+"name:"+name); | |
125 | + insertFail(deviceCode,personId,num,name,photo,schoolId,userType,code,resultCodeMap.get(code)); | |
126 | + } | |
127 | + }else { | |
128 | + // insertFail(deviceCode,teacher.getTeacherId(),teacher.getTeacherNum(),teacher.getName(),teacher.getFace(),teacher.getSchoolId(),1,response.getStatusCode(),response.getStatusString()); | |
129 | + } | |
130 | + }catch (Exception e){ | |
131 | + | |
132 | + } | |
133 | + | |
134 | + } | |
135 | + | |
136 | + private void insertSuccess(String deviceId , int customerId , String num , String name , String imgPath , int schoolId ,int userType){ | |
137 | + FaceSendsuccess send = new FaceSendsuccess(); | |
138 | + send.setDeviceid(deviceId); | |
139 | + send.setCustomerid(customerId+""); | |
140 | + send.setDevicetype(25); | |
141 | + send.setImgpath(imgPath); | |
142 | + send.setSchoolid(schoolId); | |
143 | + send.setUsertype(userType); | |
144 | + send.setName(name); | |
145 | + send.setNum(num); | |
146 | + xaFeign.insertFaceSuccess(send); | |
147 | + } | |
148 | + | |
149 | + private void insertFail(String deviceId , int customerId , String num , String name , String imgPath , int schoolId ,int userType , int failType ,String failContent){ | |
150 | + FaceSendfail send = new FaceSendfail(); | |
151 | + send.setDeviceid(deviceId); | |
152 | + send.setCustomerid(customerId+""); | |
153 | + send.setDevicetype(25); | |
154 | + send.setImgpath(imgPath); | |
155 | + send.setSchoolid(schoolId); | |
156 | + send.setUsertype(userType); | |
157 | + send.setName(name); | |
158 | + send.setNum(num); | |
159 | + send.setFailtype(failType); | |
160 | + send.setFailcontent(failContent); | |
161 | + xaFeign.insertFaceFail(send); | |
162 | + } | |
163 | + | |
164 | +} | ... | ... |
cloud/lapi/src/main/java/com/sincere/lapi/service/request/TerminalHttpCall.java
0 → 100644
... | ... | @@ -0,0 +1,131 @@ |
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 | + * faceId == userType | |
19 | + */ | |
20 | +@Component("terminalHttpCall") | |
21 | +public class TerminalHttpCall { | |
22 | + | |
23 | + | |
24 | + //设备号 对应 通道 | |
25 | + private Map<String, ChannelHandlerContext> channelMap = new ConcurrentHashMap<String, ChannelHandlerContext>(); | |
26 | + //通道 对应 设备 | |
27 | + private Map<ChannelHandlerContext , String> channelCodeMap = new ConcurrentHashMap<ChannelHandlerContext , String>(); | |
28 | + | |
29 | + //设备--上报数据 | |
30 | + private Map<String,StringBuffer> deviceDataMap = new ConcurrentHashMap<>(); | |
31 | + | |
32 | + public void setDeviceDataMap(String deviceCode , StringBuffer data){ | |
33 | + deviceDataMap.put(deviceCode,data); | |
34 | + } | |
35 | + | |
36 | + public StringBuffer getDeviceDataMap(String deviceCode){ | |
37 | + StringBuffer data = deviceDataMap.get(deviceCode); | |
38 | + if(data == null){ | |
39 | + data = new StringBuffer(); | |
40 | + } | |
41 | + return data ; | |
42 | + } | |
43 | + | |
44 | + public void addChannel(String deviceCode , ChannelHandlerContext channelHandlerContext){ | |
45 | + channelMap.put(deviceCode, channelHandlerContext); | |
46 | + channelCodeMap.put(channelHandlerContext,deviceCode); | |
47 | + } | |
48 | + | |
49 | + public ChannelHandlerContext getChannel(String deviceCode) { | |
50 | + ChannelHandlerContext channelHandlerContext = channelMap.get(deviceCode); | |
51 | + if (channelHandlerContext.channel().isActive()) { | |
52 | + return channelHandlerContext; | |
53 | + } | |
54 | + return null; | |
55 | + } | |
56 | + | |
57 | + public String getDeviceCodeByChannel(ChannelHandlerContext channelHandlerContext){ | |
58 | + return channelCodeMap.get(channelHandlerContext); | |
59 | + } | |
60 | + | |
61 | + public boolean addPerson(String deviceCode , PersonInfoList personInfoList){ | |
62 | + return add(deviceCode, UrlParam.person_add,personInfoList); | |
63 | + } | |
64 | + | |
65 | + private <E> boolean put(String deviceCode , String prefixUrl) { | |
66 | + try { | |
67 | + URI url = new URI(prefixUrl); | |
68 | + //配置HttpRequest的请求数据和一些配置信息 | |
69 | + FullHttpRequest request = new DefaultFullHttpRequest( | |
70 | + HttpVersion.HTTP_1_1, HttpMethod.PUT, url.toASCIIString()); | |
71 | + request.headers() | |
72 | + .set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON) | |
73 | + .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); | |
74 | + ChannelHandlerContext ctx = this.getChannel(deviceCode); | |
75 | + if(ctx == null){ | |
76 | + return false; | |
77 | + } | |
78 | + ctx.writeAndFlush(request); | |
79 | + }catch (Exception e){ | |
80 | + System.out.println( e); | |
81 | + return false; | |
82 | + } | |
83 | + return true; | |
84 | + } | |
85 | + | |
86 | + private boolean get(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.GET, 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 <E> boolean add(String deviceCode , String prefixUrl , E e) { | |
108 | + try { | |
109 | + URI url = new URI(prefixUrl); | |
110 | + //配置HttpRequest的请求数据和一些配置信息 | |
111 | + FullHttpRequest request = new DefaultFullHttpRequest( | |
112 | + HttpVersion.HTTP_1_1, HttpMethod.POST, url.toASCIIString(), Unpooled.wrappedBuffer(JSON.toJSONString(e).getBytes("UTF-8"))); | |
113 | + request.headers() | |
114 | + .set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.APPLICATION_JSON) | |
115 | + //开启长连接 | |
116 | + .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE) | |
117 | + //设置传递请求内容的长度 | |
118 | + .set(HttpHeaderNames.CONTENT_LENGTH, request.content().readableBytes()); | |
119 | + ChannelHandlerContext ctx = this.getChannel(deviceCode); | |
120 | + if(ctx == null){ | |
121 | + return false; | |
122 | + } | |
123 | + ctx.writeAndFlush(request); | |
124 | + return true; | |
125 | + }catch (Exception exc){ | |
126 | + System.out.println(exc); | |
127 | + } | |
128 | + return false; | |
129 | + } | |
130 | + | |
131 | +} | ... | ... |
... | ... | @@ -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://121.40.109.21:8761/eureka/,http://121.40.109.21: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 | 20 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,58 @@ |
1 | +<?xml version="1.0" encoding="utf-8" ?> | |
2 | +<configuration scan="true" scanPeriod="60 seconds" debug="false"> | |
3 | + <!-- 定义日志文件 输入位置 --> | |
4 | + <property name="logPath" value="c:/bg_log" /> | |
5 | + <!-- 日志最大的历史 30天 --> | |
6 | + <property name="maxHistory" value="600"/> | |
7 | + | |
8 | + <!-- 配置项, 通过此节点配置日志输出位置(控制台、文件、数据库)、输出格式等--> | |
9 | + <!-- ConsoleAppender代表输出到控制台 --> | |
10 | + <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender"> | |
11 | + <!-- layout代表输出格式 --> | |
12 | + <layout class="ch.qos.logback.classic.PatternLayout"> | |
13 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern> | |
14 | + </layout> | |
15 | + </appender> | |
16 | + <!-- 日志输出文件 --> | |
17 | + <appender name="operateLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
18 | + <encoder> | |
19 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
20 | + </encoder> | |
21 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
22 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.lapi.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
23 | + <multiple>1</multiple> | |
24 | + </timeBasedFileNamingAndTriggeringPolicy> | |
25 | + <!-- 输出路径 --> | |
26 | + <fileNamePattern>${logPath}/info/operate/%d{yyyy-MM-dd HH}.log</fileNamePattern> | |
27 | + <maxHistory>${maxHistory}</maxHistory> | |
28 | + </rollingPolicy> | |
29 | + </appender> | |
30 | + <appender name="reportLog" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
31 | + <encoder> | |
32 | + <pattern>%d{yyyy-MM-dd HH:mm:ss} -%msg%n</pattern> | |
33 | + </encoder> | |
34 | + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
35 | + <timeBasedFileNamingAndTriggeringPolicy class="com.sincere.lapi.logs.MyTimeBasedFileNamingAndTriggeringPolicy"> | |
36 | + <multiple>1</multiple> | |
37 | + </timeBasedFileNamingAndTriggeringPolicy> | |
38 | + <!-- 输出路径 --> | |
39 | + <fileNamePattern>${logPath}/info/report/%d{yyyy-MM-dd HH}.log</fileNamePattern> | |
40 | + <maxHistory>${maxHistory}</maxHistory> | |
41 | + </rollingPolicy> | |
42 | + </appender> | |
43 | + | |
44 | + | |
45 | + <!-- 不同的业务逻辑日志打印到指定文件夹--> | |
46 | + <logger name="operate" additivity="false" level="INFO"> | |
47 | + <appender-ref ref="operateLog"/> | |
48 | + </logger> | |
49 | + <logger name="report" additivity="false" level="INFO"> | |
50 | + <appender-ref ref="reportLog"/> | |
51 | + </logger> | |
52 | + | |
53 | + <root level="info"> | |
54 | + <appender-ref ref="operateLog" /> | |
55 | + <appender-ref ref="reportLog" /> | |
56 | + </root> | |
57 | + | |
58 | +</configuration> | |
0 | 59 | \ No newline at end of file | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/Test.java
... | ... | @@ -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,10 +20,10 @@ public class SyncJob { |
20 | 20 | @Autowired |
21 | 21 | YXYReadService yxyReadService ; |
22 | 22 | |
23 | - @Scheduled(cron = "0 0 23 * * ? ") | |
23 | + @Scheduled(cron = "30 10 22 * * ? ") | |
24 | 24 | public void Sync(){ |
25 | 25 | //翼校通的同步 之后还有钉钉的同步等等 |
26 | - yxyWriteService.sync(); | |
27 | 26 | yxyReadService.sync(); |
27 | + yxyWriteService.sync(); | |
28 | 28 | } |
29 | 29 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/model/YxyStudent.java
... | ... | @@ -6,6 +6,33 @@ public class YxyStudent { |
6 | 6 | private String classId ; |
7 | 7 | private String name ; |
8 | 8 | private String account ; |
9 | + private String cardID ; | |
10 | + private String cardID2; | |
11 | + private String cardID3 ; | |
12 | + | |
13 | + public String getCardID() { | |
14 | + return cardID; | |
15 | + } | |
16 | + | |
17 | + public void setCardID(String cardID) { | |
18 | + this.cardID = cardID; | |
19 | + } | |
20 | + | |
21 | + public String getCardID2() { | |
22 | + return cardID2; | |
23 | + } | |
24 | + | |
25 | + public void setCardID2(String cardID2) { | |
26 | + this.cardID2 = cardID2; | |
27 | + } | |
28 | + | |
29 | + public String getCardID3() { | |
30 | + return cardID3; | |
31 | + } | |
32 | + | |
33 | + public void setCardID3(String cardID3) { | |
34 | + this.cardID3 = cardID3; | |
35 | + } | |
9 | 36 | |
10 | 37 | public String getUserId() { |
11 | 38 | return userId; | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYReadService.java
... | ... | @@ -9,6 +9,7 @@ import com.sincere.quartz.model.YxyAgency; |
9 | 9 | import com.sincere.quartz.model.YxyStudent; |
10 | 10 | import com.sincere.quartz.model.YxyTeacher; |
11 | 11 | import com.sincere.quartz.service.YxyService; |
12 | +import com.sincere.quartz.utils.ThreadUtils; | |
12 | 13 | import org.apache.commons.lang3.StringUtils; |
13 | 14 | import org.slf4j.Logger; |
14 | 15 | import org.slf4j.LoggerFactory; |
... | ... | @@ -20,6 +21,8 @@ import java.security.MessageDigest; |
20 | 21 | import java.util.ArrayList; |
21 | 22 | import java.util.Date; |
22 | 23 | import java.util.List; |
24 | +import java.util.concurrent.ExecutorService; | |
25 | +import java.util.concurrent.TimeUnit; | |
23 | 26 | |
24 | 27 | @Service |
25 | 28 | public class YXYReadService { |
... | ... | @@ -46,6 +49,10 @@ public class YXYReadService { |
46 | 49 | private Logger logger = LoggerFactory.getLogger(YXYReadService.class); |
47 | 50 | |
48 | 51 | public void sync(){ |
52 | + ExecutorService pool = ThreadUtils.newFixedThreadPool(8); | |
53 | + yxyService.updateAgency(); | |
54 | + yxyService.updateStudent(); | |
55 | + yxyService.updateTeacher(); | |
49 | 56 | List<String> areaCodeList = new ArrayList<>(); |
50 | 57 | areaCodeList.add("0571") ; |
51 | 58 | areaCodeList.add("0572") ; |
... | ... | @@ -56,11 +63,7 @@ public class YXYReadService { |
56 | 63 | areaCodeList.add("0577") ; |
57 | 64 | areaCodeList.add("0578") ; |
58 | 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 | 67 | for(String areaCode : areaCodeList){ |
65 | 68 | try{ |
66 | 69 | // 先获取学校,部门,年级 班级 |
... | ... | @@ -74,34 +77,45 @@ public class YXYReadService { |
74 | 77 | String method = getALlDept_method; |
75 | 78 | JSONArray jsonArray = getMessage(wsdl, ns, method, list); |
76 | 79 | if(jsonArray != null){ |
77 | - List<String> schoolList = new ArrayList<>(); | |
80 | + logger.info("市编码:" + areaCode); | |
78 | 81 | for(int i = 0 ; i < jsonArray.size() ; i++){ |
79 | - logger.info("市编码:" + areaCode); | |
80 | 82 | JSONObject object = (JSONObject) jsonArray.get(i) ; |
81 | 83 | YxyAgency agency = new YxyAgency() ; |
82 | 84 | agency.setDeptId(object.get("deptID").toString()); |
83 | 85 | agency.setDeptName(object.get("deptName").toString()); |
84 | 86 | agency.setSuperDeptId(object.get("superDeptID").toString()); |
85 | 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 | 89 | schoolList.add(object.get("deptID").toString()) ; |
88 | 90 | } |
89 | 91 | yxyService.insertAgency(agency); |
90 | 92 | } |
91 | - for(String schoolId : schoolList){ | |
92 | - syncTeacher(schoolId) ; | |
93 | - syncStudent(schoolId) ; | |
94 | - } | |
95 | 93 | } |
96 | 94 | }catch (Exception e){ |
97 | 95 | e.printStackTrace(); |
98 | 96 | } |
99 | - | |
100 | 97 | } |
98 | + for(String schoolId : schoolList){ | |
99 | + pool.execute(initSchool(schoolId)); | |
100 | + } | |
101 | + pool.shutdown(); | |
102 | + while (!pool.isTerminated()) { | |
103 | + // 等待所有子线程结束,才退出主线程 | |
104 | + } | |
105 | + logger.info("------------------当天更新完成"); | |
101 | 106 | } |
102 | 107 | |
103 | 108 | |
104 | - private void syncStudent(String schoolId){ | |
109 | + private Runnable initSchool(String schoolId){ | |
110 | + Runnable runnable = () -> { | |
111 | + syncStudent(schoolId); | |
112 | + syncTeacher(schoolId); | |
113 | + }; | |
114 | + return runnable ; | |
115 | + } | |
116 | + | |
117 | + | |
118 | + public void syncStudent(String schoolId){ | |
105 | 119 | List list = new ArrayList(); |
106 | 120 | list.add(SI); |
107 | 121 | list.add(getPassword(SI_CODE)); |
... | ... | @@ -110,21 +124,42 @@ public class YXYReadService { |
110 | 124 | String ns = nameSpace; |
111 | 125 | String method = getALlStudent_method; |
112 | 126 | 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); | |
127 | + try{ | |
128 | + logger.info("学校ID为:"+schoolId + "共有学生" + jsonArray.size() +"人"); | |
129 | + if(jsonArray != null){ | |
130 | + for(int i = 0 ; i < jsonArray.size() ; i++){ | |
131 | + JSONObject object = (JSONObject) jsonArray.get(i) ; | |
132 | + YxyStudent student = new YxyStudent(); | |
133 | + try{ | |
134 | + student.setClassId(object.get("classID").toString()); | |
135 | + student.setAccount(object.get("account").toString()); | |
136 | + student.setName(object.get("name").toString()); | |
137 | + student.setUserId(object.get("userID").toString()); | |
138 | + }catch (Exception e){ | |
139 | + } | |
140 | + try{ | |
141 | + student.setCardID(object.get("cardID").toString()); | |
142 | + }catch (Exception e){ | |
143 | + } | |
144 | + try{ | |
145 | + student.setCardID2(object.get("cardID2").toString()); | |
146 | + }catch (Exception e){ | |
147 | + } | |
148 | + try{ | |
149 | + student.setCardID3(object.get("cardID3").toString()); | |
150 | + }catch (Exception e){ | |
151 | + } | |
152 | + yxyService.insertStudent(student); | |
153 | + } | |
123 | 154 | } |
155 | + }catch (Exception e){ | |
156 | + logger.info(e.toString()); | |
157 | + logger.info("学校ID为:"+schoolId + "学生数据没返回"); | |
124 | 158 | } |
159 | + | |
125 | 160 | } |
126 | 161 | |
127 | - private void syncTeacher(String schoolId){ | |
162 | + public void syncTeacher(String schoolId){ | |
128 | 163 | List list = new ArrayList(); |
129 | 164 | list.add(SI); |
130 | 165 | list.add(getPassword(SI_CODE)); |
... | ... | @@ -133,32 +168,45 @@ public class YXYReadService { |
133 | 168 | String ns = nameSpace; |
134 | 169 | String method = getAllTeacher_method; |
135 | 170 | 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); | |
171 | + try{ | |
172 | + logger.info("学校ID为:"+schoolId + "共有老师" + jsonArray.size() +"人"); | |
173 | + if(jsonArray != null){ | |
174 | + for(int i = 0 ; i < jsonArray.size() ; i++){ | |
175 | + JSONObject object = (JSONObject) jsonArray.get(i) ; | |
176 | + YxyTeacher teacher = new YxyTeacher(); | |
177 | + try { | |
178 | + teacher.setDeptId(object.get("classID").toString()); | |
179 | + teacher.setAccount(object.get("account").toString()); | |
180 | + teacher.setName(object.get("name").toString()); | |
181 | + teacher.setUserId(object.get("userID").toString()); | |
182 | + }catch (Exception e){ | |
183 | + } | |
184 | + yxyService.insertTeacher(teacher); | |
185 | + } | |
146 | 186 | } |
187 | + }catch (Exception e){ | |
188 | + logger.info(e.toString()); | |
189 | + logger.info("学校ID为:"+schoolId + "老师数据没返回"); | |
147 | 190 | } |
191 | + | |
148 | 192 | } |
149 | 193 | |
150 | 194 | private JSONArray getMessage(String wsdl, String ns, String method, List<String> list){ |
151 | 195 | String resultXml = HttpClientUtils.invoiceWebService(wsdl,ns,method,list); |
152 | - if(StringUtils.isNotBlank(resultXml)){ | |
153 | - resultXml = resultXml.replaceAll("<", "<"); | |
154 | - resultXml = resultXml.replaceAll(">", ">"); | |
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") ; | |
196 | + try { | |
197 | + if (StringUtils.isNotBlank(resultXml)) { | |
198 | + resultXml = resultXml.replaceAll("<", "<"); | |
199 | + resultXml = resultXml.replaceAll(">", ">"); | |
200 | + int begin = resultXml.indexOf("<JXT"); | |
201 | + int end = resultXml.indexOf("</JXT"); | |
202 | + String str = resultXml.substring(begin, end + 6); | |
203 | + JSONObject json = Xml2JsonUtils.xml2Json(str); | |
204 | + if (json != null) { | |
205 | + return (JSONArray) json.get("resultInfo"); | |
206 | + } | |
161 | 207 | } |
208 | + }catch (Exception e){ | |
209 | + logger.info("获取信息报错"+e.getMessage()); | |
162 | 210 | } |
163 | 211 | return null ; |
164 | 212 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYResult.java
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYWriteService.java
... | ... | @@ -51,19 +51,23 @@ public class YXYWriteService { |
51 | 51 | ScFeign scFeign ; |
52 | 52 | |
53 | 53 | public void sync(){ |
54 | - //查出要同步的学校 | |
55 | - logger.info("开始同步翼学云数据==========="); | |
56 | - List<SyncSchoolDto> schoolList = scFeign.selectSyncSchool(); | |
57 | - for(SyncSchoolDto school : schoolList){ | |
58 | - logger.info("学校"+school.getSchoolName()); | |
59 | - if(school.getPush() == 0){ | |
60 | - //同步课程 | |
61 | - syncSubject(school); | |
62 | - } | |
63 | - List<SyncDeptDto> deptList = scFeign.selectDept(school.getSchoolId()); | |
64 | - syncDept(school,deptList); | |
65 | - List<SyncUserDto> userList = scFeign.selectUser(school.getSchoolId()); | |
66 | - syncUser(school,userList); | |
54 | + try{ | |
55 | + //查出要同步的学校 | |
56 | + logger.info("开始同步翼学云数据==========="); | |
57 | + List<SyncSchoolDto> schoolList = scFeign.selectSyncSchool(); | |
58 | + for(SyncSchoolDto school : schoolList){ | |
59 | + logger.info("学校"+school.getSchoolName()); | |
60 | + if(school.getPush() == 0){ | |
61 | + //同步课程 | |
62 | + syncSubject(school); | |
63 | + } | |
64 | + List<SyncDeptDto> deptList = scFeign.selectDept(school.getSchoolId()); | |
65 | + syncDept(school,deptList); | |
66 | + List<SyncUserDto> userList = scFeign.selectUser(school.getSchoolId()); | |
67 | + syncUser(school,userList); | |
68 | + } | |
69 | + }catch (Exception e){ | |
70 | + | |
67 | 71 | } |
68 | 72 | } |
69 | 73 | |
... | ... | @@ -705,9 +709,17 @@ public class YXYWriteService { |
705 | 709 | |
706 | 710 | private YXYResult getResult(String url , String json){ |
707 | 711 | YXYResult result = invokeApi(url,TOKEN,json); |
708 | - if(result.getCode() == 2){ | |
712 | + if(result == null){ | |
709 | 713 | TOKEN = getToken(); |
710 | 714 | result = invokeApi(url,TOKEN,json); |
715 | + }else { | |
716 | + if (result.getCode() == 2) { | |
717 | + TOKEN = getToken(); | |
718 | + result = invokeApi(url, TOKEN, json); | |
719 | + } | |
720 | + } | |
721 | + if(result == null){ | |
722 | + result = new YXYResult(); | |
711 | 723 | } |
712 | 724 | return result ; |
713 | 725 | } | ... | ... |
cloud/quartz/src/main/java/com/sincere/quartz/utils/ThreadUtils.java
0 → 100644
... | ... | @@ -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/quartz/src/main/resources/application.yaml
cloud/quartz/src/main/resources/mapper/YxyMapper.xml
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | </insert> |
27 | 27 | |
28 | 28 | <insert id="insertStudent" parameterType="com.sincere.quartz.model.YxyStudent" > |
29 | - insert into Student(userID , account , name , classID , intime , state , isCard , isEquipment , card_crafts) | |
30 | - values (#{userId} , #{account} , #{name} , #{classId} , GETDATE() , 1 ,0,0,2) | |
29 | + insert into Student(userID , account , name , classID , intime , state , isCard , isEquipment , card_crafts,cardID,cardid2,cardid3) | |
30 | + values (#{userId} , #{account} , #{name} , #{classId} , GETDATE() , 1 ,0,0,2,#{cardID},#{cardID2},#{cardID3}) | |
31 | 31 | </insert> |
32 | 32 | </mapper> | ... | ... |
cloud/search_smartCampus/pom.xml
... | ... | @@ -126,6 +126,15 @@ |
126 | 126 | <finalName>search_smartCampus</finalName> |
127 | 127 | <!--打包方式--> |
128 | 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 | 139 | <plugin> |
131 | 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 | 6 | import com.sincere.smartSearch.service.DeviceService; |
7 | 7 | import io.swagger.annotations.Api; |
8 | 8 | import io.swagger.annotations.ApiOperation; |
9 | -import org.apache.ibatis.annotations.Param; | |
10 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
11 | 10 | import org.springframework.web.bind.annotation.*; |
12 | 11 | |
... | ... | @@ -24,6 +23,27 @@ public class AttendanceController { |
24 | 23 | @Autowired |
25 | 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("-1"); | |
38 | + try { | |
39 | + attendanceDto.setIntime(DateUtils.getToday(DateUtils.format2)); | |
40 | + }catch (Exception e){ | |
41 | + | |
42 | + } | |
43 | + attendacenService.insertAttendance(attendanceDto); | |
44 | + } | |
45 | + } | |
46 | + | |
27 | 47 | @RequestMapping(method = RequestMethod.GET, value = "selectAttendaceWithId") |
28 | 48 | public SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id) { |
29 | 49 | return attendacenService.selectDevice(clint_id); | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/controller/UserController.java
1 | 1 | package com.sincere.smartSearch.controller; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
4 | +import com.sincere.common.dto.smartCampus.StudentBean; | |
5 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
6 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
3 | 7 | import com.sincere.smartSearch.service.UserService; |
4 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
5 | -import org.springframework.web.bind.annotation.RequestMapping; | |
6 | -import org.springframework.web.bind.annotation.RequestMethod; | |
7 | -import org.springframework.web.bind.annotation.RequestParam; | |
8 | -import org.springframework.web.bind.annotation.RestController; | |
9 | +import org.springframework.web.bind.annotation.*; | |
10 | + | |
11 | +import java.util.List; | |
9 | 12 | |
10 | 13 | /** |
11 | 14 | * @author chen |
... | ... | @@ -19,6 +22,11 @@ public class UserController { |
19 | 22 | @Autowired |
20 | 23 | UserService userService; |
21 | 24 | |
25 | + @RequestMapping(value = "insertTemperature",method = RequestMethod.POST) | |
26 | + int insertTemperature(@RequestBody CwStutemperaturereocrd record){ | |
27 | + return userService.insertTemperature(record); | |
28 | + } | |
29 | + | |
22 | 30 | @RequestMapping(value = "selectStudentNumByStudentId",method = RequestMethod.GET) |
23 | 31 | String selectStudentNumByStudentId(@RequestParam("studentId") int studentId){ |
24 | 32 | return userService.selectStudentNumByStudentId(studentId); |
... | ... | @@ -27,15 +35,33 @@ public class UserController { |
27 | 35 | |
28 | 36 | |
29 | 37 | @RequestMapping(value = "getStudent_NumWitdCode",method = RequestMethod.GET) |
30 | - String getStudent_NumWitdCode(@RequestParam("studentcode") String studentcode){ | |
38 | + StudentBean getStudent_NumWitdCode(@RequestParam("studentcode") String studentcode){ | |
31 | 39 | return userService.getStudent_NumWitdCode(studentcode); |
32 | 40 | } |
33 | 41 | |
34 | 42 | |
35 | 43 | @RequestMapping(value = "getTeacherWithstudentcode",method = RequestMethod.GET) |
36 | - String getTeacherWithstudentcode(@RequestParam("num") String num,@RequestParam("schoolId") String schoolId){ | |
44 | + StudentBean getTeacherWithstudentcode(@RequestParam("num") String num,@RequestParam("schoolId") String schoolId){ | |
37 | 45 | return userService.getTeacherWithstudentcode(num,schoolId); |
38 | 46 | } |
39 | 47 | |
48 | + @RequestMapping(value = "selectTeacherBySchoolId",method = RequestMethod.GET) | |
49 | + List<SzVSchoolTeacher> selectTeacherBySchoolId(@RequestParam("schoolId") String schoolId){ | |
50 | + return userService.selectTeacherBySchool(Integer.valueOf(schoolId)); | |
51 | + } | |
40 | 52 | |
53 | + @RequestMapping(value = "selectStudentBySchoolId",method = RequestMethod.GET) | |
54 | + List<SzVSchoolStudent> selectStudentBySchoolId(@RequestParam("schoolId") String schoolId){ | |
55 | + return userService.selectStudentBySchool(Integer.valueOf(schoolId)); | |
56 | + } | |
57 | + | |
58 | + @RequestMapping(value = "selectByTeacherId",method = RequestMethod.GET) | |
59 | + SzVSchoolTeacher selectByTeacherId(@RequestParam("teacherId") int teacherId){ | |
60 | + return userService.selectByTeacherId(teacherId); | |
61 | + } | |
62 | + | |
63 | + @RequestMapping(value = "selectByStudentId",method = RequestMethod.GET) | |
64 | + SzVSchoolStudent selectByStudentId(@RequestParam("studentId") int studentId){ | |
65 | + return userService.selectByStudentId(studentId); | |
66 | + } | |
41 | 67 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/CwCheckMapper.java
0 → 100644
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/CwStutemperaturereocrdMapper.java
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +package com.sincere.smartSearch.mapper; | |
2 | + | |
3 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
4 | + | |
5 | +public interface CwStutemperaturereocrdMapper { | |
6 | + int insert(CwStutemperaturereocrd record); | |
7 | + | |
8 | + int insertSelective(CwStutemperaturereocrd record); | |
9 | +} | |
0 | 10 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/SzVSchoolStudentMapper.java
0 → 100644
... | ... | @@ -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 | 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 @@ |
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 | 17 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/mapper/UserMapper.java
1 | 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 | 10 | * @author chen |
5 | 11 | * @version 1.0 |
... | ... | @@ -12,9 +18,10 @@ public interface UserMapper { |
12 | 18 | @Select("select Top(1)*\n" + |
13 | 19 | "from SZ_V_School_Teacher\n" + |
14 | 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 | 23 | @Select("select Top(1) * from SZ_V_School_Student where studentcode = #{studentcode}") |
18 | 24 | StudentBean getStudent_NumWitdCode(@Param("studentcode") String studentcode); |
19 | 25 | |
26 | + | |
20 | 27 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/model/CwCheck.java
0 → 100644
... | ... | @@ -0,0 +1,85 @@ |
1 | +package com.sincere.smartSearch.model; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +public class CwCheck { | |
6 | + private Integer id; | |
7 | + | |
8 | + private String checkname; | |
9 | + | |
10 | + private String begintime; | |
11 | + | |
12 | + private String endtime; | |
13 | + | |
14 | + private Integer templateid; | |
15 | + | |
16 | + private Integer schoolid; | |
17 | + | |
18 | + private Integer state; | |
19 | + | |
20 | + private Date intime; | |
21 | + | |
22 | + public Integer getId() { | |
23 | + return id; | |
24 | + } | |
25 | + | |
26 | + public void setId(Integer id) { | |
27 | + this.id = id; | |
28 | + } | |
29 | + | |
30 | + public String getCheckname() { | |
31 | + return checkname; | |
32 | + } | |
33 | + | |
34 | + public void setCheckname(String checkname) { | |
35 | + this.checkname = checkname; | |
36 | + } | |
37 | + | |
38 | + public String getBegintime() { | |
39 | + return begintime; | |
40 | + } | |
41 | + | |
42 | + public void setBegintime(String begintime) { | |
43 | + this.begintime = begintime; | |
44 | + } | |
45 | + | |
46 | + public String getEndtime() { | |
47 | + return endtime; | |
48 | + } | |
49 | + | |
50 | + public void setEndtime(String endtime) { | |
51 | + this.endtime = endtime; | |
52 | + } | |
53 | + | |
54 | + public Integer getTemplateid() { | |
55 | + return templateid; | |
56 | + } | |
57 | + | |
58 | + public void setTemplateid(Integer templateid) { | |
59 | + this.templateid = templateid; | |
60 | + } | |
61 | + | |
62 | + public Integer getSchoolid() { | |
63 | + return schoolid; | |
64 | + } | |
65 | + | |
66 | + public void setSchoolid(Integer schoolid) { | |
67 | + this.schoolid = schoolid; | |
68 | + } | |
69 | + | |
70 | + public Integer getState() { | |
71 | + return state; | |
72 | + } | |
73 | + | |
74 | + public void setState(Integer state) { | |
75 | + this.state = state; | |
76 | + } | |
77 | + | |
78 | + public Date getIntime() { | |
79 | + return intime; | |
80 | + } | |
81 | + | |
82 | + public void setIntime(Date intime) { | |
83 | + this.intime = intime; | |
84 | + } | |
85 | +} | |
0 | 86 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/model/StudentBean.java
... | ... | @@ -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 | 1 | package com.sincere.smartSearch.service; |
2 | 2 | |
3 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
4 | +import com.sincere.common.dto.smartCampus.StudentBean; | |
5 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
6 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
7 | + | |
8 | +import java.util.List; | |
9 | + | |
3 | 10 | /** |
4 | 11 | * @author chen |
5 | 12 | * @version 1.0 |
... | ... | @@ -9,8 +16,18 @@ public interface UserService { |
9 | 16 | |
10 | 17 | String selectStudentNumByStudentId(int studentId); |
11 | 18 | |
12 | - StudentBean getTeacherWithstudentcode(String num,String schoolId); | |
19 | + StudentBean getTeacherWithstudentcode(String num, String schoolId); | |
13 | 20 | |
14 | 21 | StudentBean getStudent_NumWitdCode(String studentcode); |
15 | 22 | |
23 | + List<SzVSchoolTeacher> selectTeacherBySchool(int schoolId); | |
24 | + | |
25 | + List<SzVSchoolStudent> selectStudentBySchool(int schoolId); | |
26 | + | |
27 | + SzVSchoolTeacher selectByTeacherId(int teacherId); | |
28 | + | |
29 | + SzVSchoolStudent selectByStudentId(int studentId); | |
30 | + | |
31 | + int insertTemperature(CwStutemperaturereocrd record); | |
32 | + | |
16 | 33 | } | ... | ... |
cloud/search_smartCampus/src/main/java/com/sincere/smartSearch/service/impl/UserServiceImpl.java
1 | 1 | package com.sincere.smartSearch.service.impl; |
2 | 2 | |
3 | -import com.sincere.smartSearch.mapper.UserMapper; | |
3 | +import com.sincere.common.dto.smartCampus.CwStutemperaturereocrd; | |
4 | +import com.sincere.common.dto.smartCampus.SzVSchoolStudent; | |
5 | +import com.sincere.common.dto.smartCampus.SzVSchoolTeacher; | |
6 | +import com.sincere.common.util.DateUtils; | |
7 | +import com.sincere.smartSearch.mapper.*; | |
8 | +import com.sincere.common.dto.smartCampus.StudentBean; | |
9 | +import com.sincere.smartSearch.model.CwCheck; | |
4 | 10 | import com.sincere.smartSearch.service.UserService; |
5 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
6 | 12 | import org.springframework.stereotype.Service; |
7 | 13 | |
14 | +import java.util.Date; | |
15 | +import java.util.List; | |
16 | + | |
8 | 17 | /** |
9 | 18 | * @author chen |
10 | 19 | * @version 1.0 |
... | ... | @@ -16,6 +25,18 @@ public class UserServiceImpl implements UserService { |
16 | 25 | @Autowired |
17 | 26 | UserMapper userMapper ; |
18 | 27 | |
28 | + @Autowired | |
29 | + SzVSchoolStudentMapper szVSchoolStudentMapper; | |
30 | + | |
31 | + @Autowired | |
32 | + SzVSchoolTeacherMapper szVSchoolTeacherMapper; | |
33 | + | |
34 | + @Autowired | |
35 | + CwStutemperaturereocrdMapper cwStutemperaturereocrdMapper ; | |
36 | + | |
37 | + @Autowired | |
38 | + CwCheckMapper cwCheckMapper; | |
39 | + | |
19 | 40 | @Override |
20 | 41 | public String selectStudentNumByStudentId(int studentId) { |
21 | 42 | return userMapper.selectStudentNumByStudentId(studentId); |
... | ... | @@ -33,4 +54,43 @@ public class UserServiceImpl implements UserService { |
33 | 54 | return userMapper.getTeacherWithstudentcode(num,schoolId); |
34 | 55 | } |
35 | 56 | |
57 | + @Override | |
58 | + public List<SzVSchoolTeacher> selectTeacherBySchool(int schoolId) { | |
59 | + return szVSchoolTeacherMapper.selectBySchool(schoolId); | |
60 | + } | |
61 | + | |
62 | + @Override | |
63 | + public List<SzVSchoolStudent> selectStudentBySchool(int schoolId) { | |
64 | + return szVSchoolStudentMapper.selectBySchool(schoolId); | |
65 | + } | |
66 | + | |
67 | + @Override | |
68 | + public SzVSchoolTeacher selectByTeacherId(int teacherId) { | |
69 | + return szVSchoolTeacherMapper.selectByTeacherId(teacherId); | |
70 | + } | |
71 | + | |
72 | + @Override | |
73 | + public SzVSchoolStudent selectByStudentId(int studentId) { | |
74 | + return szVSchoolStudentMapper.selectByStudentId(studentId); | |
75 | + } | |
76 | + | |
77 | + @Override | |
78 | + public int insertTemperature(CwStutemperaturereocrd record) { | |
79 | + List<CwCheck> list = cwCheckMapper.selectBySchoolId(record.getSchoolid()); | |
80 | + try{ | |
81 | + String today = DateUtils.getToday(DateUtils.format1); | |
82 | + record.setType(1); | |
83 | + for(CwCheck cwCheck : list){ | |
84 | + Date begin = DateUtils.string2Date(today+ " "+ cwCheck.getBegintime()+":00",DateUtils.format2); | |
85 | + Date end = DateUtils.string2Date(today+ " "+ cwCheck.getEndtime()+":00",DateUtils.format2); | |
86 | + if(end.compareTo(record.getIntime()) == 1 && record.getIntime().compareTo(begin) == 1){ | |
87 | + record.setType(cwCheck.getCheckname().equals("晨检")?1:2); | |
88 | + } | |
89 | + } | |
90 | + return cwStutemperaturereocrdMapper.insert(record); | |
91 | + }catch (Exception e){ | |
92 | + | |
93 | + } | |
94 | + return 0 ; | |
95 | + } | |
36 | 96 | } | ... | ... |
cloud/search_smartCampus/src/main/resources/application.yml
... | ... | @@ -21,16 +21,14 @@ mybatis: |
21 | 21 | type-aliases-package: com.sincere.smartSearch.mapper |
22 | 22 | check-config-location: true |
23 | 23 | |
24 | - | |
25 | - | |
26 | 24 | eureka: |
27 | 25 | instance: |
28 | - hostname: localhost | |
26 | + hostname: 121.40.109.21 | |
29 | 27 | lease-expiration-duration-in-seconds: 60 |
30 | 28 | lease-renewal-interval-in-seconds: 10 |
31 | 29 | client: |
32 | 30 | service-url: |
33 | 31 | # defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ |
34 | - defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | |
32 | + defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/ | |
35 | 33 | |
36 | 34 | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/AttendanceMapper.xml
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | <result column="isConnection" property="isConnection"/> |
13 | 13 | <result column="state" property="state"/> |
14 | 14 | <result column="IsKaoqin" property="IsKaoqin"/> |
15 | - | |
15 | + <result column="OutOrIn" property="outOrIn"/> | |
16 | 16 | </resultMap> |
17 | 17 | |
18 | 18 | <select id="selectDevice" resultMap="BaseResultMap"> | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/CwCheckMapper.xml
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
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.CwCheckMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.smartSearch.model.CwCheck"> | |
5 | + <result column="ID" jdbcType="INTEGER" property="id" /> | |
6 | + <result column="CheckName" jdbcType="VARCHAR" property="checkname" /> | |
7 | + <result column="BeginTime" jdbcType="VARCHAR" property="begintime" /> | |
8 | + <result column="EndTime" jdbcType="VARCHAR" property="endtime" /> | |
9 | + <result column="TemplateId" jdbcType="INTEGER" property="templateid" /> | |
10 | + <result column="SchoolId" jdbcType="INTEGER" property="schoolid" /> | |
11 | + <result column="State" jdbcType="INTEGER" property="state" /> | |
12 | + <result column="Intime" jdbcType="TIMESTAMP" property="intime" /> | |
13 | + </resultMap> | |
14 | + | |
15 | + <select id="selectBySchoolId" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |
16 | + select * from CW_Check where SchoolId =#{schoolId} and state = 1 | |
17 | + </select> | |
18 | +</mapper> | |
0 | 19 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/CwStutemperaturereocrdMapper.xml
0 → 100644
... | ... | @@ -0,0 +1,93 @@ |
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.CwStutemperaturereocrdMapper"> | |
4 | + <resultMap id="BaseResultMap" type="com.sincere.common.dto.smartCampus.CwStutemperaturereocrd"> | |
5 | + <result column="Id" jdbcType="INTEGER" property="id" /> | |
6 | + <result column="UserId" jdbcType="VARCHAR" property="userid" /> | |
7 | + <result column="StudentId" jdbcType="INTEGER" property="studentid" /> | |
8 | + <result column="Name" jdbcType="VARCHAR" property="name" /> | |
9 | + <result column="ClassId" jdbcType="INTEGER" property="classid" /> | |
10 | + <result column="ClassName" jdbcType="VARCHAR" property="classname" /> | |
11 | + <result column="Temperature" jdbcType="DECIMAL" property="temperature" /> | |
12 | + <result column="Type" jdbcType="INTEGER" property="type" /> | |
13 | + <result column="SchoolId" jdbcType="INTEGER" property="schoolid" /> | |
14 | + <result column="Intime" jdbcType="TIMESTAMP" property="intime" /> | |
15 | + </resultMap> | |
16 | + <insert id="insert" parameterType="com.sincere.common.dto.smartCampus.CwStutemperaturereocrd"> | |
17 | + insert into CW_StuTemperatureReocrd ( UserId, StudentId, | |
18 | + Name, ClassId, ClassName, | |
19 | + Temperature, Type, SchoolId, | |
20 | + Intime) | |
21 | + values ( #{userid,jdbcType=VARCHAR}, #{studentid,jdbcType=INTEGER}, | |
22 | + #{name,jdbcType=VARCHAR}, #{classid,jdbcType=INTEGER}, #{classname,jdbcType=VARCHAR}, | |
23 | + #{temperature,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER}, #{schoolid,jdbcType=INTEGER}, | |
24 | + #{intime,jdbcType=TIMESTAMP}) | |
25 | + </insert> | |
26 | + <insert id="insertSelective" parameterType="com.sincere.common.dto.smartCampus.CwStutemperaturereocrd"> | |
27 | + insert into CW_StuTemperatureReocrd | |
28 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
29 | + <if test="id != null"> | |
30 | + Id, | |
31 | + </if> | |
32 | + <if test="userid != null"> | |
33 | + UserId, | |
34 | + </if> | |
35 | + <if test="studentid != null"> | |
36 | + StudentId, | |
37 | + </if> | |
38 | + <if test="name != null"> | |
39 | + Name, | |
40 | + </if> | |
41 | + <if test="classid != null"> | |
42 | + ClassId, | |
43 | + </if> | |
44 | + <if test="classname != null"> | |
45 | + ClassName, | |
46 | + </if> | |
47 | + <if test="temperature != null"> | |
48 | + Temperature, | |
49 | + </if> | |
50 | + <if test="type != null"> | |
51 | + Type, | |
52 | + </if> | |
53 | + <if test="schoolid != null"> | |
54 | + SchoolId, | |
55 | + </if> | |
56 | + <if test="intime != null"> | |
57 | + Intime, | |
58 | + </if> | |
59 | + </trim> | |
60 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
61 | + <if test="id != null"> | |
62 | + #{id,jdbcType=INTEGER}, | |
63 | + </if> | |
64 | + <if test="userid != null"> | |
65 | + #{userid,jdbcType=VARCHAR}, | |
66 | + </if> | |
67 | + <if test="studentid != null"> | |
68 | + #{studentid,jdbcType=INTEGER}, | |
69 | + </if> | |
70 | + <if test="name != null"> | |
71 | + #{name,jdbcType=VARCHAR}, | |
72 | + </if> | |
73 | + <if test="classid != null"> | |
74 | + #{classid,jdbcType=INTEGER}, | |
75 | + </if> | |
76 | + <if test="classname != null"> | |
77 | + #{classname,jdbcType=VARCHAR}, | |
78 | + </if> | |
79 | + <if test="temperature != null"> | |
80 | + #{temperature,jdbcType=DECIMAL}, | |
81 | + </if> | |
82 | + <if test="type != null"> | |
83 | + #{type,jdbcType=INTEGER}, | |
84 | + </if> | |
85 | + <if test="schoolid != null"> | |
86 | + #{schoolid,jdbcType=INTEGER}, | |
87 | + </if> | |
88 | + <if test="intime != null"> | |
89 | + #{intime,jdbcType=TIMESTAMP}, | |
90 | + </if> | |
91 | + </trim> | |
92 | + </insert> | |
93 | +</mapper> | |
0 | 94 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/SzVSchoolStudentMapper.xml
0 → 100644
... | ... | @@ -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 | 202 | \ No newline at end of file | ... | ... |
cloud/search_smartCampus/src/main/resources/mapper/SzVSchoolTeacherMapper.xml
0 → 100644
... | ... | @@ -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 | 156 | \ No newline at end of file | ... | ... |
cloud/search_xiaoan/pom.xml
... | ... | @@ -127,6 +127,17 @@ |
127 | 127 | <finalName>search_xiaoan</finalName> |
128 | 128 | <!--打包方式--> |
129 | 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 | 142 | <plugin> |
132 | 143 | <groupId>org.apache.maven.plugins</groupId> |
... | ... | @@ -146,7 +157,7 @@ |
146 | 157 | <configuration> |
147 | 158 | <archive> |
148 | 159 | <manifest> |
149 | - <mainClass>com.jevon.Application</mainClass> | |
160 | + <mainClass>com.sincere.xiaoanSearch.XiaoanSearchApplication</mainClass> | |
150 | 161 | <addClasspath>true</addClasspath> |
151 | 162 | <classpathPrefix>lib/</classpathPrefix> |
152 | 163 | </manifest> | ... | ... |
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/controller/FaceController.java
0 → 100644
... | ... | @@ -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
cloud/search_xiaoan/src/main/java/com/sincere/xiaoanSearch/mapper/FaceSendfailMapper.java
0 → 100644
... | ... | @@ -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 | 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 @@ |
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 | 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 @@ |
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 @@ |
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 | 7 | username: szjxtuser |
8 | 8 | password: RQminVCJota3H1u8bBYH |
9 | 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 | 13 | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
11 | 14 | ##mybatis |
12 | 15 | mybatis: |
... | ... | @@ -16,12 +19,12 @@ mybatis: |
16 | 19 | |
17 | 20 | eureka: |
18 | 21 | instance: |
19 | - hostname: localhost | |
22 | + hostname: 121.40.30.78 | |
20 | 23 | lease-expiration-duration-in-seconds: 60 |
21 | 24 | lease-renewal-interval-in-seconds: 10 |
22 | 25 | client: |
23 | 26 | service-url: |
24 | - defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ | |
27 | + defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/ | |
25 | 28 | |
26 | 29 | |
27 | 30 | ... | ... |
cloud/search_xiaoan/src/main/resources/logback.xml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | |
6 | 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> |
7 | 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 | 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 @@ |
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 | 71 | \ No newline at end of file | ... | ... |
cloud/search_xiaoan/src/main/resources/mapper/FaceSendfailMapper.xml
0 → 100644
... | ... | @@ -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 | 37 | \ No newline at end of file | ... | ... |
cloud/search_xiaoan/src/main/resources/mapper/FaceSendsuccessMapper.xml
0 → 100644
... | ... | @@ -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 | 33 | \ No newline at end of file | ... | ... |