|
|
|
|
@@ -78,35 +78,35 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
List<SysDicTreePO> temTreeList = sysDicTreePOList.stream().filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Trans_Sub.getCode())
|
|
|
|
|
|| Objects.equals(item.getCode(), DicTreeEnum.Converter.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Ele_Railways.getCode())
|
|
|
|
|
|| Objects.equals(item.getCode(), DicTreeEnum.Wind_Farms.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Power_Station.getCode())
|
|
|
|
|
|| Objects.equals(item.getCode(), DicTreeEnum.Smelting_Load.getCode())|| Objects.equals(item.getCode(), DicTreeEnum.Imp_Users.getCode())
|
|
|
|
|
|| Objects.equals(item.getCode(), DicTreeEnum.Smelting_Load.getCode()) || Objects.equals(item.getCode(), DicTreeEnum.Imp_Users.getCode())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
Map<String,List<String>> mapKey = new HashMap<>();
|
|
|
|
|
Map<String, List<String>> mapKey = new HashMap<>();
|
|
|
|
|
List<String> otherIds = new ArrayList<>();
|
|
|
|
|
for(SysDicTreePO sysDicTreePO : temTreeList){
|
|
|
|
|
for (SysDicTreePO sysDicTreePO : temTreeList) {
|
|
|
|
|
List<SysDicTreePO> temList;
|
|
|
|
|
if(Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())){
|
|
|
|
|
temList = sysDicTreePOList.stream()
|
|
|
|
|
.filter(item->Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
|
|
|
|
)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}else{
|
|
|
|
|
temList = sysDicTreePOList.stream().filter(item->item.getPid().equals(sysDicTreePO.getId())||
|
|
|
|
|
if (Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())) {
|
|
|
|
|
temList = sysDicTreePOList.stream()
|
|
|
|
|
.filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
|
|
|
|
)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
temList = sysDicTreePOList.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId()) ||
|
|
|
|
|
item.getId().equals(sysDicTreePO.getId())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
mapKey.put(sysDicTreePO.getCode(),ids);
|
|
|
|
|
mapKey.put(sysDicTreePO.getCode(), ids);
|
|
|
|
|
otherIds.addAll(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
|
|
|
|
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode,Function.identity()));
|
|
|
|
|
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取所有单位
|
|
|
|
|
@@ -124,23 +124,18 @@ 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){
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "2100":
|
|
|
|
|
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId());
|
|
|
|
|
break;
|
|
|
|
|
@@ -177,33 +172,31 @@ 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());
|
|
|
|
|
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
|
|
|
|
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
|
|
|
|
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
|
|
|
|
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
if (due == 0 || real == 0) {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int)pointCount);
|
|
|
|
|
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 {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
|
|
|
|
|
result.add(rUploadPointStatisticalDataD);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -223,33 +216,31 @@ 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());
|
|
|
|
|
int due = l3.stream().mapToInt(RStatIntegrityD::getDueTime).sum();
|
|
|
|
|
int real = l3.stream().mapToInt(RStatIntegrityD::getRealTime).sum();
|
|
|
|
|
rUploadPointStatisticalDataD.setExpectCollectNum(due);
|
|
|
|
|
rUploadPointStatisticalDataD.setActualCollectNum(real);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
if (due == 0 || real == 0) {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(0).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int)pointCount);
|
|
|
|
|
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 {
|
|
|
|
|
rUploadPointStatisticalDataD.setDataFullRate(BigDecimal.valueOf(real * 100.0 / due).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
}
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -283,8 +264,8 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
//结束时间
|
|
|
|
|
String endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
|
|
|
|
|
//数据集
|
|
|
|
|
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth,startTime,endTime,"02");
|
|
|
|
|
dataProcessing(calculatedParam,list);
|
|
|
|
|
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth, startTime, endTime, "02");
|
|
|
|
|
dataProcessing(calculatedParam, list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -296,18 +277,17 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
//结束时间
|
|
|
|
|
String endTime = DateUtil.format(DateUtil.endOfYear(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
|
|
|
|
|
//数据集
|
|
|
|
|
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth,startTime,endTime,"01");
|
|
|
|
|
dataProcessing(calculatedParam,list);
|
|
|
|
|
List<RUploadPointStatisticalDataD> list = this.baseMapper.pointStatisticalMonthData(beginMonth, startTime, endTime, "01");
|
|
|
|
|
dataProcessing(calculatedParam, list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param calculatedParam
|
|
|
|
|
* @param list 数据处理
|
|
|
|
|
* @param list 数据处理
|
|
|
|
|
*/
|
|
|
|
|
private void dataProcessing(CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam,List<RUploadPointStatisticalDataD> 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();
|
|
|
|
|
@@ -327,28 +307,28 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
//站别大类
|
|
|
|
|
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.Station_Type.getCode()).getData();
|
|
|
|
|
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode,Function.identity()));
|
|
|
|
|
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getCode, Function.identity()));
|
|
|
|
|
//获取对象类型下字类型
|
|
|
|
|
Map<String,List<String>> mapKey = new HashMap<>();
|
|
|
|
|
Map<String, List<String>> mapKey = new HashMap<>();
|
|
|
|
|
List<String> otherIds = new ArrayList<>();
|
|
|
|
|
for(SysDicTreePO sysDicTreePO : temTreeList){
|
|
|
|
|
for (SysDicTreePO sysDicTreePO : temTreeList) {
|
|
|
|
|
List<SysDicTreePO> temList;
|
|
|
|
|
if(Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())){
|
|
|
|
|
if (Objects.equals(sysDicTreePO.getCode(), DicTreeEnum.Smelting_Load.getCode())) {
|
|
|
|
|
temList = sysDicTreePOList.stream()
|
|
|
|
|
.filter(item->Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode())||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode())||
|
|
|
|
|
.filter(item -> Objects.equals(item.getCode(), DicTreeEnum.Electric_Heating_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Rolling_Mill.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Welding_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Lifting_Load.getCode()) ||
|
|
|
|
|
Objects.equals(item.getCode(), DicTreeEnum.Electrolytic_Load.getCode())
|
|
|
|
|
)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
}else{
|
|
|
|
|
temList = sysDicTreePOList.stream().filter(item->item.getPid().equals(sysDicTreePO.getId())||
|
|
|
|
|
} else {
|
|
|
|
|
temList = sysDicTreePOList.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId()) ||
|
|
|
|
|
item.getId().equals(sysDicTreePO.getId())
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
mapKey.put(sysDicTreePO.getCode(),ids);
|
|
|
|
|
mapKey.put(sysDicTreePO.getCode(), ids);
|
|
|
|
|
otherIds.addAll(ids);
|
|
|
|
|
}
|
|
|
|
|
RUploadPointStatisticalDataD data;
|
|
|
|
|
@@ -358,80 +338,76 @@ 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 = new RUploadPointStatisticalDataD();
|
|
|
|
|
data.setProvinceId(dept.getCode());
|
|
|
|
|
data.setProvinceName(dept.getName());
|
|
|
|
|
judgeLevel(item.getDeptLevel(), data, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
|
|
|
|
|
|
|
|
|
if(listMap.containsKey(data.getProvinceId() + data.getCityId() + data.getCountyId())){
|
|
|
|
|
if (listMap.containsKey(data.getProvinceId() + data.getCityId() + data.getCountyId())) {
|
|
|
|
|
List<RUploadPointStatisticalDataD> orgData = listMap.get(data.getProvinceId() + data.getCityId() + data.getCountyId());
|
|
|
|
|
//根据所属站别进行分类
|
|
|
|
|
Map<String, RUploadPointStatisticalDataD> stationTypeMap = orgData.stream().collect(Collectors.toMap(x -> x.getStationType(), Function.identity()));
|
|
|
|
|
mapKey.forEach((key, val) -> {
|
|
|
|
|
List<LineDevGetDTO> keyItem = temBaseList.stream().filter(o -> val.contains(o.getObjType())).collect(Collectors.toList());
|
|
|
|
|
String stationType = "";
|
|
|
|
|
switch (key){
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "2100":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "1200":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Converter.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Converter.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "1300":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Ele_Railways.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Ele_Railways.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "1401":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Wind_Farms.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Wind_Farms.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "1402":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "2300":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
case "2400":
|
|
|
|
|
stationType=dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId();
|
|
|
|
|
stationType = dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(stationTypeMap.containsKey(stationType)){
|
|
|
|
|
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);
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//其他类型
|
|
|
|
|
if(stationTypeMap.containsKey(dictDataMap.get(DicDataEnum.Station_Other.getCode()).getId())){
|
|
|
|
|
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);
|
|
|
|
|
rUploadPointStatisticalDataD.setOnlineMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setRunMonitorNum((int) monitorCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int)pointCount);
|
|
|
|
|
rUploadPointStatisticalDataD.setStationMonitorNum((int) pointCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(list)){
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
}*/
|
|
|
|
|
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);
|
|
|
|
|
this.saveOrUpdateBatchByMultiId(list, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* r_stat_integrity_d表中获取数据应收数、实收数
|
|
|
|
|
*/
|
|
|
|
|
|