feat(device): 1、开发监测点治理报告上传和下载接口,与前端联调;2、开发监测对象电网侧和负载侧监测点指标趋势对比数据查询接口
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/pqSensitiveUser", fallbackFactory = EventUserFeignClientFallbackFactory.class,contextId = "pqSensitiveUser")
|
||||
public interface PqSensitiveUserFeignClient {
|
||||
|
||||
@PostMapping("/getListByIds")
|
||||
HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.csharmonic.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.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqSensitiveUserFeignClientFallbackFactory implements FallbackFactory<PqSensitiveUserFeignClient> {
|
||||
|
||||
@Override
|
||||
public PqSensitiveUserFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqSensitiveUserFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id集合获取敏感负荷用户列表",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SensitiveUserTrendDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "检测对象ID")
|
||||
@NotBlank(message = "检测对象ID不可为空")
|
||||
private String sensitiveUserId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(value = "用于选择多个指标及谐波次数")
|
||||
List<SensitiveUserTrendDataQueryParam> list;
|
||||
@ApiModelProperty(value = "指标组id")
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "取值类型(Max,Min,cp95,avg)")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty(value = "一次值:Primary;二次值:Secondary")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private String frequency;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user