|
@@ -62,7 +62,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
try {
|
|
|
String weekdays = alarmConfig.getWeekdays();
|
|
|
DateTime startTime = new DateTime(sdf.parse(date + " " + alarmConfig.getStartTime()));
|
|
|
- DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getEndTime()));
|
|
|
+ DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getAttendanceTime()));
|
|
|
|
|
|
DateTime alarmTime = endTime.plusMinutes(-10);
|
|
|
|
|
@@ -70,12 +70,12 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
if (weekdays.indexOf(String.valueOf(weekday)) != -1) {
|
|
|
if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
|
|
|
//todo 通知个人
|
|
|
- noticePerson(alarmConfig.getCompanyId(),startTime,endTime);
|
|
|
+ noticePerson(alarmConfig,startTime,endTime);
|
|
|
}
|
|
|
|
|
|
if (now.compareTo(endTime)>=0 && now.compareTo(endTime.plusMinutes(intervalMinute))<0) {
|
|
|
//todo 通知管理人员
|
|
|
- noticeManager(alarmConfig.getCompanyId(),startTime,endTime);
|
|
|
+ noticeManager(alarmConfig,startTime,endTime);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -85,11 +85,17 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void noticePerson(String companyId, DateTime startTime, DateTime endTime) {
|
|
|
- CompanyInfo companyInfo = companyInfoService.get(companyId);
|
|
|
+ private void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
|
|
|
+
|
|
|
+ String companyCode = companyInfo.getCode();
|
|
|
+
|
|
|
+ if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
|
|
|
+ companyCode += "%";
|
|
|
+ }
|
|
|
|
|
|
//todo 查询该单位当前时间段是否有人员未测体温
|
|
|
- List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyId,startTime.toDate(),endTime.toDate());
|
|
|
+ List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
|
|
|
|
|
|
if (unmeasuredList.size()==0){
|
|
|
return;
|
|
@@ -97,7 +103,9 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
|
|
|
//todo 给未测量人推送微信通知
|
|
|
for (PersonInfo personInfo : unmeasuredList) {
|
|
|
- if (StringUtils.isNotEmpty(personInfo.getOpenId())) {
|
|
|
+ if (personInfo.getWechatNoticeEnabled()!=null
|
|
|
+ && personInfo.getWechatNoticeEnabled()
|
|
|
+ && StringUtils.isNotEmpty(personInfo.getOpenId())) {
|
|
|
String message = "尊敬的用户:" + personInfo.getName()
|
|
|
+ ",请在" + startTime.toString("HH:mm") + "至" + endTime.toString("HH:mm") + "时间内测量体温!";
|
|
|
|
|
@@ -106,11 +114,17 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void noticeManager(String companyId, DateTime startTime, DateTime endTime) {
|
|
|
- CompanyInfo companyInfo = companyInfoService.get(companyId);
|
|
|
+ private void noticeManager(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
|
|
|
+
|
|
|
+ String companyCode = companyInfo.getCode();
|
|
|
+
|
|
|
+ if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
|
|
|
+ companyCode += "%";
|
|
|
+ }
|
|
|
|
|
|
//todo 查询该单位当前时间段是否有人员未测体温
|
|
|
- List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyId,startTime.toDate(),endTime.toDate());
|
|
|
+ List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
|
|
|
|
|
|
if (unmeasuredList.size()==0){
|
|
|
return;
|
|
@@ -131,7 +145,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
|
|
|
//todo 查询该单位的通知人
|
|
|
- List<WarningPusher> pusherList = warningPusherService.findByCompanyId(companyId);
|
|
|
+ List<WarningPusher> pusherList = warningPusherService.findByCompanyId(companyInfo.getId());
|
|
|
|
|
|
//todo 给单位相关人员推送通知
|
|
|
for (WarningPusher pusher: pusherList) {
|