DeleteTask.java
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.sincere.haikangface.async;
import com.sincere.haikangface.bean.StudentBean;
import com.sincere.haikangface.dao.UserDao;
import com.sincere.haikangface.enums.EnumSzBusinessType;
import com.sincere.haikangface.service.impl.BaseService;
import com.sincere.haikangface.utils.CompressPic;
import com.sincere.haikangface.utils.FileUtils;
import com.sincere.haikangface.xiananDao.SendRecordDao;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
/**
* 多线程执行卡下发
* @author xuquan
* @date 2021/01/12 15:56
*/
@Slf4j
public class DeleteTask implements Runnable {
Integer schoolId;
Integer roomId;
Integer type;
Integer outof;
UserDao userDao;
String startTime;
String endTime;
SendRecordDao sendRecordDao;
CountDownLatch begin;
CountDownLatch end;
public DeleteTask(UserDao userDao,SendRecordDao sendRecordDao,Integer schoolId,Integer roomId, Integer type,
Integer outof,String startTime,String endTime,CountDownLatch begin, CountDownLatch end){
this.userDao=userDao;
this.sendRecordDao=sendRecordDao;
this.schoolId=schoolId;
this.roomId=roomId;
this.type=type;
this.outof=outof;
this.startTime=startTime;
this.endTime=endTime;
this.begin=begin;
this.end=end;
}
@Override
public void run() {
try {
begin.await();
List<String> studentIds = userDao.queryStudentIdList(schoolId,roomId);
if(!CollectionUtils.isEmpty(studentIds)){
for(int i=0;i<=studentIds.size();i++){
StudentBean userInfoBean = userDao.getStudentWithid(studentIds.get(i));
if(userInfoBean!=null){
String cardNum = userInfoBean.getStudent_num();
System.out.println(i);
sendRecordDao.deleteSS(schoolId,cardNum,type,outof,startTime,endTime);
}
}
}
}catch (Exception e){
log.error("异常,信息:");
}finally {
end.countDown();
}
}
}