forked from rongchao/epmet-cloud-rizhao
28 changed files with 549 additions and 2 deletions
@ -0,0 +1,24 @@ |
|||
package com.epmet.commons.tools.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class HasOperPermissionFormDTO { |
|||
|
|||
/** |
|||
* uri |
|||
*/ |
|||
@NotBlank(message = "uri不能为空") |
|||
private String uri; |
|||
|
|||
/** |
|||
* http方法 |
|||
*/ |
|||
@NotBlank(message = "请求http方法不能为空") |
|||
private String method; |
|||
|
|||
@NotBlank(message = "操作者ID不能为空") |
|||
private String operId; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.epmet.commons.tools.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class OperResouce { |
|||
|
|||
private String userId; |
|||
private String resourceUrl; |
|||
private String ResourceMethod; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package com.epmet.commons.tools.feign; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; |
|||
import com.epmet.commons.tools.dto.result.OperResouce; |
|||
import com.epmet.commons.tools.feign.fallback.CommonOperAccessOpenFeignClientFallbackFactory; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 运营端权限模块 |
|||
* @Author yinzuomei |
|||
* @Date 2020/5/21 15:17 本服务对外开放的API,其他服务通过引用此client调用该服务 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class) |
|||
//@FeignClient(name = ServiceConstant.OPER_ACCESS_SERVER, fallbackFactory = CommonOperAccessOpenFeignClientFallbackFactory.class, url = "http://localhost:8093")
|
|||
public interface CommonOperAccessOpenFeignClient { |
|||
/** |
|||
* @param |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Author yinzuomei |
|||
* @Description 清空运营人员权限信息、菜单信息 |
|||
* @Date 2020/5/21 17:08 |
|||
**/ |
|||
@GetMapping("/oper/access/menu/clearoperuseraccess") |
|||
Result clearOperUserAccess(); |
|||
|
|||
/** |
|||
* 是否有该接口的权限 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/oper/access/menu/hasPermission") |
|||
Result hasOperPermission(@RequestBody HasOperPermissionFormDTO form); |
|||
|
|||
/** |
|||
* 需要验证的菜单资源 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/oper/access/menu/getExamineResourceUrls") |
|||
Result<List<OperResouce>> getExamineResourceUrls(); |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.epmet.commons.tools.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.dto.form.HasOperPermissionFormDTO; |
|||
import com.epmet.commons.tools.dto.result.OperResouce; |
|||
import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; |
|||
import com.epmet.commons.tools.utils.ModuleUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description 运营端权限模块 |
|||
* @Author yinzuomei |
|||
* @Date 2020/5/21 15:47 |
|||
*/ |
|||
//@Component
|
|||
public class CommonOperAccessOpenFeignClientFallback implements CommonOperAccessOpenFeignClient { |
|||
@Override |
|||
public Result clearOperUserAccess() { |
|||
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "clearOperUserAccess"); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public Result hasOperPermission(HasOperPermissionFormDTO form) { |
|||
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "hasOperPermission"); |
|||
} |
|||
|
|||
@Override |
|||
public Result<List<OperResouce>> getExamineResourceUrls() { |
|||
return ModuleUtils.feignConError(ServiceConstant.OPER_ACCESS_SERVER, "getExamineResourceUrls"); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,19 @@ |
|||
package com.epmet.commons.tools.feign.fallback; |
|||
|
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.feign.CommonOperAccessOpenFeignClient; |
|||
import feign.hystrix.FallbackFactory; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
@Slf4j |
|||
public class CommonOperAccessOpenFeignClientFallbackFactory implements FallbackFactory<CommonOperAccessOpenFeignClient> { |
|||
private CommonOperAccessOpenFeignClientFallback fallback = new CommonOperAccessOpenFeignClientFallback(); |
|||
|
|||
@Override |
|||
public CommonOperAccessOpenFeignClient create(Throwable cause) { |
|||
log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); |
|||
return fallback; |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
epmet: |
|||
oper-examine-resource-urls: |
|||
# 角色编辑 |
|||
- resourceUrl: /oper/access/operrole |
|||
resourceMethod: PUT |
|||
@ -0,0 +1,3 @@ |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1005', '1912268145', '', '5000000003054196', '信息登记', 'dingtbmsztg41nmbclzi', '6mdIbt8xWkKOkGasxqQt44uNEri-KQWSmMX1u7weTMEuoGWwQsoYSyc0hBeoQGEj', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:03:32', '烟台企业内部应用', '2022-09-26 14:03:40'); |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1006', '1912172899', '', '5000000003054651', '疫情防控', 'dingye4npkwn5l8gate0', 'iOqq_5nURdTr-69DKukTfpzmkJIN5UBCQNlOdB-g6PucCC2UG-wrXmyC2XEylkuE', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:04:39', '烟台企业内部应用', '2022-09-26 14:04:46'); |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1007', '1912176853', '', '5000000003054757', '议事厅', 'ding56hee9xi5kxlmpbp', 'Y16WoB0qD0k8N7NY2J7HLyHGGAkhlBj9Bxkpa1cFuUUrTZlH2SfLvP4ZYnsvxC7f', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:05:40', '烟台企业内部应用', '2022-09-26 14:05:43'); |
|||
@ -0,0 +1,4 @@ |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1008', '1914273833', '', '5000000003069546', '随手拍', 'dingpvk106h0eca7btlm', 'zLF8ld6pF40NLUxC2aRKP7yfXreRpSRJTCN48_kyAQtretSLBfSpFMX6prUOaH_Z', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1009', '1914301613', '', '5000000003069487', '随时讲', 'ding1ept2iaynjxu2w6o', 'xSXSennTbJG8nc-IjjsrG1zEugNoCp2rLhT7pS0vInT7OnPZ5FgY3974aR9D-xd2', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1010', '1914266905', '', '5000000003069391', '我的报事', 'dingpzsyljcsbu3fbac5', 'fWRzS2W59fwx__istOF23mHq1S0hAs64nZhcmljrSLLMYrceZVsz7GhgG4izZvhy', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); |
|||
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1011', '1914338340', '', '5000000003069669', '实时动态', 'dingflbhlrd1epy11irl', '47OE8jNuSj-JoOPBx7ZCqEii4fycnWtY2x97ndu3Mk2BOh9ElKMNuOGNU0zzshVn', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40'); |
|||
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class HasOperPermissionFormDTO { |
|||
|
|||
/** |
|||
* uri |
|||
*/ |
|||
@NotBlank(message = "uri不能为空") |
|||
private String uri; |
|||
|
|||
/** |
|||
* http方法 |
|||
*/ |
|||
@NotBlank(message = "请求http方法不能为空") |
|||
private String method; |
|||
|
|||
@NotBlank(message = "操作者ID不能为空") |
|||
private String operId; |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class OperResouce { |
|||
|
|||
private String userId; |
|||
private String resourceUrl; |
|||
private String ResourceMethod; |
|||
|
|||
|
|||
} |
|||
Loading…
Reference in new issue