Commit f1e0c386ffb69f7a7c9e2d48e11b7c6bb843bb09
1 parent
1064a47d
Exists in
master
修改提交
Showing
10 changed files
with
287 additions
and
48 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
... | ... | @@ -800,7 +800,7 @@ public class MyTask implements ApplicationRunner { |
800 | 800 | |
801 | 801 | public static void sendRecordToSXYX(String name,String userId,int intOrOut,String eventTime,String scene) { |
802 | 802 | try { |
803 | - String api = "http://yixiao.198.hmkj.com.cn/index.php/Attend/send"; | |
803 | + String api = "https://yixiao.198.hmkj.com.cn/index.php/Attend/send"; | |
804 | 804 | RestTemplate restTemplate = new RestTemplate(); |
805 | 805 | MultiValueMap<String, Object> map = new LinkedMultiValueMap<>(); |
806 | 806 | map.add("name", name); |
... | ... | @@ -813,7 +813,7 @@ public class MyTask implements ApplicationRunner { |
813 | 813 | HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers); |
814 | 814 | ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class); |
815 | 815 | String body = response.getBody(); |
816 | - log.info("请求艺校OA,用户名称【{}】,返回信息【{}】 ",name,body); | |
816 | + log.info("请求艺校OA >>> api: {}, 入参: {} , 响应数据:{} ",api,JSON.toJSONString(map),body); | |
817 | 817 | } catch (Exception e) { |
818 | 818 | sendRecordToSXYX(name,userId,intOrOut,eventTime,scene); |
819 | 819 | } | ... | ... |
cloud/dahua/src/main/resources/logback-spring.xml
... | ... | @@ -9,9 +9,9 @@ |
9 | 9 | |
10 | 10 | <!--日志文件存储的基础路径: ${user.home} 为当前服务器用户主目录--> |
11 | 11 | <!--100--> |
12 | - <property name="LOG_PATH" value="D:\dahua\logs"/> | |
12 | +<!-- <property name="LOG_PATH" value="D:\dahua\logs"/>--> | |
13 | 13 | <!--137--> |
14 | - <!--<property name="LOG_PATH" value="C:\workspace\dahua\logs"/>--> | |
14 | + <property name="LOG_PATH" value="C:\\workspace\\dahua\\logs"/> | |
15 | 15 | |
16 | 16 | <!--日志文件基础名称--> |
17 | 17 | <property name="BASE_FILE_NAME" value="dahua"/> | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserOperateController.java
... | ... | @@ -67,7 +67,8 @@ public class UserOperateController { |
67 | 67 | |
68 | 68 | @ApiOperation(value = "照片下发2.0") |
69 | 69 | @RequestMapping(value = "sendFaceByThread", method = RequestMethod.POST) |
70 | - public Result sendFaceByThread(@RequestBody SendFaceDto sendFaceDto,@RequestParam(value = "groupId",required = false) Integer groupId) { | |
70 | + public Result sendFaceByThread(@RequestBody SendFaceDto sendFaceDto, | |
71 | + @RequestParam(value = "groupId",required = false) Integer groupId) { | |
71 | 72 | return userOperateService.sendUserFaceByThread(sendFaceDto,groupId); |
72 | 73 | } |
73 | 74 | |
... | ... | @@ -85,7 +86,8 @@ public class UserOperateController { |
85 | 86 | |
86 | 87 | @RequestMapping(value = "sendFailFace2", method = RequestMethod.POST) |
87 | 88 | @ApiOperation(value = "重新下发失败人脸2.1") |
88 | - public Result sendFailFace(@RequestParam("schoolId") Integer schoolId,@RequestParam(value = "deviceIds",required = false) String deviceIds) { | |
89 | + public Result sendFailFace(@RequestParam("schoolId") Integer schoolId, | |
90 | + @RequestParam(value = "deviceIds",required = false) String deviceIds) { | |
89 | 91 | return userOperateService.sendFailFace2(schoolId,deviceIds); |
90 | 92 | } |
91 | 93 | |
... | ... | @@ -131,7 +133,7 @@ public class UserOperateController { |
131 | 133 | |
132 | 134 | @ApiOperation(value = "按班级指定下发") |
133 | 135 | @RequestMapping(value = "sendFaceByClassId", method = RequestMethod.POST) |
134 | - public Result exportFace(@RequestParam("schoolId") Integer schoolId, | |
136 | + public Result sendFaceByClassId(@RequestParam("schoolId") Integer schoolId, | |
135 | 137 | @RequestParam(value = "classIds",required = false) String classIds, |
136 | 138 | @RequestParam(value = "deviceIds",required = false) String deviceIds, |
137 | 139 | @RequestParam(value = "studentType",required = false) Integer studentType, |
... | ... | @@ -140,17 +142,28 @@ public class UserOperateController { |
140 | 142 | return userOperateService.sendFaceByClassId(schoolId,classIds,deviceIds,studentType,sex,isCheck); |
141 | 143 | } |
142 | 144 | |
145 | + @ApiOperation(value = "按班级指定下发") | |
146 | + @RequestMapping(value = "sendFaceByKeyword", method = RequestMethod.POST) | |
147 | + public Result sendFaceByKeyword(@RequestParam("schoolId") Integer schoolId, | |
148 | + @RequestParam(value = "deviceIds",required = false) String deviceIds, | |
149 | + @RequestParam(value = "keyword",required = false) String keyword, | |
150 | + @RequestParam(value = "studentType",required = false) Integer studentType, | |
151 | + @RequestParam(value = "sex",required = false) String sex, | |
152 | + @RequestParam(value = "isCheck",required = false) Integer isCheck){ | |
153 | + return userOperateService.sendFaceByKeyword(schoolId,deviceIds,keyword,studentType,sex,isCheck); | |
154 | + } | |
155 | + | |
143 | 156 | @ApiOperation(value = "根据宿舍分组下发") |
144 | - @RequestMapping(value = "sendFaceByGroupId", method = RequestMethod.POST) | |
145 | - public Result sendFaceByThread(@RequestParam("schoolId") Integer schoolId, | |
146 | - @RequestParam("groupId") Integer groupId, | |
157 | + @RequestMapping(value = "sendFaceByRoomId", method = RequestMethod.POST) | |
158 | + public Result sendFaceByRoomId(@RequestParam("schoolId") Integer schoolId, | |
159 | + @RequestParam("roomId") Integer roomId, | |
147 | 160 | @RequestParam(value = "deviceIds",required = false) String deviceIds) { |
148 | - return userOperateService.sendFaceByGroupId(schoolId,groupId,deviceIds); | |
161 | + return userOperateService.sendFaceByRoomId(schoolId,roomId,deviceIds); | |
149 | 162 | } |
150 | 163 | |
151 | 164 | @ApiOperation(value = "删除指定学校下人脸照片") |
152 | 165 | @RequestMapping(value = "deleteBySchoolId", method = RequestMethod.POST) |
153 | - public Result exportFace(@RequestParam("schoolId") Integer schoolId, | |
166 | + public Result deleteBySchoolId(@RequestParam("schoolId") Integer schoolId, | |
154 | 167 | @RequestParam(value = "deviceIds",required = false) String deviceIds){ |
155 | 168 | return userOperateService.deleteFaceBySchoolId(schoolId,deviceIds); |
156 | 169 | } |
... | ... | @@ -159,4 +172,12 @@ public class UserOperateController { |
159 | 172 | public void checkFaceSend(){ |
160 | 173 | userOperateService.checkFaceSend(); |
161 | 174 | } |
175 | + | |
176 | + @ApiOperation(value = "按班级指定下发") | |
177 | + @RequestMapping(value = "replaceFaceByKeyword", method = RequestMethod.POST) | |
178 | + public Result replaceFaceByKeyword(@RequestParam("schoolId") Integer schoolId, | |
179 | + @RequestParam("deviceIds") String deviceIds, | |
180 | + @RequestParam("keyword") String keyword){ | |
181 | + return userOperateService.replaceFaceByKeyword(schoolId,deviceIds,keyword); | |
182 | + } | |
162 | 183 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
... | ... | @@ -262,13 +262,26 @@ public interface UserDao { |
262 | 262 | |
263 | 263 | List<StudentBean> getStudentBySchoolId(@Param("schoolId") Integer schoolId); |
264 | 264 | |
265 | - List<StudentBean> getStudentList(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sex") List<Integer> sex); | |
265 | + List<StudentBean> getTeacherBySchoolId(@Param("schoolId") Integer schoolId); | |
266 | 266 | |
267 | - List<StudentBean> getStudentCardGroup(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sexList") List<Integer> sexList,@Param("groupId")Integer groupId); | |
267 | + List<StudentBean> getStudentList(@Param("schoolId") Integer schoolId, | |
268 | + @Param("studentType")Integer studentType, | |
269 | + @Param("sex") List<Integer> sex); | |
268 | 270 | |
269 | - List<StudentBean> getTeacherList(@Param("schoolId") Integer schoolId); | |
271 | + List<StudentBean> getStudentCardGroup(@Param("schoolId") Integer schoolId, | |
272 | + @Param("studentType")Integer studentType, | |
273 | + @Param("sexList") List<Integer> sexList, | |
274 | + @Param("groupId")Integer groupId); | |
270 | 275 | |
271 | - List<StudentBean> getStudentByClassId(@Param("schoolId") int schoolId,@Param("classIds") List<Integer> classIds,@Param("sexList") List<Integer> sexList,@Param("studentType")int studentType); | |
276 | + List<StudentBean> getStudentByClassId(@Param("schoolId") int schoolId, | |
277 | + @Param("classIds") List<Integer> classIds, | |
278 | + @Param("sexList") List<Integer> sexList, | |
279 | + @Param("studentType")Integer studentType); | |
280 | + | |
281 | + List<StudentBean> getStudentByKeyword(@Param("schoolId") int schoolId, | |
282 | + @Param("keyword") String keyword, | |
283 | + @Param("sexList") List<Integer> sexList, | |
284 | + @Param("studentType")Integer studentType); | |
272 | 285 | |
273 | 286 | List<String> getDeviceIds(@Param("schoolId") Integer schoolId,@Param("deviceId") String deviceId); |
274 | 287 | |
... | ... | @@ -298,4 +311,9 @@ public interface UserDao { |
298 | 311 | List<Integer> getRoomBySchoolId(@Param("schoolId") Integer schoolId,@Param("groupId") Integer groupId); |
299 | 312 | |
300 | 313 | List<StudentBean> getStudentByRoomIds(@Param("schoolId") Integer schoolId,@Param("pIdList") List<Integer> pIdList); |
314 | + | |
315 | + List<StudentBean> getTestVsByKeyword(@Param("schoolId") int schoolId, | |
316 | + @Param("keyword") String keyword, | |
317 | + @Param("sexList") List<Integer> sexList, | |
318 | + @Param("studentType")Integer studentType); | |
301 | 319 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/service/UserOperateService.java
... | ... | @@ -131,7 +131,19 @@ public interface UserOperateService { |
131 | 131 | */ |
132 | 132 | Result sendFaceByClassId(Integer schoolId,String classIds,String deviceIds,Integer studentType,String sex,Integer isCheck); |
133 | 133 | |
134 | - Result sendFaceByGroupId(Integer schoolId,Integer groupId,String deviceIds); | |
134 | + /** | |
135 | + * 根据班级新生班级关键字下发 | |
136 | + * @param schoolId | |
137 | + * @param deviceIds | |
138 | + * @param keyword | |
139 | + * @param studentType | |
140 | + * @param sex | |
141 | + * @param isCheck | |
142 | + * @return | |
143 | + */ | |
144 | + Result sendFaceByKeyword(Integer schoolId,String deviceIds,String keyword,Integer studentType,String sex,Integer isCheck); | |
145 | + | |
146 | + Result sendFaceByRoomId(Integer schoolId,Integer groupId,String deviceIds); | |
135 | 147 | |
136 | 148 | /** |
137 | 149 | * 删除指定学校下的人脸 |
... | ... | @@ -142,4 +154,6 @@ public interface UserOperateService { |
142 | 154 | Result deleteFaceBySchoolId(Integer schoolId,String deviceIds); |
143 | 155 | |
144 | 156 | void checkFaceSend(); |
157 | + | |
158 | + Result replaceFaceByKeyword(Integer schoolId,String deviceIds,String keyword); | |
145 | 159 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/service/impl/BaseService.java
... | ... | @@ -485,19 +485,15 @@ public class BaseService { |
485 | 485 | * @return |
486 | 486 | */ |
487 | 487 | public List<StudentBean> getStudentByClassId(Integer schoolId,String classIds,Integer studentType,String sex) { |
488 | - List<Integer> classList = new ArrayList<>(); | |
488 | + List<Integer> classList = null; | |
489 | 489 | if(StringUtils.isNotBlank(classIds)){ |
490 | - String[] msg = classIds.split(","); | |
491 | - for(String s : msg){ | |
492 | - classList.add(Integer.valueOf(s)); | |
493 | - } | |
490 | + classList = Arrays.asList(classIds.split(",")) | |
491 | + .stream().map(Integer::parseInt).collect(Collectors.toList()); | |
494 | 492 | } |
495 | - List<Integer> sexList = new ArrayList<>(); | |
493 | + List<Integer> sexList = null; | |
496 | 494 | if(StringUtils.isNotBlank(sex)){ |
497 | - String[] msg = sex.split(","); | |
498 | - for(String s : msg){ | |
499 | - sexList.add(Integer.valueOf(s)); | |
500 | - } | |
495 | + sexList = Arrays.asList(sex.split(",")) | |
496 | + .stream().map(Integer::parseInt).collect(Collectors.toList()); | |
501 | 497 | } |
502 | 498 | List<StudentBean> students = userDao.getStudentByClassId(schoolId,classList,sexList,studentType); |
503 | 499 | //去重重复数据 |
... | ... | @@ -507,6 +503,27 @@ public class BaseService { |
507 | 503 | } |
508 | 504 | |
509 | 505 | /** |
506 | + * 根据班级关键字获取学生数据信息 | |
507 | + * @param schoolId | |
508 | + * @param keyword | |
509 | + * @param studentType | |
510 | + * @param sex | |
511 | + * @return | |
512 | + */ | |
513 | + public List<StudentBean> getStudentByKeyword(Integer schoolId,String keyword,Integer studentType,String sex) { | |
514 | + List<Integer> sexList = null; | |
515 | + if(StringUtils.isNotBlank(sex)){ | |
516 | + sexList = Arrays.asList(sex.split(",")) | |
517 | + .stream().map(Integer::parseInt).collect(Collectors.toList()); | |
518 | + } | |
519 | + List<StudentBean> students = userDao.getStudentByKeyword(schoolId,keyword,sexList,studentType); | |
520 | + //去重重复数据 | |
521 | + List<StudentBean> studentList = students.stream().collect(Collectors.collectingAndThen( | |
522 | + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new)); | |
523 | + return studentList; | |
524 | + } | |
525 | + | |
526 | + /** | |
510 | 527 | * 根据学生群组获取学校下对应群组的学生数据信息 |
511 | 528 | * @param schoolId |
512 | 529 | * @param studentType |
... | ... | @@ -514,12 +531,10 @@ public class BaseService { |
514 | 531 | * @return |
515 | 532 | */ |
516 | 533 | public List<StudentBean> getStudentListByGroup(Integer schoolId,Integer studentType,String sex,Integer groupId) { |
517 | - List<Integer> sexList = new ArrayList<>(); | |
534 | + List<Integer> sexList = null; | |
518 | 535 | if(StringUtils.isNotBlank(sex)){ |
519 | - String[] msg = sex.split(","); | |
520 | - for(String s : msg){ | |
521 | - sexList.add(Integer.valueOf(s)); | |
522 | - } | |
536 | + sexList = Arrays.asList(sex.split(",")) | |
537 | + .stream().map(Integer::parseInt).collect(Collectors.toList()); | |
523 | 538 | } |
524 | 539 | List<StudentBean> students = userDao.getStudentCardGroup(schoolId,studentType,sexList,groupId); |
525 | 540 | //去重重复数据 |
... | ... | @@ -528,9 +543,14 @@ public class BaseService { |
528 | 543 | return studentList; |
529 | 544 | } |
530 | 545 | |
531 | - | |
532 | - public List<StudentBean> getStudentListByGroupId(Integer schoolId,Integer groupId) { | |
533 | - List<Integer> rooms = userDao.getRoomBySchoolId(schoolId,groupId); | |
546 | + /** | |
547 | + * 获取宿舍分组管理学生 | |
548 | + * @param schoolId | |
549 | + * @param roomId | |
550 | + * @return | |
551 | + */ | |
552 | + public List<StudentBean> getStudentListByRoomId(Integer schoolId,Integer roomId) { | |
553 | + List<Integer> rooms = userDao.getRoomBySchoolId(schoolId,roomId); | |
534 | 554 | if(!CollectionUtils.isEmpty(rooms)) { |
535 | 555 | List<Integer> pIdlIst = rooms.stream().distinct().collect(Collectors.toList()); |
536 | 556 | List<StudentBean> studentBeans = userDao.getStudentByRoomIds(schoolId,pIdlIst); |
... | ... | @@ -549,7 +569,7 @@ public class BaseService { |
549 | 569 | * @return |
550 | 570 | */ |
551 | 571 | public List<StudentBean> getTeacherList(Integer schoolId) { |
552 | - List<StudentBean> teachers = userDao.getTeacherList(schoolId); | |
572 | + List<StudentBean> teachers = userDao.getTeacherBySchoolId(schoolId); | |
553 | 573 | //去重重复数据 |
554 | 574 | List<StudentBean> teacherist = teachers.stream().collect(Collectors.collectingAndThen( |
555 | 575 | Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getTeacher_num))), ArrayList::new)); |
... | ... | @@ -646,4 +666,15 @@ public class BaseService { |
646 | 666 | attendanceBean.getSchool_id(), attendanceBean.getState() + "", attendanceBean.getIsConnection() + ""); |
647 | 667 | } |
648 | 668 | } |
669 | + | |
670 | + public List<StudentBean> getReplaceByKeyword(Integer schoolId,String keyword) { | |
671 | + List<StudentBean> students = userDao.getTestVsByKeyword(schoolId,keyword,null,null); | |
672 | + //去重重复数据 | |
673 | + List<StudentBean> studentList = students.stream().collect(Collectors.collectingAndThen( | |
674 | + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new)); | |
675 | + return studentList; | |
676 | + } | |
677 | + | |
678 | + | |
679 | + | |
649 | 680 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/service/impl/UserOperateServiceImpl.java
... | ... | @@ -25,7 +25,7 @@ import java.io.File; |
25 | 25 | import java.io.FileInputStream; |
26 | 26 | import java.io.FileOutputStream; |
27 | 27 | import java.io.IOException; |
28 | -import java.nio.file.Files; | |
28 | +import java.text.SimpleDateFormat; | |
29 | 29 | import java.util.*; |
30 | 30 | import java.util.stream.Collectors; |
31 | 31 | |
... | ... | @@ -950,12 +950,11 @@ public class UserOperateServiceImpl implements UserOperateService { |
950 | 950 | @Override |
951 | 951 | public Result sendFaceByClassId(Integer schoolId,String classIds,String deviceIds,Integer studentType,String sex,Integer isCheck) { |
952 | 952 | //下发设备集合 |
953 | - List<String> deviceList = new ArrayList<>(); | |
953 | + List<String> deviceList = null; | |
954 | 954 | if(StringUtils.isBlank(deviceIds)){ |
955 | 955 | deviceList = deviceDao.selectDeviceBySchoolId(schoolId); |
956 | 956 | }else{ |
957 | - String[] deviceArr = deviceIds.split(","); | |
958 | - deviceList= new ArrayList<>(Arrays.asList(deviceArr)); | |
957 | + deviceList= new ArrayList<>(Arrays.asList(deviceIds.split(","))); | |
959 | 958 | } |
960 | 959 | List<StudentBean> resultCard = new ArrayList<>(); |
961 | 960 | List<String> resultDevices = new ArrayList<>(); |
... | ... | @@ -1011,7 +1010,71 @@ public class UserOperateServiceImpl implements UserOperateService { |
1011 | 1010 | } |
1012 | 1011 | |
1013 | 1012 | @Override |
1014 | - public Result sendFaceByGroupId(Integer schoolId,Integer groupId,String deviceIds) { | |
1013 | + public Result sendFaceByKeyword(Integer schoolId,String keyword,String deviceIds,Integer studentType,String sex,Integer isCheck) { | |
1014 | + //下发设备集合 | |
1015 | + List<String> deviceList = null; | |
1016 | + if(StringUtils.isBlank(deviceIds)){ | |
1017 | + deviceList = deviceDao.selectDeviceBySchoolId(schoolId); | |
1018 | + }else{ | |
1019 | + deviceList= Arrays.asList(deviceIds.split(",")); | |
1020 | + } | |
1021 | + List<StudentBean> resultCard = new ArrayList<>(); | |
1022 | + List<String> resultDevices = new ArrayList<>(); | |
1023 | + //根据类型获取下发用户信息 | |
1024 | + List<StudentBean> studentBeanList = baseService.getStudentByKeyword(schoolId,keyword,studentType,sex); | |
1025 | + log.info("统计共有下发用户数量:{}",studentBeanList.size()); | |
1026 | + if(isCheck !=null){ | |
1027 | + for(StudentBean studentBean : studentBeanList){ | |
1028 | + String cardNum = studentBean.getStudent_num(); | |
1029 | + boolean isOk = true; | |
1030 | + for(String deviceId : deviceList){ | |
1031 | + if (cmsServer.getIsDeviceOnline(deviceId)) { | |
1032 | + String cardNo = Long.parseLong(baseService.getCard(cardNum), 16) + ""; | |
1033 | + isOk = cmsServer.getFace(deviceId,cardNo,null); | |
1034 | + }else{ | |
1035 | + isOk = HttpUtil.getCard(deviceId, cardNum); | |
1036 | + } | |
1037 | + if(!isOk){ | |
1038 | + resultCard.add(studentBean); | |
1039 | + resultCard.add(studentBean); | |
1040 | + resultDevices.add(deviceId); | |
1041 | + } | |
1042 | + } | |
1043 | + } | |
1044 | + //去重重复数据 | |
1045 | + studentBeanList = resultCard.stream().collect(Collectors.collectingAndThen( | |
1046 | + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new)); | |
1047 | + //去重重复数据 | |
1048 | + deviceList = resultDevices.stream().distinct().collect(Collectors.toList()); | |
1049 | + } | |
1050 | + log.info("统计共有下发用户数量:{}",studentBeanList.size()); | |
1051 | + //设备类型 | |
1052 | + Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0)); | |
1053 | + if(clintType.intValue()== 22 || clintType.intValue()== 29){ | |
1054 | + //发送大华设备 | |
1055 | + HttpUtil.uploadDHImgByClassId(String.valueOf(schoolId),deviceIds,keyword); | |
1056 | + } | |
1057 | + if(clintType.intValue()== 18 || clintType.intValue()== 28){ | |
1058 | + //发送海康设备:异步执行 | |
1059 | + baseService.sendUserFaceByAsyncThread(schoolId,2,studentBeanList,deviceList); | |
1060 | + } | |
1061 | + int fileSize = studentBeanList.size(); | |
1062 | + int clintNum = deviceList.size(); | |
1063 | + //下发所用时长 | |
1064 | + int timeLength = new Double(clintNum * fileSize * 0.06).intValue(); | |
1065 | + //下发截止时间 | |
1066 | + String dateStr = baseService.getTime(fileSize,clintNum,timeLength); | |
1067 | + Map map = new HashMap(); | |
1068 | + map.put("timeLength",timeLength); | |
1069 | + map.put("afterDate",dateStr); | |
1070 | + map.put("fileSize",fileSize); | |
1071 | + return ResultGenerator.genSuccessResult(objectMapper.toJson(map)); | |
1072 | + } | |
1073 | + | |
1074 | + | |
1075 | + | |
1076 | + @Override | |
1077 | + public Result sendFaceByRoomId(Integer schoolId,Integer roomId,String deviceIds) { | |
1015 | 1078 | //下发设备集合 |
1016 | 1079 | List<String> deviceList = new ArrayList<>(); |
1017 | 1080 | if(StringUtils.isBlank(deviceIds)){ |
... | ... | @@ -1021,7 +1084,7 @@ public class UserOperateServiceImpl implements UserOperateService { |
1021 | 1084 | deviceList= new ArrayList<>(Arrays.asList(deviceArr)); |
1022 | 1085 | } |
1023 | 1086 | //根据类型获取下发用户信息 |
1024 | - List<StudentBean> studentBeanList = baseService.getStudentListByGroupId(schoolId,groupId); | |
1087 | + List<StudentBean> studentBeanList = baseService.getStudentListByRoomId(schoolId,roomId); | |
1025 | 1088 | log.info("统计共有下发用户数量:{}",studentBeanList.size()); |
1026 | 1089 | //设备类型 |
1027 | 1090 | Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0)); |
... | ... | @@ -1171,4 +1234,55 @@ public class UserOperateServiceImpl implements UserOperateService { |
1171 | 1234 | }); |
1172 | 1235 | } |
1173 | 1236 | } |
1237 | + | |
1238 | + @Override | |
1239 | + public Result replaceFaceByKeyword(Integer schoolId,String deviceIds,String keyword) { | |
1240 | + //下发设备集合 | |
1241 | + List<String> deviceList = null; | |
1242 | + if(StringUtils.isBlank(deviceIds)){ | |
1243 | + deviceList = deviceDao.selectDeviceBySchoolId(schoolId); | |
1244 | + }else{ | |
1245 | + deviceList= Arrays.asList(deviceIds.split(",")); | |
1246 | + } | |
1247 | + //根据类型获取下发用户信息 | |
1248 | + List<StudentBean> studentBeanList = baseService.getReplaceByKeyword(schoolId,keyword); | |
1249 | + log.info("统计共有下发用户数量:{}",studentBeanList.size()); | |
1250 | + | |
1251 | + //发送海康设备:异步执行 | |
1252 | + this.deleteReplaceFace(schoolId,studentBeanList,deviceList); | |
1253 | + | |
1254 | + int fileSize = studentBeanList.size(); | |
1255 | + int clintNum = deviceList.size(); | |
1256 | + //下发所用时长 | |
1257 | + int timeLength = new Double(clintNum * fileSize * 0.06).intValue(); | |
1258 | + //下发截止时间 | |
1259 | + String dateStr = baseService.getTime(fileSize,clintNum,timeLength); | |
1260 | + Map map = new HashMap(); | |
1261 | + map.put("timeLength",timeLength); | |
1262 | + map.put("afterDate",dateStr); | |
1263 | + map.put("fileSize",fileSize); | |
1264 | + return ResultGenerator.genSuccessResult(objectMapper.toJson(map)); | |
1265 | + } | |
1266 | + | |
1267 | + @Async | |
1268 | + public void deleteReplaceFace(Integer schoolId,List<StudentBean> studentBeanList,List<String> deviceList){ | |
1269 | + //100服务器; | |
1270 | + studentBeanList.stream().forEach(s->{ | |
1271 | + String cardNum = s.getStudent_num(); | |
1272 | + deviceList.stream().forEach(c->{ | |
1273 | + boolean isOk = false; | |
1274 | + if (cmsServer.getIsDeviceOnline(c)) { | |
1275 | + String cardNo = Long.parseLong(baseService.getCard(cardNum), 16) + ""; | |
1276 | + isOk = HttpUtil.deleteCard100(c,cardNo); | |
1277 | + }else{ | |
1278 | + isOk = HttpUtil.deleteCard(c, cardNum); | |
1279 | + } | |
1280 | + if(isOk){ | |
1281 | + //删除成功记录 | |
1282 | + sendRecordDao.deleteUserFaceSuccess(schoolId,cardNum,c); | |
1283 | + sendRecordDao.deleteRecord(schoolId,c,cardNum); | |
1284 | + } | |
1285 | + }); | |
1286 | + }); | |
1287 | + } | |
1174 | 1288 | } | ... | ... |
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
... | ... | @@ -158,6 +158,13 @@ public class HttpUtil { |
158 | 158 | return res.equals("1"); |
159 | 159 | } |
160 | 160 | |
161 | + public static boolean deleteCard100(String deviceId, String card) { | |
162 | + String url = "http://114.55.30.100:8089/file/DeleteCard?deviceId=" + deviceId + "&card=" + card; | |
163 | + RestTemplate restTemplate = new RestTemplate(); | |
164 | + String res = restTemplate.getForObject(url, String.class); | |
165 | + return res.equals("1"); | |
166 | + } | |
167 | + | |
161 | 168 | /** |
162 | 169 | * 获取海康设备卡信息 |
163 | 170 | * @param deviceId | ... | ... |
cloud/haikangface/src/main/resources/mapper/usermapper.xml
... | ... | @@ -64,7 +64,11 @@ |
64 | 64 | </update> |
65 | 65 | |
66 | 66 | <select id="getStudentBySchoolId" resultType="com.sincere.haikangface.bean.StudentBean"> |
67 | - select * from SZ_V_School_Student where school_id = #{schoolId} and (student_num is not null or student_num !='') and (photo is not null or photo !='') | |
67 | + select * from SZ_V_School_Student where school_id = #{schoolId} and student_num !='' and photo !='' | |
68 | + </select> | |
69 | + | |
70 | + <select id="getTeacherBySchoolId" resultType="com.sincere.haikangface.bean.StudentBean"> | |
71 | + select * from SZ_V_School_Teacher where school_id = #{schoolId} and teacher_num !='' and face !='' | |
68 | 72 | </select> |
69 | 73 | |
70 | 74 | <select id="getStudentList" resultType="com.sincere.haikangface.bean.StudentBean"> |
... | ... | @@ -101,6 +105,23 @@ |
101 | 105 | and student_num != '' and photo !='' |
102 | 106 | </select> |
103 | 107 | |
108 | + <select id="getStudentByKeyword" resultType="com.sincere.haikangface.bean.StudentBean"> | |
109 | + select * from SZ_V_School_Student where school_id = #{schoolId} | |
110 | + <if test="studentType != null"> | |
111 | + and student_type = #{studentType} | |
112 | + </if> | |
113 | + <if test="sexList != null and sexList.size() >0"> | |
114 | + and sex in | |
115 | + <foreach item="item" collection="sexList" separator="," open="(" close=")" index=""> | |
116 | + #{item} | |
117 | + </foreach> | |
118 | + </if> | |
119 | + <if test="keyword != null and keyword !=''"> | |
120 | + and class_name concat('%', #{keyword}, '%') | |
121 | + </if> | |
122 | + and student_num != '' and photo !='' | |
123 | + </select> | |
124 | + | |
104 | 125 | <select id="getStudentCardGroup" resultType="com.sincere.haikangface.bean.StudentBean"> |
105 | 126 | select * from SZ_V_School_Student where school_id = #{schoolId} |
106 | 127 | <if test="studentType != null"> |
... | ... | @@ -117,10 +138,6 @@ |
117 | 138 | </if> |
118 | 139 | </select> |
119 | 140 | |
120 | - <select id="getTeacherList" resultType="com.sincere.haikangface.bean.StudentBean"> | |
121 | - select * from SZ_V_School_Teacher where school_id = #{schoolId} and teacher_num !='' and face !='' | |
122 | - </select> | |
123 | - | |
124 | 141 | <select id="getDeviceIds" resultType="java.lang.String"> |
125 | 142 | select clint_id from SZ_Attendance where clint_type in(22,18,28,29) and school_id = #{schoolId} |
126 | 143 | <if test="deviceId != null and deviceId.trim() != ''"> |
... | ... | @@ -221,4 +238,21 @@ |
221 | 238 | </if> |
222 | 239 | </where> |
223 | 240 | </select> |
241 | + | |
242 | + <select id="getTestVsByKeyword" resultType="com.sincere.haikangface.bean.StudentBean"> | |
243 | + select * from test_vs where school_id = #{schoolId} | |
244 | + <if test="studentType != null"> | |
245 | + and student_type = #{studentType} | |
246 | + </if> | |
247 | + <if test="sexList != null and sexList.size() >0"> | |
248 | + and sex in | |
249 | + <foreach item="item" collection="sexList" separator="," open="(" close=")" index=""> | |
250 | + #{item} | |
251 | + </foreach> | |
252 | + </if> | |
253 | + <if test="keyword != null and keyword !=''"> | |
254 | + and class_name like concat('%', #{keyword}, '%') | |
255 | + </if> | |
256 | + and student_num != '' and photo !='' | |
257 | + </select> | |
224 | 258 | </mapper> | ... | ... |
cloud/quartz/src/main/resources/logback.xml
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <property name="PROJECT_NAME" value="quartz"/> |
5 | 5 | |
6 | 6 | <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> |
7 | - <property name="LOG_HOME" value="C://log"/> | |
7 | + <property name="LOG_HOME" value="D://log"/> | |
8 | 8 | |
9 | 9 | <!-- 控制台输出 --> |
10 | 10 | <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"><!--<withJansi>true</withJansi>--> | ... | ... |