1.国网上送数据增加非空判断
2.调整国网上送主网监测点统计和典型源荷统计的算法逻辑
This commit is contained in:
@@ -136,6 +136,7 @@ public class PqTypicalSourceCreatePOServiceImpl extends ServiceImpl<PqTypicalSou
|
||||
list = this.lambdaQuery()
|
||||
.eq(PqTypicalSourceCreatePO::getStatisticalDate,uploadParam.getTime())
|
||||
.in(PqTypicalSourceCreatePO::getId,uploadParam.getList())
|
||||
.isNotNull(PqTypicalSourceCreatePO::getComputeDate)
|
||||
.in(PqTypicalSourceCreatePO::getStatisticalLevel,Stream.of("3","4").collect(Collectors.toList()))
|
||||
.list();
|
||||
}
|
||||
@@ -144,6 +145,7 @@ public class PqTypicalSourceCreatePOServiceImpl extends ServiceImpl<PqTypicalSou
|
||||
list = this.lambdaQuery()
|
||||
.eq(PqTypicalSourceCreatePO::getStatisticalDate,uploadParam.getTime())
|
||||
.eq(PqTypicalSourceCreatePO::getIsUploadHead,0)
|
||||
.isNotNull(PqTypicalSourceCreatePO::getComputeDate)
|
||||
.in(PqTypicalSourceCreatePO::getStatisticalLevel, Stream.of("3","4").collect(Collectors.toList()))
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public class PointStatisticalDataServiceImpl extends ServiceImpl<RUploadPointSta
|
||||
list = this.lambdaQuery()
|
||||
.eq(RUploadPointStatisticalDataD::getStatisticalDate,param.getTime())
|
||||
.in(RUploadPointStatisticalDataD::getId,param.getList())
|
||||
.isNotNull(RUploadPointStatisticalDataD::getComputeDate)
|
||||
.list();
|
||||
}
|
||||
//未指定数据上送,则上送省级数据
|
||||
@@ -89,6 +90,7 @@ public class PointStatisticalDataServiceImpl extends ServiceImpl<RUploadPointSta
|
||||
list = this.lambdaQuery()
|
||||
.eq(RUploadPointStatisticalDataD::getStatisticalDate,param.getTime())
|
||||
.eq(RUploadPointStatisticalDataD::getUploadStatus,0)
|
||||
.isNotNull(RUploadPointStatisticalDataD::getComputeDate)
|
||||
.in(RUploadPointStatisticalDataD::getStatisticalLevel, Stream.of("3","4").collect(Collectors.toList()))
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ public class REvaluationDataServiceImpl extends ServiceImpl<RUploadEvaluationDat
|
||||
list = this.lambdaQuery()
|
||||
.eq(RUploadEvaluationDataD::getStatisticalDate,param.getTime())
|
||||
.in(RUploadEvaluationDataD::getId,param.getList())
|
||||
.isNotNull(RUploadEvaluationDataD::getComputeDate)
|
||||
.list();
|
||||
}
|
||||
//未指定数据上送,则上送省级数据(包含日、月数据)
|
||||
@@ -104,6 +105,7 @@ public class REvaluationDataServiceImpl extends ServiceImpl<RUploadEvaluationDat
|
||||
list = this.lambdaQuery()
|
||||
.eq(RUploadEvaluationDataD::getStatisticalDate,param.getTime())
|
||||
.eq(RUploadEvaluationDataD::getUploadStatus,0)
|
||||
.isNotNull(RUploadEvaluationDataD::getComputeDate)
|
||||
.in(RUploadEvaluationDataD::getStatisticalLevel, Stream.of("3","4").collect(Collectors.toList()))
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
@@ -13,7 +12,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.harmonic.mapper.upload.RUploadSubstationStatisticalDataDMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PqTypicalSourceCreateDTO;
|
||||
import com.njcn.harmonic.pojo.dto.upload.SubstationQualityStatisticsDTO;
|
||||
import com.njcn.harmonic.pojo.param.UploadDataParam;
|
||||
import com.njcn.harmonic.pojo.param.UploadParam;
|
||||
@@ -77,6 +75,7 @@ public class RSubstationStatisticalDataServiceImpl extends ServiceImpl<RUploadSu
|
||||
list = this.lambdaQuery()
|
||||
.eq(RUploadSubstationStatisticalDataD::getStatisticalDate,param.getTime())
|
||||
.in(RUploadSubstationStatisticalDataD::getId,param.getList())
|
||||
.isNotNull(RUploadSubstationStatisticalDataD::getComputeDate)
|
||||
.list();
|
||||
}
|
||||
//未指定数据上送,则将所有未上送的数据,上送上去
|
||||
@@ -85,6 +84,7 @@ public class RSubstationStatisticalDataServiceImpl extends ServiceImpl<RUploadSu
|
||||
.eq(RUploadSubstationStatisticalDataD::getStatisticalDate,param.getTime())
|
||||
.eq(RUploadSubstationStatisticalDataD::getUploadStatus,0)
|
||||
.eq(RUploadSubstationStatisticalDataD::getCityId,"")
|
||||
.isNotNull(RUploadSubstationStatisticalDataD::getComputeDate)
|
||||
//.eq(RUploadSubstationStatisticalDataD::getCountyId,"")
|
||||
.list();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
FROM
|
||||
pq_typical_source_create
|
||||
<where>
|
||||
AND compute_date is not null
|
||||
<if test="param.provinceId != null and param.provinceId != '' ">
|
||||
AND provinceId = #{param.provinceId}
|
||||
</if>
|
||||
@@ -115,6 +116,7 @@
|
||||
FROM
|
||||
pq_typical_source_create
|
||||
<where>
|
||||
AND compute_date is not null
|
||||
<if test="param.provinceId != null and param.provinceId != '' ">
|
||||
AND provinceId = #{param.provinceId}
|
||||
</if>
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
@@ -146,7 +147,7 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
case "1402":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId());
|
||||
break;
|
||||
case "2600":
|
||||
case "2300":
|
||||
rUploadPointStatisticalDataD.setStationType(dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId());
|
||||
break;
|
||||
case "2400":
|
||||
@@ -274,13 +275,7 @@ 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");
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
list.forEach(item->{
|
||||
item.setId(IdUtil.simpleUUID());
|
||||
item.setComputeDate(calculatedParam.getDataDate());
|
||||
});
|
||||
this.saveOrUpdateBatchByMultiId(list,1000);
|
||||
}
|
||||
dataProcessing(calculatedParam,list);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -293,6 +288,115 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
String provinceId = deptFeignClient.getDepSonIdByDeptId(root.getId()).getData().get(0);
|
||||
Dept dept = deptFeignClient.getDeptById(provinceId).getData();
|
||||
|
||||
//获取所有单位
|
||||
List<Dept> deptList = deptFeignClient.getAllDept().getData();
|
||||
Map<String, List<Dept>> deptMap = deptList.stream().collect(Collectors.groupingBy(Dept::getCode));
|
||||
|
||||
//查询所有一级树字典
|
||||
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
|
||||
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())
|
||||
).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,List<String>> mapKey = new HashMap<>();
|
||||
List<String> otherIds = new ArrayList<>();
|
||||
for(SysDicTreePO sysDicTreePO : temTreeList){
|
||||
List<SysDicTreePO> temList = sysDicTreePOList.stream().filter(item->item.getPid().equals(sysDicTreePO.getId())).collect(Collectors.toList());
|
||||
List<String> ids = temList.stream().map(SysDicTreePO::getId).distinct().collect(Collectors.toList());
|
||||
ids.add(sysDicTreePO.getId());
|
||||
mapKey.put(sysDicTreePO.getCode(),ids);
|
||||
otherIds.addAll(ids);
|
||||
}
|
||||
RUploadPointStatisticalDataD data;
|
||||
for (DeptGetChildrenMoreDTO item : calculatedParam.getIdList()) {
|
||||
//获取国网上送监测点
|
||||
List<LineDevGetDTO> temBaseList = item.getLineBaseList().stream().filter(o -> Objects.equals(o.getIsUpToGrid(), 1)).collect(Collectors.toList());
|
||||
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());
|
||||
judgeLevel(item.getDeptLevel(), data, item.getUnitId(), item.getUnitName(), deptList, deptMap);
|
||||
|
||||
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){
|
||||
case "2100":
|
||||
stationType=dictDataMap.get(DicDataEnum.Trans_Sub.getCode()).getId();
|
||||
break;
|
||||
case "1200":
|
||||
stationType=dictDataMap.get(DicDataEnum.Converter.getCode()).getId();
|
||||
break;
|
||||
case "1300":
|
||||
stationType=dictDataMap.get(DicDataEnum.Ele_Railways.getCode()).getId();
|
||||
break;
|
||||
case "1401":
|
||||
stationType=dictDataMap.get(DicDataEnum.Wind_Farms.getCode()).getId();
|
||||
break;
|
||||
case "1402":
|
||||
stationType=dictDataMap.get(DicDataEnum.Power_Station.getCode()).getId();
|
||||
break;
|
||||
case "2300":
|
||||
stationType=dictDataMap.get(DicDataEnum.Smelting_Load.getCode()).getId();
|
||||
break;
|
||||
case "2400":
|
||||
stationType=dictDataMap.get(DicDataEnum.Imp_Users.getCode()).getId();
|
||||
break;
|
||||
}
|
||||
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())){
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
list.forEach(item->{
|
||||
item.setId(IdUtil.simpleUUID());
|
||||
@@ -302,6 +406,10 @@ public class RUploadPointStatisticalDataDServiceImpl extends MppServiceImpl<RUpl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* r_stat_integrity_d表中获取数据应收数、实收数
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,8 @@ public enum DicTreeEnum {
|
||||
Ele_Railways("电气化铁路","1300"),
|
||||
Wind_Farms("风电场","1401"),
|
||||
Power_Station("光伏电站","1402"),
|
||||
Smelting_Load("冶炼负荷","2600"),
|
||||
//其实对应其他非线性负荷
|
||||
Smelting_Load("冶炼负荷","2300"),
|
||||
Imp_Users("敏感/重要/高危用户","2400"),
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user