Commit 4b0a4282f744c2ab613dd9c5e609bb0fc8da8ff6
1 parent
f6777403
Exists in
master
海康 大华接口提交
Showing
13 changed files
with
582 additions
and
163 deletions
Show diff stats
cloud/dahua/pom.xml
... | ... | @@ -127,13 +127,17 @@ |
127 | 127 | <artifactId>commons-codec</artifactId> |
128 | 128 | <version>1.10</version> |
129 | 129 | </dependency> |
130 | + <!--解析excel--> | |
130 | 131 | <dependency> |
131 | 132 | <groupId>org.apache.poi</groupId> |
132 | 133 | <artifactId>poi</artifactId> |
133 | - <version>4.1.0</version> | |
134 | - <scope>compile</scope> | |
134 | + <version>3.17</version> | |
135 | + </dependency> | |
136 | + <dependency> | |
137 | + <groupId>org.apache.poi</groupId> | |
138 | + <artifactId>poi-ooxml</artifactId> | |
139 | + <version>3.17</version> | |
135 | 140 | </dependency> |
136 | - | |
137 | 141 | <dependency> |
138 | 142 | <groupId>com.belerweb</groupId> |
139 | 143 | <artifactId>pinyin4j</artifactId> | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
... | ... | @@ -21,6 +21,7 @@ import com.example.dahua.utils.JsonUtils; |
21 | 21 | import com.example.dahua.xiananDao.SearchMapper; |
22 | 22 | import com.example.dahua.xiananDao.SendRecordDao; |
23 | 23 | import com.example.dahua.xstDao.MessageDao; |
24 | +import com.google.gson.Gson; | |
24 | 25 | import com.sun.jna.Pointer; |
25 | 26 | import com.sun.jna.ptr.IntByReference; |
26 | 27 | import lombok.extern.slf4j.Slf4j; |
... | ... | @@ -219,10 +220,7 @@ public class MyTask implements ApplicationRunner { |
219 | 220 | //设备id |
220 | 221 | String deviceId = ""; |
221 | 222 | try { |
222 | - deviceId = new String(buffer1, "GBK").trim(); | |
223 | - log.info("设备GBK心跳:" + deviceId); | |
224 | 223 | deviceId = new String(buffer1, "UTF-8").trim(); |
225 | - log.info("设备UTF-8心跳:" + deviceId); | |
226 | 224 | } catch (UnsupportedEncodingException e) { |
227 | 225 | e.printStackTrace(); |
228 | 226 | } |
... | ... | @@ -436,7 +434,6 @@ public class MyTask implements ApplicationRunner { |
436 | 434 | if(cardBean ==null){ |
437 | 435 | return -1; |
438 | 436 | } |
439 | - | |
440 | 437 | // 缓存抓拍人脸 |
441 | 438 | String fileName = StringUtils.isEmpty(userId)? card + ".png" : userId + ".png"; |
442 | 439 | String snapPicPath = path + "\\" + fileName; |
... | ... | @@ -451,7 +448,7 @@ public class MyTask implements ApplicationRunner { |
451 | 448 | //关联设备信息 |
452 | 449 | AttendanceBean attendanceBean = myTaskUtil.userDao.getTypeByClint_id(szSn); |
453 | 450 | if(attendanceBean !=null){ |
454 | - if(StringUtils.isEmpty(attendanceBean.getSchool_id())){ | |
451 | + if(!StringUtils.isEmpty(attendanceBean.getSchool_id())){ | |
455 | 452 | int schoolId = Integer.parseInt(attendanceBean.getSchool_id()); |
456 | 453 | //门禁进出类型:1进0出 |
457 | 454 | int eventType = 0; |
... | ... | @@ -481,13 +478,16 @@ public class MyTask implements ApplicationRunner { |
481 | 478 | //刷卡结果,1表示成功, 0表示失败 |
482 | 479 | int status = msg.bStatus; |
483 | 480 | |
481 | + log.info("考勤状态:{},学校:{},设备ID: {},学生信息:{}",status,schoolId,szSn,new Gson().toJson(userInfoBean)); | |
484 | 482 | if(szSn.startsWith("ytj")) { |
485 | - //保存考勤记录 | |
486 | - kaoQinRecord(status, eventType, card, szSn, eventTime,lAnalyzerHandle); | |
487 | - // 艺校考勤 | |
488 | - if(schoolId ==12 && status ==1){ | |
483 | + log.info("考勤进来了,学校:{},设备ID: {},学生信息:{}",schoolId,szSn,new Gson().toJson(userInfoBean)); | |
484 | + // 艺校考勤OA | |
485 | + if(schoolId == 12 && status ==1){ | |
489 | 486 | int intOrOut = eventType ==1? 1 : 2; |
490 | 487 | sendRecordToSXYX(userInfoBean.getName(),userInfoBean.getUser_id(),intOrOut,eventTime); |
488 | + }else{ | |
489 | + //保存考勤记录 | |
490 | + kaoQinRecord(status, eventType, card, szSn, eventTime,lAnalyzerHandle); | |
491 | 491 | } |
492 | 492 | } |
493 | 493 | } |
... | ... | @@ -727,7 +727,7 @@ public class MyTask implements ApplicationRunner { |
727 | 727 | log.info("设备id: {},关联placeId: {},未查询到关联看板设备。",deviceId,placeId); |
728 | 728 | return; |
729 | 729 | } |
730 | - log.info("设备ID集: "+ JsonUtils.nonDefaultMapper().toJson(kanbanIds)); | |
730 | +// log.info("设备ID集: "+ JsonUtils.nonDefaultMapper().toJson(kanbanIds)); | |
731 | 731 | for (String kanbanId : kanbanIds) { |
732 | 732 | String data = "{\"cmd\":\"" + 34 + "\",\"clientId\":\"" + kanbanId + "\",\"data\":{\"cardNum\":\"" + cardNum + "\",\"inOrOut\":\"" + inOrOut + "\"}}"; |
733 | 733 | // log.info("====== 开始推送看板======, kanbanId = {}, cardNum = {},content ={}",kanbanId,cardNum,data); |
... | ... | @@ -745,7 +745,7 @@ public class MyTask implements ApplicationRunner { |
745 | 745 | log.info("学校下未查询到看板信息,学校id: {}",schoolId); |
746 | 746 | return; |
747 | 747 | } |
748 | - log.info("设备ID集: "+ JsonUtils.nonDefaultMapper().toJson(clintIds)); | |
748 | +// log.info("设备ID集: "+ JsonUtils.nonDefaultMapper().toJson(clintIds)); | |
749 | 749 | for (int i = 0; i < clintIds.size(); i++) { |
750 | 750 | String clintId = clintIds.get(i); |
751 | 751 | String data = "{\"cmd\":\"" + 34 + "\",\"clientId\":\"" + clintId + "\",\"data\":{\"cardNum\":\"" + cardNum + "\",\"inOrOut\":\"" + inOrOut + "\"}}"; |
... | ... | @@ -787,7 +787,7 @@ public class MyTask implements ApplicationRunner { |
787 | 787 | HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers); |
788 | 788 | ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class); |
789 | 789 | String body = response.getBody(); |
790 | - System.out.println(body); | |
790 | + log.info("请求艺校OA,返回信息: " + body); | |
791 | 791 | } catch (Exception e) { |
792 | 792 | sendRecordToSXYX(name,userId,intOrOut,eventTime); |
793 | 793 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/async/MyScheduledTask.java
... | ... | @@ -59,9 +59,6 @@ public class MyScheduledTask { |
59 | 59 | @Autowired |
60 | 60 | MyTask myTasks; |
61 | 61 | |
62 | -// @Value("${haikangpic}") | |
63 | -// private String haikangpic; | |
64 | - | |
65 | 62 | public static boolean isSendHaikang = false; |
66 | 63 | |
67 | 64 | public static boolean isSendWeigeng = false; |
... | ... | @@ -75,24 +72,9 @@ public class MyScheduledTask { |
75 | 72 | private String imgFilPath = "C:\\EhomePicServer";//抓拍图片路径 |
76 | 73 | |
77 | 74 | @Scheduled(fixedRate = 5000) |
78 | - private void deleteFace() throws InterruptedException { | |
75 | + private void deleteFace(){ | |
79 | 76 | //删除抓拍人脸 |
80 | 77 | deleteFaceImg(); |
81 | - | |
82 | -// /** | |
83 | -// * 目前分三个时间段(9:00-10:00) (13:00-14:00)(22:00-5:00)进行补发操作 | |
84 | -// */ | |
85 | -// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH"); | |
86 | -// int hour = Integer.parseInt(simpleDateFormat.format(new Date())); | |
87 | -// | |
88 | -// if (hour >= 9 && hour < 11) { | |
89 | -// dealData(); | |
90 | -// } else if (hour >= 13 && hour < 14) { | |
91 | -// dealData(); | |
92 | -// } else if (hour >= 20 || hour < 5) { | |
93 | -// dealData(); | |
94 | -// } | |
95 | - | |
96 | 78 | } |
97 | 79 | |
98 | 80 | /** |
... | ... | @@ -109,96 +91,17 @@ public class MyScheduledTask { |
109 | 91 | } |
110 | 92 | } |
111 | 93 | |
112 | - @Autowired | |
113 | - private UserOperateService userOperateService; | |
114 | - @Autowired | |
115 | - private SearchMapper searchMapper; | |
116 | -// /** | |
117 | -// * 订阅任务 20秒执行一次 | |
118 | -// */ | |
119 | -// @Scheduled(cron = "0 51 18 * * ?") | |
120 | -// protected synchronized void task(){ | |
121 | -// log.info("开始执行----- 晚上到寝"); | |
122 | -// //男 | |
123 | -// Integer schoolId=27; | |
124 | -// Integer roomId =12226; | |
125 | -// Integer type = 7; | |
126 | -// Integer outof = 1; | |
127 | -// String clintId="253169192"; | |
128 | -// String timeIds = "2021-01-08,2021-01-11,2021-01-12,2021-01-13,2021-01-14,2021-01-15,2021-01-18,2021-01-19,2021-01-20,2021-01-21,2021-01-22"; | |
129 | -// String[] deviceArr = timeIds.split(","); | |
130 | -// List<String> deviceList= new ArrayList<>(Arrays.asList(deviceArr)); | |
131 | -// //启用多线程执行 | |
132 | -// CountDownLatch begin = new CountDownLatch(1); | |
133 | -// CountDownLatch end = new CountDownLatch(deviceList.size()); | |
134 | -// ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("thread-sendFace-runner-%d").build(); | |
135 | -// ExecutorService exe = new ThreadPoolExecutor(4,8,0L, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>(),namedThreadFactory); | |
136 | -// for(String s : deviceList){ | |
137 | -// String intime = s + " 20:26:14"; | |
138 | -// String startTime= s + " 00:00:00"; | |
139 | -// String endTime = s+" 23:59:59"; | |
140 | -// exe.execute(new SendFaceBatchTask100(userDao,sendRecordDao,searchMapper,schoolId,roomId,type,outof,intime,clintId,startTime,endTime,begin,end)); | |
141 | -// } | |
142 | -// begin.countDown(); | |
143 | -// try { | |
144 | -// end.await(); | |
145 | -// }catch (Exception e){ | |
146 | -// log.error("失败"+e); | |
147 | -// } | |
148 | -// exe.shutdown(); | |
149 | -// log.info("统计100服务器总共有"+deviceList.size()+"个设备,处理完毕"); | |
150 | -// } | |
151 | -// | |
152 | -// // @Scheduled(cron = "0 50 15 * * ?") | |
153 | -// @Scheduled(cron = "0 09 21 * * ?") | |
154 | -// protected synchronized void task2(){ | |
155 | -// log.info("开始执行----- 晚上到寝"); | |
156 | -// //男 | |
157 | -// Integer schoolId=27; | |
158 | -// Integer roomId =12226; | |
159 | -// Integer type = 4; | |
160 | -// Integer outof = 1; | |
161 | -// String clintId="253169212"; | |
162 | -// String timeIds = "2021-01-08,2021-01-11,2021-01-12,2021-01-13,2021-01-14,2021-01-15,2021-01-18,2021-01-19,2021-01-20,2021-01-21,2021-01-22"; | |
163 | -// String[] deviceArr = timeIds.split(","); | |
164 | -// List<String> deviceList= new ArrayList<>(Arrays.asList(deviceArr)); | |
165 | -// //启用多线程执行 | |
166 | -// CountDownLatch begin = new CountDownLatch(1); | |
167 | -// CountDownLatch end = new CountDownLatch(deviceList.size()); | |
168 | -// ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("thread-sendFace-runner-%d").build(); | |
169 | -// ExecutorService exe = new ThreadPoolExecutor(8,16,0L, TimeUnit.MILLISECONDS,new LinkedBlockingQueue<Runnable>(),namedThreadFactory); | |
170 | -// for(String s : deviceList){ | |
171 | -//// String intime = s + " 06:03:39"; | |
172 | -//// String startTime= s + " 00:00:00"; | |
173 | -//// String endTime = s+" 23:59:59"; | |
174 | -// String intime = s + " 17:14:39"; | |
175 | -// String startTime= s + " 00:00:00"; | |
176 | -// String endTime = s+" 23:59:59"; | |
177 | -// exe.execute(new SendFaceBatchTask2(userDao,sendRecordDao,searchMapper,schoolId,roomId,type,outof,intime,clintId,startTime,endTime,begin,end)); | |
178 | -// } | |
179 | -// begin.countDown(); | |
180 | -// try { | |
181 | -// end.await(); | |
182 | -// }catch (Exception e){ | |
183 | -// log.error("失败"+e); | |
184 | -// } | |
185 | -// exe.shutdown(); | |
186 | -// log.info("统计100服务器总共有"+deviceList.size()+"个设备,处理完毕"); | |
187 | -// } | |
188 | - | |
189 | 94 | /** |
190 | 95 | * 定期删除人脸抓拍图片 |
191 | 96 | */ |
192 | 97 | private void deleteFaceImg() { |
193 | - | |
194 | 98 | String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
195 | -// System.out.println("deleteDate:" + deleteDate); | |
196 | 99 | if (!deleteDate.equals(date)) { |
197 | 100 | deleteDate = date; |
198 | 101 | File file = new File(imgFilPath); |
199 | 102 | File[] files = file.listFiles(); |
200 | 103 | Date currentDate = new Date(); |
201 | - if (null != files) | |
104 | + if (null != files) { | |
202 | 105 | for (int i = 0; i < files.length; i++) { |
203 | 106 | File imgFile = files[i]; |
204 | 107 | String name = imgFile.getName().split("\\.")[0]; |
... | ... | @@ -220,47 +123,11 @@ public class MyScheduledTask { |
220 | 123 | |
221 | 124 | } catch (ParseException e) { |
222 | 125 | imgFile.delete(); |
223 | -// e.printStackTrace(); | |
126 | + e.printStackTrace(); | |
224 | 127 | } |
225 | - | |
226 | 128 | } |
227 | - | |
228 | - } | |
229 | - | |
230 | - } | |
231 | - | |
232 | - private synchronized void dealData() { | |
233 | - | |
234 | - String ip = new Utils().getHostAddress(); | |
235 | - System.out.println("ip:" + ip); | |
236 | - if (ip.startsWith("192") || ip.contains("172.16.247.64")) | |
237 | - return; | |
238 | - | |
239 | - /** | |
240 | - * 微耕 | |
241 | - */ | |
242 | -//System.out.println("isSendWeigeng:"+isSendWeigeng+"isSendHaikang:"+isSendHaikang+"isSendDahua:"+isSendDahua); | |
243 | - if (!isSendWeigeng) { | |
244 | - isSendWeigeng = true; | |
245 | - sendUserInfoTask.addWeiGen(); | |
246 | - } | |
247 | - | |
248 | - /** | |
249 | - * 海康 | |
250 | - */ | |
251 | - if (!isSendHaikang) { | |
252 | - isSendHaikang = true; | |
253 | - sendUserInfoTask.addHaikangface(); | |
254 | - } | |
255 | - | |
256 | - /** | |
257 | - * 大华人脸 | |
258 | - */ | |
259 | - if (!isSendDahua) { | |
260 | - isSendDahua = true; | |
261 | - sendUserInfoTask.addDahuaFace(); | |
129 | + } | |
262 | 130 | } |
263 | - | |
264 | 131 | } |
265 | 132 | |
266 | 133 | boolean isSendMQ = false; |
... | ... | @@ -344,7 +211,7 @@ public class MyScheduledTask { |
344 | 211 | //关联的显示看板设备 |
345 | 212 | List<String> kanbanIds = new ArrayList<>(); |
346 | 213 | if(!StringUtils.isEmpty(placeId)) { |
347 | - log.info("关联场景ID: {},考勤设备ID:{}",placeId,qiandaoDevId); | |
214 | +// log.info("关联场景ID: {},考勤设备ID:{}",placeId,qiandaoDevId); | |
348 | 215 | kanbanIds = userDao.getKanBanIdWithPlaceId(placeId); |
349 | 216 | }else{ |
350 | 217 | List<String> kBIds = userDao.getClintIds(schoolId); |
... | ... | @@ -362,7 +229,7 @@ public class MyScheduledTask { |
362 | 229 | String clintId = kanbanIds.get(i); |
363 | 230 | String data = "{\"cmd\":\"" + 34 + "\",\"clientId\":\"" + clintId + "\",\"data\":{\"cardNum\":\"" + cardNum + "\",\"inOrOut\":\"" + inOrOut + "\"}}"; |
364 | 231 | mqttManager.sendMqQD(clintId, data); |
365 | - log.info("发送微耕考勤消息:学校ID: {},设备ID: {},关联看板room: {},",schoolId,clintId,placeId); | |
232 | +// log.info("发送微耕考勤消息:学校ID: {},设备ID: {},关联看板room: {},",schoolId,clintId,placeId); | |
366 | 233 | } |
367 | 234 | } |
368 | 235 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/bean/yx/ImportStudent.java
0 → 100644
... | ... | @@ -0,0 +1,77 @@ |
1 | +package com.example.dahua.bean.yx; | |
2 | + | |
3 | +public class ImportStudent { | |
4 | + | |
5 | + private Integer id; | |
6 | + private String name; | |
7 | + private String userId; | |
8 | + private String cardNum; | |
9 | + private String sceneName; | |
10 | + private Integer schoolId; | |
11 | + private String photo; | |
12 | + private String studentCode; | |
13 | + | |
14 | + public Integer getId() { | |
15 | + return id; | |
16 | + } | |
17 | + | |
18 | + public void setId(Integer id) { | |
19 | + this.id = id; | |
20 | + } | |
21 | + | |
22 | + public String getName() { | |
23 | + return name; | |
24 | + } | |
25 | + | |
26 | + public void setName(String name) { | |
27 | + this.name = name; | |
28 | + } | |
29 | + | |
30 | + public String getUserId() { | |
31 | + return userId; | |
32 | + } | |
33 | + | |
34 | + public void setUserId(String userId) { | |
35 | + this.userId = userId; | |
36 | + } | |
37 | + | |
38 | + public String getCardNum() { | |
39 | + return cardNum; | |
40 | + } | |
41 | + | |
42 | + public void setCardNum(String cardNum) { | |
43 | + this.cardNum = cardNum; | |
44 | + } | |
45 | + | |
46 | + public String getSceneName() { | |
47 | + return sceneName; | |
48 | + } | |
49 | + | |
50 | + public void setSceneName(String sceneName) { | |
51 | + this.sceneName = sceneName; | |
52 | + } | |
53 | + | |
54 | + public Integer getSchoolId() { | |
55 | + return schoolId; | |
56 | + } | |
57 | + | |
58 | + public void setSchoolId(Integer schoolId) { | |
59 | + this.schoolId = schoolId; | |
60 | + } | |
61 | + | |
62 | + public String getPhoto() { | |
63 | + return photo; | |
64 | + } | |
65 | + | |
66 | + public void setPhoto(String photo) { | |
67 | + this.photo = photo; | |
68 | + } | |
69 | + | |
70 | + public String getStudentCode() { | |
71 | + return studentCode; | |
72 | + } | |
73 | + | |
74 | + public void setStudentCode(String studentCode) { | |
75 | + this.studentCode = studentCode; | |
76 | + } | |
77 | +} | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/bean/yx/YxSendFaceDto.java
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +package com.example.dahua.bean.yx; | |
2 | + | |
3 | +import io.swagger.annotations.ApiModelProperty; | |
4 | + | |
5 | +/** | |
6 | + * 照片下发人脸实体类 | |
7 | + * @author xuquan | |
8 | + * @date 2020/12/16 09:10 | |
9 | + */ | |
10 | +public class YxSendFaceDto { | |
11 | + | |
12 | + @ApiModelProperty("学校ID") | |
13 | + private Integer schoolId ; | |
14 | + @ApiModelProperty("设备号,逗号隔开") | |
15 | + private String sNos; | |
16 | + @ApiModelProperty("区域名称") | |
17 | + private String sceneName; | |
18 | + | |
19 | + public Integer getSchoolId() { | |
20 | + return schoolId; | |
21 | + } | |
22 | + | |
23 | + public void setSchoolId(Integer schoolId) { | |
24 | + this.schoolId = schoolId; | |
25 | + } | |
26 | + | |
27 | + public String getsNos() { | |
28 | + return sNos; | |
29 | + } | |
30 | + | |
31 | + public void setsNos(String sNos) { | |
32 | + this.sNos = sNos; | |
33 | + } | |
34 | + | |
35 | + public String getSceneName() { | |
36 | + return sceneName; | |
37 | + } | |
38 | + | |
39 | + public void setSceneName(String sceneName) { | |
40 | + this.sceneName = sceneName; | |
41 | + } | |
42 | +} | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/control/UserOperateController.java
1 | 1 | package com.example.dahua.control; |
2 | 2 | |
3 | 3 | import com.example.dahua.async.SendUserInfoTask2; |
4 | -import com.example.dahua.bean.StudentBean; | |
4 | +import com.example.dahua.bean.yx.Result; | |
5 | +import com.example.dahua.bean.yx.YxSendFaceDto; | |
5 | 6 | import com.example.dahua.dao.UserDao; |
6 | 7 | import com.example.dahua.service.UserOperateService; |
7 | 8 | import com.example.dahua.service.imp.BaseService; |
8 | -import com.example.dahua.utils.HttpUtil; | |
9 | +import com.example.dahua.utils.ExcelUtil; | |
9 | 10 | import com.example.dahua.utils.HttpUtils; |
10 | -import io.micrometer.core.instrument.util.StringUtils; | |
11 | +import com.example.dahua.utils.ReadExcelUtil; | |
11 | 12 | import io.swagger.annotations.Api; |
12 | 13 | import io.swagger.annotations.ApiOperation; |
13 | 14 | import lombok.extern.slf4j.Slf4j; |
14 | -import org.apache.commons.collections4.CollectionUtils; | |
15 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
16 | 16 | import org.springframework.http.MediaType; |
17 | -import org.springframework.web.bind.annotation.RequestMapping; | |
18 | -import org.springframework.web.bind.annotation.RequestMethod; | |
19 | -import org.springframework.web.bind.annotation.RequestParam; | |
20 | -import org.springframework.web.bind.annotation.RestController; | |
17 | +import org.springframework.web.bind.annotation.*; | |
18 | +import org.springframework.web.multipart.MultipartFile; | |
19 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
21 | 20 | |
21 | +import javax.servlet.http.HttpServletRequest; | |
22 | +import java.io.IOException; | |
23 | +import java.io.InputStream; | |
24 | +import java.util.ArrayList; | |
22 | 25 | import java.util.List; |
23 | 26 | |
24 | 27 | /** |
... | ... | @@ -98,4 +101,27 @@ public class UserOperateController { |
98 | 101 | @RequestParam(value = "deviceIds",required = false) String deviceIds){ |
99 | 102 | userOperateService.deleteFaceByClassId(schoolId,deviceIds); |
100 | 103 | } |
104 | + | |
105 | + @ApiOperation(value = "导入学生信息") | |
106 | + @RequestMapping(value = "importStudent", method = RequestMethod.POST) | |
107 | + public void importExcel(@RequestParam(value="studentFile") MultipartFile file,HttpServletRequest request){ | |
108 | + List<ArrayList<String>> readExcel = new ArrayList<>(); | |
109 | + try { | |
110 | + readExcel = new ReadExcelUtil().readExcel(file); | |
111 | + } catch (IOException e) { | |
112 | + e.printStackTrace(); | |
113 | + } | |
114 | + String originalFileName = file.getOriginalFilename(); | |
115 | + int beginIndex = originalFileName.lastIndexOf("."); | |
116 | + //原名 | |
117 | + String fileName = originalFileName.substring(0,beginIndex); | |
118 | + | |
119 | + userOperateService.saveStudentInfo(readExcel, fileName); | |
120 | + } | |
121 | + | |
122 | + @ApiOperation(value = "艺校照片特定下发") | |
123 | + @RequestMapping(value = "sendYxFace", method = RequestMethod.POST) | |
124 | + public Result sendFaceByThread(@RequestBody YxSendFaceDto sendFaceDto) { | |
125 | + return userOperateService.sendYxUserFace(sendFaceDto); | |
126 | + } | |
101 | 127 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/dao/UserDao.java
1 | 1 | package com.example.dahua.dao; |
2 | 2 | |
3 | 3 | import com.example.dahua.bean.*; |
4 | +import com.example.dahua.bean.yx.ImportStudent; | |
4 | 5 | import org.apache.ibatis.annotations.*; |
5 | 6 | import org.springframework.stereotype.Repository; |
6 | 7 | |
... | ... | @@ -100,6 +101,9 @@ public interface UserDao { |
100 | 101 | @Select(" select * from SZ_V_School_Student where student_num = #{student_num} and name = #{name}") |
101 | 102 | UserInfoBean getStudent(@Param("student_num") String student_num, @Param("name") String name); |
102 | 103 | |
104 | + @Select(" select Top(1) * from SZ_V_School_Student where school_id = #{schoolId} and name = #{name}") | |
105 | + UserInfoBean getStudentByName(@Param("schoolId") Integer schoolId, @Param("name") String name); | |
106 | + | |
103 | 107 | @Select(" select * from SZ_V_School_Student where school_id = #{school_id} and sex = #{sex} and student_type = #{student_type}") |
104 | 108 | List<UserInfoBean> getStudentWithSchoolId(@Param("school_id") String school_id, @Param("sex") String sex, @Param("student_type") String student_type); |
105 | 109 | |
... | ... | @@ -281,4 +285,10 @@ public interface UserDao { |
281 | 285 | List<StudentBean> getStudentByClassId(@Param("schoolId") int schoolId,@Param("classIds") List<Integer> classIds); |
282 | 286 | |
283 | 287 | List<Integer> getGroupByClassId(@Param("classId") Integer classId); |
288 | + | |
289 | + void insertStudent(ImportStudent studentBak); | |
290 | + | |
291 | + List<ImportStudent> selectYxStudentList(@Param("sceneName") String sceneName,@Param("schoolId") Integer schoolId); | |
292 | + | |
293 | + List<ImportStudent> selectStudentList(); | |
284 | 294 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/service/UserOperateService.java
1 | 1 | package com.example.dahua.service; |
2 | 2 | |
3 | 3 | |
4 | +import com.example.dahua.bean.yx.Result; | |
5 | +import com.example.dahua.bean.yx.YxSendFaceDto; | |
6 | + | |
7 | +import java.util.ArrayList; | |
8 | +import java.util.List; | |
9 | + | |
4 | 10 | /** |
5 | 11 | * 下发用户信息、人脸、卡、权限接口 |
6 | 12 | * @author xuquan |
... | ... | @@ -23,4 +29,13 @@ public interface UserOperateService { |
23 | 29 | void deleteFaceByClassId(Integer schoolId,String deviceIds); |
24 | 30 | |
25 | 31 | void test6(Integer schoolId,Integer roomId,Integer type,Integer outof,String intime,String clintId,String startTime,String endTime); |
32 | + | |
33 | + void saveStudentInfo(List<ArrayList<String>> readExcel, String fileName); | |
34 | + | |
35 | + /** | |
36 | + * 多线程照片下发 | |
37 | + * @param sendFaceDto | |
38 | + * @return | |
39 | + */ | |
40 | + Result sendYxUserFace(YxSendFaceDto sendFaceDto); | |
26 | 41 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/service/imp/BaseService.java
... | ... | @@ -3,6 +3,7 @@ package com.example.dahua.service.imp; |
3 | 3 | |
4 | 4 | import com.example.dahua.bean.SendRecordBean; |
5 | 5 | import com.example.dahua.bean.StudentBean; |
6 | +import com.example.dahua.bean.yx.ImportStudent; | |
6 | 7 | import com.example.dahua.dao.UserDao; |
7 | 8 | import com.example.dahua.xiananDao.SendRecordDao; |
8 | 9 | import lombok.extern.slf4j.Slf4j; |
... | ... | @@ -162,4 +163,17 @@ public class BaseService { |
162 | 163 | Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SendRecordBean::getNum))),ArrayList::new)); |
163 | 164 | return studentList; |
164 | 165 | } |
166 | + | |
167 | + /** | |
168 | + * 获取学校下的老师数据信息 | |
169 | + * @param schoolId | |
170 | + * @return | |
171 | + */ | |
172 | + public List<ImportStudent> getYxStudentList(Integer schoolId, String sceneName) { | |
173 | + List<ImportStudent> students = userDao.selectYxStudentList(sceneName,schoolId); | |
174 | + //去重重复数据 | |
175 | + List<ImportStudent> teacherist = students.stream().collect(Collectors.collectingAndThen( | |
176 | + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ImportStudent::getCardNum))), ArrayList::new)); | |
177 | + return teacherist; | |
178 | + } | |
165 | 179 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserOperateServiceImpl.java
... | ... | @@ -4,6 +4,10 @@ import com.example.dahua.MyTask; |
4 | 4 | import com.example.dahua.bean.SendRecordBean; |
5 | 5 | import com.example.dahua.bean.StudentBean; |
6 | 6 | import com.example.dahua.bean.UserInfoBean; |
7 | +import com.example.dahua.bean.yx.ImportStudent; | |
8 | +import com.example.dahua.bean.yx.Result; | |
9 | +import com.example.dahua.bean.yx.ResultGenerator; | |
10 | +import com.example.dahua.bean.yx.YxSendFaceDto; | |
7 | 11 | import com.example.dahua.dao.UserDao; |
8 | 12 | import com.example.dahua.lib.CompressPic; |
9 | 13 | import com.example.dahua.lib.FilePath; |
... | ... | @@ -16,12 +20,14 @@ import com.example.dahua.utils.HttpUtils; |
16 | 20 | import com.example.dahua.xiananDao.SearchMapper; |
17 | 21 | import com.example.dahua.xiananDao.SendRecordDao; |
18 | 22 | import lombok.extern.slf4j.Slf4j; |
23 | +import org.springframework.beans.BeanUtils; | |
19 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
20 | 25 | import org.springframework.stereotype.Service; |
21 | 26 | import org.springframework.util.CollectionUtils; |
22 | 27 | import org.springframework.util.StringUtils; |
23 | 28 | |
24 | 29 | import java.io.File; |
30 | +import java.text.SimpleDateFormat; | |
25 | 31 | import java.util.*; |
26 | 32 | import java.util.stream.Collectors; |
27 | 33 | |
... | ... | @@ -59,7 +65,7 @@ public class UserOperateServiceImpl implements UserOperateService { |
59 | 65 | studentBeanList = baseService.getTeacherList(schoolId); |
60 | 66 | } |
61 | 67 | log.info("下发用户总数:"+studentBeanList.size()); |
62 | - //下發人臉 | |
68 | + //下发人脸 | |
63 | 69 | sendFace(studentBeanList,deviceList,schoolId,userType); |
64 | 70 | } |
65 | 71 | |
... | ... | @@ -228,4 +234,71 @@ public class UserOperateServiceImpl implements UserOperateService { |
228 | 234 | } |
229 | 235 | } |
230 | 236 | } |
237 | + | |
238 | + @Override | |
239 | + public void saveStudentInfo(List<ArrayList<String>> readExcel, String fileName) { | |
240 | + // 读取数据封装实体 | |
241 | + if(readExcel.size() == 0) { | |
242 | + log.error("未解析到数据。"); | |
243 | + return; | |
244 | + } | |
245 | + List<ImportStudent> doList = new ArrayList<>(); | |
246 | + //将解析的Excel数据集合封装到实体, | |
247 | + for(List<String> sList : readExcel) { | |
248 | + ImportStudent importStudent = new ImportStudent(); | |
249 | + int count = 0 ; | |
250 | + for (String str : sList){ | |
251 | + if(0 == count){ | |
252 | + importStudent.setSceneName(str); | |
253 | + } | |
254 | + if(3 == count) { | |
255 | + UserInfoBean userInfoBean = userDao.getStudentByName(12,str); | |
256 | + if(userInfoBean !=null){ | |
257 | + importStudent.setSchoolId(12); | |
258 | + importStudent.setCardNum(userInfoBean.getStudent_num()); | |
259 | + importStudent.setName(userInfoBean.getName()); | |
260 | + importStudent.setUserId(userInfoBean.getUser_id()); | |
261 | + importStudent.setPhoto(userInfoBean.getPhoto()); | |
262 | + importStudent.setStudentCode(userInfoBean.getStudentcode()); | |
263 | + } | |
264 | + } | |
265 | + count ++; | |
266 | + } | |
267 | + doList.add(importStudent); | |
268 | + } | |
269 | + if(doList.size() > 0) { | |
270 | + for(ImportStudent importStudent : doList) { | |
271 | + userDao.insertStudent(importStudent); | |
272 | + } | |
273 | + } | |
274 | + } | |
275 | + | |
276 | + @Override | |
277 | + public Result sendYxUserFace(YxSendFaceDto sendFaceDto) { | |
278 | + //下发设备集合 | |
279 | + String[] deviceArr = sendFaceDto.getsNos().split(","); | |
280 | + List<String> deviceList= new ArrayList<>(Arrays.asList(deviceArr)); | |
281 | + if(deviceList.size()<1){ | |
282 | + return ResultGenerator.genFailResult("未选择下发设备"); | |
283 | + } | |
284 | + Integer schoolId = sendFaceDto.getSchoolId(); | |
285 | + String sceneName = sendFaceDto.getSceneName(); | |
286 | + //根据类型获取下发用户信息 | |
287 | + List<ImportStudent> studentBeanList = baseService.getYxStudentList(schoolId,sceneName); | |
288 | + log.info("统计共有下发用户数量:{}",studentBeanList.size()); | |
289 | + List<StudentBean> dtoList = studentBeanList.stream() | |
290 | + .filter(e -> !StringUtils.isEmpty(e.getPhoto())) | |
291 | + .map(e -> { | |
292 | + StudentBean d = new StudentBean(); | |
293 | + d.setSchool_id(e.getSchoolId()); | |
294 | + d.setPhoto(e.getPhoto()); | |
295 | + d.setName(e.getName()); | |
296 | + d.setStudentcode(e.getStudentCode()); | |
297 | + return d; | |
298 | + }) | |
299 | + .collect(Collectors.toList()); | |
300 | + //下发人脸 | |
301 | + sendFace(dtoList,deviceList,schoolId,2); | |
302 | + return ResultGenerator.genSuccessResult(); | |
303 | + } | |
231 | 304 | } | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/utils/ExcelUtil.java
0 → 100644
... | ... | @@ -0,0 +1,108 @@ |
1 | +package com.example.dahua.utils; | |
2 | + | |
3 | +import lombok.extern.slf4j.Slf4j; | |
4 | +import org.apache.poi.hssf.usermodel.HSSFCell; | |
5 | +import org.apache.poi.hssf.usermodel.HSSFDateUtil; | |
6 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
7 | +import org.apache.poi.ss.usermodel.*; | |
8 | +import org.apache.poi.xssf.usermodel.XSSFCell; | |
9 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
10 | + | |
11 | +import java.io.InputStream; | |
12 | +import java.text.DecimalFormat; | |
13 | +import java.text.SimpleDateFormat; | |
14 | +import java.util.ArrayList; | |
15 | +import java.util.Calendar; | |
16 | +import java.util.Date; | |
17 | +import java.util.List; | |
18 | + | |
19 | +/** | |
20 | + * excel工具类 | |
21 | + */ | |
22 | +@Slf4j | |
23 | +public class ExcelUtil { | |
24 | + | |
25 | + public static final String OFFICE_EXCEL_2003_POSTFIX = "xls"; | |
26 | + public static final String OFFICE_EXCEL_2010_POSTFIX = "xlsx"; | |
27 | + public static final String EMPTY = ""; | |
28 | + public static final String POINT = "."; | |
29 | + public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); | |
30 | + | |
31 | + /** | |
32 | + * 获得path的后缀名 | |
33 | + * @param path | |
34 | + * @return | |
35 | + */ | |
36 | + public static String getPostfix(String path){ | |
37 | + if(path==null || EMPTY.equals(path.trim())){ | |
38 | + return EMPTY; | |
39 | + } | |
40 | + if(path.contains(POINT)){ | |
41 | + return path.substring(path.lastIndexOf(POINT)+1,path.length()); | |
42 | + } | |
43 | + return EMPTY; | |
44 | + } | |
45 | + /** | |
46 | + * 单元格格式 | |
47 | + * @param hssfCell | |
48 | + * @return | |
49 | + */ | |
50 | + @SuppressWarnings({ "static-access", "deprecation" }) | |
51 | + public static String getHValue(HSSFCell hssfCell){ | |
52 | + if (hssfCell.getCellType() == hssfCell.CELL_TYPE_BOOLEAN) { | |
53 | + return String.valueOf(hssfCell.getBooleanCellValue()); | |
54 | + } else if (hssfCell.getCellType() == hssfCell.CELL_TYPE_NUMERIC) { | |
55 | + String cellValue = ""; | |
56 | + if(HSSFDateUtil.isCellDateFormatted(hssfCell)){ | |
57 | + Date date = HSSFDateUtil.getJavaDate(hssfCell.getNumericCellValue()); | |
58 | + cellValue = sdf.format(date); | |
59 | + }else{ | |
60 | + DecimalFormat df = new DecimalFormat("#.##"); | |
61 | + cellValue = df.format(hssfCell.getNumericCellValue()); | |
62 | + String strArr = cellValue.substring(cellValue.lastIndexOf(POINT)+1,cellValue.length()); | |
63 | + if(strArr.equals("00")){ | |
64 | + cellValue = cellValue.substring(0, cellValue.lastIndexOf(POINT)); | |
65 | + } | |
66 | + } | |
67 | + return cellValue; | |
68 | + } else { | |
69 | + return String.valueOf(hssfCell.getStringCellValue()); | |
70 | + } | |
71 | + } | |
72 | + /** | |
73 | + * 单元格格式 | |
74 | + * @param xssfCell | |
75 | + * @return | |
76 | + */ | |
77 | + public static String getXValue(XSSFCell xssfCell){ | |
78 | + if (xssfCell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { | |
79 | + return String.valueOf(xssfCell.getBooleanCellValue()); | |
80 | + } else if (xssfCell.getCellType() == Cell.CELL_TYPE_NUMERIC) { | |
81 | + String cellValue = ""; | |
82 | + if(XSSFDateUtil.isCellDateFormatted(xssfCell)){ | |
83 | + Date date = XSSFDateUtil.getJavaDate(xssfCell.getNumericCellValue()); | |
84 | + cellValue = sdf.format(date); | |
85 | + }else{ | |
86 | + DecimalFormat df = new DecimalFormat("#.##"); | |
87 | + cellValue = df.format(xssfCell.getNumericCellValue()); | |
88 | + String strArr = cellValue.substring(cellValue.lastIndexOf(POINT)+1,cellValue.length()); | |
89 | + if(strArr.equals("00")){ | |
90 | + cellValue = cellValue.substring(0, cellValue.lastIndexOf(POINT)); | |
91 | + } | |
92 | + } | |
93 | + return cellValue; | |
94 | + } else { | |
95 | + return String.valueOf(xssfCell.getStringCellValue()); | |
96 | + } | |
97 | + } | |
98 | + /** | |
99 | + * 自定义xssf日期工具类 | |
100 | + * | |
101 | + */ | |
102 | + static class XSSFDateUtil extends DateUtil { | |
103 | + protected static int absoluteDay(Calendar cal, boolean use1904windowing) { | |
104 | + return DateUtil.absoluteDay(cal, use1904windowing); | |
105 | + } | |
106 | + } | |
107 | +} | |
108 | + | ... | ... |
cloud/dahua/src/main/java/com/example/dahua/utils/ReadExcelUtil.java
0 → 100644
... | ... | @@ -0,0 +1,161 @@ |
1 | +package com.example.dahua.utils; | |
2 | + | |
3 | +import org.apache.poi.hssf.usermodel.HSSFCell; | |
4 | +import org.apache.poi.hssf.usermodel.HSSFRow; | |
5 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | |
6 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
7 | +import org.apache.poi.xssf.usermodel.XSSFCell; | |
8 | +import org.apache.poi.xssf.usermodel.XSSFRow; | |
9 | +import org.apache.poi.xssf.usermodel.XSSFSheet; | |
10 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
11 | +import org.springframework.web.multipart.MultipartFile; | |
12 | + | |
13 | +import java.io.IOException; | |
14 | +import java.io.InputStream; | |
15 | +import java.util.ArrayList; | |
16 | +import java.util.List; | |
17 | + | |
18 | +public class ReadExcelUtil { | |
19 | + | |
20 | + public int totalRows; //sheet中总行数 | |
21 | + | |
22 | + public static int totalCells; //每一行总单元格数 | |
23 | + | |
24 | + /** | |
25 | + * read the Excel .xlsx,.xls | |
26 | + * @param file jsp中的上传文件 | |
27 | + * @return | |
28 | + * @throws IOException | |
29 | + */ | |
30 | + public List<ArrayList<String>> readExcel(MultipartFile file) throws IOException { | |
31 | + if(file==null||ExcelUtil.EMPTY.equals(file.getOriginalFilename().trim())){ | |
32 | + return null; | |
33 | + }else{ | |
34 | + String postfix = ExcelUtil.getPostfix(file.getOriginalFilename()); | |
35 | + if(!ExcelUtil.EMPTY.equals(postfix)){ | |
36 | + if(ExcelUtil.OFFICE_EXCEL_2003_POSTFIX.equals(postfix)){ | |
37 | + return readXls(file); | |
38 | + }else if(ExcelUtil.OFFICE_EXCEL_2010_POSTFIX.equals(postfix)){ | |
39 | + return readXlsx(file); | |
40 | + }else{ | |
41 | + return null; | |
42 | + } | |
43 | + } | |
44 | + } | |
45 | + return null; | |
46 | + } | |
47 | + /** | |
48 | + * read the Excel 2010 .xlsx | |
49 | + * @param file | |
50 | + * @return | |
51 | + * @throws IOException | |
52 | + */ | |
53 | + @SuppressWarnings("deprecation") | |
54 | + public List<ArrayList<String>> readXlsx(MultipartFile file){ | |
55 | + List<ArrayList<String>> list = new ArrayList<ArrayList<String>>(); | |
56 | + // IO流读取文件 | |
57 | + InputStream input = null; | |
58 | + XSSFWorkbook wb = null; | |
59 | + ArrayList<String> rowList = null; | |
60 | + try { | |
61 | + input = file.getInputStream(); | |
62 | + // 创建文档 | |
63 | + wb = new XSSFWorkbook(input); | |
64 | + //读取sheet(页) | |
65 | + for(int numSheet=0;numSheet<wb.getNumberOfSheets();numSheet++){ | |
66 | + XSSFSheet xssfSheet = wb.getSheetAt(numSheet); | |
67 | + if(xssfSheet == null){ | |
68 | + continue; | |
69 | + } | |
70 | + totalRows = xssfSheet.getLastRowNum(); | |
71 | + //读取Row,从第4行开始 | |
72 | + for(int rowNum = 1;rowNum <= totalRows;rowNum++){ | |
73 | + XSSFRow xssfRow = xssfSheet.getRow(rowNum); | |
74 | + if(xssfRow!=null){ | |
75 | + rowList = new ArrayList<String>(); | |
76 | + totalCells = xssfRow.getLastCellNum(); | |
77 | + //读取列,从第一列开始 | |
78 | + for(int c=0;c<=totalCells+1;c++){ | |
79 | + XSSFCell cell = xssfRow.getCell(c); | |
80 | + if(cell==null){ | |
81 | + rowList.add(ExcelUtil.EMPTY); | |
82 | + continue; | |
83 | + } | |
84 | + rowList.add(ExcelUtil.getXValue(cell).trim()); | |
85 | + } | |
86 | + list.add(rowList); | |
87 | + } | |
88 | + } | |
89 | + } | |
90 | + return list; | |
91 | + } catch (IOException e) { | |
92 | + e.printStackTrace(); | |
93 | + } finally{ | |
94 | + try { | |
95 | + input.close(); | |
96 | + } catch (IOException e) { | |
97 | + e.printStackTrace(); | |
98 | + } | |
99 | + } | |
100 | + return null; | |
101 | + | |
102 | + } | |
103 | + /** | |
104 | + * read the Excel 2003-2007 .xls | |
105 | + * @param file | |
106 | + * @return | |
107 | + * @throws IOException | |
108 | + */ | |
109 | + public List<ArrayList<String>> readXls(MultipartFile file){ | |
110 | + List<ArrayList<String>> list = new ArrayList<ArrayList<String>>(); | |
111 | + // IO流读取文件 | |
112 | + InputStream input = null; | |
113 | + HSSFWorkbook wb = null; | |
114 | + ArrayList<String> rowList = null; | |
115 | + try { | |
116 | + input = file.getInputStream(); | |
117 | + // 创建文档 | |
118 | + wb = new HSSFWorkbook(input); | |
119 | + //读取sheet(页) | |
120 | + for(int numSheet = 0; numSheet < wb.getNumberOfSheets(); numSheet++){ | |
121 | + HSSFSheet hssfSheet = wb.getSheetAt(numSheet); | |
122 | + String sheetName = hssfSheet.getSheetName(); | |
123 | + if(hssfSheet == null){ | |
124 | + continue; | |
125 | + } | |
126 | + totalRows = hssfSheet.getLastRowNum(); | |
127 | + //读取Row,从第二行开始 | |
128 | + for(int rowNum = 1;rowNum <= totalRows;rowNum++){ | |
129 | + HSSFRow hssfRow = hssfSheet.getRow(rowNum); | |
130 | + if(hssfRow!=null){ | |
131 | + rowList = new ArrayList<String>(); | |
132 | + totalCells = hssfRow.getLastCellNum(); | |
133 | + rowList.add(sheetName); | |
134 | + //读取列,从第一列开始 | |
135 | + for(short c=0;c<=totalCells+1;c++){ | |
136 | + HSSFCell cell = hssfRow.getCell(c); | |
137 | + if(cell==null){ | |
138 | +// rowList.add(ExcelUtil.EMPTY); | |
139 | + continue; | |
140 | + } | |
141 | + rowList.add(ExcelUtil.getHValue(cell).trim()); | |
142 | + | |
143 | + } | |
144 | + list.add(rowList); | |
145 | + } | |
146 | + } | |
147 | + } | |
148 | + return list; | |
149 | + } catch (IOException e) { | |
150 | + e.printStackTrace(); | |
151 | + } finally{ | |
152 | + try { | |
153 | + input.close(); | |
154 | + } catch (IOException e) { | |
155 | + e.printStackTrace(); | |
156 | + } | |
157 | + } | |
158 | + return null; | |
159 | + } | |
160 | +} | |
161 | + | ... | ... |
cloud/dahua/src/main/resources/mapper/usermapper.xml
... | ... | @@ -70,4 +70,26 @@ |
70 | 70 | AND state = 1 |
71 | 71 | </select> |
72 | 72 | |
73 | + <resultMap id="YxStudentMap" type="com.example.dahua.bean.yx.ImportStudent"> | |
74 | + <id column="id" jdbcType="INTEGER" property="id"/> | |
75 | + <result column="name" property="name"/> | |
76 | + <result column="user_id" property="userId"/> | |
77 | + <result column="card_num" property="cardNum"/> | |
78 | + <result column="photo" property="photo"/> | |
79 | + <result column="school_Id" property="schoolId"/> | |
80 | + <result column="student_code" property="studentCode"/> | |
81 | + <result column="scene_name" property="sceneName"/> | |
82 | + </resultMap> | |
83 | + | |
84 | + <insert id="insertStudent" parameterType="com.example.dahua.bean.yx.ImportStudent"> | |
85 | + insert into sz_student_yx values (#{name},#{userId},#{cardNum},#{photo},#{studentCode},#{schoolId},#{sceneName}) | |
86 | + </insert> | |
87 | + | |
88 | + <select id="selectStudentList" resultMap="YxStudentMap"> | |
89 | + select * from sz_student_bak | |
90 | + </select> | |
91 | + | |
92 | + <select id="selectYxStudentList" resultMap="YxStudentMap"> | |
93 | + select * from sz_student_yx where school_id =#{schoolId} and scene_name = #{sceneName} | |
94 | + </select> | |
73 | 95 | </mapper> |
74 | 96 | \ No newline at end of file | ... | ... |