Commit f1e0c386ffb69f7a7c9e2d48e11b7c6bb843bb09

Authored by 徐泉
1 parent 1064a47d
Exists in master

修改提交

cloud/dahua/src/main/java/com/example/dahua/MyTask.java
@@ -800,7 +800,7 @@ public class MyTask implements ApplicationRunner { @@ -800,7 +800,7 @@ public class MyTask implements ApplicationRunner {
800 800
801 public static void sendRecordToSXYX(String name,String userId,int intOrOut,String eventTime,String scene) { 801 public static void sendRecordToSXYX(String name,String userId,int intOrOut,String eventTime,String scene) {
802 try { 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 RestTemplate restTemplate = new RestTemplate(); 804 RestTemplate restTemplate = new RestTemplate();
805 MultiValueMap<String, Object> map = new LinkedMultiValueMap<>(); 805 MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
806 map.add("name", name); 806 map.add("name", name);
@@ -813,7 +813,7 @@ public class MyTask implements ApplicationRunner { @@ -813,7 +813,7 @@ public class MyTask implements ApplicationRunner {
813 HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers); 813 HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
814 ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class); 814 ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class);
815 String body = response.getBody(); 815 String body = response.getBody();
816 - log.info("请求艺校OA,用户名称【{}】,返回信息【{}】 ",name,body); 816 + log.info("请求艺校OA >>> api: {}, 入参: {} , 响应数据:{} ",api,JSON.toJSONString(map),body);
817 } catch (Exception e) { 817 } catch (Exception e) {
818 sendRecordToSXYX(name,userId,intOrOut,eventTime,scene); 818 sendRecordToSXYX(name,userId,intOrOut,eventTime,scene);
819 } 819 }
cloud/dahua/src/main/resources/logback-spring.xml
@@ -9,9 +9,9 @@ @@ -9,9 +9,9 @@
9 9
10 <!--日志文件存储的基础路径: ${user.home} 为当前服务器用户主目录--> 10 <!--日志文件存储的基础路径: ${user.home} 为当前服务器用户主目录-->
11 <!--100--> 11 <!--100-->
12 - <property name="LOG_PATH" value="D:\dahua\logs"/> 12 +<!-- <property name="LOG_PATH" value="D:\dahua\logs"/>-->
13 <!--137--> 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 <property name="BASE_FILE_NAME" value="dahua"/> 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,7 +67,8 @@ public class UserOperateController {
67 67
68 @ApiOperation(value = "照片下发2.0") 68 @ApiOperation(value = "照片下发2.0")
69 @RequestMapping(value = "sendFaceByThread", method = RequestMethod.POST) 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 return userOperateService.sendUserFaceByThread(sendFaceDto,groupId); 72 return userOperateService.sendUserFaceByThread(sendFaceDto,groupId);
72 } 73 }
73 74
@@ -85,7 +86,8 @@ public class UserOperateController { @@ -85,7 +86,8 @@ public class UserOperateController {
85 86
86 @RequestMapping(value = "sendFailFace2", method = RequestMethod.POST) 87 @RequestMapping(value = "sendFailFace2", method = RequestMethod.POST)
87 @ApiOperation(value = "重新下发失败人脸2.1") 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 return userOperateService.sendFailFace2(schoolId,deviceIds); 91 return userOperateService.sendFailFace2(schoolId,deviceIds);
90 } 92 }
91 93
@@ -131,7 +133,7 @@ public class UserOperateController { @@ -131,7 +133,7 @@ public class UserOperateController {
131 133
132 @ApiOperation(value = "按班级指定下发") 134 @ApiOperation(value = "按班级指定下发")
133 @RequestMapping(value = "sendFaceByClassId", method = RequestMethod.POST) 135 @RequestMapping(value = "sendFaceByClassId", method = RequestMethod.POST)
134 - public Result exportFace(@RequestParam("schoolId") Integer schoolId, 136 + public Result sendFaceByClassId(@RequestParam("schoolId") Integer schoolId,
135 @RequestParam(value = "classIds",required = false) String classIds, 137 @RequestParam(value = "classIds",required = false) String classIds,
136 @RequestParam(value = "deviceIds",required = false) String deviceIds, 138 @RequestParam(value = "deviceIds",required = false) String deviceIds,
137 @RequestParam(value = "studentType",required = false) Integer studentType, 139 @RequestParam(value = "studentType",required = false) Integer studentType,
@@ -140,17 +142,28 @@ public class UserOperateController { @@ -140,17 +142,28 @@ public class UserOperateController {
140 return userOperateService.sendFaceByClassId(schoolId,classIds,deviceIds,studentType,sex,isCheck); 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 @ApiOperation(value = "根据宿舍分组下发") 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 @RequestParam(value = "deviceIds",required = false) String deviceIds) { 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 @ApiOperation(value = "删除指定学校下人脸照片") 164 @ApiOperation(value = "删除指定学校下人脸照片")
152 @RequestMapping(value = "deleteBySchoolId", method = RequestMethod.POST) 165 @RequestMapping(value = "deleteBySchoolId", method = RequestMethod.POST)
153 - public Result exportFace(@RequestParam("schoolId") Integer schoolId, 166 + public Result deleteBySchoolId(@RequestParam("schoolId") Integer schoolId,
154 @RequestParam(value = "deviceIds",required = false) String deviceIds){ 167 @RequestParam(value = "deviceIds",required = false) String deviceIds){
155 return userOperateService.deleteFaceBySchoolId(schoolId,deviceIds); 168 return userOperateService.deleteFaceBySchoolId(schoolId,deviceIds);
156 } 169 }
@@ -159,4 +172,12 @@ public class UserOperateController { @@ -159,4 +172,12 @@ public class UserOperateController {
159 public void checkFaceSend(){ 172 public void checkFaceSend(){
160 userOperateService.checkFaceSend(); 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,13 +262,26 @@ public interface UserDao {
262 262
263 List<StudentBean> getStudentBySchoolId(@Param("schoolId") Integer schoolId); 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 List<String> getDeviceIds(@Param("schoolId") Integer schoolId,@Param("deviceId") String deviceId); 286 List<String> getDeviceIds(@Param("schoolId") Integer schoolId,@Param("deviceId") String deviceId);
274 287
@@ -298,4 +311,9 @@ public interface UserDao { @@ -298,4 +311,9 @@ public interface UserDao {
298 List<Integer> getRoomBySchoolId(@Param("schoolId") Integer schoolId,@Param("groupId") Integer groupId); 311 List<Integer> getRoomBySchoolId(@Param("schoolId") Integer schoolId,@Param("groupId") Integer groupId);
299 312
300 List<StudentBean> getStudentByRoomIds(@Param("schoolId") Integer schoolId,@Param("pIdList") List<Integer> pIdList); 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,7 +131,19 @@ public interface UserOperateService {
131 */ 131 */
132 Result sendFaceByClassId(Integer schoolId,String classIds,String deviceIds,Integer studentType,String sex,Integer isCheck); 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,4 +154,6 @@ public interface UserOperateService {
142 Result deleteFaceBySchoolId(Integer schoolId,String deviceIds); 154 Result deleteFaceBySchoolId(Integer schoolId,String deviceIds);
143 155
144 void checkFaceSend(); 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,19 +485,15 @@ public class BaseService {
485 * @return 485 * @return
486 */ 486 */
487 public List<StudentBean> getStudentByClassId(Integer schoolId,String classIds,Integer studentType,String sex) { 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 if(StringUtils.isNotBlank(classIds)){ 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 if(StringUtils.isNotBlank(sex)){ 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 List<StudentBean> students = userDao.getStudentByClassId(schoolId,classList,sexList,studentType); 498 List<StudentBean> students = userDao.getStudentByClassId(schoolId,classList,sexList,studentType);
503 //去重重复数据 499 //去重重复数据
@@ -507,6 +503,27 @@ public class BaseService { @@ -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 * @param schoolId 528 * @param schoolId
512 * @param studentType 529 * @param studentType
@@ -514,12 +531,10 @@ public class BaseService { @@ -514,12 +531,10 @@ public class BaseService {
514 * @return 531 * @return
515 */ 532 */
516 public List<StudentBean> getStudentListByGroup(Integer schoolId,Integer studentType,String sex,Integer groupId) { 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 if(StringUtils.isNotBlank(sex)){ 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 List<StudentBean> students = userDao.getStudentCardGroup(schoolId,studentType,sexList,groupId); 539 List<StudentBean> students = userDao.getStudentCardGroup(schoolId,studentType,sexList,groupId);
525 //去重重复数据 540 //去重重复数据
@@ -528,9 +543,14 @@ public class BaseService { @@ -528,9 +543,14 @@ public class BaseService {
528 return studentList; 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 if(!CollectionUtils.isEmpty(rooms)) { 554 if(!CollectionUtils.isEmpty(rooms)) {
535 List<Integer> pIdlIst = rooms.stream().distinct().collect(Collectors.toList()); 555 List<Integer> pIdlIst = rooms.stream().distinct().collect(Collectors.toList());
536 List<StudentBean> studentBeans = userDao.getStudentByRoomIds(schoolId,pIdlIst); 556 List<StudentBean> studentBeans = userDao.getStudentByRoomIds(schoolId,pIdlIst);
@@ -549,7 +569,7 @@ public class BaseService { @@ -549,7 +569,7 @@ public class BaseService {
549 * @return 569 * @return
550 */ 570 */
551 public List<StudentBean> getTeacherList(Integer schoolId) { 571 public List<StudentBean> getTeacherList(Integer schoolId) {
552 - List<StudentBean> teachers = userDao.getTeacherList(schoolId); 572 + List<StudentBean> teachers = userDao.getTeacherBySchoolId(schoolId);
553 //去重重复数据 573 //去重重复数据
554 List<StudentBean> teacherist = teachers.stream().collect(Collectors.collectingAndThen( 574 List<StudentBean> teacherist = teachers.stream().collect(Collectors.collectingAndThen(
555 Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getTeacher_num))), ArrayList::new)); 575 Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getTeacher_num))), ArrayList::new));
@@ -646,4 +666,15 @@ public class BaseService { @@ -646,4 +666,15 @@ public class BaseService {
646 attendanceBean.getSchool_id(), attendanceBean.getState() + "", attendanceBean.getIsConnection() + ""); 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,7 +25,7 @@ import java.io.File;
25 import java.io.FileInputStream; 25 import java.io.FileInputStream;
26 import java.io.FileOutputStream; 26 import java.io.FileOutputStream;
27 import java.io.IOException; 27 import java.io.IOException;
28 -import java.nio.file.Files; 28 +import java.text.SimpleDateFormat;
29 import java.util.*; 29 import java.util.*;
30 import java.util.stream.Collectors; 30 import java.util.stream.Collectors;
31 31
@@ -950,12 +950,11 @@ public class UserOperateServiceImpl implements UserOperateService { @@ -950,12 +950,11 @@ public class UserOperateServiceImpl implements UserOperateService {
950 @Override 950 @Override
951 public Result sendFaceByClassId(Integer schoolId,String classIds,String deviceIds,Integer studentType,String sex,Integer isCheck) { 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 if(StringUtils.isBlank(deviceIds)){ 954 if(StringUtils.isBlank(deviceIds)){
955 deviceList = deviceDao.selectDeviceBySchoolId(schoolId); 955 deviceList = deviceDao.selectDeviceBySchoolId(schoolId);
956 }else{ 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 List<StudentBean> resultCard = new ArrayList<>(); 959 List<StudentBean> resultCard = new ArrayList<>();
961 List<String> resultDevices = new ArrayList<>(); 960 List<String> resultDevices = new ArrayList<>();
@@ -1011,7 +1010,71 @@ public class UserOperateServiceImpl implements UserOperateService { @@ -1011,7 +1010,71 @@ public class UserOperateServiceImpl implements UserOperateService {
1011 } 1010 }
1012 1011
1013 @Override 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 List<String> deviceList = new ArrayList<>(); 1079 List<String> deviceList = new ArrayList<>();
1017 if(StringUtils.isBlank(deviceIds)){ 1080 if(StringUtils.isBlank(deviceIds)){
@@ -1021,7 +1084,7 @@ public class UserOperateServiceImpl implements UserOperateService { @@ -1021,7 +1084,7 @@ public class UserOperateServiceImpl implements UserOperateService {
1021 deviceList= new ArrayList<>(Arrays.asList(deviceArr)); 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 log.info("统计共有下发用户数量:{}",studentBeanList.size()); 1088 log.info("统计共有下发用户数量:{}",studentBeanList.size());
1026 //设备类型 1089 //设备类型
1027 Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0)); 1090 Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0));
@@ -1171,4 +1234,55 @@ public class UserOperateServiceImpl implements UserOperateService { @@ -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,6 +158,13 @@ public class HttpUtil {
158 return res.equals("1"); 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 * @param deviceId 170 * @param deviceId
cloud/haikangface/src/main/resources/mapper/usermapper.xml
@@ -64,7 +64,11 @@ @@ -64,7 +64,11 @@
64 </update> 64 </update>
65 65
66 <select id="getStudentBySchoolId" resultType="com.sincere.haikangface.bean.StudentBean"> 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 </select> 72 </select>
69 73
70 <select id="getStudentList" resultType="com.sincere.haikangface.bean.StudentBean"> 74 <select id="getStudentList" resultType="com.sincere.haikangface.bean.StudentBean">
@@ -101,6 +105,23 @@ @@ -101,6 +105,23 @@
101 and student_num != '' and photo !='' 105 and student_num != '' and photo !=''
102 </select> 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 <select id="getStudentCardGroup" resultType="com.sincere.haikangface.bean.StudentBean"> 125 <select id="getStudentCardGroup" resultType="com.sincere.haikangface.bean.StudentBean">
105 select * from SZ_V_School_Student where school_id = #{schoolId} 126 select * from SZ_V_School_Student where school_id = #{schoolId}
106 <if test="studentType != null"> 127 <if test="studentType != null">
@@ -117,10 +138,6 @@ @@ -117,10 +138,6 @@
117 </if> 138 </if>
118 </select> 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 <select id="getDeviceIds" resultType="java.lang.String"> 141 <select id="getDeviceIds" resultType="java.lang.String">
125 select clint_id from SZ_Attendance where clint_type in(22,18,28,29) and school_id = #{schoolId} 142 select clint_id from SZ_Attendance where clint_type in(22,18,28,29) and school_id = #{schoolId}
126 <if test="deviceId != null and deviceId.trim() != ''"> 143 <if test="deviceId != null and deviceId.trim() != ''">
@@ -221,4 +238,21 @@ @@ -221,4 +238,21 @@
221 </if> 238 </if>
222 </where> 239 </where>
223 </select> 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 </mapper> 258 </mapper>
cloud/quartz/src/main/resources/logback.xml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <property name="PROJECT_NAME" value="quartz"/> 4 <property name="PROJECT_NAME" value="quartz"/>
5 5
6 <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> 6 <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
7 - <property name="LOG_HOME" value="C://log"/> 7 + <property name="LOG_HOME" value="D://log"/>
8 8
9 <!-- 控制台输出 --> 9 <!-- 控制台输出 -->
10 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"><!--<withJansi>true</withJansi>--> 10 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"><!--<withJansi>true</withJansi>-->