Commit 8b94a56aa6a35d3010f5502262068ae94975c3a8

Authored by 徐泉
1 parent 09102d07
Exists in master

修改提交

Showing 34 changed files with 405 additions and 195 deletions   Show diff stats
cloud/dahua/pom.xml
... ... @@ -156,35 +156,37 @@
156 156 <plugin>
157 157 <groupId>org.springframework.boot</groupId>
158 158 <artifactId>spring-boot-maven-plugin</artifactId>
  159 + <executions>
  160 + <execution>
  161 + <goals>
  162 + <goal>repackage</goal>
  163 + </goals>
  164 + </execution>
  165 + </executions>
159 166 <configuration>
160 167 <includeSystemScope>true</includeSystemScope>
161 168 <layout>ZIP</layout>
162   -<!-- <includes>-->
163   -<!-- <include>-->
164   -<!-- &lt;!&ndash; 排除所有Jar &ndash;&gt;-->
165   -<!-- <groupId>nothing</groupId>-->
166   -<!-- <artifactId>nothing</artifactId>-->
167   -<!-- </include>-->
168   -<!-- </includes>-->
  169 + <includes>
  170 + <include>
  171 + <!-- 排除所有Jar -->
  172 + <groupId>nothing</groupId>
  173 + <artifactId>nothing</artifactId>
  174 + </include>
  175 + </includes>
169 176 </configuration>
170 177 </plugin>
171   -
172 178 <plugin>
173 179 <groupId>org.apache.maven.plugins</groupId>
174 180 <artifactId>maven-dependency-plugin</artifactId>
175   - <!-- <version>2.2</version>&lt;!&ndash;$NO-MVN-MAN-VER$ &ndash;&gt;-->
176 181 <executions>
177 182 <execution>
178   - <id>copy-dependencies</id>
  183 + <id>copy</id>
179 184 <phase>package</phase>
180 185 <goals>
181 186 <goal>copy-dependencies</goal>
182 187 </goals>
183 188 <configuration>
184   - <outputDirectory>${project.build.directory}/libs</outputDirectory>
185   - <overWriteReleases>true</overWriteReleases>
186   - <overWriteSnapshots>true</overWriteSnapshots>
187   - <overWriteIfNewer>true</overWriteIfNewer>
  189 + <outputDirectory>${project.build.directory}/lib</outputDirectory>
188 190 </configuration>
189 191 </execution>
190 192 </executions>
... ...
cloud/dahua/src/main/java/com/example/dahua/DahuaApplication.java
... ... @@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
37 37 @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, MybatisAutoConfiguration.class})
38 38 @SpringBootApplication
39 39 @MapperScan("com.example.dahua.dao")
40   -@EnableDiscoveryClient
  40 +//@EnableDiscoveryClient
