用能空调定时关机策略

This commit is contained in:
2024-07-25 13:35:39 +08:00
parent 0fe103d01e
commit 61bbbed153
7 changed files with 51 additions and 41 deletions

View File

@@ -2,6 +2,7 @@ package com.njcn.energy.pojo.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.energy.pojo.api.fallback.EleAirStrategyFallbackFactory;
import com.njcn.energy.pojo.api.fallback.EleOnlineRateFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@@ -14,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author cdf
* @date 2022/4/22
*/
@FeignClient(value = ServerInfo.ENERGY,path = "/air",fallbackFactory = EleOnlineRateFallbackFactory.class)
@FeignClient(value = ServerInfo.ENERGY,path = "/air",fallbackFactory = EleAirStrategyFallbackFactory.class)
public interface EleAirStrategyFeignClient {
/**
@@ -23,6 +24,6 @@ public interface EleAirStrategyFeignClient {
* @date 2022/4/22
*/
@GetMapping("dealAirStrategyId")
HttpResult<Boolean> dealAirStrategyId(@RequestParam("id") String id,@RequestParam("operation") String operation);
HttpResult<Boolean> dealAirStrategyId(@RequestParam("operation") String operation);
}

View File

@@ -33,7 +33,7 @@ public class EleAirStrategyFallbackFactory implements FallbackFactory<EleAirStra
Enum<?> finalExceptionEnum = exceptionEnum;
return new EleAirStrategyFeignClient() {
@Override
public HttpResult<Boolean> dealAirStrategyId(String id,String operation) {
public HttpResult<Boolean> dealAirStrategyId(String operation) {
log.error("{}异常,降级处理,异常为:{}","空调控制策略数据",cause.toString());
throw new BusinessException(finalExceptionEnum);
}