|
|
@@ -37,6 +37,16 @@ public class LocalBusDeviceHistoryService extends BaseService<BusDeviceHistoryMa
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public BigDecimal computeTestLossRate(long maxCount,long totalCount,List<BusDeviceHistoryEntity> sources) {
|
|
|
+ if(totalCount==0){
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(sources)) {
|
|
|
+ BigDecimal proportionRate = BigDecimal.valueOf(totalCount).divide(BigDecimal.valueOf(maxCount), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ return BigDecimal.ONE.subtract(proportionRate).multiply(BigDecimal.valueOf(100));
|
|
|
+ }
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }
|
|
|
|
|
|
public IPage<BusDeviceHistoryEntity> pageQuery(DeviceHistoryQuery query){
|
|
|
return this.baseMapper.pageQuery(query.getPage(),query);
|