Commit a59c1762 authored by linruibiao's avatar linruibiao

Merge remote-tracking branch 'origin/develop' into develop

parents 50493a01 095314b2
......@@ -152,17 +152,18 @@ public class VariableController extends BaseRestController{
}
@GetMapping("/{deviceId}/{variableCode}/status")
@GetMapping("/{deviceId}/{variableId}/{variableCode}/status")
@ApiOperation("状态点实时数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "variableId", value = "变量点id", required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "variableCode", value = "变量点code", required = true,dataTypeClass = String.class)
})
public R<Map<String, Object>> status(HttpServletRequest request,@PathVariable String appId,@PathVariable String deviceId ,@PathVariable String variableCode) {
public R<Map<String, Object>> status(HttpServletRequest request,@PathVariable String appId,@PathVariable String deviceId ,@PathVariable String variableId,@PathVariable String variableCode) {
return call(() -> {
CurrentUser currentUser = getCurrentUser(request);
return variableService.status(dcClientHost + variableStatus, deviceId, variableCode, currentUser);
return variableService.status(dcClientHost + variableStatus, deviceId,variableId, variableCode, currentUser);
});
}
......
......@@ -15,6 +15,9 @@ public class VariableStatusRealTimeDataDTO {
@ApiModelProperty(value = "所属设备")
private String deviceId;
@ApiModelProperty(value = "变量ID")
private String variableId;
@ApiModelProperty(value = "变量code,也就是变量name")
private String variableCode;
}
......@@ -74,7 +74,7 @@ public interface VariableService {
* @param variableCode
* @return
*/
Map<String,Object> status(String uri,String deviceId,String variableCode,CurrentUser user);
Map<String,Object> status(String uri,String deviceId,String variableId,String variableCode,CurrentUser user);
/**
* 状态点历史数据
......
......@@ -278,7 +278,7 @@ public class VariableServiceImpl implements VariableService {
}
@Override
public Map<String, Object> status(String uri, String deviceId, String variableCode,CurrentUser user) {
public Map<String, Object> status(String uri, String deviceId,String variableId, String variableCode,CurrentUser user) {
if(StringUtils.isBlank(variableCode)){
throw new SysException("变量code不能为空");
}
......@@ -289,6 +289,7 @@ public class VariableServiceImpl implements VariableService {
Map<String,String> uriVariables =Maps.newHashMap();
uriVariables.put("appId",user.getAppId());
uriVariables.put("deviceId",deviceId);
uriVariables.put("variableId",variableId);
uriVariables.put("variableCode",variableCode);
R<Map<String,Object>> result = RestTemplateUtils.get(uri,new TypeToken<R<Map<String,Object>>>() {}.getType(), uriVariables);
return result.detach();
......@@ -344,6 +345,9 @@ public class VariableServiceImpl implements VariableService {
if(statusRealTimeDataList.stream().anyMatch(x -> StringUtils.isBlank(x.getDeviceId()))){
throw new SysException("设备ID不能为空");
}
if(statusRealTimeDataList.stream().anyMatch(x -> StringUtils.isBlank(x.getVariableId()))){
throw new SysException("变量Id不能为空");
}
if(statusRealTimeDataList.stream().anyMatch(x -> StringUtils.isBlank(x.getVariableCode()))){
throw new SysException("变量Code不能为空");
}
......
......@@ -66,7 +66,7 @@ dc_client:
realTimeVariableDataList: /{appId}/variables/real-time/data
filedValue : /{appId}/business/{tableName}/{filed}/filed-value?current={current}&size={size}&name={name} #/{appId}/business/{tableName}/{filed}/filed-value?current={current}&size={size}&name={name}
send : /{appId}/variables/monitor/device/commands
variableStatus : /{appId}/variables/{deviceId}/{variableCode}/status
variableStatus : /{appId}/variables/{deviceId}/{variableId}/{variableCode}/status
variableHistoryStatus : /{appId}/variables/{deviceId}/{variableCode}/history-status?startTime={startTime}&endTime={endTime}
# historyCurve : /{appId}/variables/history-curve?deviceId={deviceId}&endTime={endTime}&startTime={startTime}&variableCode={variableCode}&variableId={variableId}&format={format}
# historyCurve : /{appId}/variables/history-curve
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment