4 changed files with 34 additions and 67 deletions
			
			
		@ -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<CustomerAgencyDTO> getAgencyByStaff(@PathVariable("staffId") String staffId); | 
				
			|||
} | 
				
			|||
@ -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<CustomerAgencyDTO> getAgencyById(@PathVariable("agencyId") String agencyId); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 根据staffId查询所属的组织机构 | 
				
			|||
     *  | 
				
			|||
     * @param staffId | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    @PostMapping("/gov/org/agency/agencybystaff/{staffId}") | 
				
			|||
    Result<CustomerAgencyDTO> getAgencyByStaff(@PathVariable("staffId") String staffId); | 
				
			|||
} | 
				
			|||
 | 
				
			|||
@ -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<CustomerAgencyDTO> getAgencyByStaff(String staffId) { | 
				
			|||
        return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyByStaff", staffId); | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue