|
@@ -108,21 +108,35 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
|
|
|
int affectCount = 0;
|
|
|
|
|
|
- //更新时间段内节假日
|
|
|
- Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(startDate,endDate);
|
|
|
+ //放假日期
|
|
|
+ Set<String> realHolidaySet = holidayInfoService.getHolidaySetByDate(startDate,endDate,false);
|
|
|
+
|
|
|
+ //虽然放假但正常上班
|
|
|
+ Map<String,HolidayInfo> fakeHolidayMap = holidayInfoService.getHolidayMapByDate(startDate,endDate,true);
|
|
|
|
|
|
for (int i=0;i<days;i++){
|
|
|
DateTime now = dt1.plusDays(i);
|
|
|
|
|
|
String date = now.toString("yyyy-MM-dd");
|
|
|
|
|
|
- if (holidaySet.contains(date)){
|
|
|
+ //排除真放假日
|
|
|
+ if (realHolidaySet.contains(date)){
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
for (AlarmConfig alarmConfig : configList) {
|
|
|
- //是否工作日
|
|
|
- if (alarmConfig.getWeekdays().indexOf(String.valueOf(now.getDayOfWeek())) == -1) {
|
|
|
+ int weekday = now.getDayOfWeek();
|
|
|
+
|
|
|
+ if(fakeHolidayMap.containsKey(date)){
|
|
|
+ //虽然放假但需要工作
|
|
|
+ HolidayInfo holidayInfo = fakeHolidayMap.get(date);
|
|
|
+
|
|
|
+ //当前参考工作日
|
|
|
+ weekday = holidayInfo.getRefWeekday();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (alarmConfig.getWeekdays().indexOf(String.valueOf(weekday)) == -1) {
|
|
|
+ //当前日期不属于本轮考勤设置的工作日
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -136,7 +150,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
companyCode += "%";
|
|
|
}
|
|
|
|
|
|
- //todo 查询该单位当前时间段考勤人员列表
|
|
|
+ //todo 查询当前时间段学生测温情况
|
|
|
List<PersonInfo> attendanceList = personDeviceLogService.queryAttendanceList(companyCode,startTime.toDate(),endTime.toDate());
|
|
|
|
|
|
for (PersonInfo personInfo: attendanceList) {
|
|
@@ -156,10 +170,11 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
//上班算最早一次考勤
|
|
|
personDeviceLog = logList.get(0);
|
|
|
|
|
|
- if(personDeviceLog.getRecordTime().compareTo(startTime.toDate())>0 && personDeviceLog.getRecordTime().compareTo(attendanceTime.toDate())<=0){
|
|
|
+ //上班加1分钟
|
|
|
+ if(personDeviceLog.getRecordTime().compareTo(startTime.toDate())>0 && personDeviceLog.getRecordTime().compareTo(attendanceTime.plusMinutes(1).toDate())<=0){
|
|
|
workAttendance.setResult(WorkAttendance.SUCCESS);
|
|
|
}
|
|
|
- else if(personDeviceLog.getRecordTime().compareTo(attendanceTime.toDate())>0 && personDeviceLog.getRecordTime().compareTo(endTime.toDate())<=0){
|
|
|
+ else if(personDeviceLog.getRecordTime().compareTo(attendanceTime.plusMinutes(1).toDate())>0 && personDeviceLog.getRecordTime().compareTo(endTime.toDate())<=0){
|
|
|
workAttendance.setResult(WorkAttendance.LATE);
|
|
|
}
|
|
|
} else {
|
|
@@ -183,13 +198,14 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
|
|
|
//统计缺卡
|
|
|
- recordUnAttendance(alarmConfig,startTime.toDate(),attendanceTime.toDate(),endTime.toDate(),WorkAttendance.MISSING);
|
|
|
+ affectCount+= recordUnAttendance(alarmConfig,startTime.toDate(),attendanceTime.toDate(),endTime.toDate(),WorkAttendance.MISSING);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return affectCount;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void writeDbLog(String remark,String companyId){
|
|
|
SysLog sysLog = new SysLog();
|
|
|
sysLog.setPointcut("未测体温提醒");
|
|
@@ -213,13 +229,17 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
|
|
|
String date = now.toString("yyyy-MM-dd");
|
|
|
|
|
|
- //最近一年的节假日
|
|
|
- Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(now.minusDays(364).toDate(),now.plusDays(1).toDate());
|
|
|
+
|
|
|
+ //最近一周的节假日
|
|
|
+ Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(now.minusDays(7).toDate(),now.plusDays(1).toDate(),false);
|
|
|
|
|
|
if (holidaySet.contains(date)){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ //虽然放假但正常上班
|
|
|
+ Map<String,HolidayInfo> fakeHolidayMap = holidayInfoService.getHolidayMapByDate(now.minusDays(7).toDate(),now.plusDays(1).toDate(),true);
|
|
|
+
|
|
|
int weekday = now.getDayOfWeek();
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
@@ -242,6 +262,14 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
alarmTime = attendanceTime.plusMinutes(10);
|
|
|
}
|
|
|
|
|
|
+ if(fakeHolidayMap.containsKey(date)){
|
|
|
+ //虽然放假但需要工作
|
|
|
+ HolidayInfo holidayInfo = fakeHolidayMap.get(date);
|
|
|
+
|
|
|
+ //参考工作日
|
|
|
+ weekday = holidayInfo.getRefWeekday();
|
|
|
+ }
|
|
|
+
|
|
|
//开始时间
|
|
|
if (weekdays.indexOf(String.valueOf(weekday)) != -1) {
|
|
|
if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
|