2 changed files with 39 additions and 0 deletions
@ -0,0 +1,23 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.feign.callback.GovOrgOpenFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
//@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class, url = "localhost:8092")
|
|||
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgOpenFeignClientFallback.class) |
|||
public interface GovOrgOpenFeignClient { |
|||
|
|||
/** |
|||
* 根据Id查询agency |
|||
* @param agencyId |
|||
* @return |
|||
*/ |
|||
@PostMapping("/gov/org/agency/agencybyid/{agencyId}") |
|||
Result<CustomerAgencyDTO> getAgencyById(@PathVariable("agencyId") String agencyId); |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.feign.callback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { |
|||
@Override |
|||
public Result<CustomerAgencyDTO> getAgencyById(String agencyId) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getAgencyById", agencyId); |
|||
} |
|||
} |
Loading…
Reference in new issue