41 41 @EnableScheduling
42 42 public class DahuaApplication {
43 43  
... ...
cloud/dahua/src/main/java/com/example/dahua/MyTask.java
... ... @@ -420,18 +420,19 @@ public class MyTask implements ApplicationRunner {
420 420 String userId = new String(msg.szUserID).trim();
421 421 //开门错误码
422 422 int messageCode = msg.nErrorCode;
423   - log.info("设备ID: {}, 开门用户ID: {}, 开门卡号: {}",szSn,userId,card);
424 423 //处理心跳
425 424 saveAttendanceService(szSn,"",0,1);
  425 + String newCard = "";
426 426 try {
427 427 if (!StringUtils.isEmpty(card)) {
428 428 //根据卡号获取卡身份信息
429 429 CardBean cardBean = myTaskUtil.userDao.getCards(card);
430 430 if(cardBean ==null){
431   - card = cardNo(card);
432   - cardBean = myTaskUtil.userDao.getCards(card);
  431 + newCard = cardNo(card);
  432 + cardBean = myTaskUtil.userDao.getCards(newCard);
433 433 }
434 434 if(cardBean ==null){
  435 + log.info("卡号有误!!设备ID: 【{}】,上报卡号: 【{}】",szSn,card);
435 436 return -1;
436 437 }
437 438 // 缓存抓拍人脸
... ... @@ -450,6 +451,7 @@ public class MyTask implements ApplicationRunner {
450 451 if(attendanceBean !=null){
451 452 if(!StringUtils.isEmpty(attendanceBean.getSchool_id())){
452 453 int schoolId = Integer.parseInt(attendanceBean.getSchool_id());
  454 + String clintName = attendanceBean.getName();
453 455 //门禁进出类型:1进0出
454 456 int eventType = 0;
455 457 if(StringUtils.isEmpty(attendanceBean.getOutOrIn())){
... ... @@ -460,30 +462,42 @@ public class MyTask implements ApplicationRunner {
460 462 //刷卡时间
461 463 String eventTime = DateUtils.date2String(new Date(), DateUtils.format2);
462 464 //老师
  465 + TeacherBean teacherBean = null;
463 466 if (cardBean.getType() == 0) {
464 467 //老师人脸信息,保存人脸记录表
465   - TeacherBean teacherBean = myTaskUtil.userDao.getTeacherWithId(cardBean.getUser_id());
  468 + teacherBean = myTaskUtil.userDao.getTeacherWithId(cardBean.getUser_id());
  469 +// log.info("设备信息【{}】,学生卡信息【{}】",new Gson().toJson(attendanceBean),new Gson().toJson(teacherBean));
466 470 myTaskUtil.sendRecordDao.addFaceRecoder(szSn, teacherBean.getUser_id(), teacherBean.getName(), snapPicPath,eventType,
467   - eventTime, card,messageCode ==20?EnumSendFaceType.TIME_INTERVAL_ERROR.message:"");
  471 + eventTime, card,messageCode ==20?EnumSendFaceType.TIME_INTERVAL_ERROR.message:"",schoolId);
468 472 }
469 473 UserInfoBean userInfoBean = null;
470 474 if (cardBean.getType() == 2) {
471 475 //学生人脸信息,保存人脸记录表
472 476 userInfoBean = myTaskUtil.userDao.getStudentWithid(cardBean.getUser_id());
473 477 myTaskUtil.sendRecordDao.addFaceRecoder(szSn, userInfoBean.getUser_id(), userInfoBean.getName(), snapPicPath,eventType,
474   - eventTime, card,messageCode ==20?EnumSendFaceType.TIME_INTERVAL_ERROR.message:"");
  478 + eventTime, card,messageCode ==20?EnumSendFaceType.TIME_INTERVAL_ERROR.message:"",schoolId);
475 479 }
476   -
477   - // TODO 考勤记录
478 480 //刷卡结果,1表示成功, 0表示失败
479 481 int status = msg.bStatus;
480   -
  482 + String result = status == 1 ? "开门成功" : "开门失败";
  483 + String openMsg = eventType ==1 ? "进" : "出" ;
481 484 if(szSn.startsWith("ytj")) {
  485 + log.info("出入信息:学校【{}】,开门方向:【{}】",schoolId,status);
482 486 // 艺校考勤OA
483 487 if(schoolId == 12 && status ==1){
484   - int intOrOut = eventType ==1? 1 : 2;
485   - sendRecordToSXYX(userInfoBean.getName(),userInfoBean.getUser_id(),intOrOut,eventTime);
  488 + int intOrOut = eventType ==1 ? 1 : 2;
  489 + if(userInfoBean !=null){
  490 + log.info("【{}】出入信息:方向【{}】,开门结果【{}】",userInfoBean.getName(),openMsg,result);
  491 + sendRecordToSXYX(userInfoBean.getName(),userInfoBean.getUser_id(),intOrOut,eventTime,"");
  492 + }
  493 + if(teacherBean != null){
  494 + sendRecordToSXYX(teacherBean.getName(),teacherBean.getUser_id(),intOrOut,eventTime,getScene(clintName));
  495 + }
486 496 }else{
  497 +// if(schoolId == 489){
  498 +// eventTime = DateUtils.date2String(DateUtils.getDateByTime(-5,new Date()), DateUtils.format2);
  499 +//// log.info("设备ID: {},刷卡结果:{},开门方向: {}, 开门用户: {}, 开门卡号: {}",szSn,result,openMsg,userInfoBean.getName(),userInfoBean.getStudent_num());
  500 +// }
487 501 //保存考勤记录
488 502 kaoQinRecord(status, eventType, card, szSn, eventTime,lAnalyzerHandle);
489 503 }
... ... @@ -499,6 +513,19 @@ public class MyTask implements ApplicationRunner {
499 513 }
500 514 }
501 515  
  516 + private static String getScene(String sceneName){
  517 + if(sceneName.contains("B")){
  518 + return "B";
  519 + }
  520 + if(sceneName.contains("C")){
  521 + return "C";
  522 + }
  523 + if(sceneName.contains("D")){
  524 + return "D";
  525 + }
  526 + return "";
  527 + }
  528 +
502 529 /**
503 530 * 根据ip和port获取设备id
504 531 *
... ... @@ -771,7 +798,7 @@ public class MyTask implements ApplicationRunner {
771 798 return true;
772 799 }
773 800  
774   - public static void sendRecordToSXYX(String name,String userId,int intOrOut,String eventTime) {
  801 + public static void sendRecordToSXYX(String name,String userId,int intOrOut,String eventTime,String scene) {
775 802 try {
776 803 String api = "http://yixiao.198.hmkj.com.cn/index.php/Attend/send";
777 804 RestTemplate restTemplate = new RestTemplate();
... ... @@ -780,14 +807,15 @@ public class MyTask implements ApplicationRunner {
780 807 map.add("xuehao", userId);
781 808 map.add("time", eventTime);
782 809 map.add("state", intOrOut);
  810 + map.add("loudong", scene);
783 811 HttpHeaders headers = new HttpHeaders();
784 812 headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
785 813 HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
786 814 ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class);
787 815 String body = response.getBody();
788   - log.info("请求艺校OA,返回信息: " + body);
  816 + log.info("请求艺校OA,用户名称【{}】,返回信息【{}】 ",name,body);
789 817 } catch (Exception e) {
790   - sendRecordToSXYX(name,userId,intOrOut,eventTime);
  818 + sendRecordToSXYX(name,userId,intOrOut,eventTime,scene);
791 819 }
792 820 }
793 821 }
... ...
cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask2.java
... ... @@ -217,7 +217,7 @@ public class SendUserInfoTask2 {
217 217 log.error("学生类型【{}】无对应权限通道。",studentType);
218 218 channel = getAuthChannelByClassId(Integer.parseInt(schoolId),Integer.parseInt(classId),deviceId);
219 219 }
220   - if(StringUtils.isEmpty(channel)){
  220 + if(StringUtils.isEmpty(channel) && !schoolId.equals("1485")){
221 221 //设备不在线
222 222 sendRecordBean.setFailType(EnumSendFaceType.AUTH_NOT_SET.code);
223 223 sendRecordBean.setFailContent(EnumSendFaceType.AUTH_NOT_SET.message);
... ...
cloud/dahua/src/main/java/com/example/dahua/control/UserOperateController.java
... ... @@ -124,4 +124,20 @@ public class UserOperateController {
124 124 public Result sendFaceByThread(@RequestBody YxSendFaceDto sendFaceDto) {
125 125 return userOperateService.sendYxUserFace(sendFaceDto);
126 126 }
  127 +
  128 + @ApiOperation(value = "下方指定卡号")
  129 + @RequestMapping(value = "sendCard", method = RequestMethod.POST)
  130 + public void exportFace(@RequestParam("cardNum") String cardNum,@RequestParam("schoolId") Integer schoolId,
  131 + @RequestParam("deviceIds") String deviceIds){
  132 + userOperateService.sendCard(cardNum,schoolId,deviceIds);
  133 + }
  134 +// @ApiOperation(value = "按班级指定下发")
  135 +// @RequestMapping(value = "sendFaceByRoomId", method = RequestMethod.POST)
  136 +// public void exportFace(@RequestParam("schoolId") Integer schoolId,
  137 +// @RequestParam(value = "classIds",required = false) String classIds,
  138 +// @RequestParam(value = "deviceIds",required = false) String deviceIds){
  139 +//// userOperateService.sendFaceByRoomId(schoolId,classIds,deviceIds);
  140 +// r
  141 +// }
  142 +
127 143 }
... ...
cloud/dahua/src/main/java/com/example/dahua/service/UserOperateService.java
... ... @@ -38,4 +38,6 @@ public interface UserOperateService {
38 38 * @return
39 39 */
40 40 Result sendYxUserFace(YxSendFaceDto sendFaceDto);
  41 +
  42 + void sendCard(String cardNum,Integer schoolId,String deviceIds);
41 43 }
... ...
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserOperateServiceImpl.java
... ... @@ -19,6 +19,7 @@ import com.example.dahua.utils.DateUtils;
19 19 import com.example.dahua.utils.HttpUtils;
20 20 import com.example.dahua.xiananDao.SearchMapper;
21 21 import com.example.dahua.xiananDao.SendRecordDao;
  22 +import com.google.gson.Gson;
22 23 import lombok.extern.slf4j.Slf4j;
23 24 import org.springframework.beans.BeanUtils;
24 25 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -301,4 +302,26 @@ public class UserOperateServiceImpl implements UserOperateService {
301 302 sendFace(dtoList,deviceList,schoolId,2);
302 303 return ResultGenerator.genSuccessResult();
303 304 }
  305 +
  306 + @Override
  307 + public void sendCard(String cardNum, Integer schoolId, String deviceIds) {
  308 + //下发设备集合
  309 + String[] deviceArr = deviceIds.split(",");
  310 + List<String> deviceList= new ArrayList<>(Arrays.asList(deviceArr));
  311 + if(deviceList.size()<1){
  312 + return;
  313 + }
  314 + deviceList.stream().forEach(s -> {
  315 + //登录设备
  316 + NetSDKLib.LLong loginHandleLong = MyTask.lLongSendMap.get(s);
  317 + StudentBean studentBean = userDao.getStudentWithCard(cardNum,schoolId);
  318 + log.info("学生信息: {},设备信息: {}",new Gson().toJson(studentBean),loginHandleLong);
  319 + if(studentBean !=null && loginHandleLong != null){
  320 + String userId = studentBean.getUser_id();
  321 + //修改用户信息
  322 + int bUserFlags = GateModule2.addCardForMore(userId,cardNum,loginHandleLong,1);
  323 + log.info("下发结果:" + bUserFlags);
  324 + }
  325 + });
  326 + }
304 327 }
... ...
cloud/dahua/src/main/java/com/example/dahua/utils/DateUtils.java
... ... @@ -82,4 +82,9 @@ public class DateUtils {
82 82 return cal.getTime();
83 83 }
84 84  
  85 + public static void main(String[] args) {
  86 + System.out.println(getDateByTime(3,new Date()));
  87 + System.out.println(getDateByTime(-3,new Date()));
  88 + }
  89 +
85 90 }
... ...
cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
... ... @@ -40,7 +40,8 @@ public class HttpUtils {
40 40 return false;
41 41 }
42 42 String targPath = FilePath.picPathComp + studentCode + ".jpg";
43   - String url = "http://121.40.109.21:8991/file/uploadImg";
  43 +// String url = "http://121.40.109.21:8991/file/uploadImg";
  44 + String url = "http://116.62.155.137:8991/file/uploadImg";
44 45 MultiValueMap<String, Object> multivaluedMap = new LinkedMultiValueMap<>();
45 46 HttpHeaders headers = new HttpHeaders();
46 47 RestTemplate restTemplate = new RestTemplate();
... ... @@ -88,8 +89,8 @@ public class HttpUtils {
88 89  
89 90 String targetPath = FilePath.picPathComp + studentCode + FilePath.fileSuffix;
90 91  
91   - String url = "http://121.40.109.21:8991/operate/sendUserAndImg";
92   - //String url = "http://localhost:8991/file/uploadImg";
  92 +// String url = "http://121.40.109.21:8991/operate/sendUserAndImg";
  93 + String url = "http://116.62.155.137:8991/operate/sendUserAndImg";
93 94  
94 95 MultiValueMap<String, Object> multivaluedMap = new LinkedMultiValueMap<>();
95 96 HttpHeaders headers = new HttpHeaders();
... ... @@ -148,7 +149,7 @@ public class HttpUtils {
148 149 }
149 150  
150 151 public static void deleteFace(Integer schoolId) {
151   - String url = "http://121.40.109.21:8991/operate/deleteFailFace?schoolId=" + schoolId;
  152 + String url = "http://116.62.155.137:8991/operate/deleteFailFace?schoolId=" + schoolId;
152 153 RestTemplate restTemplate = new RestTemplate();
153 154 ResponseEntity<Boolean> result = restTemplate.getForEntity(url, Boolean.class);
154 155 System.out.println("发生请求21服务删除人脸,请求地址: +" + url+ "返回信息: "+ result.getBody());
... ... @@ -160,8 +161,8 @@ public class HttpUtils {
160 161 * @return
161 162 */
162 163 public static boolean sendPermission(PermissionBean permissionBean) {
163   - String url = "http://121.40.109.21:8991/file/sendPermission";
164   -// String url = "http://localhost:8991/file/sendPermission";
  164 +// String url = "http://121.40.109.21:8991/file/sendPermission";
  165 + String url = "http://116.62.155.137:8991/file/sendPermission";
165 166 RestTemplate restTemplate = new RestTemplate();
166 167  
167 168 HttpHeaders headers = new HttpHeaders();
... ... @@ -185,11 +186,8 @@ public class HttpUtils {
185 186 public static void sendPermission2HK(PermissionFaceBean permissionFaceBean) {
186 187 String url = "http://114.55.30.100:8089/facereco/sendPermiss";
187 188 PermissionBean permissionBean = permissionFaceBean.getPermissionBean();
188   -
189 189 if (null!=permissionBean){
190   -
191 190 PermissionHKBean permissionHKBean = new PermissionHKBean();
192   -
193 191 permissionHKBean.setDeviceIds(permissionBean.getDeviceIds());
194 192 permissionHKBean.setSchoolId(permissionFaceBean.getSchoolId()+"");
195 193 permissionHKBean.setUserType("2");
... ... @@ -208,8 +206,6 @@ public class HttpUtils {
208 206 ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
209 207  
210 208 System.out.println("海康设备下发权限:" + responseEntity.getBody());
211   -
212 209 }
213   -
214 210 }
215 211 }
... ...
cloud/dahua/src/main/java/com/example/dahua/xiananDao/SendRecordDao.java
... ... @@ -73,10 +73,10 @@ public interface SendRecordDao {
73 73 @Select("select * from Face_SendFail where schoolId = #{schoolId} and userType = #{userType} and deviceID = #{deviceID}")
74 74 List<SendRecordBean> getFaceFails(@Param("userType") int userType, @Param("schoolId") int schoolId, @Param("deviceID") String deviceID);
75 75  
76   - @Insert("insert into Face_Recoder values(#{deviceId},#{user_id},#{name},#{imgurl},#{inOrOut},#{time},#{cardNum},#{temp})")
  76 + @Insert("insert into Face_Recoder values(#{deviceId},#{user_id},#{name},#{imgurl},#{inOrOut},#{time},#{cardNum},#{temp},#{schoolId})")
77 77 void addFaceRecoder(@Param("deviceId") String deviceId, @Param("user_id") String user_id, @Param("name") String name,
78 78 @Param("imgurl") String imgurl, @Param("inOrOut") int inOrOut, @Param("time") String time,
79   - @Param("cardNum") String cardNum,@Param("temp")String temp);
  79 + @Param("cardNum") String cardNum,@Param("temp")String temp,@Param("schoolId")int schoolId);
80 80  
81 81 @Select("select DISTINCT deviceID from Face_SendFail where schoolId = #{schoolId} ")
82 82 List<String> getDeviceIds(@Param("schoolId") String schoolId);
... ...
cloud/dahua/src/main/resources/bootstrap.yml
... ... @@ -18,23 +18,23 @@ spring:
18 18 # show-details: always
19 19  
20 20 #eureka client配置
21   -eureka:
22   - client:
23   - serviceUrl:
  21 +#eureka:
  22 +# client:
  23 +# serviceUrl:
24 24 # defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
25   - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
  25 +# defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
26 26 #http://134.224.249.33:1111/eureka/ 正式库
27 27 #http://134.224.249.33:1111/eureka/ 测试库
28 28 #http://127.0.0.1:8761/eureka,http://127.0.0.1:8762/eureka
29   - registry-fetch-interval-seconds: 5
30   - instance-info-replication-interval-seconds: 10
  29 +# registry-fetch-interval-seconds: 5
  30 +# instance-info-replication-interval-seconds: 10
31 31 instance:
32 32 # prefer-ip-address: false
33   - instance-id: ${spring.application.name}
  33 +# instance-id: ${spring.application.name}
34 34 # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #固定端口
35 35 # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${randomServerPort.value[5000,5005]}} #随机端口
36   - lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测
37   - lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除
  36 +# lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测
  37 +# lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除
38 38 # status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/doc.html # ${server.port}为该服务的端口号
39   - hostname: localhost
  39 +# hostname: localhost
40 40 # status-page-url: http://${spring.cloud.client.ip-address}:${randomServerPort.value[5000,5005]}/document.html # ${server.port}为该服务的端口号
41 41 \ No newline at end of file
... ...
cloud/dahua/src/main/resources/logback-spring.xml
... ... @@ -8,7 +8,10 @@
8 8 <!--<include resource="org/springframework/boot/logging/logback/defaults.xml" />-->
9 9  
10 10 <!--日志文件存储的基础路径: ${user.home} 为当前服务器用户主目录-->
11   - <property name="LOG_PATH" value="E:/dahua-logs"/>
  11 + <!--100-->
  12 + <property name="LOG_PATH" value="E:\dahua\logs"/>
  13 + <!--137-->
  14 + <!--<property name="LOG_PATH" value="C:\workspace\dahua\logs"/>-->
12 15  
13 16 <!--日志文件基础名称-->
14 17 <property name="BASE_FILE_NAME" value="dahua"/>
... ...
cloud/fIle-center/pom.xml
... ... @@ -89,7 +89,22 @@
89 89 </includes>
90 90 </configuration>
91 91 </plugin>
92   -
  92 + <plugin>
  93 + <groupId>org.apache.maven.plugins</groupId>
  94 + <artifactId>maven-dependency-plugin</artifactId>
  95 + <executions>
  96 + <execution>
  97 + <id>copy</id>
  98 + <phase>package</phase>
  99 + <goals>
  100 + <goal>copy-dependencies</goal>
  101 + </goals>
  102 + <configuration>
  103 + <outputDirectory>${project.build.directory}/lib</outputDirectory>
  104 + </configuration>
  105 + </execution>
  106 + </executions>
  107 + </plugin>
93 108 </plugins>
94 109 <finalName>file-center</finalName>
95 110 </build>
... ...
cloud/fIle-center/src/main/java/com/sincere/file/FileApplication.java
... ... @@ -6,7 +6,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 6 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
7 7 import org.springframework.context.annotation.Configuration;
8 8  
9   -@EnableDiscoveryClient
  9 +//@EnableDiscoveryClient
10 10 @SpringBootApplication
11 11 public class FileApplication {
12 12  
... ...
cloud/fIle-center/src/main/resources/bootstrap.yml
... ... @@ -22,23 +22,23 @@ spring:
22 22 # show-details: always
23 23  
24 24 #eureka client配置
25   -eureka:
26   - client:
27   - serviceUrl:
28   - # defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
29   - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
30   - #http://134.224.249.33:1111/eureka/ 正式库
31   - #http://134.224.249.33:1111/eureka/ 测试库
32   - #http://127.0.0.1:8761/eureka,http://127.0.0.1:8762/eureka
33   - registry-fetch-interval-seconds: 5
34   - instance-info-replication-interval-seconds: 10
35   - instance:
36   - # prefer-ip-address: false
37   - instance-id: ${spring.application.name}
38   - # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #固定端口
39   - # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${randomServerPort.value[5000,5005]}} #随机端口
40   - lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测
41   - lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除
42   - # status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/doc.html # ${server.port}为该服务的端口号
43   - hostname: 121.40.30.78
44   -# status-page-url: http://${spring.cloud.client.ip-address}:${randomServerPort.value[5000,5005]}/document.html # ${server.port}为该服务的端口号
45 25 \ No newline at end of file
  26 +#eureka:
  27 +# client:
  28 +# serviceUrl:
  29 +# # defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
  30 +# defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
  31 +# #http://134.224.249.33:1111/eureka/ 正式库
  32 +# #http://134.224.249.33:1111/eureka/ 测试库
  33 +# #http://127.0.0.1:8761/eureka,http://127.0.0.1:8762/eureka
  34 +# registry-fetch-interval-seconds: 5
  35 +# instance-info-replication-interval-seconds: 10
  36 +# instance:
  37 +# # prefer-ip-address: false
  38 +# instance-id: ${spring.application.name}
  39 +# # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${server.port}} #固定端口
  40 +# # instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${spring.application.instance_id:${randomServerPort.value[5000,5005]}} #随机端口
  41 +# lease-renewal-interval-in-seconds: 10 #每隔几秒告诉eureka服务器我还存活,用于心跳检测
  42 +# lease-expiration-duration-in-seconds: 10 #如果心跳检测一直没有发送,10秒后会从eureka服务器中将此服务剔除
  43 +# # status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/doc.html # ${server.port}为该服务的端口号
  44 +# hostname: 121.40.30.78
  45 +## status-page-url: http://${spring.cloud.client.ip-address}:${randomServerPort.value[5000,5005]}/document.html # ${server.port}为该服务的端口号
46 46 \ No newline at end of file
... ...
cloud/haikangface/pom.xml
... ... @@ -169,42 +169,37 @@
169 169 <plugin>
170 170 <groupId>org.springframework.boot</groupId>
171 171 <artifactId>spring-boot-maven-plugin</artifactId>
  172 + <executions>
  173 + <execution>
  174 + <goals>
  175 + <goal>repackage</goal>
  176 + </goals>
  177 + </execution>
  178 + </executions>
172 179 <configuration>
173 180 <includeSystemScope>true</includeSystemScope>
174 181 <layout>ZIP</layout>
175   -<!-- <includes>-->
176   -<!-- <include>-->
177   -<!-- &lt;!&ndash; 排除所有Jar &ndash;&gt;-->
178   -<!-- <groupId>nothing</groupId>-->
179   -<!-- <artifactId>nothing</artifactId>-->
180   -<!-- </include>-->
181   -<!-- </includes>-->
182   - </configuration>
183   - </plugin>
184   - <!--添加maven配置跳过测试-->
185   - <plugin>
186   - <groupId>org.apache.maven.plugins</groupId>
187   - <artifactId>maven-surefire-plugin</artifactId>
188   - <configuration>
189   - <skipTests>true</skipTests>
  182 + <includes>
  183 + <include>
  184 + <!-- 排除所有Jar -->
  185 + <groupId>nothing</groupId>
  186 + <artifactId>nothing</artifactId>
  187 + </include>
  188 + </includes>
190 189 </configuration>
191 190 </plugin>
192 191 <plugin>
193 192 <groupId>org.apache.maven.plugins</groupId>
194 193 <artifactId>maven-dependency-plugin</artifactId>
195   - <!-- <version>2.2</version>&lt;!&ndash;$NO-MVN-MAN-VER$ &ndash;&gt;-->
196 194 <executions>
197 195 <execution>
198   - <id>copy-dependencies</id>
  196 + <id>copy</id>
199 197 <phase>package</phase>
200 198 <goals>
201 199 <goal>copy-dependencies</goal>
202 200 </goals>
203 201 <configuration>
204   - <outputDirectory>${project.build.directory}/libs</outputDirectory>
205   - <overWriteReleases>true</overWriteReleases>
206   - <overWriteSnapshots>true</overWriteSnapshots>
207   - <overWriteIfNewer>true</overWriteIfNewer>
  202 + <outputDirectory>${project.build.directory}/lib</outputDirectory>
208 203 </configuration>
209 204 </execution>
210 205 </executions>
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/CMSServer.java
... ... @@ -64,10 +64,10 @@ public class CMSServer implements ApplicationRunner {
64 64 // 存储设备登录句柄
65 65 static Map<String, NativeLong> map = new HashMap<>();
66 66  
67   - //114.55.30.100
68   - //120.26.116.253
69   -// private String ip_cloud = "114.55.30.100";
70 67 private String ip_cloud = "114.55.30.100";
  68 + private String strPath = "E://EhomePicServer/";
  69 +// private String ip_cloud = "120.26.116.253";
  70 +// private String strPath = "D://EhomePicServer/";
71 71  
72 72 private String ip;
73 73 {
... ... @@ -299,7 +299,6 @@ public class CMSServer implements ApplicationRunner {
299 299 //文件保存回调函数(下载)
300 300 public class PSS_Storage_Callback implements HCEHomeSS.EHomeSSStorageCallBack {
301 301 public boolean invoke(NativeLong iHandle, String pFileName, Pointer pFileBuf, int dwFileLen, Pointer pFilePath, Pointer pUser) {
302   - String strPath = "E://EhomePicServer/";
303 302 //若此目录不存在,则创建之
304 303 File myPath = new File(strPath);
305 304 if (!myPath.exists()) {
... ... @@ -340,7 +339,7 @@ public class CMSServer implements ApplicationRunner {
340 339 deviceId = isQJFileName.substring(start, end);
341 340 }
342 341 //发送看板
343   - sendUserInfoToKB(strFilePathFile, deviceId);
  342 +// sendUserInfoToKB(strFilePathFile, deviceId);
344 343 }
345 344 } catch (FileNotFoundException e) {
346 345 log.error("处理人脸机抓拍文件异常,错误信息:{}",e);
... ... @@ -353,6 +352,10 @@ public class CMSServer implements ApplicationRunner {
353 352 }
354 353 }
355 354  
  355 + public static void main(String[] args) {
  356 + System.out.println(StringUtils.isNotBlank("944"));
  357 + }
  358 +
356 359 private AlarmUtils alarmUtils;//报警工具类
357 360 /**
358 361 * 报警监听回调
... ... @@ -375,7 +378,7 @@ public class CMSServer implements ApplicationRunner {
375 378 @Override
376 379 public void callBack(String minorType, String deviceID, String cardNo, String time, String picDataUrlId, String currTemperature) {
377 380 saveAttendance(deviceID);
378   - AttendanceBean attendanceBean = deviceDao.selectDevice(deviceID);
  381 + AttendanceBean attendanceBean = deviceDao.selectDeviceInfo(deviceID);
379 382 int outOrIn = attendanceBean.getOutOrIn();
380 383 String schoolId = attendanceBean.getSchool_id();
381 384 switch (minorType) {
... ... @@ -385,6 +388,9 @@ public class CMSServer implements ApplicationRunner {
385 388 saveFaceRecoder(deviceID, cardNo, time, picDataUrlId, currTemperature,outOrIn);
386 389 //944柯桥实验幼儿园,海康一体机考勤签到
387 390 if(StringUtils.isNotBlank(schoolId)){
  391 + if(Integer.parseInt(schoolId)== 944){
  392 + log.info("柯桥实验考勤:考勤卡号:{} "+ cardNo);
  393 + }
388 394 if(Integer.parseInt(schoolId)== 944 && !StringUtils.isEmpty(cardNo) && isNumeric(cardNo)){
389 395 kaoQinRecord(outOrIn,cardNo,deviceID,time);
390 396 }
... ... @@ -402,6 +408,9 @@ public class CMSServer implements ApplicationRunner {
402 408 saveFaceRecoder(deviceID, cardNo, time, picDataUrlId, currTemperature,outOrIn);
403 409 //944柯桥实验幼儿园,海康一体机考勤签到
404 410 if(StringUtils.isNotBlank(schoolId)){
  411 + if(Integer.parseInt(schoolId)== 944){
  412 + log.info("柯桥实验考勤:考勤卡号:{} "+ cardNo);
  413 + }
405 414 if(Integer.parseInt(schoolId)== 944 && !StringUtils.isEmpty(cardNo) && isNumeric(cardNo)){
406 415 kaoQinRecord(outOrIn,cardNo,deviceID,time);
407 416 }
... ... @@ -412,6 +421,9 @@ public class CMSServer implements ApplicationRunner {
412 421 saveFaceRecoder(deviceID, cardNo, time, picDataUrlId, currTemperature,outOrIn);
413 422 //944柯桥实验幼儿园,海康一体机考勤签到
414 423 if(StringUtils.isNotBlank(schoolId)){
  424 + if(Integer.parseInt(schoolId)== 944){
  425 + log.info("柯桥实验考勤:考勤卡号:{} "+ cardNo);
  426 + }
415 427 if(Integer.parseInt(schoolId)== 944 && !StringUtils.isEmpty(cardNo) && isNumeric(cardNo)){
416 428 kaoQinRecord(outOrIn,cardNo,deviceID,time);
417 429 }
... ... @@ -444,9 +456,9 @@ public class CMSServer implements ApplicationRunner {
444 456 checkIn.setCheckTime(eventTime);
445 457 sendRecordDao.checkIn(checkIn);
446 458 if (checkIn.getIsSuccess() == 1) {
447   - log.info("考勤成功: checkIn: {}, 方向:{}", JsonUtils.nonDefaultMapper().toJson(checkIn),outOrIn == 1 ? "门" : "出门");
  459 + log.info("柯桥实验幼儿园考勤成功: checkIn: {}, 方向:{}", JsonUtils.nonDefaultMapper().toJson(checkIn),outOrIn == 1 ? "门" : "出门");
448 460 } else {
449   - log.info("考勤失败: checkIn: {}, 方向:{}",JsonUtils.nonDefaultMapper().toJson(checkIn),outOrIn == 1 ? "进门" : "出门");
  461 + log.info("柯桥实验幼儿园考勤失败: checkIn: {}, 方向:{}",JsonUtils.nonDefaultMapper().toJson(checkIn),outOrIn == 1 ? "进门" : "出门");
450 462 }
451 463 }
452 464  
... ... @@ -494,7 +506,7 @@ public class CMSServer implements ApplicationRunner {
494 506 }
495 507 //记录签到成功的流水
496 508 sendRecordDao.addFaceRecoder(face_recoder.getDeviceId(), face_recoder.getUser_id(), face_recoder.getName(),
497   - face_recoder.getImgurl(), face_recoder.getInOrOut(), face_recoder.getTime(), face_recoder.getCardNum(), currTemperature);
  509 + face_recoder.getImgurl(), face_recoder.getInOrOut(), face_recoder.getTime(), face_recoder.getCardNum(), currTemperature,schoolId);
498 510 } else {
499 511 //教师点名
500 512 isTeacher(cardNo, deviceID,null);
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/HaikangfaceApplication.java
... ... @@ -13,8 +13,8 @@ import org.springframework.scheduling.annotation.EnableAsync;
13 13  
14 14 @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, MybatisAutoConfiguration.class})
15 15 @SpringBootApplication
16   -@EnableDiscoveryClient
17   -@EnableFeignClients(basePackages = "com.sincere.haikangface.fegin")
  16 +//@EnableDiscoveryClient
  17 +//@EnableFeignClients(basePackages = "com.sincere.haikangface.fegin")
18 18 @EnableAsync
19 19 public class HaikangfaceApplication {
20 20  
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserControl.java
... ... @@ -9,7 +9,6 @@ import com.sincere.haikangface.bean.StudentBean;
9 9 import com.sincere.haikangface.bean.face.PermissionBean;
10 10 import com.sincere.haikangface.bean.face.UserAndPermission;
11 11 import com.sincere.haikangface.dao.UserDao;
12   -import com.sincere.haikangface.fegin.HaikangfaceFegin;
13 12 import com.sincere.haikangface.service.impl.BaseService;
14 13 import com.sincere.haikangface.utils.CompressPic;
15 14 import com.sincere.haikangface.utils.FileUtils;
... ... @@ -41,8 +40,8 @@ public class UserControl {
41 40 @Autowired
42 41 UserDao userDao;
43 42  
44   - @Autowired
45   - HaikangfaceFegin haikangfaceFegin;
  43 +// @Autowired
  44 +// HaikangfaceFegin haikangfaceFegin;
46 45  
47 46 @Autowired
48 47 CMSServer cmsServer;
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/control/UserOperateController.java
... ... @@ -101,8 +101,9 @@ public class UserOperateController {
101 101 public Result sendFaceForNoSend(@RequestParam("schoolId") Integer schoolId,@RequestParam("userType") Integer userType,
102 102 @RequestParam(value = "studentType",required = false) Integer studentType,
103 103 @RequestParam(value = "sex",required = false) String sex,
104   - @RequestParam(value = "deviceIds",required = false) String deviceIds) {
105   - return userOperateService.sendFaceForNoSend(schoolId,studentType,sex,userType,deviceIds);
  104 + @RequestParam(value = "deviceIds",required = false) String deviceIds,
  105 + @RequestParam(value = "groupId",required = false) Integer groupId) {
  106 + return userOperateService.sendFaceForNoSend(schoolId,studentType,sex,userType,deviceIds,groupId);
106 107 }
107 108  
108 109 @ApiOperation(value = "补发单个人脸至指定设备2.0")
... ... @@ -139,6 +140,14 @@ public class UserOperateController {
139 140 return userOperateService.sendFaceByClassId(schoolId,classIds,deviceIds,studentType,sex,isCheck);
140 141 }
141 142  
  143 + @ApiOperation(value = "根据宿舍分组下发")
  144 + @RequestMapping(value = "sendFaceByGroupId", method = RequestMethod.POST)
  145 + public Result sendFaceByThread(@RequestParam("schoolId") Integer schoolId,
  146 + @RequestParam("groupId") Integer groupId,
  147 + @RequestParam(value = "deviceIds",required = false) String deviceIds) {
  148 + return userOperateService.sendFaceByGroupId(schoolId,groupId,deviceIds);
  149 + }
  150 +
142 151 @ApiOperation(value = "删除指定学校下人脸照片")
143 152 @RequestMapping(value = "deleteBySchoolId", method = RequestMethod.POST)
144 153 public Result exportFace(@RequestParam("schoolId") Integer schoolId,
... ... @@ -146,7 +155,6 @@ public class UserOperateController {
146 155 return userOperateService.deleteFaceBySchoolId(schoolId,deviceIds);
147 156 }
148 157  
149   - @ApiOperation(value = "删除指定学校下无效人脸")
150 158 @RequestMapping(value = "checkFaceSend", method = RequestMethod.GET)
151 159 public void checkFaceSend(){
152 160 userOperateService.checkFaceSend();
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/DeviceDao.java
... ... @@ -28,6 +28,9 @@ public interface DeviceDao {
28 28 @Select("select clint_id from SZ_Attendance where clint_id = #{clint_id}")
29 29 AttendanceBean selectDevice(@Param("clint_id") String clint_id);
30 30  
  31 + @Select("select * from SZ_Attendance where clint_id = #{clint_id}")
  32 + AttendanceBean selectDeviceInfo(@Param("clint_id") String clint_id);
  33 +
31 34 // @Select("select * from SZ_Attendance where IsKaoqin = #{IsKaoqin}")
32 35 // List<SZ_AttendanceDto> getAttensWithIsKaoqin(@Param("IsKaoqin")int IsKaoqin);
33 36  
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/dao/UserDao.java
... ... @@ -264,7 +264,7 @@ public interface UserDao {
264 264  
265 265 List<StudentBean> getStudentList(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sex") List<Integer> sex);
266 266  
267   - List<StudentBean> getStudentCardGroup(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sex") String sex,@Param("groupId")Integer groupId);
  267 + List<StudentBean> getStudentCardGroup(@Param("schoolId") Integer schoolId,@Param("studentType")Integer studentType,@Param("sexList") List<Integer> sexList,@Param("groupId")Integer groupId);
268 268  
269 269 List<StudentBean> getTeacherList(@Param("schoolId") Integer schoolId);
270 270  
... ... @@ -294,4 +294,8 @@ public interface UserDao {
294 294 void updateStudent(@Param("id") Integer id);
295 295  
296 296 List<SaveStudentBak> selectStudentList();
  297 +
  298 + List<Integer> getRoomBySchoolId(@Param("schoolId") Integer schoolId,@Param("groupId") Integer groupId);
  299 +
  300 + List<StudentBean> getStudentByRoomIds(@Param("schoolId") Integer schoolId,@Param("pIdList") List<Integer> pIdList);
297 301 }
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/fegin/HaikangfaceFegin.java
1   -package com.sincere.haikangface.fegin;
2   -
3   -//import com.sincere.common.dto.smartCampus.SZ_AttendanceDto;
4   -
5   -import org.springframework.cloud.openfeign.FeignClient;
6   -import org.springframework.web.bind.annotation.RequestBody;
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RequestMethod;
9   -import org.springframework.web.bind.annotation.RequestParam;
10   -
11   -import java.util.List;
12   -
13   -@FeignClient("smartCampusSearch")
14   -public interface HaikangfaceFegin {
15   -
16   -// @RequestMapping(method = RequestMethod.GET,value = "attendance/selectAttendaceWithId")
17   -// SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id);
  1 +//package com.sincere.haikangface.fegin;
18 2 //
19   -// @RequestMapping(method = RequestMethod.GET,value = "attendance/getAttensWithIsKaoqin")
20   -// List<SZ_AttendanceDto> getAttensWithIsKaoqin(@RequestParam("IsKaoqin") int isKaoqin);
21   -
22   -}
  3 +////import com.sincere.common.dto.smartCampus.SZ_AttendanceDto;
  4 +//
  5 +//import org.springframework.cloud.openfeign.FeignClient;
  6 +//import org.springframework.web.bind.annotation.RequestBody;
  7 +//import org.springframework.web.bind.annotation.RequestMapping;
  8 +//import org.springframework.web.bind.annotation.RequestMethod;
  9 +//import org.springframework.web.bind.annotation.RequestParam;
  10 +//
  11 +//import java.util.List;
  12 +//
  13 +//@FeignClient("smartCampusSearch")
  14 +//public interface HaikangfaceFegin {
  15 +//
  16 +//// @RequestMapping(method = RequestMethod.GET,value = "attendance/selectAttendaceWithId")
  17 +//// SZ_AttendanceDto selectAttendaceWithId(@RequestParam("clint_id") String clint_id);
  18 +////
  19 +//// @RequestMapping(method = RequestMethod.GET,value = "attendance/getAttensWithIsKaoqin")
  20 +//// List<SZ_AttendanceDto> getAttensWithIsKaoqin(@RequestParam("IsKaoqin") int isKaoqin);
  21 +//
  22 +//}
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/service/UserOperateService.java
... ... @@ -91,7 +91,7 @@ public interface UserOperateService {
91 91 * @param deviceIds
92 92 * @return
93 93 */
94   - Result sendFaceForNoSend(Integer schoolId,Integer studentType,String sex,Integer userType,String deviceIds);
  94 + Result sendFaceForNoSend(Integer schoolId,Integer studentType,String sex,Integer userType,String deviceIds,Integer groupId);
95 95  
96 96 /**
97 97 * 补发单个人脸至指定设备
... ... @@ -131,6 +131,8 @@ 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);
  135 +
134 136 /**
135 137 * 删除指定学校下的人脸
136 138 * @param schoolId
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/service/impl/BaseService.java
... ... @@ -2,7 +2,6 @@ package com.sincere.haikangface.service.impl;
2 2  
3 3  
4 4 import com.google.common.util.concurrent.ThreadFactoryBuilder;
5   -import com.google.gson.Gson;
6 5 import com.sincere.haikangface.CMSServer;
7 6 import com.sincere.haikangface.async.AsyncTask;
8 7 import com.sincere.haikangface.async.SendUserAsync;
... ... @@ -15,7 +14,6 @@ import com.sincere.haikangface.enums.EnumSzBusinessType;
15 14 import com.sincere.haikangface.utils.CompressPic;
16 15 import com.sincere.haikangface.utils.DateUtils;
17 16 import com.sincere.haikangface.utils.FileUtils;
18   -import com.sincere.haikangface.utils.HttpUtil;
19 17 import com.sincere.haikangface.xiananDao.SendRecordDao;
20 18 import lombok.extern.slf4j.Slf4j;
21 19 import org.apache.commons.lang3.StringUtils;
... ... @@ -28,8 +26,6 @@ import java.io.File;
28 26 import java.text.SimpleDateFormat;
29 27 import java.util.*;
30 28 import java.util.concurrent.*;
31   -import java.util.function.Function;
32   -import java.util.function.Predicate;
33 29 import java.util.stream.Collectors;
34 30  
35 31 /**
... ... @@ -518,13 +514,35 @@ public class BaseService {
518 514 * @return
519 515 */
520 516 public List<StudentBean> getStudentListByGroup(Integer schoolId,Integer studentType,String sex,Integer groupId) {
521   - List<StudentBean> students = userDao.getStudentCardGroup(schoolId,studentType,sex,groupId);
  517 + List<Integer> sexList = new ArrayList<>();
  518 + if(StringUtils.isNotBlank(sex)){
  519 + String[] msg = sex.split(",");
  520 + for(String s : msg){
  521 + sexList.add(Integer.valueOf(s));
  522 + }
  523 + }
  524 + List<StudentBean> students = userDao.getStudentCardGroup(schoolId,studentType,sexList,groupId);
522 525 //去重重复数据
523 526 List<StudentBean> studentList = students.stream().collect(Collectors.collectingAndThen(
524 527 Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new));
525 528 return studentList;
526 529 }
527 530  
  531 +
  532 + public List<StudentBean> getStudentListByGroupId(Integer schoolId,Integer groupId) {
  533 + List<Integer> rooms = userDao.getRoomBySchoolId(schoolId,groupId);
  534 + if(!CollectionUtils.isEmpty(rooms)) {
  535 + List<Integer> pIdlIst = rooms.stream().distinct().collect(Collectors.toList());
  536 + List<StudentBean> studentBeans = userDao.getStudentByRoomIds(schoolId,pIdlIst);
  537 + //去重重复数据
  538 + List<StudentBean> studentList = studentBeans.stream().collect(Collectors.collectingAndThen(
  539 + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new));
  540 + return studentList;
  541 + }
  542 + return null;
  543 + }
  544 +
  545 +
528 546 /**
529 547 * 获取学校下的老师数据信息
530 548 * @param schoolId
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/service/impl/UserOperateServiceImpl.java
... ... @@ -304,15 +304,24 @@ public class UserOperateServiceImpl implements UserOperateService {
304 304 if (userType == EnumSzBusinessType.EnumUserType.STUDENT.code && groupId ==null) {
305 305 studentBeanList = baseService.getStudentList(schoolId,studentType,sex);
306 306 }else if(userType == EnumSzBusinessType.EnumUserType.STUDENT.code && groupId !=null){
307   - sex = sex.split(",")[0];
308 307 studentBeanList = baseService.getStudentListByGroup(schoolId,studentType,sex,groupId);
309 308 }
310 309 log.info("统计共有下发用户数量:{}",studentBeanList.size());
311 310 //设备类型
312 311 Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0));
313 312 if(clintType.intValue()== 22 || clintType.intValue()== 29){
314   - //发送大华设备
315   - HttpUtil.uploadDHImg(String.valueOf(schoolId),userType,sendFaceDto.getsNos(),studentType,sex);
  313 + if(groupId ==null){
  314 + //发送大华设备
  315 + HttpUtil.uploadDHImg(String.valueOf(schoolId),userType,sendFaceDto.getsNos(),studentType,sex);
  316 + }else{
  317 + Integer finalUserType = userType;
  318 + studentBeanList.stream().forEach(s->{
  319 + String userId = s.getUser_id();
  320 + deviceList.stream().forEach(deviceId ->{
  321 + this.againSendFace(userId,deviceId, finalUserType);
  322 + });
  323 + });
  324 + }
316 325 }
317 326 if(clintType.intValue()== 18 || clintType.intValue()== 28){
318 327 //发送海康设备:异步执行
... ... @@ -618,7 +627,7 @@ public class UserOperateServiceImpl implements UserOperateService {
618 627 }
619 628  
620 629 @Override
621   - public Result sendFaceForNoSend(Integer schoolId,Integer studentType,String sex,Integer userType,String deviceIds) {
  630 + public Result sendFaceForNoSend(Integer schoolId,Integer studentType,String sex,Integer userType,String deviceIds,Integer groupId) {
622 631 //若未传下发,则下发该学校下所有设备
623 632 //下发设备集合
624 633 List<String> idLists = null;
... ... @@ -628,18 +637,21 @@ public class UserOperateServiceImpl implements UserOperateService {
628 637 String[] deviceArr = deviceIds.split(",");
629 638 idLists= new ArrayList<>(Arrays.asList(deviceArr));
630 639 }
  640 + if(CollectionUtils.isEmpty(idLists)){
  641 + log.warn("该学校下未查询到下发设备");
  642 + return ResultGenerator.genFailResult("该学校下未查询到下发设备");
  643 + }
  644 +
631 645 //下发用户集合
632 646 List<StudentBean> list = null;
633   - if(userType.intValue() ==2){
  647 + if (userType == EnumSzBusinessType.EnumUserType.STUDENT.code && groupId ==null) {
634 648 list = baseService.getStudentList(schoolId,studentType,sex);
  649 + }else if(userType == EnumSzBusinessType.EnumUserType.STUDENT.code && groupId !=null){
  650 + list = baseService.getStudentListByGroup(schoolId,studentType,sex,groupId);
635 651 }
636   - if(userType.intValue()==1){
  652 + if(userType.intValue()==EnumSzBusinessType.EnumUserType.TEACHER.code){
637 653 list = baseService.getTeacherList(schoolId);
638 654 }
639   - if(StringUtils.isBlank(deviceIds)){
640   - log.warn("该学校下未查询到下发设备");
641   - return ResultGenerator.genFailResult("该学校下未查询到下发设备");
642   - }
643 655 //异步执行下发
644 656 sendFaceForNoSend(schoolId,userType,list,idLists);
645 657 int fileSize = list.size();
... ... @@ -657,7 +669,7 @@ public class UserOperateServiceImpl implements UserOperateService {
657 669  
658 670  
659 671 @Async
660   - protected void sendFaceForNoSend(Integer schoolId,Integer userType,List<StudentBean> studentList,List<String> deviceIds){
  672 + public void sendFaceForNoSend(Integer schoolId,Integer userType,List<StudentBean> studentList,List<String> deviceIds){
661 673 log.info("统计共有:"+studentList.size()+"张卡,"+deviceIds.size()+"台设备." );
662 674 for(StudentBean studentBean : studentList){
663 675 for(String sno : deviceIds){
... ... @@ -999,6 +1011,42 @@ public class UserOperateServiceImpl implements UserOperateService {
999 1011 }
1000 1012  
1001 1013 @Override
  1014 + public Result sendFaceByGroupId(Integer schoolId,Integer groupId,String deviceIds) {
  1015 + //下发设备集合
  1016 + List<String> deviceList = new ArrayList<>();
  1017 + if(StringUtils.isBlank(deviceIds)){
  1018 + deviceList = deviceDao.selectDeviceBySchoolId(schoolId);
  1019 + }else{
  1020 + String[] deviceArr = deviceIds.split(",");
  1021 + deviceList= new ArrayList<>(Arrays.asList(deviceArr));
  1022 + }
  1023 + //根据类型获取下发用户信息
  1024 + List<StudentBean> studentBeanList = baseService.getStudentListByGroupId(schoolId,groupId);
  1025 + log.info("统计共有下发用户数量:{}",studentBeanList.size());
  1026 + //设备类型
  1027 + Integer clintType = userDao.getClintTypeByDeviceId(deviceList.get(0));
  1028 +// if(clintType.intValue()== 22 || clintType.intValue()== 29){
  1029 +// //发送大华设备
  1030 +// HttpUtil.uploadDHImgByClassId(String.valueOf(schoolId),deviceIds);
  1031 +// }
  1032 + if(clintType.intValue()== 18 || clintType.intValue()== 28){
  1033 + //发送海康设备:异步执行
  1034 + baseService.sendUserFaceByAsyncThread(schoolId,2,studentBeanList,deviceList);
  1035 + }
  1036 + int fileSize = studentBeanList.size();
  1037 + int clintNum = deviceList.size();
  1038 + //下发所用时长
  1039 + int timeLength = new Double(clintNum * fileSize * 0.06).intValue();
  1040 + //下发截止时间
  1041 + String dateStr = baseService.getTime(fileSize,clintNum,timeLength);
  1042 + Map map = new HashMap();
  1043 + map.put("timeLength",timeLength);
  1044 + map.put("afterDate",dateStr);
  1045 + map.put("fileSize",fileSize);
  1046 + return ResultGenerator.genSuccessResult(objectMapper.toJson(map));
  1047 + }
  1048 +
  1049 + @Override
1002 1050 public Result deleteFaceBySchoolId(Integer schoolId, String deviceIds) {
1003 1051 //下发设备集合
1004 1052 List<String> deviceList = null;
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/utils/HttpUtil.java
... ... @@ -114,7 +114,6 @@ public class HttpUtil {
114 114 }
115 115 try{
116 116 String url = "http://120.26.116.253:8089/file/uploadImg";
117   -// String url = "http://127.0.0.1:8089/file/uploadImg";
118 117 RestTemplate restTemplate = new RestTemplate();
119 118 HttpHeaders headers = new HttpHeaders();
120 119 MediaType mediaType = MediaType.parseMediaType(MediaType.MULTIPART_FORM_DATA_VALUE);
... ... @@ -249,8 +248,7 @@ public class HttpUtil {
249 248 */
250 249 public static void sendDHPermission(PermissionDHBean permissionBean) {
251 250 try{
252   - String url = "http://121.40.109.21:8991/file/sendPermission";
253   -// String url = "http://127.0.0.1:8991/file/sendPermission";
  251 + String url = "http://116.62.155.137:8991/file/sendPermission";
254 252 RestTemplate restTemplate = new RestTemplate();
255 253 HttpHeaders headers = new HttpHeaders();
256 254 MediaType mediaType = MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE);
... ... @@ -289,7 +287,6 @@ public class HttpUtil {
289 287 */
290 288 public static void uploadDHImg(String schoolId,Integer userType,String deviceIds,Integer studentType,String sex) {
291 289 String api = "http://114.55.30.100:8991/operate/sendUserFaces";
292   -// String api = "http://127.0.0.1:8991/user/sendFaces";
293 290 try {
294 291 String url = String.format(api +"?schoolId=%s&userType=%s&deviceIds=%s&studentType=%s&sex=%s",schoolId,userType,deviceIds,studentType,sex);
295 292 RestTemplate restTemplate = new RestTemplate();
... ... @@ -319,7 +316,7 @@ public class HttpUtil {
319 316 * @param deviceId
320 317 */
321 318 public static void deleteDHFace(Integer schoolId,String cardNum,String deviceId) {
322   - String api = "http://121.40.109.21:8991/operate/deleteFaceByCard";
  319 + String api = "http://116.62.155.137:8991/operate/deleteFaceByCard";
323 320 try {
324 321 String url = String.format(api +"?schoolId=%s&cardNum=%s&deviceId=%s",schoolId,cardNum,deviceId);
325 322 RestTemplate restTemplate = new RestTemplate();
... ...
cloud/haikangface/src/main/java/com/sincere/haikangface/xiananDao/SendRecordDao.java
... ... @@ -36,10 +36,10 @@ public interface SendRecordDao {
36 36 @Select("select a.deviceID,a.Num,a.Name from Face_SendFail a inner join Face_SendSuccess b on a.deviceID = b.deviceID where a.schoolId = 1030 and a.num = b.Num")
37 37 List<SendRecordBean> getSuccessAndFail();
38 38  
39   - @Insert("insert into Face_Recoder values(#{deviceId},#{user_id},#{name},#{imgurl},#{inOrOut},#{time},#{cardNum},#{temp})")
  39 + @Insert("insert into Face_Recoder values(#{deviceId},#{user_id},#{name},#{imgurl},#{inOrOut},#{time},#{cardNum},#{temp},#{schoolId})")
40 40 void addFaceRecoder(@Param("deviceId") String deviceId, @Param("user_id") String user_id, @Param("name") String name,
41 41 @Param("imgurl") String imgurl, @Param("inOrOut") int inOrOut, @Param("time") String time,
42   - @Param("cardNum") String cardNum, @Param("temp") String currTemperature);
  42 + @Param("cardNum") String cardNum, @Param("temp") String currTemperature,@Param("schoolId") int schoolId);
43 43  
44 44 @Insert("insert into SZ_AttendanceRecordsSS201911 values(#{user_id},#{school_id},#{customerId},#{usertype},#{card_num},#{card_type},#{outof},#{intime},#{cid}," +
45 45 "#{func_no},#{head_image},#{classId},#{s},#{attendance_id},#{name},#{mobile},#{class_name},#{sex},#{student_type},#{systime})")
... ...
cloud/haikangface/src/main/resources/application.yaml
... ... @@ -38,14 +38,14 @@ ribbon:
38 38 ReadTimeout: 50000
39 39 ConnectTimeout: 5000
40 40  
41   -eureka:
42   - instance:
43   - hostname: localhost
44   - lease-expiration-duration-in-seconds: 60
45   - lease-renewal-interval-in-seconds: 10
46   - client:
47   - service-url:
48   - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
  41 +#eureka:
  42 +# instance:
  43 +# hostname: localhost
  44 +# lease-expiration-duration-in-seconds: 60
  45 +# lease-renewal-interval-in-seconds: 10
  46 +# client:
  47 +# service-url:
  48 +# defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
49 49 # defaultZone: http://localhost:8761/eureka/,http://localhost:8762/eureka/
50 50  
51 51 mybatis:
... ...
cloud/haikangface/src/main/resources/mapper/usermapper.xml
... ... @@ -102,8 +102,19 @@
102 102 </select>
103 103  
104 104 <select id="getStudentCardGroup" resultType="com.sincere.haikangface.bean.StudentBean">
105   - select * from SZ_V_School_Student where sex = #{sex} and student_type = #{studentType} and
106   - class_id in(select DISTINCT ClassId from SZ_OneCardGrouping where Pid = #{groupId} and state = 1)
  105 + select * from SZ_V_School_Student where school_id = #{schoolId}
  106 + <if test="studentType != null">
  107 + and student_type = #{studentType}
  108 + </if>
  109 + <if test="sexList != null and sexList.size() >0">
  110 + and sex in
  111 + <foreach item="item" collection="sexList" separator="," open="(" close=")" index="">
  112 + #{item}
  113 + </foreach>
  114 + </if>
  115 + <if test="groupId != null">
  116 + and class_id in(select DISTINCT ClassId from SZ_OneCardGrouping where Pid = #{groupId} and state = 1)
  117 + </if>
107 118 </select>
108 119  
109 120 <select id="getTeacherList" resultType="com.sincere.haikangface.bean.StudentBean">
... ... @@ -188,4 +199,26 @@
188 199 <update id="updateStudent" parameterType="java.lang.Integer">
189 200 update sz_student_bak set status = 1 where id = #{id}
190 201 </update>
  202 +
  203 + <select id="getRoomBySchoolId" resultType="java.lang.Integer">
  204 + select Id from ss_room where schoolId = #{schoolId} and pId = #{groupId}
  205 + </select>
  206 +
  207 + <select id="getStudentByRoomIds" resultType="com.sincere.haikangface.bean.StudentBean">
  208 + SELECT
  209 + ssu.*
  210 + from SS_RoomNumber ssr
  211 + LEFT JOIN SZ_V_School_Student ssu ON ssr.studentId = ssu.student_id
  212 + <where>
  213 + <if test="schoolId != null">
  214 + and ssr.schoolId = #{schoolId}
  215 + </if>
  216 + <if test="pIdList != null and pIdList.size()>0">
  217 + and ssr.Pid in
  218 + <foreach item="item" collection="pIdList" open="(" separator="," close=")" index="">
  219 + #{item}
  220 + </foreach>
  221 + </if>
  222 + </where>
  223 + </select>
191 224 </mapper>
... ...
cloud/pom.xml
... ... @@ -27,24 +27,24 @@
27 27 <modules>
28 28 <module>server1</module>
29 29 <module>server2</module>
30   - <module>autho</module>
  30 +<!-- <module>autho</module>-->
31 31 <module>common</module>
32   - <module>getaway</module>
33   - <!--<module>haikang</module>-->
34   -<!-- <module>dahua</module>-->
35   - <!-- <module>consumer</module>-->
36   -<!-- <module>haikangface</module>-->
37   - <!-- <module>search_independence</module>-->
38   - <!-- <module>search_smartCampus</module>-->
39   - <!-- <module>search_xiaoan</module>-->
  32 + <module>dahua</module>
  33 + <module>haikangface</module>
  34 +<!-- <module>quartz</module>-->
  35 +<!-- <module>getaway</module>-->
  36 +<!-- <module>haikang</module>-->
  37 +<!-- <module>consumer</module>-->
  38 +<!-- <module>search_independence</module>-->
  39 +<!-- <module>search_smartCampus</module>-->
  40 +<!-- <module>search_xiaoan</module>-->
40 41 <!-- <module>mypulsar</module>-->
41   - <!-- <module>weigeng</module>-->
42   - <!-- <module>independence</module>-->
43   - <module>quartz</module>
44   -<!-- <module>zkAttendance</module>-->
45   - <module>user_search</module>
  42 +<!-- <module>weigeng</module>-->
  43 +<!-- <module>independence</module>-->
  44 +<!-- <module>zkAttendance</module>-->
  45 +<!-- <module>user_search</module>-->
46 46 <module>fIle-center</module>
47   - <module>RibbonConsume</module>
  47 +<!-- <module>RibbonConsume</module>-->
48 48 </modules>
49 49  
50 50 <dependencies>
... ...
cloud/quartz/src/main/java/com/sincere/quartz/job/SyncJob.java
... ... @@ -23,7 +23,7 @@ public class SyncJob {
23 23 YXYReadService yxyReadService ;
24 24  
25 25 @Scheduled(cron = "30 1 22 * * ? ")
26   -// @Scheduled(cron = "* 20 9 * * ? ")
  26 +// @Scheduled(fixedDelay = 120 * 60 * 1000)
27 27 public void Sync(){
28 28 //翼校通的同步 之后还有钉钉的同步等等
29 29 yxyReadService.sync();
... ...
cloud/quartz/src/main/java/com/sincere/quartz/third/yixueyun/YXYReadService.java
... ... @@ -112,7 +112,8 @@ public class YXYReadService {
112 112 logger.info("------------------当天更新完成");
113 113 try{
114 114 String today = DateUtils.getToday(DateUtils.format1)+" 22:00:00" ;
115   - int number = Integer.parseInt(readFileContent("D:\\cloud\\config.txt"));
  115 +// int number = Integer.parseInt(readFileContent("E:\\cloud\\config.txt"));
  116 + int number = 300000;
116 117 logger.info("开始执行删除同步数据------:时间:"+today);
117 118 int count = yxyService.selectCount(today);
118 119 logger.info("跑批总数:count: "+ count);
... ...
cloud/quartz/src/main/resources/application.yaml
... ... @@ -32,12 +32,12 @@ mybatis:
32 32 ribbon:
33 33 ReadTimeout: 50000
34 34 ConnectTimeout: 5000
35   -eureka:
36   - instance:
37   - hostname: localhost
38   - lease-expiration-duration-in-seconds: 60
39   - lease-renewal-interval-in-seconds: 10
40   - client:
41   - service-url:
42   - defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
  35 +#eureka:
  36 +# instance:
  37 +# hostname: localhost
  38 +# lease-expiration-duration-in-seconds: 60
  39 +# lease-renewal-interval-in-seconds: 10
  40 +# client:
  41 +# service-url:
  42 +# defaultZone: http://121.40.109.21:8761/eureka/,http://121.40.109.21:8762/eureka/
43 43  
... ...