diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java index 35694c6..b665ec4 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java @@ -60,7 +60,8 @@ public class MallLoginStrategy implements LoginStrategy{ staffLoginInfo.setId(Constants.SUPER_ADMIN_ID).setName(Constants.SUPER_ADMIN).setSourceType(SourceType.COMMON); } LoginUser loginUser = new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); - loginUser.setUserType(UserType.MALL_USER) + loginUser.setUserId(sysUser.getId()) + .setUserType(UserType.MALL_USER) .setUserName(sysUser.getUserName()) .setLoginTime(System.currentTimeMillis()) .setStatus(sysUser.getStatus()); diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java index 481c8d8..f9e30ba 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java @@ -55,7 +55,8 @@ public class OamLoginStrategy implements LoginStrategy{ staffLoginInfo.setId(Constants.SUPER_ADMIN_ID); } LoginUser loginUser = new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); - loginUser.setUserType(UserType.OAM_USER) + loginUser.setUserId(sysUser.getId()) + .setUserType(UserType.OAM_USER) .setUserName(sysUser.getUserName()) .setLoginTime(System.currentTimeMillis()) .setStatus(sysUser.getStatus()); diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml index 4203f8f..24aa6eb 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml @@ -16,23 +16,19 @@ cpop: spring: application: name: Cpop-Oam-Dev - datasource: - url: jdbc:mysql://localhost:3306/cpop-union?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: root #redis配置 redis: #地址 - host: localhost + host: 106.52.49.102 #端口 - port: 6379 + port: 6333 #数据库 - database: 0 + database: 10 #密码 - password: + password: Jambox.123* #连接超时 timeout: 5000 - lettuce: + jedis: pool: # min-idle: 0 @@ -57,6 +53,15 @@ server: mybatis-flex: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + datasource: + mall: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: Customer0401 + jambox: + url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true + username: root + password: Customer0401 # springdoc-openapi项目配置 knife4j: diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml index a957a11..d08df99 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml @@ -31,7 +31,7 @@ spring: max-file-size: 1024MB max-request-size: 300MB profiles: - active: dev,jambox,api,sdk + active: dev,core datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver @@ -124,4 +124,27 @@ xss: logging: level: #swagger日志 - springfox: error \ No newline at end of file + springfox: error + +#微信 +wx: + #企业微信 + cp: + corpId: 111 + appConfigs: + # (某一具体应用的AgentId,如果是要配置通讯录同步的应用,可以随便配置一个) + - agentId: 1000001 + #(该应用的Secret) + secret: 1111 + # (应用中的 “接受消息” 部分的 “接收消息服务器配置” 里的Token值) + token: 111 + # (应用中的 “接受消息” 部分的 “接收消息服务器配置” 里的EncodingAESKey值) + aesKey: 111 + #开放平台 + open: + openAppid: wx6e07ba6606e912a5 + componentAppId: wx1efbf67f8637d7d1 + componentSecret: fc2e9457aaa32342751cc655b5a1d273 + componentToken: jambox + componentAesKey: 1a3NBxmCFwkCJvfoQ7WhJHB6iX3qHPsc9JbaDznE1i0 + redirectUri: https://empower.oamapi.cpopsz.com/test/openPlatform/thirdPartyPlatform/redirectUrl \ No newline at end of file diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/LoginController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/LoginController.java deleted file mode 100644 index def7933..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/LoginController.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.cpop.oam.business.controller; - -import com.cpop.core.base.R; -import com.cpop.oam.business.service.LoginService; -import com.cpop.oam.business.vo.LoginUserInfoVo; -import com.cpop.oam.business.vo.MenuRouteVo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @author DB - * @createTime 2023/09/10 11:13 - * @description 系统登陆 - */ -@Api(tags = "系统登录模块") -@RestController -public class LoginController { - - @Autowired - private LoginService loginService; - - /** - * @author LOST.yuan - * @Description 获取登录用户详情 - * @date 14:52 2022/9/7 - * @return {@link R} - **/ - @GetMapping("/getUserInfo") - @ApiOperation("获取登录用户详情") - public R getUserInfo() { - return R.ok(loginService.getUserInfo()); - } - - /** - * @author LOST.yuan - * @Description 获取权限码 - * @date 14:52 2022/9/7 - * @return {@link List} - **/ - @ApiOperation("获取权限码") - @GetMapping("/getPermCode") - public R> getPermCode(){ - List list = loginService.getPermCode(); - return R.ok(list); - } - - /** - * @author LOST.yuan - * @Description 获取菜单列表 - * @date 14:52 2022/9/7 - * @return {@link R>} - **/ - @ApiOperation("获取菜单列表") - @GetMapping("/getMenuList") - public R> getMenuList(){ - List list = loginService.getOamMenuList(); - return R.ok(list); - } -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/MenuController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/MenuController.java deleted file mode 100644 index 2e43f09..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/MenuController.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.cpop.oam.business.controller; - -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.oam.business.bo.MenuBo; -import com.cpop.oam.business.bo.MenuListBo; -import com.cpop.oam.business.service.MenuService; -import com.cpop.oam.business.vo.MenuVo; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 系统菜单模块接口 - * - * @author DB - * @since 2023-09-07 - */ -@RestController -@Api(tags = "系统菜单模块") -@RequestMapping("/menu") -public class MenuController { - - @Autowired - private MenuService menuService; - - /** - * @descriptions 获取系统菜单树列表 - * @author DB - * @date 2023/09/07 15:48 - * @param bo 请求参数 - * @return com.jambox.core.base.R> - */ - @PreAuthorize("@aps.hasPermission('system:menu:list')") - @ApiOperation("获取OAM菜单树列表") - @GetMapping("/getOamMenuTreeList") - public R> getOamMenuTreeList(MenuListBo bo) { - List list = menuService.getOamMenuTreeList(bo); - return R.ok(list); - } - - /** - * @descriptions 获取目录与菜单树 - * @author DB - * @date 2023/09/07 17:41 - * @return com.jambox.core.base.R> - */ - @ApiOperation("获取目录与菜单树") - @GetMapping("/getDirectoryAndMenuTreeList") - public R> getDirectoryAndMenuTreeList() { - List list = menuService.getDirectoryAndMenuTreeList(); - return R.ok(list); - } - - /** - * @descriptions 新增系统菜单 - * @author DB - * @date 2023/09/07 17:45 - * @param bo 请求参数 - * @return com.jambox.core.base.R - */ - @PreAuthorize("@aps.hasPermission('system:menu:insert')") - @OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_MENU) - @ApiOperation("新增OAM菜单") - @PostMapping("/insertOamMenu") - public R insertOamMenu(@RequestBody @Validated MenuBo bo) { - menuService.insertOamMenu(bo); - return R.ok(); - } - - /** - * @Description: 修改系统菜单表 - * @param bo 请求参数 - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - @PreAuthorize("@aps.hasPermission('system:menu:update')") - @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_MENU) - @ApiOperation("修改OAM菜单") - @PutMapping("/updateOamMenu") - public R updateOamMenu(@RequestBody @Validated MenuBo bo) { - menuService.updateOamMenu(bo); - return R.ok(); - } - - /** - * @Description: 删除系统菜单表 - * @param id 主键id - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - @PreAuthorize("@aps.hasPermission('system:menu:remove')") - @OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_MENU) - @ApiOperation("删除OAM菜单") - @DeleteMapping("/removeOamMenu/{id}") - public R removeOamMenu(@PathVariable String id) { - menuService.removeOamMenu(id); - return R.ok(); - } - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/RoleController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/RoleController.java deleted file mode 100644 index c713457..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/RoleController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.cpop.oam.business.controller; - -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.oam.business.bo.MenuListBo; -import com.cpop.oam.business.bo.RoleBo; -import com.cpop.oam.business.bo.RolePageBo; -import com.cpop.oam.business.bo.RoleStatusBo; -import com.cpop.oam.business.service.MenuService; -import com.cpop.oam.business.service.RoleService; -import com.cpop.oam.business.vo.MenuVo; -import com.cpop.oam.business.vo.RolePageVo; -import com.mybatisflex.core.paginate.Page; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 系统角色表 控制层。 - * - * @author DB - * @since 2023-09-08 - */ -@RestController -@Api(tags = "系统角色模块") -@RequestMapping("/role") -public class RoleController { - - @Autowired - private RoleService roleService; - - @Autowired - private MenuService menuService; - - /** - * @descriptions 查询系统角色分页列表 - * @author DB - * @date 2023/09/10 16:51 - * @param bo 请求参数 - * @return R> - */ - @PreAuthorize("@aps.hasPermission('system:role:list')") - @ApiOperation("查询系统角色分页列表") - @GetMapping("/getRolePageList") - public R> getOamRolePageList(RolePageBo bo) { - Page pageVo = roleService.selectOamRolePageList(bo); - return R.ok(pageVo); - } - - /** - * @descriptions 新增角色 - * @author DB - * @date 2023/10/12 10:48 - * @param bo 请求参数 - * @return: com.cpop.core.base.R - */ - @PreAuthorize("@aps.hasPermission('system:role:insert')") - @OperationLog(operationLogEnumType = OperationLogEnum.INSERT_OAM_ROLE) - @ApiOperation("新增角色") - @PostMapping("/insertRole") - public R insertSysRole(@RequestBody @Validated RoleBo bo) { - roleService.insertOamRole(bo); - return R.ok(); - } - - /** - * @Description: 获取系统菜单树列表 - * @return: R> - * @Author: DB - * @Date: 2023/5/10 14:39 - **/ - @ApiOperation("获取菜单树列表") - @GetMapping("/getFilterAuthMenuTreeList") - public R> getFilterAuthMenuTreeList() { - List list = menuService.getOamMenuTreeList(new MenuListBo()); - //过滤掉没有权限的数据 - return R.ok(list); - } - - /** - * @descriptions 修改角色 - * @author DB - * @date 2023/09/10 17:45 - * @param bo 请求参数 - * @return com.jambox.core.base.R - */ - @PreAuthorize("@aps.hasPermission('system:role:update')") - @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE) - @ApiOperation("修改角色") - @PutMapping("/updateRole") - public R updateRole(@RequestBody @Validated RoleBo bo) { - roleService.updateOamRole(bo); - return R.ok(); - } - - /** - * 删除系统角色表 - */ - @PreAuthorize("@aps.hasPermission('system:role:remove')") - @OperationLog(operationLogEnumType = OperationLogEnum.REMOVE_OAM_ROLE) - @ApiOperation("删除系统角色表") - @DeleteMapping("/removeRole/{id}") - public R removeRole(@PathVariable String id) { - roleService.removeOamRole(id); - return R.ok(); - } - - /** - * @Description: 设置角色状态 - * @param bo 请求参数 - * @return: R - * @Author: DB - * @Date: 2023/5/9 14:13 - **/ - @PreAuthorize("@aps.hasPermission('system:role:update')") - @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_ROLE) - @ApiOperation("设置角色状态") - @PutMapping("/setRoleStatus") - public R setOamRoleStatus(@RequestBody @Validated RoleStatusBo bo) { - roleService.setOamRoleStatus(bo); - return R.ok(); - } -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/StaffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/StaffController.java index 4ec50d5..a038876 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/StaffController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/StaffController.java @@ -1,5 +1,6 @@ package com.cpop.oam.business.controller; +import com.cpop.system.business.service.RoleService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.cpop.common.constant.Constants; @@ -9,7 +10,6 @@ import com.cpop.core.base.enums.OperationLogEnum; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.service.DeptService; -import com.cpop.oam.business.service.RoleService; import com.cpop.oam.business.service.StaffService; import com.cpop.oam.business.vo.*; import io.swagger.annotations.Api; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Menu.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Menu.java deleted file mode 100644 index 20dce9f..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Menu.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.cpop.oam.business.entity; - -import com.mybatisflex.annotation.Id; -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 系统菜单表 实体类。 - * - * @author DB - * @since 2023-09-07 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_oam_menu", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class Menu extends BaseEntity implements Serializable { - - /** - * 菜单ID - */ - @Id - private String id; - - /** - * 父级菜单ID - */ - private String parentMenu; - - /** - * 菜单名称 - */ - private String name; - - /** - * 菜单图标 - */ - private String icon; - - /** - * 菜单路由,父菜单为空 - */ - private String component; - - /** - * 标记菜单的状态 0:禁用 1:正常(根据权限正常显示) - */ - private Boolean status; - - /** - * 菜单类型,0:目录,1:菜单,2:按钮 - */ - private Integer type; - - /** - * 权限 - */ - private String permission; - - /** - * 重定向路径,一级菜单有值 - */ - private String redirect; - - /** - * 排序,值越小越靠前,一级菜单有值 - */ - private Integer orderNo; - - /** - * 路由地址 - */ - private String path; - - /** - * 标题 - */ - private String title; - - /** - * 隐藏菜单 - */ - private Boolean hideMenu; - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Role.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Role.java deleted file mode 100644 index abf9e8a..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Role.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.cpop.oam.business.entity; - -import com.mybatisflex.annotation.Id; -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 系统角色表 实体类。 - * - * @author DB - * @since 2023-09-08 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_oam_role", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class Role extends BaseEntity implements Serializable { - - /** - * 主键 - */ - @Id - private String id; - - /** - * 角色名称 - */ - private String roleName; - - /** - * 角色值 - */ - private String roleValue; - - /** - * 状态 - */ - private Boolean status; - - /** - * 备注 - */ - private String remark; - - /** - * 排序 - */ - private Integer orderNo; - - - - - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/RoleMenu.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/RoleMenu.java deleted file mode 100644 index ab65ab6..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/RoleMenu.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.cpop.oam.business.entity; - -import com.mybatisflex.annotation.Table; -import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.entity.BaseInsertListener; -import com.cpop.core.base.entity.BaseUpdateListener; -import lombok.*; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 系统-角色-菜单表 实体类。 - * - * @author DB - * @since 2023-09-10 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@Builder -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Table(value = "cp_oam_role_menu", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class RoleMenu extends BaseEntity implements Serializable { - - /** - * 角色id - */ - private String roleId; - - /** - * 菜单id - */ - private String menuId; - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/MenuMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/MenuMapper.java deleted file mode 100644 index a971a74..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/MenuMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.oam.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.oam.business.entity.Menu; - -/** - * 系统菜单表 映射层。 - * - * @author DB - * @since 2023-09-07 - */ -public interface MenuMapper extends BaseMapper { - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMapper.java deleted file mode 100644 index 13b6d12..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.oam.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.oam.business.entity.Role; - -/** - * 系统角色表 映射层。 - * - * @author DB - * @since 2023-09-08 - */ -public interface RoleMapper extends BaseMapper { - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMenuMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMenuMapper.java deleted file mode 100644 index ea02d2d..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/RoleMenuMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.oam.business.mapper; - -import com.mybatisflex.core.BaseMapper; -import com.cpop.oam.business.entity.RoleMenu; - -/** - * 系统-角色-菜单表 映射层。 - * - * @author DB - * @since 2023-09-10 - */ -public interface RoleMenuMapper extends BaseMapper { - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/LoginService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/LoginService.java deleted file mode 100644 index 3b9a2a5..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/LoginService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.cpop.oam.business.service; - -import com.cpop.oam.business.vo.LoginUserInfoVo; -import com.cpop.oam.business.vo.MenuRouteVo; - -import java.util.List; - -/** - * 系统登陆 - */ -public interface LoginService { - - /** - * 获取登录用户详情 - * - * @return 系统用户登陆信息 - */ - LoginUserInfoVo getUserInfo(); - - /** - * 获取权限码 - */ - List getPermCode(); - - /** - * @Description: 获取菜单列表 - * @return: List - * @Author: DB - * @Date: 2023/5/11 9:16 - **/ - List getOamMenuList(); -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/MenuService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/MenuService.java deleted file mode 100644 index c6cc5b7..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/MenuService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.cpop.oam.business.service; - -import com.mybatisflex.core.service.IService; -import com.cpop.oam.business.bo.MenuBo; -import com.cpop.oam.business.bo.MenuListBo; -import com.cpop.oam.business.entity.Menu; -import com.cpop.oam.business.vo.MenuRouteVo; -import com.cpop.oam.business.vo.MenuVo; - -import java.util.List; - -/** - * 系统菜单表 服务层。 - * - * @author DB - * @since 2023-09-07 - */ -public interface MenuService extends IService { - - /** - * @descriptions 获取系统菜单树列表 - * @author DB - * @date 2023/09/07 15:53 - * @param bo 请求参数 - * @return java.util.List - */ - List getOamMenuTreeList(MenuListBo bo); - - /** - * @descriptions 获取目录与菜单树 - * @author DB - * @date 2023/09/07 17:42 - * @return java.util.List - */ - List getDirectoryAndMenuTreeList(); - - /** - * @descriptions 新增系统菜单 - * @author DB - * @date 2023/09/07 17:50 - * @param bo 请求参数 - */ - void insertOamMenu(MenuBo bo); - - /** - * @Description: 修改系统菜单表 - * @param bo 请求参数 - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - void updateOamMenu(MenuBo bo); - - /** - * @Description: 删除系统菜单表 - * @param id 主键id - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - void removeOamMenu(String id); - - - /** - * @descriptions 获取菜单列表 - * @author DB - * @date 2023/09/10 14:06 - * @return java.util.List - */ - List getOamMenuList(); - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleMenuService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleMenuService.java deleted file mode 100644 index 77edf24..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleMenuService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cpop.oam.business.service; - -import com.mybatisflex.core.service.IService; -import com.cpop.oam.business.entity.RoleMenu; - -/** - * 系统-角色-菜单表 服务层。 - * - * @author DB - * @since 2023-09-10 - */ -public interface RoleMenuService extends IService { - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleService.java deleted file mode 100644 index a0b0b68..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/RoleService.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.cpop.oam.business.service; - -import com.cpop.oam.business.vo.MenuVo; -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.service.IService; -import com.cpop.oam.business.bo.RoleBo; -import com.cpop.oam.business.bo.RolePageBo; -import com.cpop.oam.business.bo.RoleStatusBo; -import com.cpop.oam.business.entity.Role; -import com.cpop.oam.business.vo.RolePageVo; - -import java.util.List; - -/** - * 系统角色表 服务层。 - * - * @author DB - * @since 2023-09-08 - */ -public interface RoleService extends IService { - - /** - * 查询系统角色分页列表 - * - * @param bo 请求参数 - * @return SysRole集合 - */ - Page selectOamRolePageList(RolePageBo bo); - - /** - * 新增角色 - * - * @param bo 请求参数 - */ - void insertOamRole(RoleBo bo); - - /** - * @descriptions 修改角色 - * @author DB - * @date 2023/09/10 17:45 - * @param bo 请求参数 - * @return: com.jambox.core.base.R - */ - void updateOamRole(RoleBo bo); - - /** - * 删除系统角色 - * - * @param id 主键 - */ - void removeOamRole(String id); - - /** - * @Description: 设置角色状态 - * @param bo 请求参数 - * @return: void - * @Author: DB - * @Date: 2023/5/9 14:13 - **/ - void setOamRoleStatus(RoleStatusBo bo); - - /** - * @descriptions 过滤掉没有权限的数据 - * @author DB - * @date 2023/10/11 17:26 - * @param list 原数据 - * @return: java.util.List - */ - List filterAuthMenu(List list); -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java deleted file mode 100644 index a6635dc..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/LoginServiceImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.cpop.oam.business.service.impl; - -import com.mybatisflex.core.query.QueryWrapper; -import com.cpop.common.constant.Constants; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.SpringUtils; -import com.cpop.oam.business.entity.Menu; -import com.cpop.oam.business.service.LoginService; -import com.cpop.oam.business.service.MenuService; -import com.cpop.oam.business.vo.LoginUserInfoVo; -import com.cpop.oam.business.vo.MenuRouteVo; -import com.cpop.oam.framework.utils.OamUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import static com.cpop.oam.business.entity.table.MenuTableDef.MENU; -import static com.cpop.oam.business.entity.table.RoleMenuTableDef.ROLE_MENU; -import static com.cpop.oam.business.entity.table.RoleTableDef.ROLE; - -/** - * @author DB - * @createTime 2023/09/10 11:19 - * @description - */ -@Service("oamLoginService") -public class LoginServiceImpl implements LoginService { - - @Autowired - private RedisService redisService; - - @Autowired - private MenuService menuService; - - /** - * @author LOST.yuan - * @Description 获取用户信息 - * @date 23:01 2022/9/26 - * @return {@link String} - **/ - @Override - public LoginUserInfoVo getUserInfo() { - //获取当前登录用户信息 - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - //获取申请员工信息 - OamStaffLoginInfo staffInfo = SpringUtils.getBean(OamUtils.class).getLoginStaffInfo(); - return new LoginUserInfoVo() - .setUserId(loginUser.getUserId()) - .setUsername(loginUser.getUsername()) - .setRealName(staffInfo.getName()) - .setAvatar(staffInfo.getAvatar()) - .setHomePath(""); - } - - /** - * @author LOST.yuan - * @Description 获取权限码 - * @date 17:30 2022/10/19 - * @return {@link List} - **/ - @Override - public List getPermCode() { - //获取当前用户所属角色以及菜单信息 - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - OamStaffLoginInfo staffInfo = SpringUtils.getBean(OamUtils.class).getLoginStaffInfo(); - if (Constants.SUPER_ADMIN.equals(loginUser.getUsername())){ - return new ArrayList(Collections.singleton(Constants.ALL_PERMISSION)); - } - List list = menuService.list(QueryWrapper.create() - .leftJoin(ROLE_MENU).on(ROLE_MENU.MENU_ID.eq(MENU.ID)) - .leftJoin(ROLE).on(ROLE.ID.eq(ROLE_MENU.ROLE_ID)) - .where(MENU.TYPE.in(1, 2)) - .and(MENU.PERMISSION.ne("")) - .and(ROLE.ID.eq(staffInfo.getRoleId()))); - return list.stream().map(Menu::getPermission).collect(Collectors.toList()); - } - - /** - * 获取菜单列表 - */ - @Override - public List getOamMenuList() { - return menuService.getOamMenuList(); - } -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/MenuServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/MenuServiceImpl.java deleted file mode 100644 index af1d78a..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/MenuServiceImpl.java +++ /dev/null @@ -1,287 +0,0 @@ -package com.cpop.oam.business.service.impl; - -import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.SpringUtils; -import com.cpop.oam.business.bo.MenuBo; -import com.cpop.oam.business.bo.MenuListBo; -import com.cpop.oam.business.entity.Menu; -import com.cpop.oam.business.mapper.MenuMapper; -import com.cpop.oam.business.service.MenuService; -import com.cpop.oam.business.vo.MenuRouteVo; -import com.cpop.oam.business.vo.MenuVo; -import com.cpop.oam.framework.utils.OamUtils; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import static com.cpop.oam.business.entity.table.MenuTableDef.MENU; -import static com.cpop.oam.business.entity.table.RoleMenuTableDef.ROLE_MENU; -import static com.cpop.oam.business.entity.table.RoleTableDef.ROLE; - -/** - * 系统菜单表 服务层实现。 - * - * @author DB - * @since 2023-09-07 - */ -@Service("oamMenuService") -public class MenuServiceImpl extends ServiceImpl implements MenuService { - - /** - * @descriptions 获取系统菜单树列表 - * @author DB - * @date 2023/09/07 15:53 - * @param bo 请求参数 - * @return java.util.List - */ - @Override - public List getOamMenuTreeList(MenuListBo bo) { - return buildMenuTree(this.listAs(QueryWrapper.create() - //状态不为空 - .and(MENU.STATUS.eq(bo.getStatus())) - //标题不为空 - .and(MENU.TITLE.like(bo.getTitle())) - .orderBy(MENU.ORDER_NO.asc()), MenuVo.class)); - } - - /** - * @descriptions 构建菜单树 - * @author DB - * @date 2023/09/07 16:36 - * @param menus 菜单集合 - * @return java.util.List - */ - private List buildMenuTree(List menus) { - List returnList = new ArrayList(); - if (menus.isEmpty()) { - return menus; - } - //构建根节点 - List tempList = menus.stream() - .filter(s -> StringUtils.isBlank(s.getParentMenu())).collect(Collectors.toList()); - for (MenuVo menu : tempList) { - MenuVo menuVo = recursionFn(menus, menu); - returnList.add(menuVo); - } - return returnList; - } - - /** - * @descriptions 递归列表 - * @author DB - * @date 2023/09/07 16:36 - * @param list 递归集合 - * @param menu 菜单 - * @return com.jambox.OAMtem.business.vo.OAMMenuVo - */ - private MenuVo recursionFn(List list, MenuVo menu) { - // 得到子节点列表 - List childList = new ArrayList(); - for (MenuVo menuNode : list) { - if (null != menuNode.getParentMenu() && menuNode.getParentMenu().equals(menu.getId())) { - childList.add(recursionFn(list, menuNode)); - } - } - if (!childList.isEmpty()){ - menu.setChildren(childList); - } - return menu; - } - - /** - * @descriptions 获取目录与菜单树 - * @author DB - * @date 2023/09/07 17:42 - * @return java.util.List - */ - @Override - public List getDirectoryAndMenuTreeList() { - //只读取启用的菜单 - return buildMenuTree(this.listAs(QueryWrapper.create() - .where(MENU.TYPE.in(0, 1)) - .orderBy(MENU.ORDER_NO.asc()) - , MenuVo.class)); - } - - /** - * @descriptions 新增系统菜单 - * @author DB - * @date 2023/09/07 17:50 - * @param bo 请求参数 - */ - @Override - public void insertOamMenu(MenuBo bo) { - Menu entity = new Menu(); - BeanUtils.copyBeanProp(entity, bo); - //设置菜单名 - if (StringUtils.isNotBlank(bo.getPath())){ - String[] split = bo.getPath().split("/"); - String name = StringUtils.getMethodName(split[split.length - 1].replace("/", "")); - entity.setName(name); - } - //设置组件 - if (StringUtils.isBlank(bo.getComponent())){ - entity.setComponent("LAYOUT"); - } - this.save(entity); - } - - /** - * @Description: 修改系统菜单表 - * @param bo 请求参数 - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - @Override - public void updateOamMenu(MenuBo bo) { - Menu entity = new Menu(); - BeanUtils.copyBeanProp(entity, bo); - //设置菜单名 - if (StringUtils.isNotBlank(bo.getPath())){ - String[] split = bo.getPath().split("/"); - String toUpperCaseString = split[split.length - 1]; - if (toUpperCaseString.contains(":")) { - toUpperCaseString = split[split.length - 2]; - } - String name = StringUtils.getMethodName(toUpperCaseString.replace("/", "")); - entity.setName(name); - } - //设置组件 - if (StringUtils.isBlank(bo.getComponent())){ - entity.setComponent("LAYOUT"); - } - this.updateById(entity); - } - - /** - * @Description: 删除系统菜单表 - * @param id 主键id - * @Author: DB - * @Date: 2023/5/10 16:01 - **/ - @Override - public void removeOamMenu(String id) { - //查询所有 - List list = this.list(); - //递归获取当前菜单及其下属子菜单 - List removeIds = new ArrayList<>(); - recursionRemove(list, id, removeIds); - removeIds.add(id); - this.removeByIds(removeIds); - } - - /** - * @Description: 递归要删除的菜单集合 - * @param list 菜单集合 - * @param id id - * @param removeIds 删除id集合 - * @Author: DB - * @Date: 2023/5/10 15:27 - **/ - private void recursionRemove(List list, String id, List removeIds) { - //过滤出删除根菜单 - List sonMenu = list.stream().filter(s -> null != s.getParentMenu()&& s.getParentMenu().equals(id)).collect(Collectors.toList()); - if (!sonMenu.isEmpty()) { - sonMenu.forEach(item -> { - recursionRemove(list, item.getId(), removeIds); - removeIds.add(item.getId()); - }); - } - } - - /** - * @descriptions 获取菜单列表 - * @author DB - * @date 2023/09/10 14:06 - * @return java.util.List - */ - @Override - public List getOamMenuList() { - //获取用户信息 - LoginUser user = SecurityUtils.getInstance().getLoginUser(); - //获取申请员工信息 - OamStaffLoginInfo staffInfo = SpringUtils.getBean(OamUtils.class).getLoginStaffInfo(); - //超级管理员 - if (Constants.SUPER_ADMIN.equals(user.getUsername())) { - //获取菜单 - List list = this.listAs(QueryWrapper.create() - .where(MENU.TYPE.in(0, 1)) - .orderBy(MENU.ORDER_NO.asc()), - MenuRouteVo.class); - return buildMenuRouteTree(list); - } else { - return buildMenuRouteTree(this.listAs(QueryWrapper.create() - .select(MENU.ALL_COLUMNS) - .leftJoin(ROLE_MENU).on(ROLE_MENU.MENU_ID.eq(MENU.ID)) - .leftJoin(ROLE).on(ROLE.ID.eq(ROLE_MENU.ROLE_ID)) - .where(MENU.STATUS.eq(1)) - .and(MENU.TYPE.in(0, 1)) - .and(MENU.NAME.notIn(Constants.HIDE_MENU.split(","))) - .and(ROLE_MENU.ROLE_ID.eq(staffInfo.getRoleId())) - .orderBy(MENU.ORDER_NO.asc()), - MenuRouteVo.class)); - } - } - - /** - * @Description: 构建菜单路由树 - * @param menus 菜单集合 - * @return: List - * @Author: DB - * @Date: 2023/5/11 9:21 - **/ - private List buildMenuRouteTree(List menus) { - if (menus.isEmpty()){ - return menus; - } - //构建内部类 - menus.forEach(item->{ - MenuRouteVo.Meta meta = item.new Meta(); - meta.setIcon(item.getIcon()); - meta.setOrderNo(item.getOrderNo()); - meta.setTitle(item.getTitle()); - meta.setHideMenu(item.getHideMenu()); - item.setMeta(meta); - }); - //构建根节点 - List tempList = menus.stream() - .filter(s -> StringUtils.isBlank(s.getParentMenu())).collect(Collectors.toList()); - List menuRoutes = new ArrayList<>(); - for (MenuRouteVo menu : tempList) { - MenuRouteVo menuVo = recursionMenuRoute(menus, menu); - //设置是否需要隐藏子内部菜单 - menuVo.getMeta().setHideChildrenInMenu(null != menuVo.getChildren() && menuVo.getChildren().size() == 1 && menuVo.getChildren().get(0).getHideMenu()); - menuRoutes.add(menuVo); - } - return BeanUtils.mapToList(menuRoutes, MenuRouteVo.class); - } - - /** - * @Description: 递归列表 - * @param list 菜单集合 - * @param menu 菜单 - * @return: MenuRouteVo - * @Author: DB - * @Date: 2023/5/11 9:22 - **/ - private MenuRouteVo recursionMenuRoute(List list, MenuRouteVo menu) { - // 得到子节点列表 - List childList = new ArrayList(); - for (MenuRouteVo menuNode : list) { - if (StringUtils.isNotBlank(menuNode.getParentMenu()) && menuNode.getParentMenu().equals(menu.getId())) { - childList.add(recursionMenuRoute(list, menuNode)); - } - } - menu.setChildren(childList); - return menu; - } -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleMenuServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleMenuServiceImpl.java deleted file mode 100644 index 53f2003..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleMenuServiceImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.cpop.oam.business.service.impl; - -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.oam.business.entity.RoleMenu; -import com.cpop.oam.business.mapper.RoleMenuMapper; -import com.cpop.oam.business.service.RoleMenuService; -import org.springframework.stereotype.Service; - -/** - * 系统-角色-菜单表 服务层实现。 - * - * @author DB - * @since 2023-09-10 - */ -@Service("oamRoleMenuService") -public class RoleMenuServiceImpl extends ServiceImpl implements RoleMenuService { - -} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleServiceImpl.java deleted file mode 100644 index ffbbd29..0000000 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/RoleServiceImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.cpop.oam.business.service.impl; - -import com.cpop.oam.business.vo.MenuVo; -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.spring.service.impl.ServiceImpl; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; -import com.cpop.oam.business.bo.RoleBo; -import com.cpop.oam.business.bo.RolePageBo; -import com.cpop.oam.business.bo.RoleStatusBo; -import com.cpop.oam.business.entity.Role; -import com.cpop.oam.business.entity.RoleMenu; -import com.cpop.oam.business.mapper.RoleMapper; -import com.cpop.oam.business.service.RoleMenuService; -import com.cpop.oam.business.service.RoleService; -import com.cpop.oam.business.vo.RolePageVo; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import static com.cpop.oam.business.entity.table.RoleMenuTableDef.ROLE_MENU; -import static com.cpop.oam.business.entity.table.RoleTableDef.ROLE; - - -/** - * 系统角色表 服务层实现。 - * - * @author DB - * @since 2023-09-08 - */ -@Service("oamRoleService") -public class RoleServiceImpl extends ServiceImpl implements RoleService { - - /** - * @param bo 请求参数 - * @Description: 查询系统角色表列表 - * @return: PageVo - * @Author: DB - * @Date: 2023/5/10 17:59 - **/ - @Override - public Page selectOamRolePageList(RolePageBo bo) { - PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - Page page = this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), - QueryWrapper.create() - .select(ROLE.ALL_COLUMNS) - .where(ROLE.ROLE_VALUE.ne(Constants.SUPER_ADMIN_VALUE)) - .and(ROLE.ROLE_NAME.like(bo.getRoleName())) - .and(ROLE.STATUS.eq(bo.getStatus())) - .orderBy(ROLE.ORDER_NO.asc()) - , RolePageVo.class); - if (!page.getRecords().isEmpty()) { - //根据角色查询中间表 - List roleMenuList = SpringUtils.getBean(RoleMenuService.class).list(QueryWrapper.create() - .where(ROLE_MENU.ROLE_ID.in(page.getRecords().stream().map(RolePageVo::getId).collect(Collectors.toSet())))); - page.getRecords().forEach(item -> { - List filterMenuIds = roleMenuList.stream() - .filter(s -> StringUtils.equals(s.getRoleId(), item.getId())) - .map(RoleMenu::getMenuId).collect(Collectors.toList()); - item.setMenuIds(filterMenuIds); - }); - } - return page; - } - - /** - * @param bo 请求参数 - * @Description: 新增角色 - * @return: void - * @Author: DB - * @Date: 2023/5/10 18:07 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void insertOamRole(RoleBo bo) { - Role role = BeanUtils.mapToClass(bo, Role.class); - this.save(role); - //将菜单信息录入中间表 - if (!bo.getMenuIds().isEmpty()) { - List roleMenus = new ArrayList<>(); - bo.getMenuIds().forEach(item -> { - RoleMenu roleMenu = new RoleMenu(); - roleMenu.setMenuId(item); - roleMenu.setRoleId(role.getId()); - roleMenus.add(roleMenu); - }); - SpringUtils.getBean(RoleMenuService.class).saveBatch(roleMenus); - } - } - - /** - * @param bo 请求参数 - * @Description: 修改系统角色 - * @return: void - * @Author: DB - * @Date: 2023/5/10 18:07 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void updateOamRole(RoleBo bo) { - Role entity = new Role(); - BeanUtils.copyBeanProp(entity, bo); - this.updateById(entity); - //将菜单信息录入中间表 - if (!bo.getMenuIds().isEmpty()) { - //先删后存 - RoleMenuService sysRoleMenuService = SpringUtils.getBean(RoleMenuService.class); - sysRoleMenuService.remove(QueryWrapper.create() - .where(ROLE_MENU.ROLE_ID.eq(entity.getId()))); - List roleMenus = new ArrayList<>(); - bo.getMenuIds().forEach(item -> { - RoleMenu roleMenu = new RoleMenu(); - roleMenu.setMenuId(item); - roleMenu.setRoleId(entity.getId()); - roleMenus.add(roleMenu); - }); - sysRoleMenuService.saveBatch(roleMenus); - } - } - - /** - * @param id 主键 - * @Description: 删除系统角色 - * @return: void - * @Author: DB - * @Date: 2023/5/10 18:07 - **/ - @Transactional(rollbackFor = Exception.class) - @Override - public void removeOamRole(String id) { - this.removeById(id); - //删除相关联菜单 - SpringUtils.getBean(RoleMenuService.class).remove(QueryWrapper.create().where(ROLE_MENU.ROLE_ID.eq(id))); - } - - /** - * @param bo 请求参数 - * @Description: 设置角色状态 - * @return: void - * @Author: DB - * @Date: 2023/5/9 14:13 - **/ - @Override - public void setOamRoleStatus(RoleStatusBo bo) { - this.updateById(BeanUtils.mapToClass(bo, Role.class)); - } - - /** - * @descriptions 过滤掉没有权限的数据 - * @author DB - * @date 2023/10/11 17:27 - * @param list 原数据 - * @return: java.util.List - */ - @Override - public List filterAuthMenu(List list) { - if (list.isEmpty()) { - return list; - } - return recursionFilterFn(list); - } - - /** - * @descriptions 递归过滤 - * @author DB - * @date 2023/10/11 17:36 - * @param list 递归列表 - * @return: java.util.List - */ - private List recursionFilterFn(List list) { - if (!list.isEmpty()){ - list.forEach(item -> { - //判断是否是目录z - if (item.getType() == 0){ - if (null != item.getChildren()){ - recursionFilterFn(item.getChildren()); - } - }else if (item.getType() == 1){ - //是否是菜单 判断是否是目录与是否有子菜单 - if (StringUtils.isBlank(item.getPermission()) || null == item.getChildren() ){ - //当前是菜单并且没权限或子菜单为空 - list.remove(item); - } - } else if (item.getType() == 2){ - //按钮 - if(StringUtils.isBlank(item.getPermission())){ - list.remove(item); - } - } - }); - } - return list; - } -} diff --git a/Cpop-Oam/src/main/resources/mapper/MenuMapper.xml b/Cpop-Oam/src/main/resources/mapper/MenuMapper.xml deleted file mode 100644 index 6f1aadb..0000000 --- a/Cpop-Oam/src/main/resources/mapper/MenuMapper.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Cpop-Oam/src/main/resources/mapper/RoleMapper.xml b/Cpop-Oam/src/main/resources/mapper/RoleMapper.xml deleted file mode 100644 index 2a93395..0000000 --- a/Cpop-Oam/src/main/resources/mapper/RoleMapper.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Cpop-Oam/src/main/resources/mapper/RoleMenuMapper.xml b/Cpop-Oam/src/main/resources/mapper/RoleMenuMapper.xml deleted file mode 100644 index 30aafbd..0000000 --- a/Cpop-Oam/src/main/resources/mapper/RoleMenuMapper.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java index f3707ef..0d99e2d 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java @@ -19,7 +19,7 @@ import java.util.Set; * @createTime 2023/09/10 11:19 * @description */ -@Service("oamLoginService") +@Service("loginService") public class LoginServiceImpl implements LoginService { @Autowired