Commit beabfe09 by 111-PC\111

[+]智能设备场景kafka消费

1 parent b6c79e92
...@@ -55,17 +55,18 @@ public class OrderIssueService { ...@@ -55,17 +55,18 @@ public class OrderIssueService {
Map<String,List<Map<String,Object>>> ordermaps=new HashMap<>(); Map<String,List<Map<String,Object>>> ordermaps=new HashMap<>();
List<Map<String,Object>> maps=new ArrayList<>(); List<Map<String,Object>> maps=new ArrayList<>();
Map<String,Object> ordermap=new HashMap<>(); Map<String,Object> ordermap=new HashMap<>();
List<Object> objects = JSONObject.parseArray(index.getParamValue(), Object.class); String[] objects = index.getParamValue().split(",");
String devideId = objects.get(0)+""; String devideId = objects[0];
ordermap.put("code",objects.get(1)+""); String valueType = objects[3];
ordermap.put("value",objects.get(2)); ordermap.put("code",objects[1]);
ordermap.put("value",revertType(valueType,objects[2]));
maps.add(ordermap); maps.add(ordermap);
ordermaps.put("commands",maps); ordermaps.put("commands",maps);
try { try {
JSONObject jsonObject = HttpUtil.sendPost(orderIssueurl.replace("{device_id}", devideId), JSONObject.toJSONString(ordermaps), new HashMap<>()); JSONObject jsonObject = HttpUtil.sendPost(orderIssueurl.replace("{device_id}", devideId), JSONObject.toJSONString(ordermaps), new HashMap<>());
Object code = jsonObject.get("code"); if(jsonObject!=null) {
Object message = jsonObject.get("message"); Object code = jsonObject.get("code");
if(code!=null) { Object message = jsonObject.get("message");
if (Integer.parseInt(code.toString())==200) { if (Integer.parseInt(code.toString())==200) {
log.info("设备{},{}", devideId,message); log.info("设备{},{}", devideId,message);
}else{ }else{
...@@ -81,4 +82,23 @@ public class OrderIssueService { ...@@ -81,4 +82,23 @@ public class OrderIssueService {
List<SmartTemplateParam> messageOrders = smartTemplateParamList.stream().filter(index -> index.getParamKey().equals(Constants.MESSAGE_NOTI)).collect(Collectors.toList()); List<SmartTemplateParam> messageOrders = smartTemplateParamList.stream().filter(index -> index.getParamKey().equals(Constants.MESSAGE_NOTI)).collect(Collectors.toList());
// 推送消息结束 -----TODO // 推送消息结束 -----TODO
} }
private Object revertType(String valueType, String object) {
Object orderValue=null;
switch (valueType){
case "1":
orderValue=object;
break;
case "2":
orderValue=Integer.parseInt(object);
break;
case "3":
orderValue=Boolean.valueOf(object);
break;
default:
orderValue=object;
break;
}
return orderValue;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!