台账模块调整
This commit is contained in:
@@ -5,7 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.AlarmClient;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -4,7 +4,7 @@ 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.device.pq.api.DeptLineFeignClient;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.DeviceTreeClient;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalTree;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -8,9 +8,8 @@ import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.OnlineRate;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -4,16 +4,12 @@ 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.device.pq.api.PqsTerminalLogsClient;
|
||||
import com.njcn.device.pq.api.TerminalBaseClient;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.SubstationFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.TerminalBaseClient;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.device.pq.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.njcn.device.pq.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 终端枚举
|
||||
* @author cdf
|
||||
* @date 2021/6/21
|
||||
*/
|
||||
@Getter
|
||||
public enum DeviceResponseEnum {
|
||||
|
||||
/**
|
||||
* A0250 ~ A0349 用于终端模块的枚举
|
||||
*/
|
||||
DEVICE_COMMON_ERROR("A00349","终端模块异常"),
|
||||
|
||||
PROJECT_SAME_NAME("A0250","项目名称已存在"),
|
||||
PROJECT_NO("A0251","项目为空"),
|
||||
|
||||
PROVINCE_SAME_NAME("A0260","省份不可重复"),
|
||||
PROVINCE_GET_ERROR("A0261","未知区域"),
|
||||
PROVINCE_EMPTY("A0262","省份为空"),
|
||||
|
||||
GD_SAME_NAME("A0270","供电公司名称已存在"),
|
||||
GD_NO("A0271","未知供电公司"),
|
||||
GD_EMPTY("A0272","公司为空"),
|
||||
|
||||
SUB_SAME_NAME("A0280","变电站名称已存在"),
|
||||
SUB_NO("A0281","变电站为空"),
|
||||
|
||||
DEVICE_SAME_NAME("A0290","设备名称已存在"),
|
||||
DEVICE_REPETITION("A0291","设备名称重复"),
|
||||
DEVICE_IP_REPETITION("A0292","设备ip端口号重复"),
|
||||
DEVICE_SAME_IP("A0293","当前设备ip端口号已存在"),
|
||||
DEVICE_EMPTY("A0294","设备为空"),
|
||||
|
||||
NODE_SAME_NAME("A0259","前置机名称已存在"),
|
||||
NODE_IP_SAME("A0260","前置机ip已存在"),
|
||||
NODE_INFO_FAIL("A0261","前置机服务器为空"),
|
||||
|
||||
|
||||
SUBV_NAME_REPETITION("A0262","同一变电站下母线名称重复"),
|
||||
SUBV_NAME_SAME("A0263","母线名称已存在"),
|
||||
SUBV_NO("A0264","母线不存在"),
|
||||
|
||||
LINE_NAME_REPETITION("A0264","监测点名称重复"),
|
||||
LINE_NUM_USE("A0266","监测点序号已存在"),
|
||||
LINE_NUM_REPETITION("A0267","监测点序号重复"),
|
||||
LINE_NO("A0268","监测点不存在"),
|
||||
|
||||
DEVICE_LINE_BIG("A0268","每台装置下监测点数量最多6个"),
|
||||
|
||||
|
||||
DEVICE_UNKNOWN_ERROR("A0269","终端服务未知异常"),
|
||||
|
||||
PARENT_INDEX_LACK("A0270","索引和实体同时存在"),
|
||||
DEVICE_VOLTAGE_BIG("A0271","每台装置下母线数量最多6个"),
|
||||
VOLTAGE_NUM_USE("A0272","母线序号已存在"),
|
||||
REQUEST_DATA_ERROR("A2071","请求体格式有误"),
|
||||
DEPT_LINE_EMPTY("A2072","当前用户部门未有监测点绑定"),
|
||||
DIC_GET_EMPTY("A2073","字典获取为空"),
|
||||
|
||||
ALGORITHM_LINE_EMPTY("A00558","算法监测点数据为空"),
|
||||
ALGORITHM_FREP_RULE("A00559","该监测点频率数据异常"),
|
||||
ALGORITHM_RMS_RULE("A00560","该监测点相变压数据异常"),
|
||||
ALGORITHM_RMS_LVR_RULE("A00561","该监测点线变压数据异常"),
|
||||
ALGORITHM_V_THD_RULE("A00562","该监测点电压总谐波畸变率数据异常"),
|
||||
ALGORITHM_V_UNBALANCE_RULE("A00563","该监测点负序电压不平衡度数据异常"),
|
||||
ALGORITHM_DATA_ERROR("A00564","未获取到data数据"),
|
||||
|
||||
INVALID_LEVEL("A2074","非法拓扑等级"),
|
||||
LINE_EMPTY("A2075","监测点为空"),
|
||||
|
||||
/*excel相关*/
|
||||
Excel_ERROR("A2080","excel解析异常"),
|
||||
|
||||
FLOW_SAME_NAME("A0350","当前名称已存在"),
|
||||
FLOW_FLAG("A0351","默认类型已存在"),
|
||||
FLOW_ERROR("A0352","占比参数异常"),
|
||||
|
||||
IMPORT_ORACLE_EXCEPTION("A0353","导入旧库台账异常"),
|
||||
PARAM_VAL_ERR("A0354","参数校验异常"),
|
||||
QUERY_LINE_DATA_EMPTY("A0355","查询监测点数据为空"),
|
||||
QUERY_SUB_DATA_EMPTY("A0356","查询变电站数据为空"),
|
||||
QUERY_GD_DATA_EMPTY("A0357","查询供电公司数据为空"),
|
||||
QUERY_PROVINCE_DATA_EMPTY("A0358","查询区域数据为空"),
|
||||
QUERY_ALARMSTRATEGY_DATA_EMPTY("A0359","查询告警策略数据为空"),
|
||||
QUERY_DEVICELEVELANDID_DATA_EMPTY("A0360","查询终端等级和id数据为空"),
|
||||
QUERY_DEVICE_DATA_EMPTY("A0360","查询终端数据数据为空"),
|
||||
SAME_ALARM_STRATEGY("A0361","当前等级策略已存在"),
|
||||
LINE_GRADE_INDEX_ERR("A0362","异常等级索引"),
|
||||
LINE_GRADE_LESS("A0363","监测点等级策略缺失")
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
DeviceResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.njcn.device.pq.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.common.utils.EnumUtils;
|
||||
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月20日 10:03
|
||||
*/
|
||||
public class DeviceEnumUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 获取UserResponseEnum实例
|
||||
*/
|
||||
public static DeviceResponseEnum getDeviceEnumResponseEnumByMessage(@NotNull Object value) {
|
||||
DeviceResponseEnum deviceResponseEnum;
|
||||
try {
|
||||
String message = value.toString();
|
||||
if(message.indexOf(StrUtil.C_COMMA)>0){
|
||||
value = message.substring(message.indexOf(StrUtil.C_COMMA)+1);
|
||||
}
|
||||
deviceResponseEnum = EnumUtils.valueOf(DeviceResponseEnum.class, value, DeviceResponseEnum.class.getMethod(BusinessException.GET_MESSAGE_METHOD));
|
||||
return Objects.isNull(deviceResponseEnum) ? DeviceResponseEnum.DEVICE_COMMON_ERROR : deviceResponseEnum;
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new BusinessException(CommonResponseEnum.INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
public static Enum<?> getExceptionEnum(HttpResult<Object> result){
|
||||
//如果返回错误,且为内部错误,则直接抛出异常
|
||||
CommonResponseEnum commonResponseEnum = EnumUtils.getCommonResponseEnumByCode(result.getCode());
|
||||
if (commonResponseEnum == CommonResponseEnum.DEVICE_RESPONSE_ENUM) {
|
||||
return getDeviceEnumResponseEnumByMessage(result.getMessage());
|
||||
}
|
||||
return commonResponseEnum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user