9 changed files with 82 additions and 34 deletions
			
			
		@ -1,17 +1,17 @@ | 
				
			|||||
package com.epmet.feign; | 
					package com.epmet.dataaggre.feign; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
import com.epmet.commons.tools.constant.ServiceConstant; | 
					import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			||||
import com.epmet.commons.tools.utils.Result; | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
					import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
				
			||||
import com.epmet.feign.impl.DataAggregatorFeignClientClientFallBackFactory; | 
					import com.epmet.dataaggre.feign.impl.DataAggregatorOpenFeignClientFallbackFactory; | 
				
			||||
import org.springframework.cloud.openfeign.FeignClient; | 
					import org.springframework.cloud.openfeign.FeignClient; | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
					import org.springframework.web.bind.annotation.PostMapping; | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
					import org.springframework.web.bind.annotation.RequestBody; | 
				
			||||
 | 
					
 | 
				
			||||
@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback = DataAggregatorFeignClientClientFallBackFactory.class) | 
					@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = DataAggregatorOpenFeignClientFallbackFactory.class) | 
				
			||||
// @FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallback= DataAggregatorFeignClientClientFallBackFactory.class,url = "localhost:8114")
 | 
					// @FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory= DataAggregatorOpenFeignClientFallbackFactory.class,url = "localhost:8114")
 | 
				
			||||
public interface DataAggregatorFeignClient { | 
					public interface DataAggregatorOpenFeignClient { | 
				
			||||
 | 
					
 | 
				
			||||
    /** | 
					    /** | 
				
			||||
     * 定时任务导出网格活跃统计表 | 
					     * 定时任务导出网格活跃统计表 | 
				
			||||
@ -1,16 +1,12 @@ | 
				
			|||||
package com.epmet.feign.impl; | 
					package com.epmet.dataaggre.feign.impl; | 
				
			||||
 | 
					 | 
				
			||||
 | 
					
 | 
				
			||||
import com.epmet.commons.tools.constant.ServiceConstant; | 
					import com.epmet.commons.tools.constant.ServiceConstant; | 
				
			||||
import com.epmet.commons.tools.utils.ModuleUtils; | 
					import com.epmet.commons.tools.utils.ModuleUtils; | 
				
			||||
import com.epmet.commons.tools.utils.Result; | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
					import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
				
			||||
import com.epmet.feign.DataAggregatorFeignClient; | 
					import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; | 
				
			||||
import org.springframework.stereotype.Component; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
@Component | 
					 | 
				
			||||
public class DataAggregatorFeignClientClientFallBackFactory implements DataAggregatorFeignClient { | 
					 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					public class DataAggregatorOpenFeignClientFallback implements DataAggregatorOpenFeignClient { | 
				
			||||
    /** | 
					    /** | 
				
			||||
     * 定时任务导出网格活跃统计表 | 
					     * 定时任务导出网格活跃统计表 | 
				
			||||
     * @param form | 
					     * @param form | 
				
			||||
@ -0,0 +1,17 @@ | 
				
			|||||
 | 
					package com.epmet.dataaggre.feign.impl; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; | 
				
			||||
 | 
					import feign.hystrix.FallbackFactory; | 
				
			||||
 | 
					import lombok.extern.slf4j.Slf4j; | 
				
			||||
 | 
					import org.springframework.stereotype.Component; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@Slf4j | 
				
			||||
 | 
					@Component | 
				
			||||
 | 
					public class DataAggregatorOpenFeignClientFallbackFactory implements FallbackFactory<DataAggregatorOpenFeignClient> { | 
				
			||||
 | 
					    private DataAggregatorOpenFeignClientFallback fallback = new DataAggregatorOpenFeignClientFallback(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public DataAggregatorOpenFeignClient create(Throwable throwable) { | 
				
			||||
 | 
					        return null; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue