数据完整性部分代码提交
This commit is contained in:
@@ -30,4 +30,7 @@ public interface DataHarmRateVFeignClient {
|
||||
@PostMapping("/getTopData")
|
||||
HttpResult<DataHarmDto> getTopData();
|
||||
|
||||
@PostMapping("/getHarmRateVData")
|
||||
HttpResult<List<DataHarmDto>> getHarmRateVData(@RequestBody LineCountEvaluateParam lineParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.dataProcess.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.fallback.DataOnlineRateFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataOnlineRateDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatIntegrityD;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 9:30
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataIntegrity", fallbackFactory = DataIntegrityFeignClient.class, contextId = "dataIntegrity")
|
||||
public interface DataIntegrityFeignClient {
|
||||
|
||||
@PostMapping("/batchInsertion")
|
||||
HttpResult<String> batchInsertion(@RequestBody List<RStatIntegrityD> dataList);
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.fallback.DataVFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.dto.DataVDTO;
|
||||
import com.njcn.dataProcess.dto.MeasurementCountDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVCvtDto;
|
||||
@@ -53,4 +54,10 @@ public interface DataVFeignClient {
|
||||
@PostMapping("/batchInsertionCvtDTO")
|
||||
HttpResult<String> batchInsertionCvtDTO(@RequestBody List<DataVCvtDto> cvtDTOList);
|
||||
|
||||
@PostMapping("/getMeasurementCount")
|
||||
HttpResult<List<MeasurementCountDTO>> getMeasurementCount(@RequestParam("lineIndex")List<String> lineIndex, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime);
|
||||
|
||||
//获取原始数据
|
||||
@PostMapping("/getDataV")
|
||||
HttpResult<List<DataVDto>> getDataV(@RequestBody LineCountEvaluateParam lineParam);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ public class DataHarmRateVFeignClientFallbackFactory implements FallbackFactory<
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DataHarmDto>> getHarmRateVData(LineCountEvaluateParam lineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取谐波含有率数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.dataProcess.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.DataIntegrityFeignClient;
|
||||
import com.njcn.dataProcess.api.DataOnlineRateFeignClient;
|
||||
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataOnlineRateDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 9:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DataIntegrityFeignClientFallbackFactory implements FallbackFactory<DataIntegrityFeignClient> {
|
||||
|
||||
|
||||
/**
|
||||
* 输出远程请求接口异常日志
|
||||
* @param cause RPC请求异常
|
||||
*/
|
||||
@Override
|
||||
public DataIntegrityFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if(cause.getCause() instanceof BusinessException){
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DataIntegrityFeignClient() {
|
||||
@Override
|
||||
public HttpResult<String> batchInsertion(List<RStatIntegrityD> dataList) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量插入数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.DataVFeignClient;
|
||||
import com.njcn.dataProcess.dto.DataVDTO;
|
||||
import com.njcn.dataProcess.dto.MeasurementCountDTO;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataVCvtDto;
|
||||
@@ -13,6 +14,8 @@ import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@@ -89,6 +92,18 @@ public class DataVFeignClientFallbackFactory implements FallbackFactory<DataVFei
|
||||
log.error("{}异常,降级处理,异常为:{}","cvt数据插入DataV",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<MeasurementCountDTO>> getMeasurementCount(List<String> lineIndex,String startTime,String endTime){
|
||||
log.error("{}异常,降级处理,异常为:{}","cvt数据插入DataV",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DataVDto>> getDataV(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","cvt数据插入DataV",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.dataProcess.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-03-12
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@Measurement(name = "data_v")
|
||||
public class MeasurementCountDTO {
|
||||
|
||||
@Column(name = "time")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "freq")
|
||||
private String freq;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.njcn.dataProcess.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-03-12
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class PollutionDTO {
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 频率偏差污染值
|
||||
*/
|
||||
private Double freqDev = 0.0;
|
||||
|
||||
/**
|
||||
* 电压偏差污染值
|
||||
*/
|
||||
private Double vDev = 0.0;
|
||||
|
||||
/**
|
||||
* 三相电压不平衡度污染值
|
||||
*/
|
||||
private Double vUnbalance = 0.0;
|
||||
|
||||
/**
|
||||
* 谐波电压污染值
|
||||
*/
|
||||
private Double vAll = 0.0;
|
||||
|
||||
/**
|
||||
* 长时电压闪变污染值
|
||||
*/
|
||||
private Double plt = 0.0;
|
||||
|
||||
/**
|
||||
* 谐波电流污染值
|
||||
*/
|
||||
private Double iAll = 0.0;
|
||||
|
||||
/**
|
||||
* 负序电流污染值
|
||||
*/
|
||||
private Double iNeg = 0.0;
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率污染值
|
||||
*/
|
||||
private Double vInharm = 0.0;
|
||||
|
||||
/**
|
||||
* 谐波电压含有率污染值
|
||||
*/
|
||||
private Double vHarmonic = 0.0;
|
||||
|
||||
|
||||
}
|
||||
@@ -30,6 +30,11 @@ public class LineCountEvaluateParam extends BaseParam implements Serializable {
|
||||
*/
|
||||
private List<String> phasicType;
|
||||
|
||||
/**
|
||||
* 值类型
|
||||
*/
|
||||
private List<String> valueType;
|
||||
|
||||
/**
|
||||
* 异常数据时间集合
|
||||
* Map<String,List<String>> key:监测点id value:异常时间集合
|
||||
|
||||
@@ -29,7 +29,7 @@ public class RStatIntegrityD {
|
||||
|
||||
@MppMultiId
|
||||
@TableField(value = "time_id")
|
||||
private String timeId;
|
||||
private LocalDate timeId;
|
||||
|
||||
@MppMultiId
|
||||
@TableField(value = "line_index")
|
||||
|
||||
Reference in New Issue
Block a user