Commit beabfe09 by 111-PC\111

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

1 parent b6c79e92
......@@ -55,17 +55,18 @@ public class OrderIssueService {
Map<String,List<Map<String,Object>>> ordermaps=new HashMap<>();
List<Map<String,Object>> maps=new ArrayList<>();
Map<String,Object> ordermap=new HashMap<>();
List<Object> objects = JSONObject.parseArray(index.getParamValue(), Object.class);
String devideId = objects.get(0)+"";
ordermap.put("code",objects.get(1)+"");
ordermap.put("value",objects.get(2));
String[] objects = index.getParamValue().split(",");
String devideId = objects[0];
String valueType = objects[3];
ordermap.put("code",objects[1]);
ordermap.put("value",revertType(valueType,objects[2]));
maps.add(ordermap);
ordermaps.put("commands",maps);
try {
JSONObject jsonObject = HttpUtil.sendPost(orderIssueurl.replace("{device_id}", devideId), JSONObject.toJSONString(ordermaps), new HashMap<>());
Object code = jsonObject.get("code");
Object message = jsonObject.get("message");
if(code!=null) {
if(jsonObject!=null) {
Object code = jsonObject.get("code");
Object message = jsonObject.get("message");
if (Integer.parseInt(code.toString())==200) {
log.info("设备{},{}", devideId,message);
}else{
......@@ -81,4 +82,23 @@ public class OrderIssueService {
List<SmartTemplateParam> messageOrders = smartTemplateParamList.stream().filter(index -> index.getParamKey().equals(Constants.MESSAGE_NOTI)).collect(Collectors.toList());
// 推送消息结束 -----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!