From 0fedc8fece4cb47a4b74fbcc47e0af759b92a10e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 14 Mar 2021 19:21:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=20master=20=E5=88=86?= =?UTF-8?q?=E6=94=AF=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/sms/client/SmsClient.java | 4 +- .../framework/sms/core/SmsClientFactory.java | 1 - .../controller/sms/SmsTemplateController.java | 74 +------------------ .../dict/impl/SysDictDataServiceImpl.java | 4 - .../impl/SysPermissionServiceImpl.java | 8 -- .../service/dept/SysDeptServiceTest.java | 2 +- .../service/dict/SysDictDataServiceTest.java | 2 +- 7 files changed, 6 insertions(+), 89 deletions(-) diff --git a/src/main/java/cn/iocoder/dashboard/framework/sms/client/SmsClient.java b/src/main/java/cn/iocoder/dashboard/framework/sms/client/SmsClient.java index b3861f159..ff8e6e72f 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/sms/client/SmsClient.java +++ b/src/main/java/cn/iocoder/dashboard/framework/sms/client/SmsClient.java @@ -24,7 +24,7 @@ public interface SmsClient { */ SmsResult send(String templateApiId, SmsBody smsBody, String targets); - + // TODO FROM 芋艿 to ZZF:是不是可以改成意图更明确的解析返回结果,例如说 parseXXXX /** * 短信发送回调请求处理 * @@ -33,4 +33,4 @@ public interface SmsClient { */ SmsResultDetail smsSendCallbackHandle(ServletRequest request) throws Exception; -} \ No newline at end of file +} diff --git a/src/main/java/cn/iocoder/dashboard/framework/sms/core/SmsClientFactory.java b/src/main/java/cn/iocoder/dashboard/framework/sms/core/SmsClientFactory.java index b4b4428ec..d55c7cb99 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/sms/core/SmsClientFactory.java +++ b/src/main/java/cn/iocoder/dashboard/framework/sms/core/SmsClientFactory.java @@ -115,7 +115,6 @@ public class SmsClientFactory { * @return 第三方平台短信唯一标识 */ public SmsResultDetail getSmsResultDetailFromCallbackQuery(ServletRequest callbackRequest) { - for (Long channelId : smsSenderMap.keySet()) { AbstractSmsClient smsClient = smsSenderMap.get(channelId); try { diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/sms/SmsTemplateController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/sms/SmsTemplateController.java index 9fdf98440..53eefad46 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/sms/SmsTemplateController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/sms/SmsTemplateController.java @@ -1,84 +1,14 @@ package cn.iocoder.dashboard.modules.system.controller.sms; -import cn.iocoder.dashboard.common.enums.CommonStatusEnum; -import cn.iocoder.dashboard.common.pojo.CommonResult; -import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; -import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginReqVO; -import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginRespVO; -import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthMenuRespVO; -import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthPermissionInfoRespVO; -import cn.iocoder.dashboard.modules.system.convert.auth.SysAuthConvert; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysMenuDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; -import cn.iocoder.dashboard.modules.system.enums.permission.MenuTypeEnum; -import cn.iocoder.dashboard.modules.system.service.auth.SysAuthService; -import cn.iocoder.dashboard.modules.system.service.permission.SysPermissionService; -import cn.iocoder.dashboard.modules.system.service.permission.SysRoleService; -import cn.iocoder.dashboard.modules.system.service.user.SysUserService; -import cn.iocoder.dashboard.util.collection.SetUtils; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.dashboard.common.pojo.CommonResult.success; -import static cn.iocoder.dashboard.framework.security.core.util.SecurityUtils.getLoginUserId; -import static cn.iocoder.dashboard.framework.security.core.util.SecurityUtils.getLoginUserRoleIds; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; @Api("认证 API") @RestController @RequestMapping("/sms/template") public class SmsTemplateController { - @Resource - private SysAuthService authService; - @Resource - private SysUserService userService; - @Resource - private SysRoleService roleService; - @Resource - private SysPermissionService permissionService; - @ApiOperation("使用账号密码登录") - @PostMapping("/login") - @OperateLog(enable = false) // 避免 Post 请求被记录操作日志 - public CommonResult login(@RequestBody @Valid SysAuthLoginReqVO reqVO) { - String token = authService.login(reqVO.getUsername(), reqVO.getPassword(), reqVO.getUuid(), reqVO.getCode()); - // 返回结果 - return success(SysAuthLoginRespVO.builder().token(token).build()); - } - - @ApiOperation("获取登陆用户的权限信息") - @GetMapping("/get-permission-info") - public CommonResult getPermissionInfo() { - // 获得用户信息 - SysUserDO user = userService.getUser(getLoginUserId()); - if (user == null) { - return null; - } - // 获得角色列表 - List roleList = roleService.listRolesFromCache(getLoginUserRoleIds()); - // 获得菜单列表 - List menuList = permissionService.listRoleMenusFromCache(getLoginUserRoleIds(), - SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()), - SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); - // 拼接结果返回 - return success(SysAuthConvert.INSTANCE.convert(user, roleList, menuList)); - } - - @ApiOperation("获得登陆用户的菜单列表") - @GetMapping("list-menus") - public CommonResult> listMenus() { - // 获得用户拥有的菜单列表 - List menuList = permissionService.listRoleMenusFromCache(getLoginUserRoleIds(), - SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType()), // 只要目录和菜单类型 - SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); // 只要开启的 - // 转换成 Tree 结构返回 - return success(SysAuthConvert.INSTANCE.buildMenuTree(menuList)); - } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java index 0bcd1ad32..c618f0e1a 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/dict/impl/SysDictDataServiceImpl.java @@ -12,10 +12,6 @@ import cn.iocoder.dashboard.modules.system.convert.dict.SysDictDataConvert; import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictTypeDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dict.SysDictDataMapper; -import cn.iocoder.dashboard.modules.system.mq.producer.dict.SysDictDataProducer; -import cn.iocoder.dashboard.modules.system.dal.mysql.dao.dict.SysDictDataMapper; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictDataDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.dict.SysDictTypeDO; import cn.iocoder.dashboard.modules.system.redis.mq.producer.dict.SysDictDataProducer; import cn.iocoder.dashboard.modules.system.service.dict.SysDictDataService; import cn.iocoder.dashboard.modules.system.service.dict.SysDictTypeService; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysPermissionServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysPermissionServiceImpl.java index 78cebabbd..0b979e033 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysPermissionServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/permission/impl/SysPermissionServiceImpl.java @@ -11,14 +11,6 @@ import cn.iocoder.dashboard.modules.system.dal.dataobject.permission.SysMenuDO; import cn.iocoder.dashboard.modules.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.dashboard.modules.system.dal.dataobject.permission.SysRoleMenuDO; import cn.iocoder.dashboard.modules.system.dal.dataobject.permission.SysUserRoleDO; -import cn.iocoder.dashboard.modules.system.mq.producer.permission.SysPermissionProducer; -import cn.iocoder.dashboard.framework.security.core.util.SecurityUtils; -import cn.iocoder.dashboard.modules.system.dal.mysql.dao.permission.SysRoleMenuMapper; -import cn.iocoder.dashboard.modules.system.dal.mysql.dao.permission.SysUserRoleMapper; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysMenuDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleMenuDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysUserRoleDO; import cn.iocoder.dashboard.modules.system.redis.mq.producer.permission.SysPermissionProducer; import cn.iocoder.dashboard.modules.system.service.permission.SysMenuService; import cn.iocoder.dashboard.modules.system.service.permission.SysPermissionService; diff --git a/src/test/java/cn/iocoder/dashboard/modules/system/service/dept/SysDeptServiceTest.java b/src/test/java/cn/iocoder/dashboard/modules/system/service/dept/SysDeptServiceTest.java index ca0165c0f..2b70615b4 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/system/service/dept/SysDeptServiceTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/system/service/dept/SysDeptServiceTest.java @@ -8,7 +8,7 @@ import cn.iocoder.dashboard.modules.system.controller.dept.vo.dept.SysDeptUpdate import cn.iocoder.dashboard.modules.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dept.SysDeptMapper; import cn.iocoder.dashboard.modules.system.enums.dept.DeptIdEnum; -import cn.iocoder.dashboard.modules.system.mq.producer.dept.SysDeptProducer; +import cn.iocoder.dashboard.modules.system.redis.mq.producer.dept.SysDeptProducer; import cn.iocoder.dashboard.modules.system.service.dept.impl.SysDeptServiceImpl; import cn.iocoder.dashboard.util.collection.ArrayUtils; import cn.iocoder.dashboard.util.object.ObjectUtils; diff --git a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java index 79c89518d..31f3b3610 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java @@ -10,7 +10,7 @@ import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataUp import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.dashboard.modules.system.dal.dataobject.dict.SysDictTypeDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dict.SysDictDataMapper; -import cn.iocoder.dashboard.modules.system.mq.producer.dict.SysDictDataProducer; +import cn.iocoder.dashboard.modules.system.redis.mq.producer.dict.SysDictDataProducer; import cn.iocoder.dashboard.modules.system.service.dict.impl.SysDictDataServiceImpl; import cn.iocoder.dashboard.util.collection.ArrayUtils; import cn.iocoder.dashboard.util.object.ObjectUtils;