|
@@ -1,5 +1,6 @@
|
|
|
package com.jpsoft.smart.schduled;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
|
import com.jpsoft.smart.config.WxConfig;
|
|
|
import com.jpsoft.smart.modules.base.entity.*;
|
|
@@ -14,6 +15,7 @@ import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
|
import io.jsonwebtoken.Jwts;
|
|
|
import io.jsonwebtoken.security.Keys;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
@@ -76,6 +78,12 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
@Value("${mobile.unMeasureUrl}")
|
|
|
private String unMeasureUrl;
|
|
|
|
|
|
+ @Value("${wx.notice.remindTmplCode}")
|
|
|
+ private String remindTmplCode;
|
|
|
+
|
|
|
+ @Value("${wx.notice.supervisionTmplCode}")
|
|
|
+ private String supervisionTmplCode;
|
|
|
+
|
|
|
@Autowired
|
|
|
private HolidayInfoService holidayInfoService;
|
|
|
|
|
@@ -215,7 +223,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
|
|
|
//todo 通知个人
|
|
|
if(alarmConfig.getNeedMeasureTemperature()){
|
|
|
- noticePerson(alarmConfig,startTime,attendanceTime,endTime);
|
|
|
+ noticePerson(alarmConfig,startTime,endTime);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -358,7 +366,7 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
- public void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime attendanceTime,DateTime endTime) {
|
|
|
+ public void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
|
|
|
|
|
|
String companyCode = companyInfo.getCode();
|
|
@@ -389,7 +397,35 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
// }
|
|
|
message +=",请抓紧时间在单位(校园)内任意打卡点打卡和测温!";
|
|
|
|
|
|
- WechatMessageUtil.sendUnmeasureAlarmInfo(personInfo.getOpenId(), companyInfo.getName(), message,"", wxConfig.getAppId(), wxConfig.getAppSecret());
|
|
|
+ JSONObject sendData = new JSONObject();
|
|
|
+
|
|
|
+ JSONObject first = new JSONObject();
|
|
|
+ first.put("value", "未测温提醒");
|
|
|
+ first.put("color", "#FF0000");
|
|
|
+
|
|
|
+ JSONObject keyword1 = new JSONObject();
|
|
|
+ keyword1.put("value", personInfo.getName());
|
|
|
+ keyword1.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject keyword2 = new JSONObject();
|
|
|
+ keyword2.put("value", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
|
|
+ keyword2.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject keyword3 = new JSONObject();
|
|
|
+ keyword3.put("value", "待测温");
|
|
|
+ keyword3.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject remark = new JSONObject();
|
|
|
+ remark.put("value", message);
|
|
|
+ remark.put("color", "#173177");
|
|
|
+
|
|
|
+ sendData.put("first", first);
|
|
|
+ sendData.put("keyword1", keyword1);
|
|
|
+ sendData.put("keyword2", keyword2);
|
|
|
+ sendData.put("keyword3", keyword3);
|
|
|
+ sendData.put("remark", remark);
|
|
|
+
|
|
|
+ WechatMessageUtil.sendTemplate(sendData, wxConfig.getAppId(),wxConfig.getAppSecret(),remindTmplCode,personInfo.getOpenId(), null);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -442,12 +478,35 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
url += "&queryDate=" + startTime.toString("yyyy-MM-dd");
|
|
|
url += "&alarmConfigId=" + alarmConfig.getId();
|
|
|
|
|
|
- WechatMessageUtil.sendUnmeasureAlarmInfo(
|
|
|
- pusher.getOpenId(),
|
|
|
- companyInfo.getName(),
|
|
|
- message,
|
|
|
- url,
|
|
|
- wxConfig.getAppId(), wxConfig.getAppSecret());
|
|
|
+ JSONObject sendData = new JSONObject();
|
|
|
+
|
|
|
+ JSONObject first = new JSONObject();
|
|
|
+ first.put("value", "未测温提醒");
|
|
|
+ first.put("color", "#FF0000");
|
|
|
+
|
|
|
+ JSONObject keyword1 = new JSONObject();
|
|
|
+ keyword1.put("value", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
|
|
+ keyword1.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject keyword2 = new JSONObject();
|
|
|
+ keyword2.put("value", companyInfo.getName());
|
|
|
+ keyword2.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject keyword3 = new JSONObject();
|
|
|
+ keyword3.put("value", pusher.getName());
|
|
|
+ keyword3.put("color", "#173177");
|
|
|
+
|
|
|
+ JSONObject remark = new JSONObject();
|
|
|
+ remark.put("value", message);
|
|
|
+ remark.put("color", "#173177");
|
|
|
+
|
|
|
+ sendData.put("first", first);
|
|
|
+ sendData.put("keyword1", keyword1);
|
|
|
+ sendData.put("keyword2", keyword2);
|
|
|
+ sendData.put("keyword3", keyword3);
|
|
|
+ sendData.put("remark", remark);
|
|
|
+
|
|
|
+ WechatMessageUtil.sendTemplate(sendData, wxConfig.getAppId(),wxConfig.getAppSecret(),supervisionTmplCode,pusher.getOpenId(), url);
|
|
|
}
|
|
|
catch(Exception ex){
|
|
|
log.error(ex.getMessage(),ex);
|