mirror of
https://gitee.com/iteaj/iboot.git
synced 2026-09-01 04:26:49 +08:00
fixed: 修改批量模型获取异常bug
This commit is contained in:
+8
-1
@@ -31,6 +31,9 @@ public interface DataPersistenceListener extends EventGroupCollectListener, Mode
|
||||
.setCollectTime(value.getCollectTime())
|
||||
.setCollectStatus(value.getStatus())
|
||||
.setUid(device.getUid())
|
||||
.setProductCode(device.getProductCode())
|
||||
.setProtocolCode(device.getProtocolCode())
|
||||
.setDeviceGroupId(device.getDeviceGroupId())
|
||||
.setField(value.getSignalOrField())
|
||||
.setFieldName(value.getSignalOrField())
|
||||
);
|
||||
@@ -51,6 +54,7 @@ public interface DataPersistenceListener extends EventGroupCollectListener, Mode
|
||||
if(CollectionUtil.isNotEmpty(info.getInfos())) {
|
||||
long cid = UniqueIdGen.nextLong(); // 声明同一组
|
||||
info.getInfos().forEach(item -> {
|
||||
final RealtimeStatus device = item.getDevice();
|
||||
DataSupplier supplier = item.getSupplier();
|
||||
if(CollectionUtil.isNotEmpty(supplier.getValues())) {
|
||||
supplier.getValues().forEach(value -> {
|
||||
@@ -59,10 +63,13 @@ public interface DataPersistenceListener extends EventGroupCollectListener, Mode
|
||||
.setCid(cid + "").setStatus(true).setReason("")
|
||||
.setCreateTime(new Date()).setValue(strValue)
|
||||
.setAddress(value.getAddress())
|
||||
.setUid(item.getDevice().getUid())
|
||||
.setUid(device.getUid())
|
||||
.setSignalId(value.getId())
|
||||
.setCollectStatus(value.getStatus())
|
||||
.setField(value.getSignalOrField())
|
||||
.setProductCode(device.getProductCode())
|
||||
.setProtocolCode(device.getProtocolCode())
|
||||
.setDeviceGroupId(device.getDeviceGroupId())
|
||||
.setFieldName(value.getSignalOrField())
|
||||
.setCollectTime(supplier.getCollectTime())
|
||||
.setCollectTaskId(info.getSource().getId());
|
||||
|
||||
@@ -94,6 +94,24 @@ public class CollectData extends BaseEntity implements RealtimeCollectData {
|
||||
@IotField(value = "create_time", type = 93)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 产品码
|
||||
*/
|
||||
@IotField(value = "product_code")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 协议码
|
||||
*/
|
||||
@IotField(value = "protocol_code")
|
||||
private String protocolCode;
|
||||
|
||||
/**
|
||||
* 所属组
|
||||
*/
|
||||
@IotField(value = "device_group_id")
|
||||
private Long deviceGroupId;
|
||||
|
||||
/**
|
||||
* 采集状态
|
||||
*/
|
||||
@@ -126,19 +144,4 @@ public class CollectData extends BaseEntity implements RealtimeCollectData {
|
||||
public Long getTaskId() {
|
||||
return getCollectTaskId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocolCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDeviceGroupId() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
)
|
||||
</if>
|
||||
<if test="range == 'device'">
|
||||
where field = #{field} and (UNIX_TIMESTAMP(collect_time) * 1000 between #{startTime} and #{endTime}) and uid in (
|
||||
where product_code=#{productCode} and field = #{field} and (UNIX_TIMESTAMP(collect_time) * 1000 between #{startTime} and #{endTime}) and uid in (
|
||||
<foreach collection="ranges" separator="," item="uid">
|
||||
#{uid}
|
||||
</foreach>
|
||||
@@ -282,7 +282,7 @@
|
||||
select min(value) value, field, uid
|
||||
</if>
|
||||
from iot_collect_data
|
||||
where field = #{field} and (UNIX_TIMESTAMP(collect_time) * 1000 between #{startTime} and #{endTime}) and uid in (
|
||||
where product_code=#{productCode} and field = #{field} and (UNIX_TIMESTAMP(collect_time) * 1000 between #{startTime} and #{endTime}) and uid in (
|
||||
<foreach collection="ranges" separator="," item="uid">
|
||||
#{uid}
|
||||
</foreach>
|
||||
|
||||
+19
-1
@@ -12,4 +12,22 @@ create table isv_project (
|
||||
content json null comment '项目内容',
|
||||
create_time datetime default now() not null comment '创建时间',
|
||||
constraint isv_project_pk primary key (id)
|
||||
) comment '大屏项目';
|
||||
) comment '大屏项目';
|
||||
|
||||
alter table iot_collect_data
|
||||
add product_code varchar(64) null comment '产品编码';
|
||||
|
||||
alter table iot_collect_data
|
||||
add protocol_code varchar(64) null comment '协议编码';
|
||||
|
||||
alter table iot_collect_data
|
||||
add device_group_id bigint null comment '所属组';
|
||||
|
||||
create index iot_collect_data_device_group_id_index
|
||||
on iot_collect_data (device_group_id);
|
||||
|
||||
create index iot_collect_data_protocol_code_index
|
||||
on iot_collect_data (protocol_code);
|
||||
|
||||
create index iot_collect_data_product_code_index
|
||||
on iot_collect_data (product_code);
|
||||
@@ -35,7 +35,7 @@ public class ViewApiParams {
|
||||
private List<String> timeRange;
|
||||
|
||||
/**
|
||||
* 值条件
|
||||
* 数据项
|
||||
*/
|
||||
private List<Value> values;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ViewApiParams {
|
||||
this.range = split[0];
|
||||
} else if(split.length > 1) {
|
||||
this.range = split[0];
|
||||
this.ranges = Arrays.asList(split[1].split(","));
|
||||
this.ranges = Arrays.asList(split[split.length - 1].split(","));
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
@@ -51,9 +51,11 @@ public class ViewSqlCondition {
|
||||
|
||||
public static ViewSqlCondition build(String productCode, String field, String calcType, ViewApiParams params) {
|
||||
List<String> ranges = params.getRanges();
|
||||
if(Objects.equals("all", params.getRange())) {
|
||||
if(Objects.equals("range", params.getCategory())){
|
||||
if(Objects.equals("range", params.getCategory())){
|
||||
if(Objects.equals("all", params.getRange())) {
|
||||
throw new ServiceException("按范围的产品轴不能选用所有范围");
|
||||
} else if(CollectionUtil.isEmpty(ranges)) {
|
||||
throw new ServiceException("按范围必须选择范围配置");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class ISVDataController extends BaseController {
|
||||
result.add(product);
|
||||
result.add(group);
|
||||
result.add(device);
|
||||
result.add(0, new DataItemOption("所有设备", "all", true).asName());
|
||||
result.add(0, new DataItemOption("按所有", "all", true).asName());
|
||||
final List<DataItemOption> groupOptions = isvDataService.listGroupOption();
|
||||
final List<DataItemOption> productOptions = isvDataService.listProductOption(true);
|
||||
if(CollectionUtil.isNotEmpty(groupOptions)) {
|
||||
|
||||
Reference in New Issue
Block a user