Commit 919c75a57c4f858d11ca5a248ecc386b479cd31e
1 parent
86dc0d39
Exists in
master
大华代码提交
Showing
5 changed files
with
73 additions
and
0 deletions
Show diff stats
cloud/dahua/src/main/java/com/example/dahua/control/UserOperateController.java
@@ -91,4 +91,11 @@ public class UserOperateController { | @@ -91,4 +91,11 @@ public class UserOperateController { | ||
91 | @RequestParam(value = "deviceIds",required = false) String deviceIds){ | 91 | @RequestParam(value = "deviceIds",required = false) String deviceIds){ |
92 | userOperateService.sendFaceByClassId(schoolId,classIds,deviceIds); | 92 | userOperateService.sendFaceByClassId(schoolId,classIds,deviceIds); |
93 | } | 93 | } |
94 | + | ||
95 | + @ApiOperation(value = "删除指定学校下无效人脸") | ||
96 | + @RequestMapping(value = "deleteFaceByClassId", method = RequestMethod.POST) | ||
97 | + public void exportFace(@RequestParam("schoolId") Integer schoolId, | ||
98 | + @RequestParam(value = "deviceIds",required = false) String deviceIds){ | ||
99 | + userOperateService.deleteFaceByClassId(schoolId,deviceIds); | ||
100 | + } | ||
94 | } | 101 | } |
cloud/dahua/src/main/java/com/example/dahua/service/UserOperateService.java
@@ -20,5 +20,7 @@ public interface UserOperateService { | @@ -20,5 +20,7 @@ public interface UserOperateService { | ||
20 | */ | 20 | */ |
21 | void sendFaceByClassId(Integer schoolId,String classIds,String deviceIds); | 21 | void sendFaceByClassId(Integer schoolId,String classIds,String deviceIds); |
22 | 22 | ||
23 | + void deleteFaceByClassId(Integer schoolId,String deviceIds); | ||
24 | + | ||
23 | void test6(Integer schoolId,Integer roomId,Integer type,Integer outof,String intime,String clintId,String startTime,String endTime); | 25 | void test6(Integer schoolId,Integer roomId,Integer type,Integer outof,String intime,String clintId,String startTime,String endTime); |
24 | } | 26 | } |
cloud/dahua/src/main/java/com/example/dahua/service/imp/BaseService.java
@@ -145,4 +145,21 @@ public class BaseService { | @@ -145,4 +145,21 @@ public class BaseService { | ||
145 | Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new)); | 145 | Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StudentBean::getStudent_num))), ArrayList::new)); |
146 | return studentList; | 146 | return studentList; |
147 | } | 147 | } |
148 | + | ||
149 | + /** | ||
150 | + * 获取指定学校下的学生卡信息 | ||
151 | + * @param schoolId | ||
152 | + * @return | ||
153 | + */ | ||
154 | + public List<SendRecordBean> getRecordCardBySchoolId(int schoolId) { | ||
155 | + List<SendRecordBean> allStudents = new LinkedList<>(); | ||
156 | + List<SendRecordBean> students = sendRecordDao.getSendFaceSuccess(schoolId); | ||
157 | + allStudents.addAll(students); | ||
158 | + List<SendRecordBean> students2 = sendRecordDao.getFaceRecord(schoolId); | ||
159 | + allStudents.addAll(students2); | ||
160 | + //去重重复数据 | ||
161 | + List<SendRecordBean> studentList = allStudents.stream().collect(Collectors.collectingAndThen( | ||
162 | + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SendRecordBean::getNum))),ArrayList::new)); | ||
163 | + return studentList; | ||
164 | + } | ||
148 | } | 165 | } |
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserOperateServiceImpl.java
1 | package com.example.dahua.service.imp; | 1 | package com.example.dahua.service.imp; |
2 | 2 | ||
3 | +import com.example.dahua.MyTask; | ||
4 | +import com.example.dahua.bean.SendRecordBean; | ||
3 | import com.example.dahua.bean.StudentBean; | 5 | import com.example.dahua.bean.StudentBean; |
4 | import com.example.dahua.bean.UserInfoBean; | 6 | import com.example.dahua.bean.UserInfoBean; |
5 | import com.example.dahua.dao.UserDao; | 7 | import com.example.dahua.dao.UserDao; |
6 | import com.example.dahua.lib.CompressPic; | 8 | import com.example.dahua.lib.CompressPic; |
7 | import com.example.dahua.lib.FilePath; | 9 | import com.example.dahua.lib.FilePath; |
10 | +import com.example.dahua.lib.NetSDKLib; | ||
11 | +import com.example.dahua.module.GateModule2; | ||
8 | import com.example.dahua.service.UserOperateService; | 12 | import com.example.dahua.service.UserOperateService; |
9 | import com.example.dahua.utils.DateFormatUtil; | 13 | import com.example.dahua.utils.DateFormatUtil; |
10 | import com.example.dahua.utils.DateUtils; | 14 | import com.example.dahua.utils.DateUtils; |
@@ -175,4 +179,39 @@ public class UserOperateServiceImpl implements UserOperateService { | @@ -175,4 +179,39 @@ public class UserOperateServiceImpl implements UserOperateService { | ||
175 | String dateStr = DateUtils.date2String(afterDate,DateUtils.format3); | 179 | String dateStr = DateUtils.date2String(afterDate,DateUtils.format3); |
176 | return dateStr; | 180 | return dateStr; |
177 | } | 181 | } |
182 | + | ||
183 | + @Override | ||
184 | + public void deleteFaceByClassId(Integer schoolId,String deviceIds) { | ||
185 | + //下发设备集合 | ||
186 | + List<String> deviceList = new ArrayList<>(); | ||
187 | + if(StringUtils.isEmpty(deviceIds)){ | ||
188 | + deviceList = userDao.selectDeviceBySchoolId(schoolId); | ||
189 | + }else{ | ||
190 | + String[] deviceArr = deviceIds.split(","); | ||
191 | + deviceList= new ArrayList<>(Arrays.asList(deviceArr)); | ||
192 | + } | ||
193 | + List<SendRecordBean> students= baseService.getRecordCardBySchoolId(schoolId.intValue()); | ||
194 | + if(!CollectionUtils.isEmpty(students)){ | ||
195 | + for(SendRecordBean s : students){ | ||
196 | + String cardNum = s.getNum(); | ||
197 | + String userId = s.getUserId(); | ||
198 | + StudentBean studentBean = userDao.getStudentWithCard(cardNum,schoolId.intValue()); | ||
199 | + if(studentBean == null){ | ||
200 | + deviceList.stream().forEach(deviceId->{ | ||
201 | + int isOk = 1; | ||
202 | + //登录设备 | ||
203 | + NetSDKLib.LLong loginHandleLong = MyTask.lLongSendMap.get(deviceId); | ||
204 | + if (loginHandleLong !=null) { | ||
205 | + isOk = GateModule2.deleteFace(userId,loginHandleLong); | ||
206 | + } | ||
207 | + if(isOk ==0){ | ||
208 | + log.info("删除成功: 用户:{}, 卡号: {}, 设备:{}", s.getName(),cardNum,deviceId); | ||
209 | + //删除成功记录 | ||
210 | + sendRecordDao.deleteRecordById(schoolId,deviceId,cardNum); | ||
211 | + } | ||
212 | + }); | ||
213 | + } | ||
214 | + } | ||
215 | + } | ||
216 | + } | ||
178 | } | 217 | } |
cloud/dahua/src/main/java/com/example/dahua/xiananDao/SendRecordDao.java
@@ -30,6 +30,8 @@ public interface SendRecordDao { | @@ -30,6 +30,8 @@ public interface SendRecordDao { | ||
30 | @Update("update Face_SendSuccess set time = #{time} where num = #{num} and deviceID = #{deviceID} ") | 30 | @Update("update Face_SendSuccess set time = #{time} where num = #{num} and deviceID = #{deviceID} ") |
31 | void updateFaceSuccess(@Param("time") String time, @Param("deviceID") String clint_id, @Param("num") String num); | 31 | void updateFaceSuccess(@Param("time") String time, @Param("deviceID") String clint_id, @Param("num") String num); |
32 | 32 | ||
33 | + @Select("select * from Face_SendSuccess where schoolId = #{schoolId} ") | ||
34 | + List<SendRecordBean> getSendFaceSuccess(@Param("schoolId") Integer schoolId); | ||
33 | 35 | ||
34 | @Insert("insert into Face_SendFail values(#{deviceID},#{customerid},#{num},#{name},#{time},#{schoolName},#{imgPath},#{schoolId},#{failContent},#{failType},#{userType},#{deviceType})") | 36 | @Insert("insert into Face_SendFail values(#{deviceID},#{customerid},#{num},#{name},#{time},#{schoolName},#{imgPath},#{schoolId},#{failContent},#{failType},#{userType},#{deviceType})") |
35 | void addFaceFail(@Param("customerid") String customerid, @Param("deviceID") String deviceID, @Param("num") String num, @Param("name") String name, | 37 | void addFaceFail(@Param("customerid") String customerid, @Param("deviceID") String deviceID, @Param("num") String num, @Param("name") String name, |
@@ -102,6 +104,9 @@ public interface SendRecordDao { | @@ -102,6 +104,9 @@ public interface SendRecordDao { | ||
102 | @Update("delete from Face_SendRecord where id = #{id}") | 104 | @Update("delete from Face_SendRecord where id = #{id}") |
103 | void deleteRecord(@Param("id") Integer id); | 105 | void deleteRecord(@Param("id") Integer id); |
104 | 106 | ||
107 | + @Delete("delete Face_SendRecord where deviceID = #{deviceID} and Num = #{Num} and schoolId = #{schoolId}") | ||
108 | + void deleteRecordById(@Param("schoolId") Integer schoolId,@Param("deviceID") String deviceID,@Param("Num") String Num); | ||
109 | + | ||
105 | // ======================== 表 Face_SendRecord ======================== | 110 | // ======================== 表 Face_SendRecord ======================== |
106 | @Select("select * from Face_SendRecord where schoolId = #{schoolId} and deviceID = #{deviceID} and Num = #{Num} and userId = #{userId}") | 111 | @Select("select * from Face_SendRecord where schoolId = #{schoolId} and deviceID = #{deviceID} and Num = #{Num} and userId = #{userId}") |
107 | List<SendRecordBean> getRecordIsExit(@Param("schoolId") Integer schoolId,@Param("deviceID") String deviceId, @Param("Num") String card,@Param("userId") String userId); | 112 | List<SendRecordBean> getRecordIsExit(@Param("schoolId") Integer schoolId,@Param("deviceID") String deviceId, @Param("Num") String card,@Param("userId") String userId); |
@@ -120,6 +125,9 @@ public interface SendRecordDao { | @@ -120,6 +125,9 @@ public interface SendRecordDao { | ||
120 | @Select("select * from Face_SendRecord where schoolId = #{schoolId} and status =2") | 125 | @Select("select * from Face_SendRecord where schoolId = #{schoolId} and status =2") |
121 | List<SendRecordBean> getFailRecord(@Param("schoolId") Integer schoolId); | 126 | List<SendRecordBean> getFailRecord(@Param("schoolId") Integer schoolId); |
122 | 127 | ||
128 | + @Select("select * from Face_SendRecord where schoolId = #{schoolId}") | ||
129 | + List<SendRecordBean> getFaceRecord(@Param("schoolId") Integer schoolId); | ||
130 | + | ||
123 | @Select("select count(*) from SZ_AttendanceRecordsSS202101 where school_id = #{schoolId} and card_num = #{cardNum} and card_type = #{cardType} and outof=#{outof} and intime > #{startTime} and intime < #{endTime} ") | 131 | @Select("select count(*) from SZ_AttendanceRecordsSS202101 where school_id = #{schoolId} and card_num = #{cardNum} and card_type = #{cardType} and outof=#{outof} and intime > #{startTime} and intime < #{endTime} ") |
124 | int getSSKaoQin(@Param("schoolId") Integer schoolId,@Param("cardNum") String cardNum,@Param("cardType") Integer cardType,@Param("outof") Integer outof,@Param("startTime") String startTime,@Param("endTime") String endTime); | 132 | int getSSKaoQin(@Param("schoolId") Integer schoolId,@Param("cardNum") String cardNum,@Param("cardType") Integer cardType,@Param("outof") Integer outof,@Param("startTime") String startTime,@Param("endTime") String endTime); |
125 | 133 |