Commit 0feb3e1e authored by 梁光意's avatar 梁光意

修改获取实时和历史变量数据

parent 7aca0545
......@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Map;
import java.util.List;
/**
......@@ -16,8 +16,8 @@ import java.util.Map;
@ApiModel("变量DTO")
@Data
public class VariableHistoryDataDTO {
@ApiModelProperty(value = "所属设备", required = true)
private String deviceId;
// @ApiModelProperty(value = "所属设备", required = true)
// private String deviceId;
@ApiModelProperty(value = "(x轴为变量时,统计类型必填)统计类型,代表(合计值(sum),平均值(avg),最大值(max),最小值(min) 中位数(middle),原值 original)", required = true)
private String statisticsType;
// @ApiModelProperty(value = "变量id", required = true)
......@@ -34,6 +34,8 @@ public class VariableHistoryDataDTO {
@ApiModelProperty(value = "统计维度如果是时间,请填时间格式如(yyyy-MM-dd HH:mm:ss),非时间为空", required = true)
private String format;
@ApiModelProperty(value = "key 为变量id value 为变量名称", required = true)
private Map<String,String> variables;
// @ApiModelProperty(value = "key 为变量id value 为变量名称", required = true)
// private Map<String,String> variables;
@ApiModelProperty(value = "变量信息", required = true)
private List<VariableSearchDTO> variableSearchList;
}
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
......@@ -15,8 +16,8 @@ import java.util.Map;
@ApiModel("变量DTO")
@Data
public class VariableRealTimeDTO {
@ApiModelProperty(value = "所属设备", required = true)
private String deviceId;
// @ApiModelProperty(value = "所属设备", required = true)
// private String deviceId;
// @ApiModelProperty(value = "变量id", required = true)
// private String variableId;
// @ApiModelProperty(value = "变量Code", required = true)
......@@ -28,8 +29,8 @@ public class VariableRealTimeDTO {
@ApiModelProperty(value = "(如果x轴为变量直接填yyyy-MM-dd HH:mm:ss)请填时间格式如(yyyy-MM-dd HH:mm:ss)", required = true)
private String format;
@ApiModelProperty(value = "key 为变量id value 为变量名称", required = true)
private Map<String,String> variables;
@ApiModelProperty(value = "变量信息", required = true)
private List<VariableSearchDTO> variableSearchList;
@ApiModelProperty(value = "统计维度,如果是时间填time,如果是变量填variableCode", required = true)
private String x;
}
package com.syc.slm.slmbi.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* slm-bi
* 变量
*
* @author : lin
* @date : 2021-03-25 19:05
**/
@Data
@ApiModel(value = "变量DTO")
@EqualsAndHashCode(callSuper=false)
public class VariableSearchDTO extends QueryPageDTO{
@ApiModelProperty(value = "所属设备")
private String deviceId;
@ApiModelProperty(value = "变量id")
private String variableId;
@ApiModelProperty(value = "变量名称")
private String variableName;
}
......@@ -123,14 +123,20 @@ public class VariableServiceImpl implements VariableService {
if(StringUtils.isBlank(uri)){
throw new SysException("请传入uri");
}
if(StringUtils.isBlank(variableDTO.getDeviceId())){
throw new SysException("请传入设备id");
}
if(CollectionUtils.isEmpty(variableDTO.getVariables())){
// if(StringUtils.isBlank(variableDTO.getDeviceId())){
// throw new SysException("请传入设备id");
// }
if(CollectionUtils.isEmpty(variableDTO.getVariableSearchList())){
throw new SysException("请传入变量");
}else{
if(variableDTO.getVariables().values().stream().anyMatch(StringUtils::isBlank)) {
throw new SysException("变量名字不能为空");
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getDeviceId()))){
throw new SysException("设备ID不能为空");
}
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getVariableId()))){
throw new SysException("变量ID不能为空");
}
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getVariableName()))){
throw new SysException("变量名称不能为空");
}
}
if(StringUtils.isBlank(variableDTO.getEndTime())){
......@@ -155,7 +161,7 @@ public class VariableServiceImpl implements VariableService {
if(StringUtils.isBlank(uri)){
throw new SysException("请传入uri");
}
if(StringUtils.isBlank(variableDTO.getDeviceId())){
/*if(StringUtils.isBlank(variableDTO.getDeviceId())){
throw new SysException("请传入设备id");
}
if(CollectionUtils.isEmpty(variableDTO.getVariables())){
......@@ -164,6 +170,19 @@ public class VariableServiceImpl implements VariableService {
if(variableDTO.getVariables().values().stream().anyMatch(StringUtils::isBlank)) {
throw new SysException("变量名字不能为空");
}
}*/
if(CollectionUtils.isEmpty(variableDTO.getVariableSearchList())){
throw new SysException("请传入变量");
}else{
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getDeviceId()))){
throw new SysException("设备ID不能为空");
}
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getVariableId()))){
throw new SysException("变量ID不能为空");
}
if(variableDTO.getVariableSearchList().stream().anyMatch(x -> StringUtils.isBlank(x.getVariableName()))){
throw new SysException("变量名称不能为空");
}
}
if(StringUtils.isBlank(variableDTO.getEndTime())){
......
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