forked from rongchao/epmet-cloud-rizhao
				
			
				 7 changed files with 20 additions and 140 deletions
			
			
		@ -1,23 +0,0 @@ | 
				
			|||||
package com.epmet.feign; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
import com.epmet.commons.tools.constant.ServiceConstant; | 
					 | 
				
			||||
import com.epmet.commons.tools.utils.Result; | 
					 | 
				
			||||
import com.epmet.dto.form.LoginUserDetailsFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.LoginUserDetailsResultDTO; | 
					 | 
				
			||||
import com.epmet.feign.fallback.EpmetUserClientFeignClientFallback; | 
					 | 
				
			||||
import org.springframework.cloud.openfeign.FeignClient; | 
					 | 
				
			||||
import org.springframework.web.bind.annotation.PostMapping; | 
					 | 
				
			||||
import org.springframework.web.bind.annotation.RequestBody; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserClientFeignClientFallback.class) | 
					 | 
				
			||||
//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserClientFeignClientFallback.class, url = "localhost:8087")
 | 
					 | 
				
			||||
public interface EpmetUserClientFeignClient { | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    /** | 
					 | 
				
			||||
     * 从缓存中查询已登录用户的基本信息以及角色等相关信息 | 
					 | 
				
			||||
     * @return | 
					 | 
				
			||||
     */ | 
					 | 
				
			||||
    @PostMapping("/epmetuser/user/loginuserdetails") | 
					 | 
				
			||||
    Result<LoginUserDetailsResultDTO> getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
} | 
					 | 
				
			||||
@ -1,55 +0,0 @@ | 
				
			|||||
package com.epmet.feign; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
import com.epmet.commons.tools.constant.ServiceConstant; | 
					 | 
				
			||||
import com.epmet.commons.tools.utils.Result; | 
					 | 
				
			||||
import com.epmet.dto.CustomerStaffDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.CustomerStaffRoleListFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.LoginUserDetailsFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.TagCustomerFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.CustomerStaffRoleListResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.CustomerStaffRoleResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.LoginUserDetailsResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.TagCustomerResultDTO; | 
					 | 
				
			||||
import com.epmet.feign.fallback.EpmetUserSelfFeignClientFallBack; | 
					 | 
				
			||||
import org.springframework.cloud.openfeign.FeignClient; | 
					 | 
				
			||||
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; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
/** | 
					 | 
				
			||||
 * @author sun | 
					 | 
				
			||||
 * @dscription epmet-user服务 | 
					 | 
				
			||||
 */ | 
					 | 
				
			||||
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserSelfFeignClientFallBack.class) | 
					 | 
				
			||||
public interface EpmetUserSelfFeignClient { | 
					 | 
				
			||||
 | 
					 | 
				
			||||
	/** | 
					 | 
				
			||||
	 * 从缓存中查询已登录用户的基本信息以及角色等相关信息 | 
					 | 
				
			||||
	 * | 
					 | 
				
			||||
	 * @return | 
					 | 
				
			||||
	 */ | 
					 | 
				
			||||
	@PostMapping("/epmetuser/user/loginuserdetails") | 
					 | 
				
			||||
	Result<LoginUserDetailsResultDTO> getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
	/** | 
					 | 
				
			||||
	 * @param formDTO | 
					 | 
				
			||||
	 * @Description 根据userId获取customerId | 
					 | 
				
			||||
	 * @author zxc | 
					 | 
				
			||||
	 */ | 
					 | 
				
			||||
	@PostMapping("/epmetuser/user/getcustomeridbyuserid") | 
					 | 
				
			||||
	Result<TagCustomerResultDTO> getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
	/** | 
					 | 
				
			||||
	 * 根据staffId查询人员拥有的所有角色信息 | 
					 | 
				
			||||
	 * | 
					 | 
				
			||||
	 * @param staffId | 
					 | 
				
			||||
	 * @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.CustomerStaffRoleResultDTO>> | 
					 | 
				
			||||
	 * @author zhaoqifeng | 
					 | 
				
			||||
	 * @date 2020/6/2 16:11 | 
					 | 
				
			||||
	 */ | 
					 | 
				
			||||
	@PostMapping("/epmetuser/staffrole/staffroles/{staffId}") | 
					 | 
				
			||||
	Result<List<CustomerStaffRoleResultDTO>> getStaffRoles(@PathVariable String staffId); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
} | 
					 | 
				
			||||
@ -1,18 +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.form.LoginUserDetailsFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.LoginUserDetailsResultDTO; | 
					 | 
				
			||||
import com.epmet.feign.EpmetUserClientFeignClient; | 
					 | 
				
			||||
import org.springframework.stereotype.Component; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
@Component | 
					 | 
				
			||||
public class EpmetUserClientFeignClientFallback implements EpmetUserClientFeignClient { | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    @Override | 
					 | 
				
			||||
    public Result<LoginUserDetailsResultDTO> getLoginUserDetails(LoginUserDetailsFormDTO dto) { | 
					 | 
				
			||||
        return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLoginUserDetails", dto); | 
					 | 
				
			||||
    } | 
					 | 
				
			||||
} | 
					 | 
				
			||||
@ -1,40 +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.CustomerStaffDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.CustomerStaffRoleListFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.LoginUserDetailsFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.form.TagCustomerFormDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.CustomerStaffRoleListResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.CustomerStaffRoleResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.LoginUserDetailsResultDTO; | 
					 | 
				
			||||
import com.epmet.dto.result.TagCustomerResultDTO; | 
					 | 
				
			||||
import com.epmet.feign.EpmetUserSelfFeignClient; | 
					 | 
				
			||||
import org.springframework.stereotype.Component; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
import java.util.List; | 
					 | 
				
			||||
 | 
					 | 
				
			||||
/** | 
					 | 
				
			||||
 * @dscription epmet-user服务 | 
					 | 
				
			||||
 * @author sun | 
					 | 
				
			||||
 */ | 
					 | 
				
			||||
@Component | 
					 | 
				
			||||
public class EpmetUserSelfFeignClientFallBack implements EpmetUserSelfFeignClient { | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    @Override | 
					 | 
				
			||||
    public Result<LoginUserDetailsResultDTO> getLoginUserDetails(LoginUserDetailsFormDTO dto) { | 
					 | 
				
			||||
        return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLoginUserDetails", dto); | 
					 | 
				
			||||
    } | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    @Override | 
					 | 
				
			||||
    public Result<TagCustomerResultDTO> getCustomerIdByUserId(TagCustomerFormDTO formDTO) { | 
					 | 
				
			||||
        return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerIdByUserId", formDTO); | 
					 | 
				
			||||
    } | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    @Override | 
					 | 
				
			||||
    public Result<List<CustomerStaffRoleResultDTO>> getStaffRoles(String staffId) { | 
					 | 
				
			||||
        return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffRoles", staffId); | 
					 | 
				
			||||
    } | 
					 | 
				
			||||
} | 
					 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue