1.添加pms国网上送定时接口
2.处理上送国网bug
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.njcn.device.pms.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pms.api.fallback.GwMonitorPushClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/12/22
|
||||
*/
|
||||
|
||||
@FeignClient(value = ServerInfo.DEVICE,
|
||||
path = "gwTerminalPush",
|
||||
contextId = "gwTerminalPush",
|
||||
fallbackFactory = GwMonitorPushClientFallbackFactory.class)
|
||||
public interface GwMonitorPushFeignClient {
|
||||
|
||||
/**
|
||||
* 定时推送国网监测点
|
||||
* @author cdf
|
||||
* @date 2023/12/22
|
||||
*/
|
||||
@PostMapping("/pushMonitor")
|
||||
HttpResult<String> timeTaskPushMonitor(@RequestBody List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 定时推送国网监测点
|
||||
* @author cdf
|
||||
* @date 2023/12/22
|
||||
*/
|
||||
@PostMapping("/pushMonitorOverLimit")
|
||||
HttpResult<Object> pushMonitorOverLimit(@RequestBody List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.device.pms.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.pms.api.GwMonitorPushFeignClient;
|
||||
import com.njcn.device.pms.utils.PmsDeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yzh
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GwMonitorPushClientFallbackFactory implements FallbackFactory<GwMonitorPushFeignClient> {
|
||||
|
||||
@Override
|
||||
public GwMonitorPushFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = PmsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new GwMonitorPushFeignClient() {
|
||||
@Override
|
||||
public HttpResult<String> timeTaskPushMonitor(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}", LocalDate.now()+"定时推送主网监测点", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Object> pushMonitorOverLimit(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}", LocalDate.now()+"定时推送主网监测点限值", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -242,6 +242,11 @@ public class MonitorParam {
|
||||
@ApiModelProperty(value = "行业分类")
|
||||
private String tradeCode;
|
||||
|
||||
/**
|
||||
* 牵引站id
|
||||
*/
|
||||
private String tractionId;
|
||||
|
||||
@Data
|
||||
public static class Info implements Serializable {
|
||||
@ApiModelProperty(name = "monitorTag",value = "监测点对象标签")
|
||||
|
||||
Reference in New Issue
Block a user