|
|
|
|
@@ -124,21 +124,16 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<LineDevGetDTO> newList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
|
|
|
|
|
item.setLineBaseList(newList);
|
|
|
|
|
List<LineDevGetDTO> newBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me->!otherIds.contains(me.getObjType())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<LineDevGetDTO> temBaseList = item.getLineBaseList();
|
|
|
|
|
long monitorCount = temBaseList.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
long devCount = temBaseList.stream().map(LineDevGetDTO::getDevId).distinct().count();
|
|
|
|
|
List<String> upMonitorIds = newBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> upDevIds = newBaseList.stream().map(LineDevGetDTO::getDevId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapKey.forEach((key, val) -> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<LineDevGetDTO> keyItem = temBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(Collectors.toList());
|
|
|
|
|
List<LineDevGetDTO> keyItem = newBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(Collectors.toList());
|
|
|
|
|
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = new RUploadPointStatisticalDataD();
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "2100":
|
|
|
|
|
@@ -177,21 +172,23 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
//fixme over
|
|
|
|
|
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
//long devCount = keyItem.stream().map(LineDevGetDTO::getDevId).distinct().count();
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorRate(monitorCount == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum(upDevIds.size());
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> temBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
|
|
|
|
|
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> upMonitorIds.contains(it.getLineIndex())).collect(Collectors.toList());
|
|
|
|
|
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
|
|
|
|
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
|
|
|
|
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
|
|
|
|
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
|
|
|
|
|
|
|
|
|
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) onlineCount);
|
|
|
|
|
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
|
|
|
|
|
if (due == 0 || real == 0) {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
@@ -199,11 +196,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.add(rUploadPointStatisticalDataD);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -223,21 +216,21 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
//fixme over
|
|
|
|
|
judgeLevel(item.getDeptLevel(), rUploadPointStatisticalDataD, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<LineDevGetDTO> otherMonitor = newBaseList.stream().filter(me -> !otherIds.contains(me.getObjType())).collect(Collectors.toList());
|
|
|
|
|
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
//long devCount = otherMonitor.stream().map(LineDevGetDTO::getDevId).distinct().count();
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorRate(monitorCount == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum(upDevIds.size());
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum(upMonitorIds.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> temBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
|
|
|
|
|
List<RStatIntegrityD> l3 = dataList.stream().filter(it -> newBaseList.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList()).contains(it.getLineIndex())).collect(Collectors.toList());
|
|
|
|
|
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
|
|
|
|
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
|
|
|
|
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
|
|
|
|
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
|
|
|
|
|
|
|
|
|
long onlineCount = l3.stream().filter(me -> me.getRealTime() > 0).count();
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) onlineCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorRate(upMonitorIds.size() == 0 ? 0d : BigDecimal.valueOf(rUploadPointStatisticalDataD.getOnlineMonitorNum() * 100.0 / rUploadPointStatisticalDataD.getRunMonitorNum()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
if (due == 0 || real == 0) {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
@@ -248,8 +241,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
result.add(rUploadPointStatisticalDataD);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(result)) {
|
|
|
|
|
@@ -260,16 +251,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
if (CollectionUtil.isNotEmpty(oldData)) {
|
|
|
|
|
result.forEach(it -> it.setId(null));
|
|
|
|
|
}
|
|
|
|
|
//fixme 数据完成率先造假,后期删除
|
|
|
|
|
// result.forEach(item->{
|
|
|
|
|
// if (item.getExpectCollectNum() > 0){
|
|
|
|
|
// Random random = new Random();
|
|
|
|
|
// double randomValue = 99 + random.nextDouble() * (100 - 99);
|
|
|
|
|
// item.setDataFullRate(randomValue);
|
|
|
|
|
// item.setActualCollectNum((int) Math.ceil(randomValue * item.getExpectCollectNum() / 100));
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
//fixme over
|
|
|
|
|
this.saveOrUpdateBatchByMultiId(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -301,13 +282,12 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param calculatedParam
|
|
|
|
|
* @param list 数据处理
|
|
|
|
|
*/
|
|
|
|
|
private void dataProcessing(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam, List<RUploadPointStatisticalDataD> list) {
|
|
|
|
|
|
|
|
|
|
//数据分组
|
|
|
|
|
/* //数据分组
|
|
|
|
|
Map<String, List<RUploadPointStatisticalDataD>> listMap = list.stream().collect(Collectors.groupingBy(x -> x.getProvinceId() + x.getCityId() + x.getCountyId()));
|
|
|
|
|
//获取省级单位id
|
|
|
|
|
Dept root = deptFeignClient.getRootDept().getData();
|
|
|
|
|
@@ -358,7 +338,6 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
long monitorCount = temBaseList.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
long devCount = temBaseList.stream().map(LineDevGetDTO::getDevId).distinct().count();
|
|
|
|
|
//其他类型
|
|
|
|
|
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me->!otherIds.contains(me.getObjType())).collect(Collectors.toList());
|
|
|
|
|
data = new RUploadPointStatisticalDataD();
|
|
|
|
|
data.setProvinceId(dept.getCode());
|
|
|
|
|
data.setProvinceName(dept.getName());
|
|
|
|
|
@@ -397,18 +376,14 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
if (stationTypeMap.containsKey(stationType)) {
|
|
|
|
|
long pointCount = keyItem.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = stationTypeMap.get(stationType);
|
|
|
|
|
if(ObjectUtil.isNull(devCount)){
|
|
|
|
|
System.out.println();
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//其他类型
|
|
|
|
|
if (stationTypeMap.containsKey(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId())) {
|
|
|
|
|
List<LineDevGetDTO> otherMonitor = item.getLineBaseList().stream().filter(me -> !otherIds.contains(me.getObjType())).collect(Collectors.toList());
|
|
|
|
|
long pointCount = otherMonitor.stream().map(LineDevGetDTO::getPointId).distinct().count();
|
|
|
|
|
RUploadPointStatisticalDataD rUploadPointStatisticalDataD = stationTypeMap.get(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId());
|
|
|
|
|
rUploadPointStatisticalDataD.setRunTerminalNum((int) devCount);
|
|
|
|
|
@@ -418,20 +393,21 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
list.forEach(item -> {
|
|
|
|
|
item.setId(IdUtil.simpleUUID());
|
|
|
|
|
item.setComputeDate(calculatedParam.getDataDate());
|
|
|
|
|
if(item.getOnlineMonitorNum()>item.getRunMonitorNum()){
|
|
|
|
|
item.setOnlineMonitorRate(100.0);
|
|
|
|
|
item.setOnlineMonitorNum(item.getRunMonitorNum());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.saveOrUpdateBatchByMultiId(list, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* r_stat_integrity_d表中获取数据应收数、实收数
|
|
|
|
|
*/
|
|
|
|
|
|