小bug修复
This commit is contained in:
parent
70d9d40aeb
commit
9d58e115f2
@ -14,6 +14,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author mijiupro
|
||||||
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/seedlingGrowth")
|
@RequestMapping("/seedlingGrowth")
|
||||||
public class DeviceRealtimedataSeedlingGrowthController {
|
public class DeviceRealtimedataSeedlingGrowthController {
|
||||||
|
@ -2,10 +2,11 @@ package com.fastbee.iot.model.ThingsModelItem;
|
|||||||
|
|
||||||
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Datatype
|
public class Datatype implements Serializable
|
||||||
{
|
{
|
||||||
/** 数据类型 */
|
/** 数据类型 */
|
||||||
private String type;
|
private String type;
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class ThingsModelValueItem {
|
public class ThingsModelValueItem implements java.io.Serializable{
|
||||||
/**
|
/**
|
||||||
* 物模型唯一标识符
|
* 物模型唯一标识符
|
||||||
*/
|
*/
|
||||||
|
@ -204,5 +204,8 @@ public class DeviceRealTimeDataStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class ZhanLianDeviceRealTimeDataGetStrategy implements DeviceRealTimeData
|
|||||||
//解析设备对接参数
|
//解析设备对接参数
|
||||||
String devParams = device.getDevParams();
|
String devParams = device.getDevParams();
|
||||||
if(StringUtils.isBlank(devParams)){
|
if(StringUtils.isBlank(devParams)){
|
||||||
throw new RuntimeException("展连设备对接参数为空!设备id为:"+device.getDeviceId());
|
throw new RuntimeException("展连设备对接参数为空!设备id为:"+device.getDeviceId()+"设备序列号为:"+device.getSerialNumber());
|
||||||
}
|
}
|
||||||
JSONArray paramArray = JSONUtil.parseArray(devParams);
|
JSONArray paramArray = JSONUtil.parseArray(devParams);
|
||||||
//解析参数列表建立map
|
//解析参数列表建立map
|
||||||
@ -75,7 +75,7 @@ public class ZhanLianDeviceRealTimeDataGetStrategy implements DeviceRealTimeData
|
|||||||
|
|
||||||
ZhanLianBaseService zhanLianBaseService = new ZhanLianBaseService();
|
ZhanLianBaseService zhanLianBaseService = new ZhanLianBaseService();
|
||||||
//请求设备
|
//请求设备
|
||||||
System.err.println(reqBody);
|
// System.err.println(reqBody);
|
||||||
JSONObject respObj = zhanLianBaseService.baseRequest(reqBody, authEndpoint);
|
JSONObject respObj = zhanLianBaseService.baseRequest(reqBody, authEndpoint);
|
||||||
//解析设备实时数据
|
//解析设备实时数据
|
||||||
JSONObject deviceRealTimeData = getDeviceRealTimeData(respObj, deviceId);
|
JSONObject deviceRealTimeData = getDeviceRealTimeData(respObj, deviceId);
|
||||||
|
@ -19,16 +19,17 @@ public class test11 {
|
|||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
public AjaxResult test(){
|
public AjaxResult test(){
|
||||||
|
|
||||||
String deviceId = "3270";
|
String deviceId = "3269";
|
||||||
String deviceBrand = "展连IOT";
|
String deviceBrand = "展连IOT";
|
||||||
// String deviceId = "1017240042";
|
// String deviceId = "1017240042";
|
||||||
// String deviceBrand = "仁科";
|
// String deviceBrand = "仁科";
|
||||||
Long productId = 143L;
|
Long productId = 143L;
|
||||||
//获取设备对应数据获取器
|
//获取设备对应数据获取器
|
||||||
DeviceRealTimeDataGetStrategy DataGetMachine = dataGetFactory.getDeviceRealTimeDataGetStrategy(deviceBrand);
|
DeviceRealTimeDataGetStrategy DataGetMachine = dataGetFactory.getDeviceRealTimeDataGetStrategy(deviceBrand);
|
||||||
|
System.err.println("获取到设备数据获取器:"+DataGetMachine.getClass());
|
||||||
//获取设备实时数据
|
//获取设备实时数据
|
||||||
JSONObject deviceRealTimeData = DataGetMachine.getDeviceRealTimeData(deviceId);
|
JSONObject deviceRealTimeData = DataGetMachine.getDeviceRealTimeData(deviceId);
|
||||||
System.err.println(deviceRealTimeData);
|
System.err.println("实时数据:"+deviceRealTimeData);
|
||||||
return AjaxResult.success(deviceRealTimeData);
|
return AjaxResult.success(deviceRealTimeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class ZhanLianBaseService {
|
|||||||
String jsonStr = JSONUtil.toJsonStr(body);
|
String jsonStr = JSONUtil.toJsonStr(body);
|
||||||
String respStr = HttpUtil.post(url,jsonStr);
|
String respStr = HttpUtil.post(url,jsonStr);
|
||||||
JSONObject resp = JSONUtil.parseObj(respStr);
|
JSONObject resp = JSONUtil.parseObj(respStr);
|
||||||
System.err.println(resp);
|
// System.err.println(resp);
|
||||||
if(!resp.getStr("code").equals("200")){
|
if(!resp.getStr("code").equals("200")){
|
||||||
throw new ServiceException("展联基本请求失败!");
|
throw new ServiceException("展联基本请求失败!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user