高低电压穿越相关接口走算法模块
This commit is contained in:
@@ -3,8 +3,13 @@ package com.njcn.prepare.harmonic.api.event;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.api.event.fallback.SpThroughFeignClientFallbackFactory;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高低电压穿越Feign客户端
|
||||
@@ -20,4 +25,10 @@ public interface SpThroughFeignClient {
|
||||
|
||||
@PostMapping("/record")
|
||||
HttpResult<Boolean> record();
|
||||
|
||||
@PostMapping("/getDataByEventIds")
|
||||
HttpResult<SpThroughVO> getDataByEventIds(@RequestBody @Validated SpThroughParam spThroughParam);
|
||||
|
||||
@PostMapping("/formatEventIds")
|
||||
HttpResult<List<String>> formatEventIds(@RequestBody @Validated SpThroughParam spThroughParam);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,13 @@ 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.prepare.harmonic.api.event.SpThroughFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SpThroughVO;
|
||||
import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高低电压穿越熔断降级
|
||||
@@ -33,6 +36,18 @@ public class SpThroughFeignClientFallbackFactory implements FallbackFactory<SpTh
|
||||
log.error("{}异常,降级处理,异常为:{}", "高低电压穿越记录: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<SpThroughVO> getDataByEventIds(SpThroughParam spThroughParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据事件ID集合及能源站类型获取高低电压穿越次数: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> formatEventIds(SpThroughParam spThroughParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据原有的事件集合进行过滤: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.prepare.harmonic.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author guofeihu
|
||||
* @since 2024-08-14
|
||||
*/
|
||||
@Data
|
||||
public class SpThroughParam {
|
||||
|
||||
@ApiModelProperty(name = "eventIds",value = "事件ID集合")
|
||||
private List<String> eventIds;
|
||||
|
||||
@ApiModelProperty(name = "lineType",value = "监测点类别(1:风电场、2:光伏电站)")
|
||||
private String stationType;
|
||||
|
||||
public SpThroughParam(List<String> eventIds, String stationType) {
|
||||
this.eventIds = eventIds;
|
||||
this.stationType = stationType;
|
||||
}
|
||||
|
||||
public SpThroughParam() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author guofeihu
|
||||
* @since 2024-08-14
|
||||
*/
|
||||
@Data
|
||||
public class SpThroughVO {
|
||||
|
||||
@ApiModelProperty("低压次数")
|
||||
private String lowPressure;
|
||||
|
||||
@ApiModelProperty("高压次数")
|
||||
private String highPressure;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user