Browse Source

#发电量计算最后值减最初值方式

zhongwei
yang_shj 7 months ago
parent
commit
196eb317e5
  1. 5
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java
  2. 10
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java
  3. 1
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  4. 5
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  5. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java
  6. 53
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java

5
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/entity/AlarmEntity.java

@ -1,11 +1,14 @@
package com.hnac.hzims.alarm.config.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@ -68,6 +71,8 @@ public class AlarmEntity extends TenantEntity {
private Integer alarmCount;
@ApiModelProperty(value = "告警时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.sss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.sss")
private Date alarmTime;
@ApiModelProperty(value = "监测点")

10
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/VideoAlarmServiceImpl.java

@ -68,7 +68,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService {
return records;
}
return records;
}).filter(s -> CollectionUtil.isNotEmpty(s)).collect(Collectors.toList());
}).filter(CollectionUtil::isNotEmpty).collect(Collectors.toList());
List<DeviceSoeVO> res =new ArrayList<>();
if (CollectionUtil.isNotEmpty(collect)) {
res= collect.stream().flatMap(List::stream).collect(Collectors.toList());
@ -76,7 +76,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService {
// 转换平台视频预警信息
List<AlarmEntity> alarmEntities =new ArrayList<>();
if (CollectionUtil.isNotEmpty(res)) {
alarmEntities= res.stream().filter(s->ObjectUtils.isNotEmpty(s)).map(s -> getAlarmEntity(s)).collect(Collectors.toList());
alarmEntities= res.stream().filter(ObjectUtils::isNotEmpty).map(this::getAlarmEntity).collect(Collectors.toList());
}
return alarmEntities;
}
@ -93,11 +93,7 @@ public class VideoAlarmServiceImpl implements VideoAlarmService {
if (CollectionUtil.isEmpty(alarms)) {
return new ArrayList<>();
}
List<AlarmEntity> res = alarms.stream().map(s -> {
AlarmEntity entity = getAlarmEntity(s);
return entity;
}).collect(Collectors.toList());
return res;
return alarms.stream().map(this::getAlarmEntity).collect(Collectors.toList());
}
private AlarmEntity getAlarmEntity(DeviceSoeVO item) {

1
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -69,4 +69,5 @@ public class AlarmScheduledTask {
alarmService.interruption(param);
return new ReturnT<>("SUCCESS");
}
}

5
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -385,15 +385,16 @@ public class MonitorServiceImpl implements MonitorService {
for (RealDeviceVo item : devices) {
List<RealAttributeVo> attributes = item.getAttbtList();
if (CollectionUtil.isEmpty(attributes)) {
return;
continue;
}
List<RealAttributeVo> powerList = attributes.stream().filter(o -> StringUtil.isNoneBlank(o.getValue()) && !"-".equals(o.getValue()) && HomePageConstant.powerList.contains(o.getName())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(powerList)) {
return;
continue;
}
// 获取设备中属性为P/p的value值总和
powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue();
}
realStation.setPowerSum(powerSum);
}
/**

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java

@ -29,5 +29,7 @@ public interface DataService {
List<Map<String, String>> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
Float lastFirstByFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages);
}

53
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java

@ -168,7 +168,7 @@ public class DataServiceImpl implements DataService {
@Override
public List<Map<String, String>> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signage) {
ReductionDataDTO reduction = new ReductionDataDTO();
reduction.setFull(1);
reduction.setFull(0);
reduction.setDeviceCode(deviceCode);
reduction.setSaveTimeType(cycleType);
reduction.setTimeInterval(1);
@ -201,6 +201,57 @@ public class DataServiceImpl implements DataService {
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signage 指标
* @return
*/
@Override
public Float lastFirstByFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signage) {
ReductionDataDTO reduction = new ReductionDataDTO();
reduction.setFull(0);
reduction.setDeviceCode(deviceCode);
reduction.setSaveTimeType(cycleType);
reduction.setTimeInterval(1);
reduction.setNeedPage(false);
reduction.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
reduction.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
// 属性列表
List<ReductionAttrDataDTO> atts = new ArrayList<>();
ReductionAttrDataDTO attr = new ReductionAttrDataDTO();
attr.setAccessRules(accessRules);
attr.setKeepFigures(4);
attr.setSignage(signage);
atts.add(attr);
reduction.setDtos(atts);
Result<ReductionDataVO> result = deviceDataClient.pageDeviceCodeAndSignages(reduction);
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) {
return 0f;
}
if(MapUtils.isEmpty(result.getData().getFieldMap()) || CollectionUtil.isEmpty(result.getData().getDataList())){
return 0f;
}
List<Map<String, String>> dataList = result.getData().getDataList();
if (CollectionUtil.isEmpty(dataList)) {
return 0f;
}
Map<String, String> data = dataList.get(0);
if(MapUtils.isEmpty(data)){
return 0f;
}
String val = data.get(signage);
if(StringUtil.isEmpty(val)){
return 0f;
}
return Float.parseFloat(String.valueOf(Double.parseDouble(val) * ride));
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标
* @return
*/

Loading…
Cancel
Save