Commit 0e6455b5ce20ff2aacb9fcb18732a89c013d1139

Authored by 徐泉
1 parent 0135242b
Exists in master

sss

cloud/dahua/src/main/java/com/example/dahua/async/SendUserInfoTask2.java
1 1 package com.example.dahua.async;
2 2  
3 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
4 5 import com.example.dahua.MyTask;
5 6 import com.example.dahua.bean.*;
6 7 import com.example.dahua.dao.UserDao;
... ... @@ -116,7 +117,7 @@ public class SendUserInfoTask2 {
116 117 */
117 118 pushCardAndFace(file, userInfoBean, deviceList,sendRecordBean.getUserType()+"",sendRecordBean.getFailType());
118 119 } catch (Exception e) {
119   - log.error("下发失败");
  120 + log.error("下发失败:{}",e);
120 121 return false;
121 122 }
122 123 return false;
... ... @@ -150,7 +151,7 @@ public class SendUserInfoTask2 {
150 151 * @param failType
151 152 */
152 153 private synchronized void pushCardAndFace(String picSrc, UserInfoBean userInfoBean,List<String> deviceList,String userType, int failType) {
153   - log.info("下发人脸设备总数,size: "+ deviceList.size());
  154 + log.info("下发人脸设备总数,size:{},用户信息:{}",deviceList.size(), JSONObject.toJSONString(userInfoBean));
154 155 String facePath = compressPic(picSrc,userInfoBean.getStudentcode());
155 156 if(StringUtils.isEmpty(facePath)){
156 157 log.warn("压缩后图片路径为空!");
... ...
cloud/dahua/src/main/java/com/example/dahua/service/imp/BaseService.java
... ... @@ -216,7 +216,7 @@ public class BaseService {
216 216 }
217 217  
218 218 public List<String> getDeviceList(String deviceIds,Integer schoolId){
219   - if(StringUtils.isEmpty(deviceIds)) return Arrays.asList(deviceIds.split(","));
  219 + if(!StringUtils.isEmpty(deviceIds)) return Arrays.asList(deviceIds.split(","));
220 220 return userDao.selectDeviceBySchoolId(schoolId);
221 221 }
222 222  
... ...
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserOperateServiceImpl.java
... ... @@ -70,7 +70,7 @@ public class UserOperateServiceImpl implements UserOperateService {
70 70 if(Objects.equals(faceBean.getUserType(),2)) studentBeans = baseService.getStudentByClassId(faceBean);
71 71 else studentBeans = baseService.getTeacherList(faceBean.getSchoolId());
72 72 if(CollectionUtils.isEmpty(studentBeans)) return;
73   - log.info("统计共有下发用户数量:{}",studentBeans.size());
  73 + log.info("统计共有下发用户数量:{},下发设备数量:{}",studentBeans.size(),deviceList.size());
74 74 //下发人脸
75 75 sendFace(studentBeans,deviceList, faceBean.getSchoolId(), faceBean.getUserType());
76 76 }
... ... @@ -80,7 +80,7 @@ public class UserOperateServiceImpl implements UserOperateService {
80 80 List<String> deviceList = baseService.getDeviceList(faceBean.getDeviceIds(),faceBean.getSchoolId());
81 81 //根据类型获取下发用户信息
82 82 List<StudentBean> studentBeans = baseService.getStudentByRoomId(faceBean.getSchoolId(),faceBean.getRoomId());
83   - log.info("统计共有下发用户数量:{}",studentBeans.size());
  83 + log.info("统计共有下发用户数量:{},下发设备数量:{}",studentBeans.size(),deviceList.size());
84 84 //下發人臉
85 85 sendFace(studentBeans,deviceList, faceBean.getSchoolId(),faceBean.getUserType());
86 86 }
... ...
cloud/dahua/src/main/java/com/example/dahua/service/imp/UserServiceImp.java
... ... @@ -81,6 +81,7 @@ public class UserServiceImp implements UserService {
81 81 userInfoBean.setUser_id(teacher.getUser_id());
82 82 userInfoBean.setStudentcode(teacher.getNum());
83 83 userInfoBean.setStudent_id(teacher.getTeacher_id());
  84 + userInfoBean.setSchool_id(schoolId+"");
84 85 }
85 86 }
86 87 //下发任务
... ...
cloud/dahua/src/main/java/com/example/dahua/utils/HttpUtils.java
... ... @@ -47,7 +47,7 @@ public class HttpUtils {
47 47 multivaluedMap.add("studentCode", studentCode);
48 48 multivaluedMap.add("userType", userType);
49 49 if(!StringUtils.isEmpty(deviceId)){
50   - multivaluedMap.add("deviceIds", deviceId);
  50 + multivaluedMap.add("deviceId", deviceId);
51 51 }
52 52 httpEntity = new HttpEntity<>(multivaluedMap, headers);
53 53 responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
... ...
cloud/haikangface/src/test/java/com/sincere/haikangface/HaikangfaceApplicationTests.java
1   -package com.sincere.haikangface;
2   -
3   -import com.alibaba.fastjson.JSONObject;
4   -import com.drew.imaging.jpeg.JpegMetadataReader;
5   -import com.drew.imaging.jpeg.JpegProcessingException;
6   -import com.drew.metadata.Directory;
7   -import com.drew.metadata.Metadata;
8   -import com.drew.metadata.MetadataException;
9   -import com.drew.metadata.exif.ExifDirectory;
10   -import com.sincere.haikangface.admindao.ZuoyeAdminDao;
11   -import com.sincere.haikangface.bean.*;
12   -import com.sincere.haikangface.bean.homework.QuestionBean;
13   -import com.sincere.haikangface.bean.test.SaveStudentBak;
14   -import com.sincere.haikangface.bean.xiaoan.AttendanceRecordsSS;
15   -import com.sincere.haikangface.bean.xiaoan.CreditCardRecordsSS;
16   -import com.sincere.haikangface.dao.DeviceDao;
17   -import com.sincere.haikangface.dao.UserDao;
18   -import com.sincere.haikangface.dao.ZuoYeDao;
19   -import com.sincere.haikangface.service.impl.BaseService;
20   -import com.sincere.haikangface.utils.ApiUtil;
21   -import com.sincere.haikangface.utils.DateUtils;
22   -import com.sincere.haikangface.xiananDao.SendRecordDao;
23   -import org.apache.commons.lang3.RandomStringUtils;
24   -import org.bouncycastle.asn1.cms.MetaData;
25   -import org.hibernate.validator.constraints.LuhnCheck;
26   -import org.junit.Test;
27   -import org.junit.runner.RunWith;
28   -import org.springframework.beans.factory.annotation.Autowired;
29   -import org.springframework.boot.test.context.SpringBootTest;
30   -import org.springframework.core.io.FileSystemResource;
31   -import org.springframework.http.HttpEntity;
32   -import org.springframework.http.HttpHeaders;
33   -import org.springframework.http.MediaType;
34   -import org.springframework.http.ResponseEntity;
35   -import org.springframework.test.context.junit4.SpringRunner;
36   -import org.springframework.util.CollectionUtils;
37   -import org.springframework.util.LinkedMultiValueMap;
38   -import org.springframework.util.MultiValueMap;
39   -import org.springframework.util.StringUtils;
40   -import org.springframework.web.client.RestTemplate;
41   -
42   -import javax.imageio.stream.FileImageInputStream;
43   -import javax.imageio.stream.FileImageOutputStream;
44   -import javax.ws.rs.core.MultivaluedMap;
45   -import java.io.*;
46   -import java.math.BigInteger;
47   -import java.text.SimpleDateFormat;
48   -import java.util.*;
49   -
50   -@RunWith(SpringRunner.class)
51   -@SpringBootTest
52   -public class HaikangfaceApplicationTests {
53   -
54   - @Autowired
55   - UserDao userDao;
56   -
57   - @Autowired
58   - DeviceDao deviceDao;
59   -
60   - @Autowired
61   - SendRecordDao sendRecordDao;
62   -
63   - @Autowired
64   - ZuoYeDao zuoYeDao;
65   -
66   - @Autowired
67   - ZuoyeAdminDao zuoyeAdminDao;
68   -
69   - @Autowired
70   - BaseService baseService;
71   -
72   - @Test
73   - public void sync() {
74   -// String deviceIds = "338652415671,694642005671,694642555671,338652515671,338653105671,338652895671,ytj687425415671,ytj694642105671,694642135671,ytj694642375671";
75   -// String deviceIds = "687425135671,ytj687425345671,ytj687425395671,ytj687425155671,687425355671,687425225671,687425265671,740456495671,687425325671,694642215671";
76   - //陆埠
77   - String deviceIds = "840153165671,840153205671,840153485671,840153965671,840153325671,840153835671,840154005671,840153105671";
78   - //艺术
79   -// String deviceIds = "567176463869,567176463898,567176463903,567176463892";
80   - Integer schoolId = 1066;
81   - baseService.clearStudent(schoolId,deviceIds);
82   - baseService.clearStudent2(schoolId);
83   - }
84   -
85   - @Test
86   - public void checkFaceSend() {
87   - String deviceIds = "694642005671,694642215671,687425355671,687425325671,338652895671,687425135671,ytj694642375671,338652415671,687425265671,ytj687425345671,338652515671,694642555671,ytj694642105671,338653105671,ytj687425415671,ytj687425155671,740456495671,694642135671,ytj687425395671,687425225671";
88   - //下发设备集合
89   - List<String> deviceList= new ArrayList<>(Arrays.asList(deviceIds.split(",")));
90   - List<StudentBean> studentBeans = userDao.getStudentBySchoolId(865);
91   - studentBeans.stream().distinct().forEach(studentBean -> {
92   - String name = studentBean.getName();
93   - String userId = studentBean.getUser_id();
94   - String cardNum = studentBean.getStudent_num();
95   - String className = studentBean.getClass_name();
96   - for(String s : deviceList){
97   - List<SendRecordBean> sendRecordBeans = sendRecordDao.getRecordIsExit(s,cardNum,userId);
98   - if(CollectionUtils.isEmpty(sendRecordBeans)){
99   - SaveStudentBak saveStudentBak = new SaveStudentBak();
100   - saveStudentBak.setCardNum(cardNum);
101   - saveStudentBak.setClientId(s);
102   - saveStudentBak.setUserId(userId);
103   - saveStudentBak.setName(name);
104   - saveStudentBak.setClassName(className);
105   - saveStudentBak.setStatus(2);
106   -// userDao.insertStudent(saveStudentBak);
107   - }
108   - }
109   - });
110   - }
111   -
112   - public String splicingZero(String str, int totalLenght) {
113   - int strLenght = str.length();
114   - String strReturn = str;
115   - for (int i = 0; i < totalLenght - strLenght; i++) {
116   - strReturn = "0" + strReturn;
117   - }
118   - return strReturn;
119   - }
120   -
121   -
122   - @Test
123   - public void delete() {
124   - Integer schoolId =27;
125   - Integer roomId = 11748;
126   - Integer type = 7;
127   - Integer outof = 1;
128   - Integer size = 66;
129   - String startTime= "2021-01-11 00:00:00";
130   - String endTime ="2021-01-11 23:59:59";
131   - List<String> studentIds = userDao.queryStudentIdList(schoolId,roomId);
132   - if(!CollectionUtils.isEmpty(studentIds)){
133   - for(int i=0;i<=studentIds.size();i++){
134   - if(i == size){
135   - return;
136   - }
137   - StudentBean userInfoBean = userDao.getStudentWithid(studentIds.get(i));
138   - if(userInfoBean!=null){
139   - String cardNum = userInfoBean.getStudent_num();
140   - System.out.println(i);
141   - sendRecordDao.deleteSS(schoolId,cardNum,type,outof,startTime,endTime);
142   - }
143   - }
144   - }
145   - }
146   -
147   - @Test
148   - public void delete2() {
149   - Integer schoolId =27;
150   - Integer roomId = 11748;
151   - Integer type = 12;
152   - Integer outof = 0;
153   - Integer size =62;
154   - String startTime= "2021-01-22 00:00:00";
155   - String endTime ="2021-01-22 23:59:59";
156   - List<String> studentIds = userDao.queryStudentIdList(schoolId,roomId);
157   - if(!CollectionUtils.isEmpty(studentIds)){
158   - for(int i=0;i<=studentIds.size();i++){
159   - if(i == size){
160   - return;
161   - }
162   - StudentBean userInfoBean = userDao.getStudentWithid(studentIds.get(i));
163   - if(userInfoBean!=null){
164   - String cardNum = userInfoBean.getStudent_num();
165   - System.out.println(i);
166   - sendRecordDao.deleteSS(schoolId,cardNum,type,outof,startTime,endTime);
167   - }
168   - }
169   - }
170   - }
171   -
172   - @Test
173   - public void test() {
174   - List<StudentBean> students = userDao.getStudentBySchoolId(12);
175   - int i = 0;
176   - for(StudentBean studentBean : students){
177   - String time = DateUtils.date2String(new Date(),"yyyyMMddHHmm");
178   - String randomString = RandomStringUtils.randomNumeric(4);
179   - String studentCode = "YX"+time+randomString+".png";
180   - String photo = studentBean.getPhoto();
181   - System.out.println("源文件:" + photo);
182   - //以学籍号为名的文件名
183   - String fileName = photo.substring(photo.lastIndexOf("/") + 1,photo.length());
184   - //100服务器人脸照绝对路径
185   - //100服务器人脸照绝对路径
186   - String path_1 = "E:\\wwwhtdocs\\SmartCampus\\face17e50\\School12\\Student";
187   - String path_2 = "E:\\wwwhtdocs\\SmartCampus\\face17e5\\School12\\Student";
188   - String path_3 = "E:\\wwwhtdocs\\SmartCampus\\f0i5l7e5\\";
189   - String filePath ="";
190   - String filePath2 ="";
191   - if(photo.indexOf("f0i5l7e5")!=-1){
192   - String afterStr = photo.split("f0i5l7e5/")[1].replace("/","\\");
193   - filePath = path_3 + afterStr;
194   - filePath2 = path_3 + studentCode;
195   - }
196   - if(photo.indexOf("face17e5")!=-1){
197   - filePath = path_2 + "\\" + fileName;
198   - filePath2 = path_2 + "\\" + studentCode;
199   - }
200   - if(photo.indexOf("face17e50")!=-1){
201   - filePath = path_1 + "\\" + fileName;
202   - filePath2 = path_1 + "\\" + studentCode;
203   - }
204   - if(filePath.indexOf("?v=")!=-1){
205   - filePath = filePath.split("\\?")[0];
206   - }
207   - File file = new File(filePath.trim());//图片
208   - if (file.exists()) {
209   - //原始文件路径
210   - String srcPath = file.getAbsolutePath();
211   - System.out.println("文件名:" + fileName + ", 学籍号:" + fileName.split("\\.")[0]);
212   - //复制文件
213   - copy(srcPath,filePath2);
214   - String savePath = "http://campus.myjxt.com//" + filePath2;
215   - studentBean.setPhoto(savePath);
216   - userDao.updateUser(studentBean.getUser_id(), savePath);
217   - file.delete();
218   - i++;
219   - }
220   - if(i==1){
221   - System.out.println(filePath);
222   - return;
223   - }
224   - }
225   - }
226   -
227   - public static void copy(String srcPathStr, String desPathStr) {
228   - //获取源文件的名称
229   - try {
230   - FileInputStream fis = new FileInputStream(srcPathStr);//创建输入流对象
231   - FileOutputStream fos = new FileOutputStream(desPathStr); //创建输出流对象
232   - byte datas[] = new byte[1024*8];//创建搬运工具
233   - int len = 0;//创建长度
234   - while((len = fis.read(datas))!=-1)//循环读取数据
235   - {
236   - fos.write(datas,0,len);
237   - }
238   - fis.close();//释放资源
239   - fis.close();//释放资源
240   - }
241   - catch (Exception e)
242   - {
243   - e.printStackTrace();
244   - }
245   - }
246   -
247   -
248   - @Test
249   - public void send2() {
250   - try {
251   - String api = "http://yixiao.198.hmkj.com.cn/index.php/Attend/send";
252   - RestTemplate restTemplate = new RestTemplate();
253   - MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
254   - map.add("name", "测试");
255   - map.add("xuehao", "1122");
256   - map.add("time", "2022-02-10 09:09:00");
257   - map.add("state", 1);
258   - HttpHeaders headers = new HttpHeaders();
259   - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
260   - HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
261   - ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class);
262   - String body = response.getBody();
263   - System.out.println(body);
264   - } catch (Exception e) {
265   - e.printStackTrace();
266   - System.out.println("考勤失败");
267   - }
268   - }
269   -}
  1 +//package com.sincere.haikangface;
  2 +//
  3 +//import com.alibaba.fastjson.JSONObject;
  4 +//import com.drew.imaging.jpeg.JpegMetadataReader;
  5 +//import com.drew.imaging.jpeg.JpegProcessingException;
  6 +//import com.drew.metadata.Directory;
  7 +//import com.drew.metadata.Metadata;
  8 +//import com.drew.metadata.MetadataException;
  9 +//import com.drew.metadata.exif.ExifDirectory;
  10 +//import com.sincere.haikangface.admindao.ZuoyeAdminDao;
  11 +//import com.sincere.haikangface.bean.*;
  12 +//import com.sincere.haikangface.bean.homework.QuestionBean;
  13 +//import com.sincere.haikangface.bean.test.SaveStudentBak;
  14 +//import com.sincere.haikangface.bean.xiaoan.AttendanceRecordsSS;
  15 +//import com.sincere.haikangface.bean.xiaoan.CreditCardRecordsSS;
  16 +//import com.sincere.haikangface.dao.DeviceDao;
  17 +//import com.sincere.haikangface.dao.UserDao;
  18 +//import com.sincere.haikangface.dao.ZuoYeDao;
  19 +//import com.sincere.haikangface.service.impl.BaseService;
  20 +//import com.sincere.haikangface.utils.ApiUtil;
  21 +//import com.sincere.haikangface.utils.DateUtils;
  22 +//import com.sincere.haikangface.xiananDao.SendRecordDao;
  23 +//import org.apache.commons.lang3.RandomStringUtils;
  24 +//import org.bouncycastle.asn1.cms.MetaData;
  25 +//import org.hibernate.validator.constraints.LuhnCheck;
  26 +//import org.junit.Test;
  27 +//import org.junit.runner.RunWith;
  28 +//import org.springframework.beans.factory.annotation.Autowired;
  29 +//import org.springframework.boot.test.context.SpringBootTest;
  30 +//import org.springframework.core.io.FileSystemResource;
  31 +//import org.springframework.http.HttpEntity;
  32 +//import org.springframework.http.HttpHeaders;
  33 +//import org.springframework.http.MediaType;
  34 +//import org.springframework.http.ResponseEntity;
  35 +//import org.springframework.test.context.junit4.SpringRunner;
  36 +//import org.springframework.util.CollectionUtils;
  37 +//import org.springframework.util.LinkedMultiValueMap;
  38 +//import org.springframework.util.MultiValueMap;
  39 +//import org.springframework.util.StringUtils;
  40 +//import org.springframework.web.client.RestTemplate;
  41 +//
  42 +//import javax.imageio.stream.FileImageInputStream;
  43 +//import javax.imageio.stream.FileImageOutputStream;
  44 +//import javax.ws.rs.core.MultivaluedMap;
  45 +//import java.io.*;
  46 +//import java.math.BigInteger;
  47 +//import java.text.SimpleDateFormat;
  48 +//import java.util.*;
  49 +//
  50 +//@RunWith(SpringRunner.class)
  51 +//@SpringBootTest
  52 +//public class HaikangfaceApplicationTests {
  53 +//
  54 +// @Autowired
  55 +// UserDao userDao;
  56 +//
  57 +// @Autowired
  58 +// DeviceDao deviceDao;
  59 +//
  60 +// @Autowired
  61 +// SendRecordDao sendRecordDao;
  62 +//
  63 +// @Autowired
  64 +// ZuoYeDao zuoYeDao;
  65 +//
  66 +// @Autowired
  67 +// ZuoyeAdminDao zuoyeAdminDao;
  68 +//
  69 +// @Autowired
  70 +// BaseService baseService;
  71 +//
  72 +// @Test
  73 +// public void sync() {
  74 +//// String deviceIds = "338652415671,694642005671,694642555671,338652515671,338653105671,338652895671,ytj687425415671,ytj694642105671,694642135671,ytj694642375671";
  75 +//// String deviceIds = "687425135671,ytj687425345671,ytj687425395671,ytj687425155671,687425355671,687425225671,687425265671,740456495671,687425325671,694642215671";
  76 +// //陆埠
  77 +// String deviceIds = "840153165671,840153205671,840153485671,840153965671,840153325671,840153835671,840154005671,840153105671";
  78 +// //艺术
  79 +//// String deviceIds = "567176463869,567176463898,567176463903,567176463892";
  80 +// Integer schoolId = 1066;
  81 +// baseService.clearStudent(schoolId,deviceIds);
  82 +// baseService.clearStudent2(schoolId);
  83 +// }
  84 +//
  85 +// @Test
  86 +// public void checkFaceSend() {
  87 +// String deviceIds = "694642005671,694642215671,687425355671,687425325671,338652895671,687425135671,ytj694642375671,338652415671,687425265671,ytj687425345671,338652515671,694642555671,ytj694642105671,338653105671,ytj687425415671,ytj687425155671,740456495671,694642135671,ytj687425395671,687425225671";
  88 +// //下发设备集合
  89 +// List<String> deviceList= new ArrayList<>(Arrays.asList(deviceIds.split(",")));
  90 +// List<StudentBean> studentBeans = userDao.getStudentBySchoolId(865);
  91 +// studentBeans.stream().distinct().forEach(studentBean -> {
  92 +// String name = studentBean.getName();
  93 +// String userId = studentBean.getUser_id();
  94 +// String cardNum = studentBean.getStudent_num();
  95 +// String className = studentBean.getClass_name();
  96 +// for(String s : deviceList){
  97 +// List<SendRecordBean> sendRecordBeans = sendRecordDao.getRecordIsExit(s,cardNum,userId);
  98 +// if(CollectionUtils.isEmpty(sendRecordBeans)){
  99 +// SaveStudentBak saveStudentBak = new SaveStudentBak();
  100 +// saveStudentBak.setCardNum(cardNum);
  101 +// saveStudentBak.setClientId(s);
  102 +// saveStudentBak.setUserId(userId);
  103 +// saveStudentBak.setName(name);
  104 +// saveStudentBak.setClassName(className);
  105 +// saveStudentBak.setStatus(2);
  106 +//// userDao.insertStudent(saveStudentBak);
  107 +// }
  108 +// }
  109 +// });
  110 +// }
  111 +//
  112 +// public String splicingZero(String str, int totalLenght) {
  113 +// int strLenght = str.length();
  114 +// String strReturn = str;
  115 +// for (int i = 0; i < totalLenght - strLenght; i++) {
  116 +// strReturn = "0" + strReturn;
  117 +// }
  118 +// return strReturn;
  119 +// }
  120 +//
  121 +//
  122 +// @Test
  123 +// public void delete() {
  124 +// Integer schoolId =27;
  125 +// Integer roomId = 11748;
  126 +// Integer type = 7;
  127 +// Integer outof = 1;
  128 +// Integer size = 66;
  129 +// String startTime= "2021-01-11 00:00:00";
  130 +// String endTime ="2021-01-11 23:59:59";
  131 +// List<String> studentIds = userDao.queryStudentIdList(schoolId,roomId);
  132 +// if(!CollectionUtils.isEmpty(studentIds)){
  133 +// for(int i=0;i<=studentIds.size();i++){
  134 +// if(i == size){
  135 +// return;
  136 +// }
  137 +// StudentBean userInfoBean = userDao.getStudentWithid(studentIds.get(i));
  138 +// if(userInfoBean!=null){
  139 +// String cardNum = userInfoBean.getStudent_num();
  140 +// System.out.println(i);
  141 +// sendRecordDao.deleteSS(schoolId,cardNum,type,outof,startTime,endTime);
  142 +// }
  143 +// }
  144 +// }
  145 +// }
  146 +//
  147 +// @Test
  148 +// public void delete2() {
  149 +// Integer schoolId =27;
  150 +// Integer roomId = 11748;
  151 +// Integer type = 12;
  152 +// Integer outof = 0;
  153 +// Integer size =62;
  154 +// String startTime= "2021-01-22 00:00:00";
  155 +// String endTime ="2021-01-22 23:59:59";
  156 +// List<String> studentIds = userDao.queryStudentIdList(schoolId,roomId);
  157 +// if(!CollectionUtils.isEmpty(studentIds)){
  158 +// for(int i=0;i<=studentIds.size();i++){
  159 +// if(i == size){
  160 +// return;
  161 +// }
  162 +// StudentBean userInfoBean = userDao.getStudentWithid(studentIds.get(i));
  163 +// if(userInfoBean!=null){
  164 +// String cardNum = userInfoBean.getStudent_num();
  165 +// System.out.println(i);
  166 +// sendRecordDao.deleteSS(schoolId,cardNum,type,outof,startTime,endTime);
  167 +// }
  168 +// }
  169 +// }
  170 +// }
  171 +//
  172 +// @Test
  173 +// public void test() {
  174 +// List<StudentBean> students = userDao.getStudentBySchoolId(12);
  175 +// int i = 0;
  176 +// for(StudentBean studentBean : students){
  177 +// String time = DateUtils.date2String(new Date(),"yyyyMMddHHmm");
  178 +// String randomString = RandomStringUtils.randomNumeric(4);
  179 +// String studentCode = "YX"+time+randomString+".png";
  180 +// String photo = studentBean.getPhoto();
  181 +// System.out.println("源文件:" + photo);
  182 +// //以学籍号为名的文件名
  183 +// String fileName = photo.substring(photo.lastIndexOf("/") + 1,photo.length());
  184 +// //100服务器人脸照绝对路径
  185 +// //100服务器人脸照绝对路径
  186 +// String path_1 = "E:\\wwwhtdocs\\SmartCampus\\face17e50\\School12\\Student";
  187 +// String path_2 = "E:\\wwwhtdocs\\SmartCampus\\face17e5\\School12\\Student";
  188 +// String path_3 = "E:\\wwwhtdocs\\SmartCampus\\f0i5l7e5\\";
  189 +// String filePath ="";
  190 +// String filePath2 ="";
  191 +// if(photo.indexOf("f0i5l7e5")!=-1){
  192 +// String afterStr = photo.split("f0i5l7e5/")[1].replace("/","\\");
  193 +// filePath = path_3 + afterStr;
  194 +// filePath2 = path_3 + studentCode;
  195 +// }
  196 +// if(photo.indexOf("face17e5")!=-1){
  197 +// filePath = path_2 + "\\" + fileName;
  198 +// filePath2 = path_2 + "\\" + studentCode;
  199 +// }
  200 +// if(photo.indexOf("face17e50")!=-1){
  201 +// filePath = path_1 + "\\" + fileName;
  202 +// filePath2 = path_1 + "\\" + studentCode;
  203 +// }
  204 +// if(filePath.indexOf("?v=")!=-1){
  205 +// filePath = filePath.split("\\?")[0];
  206 +// }
  207 +// File file = new File(filePath.trim());//图片
  208 +// if (file.exists()) {
  209 +// //原始文件路径
  210 +// String srcPath = file.getAbsolutePath();
  211 +// System.out.println("文件名:" + fileName + ", 学籍号:" + fileName.split("\\.")[0]);
  212 +// //复制文件
  213 +// copy(srcPath,filePath2);
  214 +// String savePath = "http://campus.myjxt.com//" + filePath2;
  215 +// studentBean.setPhoto(savePath);
  216 +// userDao.updateUser(studentBean.getUser_id(), savePath);
  217 +// file.delete();
  218 +// i++;
  219 +// }
  220 +// if(i==1){
  221 +// System.out.println(filePath);
  222 +// return;
  223 +// }
  224 +// }
  225 +// }
  226 +//
  227 +// public static void copy(String srcPathStr, String desPathStr) {
  228 +// //获取源文件的名称
  229 +// try {
  230 +// FileInputStream fis = new FileInputStream(srcPathStr);//创建输入流对象
  231 +// FileOutputStream fos = new FileOutputStream(desPathStr); //创建输出流对象
  232 +// byte datas[] = new byte[1024*8];//创建搬运工具
  233 +// int len = 0;//创建长度
  234 +// while((len = fis.read(datas))!=-1)//循环读取数据
  235 +// {
  236 +// fos.write(datas,0,len);
  237 +// }
  238 +// fis.close();//释放资源
  239 +// fis.close();//释放资源
  240 +// }
  241 +// catch (Exception e)
  242 +// {
  243 +// e.printStackTrace();
  244 +// }
  245 +// }
  246 +//
  247 +//
  248 +// @Test
  249 +// public void send2() {
  250 +// try {
  251 +// String api = "http://yixiao.198.hmkj.com.cn/index.php/Attend/send";
  252 +// RestTemplate restTemplate = new RestTemplate();
  253 +// MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
  254 +// map.add("name", "测试");
  255 +// map.add("xuehao", "1122");
  256 +// map.add("time", "2022-02-10 09:09:00");
  257 +// map.add("state", 1);
  258 +// HttpHeaders headers = new HttpHeaders();
  259 +// headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
  260 +// HttpEntity<MultiValueMap<String, Object>> param = new HttpEntity<>(map, headers);
  261 +// ResponseEntity<String> response = restTemplate.postForEntity(api, param, String.class);
  262 +// String body = response.getBody();
  263 +// System.out.println(body);
  264 +// } catch (Exception e) {
  265 +// e.printStackTrace();
  266 +// System.out.println("考勤失败");
  267 +// }
  268 +// }
  269 +//}
... ...