1.解决变电站数量不统一问题
2.替换最新污染值 3.解决终端数量不一致问题
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package com.njcn.harmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(
|
||||
value = ServerInfo.HARMONIC,
|
||||
path = "/PollutionSubstation",
|
||||
fallbackFactory = RStatLimitRateDFeignClientFallbackFactory.class,
|
||||
contextId = "PollutionSubstation")
|
||||
public interface PollutionSubstationClient {
|
||||
|
||||
@PostMapping(value ="/getSumList")
|
||||
HttpResult<Map<String, UserLinePollution>> getSumList(@RequestBody OnlineRateParam.Info param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.harmonic.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.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.harmonic.api.PollutionSubstationClient;
|
||||
import com.njcn.harmonic.pojo.excel.pollution.UserLinePollution;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月21日 14:31
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PollutionSubstationClientFactory implements FallbackFactory<PollutionSubstationClient> {
|
||||
@Override
|
||||
public PollutionSubstationClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PollutionSubstationClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<Map<String, UserLinePollution>> getSumList(OnlineRateParam.Info param) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "国网上送-典型源荷指标统计数据", throwable.toString());
|
||||
return new HttpResult<>(CommonResponseEnum.FAIL.getCode(),CommonResponseEnum.FAIL.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,8 @@ public class LinePollution implements Serializable {
|
||||
@ApiModelProperty("变电站")
|
||||
private String subStationName;
|
||||
|
||||
private String subStationId;
|
||||
|
||||
/**
|
||||
* 终端名称
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.harmonic.pojo.excel.pollution;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2025/12/9 21:12
|
||||
*/
|
||||
@Data
|
||||
public class UserLinePollution {
|
||||
|
||||
private String lineId;
|
||||
private Double vHarmonicValue;
|
||||
private List<User> userList;
|
||||
|
||||
@Data
|
||||
public static class User{
|
||||
private String id;
|
||||
private String projectName;
|
||||
private String stationId;
|
||||
private String lineId;
|
||||
private String city;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user