Commit 8b354337 by 111-PC\111

[+]通知消息修改

1 parent 773a7c8e
......@@ -283,7 +283,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
paramMap.put("deviceType", map.get("source")+"");
paramMap.put("title", title);
paramMap.put("body", msg);
saveMegInfo(user_id, title, msg, scene.getId());
saveMegInfo(user_id, title, msg);
try {
JSONObject jsonObject = HttpUtil.sendPost(infoUrl, JSONObject.toJSONString(paramMap), new HashMap<>());
if (jsonObject != null) {
......@@ -305,9 +305,8 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
* @param user_id 用户id
* @param title 标题
* @param msg 消息
* @param id 场景id
*/
private void saveMegInfo(String user_id, String title, String msg, Long id) {
private void saveMegInfo(String user_id, String title, String msg) {
CarAssistantInfo carAssistantInfo=new CarAssistantInfo();
carAssistantInfo.setUserId(Integer.parseInt(user_id));
carAssistantInfo.setCreateBy(Integer.parseInt(user_id));
......@@ -346,7 +345,9 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
content = MessageFormat.format("您配置的{0}场景未顺利执行,点击可查看详情。", scene_name);
}
paramMap.put("body", content);
saveInfo(user_id, title, collect, scene.getId(), scene_name);
String context = buildBody(user_id, title, collect, scene.getId(), scene_name);
paramMap.put("msgBody", context);
saveMegInfo(user_id,title,context);
try {
JSONObject jsonObject = HttpUtil.sendPost(infoUrl, JSONObject.toJSONString(paramMap), new HashMap<>());
if (jsonObject != null) {
......@@ -384,7 +385,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
* @param id 场景id
* @param scene_name
*/
private void saveInfo(String user_id, String title, List<OrderResponse> orderResponseList, Long id, String scene_name) {
private String buildBody(String user_id, String title, List<OrderResponse> orderResponseList, Long id, String scene_name) {
String context = "";
if (CollectionUtils.isEmpty(orderResponseList)) {
context = MessageFormat.format("您配置的{0}场景已在{1} 成功执行", scene_name, new Date());
......@@ -392,7 +393,7 @@ public class SmartSceneServiceImpl extends BaseService implements SmartSceneServ
List<String> names = orderResponseList.stream().map(p -> p.getDeviceName()).collect(Collectors.toList());
context = MessageFormat.format("您配置的{0}场景已在{1}触发执行,但因以下设备{2}未能执行成功,请关注以上设备状态", scene_name, new Date(),names);
}
saveMegInfo(user_id,title,context,id);
return context;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!