refactor(data-process): 重构数据处理服务依赖注入和数据获取逻辑
- 将 PqReasonableRangeFeignClient 替换为 IPqReasonableRangeService 接口 - 统一使用本地服务接口替代远程调用,优化性能 - 移除废弃的 WlMinuteData 方法和相关设备线路查询逻辑 - 标准化时间相关的导入包,只保留必要的类 - 清理未使用的资源注入和函数式编程相关导入 - 简化数据获取流程,统一使用 getMinuteData 方法
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
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.PqReasonableRangeFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @version 1.0.0
|
||||
* @date 2025年02月13日 20:11
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/pqReasonableRange", fallbackFactory = PqReasonableRangeFeignClientFallbackFactory.class, contextId = "pqReasonableRange")
|
||||
public interface PqReasonableRangeFeignClient {
|
||||
|
||||
@PostMapping("/getData")
|
||||
@ApiOperation("按条件获取数据合理范围")
|
||||
HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param);
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
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.PqReasonableRangeFeignClient;
|
||||
import com.njcn.dataProcess.param.DataCleanParam;
|
||||
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @version 1.0.0
|
||||
* @date 2025年02月13日 20:13
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqReasonableRangeFeignClientFallbackFactory implements FallbackFactory<PqReasonableRangeFeignClient> {
|
||||
|
||||
/**
|
||||
* 输出远程请求接口异常日志
|
||||
* @param cause RPC请求异常
|
||||
*/
|
||||
@Override
|
||||
public PqReasonableRangeFeignClient 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 PqReasonableRangeFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<PqReasonableRangeDto>> getData(DataCleanParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","按条件获取数据合理范围",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -196,5 +196,8 @@ public interface InfluxDBTableConstant {
|
||||
String NORMAL = "0";
|
||||
String UN_NORMAL = "1";
|
||||
|
||||
|
||||
/**
|
||||
* 数据清洗标志 0:正常 1:异常
|
||||
*/
|
||||
String ABNORMAL_FLAG = "abnormal_flag";
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.njcn.dataProcess.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class PqReasonableRangeDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 指标code
|
||||
*/
|
||||
private String indexCode;
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String indexName;
|
||||
|
||||
/**
|
||||
* 指标开始
|
||||
*/
|
||||
private Integer harmStart;
|
||||
|
||||
/**
|
||||
* 指标结束
|
||||
*/
|
||||
private Integer harmEnd;
|
||||
|
||||
/**
|
||||
* 指标所属项别
|
||||
*/
|
||||
private String phaseType;
|
||||
|
||||
/**
|
||||
* 指标所属influxdb表的实体类
|
||||
*/
|
||||
private String influxdbTableName;
|
||||
|
||||
/**
|
||||
* 指标所属类的属性
|
||||
*/
|
||||
private String influxdbColumnName;
|
||||
|
||||
/**
|
||||
* 指标下限
|
||||
*/
|
||||
private Double minValue;
|
||||
|
||||
/**
|
||||
* 指标上限
|
||||
*/
|
||||
private Double maxValue;
|
||||
|
||||
/**
|
||||
* 电压等级是否参与计算(0:不参与1:参与)
|
||||
*/
|
||||
private Integer isVoltage;
|
||||
|
||||
/**
|
||||
* Ct变比是否参与计算
|
||||
*/
|
||||
private Integer ctAttendFlag;
|
||||
|
||||
/**
|
||||
* 指标数据源(influxdb,oralce,mysql)
|
||||
*/
|
||||
private String dataSource;
|
||||
|
||||
/**
|
||||
* 无具体范围,判断的条件描述
|
||||
*/
|
||||
private String otherAlgorithm;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 所属系统(pqs,govern)目前就这个两个系统
|
||||
*/
|
||||
private String belongingSystem;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
package com.njcn.dataProcess.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pq_reasonable_range")
|
||||
public class PqReasonableRange extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 指标code
|
||||
*/
|
||||
private String indexCode;
|
||||
|
||||
/**
|
||||
* 指标名称
|
||||
*/
|
||||
private String indexName;
|
||||
|
||||
/**
|
||||
* 指标开始
|
||||
*/
|
||||
private Integer harmStart;
|
||||
|
||||
/**
|
||||
* 指标结束
|
||||
*/
|
||||
private Integer harmEnd;
|
||||
|
||||
/**
|
||||
* 指标所属项别
|
||||
*/
|
||||
private String phaseType;
|
||||
|
||||
/**
|
||||
* 指标所属influxdb表的实体类
|
||||
*/
|
||||
private String influxdbTableName;
|
||||
|
||||
/**
|
||||
* 指标所属类的属性
|
||||
*/
|
||||
private String influxdbColumnName;
|
||||
|
||||
/**
|
||||
* 指标下限
|
||||
*/
|
||||
private Double minValue;
|
||||
|
||||
/**
|
||||
* 指标上限
|
||||
*/
|
||||
private Double maxValue;
|
||||
|
||||
/**
|
||||
* 电压等级是否参与计算(0:不参与1:参与)
|
||||
*/
|
||||
private Integer isVoltage;
|
||||
|
||||
/**
|
||||
* Ct变比是否参与计算
|
||||
*/
|
||||
private Integer ctAttendFlag;
|
||||
|
||||
/**
|
||||
* 指标数据源(influxdb,oralce,mysql)
|
||||
*/
|
||||
private String dataSource;
|
||||
|
||||
/**
|
||||
* 无具体范围,判断的条件描述
|
||||
*/
|
||||
private String otherAlgorithm;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 所属系统(pqs,govern)目前就这个两个系统
|
||||
*/
|
||||
private String belongingSystem;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user