diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgFeignClient.java deleted file mode 100644 index 1b23a85ec8..0000000000 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ /dev/null @@ -1,34 +0,0 @@ -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.dto.form.LatestGridFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.dto.result.MineResultDTO; -import com.epmet.feign.fallback.GovOrgFeignClientFallBack; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - -/** - * @Description url = "localhost:8092" - * @Author sun - */ -@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) -public interface GovOrgFeignClient { - - /** - * 根据staffId查询所属的组织机构 - * @param staffId - * @return - */ - @PostMapping("/gov/org/agency/agencybystaff/{staffId}") - Result getAgencyByStaff(@PathVariable("staffId") String staffId); -} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 88df475dac..a780ef8896 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -1,23 +1,40 @@ 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") +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback; + +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/4 13:37 + */ +// @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 getAgencyById(@PathVariable("agencyId") String agencyId); + /** + * 根据staffId查询所属的组织机构 + * + * @param staffId + * @return + */ + @PostMapping("/gov/org/agency/agencybystaff/{staffId}") + Result getAgencyByStaff(@PathVariable("staffId") String staffId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java deleted file mode 100644 index 8b0cb47059..0000000000 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.epmet.feign.fallback; - -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.dto.form.LatestGridFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.dto.result.MineResultDTO; -import com.epmet.feign.GovOrgFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @Description - * @Author sun - */ -@Component -public class GovOrgFeignClientFallBack implements GovOrgFeignClient { - @Override - public Result getAgencyByStaff(String staffId) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); - } -} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java similarity index 60% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 03c5cf8712..262b037206 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/callback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -1,4 +1,4 @@ -package com.epmet.feign.callback; +package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; @@ -7,10 +7,21 @@ import com.epmet.dto.CustomerAgencyDTO; import com.epmet.feign.GovOrgOpenFeignClient; import org.springframework.stereotype.Component; +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @author yinzuomei@elink-cn.com + * @date 2020/6/4 13:37 + */ @Component public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { @Override public Result getAgencyById(String agencyId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getAgencyById", agencyId); } + + @Override + public Result getAgencyByStaff(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); + } }