|
@@ -61,6 +61,9 @@ public class TWechatServiceImpl extends ServiceImpl<TWechatMapper, TWechat> impl
|
|
|
Map<String, WeChatTemplateMsg> sendMag = new HashMap();
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String alarmTime = format.format(new Date());
|
|
|
+ if(name.length() > 20) {
|
|
|
+ name = name.substring(0, 16) + "...";
|
|
|
+ }
|
|
|
if (StringUtils.isEmpty(ifForeign) || ifForeign.equals("0")) {
|
|
|
// 国内
|
|
|
sendMag.put("thing11", new WeChatTemplateMsg(name));
|
|
@@ -87,7 +90,11 @@ public class TWechatServiceImpl extends ServiceImpl<TWechatMapper, TWechat> impl
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String alarmTime = format.format(occurrenceTime);
|
|
|
// 模版参数
|
|
|
- sendMag.put("thing11", new WeChatTemplateMsg(name));
|
|
|
+ if(name.length() > 20) {
|
|
|
+ sendMag.put("thing11", new WeChatTemplateMsg(name.substring(0, 16) + "..."));
|
|
|
+ } else {
|
|
|
+ sendMag.put("thing11", new WeChatTemplateMsg(name));
|
|
|
+ }
|
|
|
sendMag.put("character_string14", new WeChatTemplateMsg(clientId.substring(clientId.length()-6)));
|
|
|
sendMag.put("thing4", new WeChatTemplateMsg("高"));
|
|
|
sendMag.put("time5", new WeChatTemplateMsg(alarmTime));
|
|
@@ -183,8 +190,11 @@ public class TWechatServiceImpl extends ServiceImpl<TWechatMapper, TWechat> impl
|
|
|
sendBody.put("data", sendMag);
|
|
|
if(StringUtils.isEmpty(companyType) || companyType.equals("0")) {
|
|
|
sendBody.put("template_id", ConfigConsts.SZ_TEMPLATE_ID);
|
|
|
+ sendBody.put("url", "http://szwlh.sunzee.com.cn/shenze/");
|
|
|
} else {
|
|
|
sendBody.put("template_id", ConfigConsts.SC_TEMPLATE_ID);
|
|
|
+ sendBody.put("url", "http://sevencloud.com.cn/sc/");
|
|
|
+
|
|
|
}
|
|
|
String sendUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
|
|
|
ResponseEntity<String> forEntity = restTemplate.postForEntity(sendUrl, sendBody, String.class);
|