微调
This commit is contained in:
@@ -9,6 +9,7 @@ import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||
import com.njcn.algorithm.pojo.bo.HourParam;
|
||||
import com.njcn.algorithm.pojo.enums.PrepareResponseEnum;
|
||||
import com.njcn.algorithm.utils.MemorySizeUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -91,20 +92,7 @@ public class ExecutionCenter extends BaseController {
|
||||
* @date 2023/11/7 14:44
|
||||
*/
|
||||
private void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse, String methodDescribe) {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
// 获取 JVM 最大可用内存(以字节为单位)
|
||||
long maxMemory = runtime.maxMemory();
|
||||
// 获取 JVM 当前已分配的内存(以字节为单位)
|
||||
long totalMemory = runtime.totalMemory();
|
||||
// 获取 JVM 当前空闲内存(以字节为单位)
|
||||
long freeMemory = runtime.freeMemory();
|
||||
// 计算已使用的内存
|
||||
long usedMemory = totalMemory - freeMemory;
|
||||
|
||||
System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
||||
MemorySizeUtil.getNowMemory();
|
||||
if (liteflowResponse.isSuccess()) {
|
||||
// 获取执行步骤列表
|
||||
long allTime = 0;
|
||||
|
||||
@@ -71,21 +71,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
||||
|
||||
@Override
|
||||
public void dataVCleanHandler(CalculatedParam calculatedParam) {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
// 获取 JVM 最大可用内存(以字节为单位)
|
||||
long maxMemory = runtime.maxMemory();
|
||||
// 获取 JVM 当前已分配的内存(以字节为单位)
|
||||
long totalMemory = runtime.totalMemory();
|
||||
// 获取 JVM 当前空闲内存(以字节为单位)
|
||||
long freeMemory = runtime.freeMemory();
|
||||
// 计算已使用的内存
|
||||
long usedMemory = totalMemory - freeMemory;
|
||||
|
||||
System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("第一次分析结束-----------------------------------------");
|
||||
MemorySizeUtil.getNowMemory();
|
||||
|
||||
|
||||
logger.info("{},dataV表异常数据算法执行=====》", LocalDateTime.now());
|
||||
|
||||
@@ -9,6 +9,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||
import com.njcn.algorithm.service.line.IDataCrossingService;
|
||||
import com.njcn.algorithm.utils.MemorySizeUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.dataProcess.api.*;
|
||||
import com.njcn.dataProcess.constant.PhaseType;
|
||||
@@ -80,6 +81,7 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
||||
|
||||
@Override
|
||||
public void limitRateHandler(CalculatedParam calculatedParam) {
|
||||
MemorySizeUtil.getNowMemory();
|
||||
logger.info("{},limitRate表转r_stat_limit_rate_d算法开始=====》", LocalDateTime.now());
|
||||
List<DataLimitDetailDto> result = new ArrayList<>();
|
||||
//远程接口获取分钟数据
|
||||
@@ -95,6 +97,7 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
||||
//以100个监测点分片处理
|
||||
List<List<String>> pendingIds = ListUtils.partition(lineIds, NUM);
|
||||
ArrayList<String> phase = ListUtil.toList(PhaseType.PHASE_A, PhaseType.PHASE_B, PhaseType.PHASE_C);
|
||||
MemorySizeUtil.getNowMemory();
|
||||
pendingIds.forEach(list -> {
|
||||
lineParam.setLineId(list);
|
||||
//获取电压数据
|
||||
@@ -107,7 +110,6 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
||||
List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(lineParam).getData();
|
||||
//电流数据
|
||||
List<DataIDto> dataIList = dataIFeignClient.getRawData(lineParam).getData();
|
||||
|
||||
/**
|
||||
* 功能描述:获取influxDB -> data_v ->
|
||||
* 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
|
||||
@@ -122,7 +124,7 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
||||
* 闪变总计算次数(用data_plt中phasic_type=A,quality_flag=0来参与统计)
|
||||
*/
|
||||
Map<String, List<DataPltDto>> flickerAllTime = dataFlickerAllTime.stream()
|
||||
.filter(x -> PhaseType.PHASE_A.equals(x.getValueType()))
|
||||
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
||||
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
||||
|
||||
/**
|
||||
@@ -218,7 +220,7 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MemorySizeUtil.getNowMemory();
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
//存储数据
|
||||
List<DataLimitRateDto> dataLimitRate = result.stream().map(DataLimitDetailDto::getDataLimitRate).filter(x -> ObjectUtil.isNotNull(x)).collect(Collectors.toList());
|
||||
|
||||
@@ -158,9 +158,6 @@ public class PollutionServiceImpl implements IPollutionService {
|
||||
if (ObjectUtil.isNotNull(dto.getUnitId())) {
|
||||
lineParam.setLineId(Arrays.asList(dto.getUnitId()));
|
||||
List<DataPollutionOrgD> data = dataPollutionFeignClient.getRawDataOrgD(lineParam).getData();
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
System.out.println(data);
|
||||
}
|
||||
Map<String, List<DataPollutionOrgD>> pollutionMap = data.stream().collect(Collectors.groupingBy(DataPollutionOrgD::getPollutionType));
|
||||
pollutionMap.forEach((key, value) -> {
|
||||
DataPollutionOrgM orgD = new DataPollutionOrgM();
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.apache.commons.lang.SerializationUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.instrument.Instrumentation;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,4 +20,22 @@ public class MemorySizeUtil {
|
||||
return (double)serialized.length/1024/1024;
|
||||
}
|
||||
|
||||
|
||||
public static void getNowMemory(){
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
// 获取 JVM 最大可用内存(以字节为单位)
|
||||
long maxMemory = runtime.maxMemory();
|
||||
// 获取 JVM 当前已分配的内存(以字节为单位)
|
||||
long totalMemory = runtime.totalMemory();
|
||||
// 获取 JVM 当前空闲内存(以字节为单位)
|
||||
long freeMemory = runtime.freeMemory();
|
||||
// 计算已使用的内存
|
||||
long usedMemory = totalMemory - freeMemory;
|
||||
System.out.println("--------------------------华丽的分隔符--------------------------------------------------------------"+ LocalDateTime.now());
|
||||
System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB");
|
||||
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user