|
|
@ -73,9 +73,11 @@ public class PushDataToWechatJob { |
|
|
|
PushMsgEntity pushMsgEntity = new PushMsgEntity(); |
|
|
|
PushMsgEntity pushMsgEntity = new PushMsgEntity(); |
|
|
|
// 判断模板id种类
|
|
|
|
// 判断模板id种类
|
|
|
|
switch (map.get("template_id").toString()) { |
|
|
|
switch (map.get("template_id").toString()) { |
|
|
|
case "LrSu6VlICV9sTIWZgl8SF7bFI7TfqbSpeJ-cvPaTe6I": |
|
|
|
// case "LrSu6VlICV9sTIWZgl8SF7bFI7TfqbSpeJ-cvPaTe6I":
|
|
|
|
|
|
|
|
case "SiyBtZeZuF0Qo8V3NlvGwhc95-vX-a6wsvIxpAq3d_Y": |
|
|
|
// 推送单种设备消息
|
|
|
|
// 推送单种设备消息
|
|
|
|
pushOffLineGw(val, map, pushMsgEntity); |
|
|
|
// pushOffLineGw(val, map, pushMsgEntity);
|
|
|
|
|
|
|
|
pushOffLineGw1(val, map, pushMsgEntity); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
@ -92,6 +94,35 @@ public class PushDataToWechatJob { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void pushOffLineGw1(GatewayManageEntity gw, Map<String, Object> map, PushMsgEntity pushMsgEntity) { |
|
|
|
|
|
|
|
// 项目名称 {{thing95.DATA}}
|
|
|
|
|
|
|
|
// 设备名称 {{thing23.DATA}}
|
|
|
|
|
|
|
|
// 告警等级 {{phrase20.DATA}}
|
|
|
|
|
|
|
|
// 异常原因 {{thing25.DATA}}
|
|
|
|
|
|
|
|
// 发生时间 {{time51.DATA}}
|
|
|
|
|
|
|
|
pushMsgEntity.setTouser(map.get("open_id").toString()); |
|
|
|
|
|
|
|
pushMsgEntity.setTemplateId(map.get("template_id").toString()); |
|
|
|
|
|
|
|
pushMsgEntity.setUrl("http://jnd2.mhwsh.net:8765/"); |
|
|
|
|
|
|
|
First first = new First(); |
|
|
|
|
|
|
|
first.setValue("设备报警提醒"); |
|
|
|
|
|
|
|
pushMsgEntity.setFirst(first); |
|
|
|
|
|
|
|
Key1 key1 = new Key1(); |
|
|
|
|
|
|
|
key1.setValue(map.get("project_name").toString()); |
|
|
|
|
|
|
|
pushMsgEntity.setKey1(key1); |
|
|
|
|
|
|
|
Key2 key2 = new Key2(); |
|
|
|
|
|
|
|
key2.setValue(gw.getGwName()); |
|
|
|
|
|
|
|
pushMsgEntity.setKey2(key2); |
|
|
|
|
|
|
|
Key3 key3 = new Key3(); |
|
|
|
|
|
|
|
key3.setValue("报警"); |
|
|
|
|
|
|
|
pushMsgEntity.setKey3(key3); |
|
|
|
|
|
|
|
Key4 key4 = new Key4(); |
|
|
|
|
|
|
|
key4.setValue("设备已离线,请及时查看处理!"); |
|
|
|
|
|
|
|
pushMsgEntity.setKey4(key4); |
|
|
|
|
|
|
|
Key5 key5 = new Key5(); |
|
|
|
|
|
|
|
key5.setValue(DateUtil.dateToString(gw.getConnectTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
pushMsgEntity.setKey5(key5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = " 0 0 8 * * ? ") //每天八点钟推送上一天的数据能耗
|
|
|
|
@Scheduled(cron = " 0 0 8 * * ? ") //每天八点钟推送上一天的数据能耗
|
|
|
|
public void pushDataToWechat() { |
|
|
|
public void pushDataToWechat() { |
|
|
|
log.info("推送给微信公众号"); |
|
|
|
log.info("推送给微信公众号"); |
|
|
|