1.谐波溯源算法
2.北京暂降平台
This commit is contained in:
@@ -195,6 +195,9 @@ public class HarmonicUpServiceImpl extends ServiceImpl<UpHarmonicDetailMapper,Up
|
||||
|
||||
// 1. 获取线路ID和台账基础信息
|
||||
List<String> lineIds = commGeneralService.getRunLineIdsByDept(param.getDeptId());
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"当前部门未绑定监测点");
|
||||
}
|
||||
List<LedgerBaseInfo> ledgerBaseInfoList = ledgerScaleMapper.getLedgerBaseInfo(lineIds);
|
||||
|
||||
if (CollUtil.isEmpty(ledgerBaseInfoList)) {
|
||||
@@ -558,10 +561,6 @@ public class HarmonicUpServiceImpl extends ServiceImpl<UpHarmonicDetailMapper,Up
|
||||
.sorted(Comparator.comparing(AnomalyInfo::getTime))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if(sortedAnomalies.get(0).getLineId().equals("9686e66738bab8516ff2c2e9fedc0518")){
|
||||
System.out.println(555);
|
||||
}
|
||||
|
||||
// 检查是否连续
|
||||
List<List<AnomalyInfo>> infoList =findAllContinuousAnomalies(sortedAnomalies,ledgerBaseInfoMap);
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.product.advance.responsility.pojo.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum CalculationType {
|
||||
|
||||
PW_TYPE(0,"配网类型"),
|
||||
SYSTEM_TYPE(1,"系统类型")
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
private final int code;
|
||||
private final String description;
|
||||
|
||||
CalculationType(int code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@@ -25,5 +25,7 @@ public class RespDataDTO extends RespData implements Serializable {
|
||||
|
||||
private String lineName;
|
||||
|
||||
private Integer type;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -52,4 +52,9 @@ public class RespData extends BaseEntity {
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 状态(0/null:配网 1:系统)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.product.advance.responsility.mapper.RespDataResultMapper;
|
||||
import com.njcn.product.advance.responsility.pojo.constant.CalculationType;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.ResponsibilityResult;
|
||||
@@ -48,11 +49,11 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
||||
@Override
|
||||
public List<ResponsibilityResult> displayHistoryData(String id, Integer time) {
|
||||
List<ResponsibilityResult> responsibilityResults = new ArrayList<>();
|
||||
if (Objects.isNull(time)) {
|
||||
RespData respData = respDataService.getById(id);
|
||||
String[] split = respData.getDataTimes().split(StrPool.COMMA);
|
||||
//if (Objects.isNull(time)) {
|
||||
RespData respDataQuery = respDataService.getById(id);
|
||||
String[] split = respDataQuery.getDataTimes().split(StrPool.COMMA);
|
||||
time = Integer.parseInt(split[0]);
|
||||
}
|
||||
//}
|
||||
LambdaQueryWrapper<RespDataResult> respDataResultLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
respDataResultLambdaQueryWrapper.eq(RespDataResult::getResDataId, id)
|
||||
.eq(RespDataResult::getTime, time);
|
||||
@@ -74,12 +75,17 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
||||
InputStream userDetailStream = fileStorageUtil.getFileStream(respDataResult.getUserDetailData());
|
||||
String userDetailStr = IoUtil.readUtf8(userDetailStream);
|
||||
List<CustomerData> customerData = JSONArray.parseArray(userDetailStr, CustomerData.class);
|
||||
responsibilityResult.setDatas(customerData);
|
||||
//处理排名前10数据
|
||||
InputStream respStream = fileStorageUtil.getFileStream(respDataResult.getUserResponsibility());
|
||||
String respStr = IoUtil.readUtf8(respStream);
|
||||
List<CustomerResponsibility> respData = JSONArray.parseArray(respStr, CustomerResponsibility.class);
|
||||
if(Objects.nonNull(respDataQuery.getType()) && respDataQuery.getType().equals(CalculationType.SYSTEM_TYPE.getCode())){
|
||||
customerData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||
respData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||
}
|
||||
responsibilityResult.setResponsibilities(respData);
|
||||
responsibilityResult.setDatas(customerData);
|
||||
|
||||
responsibilityResults.add(responsibilityResult);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.FileUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
@@ -41,6 +42,7 @@ import com.njcn.product.advance.responsility.pojo.bo.RespCommon;
|
||||
import com.njcn.product.advance.responsility.pojo.bo.RespHarmData;
|
||||
import com.njcn.product.advance.responsility.pojo.bo.UserDataExcel;
|
||||
import com.njcn.product.advance.responsility.pojo.constant.CalculationStatus;
|
||||
import com.njcn.product.advance.responsility.pojo.constant.CalculationType;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
||||
import com.njcn.product.advance.responsility.pojo.dto.RespDataDTO;
|
||||
@@ -121,6 +123,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
public final static int INTERVAL_TIME_1 = 1;
|
||||
public final static int INTERVAL_TIME_3 = 3;
|
||||
public final static int INTERVAL_TIME_5 = 5;
|
||||
public final static int INTERVAL_TIME_10 = 10;
|
||||
public final static int INTERVAL_TIME_15 = 15;
|
||||
public final static int INTERVAL_TIME_30 = 30;
|
||||
public final static int WINDOW_96 = 96;
|
||||
@@ -453,8 +456,8 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
int pNode, pNum, win, harmNum;
|
||||
float harmMk;
|
||||
List<UserDataExcel> userDataExcels = new ArrayList<>();
|
||||
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==1){
|
||||
userDataExcels = test(responsibilityCalculateParam.getUserList(),responsibilityCalculateParam.getSearchBeginTime(),responsibilityCalculateParam.getSearchEndTime());
|
||||
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||
userDataExcels = sysMonitorDataGet(responsibilityCalculateParam.getUserList(),responsibilityCalculateParam.getSearchBeginTime(),responsibilityCalculateParam.getSearchEndTime());
|
||||
}else {
|
||||
userDataExcels = respUserDataService.getUserDataExcelList(responsibilityCalculateParam.getUserDataId());
|
||||
|
||||
@@ -618,6 +621,12 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
customerData.add(customerDataT);
|
||||
}
|
||||
}
|
||||
|
||||
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||
customerData.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||
customerResponsibilities.forEach(item->item.setCustomerName(item.getCustomerName().substring(0,item.getCustomerName().indexOf("("))));
|
||||
}
|
||||
|
||||
result.setDatas(customerData);
|
||||
result.setTimeDatas(timeDatas);
|
||||
result.setResponsibilities(customerResponsibilities);
|
||||
@@ -643,6 +652,11 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
responsibilityData.setDataTimes(responsibilityCalculateParam.getTime().toString());
|
||||
responsibilityData.setTimeWindow(timeWin);
|
||||
responsibilityData.setState(DataStateEnum.ENABLE.getCode());
|
||||
if(Objects.nonNull(responsibilityCalculateParam.getSystemType()) && responsibilityCalculateParam.getSystemType()==CalculationType.SYSTEM_TYPE.getCode()){
|
||||
responsibilityData.setType(CalculationType.SYSTEM_TYPE.getCode());
|
||||
}else {
|
||||
responsibilityData.setType(CalculationType.PW_TYPE.getCode());
|
||||
}
|
||||
//进行插入操作
|
||||
this.baseMapper.insert(responsibilityData);
|
||||
} else {
|
||||
@@ -1435,7 +1449,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(lineId);
|
||||
int lineInterval = lineDetailData.getTimeInterval();
|
||||
int userIntervalTime;
|
||||
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5) {
|
||||
if (lineInterval == INTERVAL_TIME_1 || lineInterval == INTERVAL_TIME_3 || lineInterval == INTERVAL_TIME_5 || lineInterval == INTERVAL_TIME_10) {
|
||||
userIntervalTime = INTERVAL_TIME_15;
|
||||
pNum = dateStr.size() * WINDOW_96;
|
||||
} else {
|
||||
@@ -1474,7 +1488,7 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
* 获取背景用户的下级用户及其数据
|
||||
*/
|
||||
|
||||
public List<UserDataExcel> test(List<String> userList, String startTime, String endTime){
|
||||
public List<UserDataExcel> sysMonitorDataGet(List<String> userList, String startTime, String endTime){
|
||||
List<UserDataExcel> userDataExcelList = new ArrayList<>();
|
||||
PHistoryHarmParam param = new PHistoryHarmParam();
|
||||
param.setSearchBeginTime(startTime);
|
||||
@@ -1485,7 +1499,9 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
||||
List<DataHarmPowerP> result = new ArrayList<>();
|
||||
collect.forEach((k,v)->{
|
||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(k);
|
||||
|
||||
if(v.stream().mapToDouble(DataHarmPowerP::getP).min().getAsDouble() < 0){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,lineDetailData.getLineName()+"功率数据异常");
|
||||
}
|
||||
//数据补全
|
||||
List<DataHarmPowerP> dataHarmPowerPList = linearInterpolate(startTime.concat(InfluxDBTableConstant.START_TIME), endTime.concat(InfluxDBTableConstant.END_TIME), lineDetailData.getTimeInterval()*60, v);
|
||||
//数据间隔转换成15分钟
|
||||
|
||||
Reference in New Issue
Block a user