|
@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.bizmatics.common.core.exception.BusinessException;
|
|
|
import com.bizmatics.common.core.util.*;
|
|
@@ -131,8 +132,11 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
|
|
|
Optional.ofNullable(siteDynamicProperties).orElseThrow(() -> new BusinessException("sd不存在"));
|
|
|
LambdaQueryWrapper<DeviceAttribute> adQuery = Wrappers.lambdaQuery();
|
|
|
adQuery.eq(DeviceAttribute::getSiteId,device.getSiteId());
|
|
|
- DeviceAttribute deviceAttribute= deviceAttributeService.getOne(adQuery);
|
|
|
- Optional.ofNullable(deviceAttribute).orElseThrow(() -> new BusinessException("da不存在"));
|
|
|
+ List<DeviceAttribute> deviceAttributes = deviceAttributeService.list(adQuery);
|
|
|
+ if (CollectionUtils.isEmpty(deviceAttributes)){
|
|
|
+ throw new BusinessException("da不存在");
|
|
|
+ }
|
|
|
+ DeviceAttribute deviceAttribute = deviceAttributes.stream().min(Comparator.comparing(DeviceAttribute::getId)).get();
|
|
|
return fillRealScoreData(rtAnalogData,siteDynamicProperties,deviceAttribute);
|
|
|
}
|
|
|
|
|
@@ -184,7 +188,7 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
|
|
|
score+=20;
|
|
|
}
|
|
|
//功率
|
|
|
- if (realScoreVo.getCOS() <= 0.15){
|
|
|
+ if (realScoreVo.getCos() <= 0.15){
|
|
|
score+=20;
|
|
|
}
|
|
|
realScoreVo.setScore(score);
|
|
@@ -210,6 +214,10 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
|
|
|
* @return
|
|
|
*/
|
|
|
public Double checkBalun(List<Double> list){
|
|
|
+ long count = list.stream().filter(code -> 0.00 == code).count();
|
|
|
+ if (3 == count){
|
|
|
+ return 0.00;
|
|
|
+ }
|
|
|
Double max = list.stream().max(Double::compareTo).get();
|
|
|
Double min = list.stream().min(Double::compareTo).get();
|
|
|
return Arith.div(Arith.sub(max,min),max);
|