forked from rongchao/epmet-cloud-rizhao
25 changed files with 269 additions and 15 deletions
@ -0,0 +1,36 @@ |
|||
package com.epmet.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.feign.fallback.OperRoleUserFeignClientFallBack; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/3/20 17:19 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallback = OperRoleUserFeignClientFallBack.class, url = "http://localhost:8093") |
|||
public interface OperRoleUserFeignClient { |
|||
|
|||
/** |
|||
* 获取权限id列表 |
|||
* @param id 用户id |
|||
* @return List<String> |
|||
* @author zhaoqifeng |
|||
*/ |
|||
@GetMapping("/oper/access/operroleuser/getRoleIdList/{id}") |
|||
Result<List<String>> getRoleIdList(@PathVariable("id") String id); |
|||
|
|||
/** |
|||
* 保存更新权限 |
|||
* @param userId 用户id |
|||
* @param roleIdList 权限列表 |
|||
* @author zhaoqifeng |
|||
*/ |
|||
@PostMapping("/oper/access/operroleuser/saveOrUpdateRole") |
|||
Result saveOrUpdate(@RequestParam("userId") String userId, @RequestBody List<String> roleIdList); |
|||
} |
@ -0,0 +1,28 @@ |
|||
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.feign.OperRoleUserFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
import sun.misc.Contended; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author zhaoqifeng |
|||
* @dscription |
|||
* @date 2020/3/20 17:27 |
|||
*/ |
|||
@Component |
|||
public class OperRoleUserFeignClientFallBack implements OperRoleUserFeignClient { |
|||
@Override |
|||
public Result<List<String>> getRoleIdList(String id) { |
|||
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getRoleIdList",id); |
|||
} |
|||
|
|||
@Override |
|||
public Result saveOrUpdate(String userId, List<String> roleIdList) { |
|||
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "saveOrUpdate",userId); |
|||
} |
|||
} |
Loading…
Reference in new issue