From 06089647364d88028d93721b49da19f8678ee527 Mon Sep 17 00:00:00 2001 From: hosinokamui Date: Thu, 19 Mar 2020 15:41:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E7=AB=AF=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 2 +- .../epmet/commons/tools/redis/RedisKeys.java | 14 ++ .../commons/tools/utils/TreeStringNode.java | 38 ++++ .../epmet/commons/tools/utils/TreeUtils.java | 25 +++ epmet-gateway/pom.xml | 4 + .../src/main/resources/bootstrap.yml | 8 + .../oper-access/oper-access-client/pom.xml | 35 ++++ .../java/com/epmet/dto/OperLanguageDTO.java | 61 ++++++ .../main/java/com/epmet/dto/OperMenuDTO.java | 115 ++++++++++++ .../java/com/epmet/dto/OperResourceDTO.java | 101 ++++++++++ .../main/java/com/epmet/dto/OperRoleDTO.java | 86 +++++++++ .../java/com/epmet/dto/OperRoleMenuDTO.java | 81 ++++++++ .../java/com/epmet/dto/OperRoleUserDTO.java | 81 ++++++++ .../java/com/epmet/dto/form/UserInfoDto.java | 49 +++++ .../com/epmet/dto/result/MenuResourceDTO.java | 29 +++ .../com/epmet/dto/result/OperMenuDTO.java | 158 ++++++++++++++++ .../java/com/epmet/enums/MenuFlagEnum.java | 36 ++++ .../java/com/epmet/enums/MenuTypeEnum.java | 36 ++++ .../java/com/epmet/enums/RegionLeafEnum.java | 29 +++ .../java/com/epmet/enums/RegionLevelEnum.java | 30 +++ .../java/com/epmet/enums/UserStatusEnum.java | 30 +++ .../oper-access/oper-access-server/pom.xml | 150 +++++++++++++++ .../java/com/epmet/AccessApplication.java | 21 +++ .../com/epmet/config/ModuleConfigImpl.java | 26 +++ .../controller/OperLanguageController.java | 94 ++++++++++ .../epmet/controller/OperMenuController.java | 101 ++++++++++ .../controller/OperResourceController.java | 94 ++++++++++ .../epmet/controller/OperRoleController.java | 94 ++++++++++ .../controller/OperRoleMenuController.java | 94 ++++++++++ .../controller/OperRoleUserController.java | 94 ++++++++++ .../java/com/epmet/dao/OperLanguageDao.java | 27 +++ .../main/java/com/epmet/dao/OperMenuDao.java | 52 ++++++ .../java/com/epmet/dao/OperResourceDao.java | 48 +++++ .../main/java/com/epmet/dao/OperRoleDao.java | 24 +++ .../java/com/epmet/dao/OperRoleMenuDao.java | 42 +++++ .../java/com/epmet/dao/OperRoleUserDao.java | 45 +++++ .../com/epmet/entity/OperLanguageEntity.java | 49 +++++ .../java/com/epmet/entity/OperMenuEntity.java | 67 +++++++ .../com/epmet/entity/OperResourceEntity.java | 57 ++++++ .../java/com/epmet/entity/OperRoleEntity.java | 46 +++++ .../com/epmet/entity/OperRoleMenuEntity.java | 37 ++++ .../com/epmet/entity/OperRoleUserEntity.java | 37 ++++ .../com/epmet/excel/OperLanguageExcel.java | 50 +++++ .../java/com/epmet/excel/OperMenuExcel.java | 74 ++++++++ .../com/epmet/excel/OperResourceExcel.java | 74 ++++++++ .../java/com/epmet/excel/OperRoleExcel.java | 65 +++++++ .../com/epmet/excel/OperRoleMenuExcel.java | 62 +++++++ .../com/epmet/excel/OperRoleUserExcel.java | 62 +++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 32 ++++ .../EpmetUserFeignClientFallback.java | 21 +++ .../com/epmet/redis/OperLanguageRedis.java | 47 +++++ .../java/com/epmet/redis/OperMenuRedis.java | 73 ++++++++ .../com/epmet/redis/OperResourceRedis.java | 47 +++++ .../com/epmet/redis/OperRoleMenuRedis.java | 47 +++++ .../java/com/epmet/redis/OperRoleRedis.java | 47 +++++ .../com/epmet/redis/OperRoleUserRedis.java | 47 +++++ .../epmet/service/OperLanguageService.java | 95 ++++++++++ .../com/epmet/service/OperMenuService.java | 121 ++++++++++++ .../epmet/service/OperResourceService.java | 95 ++++++++++ .../epmet/service/OperRoleMenuService.java | 95 ++++++++++ .../com/epmet/service/OperRoleService.java | 95 ++++++++++ .../epmet/service/OperRoleUserService.java | 95 ++++++++++ .../service/impl/OperLanguageServiceImpl.java | 104 +++++++++++ .../service/impl/OperMenuServiceImpl.java | 173 ++++++++++++++++++ .../service/impl/OperResourceServiceImpl.java | 104 +++++++++++ .../service/impl/OperRoleMenuServiceImpl.java | 104 +++++++++++ .../service/impl/OperRoleServiceImpl.java | 104 +++++++++++ .../service/impl/OperRoleUserServiceImpl.java | 104 +++++++++++ .../src/main/resources/bootstrap.yml | 102 +++++++++++ .../main/resources/i18n/messages.properties | 1 + .../resources/i18n/messages_en_US.properties | 1 + .../resources/i18n/messages_zh_CN.properties | 1 + .../resources/i18n/messages_zh_TW.properties | 1 + .../main/resources/i18n/validation.properties | 1 + .../i18n/validation_en_US.properties | 1 + .../i18n/validation_zh_CN.properties | 1 + .../i18n/validation_zh_TW.properties | 1 + .../src/main/resources/logback-spring.xml | 159 ++++++++++++++++ .../main/resources/mapper/OperLanguageDao.xml | 16 ++ .../src/main/resources/mapper/OperMenuDao.xml | 42 +++++ .../main/resources/mapper/OperResourceDao.xml | 25 +++ .../src/main/resources/mapper/OperRoleDao.xml | 6 + .../main/resources/mapper/OperRoleMenuDao.xml | 18 ++ .../main/resources/mapper/OperRoleUserDao.xml | 21 +++ epmet-module/oper-access/pom.xml | 20 ++ epmet-module/pom.xml | 1 + .../main/java/com/epmet/dto/OperUserDTO.java | 126 +++++++++++++ .../epmet/controller/OperUserController.java | 109 +++++++++++ .../main/java/com/epmet/dao/OperUserDao.java | 39 ++++ .../java/com/epmet/entity/OperUserEntity.java | 96 ++++++++++ .../java/com/epmet/excel/OperUserExcel.java | 89 +++++++++ .../java/com/epmet/redis/OperUserRedis.java | 47 +++++ .../com/epmet/service/OperUserService.java | 102 +++++++++++ .../service/impl/OperUserServiceImpl.java | 111 +++++++++++ .../src/main/resources/mapper/OperUserDao.xml | 37 ++++ 95 files changed, 5557 insertions(+), 1 deletion(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java create mode 100644 epmet-module/oper-access/oper-access-client/pom.xml create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java create mode 100644 epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java create mode 100644 epmet-module/oper-access/oper-access-server/pom.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml create mode 100644 epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml create mode 100644 epmet-module/oper-access/pom.xml create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index c605d010dc..7eabb4ea78 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://47.104.224.45:3308/epmet_oper_crm?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://47.104.224.45:3308/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epmet password: elink@833066 #oracle配置 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 1d8e7df2e3..c6c09162dd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -61,6 +61,13 @@ public class RedisKeys { return rootPrefix.concat("sys:user:nav:").concat(String.valueOf(userId)).concat("_").concat(language); } + /** + * 用户菜单导航Key + */ + public static String getUserMenuNavKey(String userId, String app, String client, String language) { + return rootPrefix.concat("oper:access:nav:").concat(userId).concat("_").concat(app).concat("_").concat(client).concat("_").concat(language); + } + /** * 用户菜单导航Key */ @@ -75,6 +82,13 @@ public class RedisKeys { return rootPrefix.concat("sys:user:permissions:").concat(String.valueOf(userId)); } + /** + * 用户权限标识Key + */ + public static String getUserPermissionsKey(String userId, String app, String client) { + return rootPrefix.concat("oper:access:permissions:").concat(userId).concat("_").concat(app).concat("_").concat(client); + } + /** * epmet用户token对应redis中的Key * epmet:sys:security:user:token字符串 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java new file mode 100644 index 0000000000..53713e032c --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeStringNode.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.utils; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 树节点,所有需要实现树节点的,都需要继承该类 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +public class TreeStringNode implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + private String id; + /** + * 上级ID + */ + private String pid; + /** + * 子节点列表 + */ + private List children = new ArrayList<>(); +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java index 3c365c5dbe..b78c8317ef 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/TreeUtils.java @@ -77,4 +77,29 @@ public class TreeUtils { return result; } + /** + * 构建树节点 + */ + public static List buildTree(List treeNodes) { + List result = new ArrayList<>(); + + //list转map + Map nodeMap = new LinkedHashMap<>(treeNodes.size()); + for(T treeNode : treeNodes){ + nodeMap.put(treeNode.getId(), treeNode); + } + + for(T node : nodeMap.values()) { + T parent = nodeMap.get(node.getPid()); + if(parent != null && !(node.getId().equals(parent.getId()))){ + parent.getChildren().add(node); + continue; + } + + result.add(node); + } + + return result; + } + } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 422afe3e93..9f743f6aee 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -135,6 +135,8 @@ http://127.0.0.1:8092 + + http://127.0.0.1:8093 @@ -186,6 +188,8 @@ lb://resi-guid-server lb://gov-org-server + + lb://oper-access-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 59fef1536a..efb7537572 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -130,6 +130,14 @@ spring: - Path=${server.servlet.context-path}/gov/org/** filters: - StripPrefix=1 + #运营端访问权限控制 + - id: oper-access-server + uri: @gateway.routes.oper-access-server.uri@ + order: 14 + predicates: + - Path=${server.servlet.context-path}/oper/access/** + filters: + - StripPrefix=1 nacos: discovery: server-addr: @nacos.server-addr@ diff --git a/epmet-module/oper-access/oper-access-client/pom.xml b/epmet-module/oper-access/oper-access-client/pom.xml new file mode 100644 index 0000000000..f0572d0e8d --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/pom.xml @@ -0,0 +1,35 @@ + + + + oper-access + com.epmet + 2.0.0 + + 4.0.0 + + oper-access-client + jar + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java new file mode 100644 index 0000000000..506e1885b6 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperLanguageDTO.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperLanguageDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 表名 + */ + private String tableName; + + /** + * 表主键 + */ + private String tableId; + + /** + * 字段名 + */ + private String fieldName; + + /** + * 字段值 + */ + private String fieldValue; + + /** + * 语言 + */ + private String language; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java new file mode 100644 index 0000000000..59089f00ff --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperMenuDTO.java @@ -0,0 +1,115 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import com.epmet.commons.tools.utils.TreeStringNode; +import com.epmet.dto.result.MenuResourceDTO; +import lombok.Data; + + +/** + * 菜单管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperMenuDTO extends TreeStringNode implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 上级ID,一级菜单为0 + */ + private String pid; + + /** + * 菜单URL + */ + private String url; + + /** + * 类型 0:菜单 1:按钮 + */ + private Integer type; + + /** + * 菜单图标 + */ + private String icon; + + /** + * 权限标识,如:sys:menu:save + */ + private String permissions; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 菜单资源 + */ + private List resourceList; + + /** + * 上级菜单名称 + */ + private String parentName; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java new file mode 100644 index 0000000000..9a1cd25769 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperResourceDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperResourceDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 资源编码,如菜单ID + */ + private String resourceCode; + + /** + * 资源名称 + */ + private String resourceName; + + /** + * 资源URL + */ + private String resourceUrl; + + /** + * 请求方式(如:GET、POST、PUT、DELETE) + */ + private String resourceMethod; + + /** + * 菜单标识 0:非菜单资源 1:菜单资源 + */ + private Integer menuFlag; + + /** + * 认证等级 0:权限认证 1:登录认证 2:无需认证 + */ + private Integer authLevel; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java new file mode 100644 index 0000000000..b8710f2c47 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 角色名称 + */ + private String name; + + /** + * 备注 + */ + private String remark; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java new file mode 100644 index 0000000000..334ef8cf38 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleMenuDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleMenuDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 菜单ID + */ + private String menuId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java new file mode 100644 index 0000000000..51bd851cc2 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/OperRoleUserDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleUserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 用户ID + */ + private String userId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java new file mode 100644 index 0000000000..faa2fc297a --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/form/UserInfoDto.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * + * 用户信息token + * + * @author zhaoqifeng + * @date 2020/3/18 10:23 + */ +@Data +public class UserInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 政府端:gov、居民端:resi、运营端:oper + */ + private String app; + + /** + * PC端:web、微信小程序:wxmp + */ + private String client; + + /** + * 用户ID + */ + private String userId; + + /** + * openId + */ + private String openId; + + /** + * unionId + */ + private String unionId; + + /** + * 超级管理员 0:否 1:是 + */ + private Integer superAdmin; + +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java new file mode 100644 index 0000000000..86df7d55ca --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/MenuResourceDTO.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dto.result; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 菜单资源 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@ApiModel(value = "菜单资源") +public class MenuResourceDTO { + @ApiModelProperty(value = "资源URL") + private String resourceUrl; + @ApiModelProperty(value = "请求方式(如:GET、POST、PUT、DELETE)") + private String resourceMethod; + +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java new file mode 100644 index 0000000000..41f02723df --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/dto/result/OperMenuDTO.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dto.result; + +import com.epmet.commons.tools.utils.TreeNode; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 菜单管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@ApiModel(value = "菜单管理") +public class OperMenuDTO extends TreeNode implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "id") + @Null(message="{id.null}", groups = AddGroup.class) + @NotNull(message="{id.require}", groups = UpdateGroup.class) + private Long id; + + @ApiModelProperty(value = "上级ID") + @NotNull(message="{sysmenu.pid.require}", groups = DefaultGroup.class) + private Long pid; + + @ApiModelProperty(value = "菜单名称") + @NotBlank(message="{sysmenu.name.require}", groups = DefaultGroup.class) + private String name; + + @ApiModelProperty(value = "菜单URL") + private String url; + + @ApiModelProperty(value = "类型 0:菜单 1:按钮") + @Range(min=0, max=1, message = "{sysmenu.type.range}", groups = DefaultGroup.class) + private Integer type; + + @ApiModelProperty(value = "菜单图标") + private String icon; + + @ApiModelProperty(value = "权限标识,如:sys:menu:save") + private String permissions; + + @ApiModelProperty(value = "排序") + @Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class) + private Integer sort; + + @ApiModelProperty(value = "创建时间") + @JsonProperty(access = JsonProperty.Access.READ_ONLY) + private Date createDate; + + @ApiModelProperty(value = "菜单资源") + private List resourceList; + + @ApiModelProperty(value = "上级菜单名称") + private String parentName; + + public void setName(String name) { + this.name = name; + } + public String getName() { + return name; + } + public void setUrl(String url) { + this.url = url; + } + public String getUrl() { + return url; + } + public void setType(Integer type) { + this.type = type; + } + public Integer getType() { + return type; + } + public void setIcon(String icon) { + this.icon = icon; + } + public String getIcon() { + return icon; + } + public void setSort(Integer sort) { + this.sort = sort; + } + public Integer getSort() { + return sort; + } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + public Date getCreateDate() { + return createDate; + } + + public String getPermissions() { + return permissions; + } + + public void setPermissions(String permissions) { + this.permissions = permissions; + } + + public List getResourceList() { + return resourceList; + } + + public void setResourceList(List resourceList) { + this.resourceList = resourceList; + } + + @Override + public Long getId() { + return id; + } + + @Override + public void setId(Long id) { + this.id = id; + } + + @Override + public Long getPid() { + return pid; + } + + @Override + public void setPid(Long pid) { + this.pid = pid; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java new file mode 100644 index 0000000000..2a880a728a --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuFlagEnum.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.enums; + +/** + * 菜单资源标识 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public enum MenuFlagEnum { + /** + * 菜单资源 + */ + YES(1), + /** + * 非菜单资源 + */ + NO(0); + + private int value; + + MenuFlagEnum(int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java new file mode 100644 index 0000000000..7132fa2ce3 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/MenuTypeEnum.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.enums; + +/** + * 菜单类型枚举 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public enum MenuTypeEnum { + /** + * 菜单 + */ + MENU(0), + /** + * 按钮 + */ + BUTTON(1); + + private int value; + + MenuTypeEnum(int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java new file mode 100644 index 0000000000..36300e201f --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLeafEnum.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.enums; + +/** + * 叶子节点枚举 + * + * @author Mark sunlightcs@gmail.com + */ +public enum RegionLeafEnum { + YES(1), + NO(0); + + private int value; + + RegionLeafEnum(int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java new file mode 100644 index 0000000000..b29c456897 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/RegionLevelEnum.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2019 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.enums; + +/** + * 行政区域 级别枚举 + * + * @author Mark sunlightcs@gmail.com + */ +public enum RegionLevelEnum { + ONE(1), + TWO(2), + THREE(3); + + private int value; + + RegionLevelEnum(int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java new file mode 100644 index 0000000000..dbc043f529 --- /dev/null +++ b/epmet-module/oper-access/oper-access-client/src/main/java/com/epmet/enums/UserStatusEnum.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.enums; + +/** + * 用户状态 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public enum UserStatusEnum { + DISABLE(0), + ENABLED(1); + + private int value; + + UserStatusEnum(int value) { + this.value = value; + } + + public int value() { + return this.value; + } +} diff --git a/epmet-module/oper-access/oper-access-server/pom.xml b/epmet-module/oper-access/oper-access-server/pom.xml new file mode 100644 index 0000000000..f21c4ae64c --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/pom.xml @@ -0,0 +1,150 @@ + + + + oper-access + com.epmet + 2.0.0 + + 4.0.0 + + oper-access-server + jar + + + + com.epmet + oper-access-client + 2.0.0 + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + com.epmet + epmet-user-client + 2.0.0 + compile + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + dev + + true + + + 8093 + dev + + + + + + epmet + elink@833066 + + 0 + 122.152.200.70 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + test + + + 8093 + test + + + + + + epmet + elink@833066 + + 0 + 122.152.200.70 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java new file mode 100644 index 0000000000..5b61001f1f --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java @@ -0,0 +1,21 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * 管理后台 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class AccessApplication { + public static void main(String[] args) { + SpringApplication.run(AccessApplication.class, args); + } +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..5415a86538 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-新闻公告模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "access"; + } +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java new file mode 100644 index 0000000000..af0772f36d --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperLanguageController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperLanguageDTO; +import com.epmet.excel.OperLanguageExcel; +import com.epmet.service.OperLanguageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("operlanguage") +public class OperLanguageController { + + @Autowired + private OperLanguageService operLanguageService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operLanguageService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperLanguageDTO data = operLanguageService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperLanguageDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operLanguageService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperLanguageDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operLanguageService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operLanguageService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operLanguageService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperLanguageExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java new file mode 100644 index 0000000000..18dd90918a --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java @@ -0,0 +1,101 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.form.UserInfoDto; +import com.epmet.excel.OperMenuExcel; +import com.epmet.service.OperMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * + * 菜单管理 + * + * @author zhaoqifeng + * @date 2020/3/17 16:35 + */ +@RestController +@RequestMapping("menu") +public class OperMenuController { + + @Autowired + private OperMenuService operMenuService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operMenuService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperMenuDTO data = operMenuService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperMenuDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operMenuService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperMenuDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operMenuService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operMenuService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operMenuService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperMenuExcel.class); + } + + /** + * 导航 + * @param userInfo token + * @return List + */ + @PostMapping("nav") + public Result> nav(@RequestBody UserInfoDto userInfo){ + List list = operMenuService.getUserMenuNavList(userInfo); + return new Result>().ok(list); + } + + /** + * 权限标识 + * @param userInfo token + * @return Set + */ + @PostMapping("permissions") + public Result> permissions(@RequestBody UserInfoDto userInfo){ + Set set = operMenuService.getUserPermissions(userInfo); + return new Result>().ok(set); + } +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java new file mode 100644 index 0000000000..160079f2dd --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperResourceController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperResourceDTO; +import com.epmet.excel.OperResourceExcel; +import com.epmet.service.OperResourceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("operresource") +public class OperResourceController { + + @Autowired + private OperResourceService operResourceService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operResourceService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperResourceDTO data = operResourceService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperResourceDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operResourceService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperResourceDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operResourceService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operResourceService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operResourceService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperResourceExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java new file mode 100644 index 0000000000..c7c672b951 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperRoleDTO; +import com.epmet.excel.OperRoleExcel; +import com.epmet.service.OperRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("operrole") +public class OperRoleController { + + @Autowired + private OperRoleService operRoleService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operRoleService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperRoleDTO data = operRoleService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperRoleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operRoleService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperRoleDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operRoleService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operRoleService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operRoleService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperRoleExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java new file mode 100644 index 0000000000..e4ff35888b --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleMenuController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperRoleMenuDTO; +import com.epmet.excel.OperRoleMenuExcel; +import com.epmet.service.OperRoleMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("operrolemenu") +public class OperRoleMenuController { + + @Autowired + private OperRoleMenuService operRoleMenuService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operRoleMenuService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperRoleMenuDTO data = operRoleMenuService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperRoleMenuDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operRoleMenuService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperRoleMenuDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operRoleMenuService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operRoleMenuService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operRoleMenuService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperRoleMenuExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java new file mode 100644 index 0000000000..ccc4c56920 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperRoleUserController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperRoleUserDTO; +import com.epmet.excel.OperRoleUserExcel; +import com.epmet.service.OperRoleUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("operroleuser") +public class OperRoleUserController { + + @Autowired + private OperRoleUserService operRoleUserService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operRoleUserService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperRoleUserDTO data = operRoleUserService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperRoleUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operRoleUserService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperRoleUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operRoleUserService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operRoleUserService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operRoleUserService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperRoleUserExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java new file mode 100644 index 0000000000..d681d328c3 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperLanguageDao.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperLanguageEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 国际化 + * + * @author Mark sunlightcs@gmail.com + */ +@Mapper +public interface OperLanguageDao extends BaseDao { + + OperLanguageEntity getLanguage(OperLanguageEntity entity); + + void updateLanguage(OperLanguageEntity entity); + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java new file mode 100644 index 0000000000..2858a76f24 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperMenuDao.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperMenuEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 菜单管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Mapper +public interface OperMenuDao extends BaseDao { + + OperMenuEntity getById(@Param("id") String id, @Param("language") String language); + + /** + * 查询所有菜单列表 + * + * @param type 菜单类型 + * @param language 语言 + */ + List getMenuList(@Param("type") Integer type, @Param("language") String language); + + /** + * 查询用户菜单列表 + * + * @param userId 用户ID + * @param type 菜单类型 + * @param language 语言 + */ + List getUserMenuList(@Param("userId") String userId, @Param("type") Integer type, @Param("language") String language); + + + /** + * 根据父菜单,查询子菜单 + * @param pid 父菜单ID + */ + List getListPid(String pid); +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java new file mode 100644 index 0000000000..b92caee0d7 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperResourceDao.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperResourceEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 资源管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Mapper +public interface OperResourceDao extends BaseDao { + /** + * 根据资源编码,删除对应的资源 + * @param code 资源编码 + */ + void deleteByCode(String code); + + /** + * 获取资源列表 + * @param menuId 菜单ID + */ + List getMenuResourceList(String menuId); + + /** + * 获取所有资源列表 + */ + List getResourceList(); + + /** + * 获取用户资源列表 + * @param userId 用户ID + */ + List getUserResourceList(@Param("userId") String userId); +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java new file mode 100644 index 0000000000..408a5275f5 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleDao.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperRoleEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Mapper +public interface OperRoleDao extends BaseDao { + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java new file mode 100644 index 0000000000..5e915925a4 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleMenuDao.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperRoleMenuEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 角色菜单关系 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Mapper +public interface OperRoleMenuDao extends BaseDao { + + /** + * 根据角色ID,获取菜单ID列表 + */ + List getMenuIdList(String roleId); + + /** + * 根据角色id,删除角色菜单关系 + * @param roleId 角色id + */ + void deleteByRoleId(String roleId); + + /** + * 根据菜单id,删除角色菜单关系 + * @param menuId 菜单id + */ + void deleteByMenuId(String menuId); +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java new file mode 100644 index 0000000000..4741b5b91a --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/dao/OperRoleUserDao.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperRoleUserEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 角色用户关系 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Mapper +public interface OperRoleUserDao extends BaseDao { + + /** + * 根据角色ids,删除角色用户关系 + * @param roleIds 角色ids + */ + void deleteByRoleIds(String[] roleIds); + + /** + * 根据用户id,删除角色用户关系 + * @param userId 用户id + */ + void deleteByUserId(String userId); + + /** + * 角色ID列表 + * @param userId 用户ID + * + * @return + */ + List getRoleIdList(String userId); +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java new file mode 100644 index 0000000000..685c9fdd29 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperLanguageEntity.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * 国际化 + * + * @author Mark sunlightcs@gmail.com + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_language") +public class OperLanguageEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 表名 + */ + private String tableName; + /** + * 表主键 + */ + private String tableId; + /** + * 字段名 + */ + private String fieldName; + /** + * 字段值 + */ + private String fieldValue; + /** + * 语言 + */ + private String language; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java new file mode 100644 index 0000000000..dd5b161730 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperMenuEntity.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 菜单管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_menu") +public class OperMenuEntity extends BaseEpmetEntity { + private static final long serialVersionUID = 1L; + + /** + * 上级ID,一级菜单为0 + */ + private String pid; + /** + * 菜单名称 + */ + @TableField(exist = false) + private String name; + /** + * 菜单URL + */ + private String url; + /** + * 类型 0:菜单 1:按钮 + */ + private Integer type; + /** + * 菜单图标 + */ + private String icon; + /** + * 权限标识,如:sys:menu:save + */ + private String permissions; + /** + * 排序 + */ + private Integer sort; + /** + * 上级菜单名称 + */ + @TableField(exist = false) + private String parentName; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java new file mode 100644 index 0000000000..19d5718d0a --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperResourceEntity.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 资源管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_resource") +public class OperResourceEntity extends BaseEpmetEntity { + private static final long serialVersionUID = 1L; + + /** + * 资源编码,如菜单ID + */ + private String resourceCode; + /** + * 资源名称 + */ + private String resourceName; + /** + * 资源URL + */ + private String resourceUrl; + /** + * 请求方式(如:GET、POST、PUT、DELETE) + */ + private String resourceMethod; + /** + * 菜单标识 0:非菜单资源 1:菜单资源 + */ + private Integer menuFlag; + /** + * 认证等级 0:权限认证 1:登录认证 2:无需认证 + */ + private Integer authLevel; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java new file mode 100644 index 0000000000..18b34f123f --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleEntity.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 角色管理 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_role") +public class OperRoleEntity extends BaseEpmetEntity { + private static final long serialVersionUID = 1L; + + /** + * 角色名称 + */ + private String name; + /** + * 备注 + */ + private String remark; + /** + * 部门ID + */ + @TableField(fill = FieldFill.INSERT) + private Long deptId; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java new file mode 100644 index 0000000000..f467f8ace2 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleMenuEntity.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEntity; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色菜单关系 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_role_menu") +public class OperRoleMenuEntity extends BaseEpmetEntity { + private static final long serialVersionUID = 1L; + /** + * 角色ID + */ + private String roleId; + /** + * 菜单ID + */ + private String menuId; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java new file mode 100644 index 0000000000..4cf1925259 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/entity/OperRoleUserEntity.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色用户关系 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("sys_role_user") +public class OperRoleUserEntity extends BaseEpmetEntity { + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + private String roleId; + /** + * 用户ID + */ + private String userId; + +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java new file mode 100644 index 0000000000..13c8cc8ccf --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperLanguageExcel.java @@ -0,0 +1,50 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperLanguageExcel { + + @Excel(name = "表名") + private String tableName; + + @Excel(name = "表主键") + private String tableId; + + @Excel(name = "字段名") + private String fieldName; + + @Excel(name = "字段值") + private String fieldValue; + + @Excel(name = "语言") + private String language; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java new file mode 100644 index 0000000000..883591d105 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperMenuExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 菜单管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperMenuExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "上级ID,一级菜单为0") + private String pid; + + @Excel(name = "菜单URL") + private String url; + + @Excel(name = "类型 0:菜单 1:按钮") + private Integer type; + + @Excel(name = "菜单图标") + private String icon; + + @Excel(name = "权限标识,如:sys:menu:save") + private String permissions; + + @Excel(name = "排序") + private Integer sort; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private Integer delFlag; + + @Excel(name = "创建者") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java new file mode 100644 index 0000000000..5365542ada --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperResourceExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperResourceExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "资源编码,如菜单ID") + private String resourceCode; + + @Excel(name = "资源名称") + private String resourceName; + + @Excel(name = "资源URL") + private String resourceUrl; + + @Excel(name = "请求方式(如:GET、POST、PUT、DELETE)") + private String resourceMethod; + + @Excel(name = "菜单标识 0:非菜单资源 1:菜单资源") + private Integer menuFlag; + + @Excel(name = "认证等级 0:权限认证 1:登录认证 2:无需认证") + private Integer authLevel; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private Integer delFlag; + + @Excel(name = "创建者") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java new file mode 100644 index 0000000000..f7b5ebf4bc --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleExcel.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "角色名称") + private String name; + + @Excel(name = "备注") + private String remark; + + @Excel(name = "部门ID") + private Long deptId; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private Integer delFlag; + + @Excel(name = "创建者") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java new file mode 100644 index 0000000000..de81137dd3 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleMenuExcel.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleMenuExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "菜单ID") + private String menuId; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private Integer delFlag; + + @Excel(name = "创建者") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java new file mode 100644 index 0000000000..86a8e6846e --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/excel/OperRoleUserExcel.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperRoleUserExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "删除标识 0:未删除 1:删除") + private Integer delFlag; + + @Excel(name = "创建者") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java new file mode 100644 index 0000000000..f84f6002a6 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,32 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.OperUserDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +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 org.springframework.web.bind.annotation.RequestParam; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/3/19 9:32 + */ +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, path="/epmetuser", fallback = EpmetUserFeignClientFallback.class) +public interface EpmetUserFeignClient { + + /** + * + * 根据id查询运营人员详情 + * + * @param id ID + * @return com.epmet.commons.tools.utils.Result> + * @author zhaoqifeng + * @date 2020/3/19 09:28 + **/ + @PostMapping("/user/info/") + Result info(@RequestBody String id); +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java new file mode 100644 index 0000000000..067e5ca5a8 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -0,0 +1,21 @@ +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.OperUserDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +/** + * 用户模块 + * @author zhaoqifeng + * @date 2020/3/19 9:34 + */ +@Component +public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result info(String id) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "info",id); + } +} diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java new file mode 100644 index 0000000000..fa479f92ca --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperLanguageRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperLanguageRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java new file mode 100644 index 0000000000..d86846c7d8 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperMenuRedis.java @@ -0,0 +1,73 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.HttpContextUtils; +import com.epmet.dto.OperMenuDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Set; + +/** + * 菜单管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperMenuRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + + public void setUserMenuNavList(String userId, String app, String client, List menuList){ + String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage()); + redisUtils.set(key, menuList); + } + + public List getUserMenuNavList(String userId, String app, String client){ + String key = RedisKeys.getUserMenuNavKey(userId, app, client, HttpContextUtils.getLanguage()); + return (List)redisUtils.get(key); + } + + public void setUserPermissions(String userId, String app, String client, Set permsSet){ + String key = RedisKeys.getUserPermissionsKey(userId, app, client); + redisUtils.set(key, permsSet); + } + + public Set getUserPermissions(String userId, String app, String client){ + String key = RedisKeys.getUserPermissionsKey(userId, app, client); + return (Set)redisUtils.get(key); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java new file mode 100644 index 0000000000..4c79c26170 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperResourceRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperResourceRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java new file mode 100644 index 0000000000..28f98c5615 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleMenuRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperRoleMenuRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java new file mode 100644 index 0000000000..15e6682155 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperRoleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java new file mode 100644 index 0000000000..7f6df90fa3 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/redis/OperRoleUserRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperRoleUserRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java new file mode 100644 index 0000000000..366c48bd0b --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperLanguageService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperLanguageDTO; +import com.epmet.entity.OperLanguageEntity; + +import java.util.List; +import java.util.Map; + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperLanguageService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperLanguageDTO + * @author generator + * @date 2020-03-18 + */ + OperLanguageDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperLanguageDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperLanguageDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java new file mode 100644 index 0000000000..148ddc55f7 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperMenuService.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.UserDetail; +import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.form.UserInfoDto; +import com.epmet.entity.OperMenuEntity; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 菜单管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperMenuService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperMenuDTO + * @author generator + * @date 2020-03-18 + */ + OperMenuDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperMenuDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperMenuDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); + + /** + * 用户菜单列表 + * + * @param userInfo 用户信息 + * @param type 菜单类型 + * @return java.util.List + */ + List getUserMenuList(UserInfoDto userInfo, Integer type); + + /** + * 用户菜单导航 + * @param userInfo 用户信息 + * @return java.util.List + */ + List getUserMenuNavList(UserInfoDto userInfo); + + /** + * 获取用户权限标识 + * @param userInfo 用户信息 + * @return java.util.Set + */ + Set getUserPermissions(UserInfoDto userInfo); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java new file mode 100644 index 0000000000..1433da0ac6 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperResourceService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperResourceDTO; +import com.epmet.entity.OperResourceEntity; + +import java.util.List; +import java.util.Map; + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperResourceService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperResourceDTO + * @author generator + * @date 2020-03-18 + */ + OperResourceDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperResourceDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperResourceDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java new file mode 100644 index 0000000000..20510c8edc --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleMenuService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperRoleMenuDTO; +import com.epmet.entity.OperRoleMenuEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperRoleMenuService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperRoleMenuDTO + * @author generator + * @date 2020-03-18 + */ + OperRoleMenuDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperRoleMenuDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperRoleMenuDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java new file mode 100644 index 0000000000..b4368ca747 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperRoleDTO; +import com.epmet.entity.OperRoleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperRoleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperRoleDTO + * @author generator + * @date 2020-03-18 + */ + OperRoleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperRoleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperRoleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java new file mode 100644 index 0000000000..f569984008 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/OperRoleUserService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperRoleUserDTO; +import com.epmet.entity.OperRoleUserEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperRoleUserService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperRoleUserDTO + * @author generator + * @date 2020-03-18 + */ + OperRoleUserDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperRoleUserDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperRoleUserDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java new file mode 100644 index 0000000000..3ff21c04c1 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperLanguageServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperLanguageDao; +import com.epmet.dto.OperLanguageDTO; +import com.epmet.entity.OperLanguageEntity; +import com.epmet.redis.OperLanguageRedis; +import com.epmet.service.OperLanguageService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 国际化 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperLanguageServiceImpl extends BaseServiceImpl implements OperLanguageService { + + @Autowired + private OperLanguageRedis operLanguageRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperLanguageDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperLanguageDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperLanguageDTO get(String id) { + OperLanguageEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperLanguageDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperLanguageDTO dto) { + OperLanguageEntity entity = ConvertUtils.sourceToTarget(dto, OperLanguageEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperLanguageDTO dto) { + OperLanguageEntity entity = ConvertUtils.sourceToTarget(dto, OperLanguageEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java new file mode 100644 index 0000000000..4e7becdeea --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperMenuServiceImpl.java @@ -0,0 +1,173 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.enums.SuperAdminEnum; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.HttpContextUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.TreeUtils; +import com.epmet.dao.OperMenuDao; +import com.epmet.dto.OperMenuDTO; +import com.epmet.dto.OperUserDTO; +import com.epmet.dto.form.UserInfoDto; +import com.epmet.entity.OperMenuEntity; +import com.epmet.enums.MenuTypeEnum; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.redis.OperMenuRedis; +import com.epmet.service.OperMenuService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; + +/** + * 菜单管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperMenuServiceImpl extends BaseServiceImpl implements OperMenuService { + + @Autowired + private OperMenuRedis operMenuRedis; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperMenuDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperMenuDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperMenuDTO get(String id) { + OperMenuEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperMenuDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperMenuDTO dto) { + OperMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperMenuEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperMenuDTO dto) { + OperMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperMenuEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List getUserMenuList(UserInfoDto userInfo, Integer type) { + List menuList; + + Result operUserDTOResult = epmetUserFeignClient.info(userInfo.getUserId()); + + //系统管理员,拥有最高权限 + if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){ + menuList = baseDao.getMenuList(type, HttpContextUtils.getLanguage()); + }else { + menuList = baseDao.getUserMenuList(userInfo.getUserId(), type, HttpContextUtils.getLanguage()); + } + + List dtoList = ConvertUtils.sourceToTarget(menuList, OperMenuDTO.class); + + return TreeUtils.buildTree(dtoList); + } + + @Override + public List getUserMenuNavList(UserInfoDto userInfo) { + List menuList = operMenuRedis.getUserMenuNavList(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient()); + if(menuList == null){ + menuList = getUserMenuList(userInfo, MenuTypeEnum.MENU.value()); + + operMenuRedis.setUserMenuNavList(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient(), menuList); + } + + return menuList; + } + + @Override + public Set getUserPermissions(UserInfoDto userInfo) { + //用户权限列表 + Set permsSet = operMenuRedis.getUserPermissions(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient()); + if(permsSet != null){ + return permsSet; + } + + Result operUserDTOResult = epmetUserFeignClient.info(userInfo.getUserId()); + + //超级管理员,拥有最高权限 + List menuList; + if(operUserDTOResult.getData().getSuperAdmin() == SuperAdminEnum.YES.value()){ + menuList = baseDao.getMenuList(MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage()); + }else{ + menuList = baseDao.getUserMenuList(userInfo.getUserId(), MenuTypeEnum.BUTTON.value(), HttpContextUtils.getLanguage()); + } + + permsSet = new HashSet<>(); + for(OperMenuEntity menu : menuList){ + if(StringUtils.isNotBlank(menu.getPermissions())){ + permsSet.add(menu.getPermissions()); + } + } + + //保存到缓存 + operMenuRedis.setUserPermissions(userInfo.getUserId(), userInfo.getApp(), userInfo.getClient(), permsSet); + + return permsSet; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java new file mode 100644 index 0000000000..89abe6aae8 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperResourceServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperResourceDao; +import com.epmet.dto.OperResourceDTO; +import com.epmet.entity.OperResourceEntity; +import com.epmet.redis.OperResourceRedis; +import com.epmet.service.OperResourceService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 资源管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperResourceServiceImpl extends BaseServiceImpl implements OperResourceService { + + @Autowired + private OperResourceRedis operResourceRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperResourceDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperResourceDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperResourceDTO get(String id) { + OperResourceEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperResourceDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperResourceDTO dto) { + OperResourceEntity entity = ConvertUtils.sourceToTarget(dto, OperResourceEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperResourceDTO dto) { + OperResourceEntity entity = ConvertUtils.sourceToTarget(dto, OperResourceEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java new file mode 100644 index 0000000000..75c5d30419 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleMenuServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperRoleMenuDao; +import com.epmet.dto.OperRoleMenuDTO; +import com.epmet.entity.OperRoleMenuEntity; +import com.epmet.redis.OperRoleMenuRedis; +import com.epmet.service.OperRoleMenuService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色菜单关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperRoleMenuServiceImpl extends BaseServiceImpl implements OperRoleMenuService { + + @Autowired + private OperRoleMenuRedis operRoleMenuRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperRoleMenuDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperRoleMenuDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperRoleMenuDTO get(String id) { + OperRoleMenuEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperRoleMenuDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperRoleMenuDTO dto) { + OperRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleMenuEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperRoleMenuDTO dto) { + OperRoleMenuEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleMenuEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java new file mode 100644 index 0000000000..323400975c --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperRoleDao; +import com.epmet.dto.OperRoleDTO; +import com.epmet.entity.OperRoleEntity; +import com.epmet.redis.OperRoleRedis; +import com.epmet.service.OperRoleService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色管理 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperRoleServiceImpl extends BaseServiceImpl implements OperRoleService { + + @Autowired + private OperRoleRedis operRoleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperRoleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperRoleDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperRoleDTO get(String id) { + OperRoleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperRoleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperRoleDTO dto) { + OperRoleEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperRoleDTO dto) { + OperRoleEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java new file mode 100644 index 0000000000..806a9232f7 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/service/impl/OperRoleUserServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperRoleUserDao; +import com.epmet.dto.OperRoleUserDTO; +import com.epmet.entity.OperRoleUserEntity; +import com.epmet.redis.OperRoleUserRedis; +import com.epmet.service.OperRoleUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色用户关系 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperRoleUserServiceImpl extends BaseServiceImpl implements OperRoleUserService { + + @Autowired + private OperRoleUserRedis operRoleUserRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperRoleUserDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperRoleUserDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperRoleUserDTO get(String id) { + OperRoleUserEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperRoleUserDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperRoleUserDTO dto) { + OperRoleUserEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleUserEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperRoleUserDTO dto) { + OperRoleUserEntity entity = ConvertUtils.sourceToTarget(dto, OperRoleUserEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml b/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..81856afde2 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml @@ -0,0 +1,102 @@ +server: + port: @server.port@ + servlet: + context-path: /oper/access + +spring: + application: + name: oper-access-server + #环境 dev|test|prod + profiles: + active: dev + messages: + encoding: UTF-8 + basename: i18n/messages,i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml + #指定共享配置,且支持动态刷新 +# ext-config: +# - data-id: datasource.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +# - data-id: common.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + max-connections: 200 + max-connections-per-route: 50 + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000..a7091dbb43 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages.properties @@ -0,0 +1 @@ +#Default diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties new file mode 100644 index 0000000000..9e895e4281 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_en_US.properties @@ -0,0 +1 @@ +#English diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties new file mode 100644 index 0000000000..b21fd22eca --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_CN.properties @@ -0,0 +1 @@ +#\u7B80\u4F53\u4E2D\u6587 diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties new file mode 100644 index 0000000000..4433dba45a --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/messages_zh_TW.properties @@ -0,0 +1 @@ +#\u7E41\u4F53\u4E2D\u6587 diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties new file mode 100644 index 0000000000..56ca909c46 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation.properties @@ -0,0 +1 @@ +#Default \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties new file mode 100644 index 0000000000..9e895e4281 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_en_US.properties @@ -0,0 +1 @@ +#English diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties new file mode 100644 index 0000000000..b21fd22eca --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_CN.properties @@ -0,0 +1 @@ +#\u7B80\u4F53\u4E2D\u6587 diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties new file mode 100644 index 0000000000..4433dba45a --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/i18n/validation_zh_TW.properties @@ -0,0 +1 @@ +#\u7E41\u4F53\u4E2D\u6587 diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..86fc4a6979 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml new file mode 100644 index 0000000000..2b3f63c0e0 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperLanguageDao.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml new file mode 100644 index 0000000000..e3a61dbd36 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml new file mode 100644 index 0000000000..3cf44a3346 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperResourceDao.xml @@ -0,0 +1,25 @@ + + + + + + + delete from oper_resource where resource_code = #{value} + + + + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml new file mode 100644 index 0000000000..e1df3a1038 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleDao.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml new file mode 100644 index 0000000000..601c1a7f2e --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleMenuDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + delete from oper_role_menu where role_id = #{value} + + + + delete from oper_role_menu where menu_id = #{value} + + + diff --git a/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml new file mode 100644 index 0000000000..c0415f8998 --- /dev/null +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperRoleUserDao.xml @@ -0,0 +1,21 @@ + + + + + + + delete from oper_role_user where role_id in + + #{roleId} + + + + + delete from oper_role_user where user_id = #{value} + + + + + diff --git a/epmet-module/oper-access/pom.xml b/epmet-module/oper-access/pom.xml new file mode 100644 index 0000000000..2b37cef177 --- /dev/null +++ b/epmet-module/oper-access/pom.xml @@ -0,0 +1,20 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + oper-access + pom + + oper-access-client + oper-access-server + + + + \ No newline at end of file diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index 571b2fed2c..a35e85adb9 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -23,6 +23,7 @@ oper-crm resi-guide gov-org + oper-access diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java new file mode 100644 index 0000000000..5fb5e97876 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/OperUserDTO.java @@ -0,0 +1,126 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperUserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 姓名 + */ + private String realName; + + /** + * 密码 + */ + private String password; + + /** + * 头像 + */ + private String headUrl; + + /** + * 性别 0:男 1:女 2:保密 + */ + private Integer gender; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号 + */ + private String phone; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 超级管理员 0:否 1:是 + */ + private Integer superAdmin; + + /** + * 状态 0:停用 1:正常 + */ + private Integer status; + + /** + * 备注 + */ + private String remark; + + /** + * 删除标识 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java new file mode 100644 index 0000000000..d1a4f8a88e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java @@ -0,0 +1,109 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.UserDetail; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.OperUserDTO; +import com.epmet.excel.OperUserExcel; +import com.epmet.service.OperUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@RestController +@RequestMapping("user") +public class OperUserController { + + @Autowired + private OperUserService operUserService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = operUserService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + OperUserDTO data = operUserService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody OperUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + operUserService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody OperUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + operUserService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + operUserService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = operUserService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, OperUserExcel.class); + } + + /** + * 获取运营人员信息 + * @param id 主键 + * @return OperUserDTO + * @author zhaoqifeng + */ + @PostMapping("info") + public Result info(@RequestBody String id){ + OperUserDTO data = operUserService.getOperUserInfoById(id); + return new Result().ok(data); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java new file mode 100644 index 0000000000..aea4b58d61 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/OperUserDao.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.OperUserDTO; +import com.epmet.entity.OperUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Mapper +public interface OperUserDao extends BaseDao { + /** + * 根据id查询运营人员信息 + * @param id + * @return OperUserDTO + */ + OperUserDTO selectOperUserInfoById(String id); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java new file mode 100644 index 0000000000..bea7a145d2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/OperUserEntity.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("oper_user") +public class OperUserEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + private String realName; + + /** + * 密码 + */ + private String password; + + /** + * 头像 + */ + private String headUrl; + + /** + * 性别 0:男 1:女 2:保密 + */ + private Integer gender; + + /** + * 邮箱 + */ + private String email; + + /** + * 手机号 + */ + private String phone; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 超级管理员 0:否 1:是 + */ + private Integer superAdmin; + + /** + * 状态 0:停用 1:正常 + */ + private Integer status; + + /** + * 备注 + */ + private String remark; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java new file mode 100644 index 0000000000..c9a0ee7435 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/OperUserExcel.java @@ -0,0 +1,89 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Data +public class OperUserExcel { + + @Excel(name = "id") + private Long id; + + @Excel(name = "姓名") + private String realName; + + @Excel(name = "密码") + private String password; + + @Excel(name = "头像") + private String headUrl; + + @Excel(name = "性别 0:男 1:女 2:保密") + private Integer gender; + + @Excel(name = "邮箱") + private String email; + + @Excel(name = "手机号") + private String phone; + + @Excel(name = "微信openId") + private String wxOpenId; + + @Excel(name = "部门ID") + private Long deptId; + + @Excel(name = "超级管理员 0:否 1:是") + private Integer superAdmin; + + @Excel(name = "状态 0:停用 1:正常") + private Integer status; + + @Excel(name = "备注") + private String remark; + + @Excel(name = "删除标识") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java new file mode 100644 index 0000000000..ec0df3ca96 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Component +public class OperUserRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java new file mode 100644 index 0000000000..fd7b4f60e8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/OperUserService.java @@ -0,0 +1,102 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperUserDTO; +import com.epmet.entity.OperUserEntity; + +import java.util.List; +import java.util.Map; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +public interface OperUserService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperUserDTO + * @author generator + * @date 2020-03-18 + */ + OperUserDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void save(OperUserDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-18 + */ + void update(OperUserDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-18 + */ + void delete(String[] ids); + + /** + * 根据id查询运营人员信息 + * @param id 主键id + * @return + */ + OperUserDTO getOperUserInfoById(String id); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java new file mode 100644 index 0000000000..b6a4f1478d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperUserDao; +import com.epmet.dto.OperUserDTO; +import com.epmet.entity.OperUserEntity; +import com.epmet.redis.OperUserRedis; +import com.epmet.service.OperUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 运营人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-18 + */ +@Service +public class OperUserServiceImpl extends BaseServiceImpl implements OperUserService { + + @Autowired + private OperUserRedis operUserRedis; + @Autowired + private OperUserDao operUserDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperUserDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperUserDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperUserDTO get(String id) { + OperUserEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperUserDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperUserDTO dto) { + OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperUserDTO dto) { + OperUserEntity entity = ConvertUtils.sourceToTarget(dto, OperUserEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public OperUserDTO getOperUserInfoById(String id) { + return operUserDao.selectOperUserInfoById(id); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml new file mode 100644 index 0000000000..f249294836 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/OperUserDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file