Commit 50e7c5a3 authored by tangwei's avatar tangwei

修改bug

parent 1cc2c07c
......@@ -15,5 +15,5 @@ public class IndexDto {
private String gatewayId;// '网关',
private String valueLabel;// '指标值', 取valueLable
private String address;// 指标地址
private Date createdTime;// '上报时间',
private String createdTime;// '上报时间',
}
......@@ -22,7 +22,7 @@ public class MonitorFanIndicatorDto extends BaseEntity {
private String gateway;// '网关',
private String indicator;//'指标名称',
private String indicatorValue;// '指标值',
private Date time;// '时间',
private Date indicatorTime;// '时间',
private String isAlarm;//'是否告警指标',
private String unit;//'指标单位',
private String systemType;//所属系统
......
......@@ -29,8 +29,8 @@ public class MonitorFanIndicator extends BaseEntity {
private String indicator;//'指标名称',
@TableField("indicator_value")
private String indicatorValue;// '指标值',
@TableField("time")
private Date time;// '时间',
@TableField("indicator_time")
private Date indicatorTime;// '时间',
@TableField("is_alarm")
private String isAlarm;//'是否告警指标',
@TableField("unit")
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mysql.cj.x.protobuf.MysqlxCrud;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -14,6 +15,6 @@ import java.util.List;
*/
public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicator> {
//批量修改
void UpdateMonitorFanIndicator(List<IndexDto> list);
void UpdateMonitorFanIndicator(@Param(value = "list") List<IndexDto> list);
}
......@@ -5,8 +5,8 @@
<update id="UpdateMonitorFanIndicator">
<foreach collection="list" item="item" index="index">
update monitor_fan_indicator set indicator_value =#{item.indicatorValue} ,set time=#{item.createdTime}
where gateway=#{time.gateway} and index_address=#{time.indexAddress}
update monitor_fan_indicator set indicator_value =#{item.valueLabel} , indicator_time =#{item.createdTime}
where gateway=#{item.gatewayId} and index_address=#{item.address};
</foreach>
</update>
......
......@@ -58,7 +58,7 @@ public class StationDataTaskImpl {
return stationTaksDtoList;
}
@Async("jxiopAsyncExecutor")
public List<DeviceDto> getListDevice(StationTaksDto stationTaksDto) {
List<DeviceDto> deviceDtoList = new ArrayList<>();
TpriDmpDatabook tpriDmpDatabook = tpriDmpDatabookServiceImpl.getTpriDmpDatabookByDataName("风机");
......@@ -70,33 +70,32 @@ public class StationDataTaskImpl {
String [] kksbms = kksbm.split(" ");
String numberName = kksbms[kksbms.length-1].replace("MD","");
deviceDto.setNumberName(numberName);
deviceDtoList.add(deviceDto);
});
return deviceDtoList;
}
@Async("jxiopAsyncExecutor")
public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
String querysql ="SELECT createdTime ,gatewayId,address,valueLabel FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+".*/ and gatewayId='"+deviceDto.getGateway()+"' GROUP BY equipmentIndex ORDER BY time desc LIMIT 600";
String querysql ="SELECT createdTime ,gatewayId,address,valueLabel FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
//每个分机的指标数据
List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
return list;
}
@Async("jxiopAsyncExecutor")
public void UpdateMonitorFanIndicator(List<IndexDto> list){
if(list!=null&&list.size()>0){
//对数据切片处理 默认创建
if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{
//进行分片处理
List<List<IndexDto>> listfp= Lists.partition(list,list.size()%stationSection);
for (List<IndexDto> indexDtos : listfp) {
List<List<IndexDto>> listfp4= Lists.partition(list,100);
for (List<IndexDto> indexDtos : listfp4) {
//每个分级信息处理
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(indexDtos);
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}
}
}
return list;
}
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
......@@ -17,6 +18,7 @@ import java.util.List;
*/
@Component
@EnableScheduling
public class StationDataTask {
@Autowired
......@@ -34,7 +36,6 @@ public class StationDataTask {
if(listDeviceDto!=null&&listDeviceDto.size()>0){
for (DeviceDto deviceDto : listDeviceDto) {
List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
stationDataTask.UpdateMonitorFanIndicator(listIndexDto);
}
}
}
......
......@@ -35,10 +35,7 @@ public class InfluxDButils {
Object v = values.get(i).get(j);
if ("time".equals(k)) {
continue;
} else if ("createdTime".equals(k)) {
Date date = DateUtil.getLongDate(v.toString());
bean.setPropertyValue(k, date);
} else {
} else {
bean.setPropertyValue(k, v);
}
}
......
......@@ -66,7 +66,7 @@ privilege.fegin.name=AMOS-API-PRIVILEGE
feign.client.config.default.connect-timeout=20000
feign.client.config.default.read-timeout=20000
#场站实时数据
station.task.cron=0 0/2 * * * ?
station.task.cron=0/10 * * * * ?
#是否切片
station.isok=true
#风机更新数据切片量
......
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