bug调整

This commit is contained in:
2023-11-21 14:23:49 +08:00
parent 23a47892d0
commit 41a0e62953
5 changed files with 22 additions and 18 deletions

View File

@@ -32,6 +32,7 @@ public class RMpMonitorAlarmCountM implements Serializable {
/**
* 数据类型(0:主网 1:配网)
*/
@TableField(exist = false)
private String dataType;
/**

View File

@@ -109,8 +109,7 @@ implements RMpMonitorAlarmCountMService {
LambdaQueryWrapper<RMpMonitorAlarmCountM> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(RMpMonitorAlarmCountM::getMeasurementPointId, monitorIdList)
.ge(RMpMonitorAlarmCountM::getDataDate, startTime)
.le(RMpMonitorAlarmCountM::getDataDate, endTime)
.eq(RMpMonitorAlarmCountM::getDataType, dataType);
.le(RMpMonitorAlarmCountM::getDataDate, endTime);
List<RMpMonitorAlarmCountM> alarmCountMList = this.list(lambdaQueryWrapper);
List<RMpMonitorAlarmCountMVO> resultList;
if (CollUtil.isNotEmpty(alarmCountMList)) {
@@ -119,7 +118,7 @@ implements RMpMonitorAlarmCountMService {
RMpMonitorAlarmCountMVO rMpMonitorAlarmCountMVO = new RMpMonitorAlarmCountMVO();
BeanUtils.copyProperties(item, rMpMonitorAlarmCountMVO);
//单位信息
rMpMonitorAlarmCountMVO.setOrgName(deptDTOMap.get(item.getOrgNo()).getName()); //所属单位名称
rMpMonitorAlarmCountMVO.setOrgName(deptDTOMap.get(monitorMap.get(item.getMeasurementPointId()).getOrgId()).getName()); //所属单位名称
//监测点信息
rMpMonitorAlarmCountMVO.setMeasurementPointName(monitorMap.get(item.getMeasurementPointId()).getName());//监测点名称
rMpMonitorAlarmCountMVO.setMonitorTypeName(monitorTypeMap.get(monitorMap.get(item.getMeasurementPointId()).getMonitorType()));//监测点类型名称

View File

@@ -99,17 +99,20 @@ implements RStatZwAlarmCountWService {
BeanUtils.copyProperties(item, rStatZwAlarmCountWVO);
//单位名称
rStatZwAlarmCountWVO.setOrgName(deptDTOMap.get(rStatZwAlarmCountWVO.getOrgNo()).getName());
DecimalFormat df = new DecimalFormat("###.00");
// DecimalFormat df = new DecimalFormat("###.00");
//获取有效监测点数量
Integer monitorEffectiveCount = item.getMonitorEffectiveCount();
if (monitorEffectiveCount == null || monitorEffectiveCount <= 0) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "有效监测点数量异常");
}
//todo 有效监测点数量在实际环境中是可能为0的,不需要做异常处理
// if (monitorEffectiveCount == null || monitorEffectiveCount <= 0) {
// throw new BusinessException(CommonResponseEnum.NO_DATA, "有效监测点数量异常");
// }
//计算告警四次及以上监测点占比( * 100 是直接取到百分比)
Double warnMonitorRate = Double.parseDouble(df.format(item.getWarnMonitorCount() / (monitorEffectiveCount * 1.0) * 100));
// Double warnMonitorRate = Double.parseDouble(df.format(item.getWarnMonitorCount() / (monitorEffectiveCount * 1.0) * 100));
Double warnMonitorRate = monitorEffectiveCount<=0 ? 0.0 : Double.parseDouble(String.format("%.2f",item.getWarnMonitorCount() / (monitorEffectiveCount * 1.0) * 100));
rStatZwAlarmCountWVO.setWarnMonitorRate(warnMonitorRate);
//级别'较差'监测点占比( * 100 是直接取到百分比)
Double monitorGradeRate = Double.parseDouble(df.format(item.getMonitorGradeCount() / (monitorEffectiveCount * 1.0) * 100));
// Double monitorGradeRate = Double.parseDouble(df.format(item.getMonitorGradeCount() / (monitorEffectiveCount * 1.0) * 100));
Double monitorGradeRate = monitorEffectiveCount<=0 ? 0.0 : Double.parseDouble(String.format("%.2f",item.getMonitorGradeCount() / (monitorEffectiveCount * 1.0) * 100));
rStatZwAlarmCountWVO.setMonitorGradeRate(monitorGradeRate);
return rStatZwAlarmCountWVO;