|
@@ -7,12 +7,10 @@ import com.jpsoft.smart.modules.base.entity.*;
|
|
|
import com.jpsoft.smart.modules.base.service.*;
|
|
|
import com.jpsoft.smart.modules.business.entity.WorkAttendance;
|
|
|
import com.jpsoft.smart.modules.business.service.WorkAttendanceService;
|
|
|
-import com.jpsoft.smart.modules.common.utils.JwtUtil;
|
|
|
-import com.jpsoft.smart.modules.common.utils.OSSUtil;
|
|
|
-import com.jpsoft.smart.modules.common.utils.POIUtils;
|
|
|
-import com.jpsoft.smart.modules.common.utils.WechatMessageUtil;
|
|
|
+import com.jpsoft.smart.modules.common.utils.*;
|
|
|
import com.jpsoft.smart.modules.sys.entity.SysLog;
|
|
|
import com.jpsoft.smart.modules.sys.service.SysLogService;
|
|
|
+import com.jpsoft.smart.modules.wechat.entity.AccessToken;
|
|
|
import com.sun.corba.se.spi.orbutil.threadpool.Work;
|
|
|
import io.jsonwebtoken.Jwts;
|
|
|
import io.jsonwebtoken.security.Keys;
|
|
@@ -33,9 +31,10 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.io.ByteArrayInputStream;
|
|
|
-import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.*;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
import java.net.SocketAddress;
|
|
|
+import java.net.URL;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.security.Key;
|
|
|
import java.text.ParseException;
|
|
@@ -464,9 +463,9 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
sendData.put("keyword3", keyword3);
|
|
|
sendData.put("remark", remark);
|
|
|
|
|
|
- writeDbLog(String.format("向未测温人:%s 发送测温提醒通知",personInfo.getName()),alarmConfig.getCompanyId());
|
|
|
+ writeDbLog(String.format("向未测温人:%s,%s发送测温提醒通知",personInfo.getName(),personInfo.getOpenId()),alarmConfig.getCompanyId());
|
|
|
|
|
|
- WechatMessageUtil.sendTemplate(sendData, wxConfig.getAppId(),wxConfig.getAppSecret(),remindTmplCode,personInfo.getOpenId(), null);
|
|
|
+ WechatMessageUtil.sendNativeTemplate(wxConfig.getAppId(),wxConfig.getAppSecret(),remindTmplCode,personInfo.getOpenId(),sendData,null);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -638,13 +637,41 @@ public class UnmeasureTemperatureAlarmTask {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String str = String.format(
|
|
|
- "查询考勤时段:%s~%s,未考勤人员数量:%s",
|
|
|
- "2020-04-24 08:00",
|
|
|
- "2020-04-24 09:00",
|
|
|
- 10
|
|
|
- );
|
|
|
-
|
|
|
- System.out.println(str);
|
|
|
+ String message ="请抓紧时间在单位内任意打卡点打卡和测温!";
|
|
|
+
|
|
|
+ JSONObject sendData = new JSONObject();
|
|
|
+
|
|
|
+ JSONObject first = new JSONObject();
|
|
|
+ first.put("value", "未测温提醒");
|
|
|
+ first.put("color", "#FF0000");
|
|
|
+
|
|
|
+ JSONObject keyword1 = new JSONObject();
|
|
|
+ keyword1.put("value", "当前用户");
|
|
|
+ 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);
|
|
|
+
|
|
|
+ String appId = "wx0b3c41a903053808";
|
|
|
+ String appSecret = "43557bd62f77b0c3d6670e991872f0e7";
|
|
|
+ String remindTmplCode = "Nsn_8-M25Ef_KThmin8uDocXeh8XVQMC1rVzBAIaeig";
|
|
|
+ String openId = "oLowyuB1PliW0qAnJJ56axydeUOM";
|
|
|
+
|
|
|
+ WechatMessageUtil.sendNativeTemplate(appId,appSecret,remindTmplCode,openId,sendData ,null);
|
|
|
}
|
|
|
}
|