Commit 22e33404 by 111-PC\111

[+]代码修改

1 parent 5e90de1b
...@@ -15,4 +15,5 @@ public class ExecuteTaskVo { ...@@ -15,4 +15,5 @@ public class ExecuteTaskVo {
private String remoteId; private String remoteId;
private String value; private String value;
private String deviceName; private String deviceName;
private String msg;
} }
...@@ -237,9 +237,53 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ ...@@ -237,9 +237,53 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
} }
// 下发推送通知(Android设备和ios设备) // 下发推送通知(Android设备和ios设备)
issueNotice(scene, orderResponseList); issueNotice(scene, orderResponseList);
// 下发系统消息
List<SmartSceneData> scene_content_system = smartTemplateParamList.stream().filter(index -> index.getParamKey().equals("scene_content_system")).collect(Collectors.toList());
scene_content_system.forEach(index->{
String paramValue = index.getParamValue();
ExecuteTaskVo executeTaskVo = JSONObject.parseObject(paramValue, ExecuteTaskVo.class);
issueSystemNotice(scene, executeTaskVo.getMsg());
});
return orderResponseList; return orderResponseList;
} }
private void issueSystemNotice(SmartScene scene, String msg) {
String title = "收到一条智能消息";
Map<String, Object> map = sceneMapper.getBySourceAndUserId(scene.getId());
String user_id = map.get("user_id")+"";
String scene_name = map.get("scene_name")+"";
Map<String, String> paramMap = new HashMap<>();
paramMap.put("alias", user_id);
paramMap.put("deviceType", map.get("source")+"");
paramMap.put("title", title);
paramMap.put("body", msg);
saveMegInfo(user_id, title, msg, scene.getId(), scene_name);
try {
JSONObject jsonObject = HttpUtil.sendPost(infoUrl, JSONObject.toJSONString(paramMap), new HashMap<>());
if (jsonObject != null) {
String code = jsonObject.get("code") + "";
if (("200").equals(code)) {
log.info("场景{}系统消息下发通知成功", scene.getId());
} else {
log.info("场景{}系统消息下发通知失败", jsonObject.get("message"));
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void saveMegInfo(String user_id, String title, String msg, Long id, String scene_name) {
MessageBoxInfo messageBoxInfo = new MessageBoxInfo();
messageBoxInfo.setAccountId(Integer.parseInt(user_id));
messageBoxInfo.setSn("88888888");
messageBoxInfo.setContent(msg);
messageBoxInfo.setTitle(title);
messageBoxInfo.setExpandId(id.intValue());
messageBoxInfo.setIsPushSuccess(MessagePushResultEnum.FAILURE.getValue());
messageBoxInfoRemote.insert(messageBoxInfo);
}
/** /**
* 推送通知 * 推送通知
* *
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!