├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── doc └── sql │ └── harry_20200429.sql ├── docs ├── _config.yml └── index.md ├── harry-biz ├── pom.xml └── src │ └── main │ ├── java │ └── cn │ │ └── harry │ │ ├── common │ │ ├── annotation │ │ │ ├── DataScope.java │ │ │ ├── DataSource.java │ │ │ ├── IgnoreAuth.java │ │ │ └── SysLog.java │ │ ├── api │ │ │ ├── CommonPage.java │ │ │ ├── CommonResult.java │ │ │ ├── IErrorCode.java │ │ │ └── ResultCode.java │ │ ├── constant │ │ │ └── CommonConstant.java │ │ ├── datasource │ │ │ ├── DynamicDataSource.java │ │ │ └── DynamicDataSourceContextHolder.java │ │ ├── enums │ │ │ ├── BusinessType.java │ │ │ ├── DataSourceType.java │ │ │ ├── HttpMethod.java │ │ │ └── PlatformEnums.java │ │ ├── exception │ │ │ ├── ApiException.java │ │ │ └── ApiExceptionHandler.java │ │ ├── exption │ │ │ ├── KaptchaEnum.java │ │ │ ├── SmsExceptionEnum.java │ │ │ └── SysExceptionEnum.java │ │ ├── interceptor │ │ │ └── TokenInterceptor.java │ │ ├── manager │ │ │ ├── AsyncManager.java │ │ │ └── factory │ │ │ │ └── AsyncFactory.java │ │ └── utils │ │ │ ├── Arith.java │ │ │ ├── BeanUtils.java │ │ │ ├── EncryptUtils.java │ │ │ ├── FileUtil.java │ │ │ ├── IdsParam.java │ │ │ ├── IdsStrParam.java │ │ │ ├── IpAddressUtil.java │ │ │ ├── JsonUtil.java │ │ │ ├── JwtTokenUtil.java │ │ │ ├── NumberGenUtils.java │ │ │ ├── OkHttpUtil.java │ │ │ ├── RedisKeys.java │ │ │ ├── RedisUtils.java │ │ │ ├── SecurityUtils.java │ │ │ ├── ServletUtils.java │ │ │ ├── SpringUtils.java │ │ │ ├── StringUtils.java │ │ │ ├── SysUserDetails.java │ │ │ ├── SysUserUtils.java │ │ │ ├── Threads.java │ │ │ └── TreeUtils.java │ │ ├── component │ │ └── aspect │ │ │ ├── DataScopeAspect.java │ │ │ ├── DataSourceAspect.java │ │ │ └── WebLogAspect.java │ │ ├── config │ │ ├── DruidConfig.java │ │ ├── DruidProperties.java │ │ ├── KaptchaConfig.java │ │ ├── MybatisPlusConfig.java │ │ ├── OkHttpConfig.java │ │ ├── OssConfig.java │ │ ├── RedisConfig.java │ │ ├── SmsConfig.java │ │ └── ThreadPoolConfig.java │ │ ├── monitor │ │ ├── dao │ │ │ └── SysOperationLogDao.java │ │ ├── entity │ │ │ └── SysOperationLog.java │ │ └── service │ │ │ ├── SysOperationLogService.java │ │ │ └── impl │ │ │ └── SysOperationLogServiceImpl.java │ │ ├── oss │ │ ├── OssService.java │ │ ├── impl │ │ │ └── OssServiceImpl.java │ │ └── vo │ │ │ ├── OssCallbackParam.java │ │ │ ├── OssCallbackResult.java │ │ │ └── OssPolicyResult.java │ │ └── sys │ │ ├── dao │ │ ├── SysAreaDao.java │ │ ├── SysCaptchaDao.java │ │ ├── SysConfigDao.java │ │ ├── SysCountryDao.java │ │ ├── SysDeptDao.java │ │ ├── SysDictDao.java │ │ ├── SysDictDetailDao.java │ │ ├── SysMenuDao.java │ │ ├── SysRoleDao.java │ │ ├── SysRoleDeptDao.java │ │ ├── SysRoleMenuDao.java │ │ ├── SysSmsLogDao.java │ │ ├── SysSmsTemplateDao.java │ │ ├── SysUserDao.java │ │ ├── SysUserLoginLogDao.java │ │ └── SysUserRoleDao.java │ │ ├── entity │ │ ├── SysArea.java │ │ ├── SysCaptcha.java │ │ ├── SysConfig.java │ │ ├── SysCountry.java │ │ ├── SysDept.java │ │ ├── SysDict.java │ │ ├── SysDictDetail.java │ │ ├── SysMenu.java │ │ ├── SysRole.java │ │ ├── SysRoleDept.java │ │ ├── SysRoleMenu.java │ │ ├── SysSmsLog.java │ │ ├── SysSmsTemplate.java │ │ ├── SysUser.java │ │ ├── SysUserLoginLog.java │ │ └── SysUserRole.java │ │ ├── enums │ │ ├── DataScopeEnums.java │ │ ├── MenuTypeEnums.java │ │ ├── SmsCodeTypeEnums.java │ │ ├── SmsTemplateEnums.java │ │ ├── SmsTypeEnums.java │ │ ├── StatusEnums.java │ │ └── SysParamTypeEnums.java │ │ ├── param │ │ ├── SmsCodeParam.java │ │ ├── SmsParam.java │ │ ├── SysUserCreatByMemberParam.java │ │ ├── SysUserLoginParam.java │ │ └── SysUserUpdatePasswordParam.java │ │ ├── service │ │ ├── OnlineUserService.java │ │ ├── SmsService.java │ │ ├── SmsStrategy.java │ │ ├── SysAreaService.java │ │ ├── SysCaptchaService.java │ │ ├── SysConfigService.java │ │ ├── SysCountryService.java │ │ ├── SysDeptService.java │ │ ├── SysDictDetailService.java │ │ ├── SysDictService.java │ │ ├── SysMenuService.java │ │ ├── SysRoleDeptService.java │ │ ├── SysRoleMenuService.java │ │ ├── SysRoleService.java │ │ ├── SysSmsLogService.java │ │ ├── SysSmsTemplateService.java │ │ ├── SysUserLoginLogService.java │ │ ├── SysUserRoleService.java │ │ ├── SysUserService.java │ │ └── impl │ │ │ ├── AliDaYuSmsStrategy.java │ │ │ ├── FakeSmsStrategy.java │ │ │ ├── OnlineUserServiceImpl.java │ │ │ ├── SmsServiceImpl.java │ │ │ ├── SysAreaServiceImpl.java │ │ │ ├── SysCaptchaServiceImpl.java │ │ │ ├── SysConfigServiceImpl.java │ │ │ ├── SysCountryServiceImpl.java │ │ │ ├── SysDeptServiceImpl.java │ │ │ ├── SysDictDetailServiceImpl.java │ │ │ ├── SysDictServiceImpl.java │ │ │ ├── SysMenuServiceImpl.java │ │ │ ├── SysRoleDeptServiceImpl.java │ │ │ ├── SysRoleMenuServiceImpl.java │ │ │ ├── SysRoleServiceImpl.java │ │ │ ├── SysSmsLogServiceImpl.java │ │ │ ├── SysSmsTemplateServiceImpl.java │ │ │ ├── SysUserLoginLogServiceImpl.java │ │ │ ├── SysUserRoleServiceImpl.java │ │ │ └── SysUserServiceImpl.java │ │ └── vo │ │ ├── MetaVo.java │ │ ├── OnlineUser.java │ │ ├── RouterVo.java │ │ ├── SmsTemplateDto.java │ │ ├── SysAreaResult.java │ │ ├── SysConfigResult.java │ │ └── TreeSelect.java │ └── resources │ ├── application-dev.yml │ ├── application-prod.yml │ ├── application-test.yml │ ├── ip2region │ └── ip2region.db │ ├── logback-spring.xml │ └── mapper │ └── sys │ ├── SysAreaDao.xml │ ├── SysCaptchaDao.xml │ ├── SysConfigDao.xml │ ├── SysCountryDao.xml │ ├── SysDeptDao.xml │ ├── SysDictDao.xml │ ├── SysDictDetailDao.xml │ ├── SysMenuDao.xml │ ├── SysRoleDao.xml │ ├── SysRoleDeptDao.xml │ ├── SysRoleMenuDao.xml │ ├── SysSmsLogDao.xml │ ├── SysSmsTemplateDao.xml │ ├── SysUserDao.xml │ ├── SysUserLoginLogDao.xml │ ├── SysUserRoleDao.xml │ └── monitor │ └── SysOperationDao.xml ├── harry-platform ├── pom.xml └── src │ └── main │ ├── java │ └── cn │ │ └── harry │ │ ├── PlatformApplication.java │ │ ├── component │ │ └── security │ │ │ ├── filter │ │ │ └── JwtAuthenticationTokenFilter.java │ │ │ ├── handle │ │ │ ├── RestAuthenticationEntryPoint.java │ │ │ └── RestfulAccessDeniedHandler.java │ │ │ └── service │ │ │ ├── PermissionService.java │ │ │ └── UserDetailsServiceImpl.java │ │ ├── config │ │ ├── GlobalWebConfig.java │ │ ├── SecurityConfig.java │ │ └── Swagger2Config.java │ │ └── controller │ │ ├── monitor │ │ ├── SysLoginLogController.java │ │ ├── SysOnlineUserController.java │ │ └── SysOperationLogController.java │ │ ├── oss │ │ └── OssController.java │ │ ├── sys │ │ ├── SysCaptchaController.java │ │ ├── SysConfigController.java │ │ ├── SysDeptController.java │ │ ├── SysDictController.java │ │ ├── SysDictDetailController.java │ │ ├── SysLoginController.java │ │ ├── SysMenuController.java │ │ ├── SysProfileController.java │ │ ├── SysRoleController.java │ │ └── SysUserController.java │ │ └── test │ │ └── TestController.java │ └── resources │ ├── application.yml │ └── banner.txt └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # 忽略文件夹 2 | /target 3 | # Compiled class file 4 | *.class 5 | 6 | # Log file 7 | *.log 8 | 9 | # BlueJ files 10 | *.ctxt 11 | 12 | # Mobile Tools for Java (J2ME) 13 | .mtj.tmp/ 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.rar 22 | *.iml 23 | .idea 24 | 25 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 26 | hs_err_pid* 27 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | EXPOSE 9001 3 | 4 | VOLUME /tmp 5 | ADD harry-platform.jar /app.jar 6 | RUN bash -c 'touch /app.jar' 7 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 8 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | ## Welcome to GitHub Pages 2 | 3 | You can use the [editor on GitHub](https://github.com/honghh/harry/edit/master/docs/index.md) to maintain and preview the content for your website in Markdown files. 4 | 5 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. 6 | 7 | ### Markdown 8 | 9 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for 10 | 11 | ```markdown 12 | Syntax highlighted code block 13 | 14 | # Header 1 15 | ## Header 2 16 | ### Header 3 17 | 18 | - Bulleted 19 | - List 20 | 21 | 1. Numbered 22 | 2. List 23 | 24 | **Bold** and _Italic_ and `Code` text 25 | 26 | [Link](url) and ![Image](src) 27 | ``` 28 | 29 | For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). 30 | 31 | ### Jekyll Themes 32 | 33 | Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/honghh/harry/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file. 34 | 35 | ### Support or Contact 36 | 37 | Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. 38 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/annotation/DataScope.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * ClassName: DataScope 7 | * Description: 8 | * 9 | * @author honghh 10 | * Date 2020/04/28 17:17 11 | * Copyright (C) www.honghh.top 12 | */ 13 | 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | public @interface DataScope { 18 | /** 表的别名 */ 19 | String tableAlias() default ""; 20 | 21 | /** true:没有本部门数据权限,也能查询本人数据 */ 22 | boolean user() default true; 23 | 24 | /** true:拥有子部门数据权限 */ 25 | boolean subDept() default false; 26 | 27 | /** 部门ID */ 28 | String deptId() default "dept_id"; 29 | 30 | /** 用户ID */ 31 | String userId() default "user_id"; 32 | } 33 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/annotation/DataSource.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.annotation; 2 | 3 | import cn.harry.common.enums.DataSourceType; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * ClassName: DataSource 9 | * Description: 自定义多数据源切换注解 10 | * 11 | * @author honghh 12 | * Date 2020/04/28 12:06 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Target({ElementType.METHOD, ElementType.TYPE}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | @Inherited 19 | public @interface DataSource { 20 | /** 21 | * 切换数据源名称 22 | */ 23 | DataSourceType value() default DataSourceType.MASTER; 24 | } 25 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/annotation/IgnoreAuth.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 忽略Token验证 7 | * 8 | * @author honghh 9 | * Date 2019/10/08 10:47 10 | * Copyright (C) www.honghh.top 11 | */ 12 | @Target(ElementType.METHOD) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | public @interface IgnoreAuth { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/annotation/SysLog.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.annotation; 2 | 3 | import cn.harry.common.enums.BusinessType; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * 系统日志注解 9 | * 10 | * @author honghh 11 | * Date 2019/10/08 10:47 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | public @interface SysLog { 18 | 19 | /** 20 | * 模块 21 | */ 22 | String title() default ""; 23 | 24 | /** 25 | * 功能 26 | */ 27 | BusinessType businessType() default BusinessType.OTHER; 28 | 29 | /** 30 | * 是否保存请求的参数 31 | */ 32 | boolean isSaveRequestData() default true; 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/api/IErrorCode.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.api; 2 | 3 | /** 4 | * 封装API的错误码 5 | * 6 | * @author honghh 7 | * Date 2019-10-12 10:55:44 8 | * Copyright (C) www.honghh.top 9 | */ 10 | public interface IErrorCode { 11 | long getCode(); 12 | 13 | String getMessage(); 14 | } 15 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/api/ResultCode.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.api; 2 | 3 | /** 4 | * 枚举了一些常用API操作码 5 | * 6 | * @author honghh 7 | * Date 2019-10-12 10:55:44 8 | * Copyright (C) www.honghh.top 9 | */ 10 | public enum ResultCode implements IErrorCode { 11 | /** 12 | * 操作成功 13 | */ 14 | SUCCESS(200, "操作成功"), 15 | FAILED(500, "操作失败"), 16 | VALIDATE_FAILED(10000, "参数检验失败"), 17 | UNAUTHORIZED(10001, "暂未登录或token已经过期"), 18 | FORBIDDEN(10002, "暂未登录或token已经过期,没有相关权限"); 19 | private long code; 20 | private String message; 21 | 22 | private ResultCode(long code, String message) { 23 | this.code = code; 24 | this.message = message; 25 | } 26 | 27 | @Override 28 | public long getCode() { 29 | return code; 30 | } 31 | 32 | @Override 33 | public String getMessage() { 34 | return message; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/constant/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.constant; 2 | 3 | 4 | /** 5 | * 公共常量 6 | * 7 | * @author honghh 8 | * Date 2019-10-12 10:58:47 9 | * Copyright (C) www.honghh.top 10 | */ 11 | public class CommonConstant { 12 | 13 | public static final String AJAX_REQUEST_HEADER_KEY = "x-rjft-request"; 14 | 15 | public static final String AJAX_REQUEST_HEADER_VALUE = "ajax"; 16 | 17 | public static final String AJAX_REQUEST_TOKEN_KEY = "Authorization"; 18 | 19 | /** 20 | * app原生页请求 21 | */ 22 | public static final String AJAX_NATIVE_HEADER_KEY = "x-rjft-native"; 23 | 24 | public static final String AJAX_NATIVE_HEADER_VALUE = "native"; 25 | 26 | 27 | /** 28 | * 超级管理员ID 29 | */ 30 | public static final long SUPER_ADMIN_ID = 1L; 31 | 32 | /** 33 | * 系统菜单最大id 34 | */ 35 | public static final int SYS_MENU_MAX_ID = 1; 36 | /** 37 | * 默认角色 38 | */ 39 | public static final long DEFAULT_ROLE = 1L; 40 | 41 | /** 42 | * 匿名用户 43 | */ 44 | public static final String ANONYMOUS_USER = "anonymousUser"; 45 | 46 | /** 47 | * 订单生成规则 48 | */ 49 | public static final String NUMBER_GEN_KEY_ORDER = "number_gen_key_order"; 50 | 51 | /** 52 | * 退货单生成规则 53 | */ 54 | public static final String NUMBER_GEN_KEY_ORDER_RETURN = "number_gen_key_order_return"; 55 | 56 | /** 57 | * 业务类型前缀 【支付宝支付唯一编码前缀】 58 | */ 59 | public static final String ALI_PAY_PREFIX = "ALI"; 60 | /** 61 | * 业务类型前缀 【微信支付唯一编码前缀】 62 | */ 63 | public static final String WEIXIN_PAY_PREFIX = "WX"; 64 | 65 | 66 | /** 数据权限过滤 */ 67 | public static final String SQL_FILTER = "sql_filter"; 68 | } 69 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/datasource/DynamicDataSource.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.datasource; 2 | 3 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; 4 | 5 | import javax.sql.DataSource; 6 | import java.util.Map; 7 | 8 | /** 9 | * ClassName: DynamicDataSource 10 | * Description: 动态数据源 11 | * 12 | * @author honghh 13 | * Date 2020/04/28 12:14 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public class DynamicDataSource extends AbstractRoutingDataSource 17 | { 18 | public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) 19 | { 20 | super.setDefaultTargetDataSource(defaultTargetDataSource); 21 | super.setTargetDataSources(targetDataSources); 22 | super.afterPropertiesSet(); 23 | } 24 | 25 | @Override 26 | protected Object determineCurrentLookupKey() 27 | { 28 | return DynamicDataSourceContextHolder.getDataSourceType(); 29 | } 30 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/datasource/DynamicDataSourceContextHolder.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.datasource; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * ClassName: DynamicDataSourceContextHolder 8 | * Description: 数据源切换处理 9 | * 10 | * @author honghh 11 | * Date 2020/04/28 12:14 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public class DynamicDataSourceContextHolder { 15 | public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); 16 | 17 | /** 18 | * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, 19 | * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 20 | */ 21 | private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); 22 | 23 | /** 24 | * 设置数据源的变量 25 | */ 26 | public static void setDataSourceType(String dsType) { 27 | log.info("切换到{}数据源", dsType); 28 | CONTEXT_HOLDER.set(dsType); 29 | } 30 | 31 | /** 32 | * 获得数据源的变量 33 | */ 34 | public static String getDataSourceType() { 35 | return CONTEXT_HOLDER.get(); 36 | } 37 | 38 | /** 39 | * 清空数据源变量 40 | */ 41 | public static void clearDataSourceType() { 42 | CONTEXT_HOLDER.remove(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/enums/BusinessType.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: BusinessType 8 | * Description: 业务操作类型 9 | * 10 | * @author honghh 11 | * Date 2020/04/20 09:50 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum BusinessType { 17 | /** 18 | * 其它 19 | */ 20 | OTHER, 21 | 22 | /** 23 | * 新增 24 | */ 25 | INSERT, 26 | 27 | /** 28 | * 修改 29 | */ 30 | UPDATE, 31 | 32 | /** 33 | * 删除 34 | */ 35 | DELETE, 36 | 37 | /** 38 | * 授权 39 | */ 40 | GRANT, 41 | 42 | /** 43 | * 导出 44 | */ 45 | EXPORT, 46 | 47 | /** 48 | * 导入 49 | */ 50 | IMPORT, 51 | 52 | /** 53 | * 强退 54 | */ 55 | FORCE, 56 | 57 | /** 58 | * 生成代码 59 | */ 60 | GENCODE, 61 | 62 | /** 63 | * 清空数据 64 | */ 65 | CLEAN, 66 | } 67 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/enums/DataSourceType.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.enums; 2 | 3 | /** 4 | * ClassName: DataSourceType 5 | * Description: 数据源 6 | * 7 | * @author honghh 8 | * Date 2020/04/28 12:08 9 | * Copyright (C) www.honghh.top 10 | */ 11 | public enum DataSourceType { 12 | /** 13 | * 主库 14 | */ 15 | MASTER, 16 | 17 | /** 18 | * 从库 19 | */ 20 | SLAVE 21 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/enums/HttpMethod.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.enums; 2 | 3 | import org.springframework.lang.Nullable; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | public enum HttpMethod { 9 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; 10 | 11 | private static final Map mappings = new HashMap<>(16); 12 | 13 | static 14 | { 15 | for (HttpMethod httpMethod : values()) 16 | { 17 | mappings.put(httpMethod.name(), httpMethod); 18 | } 19 | } 20 | 21 | @Nullable 22 | public static HttpMethod resolve(@Nullable String method) 23 | { 24 | return (method != null ? mappings.get(method) : null); 25 | } 26 | 27 | public boolean matches(String method) 28 | { 29 | return (this == resolve(method)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/enums/PlatformEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: PlatformEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/12/03 11:17 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum PlatformEnums { 17 | // 平台来源 18 | PC(1, "PC"), 19 | 20 | WX_MINIAPP(2, "微信小程序"), 21 | 22 | APP(3, "APP"), 23 | 24 | H5(4, "H5"), 25 | ; 26 | 27 | private Integer code; 28 | private String msg; 29 | } 30 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.exception; 2 | 3 | 4 | import cn.harry.common.api.IErrorCode; 5 | 6 | /** 7 | * 自定义异常 8 | * 9 | * @author honghh 10 | * Date 2019/07/18 14:03 11 | * Copyright (C) www.honghh.top 12 | */ 13 | public class ApiException extends RuntimeException { 14 | private static final long serialVersionUID = 1L; 15 | 16 | private String msg; 17 | private long code = 500; 18 | 19 | public ApiException(String msg) { 20 | super(msg); 21 | this.msg = msg; 22 | } 23 | 24 | public ApiException(String msg, Throwable e) { 25 | super(msg, e); 26 | this.msg = msg; 27 | } 28 | 29 | public ApiException(String msg, int code) { 30 | super(msg); 31 | this.msg = msg; 32 | this.code = code; 33 | } 34 | 35 | public ApiException(String msg, int code, Throwable e) { 36 | super(msg, e); 37 | this.msg = msg; 38 | this.code = code; 39 | } 40 | 41 | public ApiException(IErrorCode exceptionEnum) { 42 | this.code = exceptionEnum.getCode(); 43 | this.msg = exceptionEnum.getMessage(); 44 | } 45 | 46 | public String getMsg() { 47 | return msg; 48 | } 49 | 50 | public void setMsg(String msg) { 51 | this.msg = msg; 52 | } 53 | 54 | public long getCode() { 55 | return code; 56 | } 57 | 58 | public void setCode(long code) { 59 | this.code = code; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/exception/ApiExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.exception; 2 | 3 | import cn.harry.common.api.CommonResult; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.web.bind.annotation.ExceptionHandler; 6 | import org.springframework.web.bind.annotation.RestControllerAdvice; 7 | 8 | /** 9 | * 异常处理器 10 | * 11 | * @author honghh 12 | * Date 2019/07/18 14:03 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Slf4j 16 | @RestControllerAdvice 17 | public class ApiExceptionHandler { 18 | 19 | /** 20 | * 处理自定义异常 21 | */ 22 | @ExceptionHandler(ApiException.class) 23 | public CommonResult handleApiException(ApiException e) { 24 | log.error("自定义ApiException 抛出: {}",e); 25 | return CommonResult.failed(e.getCode(), e.getMsg()); 26 | } 27 | 28 | @ExceptionHandler(Exception.class) 29 | public CommonResult handleException(Exception e) { 30 | log.error(e.getMessage(), e); 31 | return CommonResult.failed(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/exption/KaptchaEnum.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.exption; 2 | 3 | 4 | import cn.harry.common.api.IErrorCode; 5 | 6 | /** 7 | * ClassName: KaptchaEnum 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/10/08 10:47 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public enum KaptchaEnum implements IErrorCode { 15 | /** 16 | * 参数不可以为空 17 | */ 18 | UUID_NOT_NULL(90100, "uuid不能为空"), 19 | MSG_CODE_ERROR(90101, "验证码错误"), 20 | ; 21 | 22 | private long code; 23 | private String msg; 24 | 25 | KaptchaEnum(long code, String msg) { 26 | this.code = code; 27 | this.msg = msg; 28 | } 29 | 30 | @Override 31 | public long getCode() { 32 | return code; 33 | } 34 | 35 | public void setCode(long code) { 36 | this.code = code; 37 | } 38 | 39 | @Override 40 | public String getMessage() { 41 | return msg; 42 | } 43 | 44 | public void setMsg(String msg) { 45 | this.msg = msg; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/exption/SmsExceptionEnum.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.exption; 2 | 3 | 4 | import cn.harry.common.api.IErrorCode; 5 | 6 | /** 7 | * ClassName: SmsExceptionEnum 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/08/30 11:22 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public enum SmsExceptionEnum implements IErrorCode { 15 | 16 | /******** 短信模块 sys_sms 10700 *********/ 17 | MESSAGE_TO_MANY(10700, "1分钟之内不能重发2次"), 18 | MSG_TYPE_ERROR(10701, "短信类型错误"), 19 | MSG_CODE_ERROR(10702, "验证码错误"), 20 | MOBILE_ERROR(10703, "手机号有误"), 21 | PHONE_IS_EMPTY(10705, "手机号为空"), 22 | VERIFICATION_CODE_FAILED(10706, "验证码验证失败"), 23 | TEMPLATE_CODE_ERROR(10707, "短信模版未配置"), 24 | MSG_PARAM_ERROR(10708, "短信参数错误"), 25 | 26 | ; 27 | private long code; 28 | private String msg; 29 | 30 | SmsExceptionEnum(long code, String msg) { 31 | this.code = code; 32 | this.msg = msg; 33 | } 34 | 35 | @Override 36 | public long getCode() { 37 | return code; 38 | } 39 | 40 | public void setCode(long code) { 41 | this.code = code; 42 | } 43 | 44 | @Override 45 | public String getMessage() { 46 | return msg; 47 | } 48 | 49 | public void setMsg(String msg) { 50 | this.msg = msg; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/exption/SysExceptionEnum.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.exption; 2 | 3 | 4 | import cn.harry.common.api.IErrorCode; 5 | 6 | /** 7 | * ClassName: UmsExceptionEnum 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/08/30 11:22 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public enum SysExceptionEnum implements IErrorCode { 15 | 16 | /******** 系统管理 member 100100 *********/ 17 | WRONG_USERNAME_OR_PASSWORD(100100, "用户名或密码错误"), 18 | 19 | /******** 微信小程序登陆 100101 *********/ 20 | AUTHORIZATION_WX_FAILURE(100101, "授权失败"), 21 | 22 | 23 | /******** 菜单管理 menu 100200 *********/ 24 | MENU_SUBMENU_EXISTS(100200, "存在子菜单,不允许删除"), 25 | MENU_IS_ASSIGNED(100201, "菜单已分配,不允许删除"), 26 | 27 | /******** 字典管理 dict 100300 *********/ 28 | DICT_TYPE_EXISTS(100300, "字典类型已存在,不允许删除"), 29 | 30 | 31 | /******** 部门管理 dept 100400 *********/ 32 | DEPT_NOT_EXISTS(100400, "部门已停用或不存在,不允许新增"), 33 | ; 34 | 35 | 36 | private long code; 37 | private String msg; 38 | 39 | SysExceptionEnum(long code, String msg) { 40 | this.code = code; 41 | this.msg = msg; 42 | } 43 | 44 | @Override 45 | public long getCode() { 46 | return code; 47 | } 48 | 49 | public void setCode(long code) { 50 | this.code = code; 51 | } 52 | 53 | @Override 54 | public String getMessage() { 55 | return msg; 56 | } 57 | 58 | public void setMsg(String msg) { 59 | this.msg = msg; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/manager/AsyncManager.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.manager; 2 | 3 | import cn.harry.common.utils.SpringUtils; 4 | import cn.harry.common.utils.Threads; 5 | 6 | import java.util.TimerTask; 7 | import java.util.concurrent.ScheduledExecutorService; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | /** 11 | * ClassName: AsyncManager 12 | * Description: 异步任务管理器 13 | * 14 | * @author honghh 15 | * Date 2020/04/20 15:46 16 | * Copyright (C) www.honghh.top 17 | */ 18 | public class AsyncManager { 19 | 20 | /** 21 | * 操作延迟10毫秒 22 | */ 23 | private final int OPERATE_DELAY_TIME = 10; 24 | 25 | /** 26 | * 异步操作任务调度线程池 27 | */ 28 | private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); 29 | 30 | /** 31 | * 单例模式 32 | */ 33 | private AsyncManager() { 34 | } 35 | 36 | private static AsyncManager me = new AsyncManager(); 37 | 38 | public static AsyncManager me() { 39 | return me; 40 | } 41 | 42 | /** 43 | * 执行任务 44 | * 45 | * @param task 任务 46 | */ 47 | public void execute(TimerTask task) { 48 | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); 49 | } 50 | 51 | /** 52 | * 停止任务线程池 53 | */ 54 | public void shutdown() { 55 | Threads.shutdownAndAwaitTermination(executor); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/manager/factory/AsyncFactory.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.manager.factory; 2 | 3 | import cn.harry.common.utils.IpAddressUtil; 4 | import cn.harry.common.utils.SpringUtils; 5 | import cn.harry.monitor.entity.SysOperationLog; 6 | import cn.harry.monitor.service.SysOperationLogService; 7 | import lombok.extern.slf4j.Slf4j; 8 | 9 | import java.util.TimerTask; 10 | 11 | /** 12 | * ClassName: AsyncFactory 13 | * Description: 异步工厂(产生任务用) 14 | * 15 | * @author honghh 16 | * Date 2020/04/20 15:49 17 | * Copyright (C) www.honghh.top 18 | */ 19 | @Slf4j 20 | public class AsyncFactory { 21 | /** 22 | * 操作日志记录 23 | * 24 | * @param operLog 操作日志信息 25 | * @return 任务task 26 | */ 27 | public static TimerTask recordOper(final SysOperationLog operLog) { 28 | return new TimerTask() { 29 | @Override 30 | public void run() { 31 | String address = IpAddressUtil.getCityInfo(operLog.getOperIp()); 32 | // 远程查询操作地点 33 | operLog.setOperLocation(address); 34 | SpringUtils.getBean(SysOperationLogService.class).insertLog(operLog); 35 | } 36 | }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/BeanUtils.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONArray; 5 | import com.alibaba.fastjson.JSONObject; 6 | import com.alibaba.fastjson.serializer.SerializerFeature; 7 | import lombok.extern.slf4j.Slf4j; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * ClassName: BeanUtils 13 | * Description: 14 | * 15 | * @author honghh 16 | * Date 2019/08/14 15:00 17 | * Copyright (C) www.honghh.top 18 | */ 19 | @Slf4j 20 | public class BeanUtils { 21 | 22 | /** 23 | * 普通对象转换 24 | * 25 | * @param targetClass 目标对象类型,必须含有无参构造函数,且目标对象和被转换对象如果有相同名称字段,则2个字段的类型必须一致 26 | * @param source 被转换的对象 27 | */ 28 | public static T transform(Class targetClass, Object source) { 29 | if (source == null) { 30 | return null; 31 | } 32 | try { 33 | String jsonSource = JSON.toJSONString(source); 34 | return JSONObject.parseObject(jsonSource, targetClass); 35 | } catch (Exception e) { 36 | log.error("对象转换出错:目标对象类型:{}, 被转换的对象类型:{}, 被转换的对象值:{}", targetClass, source.getClass(), 37 | JSON.toJSONString(source, SerializerFeature.WriteMapNullValue), e); 38 | throw new RuntimeException(e); 39 | } 40 | } 41 | 42 | 43 | /** 44 | * 普通对象集合转换 45 | * 46 | * @param targetClass 目标对象类型,必须含有无参构造函数,且目标对象和被转换对象如果有相同名称字段,则2个字段的类型必须一致 47 | * @param listSource 被转换的对象 48 | */ 49 | public static List transformList(Class targetClass, List listSource) { 50 | if (listSource == null) { 51 | return null; 52 | } 53 | try { 54 | String jsonSource = JSON.toJSONString(listSource); 55 | return JSONArray.parseArray(jsonSource, targetClass); 56 | } catch (Exception e) { 57 | log.error("对象转换出错:目标对象类型:{}, 被转换的对象类型:{}, 被转换的对象值:{}", targetClass, listSource.getClass(), 58 | JSON.toJSONString(listSource, SerializerFeature.WriteMapNullValue), e); 59 | throw new RuntimeException(e); 60 | } 61 | } 62 | 63 | /** 64 | * * 判断一个对象是否为空 65 | * 66 | * @param object Object 67 | * @return true:为空 false:非空 68 | */ 69 | public static boolean isNull(Object object) 70 | { 71 | return object == null; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/IdsParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * ClassName: IdsParam 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2019/09/24 12:53 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Data 16 | public class IdsParam { 17 | private List ids; 18 | } 19 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/IdsStrParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * ClassName: IdsStrParam 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2019/09/24 13:52 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Data 16 | public class IdsStrParam { 17 | private List ids; 18 | } 19 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/JsonUtil.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.JavaType; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Jackson json序列化和反序列化工具类 11 | * 12 | * @author honghh 13 | * Date 2019/10/08 10:47 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public class JsonUtil { 17 | 18 | /** 19 | * 定义jackson对象 20 | */ 21 | private static final ObjectMapper MAPPER = new ObjectMapper(); 22 | 23 | /** 24 | * 将对象转换成json字符串。 25 | */ 26 | public static String objectToJson(Object data) { 27 | try { 28 | return MAPPER.writeValueAsString(data); 29 | } catch (JsonProcessingException e) { 30 | e.printStackTrace(); 31 | } 32 | return null; 33 | } 34 | 35 | /** 36 | * 将json结果集转化为对象 37 | * 38 | * @param jsonData json数据 39 | * @param beanType 对象中的object类型 40 | */ 41 | public static T jsonToPojo(String jsonData, Class beanType) { 42 | try { 43 | return MAPPER.readValue(jsonData, beanType); 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | } 47 | return null; 48 | } 49 | 50 | /** 51 | * 将json数据转换成pojo对象list 52 | */ 53 | public static List jsonToList(String jsonData, Class beanType) { 54 | JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType); 55 | try { 56 | return MAPPER.readValue(jsonData, javaType); 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | } 60 | 61 | return null; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/NumberGenUtils.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import cn.harry.common.constant.CommonConstant; 4 | import cn.hutool.core.date.DateUtil; 5 | import org.springframework.stereotype.Component; 6 | 7 | import javax.annotation.Resource; 8 | import java.text.SimpleDateFormat; 9 | import java.util.Date; 10 | 11 | /** 12 | * ClassName: NumberGenUtils 13 | * Description: 14 | * 15 | * @author honghh 16 | * Date 2019/10/30 16:18 17 | * Copyright (C) www.honghh.top 18 | */ 19 | @Component 20 | public class NumberGenUtils { 21 | @Resource 22 | private RedisUtils redisUtils; 23 | 24 | /** 25 | * 生成18位订单编号:8位日期+2位平台号码+2位支付方式+6位以上自增id 26 | */ 27 | public String genOrderSn(Integer sourceType, Integer payType) { 28 | StringBuilder sb = new StringBuilder(); 29 | String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); 30 | sb.append(date); 31 | sb.append(String.format("%02d", sourceType)); 32 | sb.append(String.format("%02d", payType)); 33 | sb.append(String.format("%06d", redisUtils.increment(CommonConstant.NUMBER_GEN_KEY_ORDER, date))); 34 | return sb.toString(); 35 | } 36 | 37 | /** 38 | * 生成16位退货单编号:8位日期+2位平台号码+6位以上自增id 39 | */ 40 | public String genOrderReturnSn(Integer sourceType) { 41 | StringBuilder sb = new StringBuilder(); 42 | String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); 43 | sb.append(date); 44 | sb.append(String.format("%02d", sourceType)); 45 | sb.append(String.format("%06d", redisUtils.increment(CommonConstant.NUMBER_GEN_KEY_ORDER_RETURN, date))); 46 | return sb.toString(); 47 | } 48 | 49 | /** 50 | * 获取13位以天为周期的自增编号 51 | * TYPE + yyMMdd + 时间戳 52 | * 53 | * @param type 编号类型(订单:DD 等) 54 | * @return 55 | * @author honghh 56 | * @date 2018/8/1 15:46 57 | */ 58 | public static String generateCode(String type) { 59 | StringBuffer sb = new StringBuffer(); 60 | sb.append(type); 61 | String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); 62 | sb.append(date); 63 | sb.append(DateUtil.current(true)); 64 | return sb.toString(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/OkHttpUtil.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import okhttp3.*; 4 | 5 | import java.io.IOException; 6 | import java.util.Iterator; 7 | import java.util.Map; 8 | 9 | /** 10 | * ClassName: OkHttpUtil 11 | * Description: 12 | * 13 | * @author honghh 14 | * Date 2019/10/21 10:27 15 | * Copyright (C) www.honghh.top 16 | */ 17 | public class OkHttpUtil { 18 | 19 | /** 20 | * 发起get请求 21 | * 22 | * @param url 23 | * @param queries 24 | * @return 25 | */ 26 | public static String get(String url, Map queries) { 27 | String result = null; 28 | OkHttpClient client = new OkHttpClient(); 29 | StringBuffer sb = new StringBuffer(url); 30 | if (queries != null && queries.keySet().size() > 0) { 31 | boolean firstFlag = true; 32 | Iterator iterator = queries.entrySet().iterator(); 33 | while (iterator.hasNext()) { 34 | Map.Entry entry = (Map.Entry) iterator.next(); 35 | if (firstFlag) { 36 | sb.append("?" + entry.getKey() + "=" + entry.getValue()); 37 | firstFlag = false; 38 | } else { 39 | sb.append("&" + entry.getKey() + "=" + entry.getValue()); 40 | } 41 | } 42 | } 43 | 44 | Request request = new Request.Builder().url("http://ip.taobao.com/service/getIpInfo.php?ip=1.193.163.159").build(); 45 | try { 46 | 47 | Response response = client.newCall(request).execute(); 48 | result = response.body().string(); 49 | System.out.println(result); 50 | System.out.println(response); 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | } 54 | return result; 55 | } 56 | 57 | /** 58 | * 发送httppost请求 59 | * 60 | * @param url 61 | * @param data 提交的参数为key=value&key1=value1的形式 62 | * @return 63 | */ 64 | public static String httpPost(String url, String data) { 65 | String result = null; 66 | OkHttpClient httpClient = new OkHttpClient(); 67 | RequestBody requestBody = RequestBody.create(MediaType.parse("text/html;charset=utf-8"), data); 68 | 69 | Request request = new Request.Builder().url(url).post(requestBody).build(); 70 | try { 71 | Response response = httpClient.newCall(request).execute(); 72 | result = response.body().string(); 73 | } catch (IOException e) { 74 | e.printStackTrace(); 75 | } 76 | return result; 77 | } 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/RedisKeys.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | /** 4 | * Redis所有Keys 5 | * 6 | * @author honghh 7 | * Date 2019/07/18 14:03 8 | * Copyright (C) www.honghh.top 9 | */ 10 | public class RedisKeys { 11 | 12 | public static String getSysConfigKey(String key) { 13 | return "sys:config:" + key; 14 | } 15 | 16 | /** 17 | * desc 获取短信验证码 18 | * 19 | * @param key 手机号 20 | * @param type 类型 21 | * @return 22 | * @author honghh 23 | * date 2019-09-06 10:20 24 | */ 25 | public static String getMsgCodeKey(String key, String type) { 26 | return "msg:code:" + type + key; 27 | } 28 | 29 | /** 30 | * desc 获取token 31 | * 32 | * @return 33 | * @author honghh 34 | * date 2019-09-06 10:20 35 | */ 36 | public static String getTokenByOpenid(String openid) { 37 | return "token:openid:" + openid; 38 | } 39 | 40 | /** 41 | * desc 获取username 42 | * 43 | * @param openid 44 | * @return 45 | * @author honghh 46 | * date 2020-01-03 10:23 47 | */ 48 | public static String getUsernameByOpenid(String openid) { 49 | return "username:openid:" + openid; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/SecurityUtils.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import cn.harry.common.constant.CommonConstant; 4 | import cn.harry.common.exception.ApiException; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | 8 | /** 9 | * ClassName: SecurityUtils 10 | * Description: 安全服务工具类 11 | * 12 | * @author honghh 13 | * Date 2020/04/13 12:49 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public class SecurityUtils { 17 | 18 | public static UserDetails getUserDetails() { 19 | UserDetails userDetails; 20 | try { 21 | userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); 22 | } catch (Exception e) { 23 | throw new ApiException("登录状态过期", 401); 24 | } 25 | return userDetails; 26 | } 27 | 28 | /** 29 | * 是否为管理员 30 | * 31 | * @param userId 用户ID 32 | * @return 结果 33 | */ 34 | public static boolean isAdmin(Long userId) { 35 | return userId != null && CommonConstant.SUPER_ADMIN_ID == userId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/SysUserDetails.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import cn.harry.sys.entity.SysMenu; 4 | import cn.harry.sys.entity.SysUser; 5 | import cn.harry.sys.enums.StatusEnums; 6 | import cn.hutool.core.util.StrUtil; 7 | import org.springframework.security.core.GrantedAuthority; 8 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | 11 | import java.util.Collection; 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | /** 16 | * Description: SpringSecurity 需要的用户详情 17 | * 18 | * @author honghh 19 | * Date 2019/08/14 15:00 20 | * Copyright (C) www.honghh.top 21 | */ 22 | public class SysUserDetails implements UserDetails { 23 | private SysUser sysUser; 24 | private List permissions; 25 | 26 | public SysUserDetails(SysUser sysUser, List permissions) { 27 | this.sysUser = sysUser; 28 | this.permissions = permissions; 29 | } 30 | 31 | @Override 32 | public Collection getAuthorities() { 33 | //返回当前用户的权限 34 | return permissions.stream().filter(item -> item != null && StrUtil.isNotEmpty(item.getValue())) 35 | .map(item -> new SimpleGrantedAuthority(item.getValue())) 36 | .collect(Collectors.toList()); 37 | } 38 | 39 | 40 | @Override 41 | public String getPassword() { 42 | return sysUser.getPassword(); 43 | } 44 | 45 | @Override 46 | public String getUsername() { 47 | return sysUser.getUsername(); 48 | } 49 | 50 | /** 51 | * 账户是否未过期,过期无法验证 52 | */ 53 | @Override 54 | public boolean isAccountNonExpired() { 55 | return true; 56 | } 57 | 58 | /** 59 | * 指定用户是否解锁,锁定的用户无法进行身份验证 60 | * 61 | * @return 62 | */ 63 | @Override 64 | public boolean isAccountNonLocked() { 65 | return true; 66 | } 67 | 68 | /** 69 | * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 70 | * 71 | * @return 72 | */ 73 | @Override 74 | public boolean isCredentialsNonExpired() { 75 | return true; 76 | } 77 | 78 | /** 79 | * 是否可用 ,禁用的用户不能身份验证 80 | * 81 | * @return 82 | */ 83 | @Override 84 | public boolean isEnabled() { 85 | return StatusEnums.ENABLE.getKey().equals(sysUser.getStatus()); 86 | } 87 | 88 | public SysUser getSysUser() { 89 | return sysUser; 90 | } 91 | 92 | public void setSysUser(SysUser sysUser) { 93 | this.sysUser = sysUser; 94 | } 95 | 96 | public List getPermissions() { 97 | return permissions; 98 | } 99 | 100 | public void setPermissions(List permissions) { 101 | this.permissions = permissions; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/SysUserUtils.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import cn.harry.sys.entity.SysUser; 4 | import org.springframework.security.core.Authentication; 5 | import org.springframework.security.core.context.SecurityContext; 6 | import org.springframework.security.core.context.SecurityContextHolder; 7 | 8 | /** 9 | * ClassName: BeanUtils 10 | * Description: 获取当前登陆用户信息 11 | * 12 | * @author honghh 13 | * Date 2019/08/14 15:00 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public class SysUserUtils { 17 | 18 | public static SysUser getSysUser() { 19 | try { 20 | SecurityContext ctx = SecurityContextHolder.getContext(); 21 | Authentication auth = ctx.getAuthentication(); 22 | SysUserDetails memberDetails = (SysUserDetails) auth.getPrincipal(); 23 | return memberDetails.getSysUser(); 24 | } catch (Exception e) { 25 | return new SysUser(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/Threads.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import java.util.concurrent.*; 6 | 7 | /** 8 | * ClassName: Threads 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2020/04/20 15:46 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Slf4j 16 | public class Threads { 17 | /** 18 | * sleep等待,单位为毫秒 19 | */ 20 | public static void sleep(long milliseconds) { 21 | try { 22 | Thread.sleep(milliseconds); 23 | } catch (InterruptedException e) { 24 | return; 25 | } 26 | } 27 | 28 | /** 29 | * 停止线程池 30 | * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. 31 | * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. 32 | * 如果仍人超時,則強制退出. 33 | * 另对在shutdown时线程本身被调用中断做了处理. 34 | */ 35 | public static void shutdownAndAwaitTermination(ExecutorService pool) { 36 | if (pool != null && !pool.isShutdown()) { 37 | pool.shutdown(); 38 | try { 39 | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) { 40 | pool.shutdownNow(); 41 | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) { 42 | log.info("Pool did not terminate"); 43 | } 44 | } 45 | } catch (InterruptedException ie) { 46 | pool.shutdownNow(); 47 | Thread.currentThread().interrupt(); 48 | } 49 | } 50 | } 51 | 52 | /** 53 | * 打印线程异常信息 54 | */ 55 | public static void printException(Runnable r, Throwable t) { 56 | if (t == null && r instanceof Future) { 57 | try { 58 | Future future = (Future) r; 59 | if (future.isDone()) { 60 | future.get(); 61 | } 62 | } catch (CancellationException ce) { 63 | t = ce; 64 | } catch (ExecutionException ee) { 65 | t = ee.getCause(); 66 | } catch (InterruptedException ie) { 67 | Thread.currentThread().interrupt(); 68 | } 69 | } 70 | if (t != null) { 71 | log.error(t.getMessage(), t); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/common/utils/TreeUtils.java: -------------------------------------------------------------------------------- 1 | package cn.harry.common.utils; 2 | 3 | import cn.harry.sys.vo.SysAreaResult; 4 | import cn.hutool.core.bean.BeanUtil; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * ClassName: TreeUtils 11 | * Description: 12 | * 13 | * @author honghh 14 | * Date 2019/09/25 11:40 15 | * Copyright (C) www.honghh.top 16 | */ 17 | public class TreeUtils { 18 | private final static Long ROOT_ID = 0L; 19 | private List menuCommon; 20 | public List list = new ArrayList(); 21 | 22 | public List menuList(List menu) { 23 | this.menuCommon = menu; 24 | for (SysAreaResult areaResult : menu) { 25 | SysAreaResult mainCategoryDto = new SysAreaResult(); 26 | if (ROOT_ID.equals(areaResult.getParentId())) { 27 | BeanUtil.copyProperties(areaResult, mainCategoryDto); 28 | mainCategoryDto.setChildren(menuChild(areaResult.getId())); 29 | list.add(mainCategoryDto); 30 | } 31 | } 32 | return list; 33 | } 34 | 35 | private List menuChild(Long id) { 36 | List lists = new ArrayList(); 37 | for (SysAreaResult categoryDto : menuCommon) { 38 | SysAreaResult areaResult = new SysAreaResult(); 39 | if (categoryDto.getParentId().equals(id)) { 40 | BeanUtil.copyProperties(categoryDto, areaResult); 41 | areaResult.setChildren(menuChild(categoryDto.getId())); 42 | lists.add(areaResult); 43 | } 44 | } 45 | return lists; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/component/aspect/DataSourceAspect.java: -------------------------------------------------------------------------------- 1 | package cn.harry.component.aspect; 2 | 3 | import cn.harry.common.annotation.DataSource; 4 | import cn.harry.common.datasource.DynamicDataSourceContextHolder; 5 | import cn.harry.common.utils.StringUtils; 6 | import org.aspectj.lang.ProceedingJoinPoint; 7 | import org.aspectj.lang.annotation.Around; 8 | import org.aspectj.lang.annotation.Aspect; 9 | import org.aspectj.lang.annotation.Pointcut; 10 | import org.aspectj.lang.reflect.MethodSignature; 11 | import org.springframework.core.annotation.Order; 12 | import org.springframework.stereotype.Component; 13 | 14 | import java.lang.reflect.Method; 15 | 16 | /** 17 | * ClassName: DataScopeAspect 18 | * Description: 19 | * 20 | * @author honghh 21 | * Date 2020/04/28 12:11 22 | * Copyright (C) www.honghh.top 23 | */ 24 | @Aspect 25 | @Order(1) 26 | @Component 27 | public class DataSourceAspect { 28 | @Pointcut("@annotation(cn.harry.common.annotation.DataSource)" 29 | + "|| @within(cn.harry.common.annotation.DataSource)") 30 | public void dsPointCut() { 31 | 32 | } 33 | 34 | @Around("dsPointCut()") 35 | public Object around(ProceedingJoinPoint point) throws Throwable { 36 | DataSource dataSource = getDataSource(point); 37 | 38 | if (StringUtils.isNotNull(dataSource)) { 39 | DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); 40 | } 41 | 42 | try { 43 | return point.proceed(); 44 | } finally { 45 | // 销毁数据源 在执行方法之后 46 | DynamicDataSourceContextHolder.clearDataSourceType(); 47 | } 48 | } 49 | 50 | /** 51 | * 获取需要切换的数据源 52 | */ 53 | public DataSource getDataSource(ProceedingJoinPoint point) { 54 | MethodSignature signature = (MethodSignature) point.getSignature(); 55 | Class targetClass = point.getTarget().getClass(); 56 | DataSource targetDataSource = targetClass.getAnnotation(DataSource.class); 57 | if (StringUtils.isNotNull(targetDataSource)) { 58 | return targetDataSource; 59 | } else { 60 | Method method = signature.getMethod(); 61 | return method.getAnnotation(DataSource.class); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/DruidProperties.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * ClassName: DruidProperties 9 | * Description: druid 配置属性 10 | * 11 | * @author honghh 12 | * Date 2020/04/28 12:27 13 | * Copyright (C) www.honghh.top 14 | */ 15 | 16 | @Configuration 17 | public class DruidProperties { 18 | @Value("${spring.datasource.druid.initial-size}") 19 | private int initialSize; 20 | 21 | @Value("${spring.datasource.druid.min-idle}") 22 | private int minIdle; 23 | 24 | @Value("${spring.datasource.druid.max-active}") 25 | private int maxActive; 26 | 27 | @Value("${spring.datasource.druid.max-wait}") 28 | private int maxWait; 29 | 30 | @Value("${spring.datasource.druid.time-between-eviction-runs-millis}") 31 | private int timeBetweenEvictionRunsMillis; 32 | 33 | @Value("${spring.datasource.druid.min-evictable-idle-time-millis}") 34 | private int minEvictableIdleTimeMillis; 35 | 36 | @Value("${spring.datasource.druid.max-evictable-idle-time-millis}") 37 | private int maxEvictableIdleTimeMillis; 38 | 39 | @Value("${spring.datasource.druid.validation-query}") 40 | private String validationQuery; 41 | 42 | @Value("${spring.datasource.druid.test-while-idle}") 43 | private boolean testWhileIdle; 44 | 45 | @Value("${spring.datasource.druid.test-on-borrow}") 46 | private boolean testOnBorrow; 47 | 48 | @Value("${spring.datasource.druid.test-on-return}") 49 | private boolean testOnReturn; 50 | 51 | public DruidDataSource dataSource(DruidDataSource datasource) { 52 | /** 配置初始化大小、最小、最大 */ 53 | datasource.setInitialSize(initialSize); 54 | datasource.setMaxActive(maxActive); 55 | datasource.setMinIdle(minIdle); 56 | 57 | /** 配置获取连接等待超时的时间 */ 58 | datasource.setMaxWait(maxWait); 59 | 60 | /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ 61 | datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); 62 | 63 | /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ 64 | datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); 65 | datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); 66 | 67 | /** 68 | * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 69 | */ 70 | datasource.setValidationQuery(validationQuery); 71 | /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ 72 | datasource.setTestWhileIdle(testWhileIdle); 73 | /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ 74 | datasource.setTestOnBorrow(testOnBorrow); 75 | /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ 76 | datasource.setTestOnReturn(testOnReturn); 77 | return datasource; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/KaptchaConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import com.google.code.kaptcha.impl.DefaultKaptcha; 4 | import com.google.code.kaptcha.util.Config; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import java.util.Properties; 9 | 10 | 11 | /** 12 | * 生成验证码配置 13 | * 14 | * @author honghh 15 | * Date 2019/07/18 14:03 16 | * Copyright (C) www.honghh.top 17 | */ 18 | @Configuration 19 | public class KaptchaConfig { 20 | 21 | @Bean 22 | public DefaultKaptcha producer() { 23 | Properties properties = new Properties(); 24 | properties.put("kaptcha.border", "no"); 25 | properties.put("kaptcha.textproducer.font.color", "black"); 26 | properties.put("kaptcha.textproducer.char.space", "5"); 27 | properties.put("kaptcha.textproducer.font.names", "Arial,Courier,cmr10,宋体,楷体,微软雅黑"); 28 | Config config = new Config(properties); 29 | DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); 30 | defaultKaptcha.setConfig(config); 31 | return defaultKaptcha; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.transaction.annotation.EnableTransactionManagement; 9 | 10 | /** 11 | * ClassName: MybatisPlusConfig 12 | * Description: 13 | * 14 | * @author honghh 15 | * Date 2019/10/14 11:50 16 | * Copyright (C) www.honghh.top 17 | */ 18 | @EnableTransactionManagement 19 | @Configuration 20 | @MapperScan("cn.harry.*.dao*") 21 | public class MybatisPlusConfig { 22 | @Bean 23 | public PaginationInterceptor paginationInterceptor() { 24 | 25 | PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); 26 | // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false 27 | // paginationInterceptor.setOverflow(false); 28 | // 设置最大单页限制数量,默认 500 条,-1 不受限制 29 | // paginationInterceptor.setLimit(500); 30 | // 开启 count 的 join 优化,只针对部分 left join 31 | paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true)); 32 | return paginationInterceptor; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/OkHttpConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import okhttp3.ConnectionPool; 4 | import okhttp3.OkHttpClient; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import javax.net.ssl.SSLContext; 9 | import javax.net.ssl.SSLSocketFactory; 10 | import javax.net.ssl.TrustManager; 11 | import javax.net.ssl.X509TrustManager; 12 | import java.security.KeyManagementException; 13 | import java.security.NoSuchAlgorithmException; 14 | import java.security.SecureRandom; 15 | import java.security.cert.CertificateException; 16 | import java.security.cert.X509Certificate; 17 | import java.util.concurrent.TimeUnit; 18 | 19 | /** 20 | * ClassName: OkHttpConfig 21 | * Description: 22 | * 23 | * @author honghh 24 | * Date 2019/10/21 10:26 25 | * Copyright (C) www.honghh.top 26 | */ 27 | 28 | @Configuration 29 | public class OkHttpConfig { 30 | 31 | @Bean 32 | public X509TrustManager x509TrustManager() { 33 | return new X509TrustManager() { 34 | @Override 35 | public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { 36 | } 37 | 38 | @Override 39 | public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { 40 | } 41 | 42 | @Override 43 | public X509Certificate[] getAcceptedIssuers() { 44 | return new X509Certificate[0]; 45 | } 46 | }; 47 | } 48 | 49 | @Bean 50 | public SSLSocketFactory sslSocketFactory() { 51 | try { 52 | //信任任何链接 53 | SSLContext sslContext = SSLContext.getInstance("TLS"); 54 | sslContext.init(null, new TrustManager[]{x509TrustManager()}, new SecureRandom()); 55 | return sslContext.getSocketFactory(); 56 | } catch (NoSuchAlgorithmException e) { 57 | e.printStackTrace(); 58 | } catch (KeyManagementException e) { 59 | e.printStackTrace(); 60 | } 61 | return null; 62 | } 63 | 64 | /** 65 | * Create a new connection pool with tuning parameters appropriate for a single-user application. 66 | * The tuning parameters in this pool are subject to change in future OkHttp releases. Currently 67 | */ 68 | @Bean 69 | public ConnectionPool pool() { 70 | return new ConnectionPool(200, 5, TimeUnit.MINUTES); 71 | } 72 | 73 | @Bean 74 | public OkHttpClient okHttpClient() { 75 | return new OkHttpClient.Builder() 76 | .sslSocketFactory(sslSocketFactory(), x509TrustManager()) 77 | 78 | //是否开启缓存 79 | .retryOnConnectionFailure(false) 80 | 81 | //连接池 82 | .connectionPool(pool()) 83 | .connectTimeout(10L, TimeUnit.SECONDS) 84 | .readTimeout(10L, TimeUnit.SECONDS) 85 | .build(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/OssConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import com.aliyun.oss.OSSClient; 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | /** 10 | * ClassName: OssConfig 11 | * Description: 阿里云存储配置 12 | * 13 | * @author honghh 14 | * Date 2019/10/14 11:50 15 | * Copyright (C) www.honghh.top 16 | */ 17 | @Data 18 | @Configuration 19 | @ConfigurationProperties(prefix = "aliyun.oss") 20 | public class OssConfig { 21 | 22 | /** 23 | * oss对外服务的访问域名 24 | */ 25 | private String endpoint; 26 | 27 | /** 28 | * 访问身份验证中用到用户标识 29 | */ 30 | private String accessKeyId; 31 | 32 | /** 33 | * 用户用于加密签名字符串和oss用来验证签名字符串的密钥 34 | */ 35 | private String accessKeySecret; 36 | 37 | /** 38 | * oss的存储空间 39 | */ 40 | private String bucketName; 41 | 42 | /** 43 | * 签名有效期(S) 44 | */ 45 | private String policyExpire; 46 | 47 | /** 48 | * 上传文件大小(M) 49 | */ 50 | private String maxSize; 51 | 52 | /** 53 | * 文件上传成功后的回调地址 54 | */ 55 | private String callback; 56 | 57 | /** 58 | * 上传文件夹路径前缀 59 | */ 60 | private String dirPrefix; 61 | 62 | @Bean 63 | public OSSClient ossClient() { 64 | return new OSSClient(endpoint, accessKeyId, accessKeySecret); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.data.redis.connection.RedisConnectionFactory; 7 | import org.springframework.data.redis.core.*; 8 | import org.springframework.data.redis.serializer.StringRedisSerializer; 9 | 10 | import javax.annotation.Resource; 11 | 12 | /** 13 | * Redis配置 14 | * 15 | * @author honghh 16 | * Date 2019/07/18 14:03 17 | * Copyright (C) www.honghh.top 18 | */ 19 | @Configuration 20 | @ConfigurationProperties(prefix = "harry.redis") 21 | public class RedisConfig { 22 | 23 | /** 24 | * 是否开启redis缓存 true开启 false关闭 25 | */ 26 | private boolean open; 27 | /** 28 | * 默认过期时长,单位:秒 29 | */ 30 | private long expire; 31 | @Resource 32 | private RedisConnectionFactory factory; 33 | 34 | @Bean 35 | public RedisTemplate redisTemplate() { 36 | RedisTemplate redisTemplate = new RedisTemplate<>(); 37 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 38 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); 39 | redisTemplate.setHashValueSerializer(new StringRedisSerializer()); 40 | redisTemplate.setValueSerializer(new StringRedisSerializer()); 41 | redisTemplate.setConnectionFactory(factory); 42 | return redisTemplate; 43 | } 44 | 45 | @Bean 46 | public HashOperations hashOperations(RedisTemplate redisTemplate) { 47 | return redisTemplate.opsForHash(); 48 | } 49 | 50 | @Bean 51 | public ValueOperations valueOperations(RedisTemplate redisTemplate) { 52 | return redisTemplate.opsForValue(); 53 | } 54 | 55 | @Bean 56 | public ListOperations listOperations(RedisTemplate redisTemplate) { 57 | return redisTemplate.opsForList(); 58 | } 59 | 60 | @Bean 61 | public SetOperations setOperations(RedisTemplate redisTemplate) { 62 | return redisTemplate.opsForSet(); 63 | } 64 | 65 | @Bean 66 | public ZSetOperations zSetOperations(RedisTemplate redisTemplate) { 67 | return redisTemplate.opsForZSet(); 68 | } 69 | 70 | public boolean isOpen() { 71 | return open; 72 | } 73 | 74 | public void setOpen(boolean open) { 75 | this.open = open; 76 | } 77 | 78 | public long getExpire() { 79 | return expire; 80 | } 81 | 82 | public void setExpire(long expire) { 83 | this.expire = expire; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/SmsConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * ClassName: SmsConfig 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2019/08/30 08:52 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Data 16 | @Component 17 | @ConfigurationProperties(prefix = "harry.sms") 18 | public class SmsConfig { 19 | 20 | private String accessKeyId; 21 | 22 | private String accessKeySecret; 23 | 24 | private boolean enabled; 25 | } 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/config/ThreadPoolConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import cn.harry.common.utils.Threads; 4 | import org.apache.commons.lang3.concurrent.BasicThreadFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 8 | 9 | import java.util.concurrent.ScheduledExecutorService; 10 | import java.util.concurrent.ScheduledThreadPoolExecutor; 11 | import java.util.concurrent.ThreadPoolExecutor; 12 | 13 | /** 14 | * ClassName: ThreadPoolConfig 15 | * Description: 线程池配置 16 | * 17 | * @author honghh 18 | * Date 2020/04/24 09:36 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Configuration 22 | public class ThreadPoolConfig { 23 | /** 24 | * 核心线程池大小 25 | */ 26 | private int corePoolSize = 50; 27 | 28 | /** 29 | * 最大可创建的线程数 30 | */ 31 | private int maxPoolSize = 200; 32 | 33 | /** 34 | * 队列最大长度 35 | */ 36 | private int queueCapacity = 1000; 37 | 38 | /** 39 | * 线程池维护线程所允许的空闲时间 40 | */ 41 | private int keepAliveSeconds = 300; 42 | 43 | @Bean(name = "threadPoolTaskExecutor") 44 | public ThreadPoolTaskExecutor threadPoolTaskExecutor() { 45 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 46 | executor.setMaxPoolSize(maxPoolSize); 47 | executor.setCorePoolSize(corePoolSize); 48 | executor.setQueueCapacity(queueCapacity); 49 | executor.setKeepAliveSeconds(keepAliveSeconds); 50 | // 线程池对拒绝任务(无线程可用)的处理策略 51 | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); 52 | return executor; 53 | } 54 | 55 | /** 56 | * 执行周期性或定时任务 57 | */ 58 | @Bean(name = "scheduledExecutorService") 59 | protected ScheduledExecutorService scheduledExecutorService() { 60 | return new ScheduledThreadPoolExecutor(corePoolSize, 61 | new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { 62 | @Override 63 | protected void afterExecute(Runnable r, Throwable t) { 64 | super.afterExecute(r, t); 65 | Threads.printException(r, t); 66 | } 67 | }; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/monitor/dao/SysOperationLogDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.monitor.dao; 2 | 3 | import cn.harry.monitor.entity.SysOperationLog; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * ClassName: SysOperationLogDao 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2020/04/20 16:06 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Mapper 16 | public interface SysOperationLogDao extends BaseMapper { 17 | 18 | /** 19 | * 清空 20 | * 21 | * @return 22 | */ 23 | void clean(); 24 | } 25 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/monitor/service/SysOperationLogService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.monitor.service; 2 | 3 | import cn.harry.monitor.entity.SysOperationLog; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ClassName: SysOperationLogService 10 | * Description: 11 | * 12 | * @author honghh 13 | * Date 2020/04/20 16:02 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public interface SysOperationLogService { 17 | /** 18 | * 新增操作日志 19 | * 20 | * @param log 操作日志对象 21 | */ 22 | void insertLog(SysOperationLog log); 23 | 24 | /** 25 | * 分页获取 26 | * 27 | * @param sysOperationLog 28 | * @param pageSize 29 | * @param pageNum 30 | * @return 31 | */ 32 | IPage getPage(SysOperationLog sysOperationLog, Integer pageSize, Integer pageNum); 33 | 34 | /** 35 | * 批量删除 36 | * 37 | * @param ids 38 | * @return 39 | */ 40 | int deleteByIds(Long[] ids); 41 | 42 | /** 43 | * 清空 44 | * 45 | * @return 46 | */ 47 | void clean(); 48 | 49 | /** 50 | * 导出(不分页) 51 | * 52 | * @param sysOperationLog 53 | * @return 54 | */ 55 | List getExportList(SysOperationLog sysOperationLog); 56 | } 57 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/monitor/service/impl/SysOperationLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.monitor.service.impl; 2 | 3 | import cn.harry.monitor.dao.SysOperationLogDao; 4 | import cn.harry.monitor.entity.SysOperationLog; 5 | import cn.harry.monitor.service.SysOperationLogService; 6 | import cn.harry.sys.entity.SysDict; 7 | import cn.hutool.core.util.StrUtil; 8 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 9 | import com.baomidou.mybatisplus.core.metadata.IPage; 10 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 11 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | /** 18 | * ClassName: SysOperationLogServiceImpl 19 | * Description: 20 | * 21 | * @author honghh 22 | * Date 2020/04/20 16:02 23 | * Copyright (C) www.honghh.top 24 | */ 25 | @Service("sysOperationLogService") 26 | public class SysOperationLogServiceImpl extends ServiceImpl implements SysOperationLogService { 27 | @Override 28 | public void insertLog(SysOperationLog log) { 29 | this.baseMapper.insert(log); 30 | } 31 | 32 | @Override 33 | public IPage getPage(SysOperationLog sysOperationLog, Integer pageSize, Integer pageNum) { 34 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(sysOperationLog); 35 | if (StrUtil.isNotEmpty(sysOperationLog.getBeginTime())) { 36 | wrapper.gt(SysOperationLog::getCreateTime, sysOperationLog.getBeginTime()); 37 | } 38 | 39 | if (StrUtil.isNotEmpty(sysOperationLog.getEndTime())) { 40 | wrapper.lt(SysOperationLog::getCreateTime, sysOperationLog.getEndTime()); 41 | } 42 | 43 | return page(new Page<>(pageNum, pageSize), wrapper); 44 | } 45 | 46 | @Override 47 | public int deleteByIds(Long[] ids) { 48 | return this.baseMapper.deleteBatchIds(Arrays.asList(ids)); 49 | } 50 | 51 | @Override 52 | public void clean() { 53 | this.baseMapper.clean(); 54 | } 55 | 56 | @Override 57 | public List getExportList(SysOperationLog sysOperationLog) { 58 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(sysOperationLog); 59 | if (StrUtil.isNotEmpty(sysOperationLog.getBeginTime())) { 60 | wrapper.gt(SysOperationLog::getCreateTime, sysOperationLog.getBeginTime()); 61 | } 62 | 63 | if (StrUtil.isNotEmpty(sysOperationLog.getEndTime())) { 64 | wrapper.lt(SysOperationLog::getCreateTime, sysOperationLog.getEndTime()); 65 | } 66 | return list(wrapper); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/oss/OssService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.oss; 2 | 3 | 4 | import cn.harry.oss.vo.OssCallbackResult; 5 | import cn.harry.oss.vo.OssPolicyResult; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | /** 10 | * oss上传管理Service 11 | * Created by macro on 2018/5/17. 12 | */ 13 | 14 | /** 15 | * ClassName: MybatisPlusConfig 16 | * Description: 17 | * 18 | * @author honghh 19 | * Date 2019/10/14 11:50 20 | * Copyright (C) www.honghh.top 21 | */ 22 | public interface OssService { 23 | /** 24 | * oss上传策略生成 25 | * 26 | * @return 27 | */ 28 | OssPolicyResult policy(); 29 | 30 | /** 31 | * oss上传成功回调 32 | * 33 | * @param request 34 | * @return 35 | */ 36 | OssCallbackResult callback(HttpServletRequest request); 37 | } 38 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/oss/vo/OssCallbackParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.oss.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | /** 6 | * ClassName: OssCallbackParam 7 | * Description: oss上传成功后的回调参数 8 | * 9 | * @author honghh 10 | * Date 2019/10/14 11:50 11 | * Copyright (C) www.honghh.top 12 | */ 13 | public class OssCallbackParam { 14 | @ApiModelProperty("请求的回调地址") 15 | private String callbackUrl; 16 | @ApiModelProperty("回调是传入request中的参数") 17 | private String callbackBody; 18 | @ApiModelProperty("回调时传入参数的格式,比如表单提交形式") 19 | private String callbackBodyType; 20 | 21 | public String getCallbackUrl() { 22 | return callbackUrl; 23 | } 24 | 25 | public void setCallbackUrl(String callbackUrl) { 26 | this.callbackUrl = callbackUrl; 27 | } 28 | 29 | public String getCallbackBody() { 30 | return callbackBody; 31 | } 32 | 33 | public void setCallbackBody(String callbackBody) { 34 | this.callbackBody = callbackBody; 35 | } 36 | 37 | public String getCallbackBodyType() { 38 | return callbackBodyType; 39 | } 40 | 41 | public void setCallbackBodyType(String callbackBodyType) { 42 | this.callbackBodyType = callbackBodyType; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/oss/vo/OssCallbackResult.java: -------------------------------------------------------------------------------- 1 | package cn.harry.oss.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | /** 6 | * ClassName: OssCallbackResult 7 | * Description: oss上传文件的回调结果 8 | * 9 | * @author honghh 10 | * Date 2019/10/14 11:50 11 | * Copyright (C) www.honghh.top 12 | */ 13 | public class OssCallbackResult { 14 | @ApiModelProperty("文件名称") 15 | private String filename; 16 | @ApiModelProperty("文件大小") 17 | private String size; 18 | @ApiModelProperty("文件的mimeType") 19 | private String mimeType; 20 | @ApiModelProperty("图片文件的宽") 21 | private String width; 22 | @ApiModelProperty("图片文件的高") 23 | private String height; 24 | 25 | public String getFilename() { 26 | return filename; 27 | } 28 | 29 | public void setFilename(String filename) { 30 | this.filename = filename; 31 | } 32 | 33 | public String getSize() { 34 | return size; 35 | } 36 | 37 | public void setSize(String size) { 38 | this.size = size; 39 | } 40 | 41 | public String getMimeType() { 42 | return mimeType; 43 | } 44 | 45 | public void setMimeType(String mimeType) { 46 | this.mimeType = mimeType; 47 | } 48 | 49 | public String getWidth() { 50 | return width; 51 | } 52 | 53 | public void setWidth(String width) { 54 | this.width = width; 55 | } 56 | 57 | public String getHeight() { 58 | return height; 59 | } 60 | 61 | public void setHeight(String height) { 62 | this.height = height; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/oss/vo/OssPolicyResult.java: -------------------------------------------------------------------------------- 1 | package cn.harry.oss.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | /** 6 | * ClassName: OssPolicyResult 7 | * Description: 获取OSS上传文件授权返回结果 8 | * 9 | * @author honghh 10 | * Date 2019/10/14 11:50 11 | * Copyright (C) www.honghh.top 12 | */ 13 | public class OssPolicyResult { 14 | @ApiModelProperty("访问身份验证中用到用户标识") 15 | private String accessKeyId; 16 | @ApiModelProperty("用户表单上传的策略,经过base64编码过的字符串") 17 | private String policy; 18 | @ApiModelProperty("对policy签名后的字符串") 19 | private String signature; 20 | @ApiModelProperty("上传文件夹路径前缀") 21 | private String dir; 22 | @ApiModelProperty("oss对外服务的访问域名") 23 | private String host; 24 | @ApiModelProperty("上传成功后的回调设置") 25 | private String callback; 26 | 27 | public String getAccessKeyId() { 28 | return accessKeyId; 29 | } 30 | 31 | public void setAccessKeyId(String accessKeyId) { 32 | this.accessKeyId = accessKeyId; 33 | } 34 | 35 | public String getPolicy() { 36 | return policy; 37 | } 38 | 39 | public void setPolicy(String policy) { 40 | this.policy = policy; 41 | } 42 | 43 | public String getSignature() { 44 | return signature; 45 | } 46 | 47 | public void setSignature(String signature) { 48 | this.signature = signature; 49 | } 50 | 51 | public String getDir() { 52 | return dir; 53 | } 54 | 55 | public void setDir(String dir) { 56 | this.dir = dir; 57 | } 58 | 59 | public String getHost() { 60 | return host; 61 | } 62 | 63 | public void setHost(String host) { 64 | this.host = host; 65 | } 66 | 67 | public String getCallback() { 68 | return callback; 69 | } 70 | 71 | public void setCallback(String callback) { 72 | this.callback = callback; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysAreaDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysArea; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 地区表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysAreaDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysCaptchaDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysCaptcha; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 图片验证码 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysCaptchaDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysConfigDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysConfig; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 系统配置信息表/枚举值表 9 | * 10 | * @author honghh 11 | * Date 2019-11-25 16:36:48 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysConfigDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysCountryDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysCountry; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 世界国旗图标 9 | * 10 | * @author honghh 11 | * Date 2019-10-22 10:38:46 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysCountryDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysDeptDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysDept; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 部门表 12 | * 13 | * @author honghh 14 | * Date 2020-03-16 08:51:37 15 | * Copyright (C) www.tech-harry.cn 16 | */ 17 | @Mapper 18 | public interface SysDeptDao extends BaseMapper { 19 | 20 | 21 | /** 22 | * 根据角色ID查询部门树信息 23 | * 24 | * @param roleId 角色ID 25 | * @return 选中部门列表 26 | */ 27 | List selectDeptListByRoleId(@Param("roleId") Long roleId); 28 | /** 29 | * 根据父级ID 获取子部门ID 30 | * 31 | * @param parentId 32 | * @return 33 | */ 34 | List queryDeptIdList(@Param("parentId") Long parentId); 35 | } 36 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysDictDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysDict; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 数据字典 9 | * 10 | * @author honghh 11 | * Date 2020-03-16 09:53:38 12 | * Copyright (C) www.tech-harry.cn 13 | */ 14 | @Mapper 15 | public interface SysDictDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysDictDetailDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysDictDetail; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 数据字典详情 9 | * 10 | * @author honghh 11 | * Date 2020-03-16 09:53:38 12 | * Copyright (C) www.tech-harry.cn 13 | */ 14 | @Mapper 15 | public interface SysDictDetailDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysMenuDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysMenu; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 后台用户权限表 12 | * 13 | * @author honghh 14 | * Date 2019-10-12 10:55:44 15 | * Copyright (C) www.honghh.top 16 | */ 17 | @Mapper 18 | public interface SysMenuDao extends BaseMapper { 19 | 20 | 21 | /** 22 | * 获取用户所有权限 23 | * 24 | * @param userId 25 | * @return 26 | */ 27 | List getPermissionList(@Param("userId") Long userId); 28 | 29 | /** 30 | * 查询用户的所有菜单ID 31 | * 32 | * @param userId 用户id 33 | * @return 该用户所有可用的菜单 34 | */ 35 | List listMenuByUserId(@Param("userId") Long userId); 36 | 37 | /** 38 | * 根据用户ID查询菜单 39 | * 40 | * @param userId 41 | * @return 42 | */ 43 | List selectMenuTreeByUserId(@Param("userId") Long userId); 44 | 45 | /** 46 | * 根据角色ID查询菜单树信息 47 | * 48 | * @param roleId 角色ID 49 | * @return 选中菜单列表 50 | */ 51 | List selectMenuListByRoleId(@Param("roleId") Long roleId); 52 | } 53 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysRoleDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysRole; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 后台用户角色表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysRoleDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysRoleDeptDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysRoleDept; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 角色部门关联 12 | * 13 | * @author honghh 14 | * Date 2020-03-16 08:51:37 15 | * Copyright (C) www.tech-harry.cn 16 | */ 17 | @Mapper 18 | public interface SysRoleDeptDao extends BaseMapper { 19 | 20 | /** 21 | * 根据角色ID,获取部门ID列表 22 | * 23 | * @param roleIdList 24 | * @return 25 | */ 26 | List queryDeptIdList(@Param("roleIdList") List roleIdList); 27 | } 28 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysRoleMenuDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysRoleMenu; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 后台用户角色和权限关系表 12 | * 13 | * @author honghh 14 | * Date 2019-10-12 10:55:44 15 | * Copyright (C) www.honghh.top 16 | */ 17 | @Mapper 18 | public interface SysRoleMenuDao extends BaseMapper { 19 | /** 20 | * 根据角色id 批量添加角色与菜单关系 21 | * @param roleId 22 | * @param menuIdList 23 | */ 24 | void insertRoleAndRoleMenu(@Param("roleId") Long roleId, @Param("menuIdList") List menuIdList); 25 | } 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysSmsLogDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysSmsLog; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 短信日志表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysSmsLogDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysSmsTemplateDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysSmsTemplate; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 短信模板 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysSmsTemplateDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysUserDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysUser; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 后台用户表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysUserDao extends BaseMapper { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysUserLoginLogDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysUserLoginLog; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 后台用户登录日志表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Mapper 15 | public interface SysUserLoginLogDao extends BaseMapper { 16 | 17 | /** 18 | * 清空 19 | * 20 | * @return 21 | */ 22 | int clean(); 23 | } 24 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/dao/SysUserRoleDao.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.dao; 2 | 3 | import cn.harry.sys.entity.SysUserRole; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 后台用户和角色关系表 12 | * 13 | * @author honghh 14 | * Date 2019-10-12 10:55:44 15 | * Copyright (C) www.honghh.top 16 | */ 17 | @Mapper 18 | public interface SysUserRoleDao extends BaseMapper { 19 | /** 20 | * 根据用户id 批量添加用户角色关系 21 | * @param userId 22 | * @param roleIdList 23 | */ 24 | void insertUserAndUserRole(@Param("userId") Long userId, @Param("roleIdList") List roleIdList); 25 | 26 | 27 | /** 28 | * 根据用户ID 获取角色数据权限标识 29 | * @param userId 30 | * @return 31 | */ 32 | List listDataScopesByUserId(Long userId); 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysArea.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 地区表 12 | * 13 | * @author honghh 14 | * Date 2019-10-14 10:39:24 15 | * Copyright (C) www.honghh.top 16 | */ 17 | @Data 18 | @TableName("sys_area") 19 | public class SysArea implements Serializable { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * ID 24 | */ 25 | @TableId 26 | @ApiModelProperty(value = "ID") 27 | private Long id; 28 | /** 29 | * 地区名称 30 | */ 31 | @ApiModelProperty(value = "地区名称") 32 | private String areaName; 33 | /** 34 | * 上级id 35 | */ 36 | @ApiModelProperty(value = "上级id") 37 | private Long parentId; 38 | /** 39 | * 层级 40 | */ 41 | @ApiModelProperty(value = "层级") 42 | private Integer level; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysCaptcha.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import io.swagger.annotations.ApiModelProperty; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 图片验证码 14 | * 15 | * @author honghh 16 | * Date 2019-10-14 10:39:24 17 | * Copyright (C) www.honghh.top 18 | */ 19 | @Data 20 | @TableName("sys_captcha") 21 | public class SysCaptcha implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * uuid 26 | */ 27 | @ApiModelProperty(value = "uuid") 28 | private String uuid; 29 | /** 30 | * 验证码 31 | */ 32 | @ApiModelProperty(value = "验证码") 33 | private String code; 34 | /** 35 | * 过期时间 36 | */ 37 | @ApiModelProperty(value = "过期时间") 38 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 39 | private Date expireTime; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.annotation.JsonIgnore; 7 | import io.swagger.annotations.ApiModelProperty; 8 | import lombok.Data; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 系统配置信息表/枚举值表 15 | * 16 | * @author honghh 17 | * Date 2019-11-25 16:36:48 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Data 21 | @TableName("sys_config") 22 | public class SysConfig implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * 27 | */ 28 | @TableId 29 | private Long id; 30 | /** 31 | * 系统内置: Y N 32 | */ 33 | @ApiModelProperty(value = "系统内置: Y N ") 34 | private String paramType; 35 | /** 36 | * key 37 | */ 38 | @ApiModelProperty(value = "key") 39 | @TableField(condition = SqlCondition.LIKE) 40 | private String paramKey; 41 | /** 42 | * value 43 | */ 44 | @ApiModelProperty(value = "value") 45 | private String paramValue; 46 | /** 47 | * name 48 | */ 49 | @ApiModelProperty(value = "name") 50 | @TableField(condition = SqlCondition.LIKE) 51 | private String paramName; 52 | /** 53 | * 状态 0:禁用 1:启用 54 | */ 55 | @ApiModelProperty(value = "状态 0:禁用 1:启用") 56 | private String status; 57 | /** 58 | * 备注 59 | */ 60 | @ApiModelProperty(value = "备注") 61 | private String remark; 62 | /** 63 | * 创建时间 64 | */ 65 | @ApiModelProperty(value = "创建时间") 66 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 67 | private Date createTime; 68 | /** 69 | * 修改时间 70 | */ 71 | @ApiModelProperty(value = "修改时间") 72 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 73 | private Date modifyTime; 74 | /** 75 | * 有效状态:0->无效;1->有效 76 | */ 77 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 78 | @TableLogic 79 | private Integer valid; 80 | 81 | 82 | /** 开始时间 */ 83 | @JsonIgnore 84 | @TableField(exist = false) 85 | private String beginTime; 86 | 87 | /** 结束时间 */ 88 | @JsonIgnore 89 | @TableField(exist = false) 90 | private String endTime; 91 | } 92 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysCountry.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import io.swagger.annotations.ApiModelProperty; 8 | import lombok.Data; 9 | 10 | import java.io.Serializable; 11 | import java.util.Date; 12 | 13 | /** 14 | * 世界国旗图标 15 | * 16 | * @author honghh 17 | * Date 2019-10-22 10:38:46 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Data 21 | @TableName("sys_country") 22 | public class SysCountry implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * id 27 | */ 28 | @TableId 29 | @ApiModelProperty(value = "id") 30 | private Long id; 31 | /** 32 | * 名称 33 | */ 34 | @ApiModelProperty(value = "名称") 35 | private String countryName; 36 | /** 37 | * 图标 38 | */ 39 | @ApiModelProperty(value = "图标") 40 | private String countryIcon; 41 | /** 42 | * 创建时间 43 | */ 44 | @ApiModelProperty(value = "创建时间") 45 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 46 | private Date createTime; 47 | /** 48 | * 修改时间 49 | */ 50 | @ApiModelProperty(value = "修改时间") 51 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 52 | private Date modifyTime; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysDept.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableLogic; 7 | import com.baomidou.mybatisplus.annotation.TableName; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | 12 | import java.io.Serializable; 13 | import java.util.ArrayList; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | /** 18 | * 部门表 19 | * 20 | * @author honghh 21 | * Date 2020-03-16 08:51:37 22 | * Copyright (C) www.tech-harry.cn 23 | */ 24 | @Data 25 | @TableName("sys_dept") 26 | public class SysDept implements Serializable { 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * 31 | */ 32 | @TableId 33 | @ApiModelProperty(value = "id") 34 | private Long id; 35 | /** 36 | * 名称 37 | */ 38 | @ApiModelProperty(value = "名称") 39 | private String name; 40 | /** 41 | * 上级部门 42 | */ 43 | @ApiModelProperty(value = "上级部门") 44 | private Long pid; 45 | /** 46 | * 启用状态:0->禁用;1->启用 47 | */ 48 | @ApiModelProperty(value = "启用状态:0->禁用;1->启用") 49 | private String status; 50 | /** 51 | * 祖级列表 52 | */ 53 | @ApiModelProperty(value = "祖级列表") 54 | private String ancestors; 55 | 56 | /** 57 | * 排序 58 | */ 59 | @ApiModelProperty(value = "排序") 60 | private Integer sort; 61 | 62 | /** 63 | * 负责人 64 | */ 65 | @ApiModelProperty(value = "负责人") 66 | private String leader; 67 | 68 | /** 69 | * 联系电话 70 | */ 71 | @ApiModelProperty(value = "联系电话") 72 | private String phone; 73 | 74 | /** 75 | * 邮箱 76 | */ 77 | @ApiModelProperty(value = "邮箱") 78 | private String email; 79 | /** 80 | * 创建时间 81 | */ 82 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 83 | @ApiModelProperty(value = "创建时间") 84 | private Date createTime; 85 | /** 86 | * 修改时间 87 | */ 88 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 89 | @ApiModelProperty(value = "修改时间") 90 | private Date modifyTime; 91 | /** 92 | * 有效状态:0->无效;1->有效 93 | */ 94 | @TableLogic 95 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 96 | private Integer valid; 97 | 98 | /** 99 | * 子部门 100 | */ 101 | @TableField(exist = false) 102 | private List children = new ArrayList<>(); 103 | } 104 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysDict.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.alibaba.excel.annotation.ExcelIgnore; 5 | import com.alibaba.excel.annotation.ExcelProperty; 6 | import com.alibaba.excel.annotation.write.style.ColumnWidth; 7 | import com.baomidou.mybatisplus.annotation.*; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import com.fasterxml.jackson.annotation.JsonIgnore; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Data; 12 | 13 | import java.io.Serializable; 14 | import java.util.Date; 15 | 16 | /** 17 | * 数据字典 18 | * 19 | * @author honghh 20 | * Date 2020-03-16 09:53:38 21 | * Copyright (C) www.tech-harry.cn 22 | */ 23 | @Data 24 | @TableName("sys_dict") 25 | public class SysDict implements Serializable { 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * 30 | */ 31 | @TableId 32 | @ApiModelProperty(value = "id") 33 | @ExcelProperty("ID") 34 | @ColumnWidth(10) 35 | private Long id; 36 | /** 37 | * 字典名称 38 | */ 39 | @ApiModelProperty(value = "字典名称") 40 | @ExcelProperty("字典名称") 41 | @ColumnWidth(15) 42 | @TableField(condition = SqlCondition.LIKE) 43 | private String name; 44 | 45 | /** 46 | * 字典类型 47 | */ 48 | @ApiModelProperty(value = "字典类型") 49 | @ExcelProperty("字典类型") 50 | @ColumnWidth(15) 51 | @TableField(condition = SqlCondition.LIKE) 52 | private String type; 53 | 54 | /** 55 | * 状态(1正常 0停用) 56 | */ 57 | @ExcelProperty("状态「1正常 0停用」") 58 | @ColumnWidth(25) 59 | @ApiModelProperty(value = "状态") 60 | private String status; 61 | /** 62 | * 描述 63 | */ 64 | @ExcelProperty("描述") 65 | @ColumnWidth(20) 66 | @ApiModelProperty(value = "描述") 67 | private String remark; 68 | /** 69 | * 创建时间 70 | */ 71 | @ExcelProperty("创建时间") 72 | @ColumnWidth(20) 73 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 74 | @ApiModelProperty(value = "创建时间") 75 | private Date createTime; 76 | /** 77 | * 修改时间 78 | */ 79 | @ExcelProperty("修改时间") 80 | @ColumnWidth(20) 81 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 82 | @ApiModelProperty(value = "修改时间") 83 | private Date modifyTime; 84 | /** 85 | * 有效状态:0->无效;1->有效 86 | */ 87 | @ExcelIgnore 88 | @TableLogic 89 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 90 | private Integer valid; 91 | 92 | 93 | /** 94 | * 开始时间 95 | */ 96 | @ExcelIgnore 97 | @JsonIgnore 98 | @TableField(exist = false) 99 | private String beginTime; 100 | 101 | /** 102 | * 结束时间 103 | */ 104 | @ExcelIgnore 105 | @JsonIgnore 106 | @TableField(exist = false) 107 | private String endTime; 108 | 109 | } 110 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysDictDetail.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.*; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import io.swagger.annotations.ApiModelProperty; 7 | import lombok.Data; 8 | 9 | import java.io.Serializable; 10 | import java.util.Date; 11 | 12 | /** 13 | * 数据字典详情 14 | * 15 | * @author honghh 16 | * Date 2020-03-16 09:53:38 17 | * Copyright (C) www.tech-harry.cn 18 | */ 19 | @Data 20 | @TableName("sys_dict_detail") 21 | public class SysDictDetail implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * 26 | */ 27 | @TableId 28 | @ApiModelProperty(value = "id") 29 | private Long id; 30 | 31 | /** 32 | * 字典排序 33 | */ 34 | @ApiModelProperty(value = "字典排序") 35 | private Long dictSort; 36 | 37 | /** 38 | * 字典标签 39 | */ 40 | @ApiModelProperty(value = "字典标签") 41 | @TableField(condition = SqlCondition.LIKE) 42 | private String dictLabel; 43 | 44 | /** 45 | * 字典键值 46 | */ 47 | @ApiModelProperty(value = "字典键值") 48 | private String dictValue; 49 | 50 | /** 51 | * 字典类型 52 | */ 53 | @ApiModelProperty(value = "字典类型") 54 | private String dictType; 55 | 56 | /** 57 | * 样式属性(其他样式扩展) 58 | */ 59 | @ApiModelProperty(value = "样式属性") 60 | private String cssClass; 61 | 62 | /** 63 | * 表格字典样式 64 | */ 65 | @ApiModelProperty(value = "表格字典样式") 66 | private String listClass; 67 | 68 | /** 69 | * 是否默认(Y是 N否) 70 | */ 71 | @ApiModelProperty(value = "是否默认") 72 | private String isDefault; 73 | 74 | /** 75 | * 状态(1正常 0停用) 76 | */ 77 | @ApiModelProperty(value = "状态") 78 | private String status; 79 | /** 80 | * 创建时间 81 | */ 82 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 83 | @ApiModelProperty(value = "创建时间") 84 | private Date createTime; 85 | /** 86 | * 修改时间 87 | */ 88 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 89 | @ApiModelProperty(value = "修改时间") 90 | private Date modifyTime; 91 | /** 92 | * 有效状态:0->无效;1->有效 93 | */ 94 | @TableLogic 95 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 96 | private Integer valid; 97 | 98 | } 99 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysMenu.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.fasterxml.jackson.annotation.JsonFormat; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Data; 10 | 11 | import java.io.Serializable; 12 | import java.util.ArrayList; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | /** 17 | * 后台用户权限表 18 | * 19 | * @author honghh 20 | * Date 2019-10-14 10:39:24 21 | * Copyright (C) www.honghh.top 22 | */ 23 | @Data 24 | @TableName("sys_menu") 25 | public class SysMenu implements Serializable { 26 | private static final long serialVersionUID = 1L; 27 | 28 | /** 29 | * 30 | */ 31 | @TableId 32 | private Long id; 33 | /** 34 | * 父级权限id 35 | */ 36 | @ApiModelProperty(value = "父级权限id") 37 | private Long pid; 38 | /** 39 | * 名称 40 | */ 41 | @ApiModelProperty(value = "名称") 42 | private String name; 43 | /** 44 | * 权限值 45 | */ 46 | @ApiModelProperty(value = "权限值") 47 | private String value; 48 | /** 49 | * 图标 50 | */ 51 | @ApiModelProperty(value = "图标") 52 | private String icon; 53 | /** 54 | * 权限类型:0->目录;1->菜单;2->按钮(接口绑定权限) 55 | */ 56 | @ApiModelProperty(value = "权限类型:0->目录;1->菜单;2->按钮(接口绑定权限)") 57 | private Integer type; 58 | /** 59 | * 前端资源路径 60 | */ 61 | @ApiModelProperty(value = "前端资源路径") 62 | private String uri; 63 | /** 64 | * 启用状态;0->禁用;1->启用 65 | */ 66 | @ApiModelProperty(value = "启用状态;0->禁用;1->启用") 67 | private String status; 68 | /** 69 | * 路由地址 70 | */ 71 | @ApiModelProperty(value = "路由地址") 72 | private String path; 73 | /** 74 | * 是否为外链(1是 0否) 75 | */ 76 | @ApiModelProperty(value = "是否为外链(1是 0否)") 77 | private String outerLink; 78 | /** 79 | * 创建时间 80 | */ 81 | @ApiModelProperty(value = "创建时间") 82 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 83 | private Date createTime; 84 | /** 85 | * 排序 86 | */ 87 | @ApiModelProperty(value = "排序") 88 | private Integer sort; 89 | 90 | @TableField(exist = false) 91 | private List list; 92 | 93 | @TableField(exist = false) 94 | private List children = new ArrayList<>(); 95 | } 96 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysRole.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.SqlCondition; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.baomidou.mybatisplus.annotation.TableId; 7 | import com.baomidou.mybatisplus.annotation.TableName; 8 | import com.fasterxml.jackson.annotation.JsonFormat; 9 | import com.fasterxml.jackson.annotation.JsonIgnore; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Data; 12 | 13 | import java.io.Serializable; 14 | import java.util.Date; 15 | import java.util.List; 16 | 17 | /** 18 | * 后台用户角色表 19 | * 20 | * @author honghh 21 | * Date 2019-10-14 10:39:25 22 | * Copyright (C) www.honghh.top 23 | */ 24 | @Data 25 | @TableName("sys_role") 26 | public class SysRole implements Serializable { 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * 31 | */ 32 | @TableId 33 | private Long id; 34 | /** 35 | * 名称 36 | */ 37 | @ApiModelProperty(value = "名称") 38 | @TableField(condition = SqlCondition.LIKE) 39 | private String name; 40 | /** 41 | * 角色权限 42 | */ 43 | @ApiModelProperty(value = "角色权限") 44 | @TableField(condition = SqlCondition.LIKE) 45 | private String roleKey; 46 | /** 47 | * 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) 48 | */ 49 | @ApiModelProperty(value = "数据范围") 50 | private String dataScope; 51 | /** 52 | * 描述 53 | */ 54 | @ApiModelProperty(value = "描述") 55 | private String description; 56 | /** 57 | * 后台用户数量 58 | */ 59 | @ApiModelProperty(value = "后台用户数量") 60 | private Integer adminCount; 61 | /** 62 | * 创建时间 63 | */ 64 | @ApiModelProperty(value = "创建时间") 65 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 66 | private Date createTime; 67 | /** 68 | * 启用状态:0->禁用;1->启用 69 | */ 70 | @ApiModelProperty(value = "启用状态:0->禁用;1->启用") 71 | private String status; 72 | /** 73 | * 排序 74 | */ 75 | @ApiModelProperty(value = "排序") 76 | private Integer sort; 77 | 78 | /** 79 | * 菜单组 80 | */ 81 | @TableField(exist = false) 82 | private List menuIds; 83 | 84 | /** 85 | * 部门组(数据权限) 86 | */ 87 | @TableField(exist = false) 88 | private Long[] deptIds; 89 | 90 | /** 开始时间 */ 91 | @JsonIgnore 92 | @TableField(exist = false) 93 | private String beginTime; 94 | 95 | /** 结束时间 */ 96 | @JsonIgnore 97 | @TableField(exist = false) 98 | private String endTime; 99 | 100 | } 101 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysRoleDept.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 角色部门关联 12 | * 13 | * @author honghh 14 | * Date 2020-03-16 08:51:37 15 | * Copyright (C) www.tech-harry.cn 16 | */ 17 | @Data 18 | @TableName("sys_role_dept") 19 | public class SysRoleDept implements Serializable { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * 24 | */ 25 | @TableId 26 | @ApiModelProperty(value = "id") 27 | private Long id; 28 | /** 29 | * 30 | */ 31 | @ApiModelProperty(value = "roleId") 32 | private Long roleId; 33 | /** 34 | * 35 | */ 36 | @ApiModelProperty(value = "deptId") 37 | private Long deptId; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysRoleMenu.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 后台用户角色和权限关系表 11 | * 12 | * @author honghh 13 | * Date 2019-10-14 10:39:25 14 | * Copyright (C) www.honghh.top 15 | */ 16 | @Data 17 | @TableName("sys_role_menu") 18 | public class SysRoleMenu implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * 23 | */ 24 | @TableId 25 | private Long id; 26 | /** 27 | * 28 | */ 29 | private Long roleId; 30 | /** 31 | * 32 | */ 33 | private Long menuId; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysSmsLog.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.fasterxml.jackson.annotation.JsonFormat; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Data; 10 | 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * 短信日志表 16 | * 17 | * @author honghh 18 | * Date 2019-10-14 10:39:25 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Data 22 | @TableName("sys_sms_log") 23 | public class SysSmsLog implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 短信记录id 28 | */ 29 | @TableId 30 | @ApiModelProperty(value = "短信记录id") 31 | private Long id; 32 | /** 33 | * 手机号 34 | */ 35 | @ApiModelProperty(value = "手机号") 36 | private String mobiles; 37 | /** 38 | * 参数 39 | */ 40 | @ApiModelProperty(value = "参数") 41 | private String param; 42 | /** 43 | * 短信内容 44 | */ 45 | @ApiModelProperty(value = "短信内容") 46 | private String content; 47 | /** 48 | * 短信类型 10 单发 20 群发 49 | */ 50 | @ApiModelProperty(value = "短信类型 10 单发 20 群发") 51 | private Integer type; 52 | /** 53 | * 短信类型名称 54 | */ 55 | @ApiModelProperty(value = "短信类型名称") 56 | private String typeName; 57 | /** 58 | * 模板号 59 | */ 60 | @ApiModelProperty(value = "模板号") 61 | private String templateCode; 62 | /** 63 | * 结果成功失败 0 失败 1 成功 64 | */ 65 | @ApiModelProperty(value = "结果成功失败 0 失败 1 成功") 66 | private String status; 67 | /** 68 | * 第三方返回结果 69 | */ 70 | @ApiModelProperty(value = "第三方返回结果") 71 | private String result; 72 | /** 73 | * 来源平台 74 | */ 75 | @ApiModelProperty(value = "来源平台") 76 | private Integer source; 77 | /** 78 | * 创建时间 79 | */ 80 | @ApiModelProperty(value = "创建时间") 81 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 82 | private Date createTime; 83 | /** 84 | * 修改时间 85 | */ 86 | @ApiModelProperty(value = "修改时间") 87 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 88 | private Date modifyTime; 89 | /** 90 | * 有效状态:0->无效;1->有效 91 | */ 92 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 93 | @TableLogic 94 | private Integer valid; 95 | 96 | } 97 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysSmsTemplate.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableLogic; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.fasterxml.jackson.annotation.JsonFormat; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Data; 10 | 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * 短信模板 16 | * 17 | * @author honghh 18 | * Date 2019-10-14 10:39:24 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Data 22 | @TableName("sys_sms_template") 23 | public class SysSmsTemplate implements Serializable { 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * id 28 | */ 29 | @TableId 30 | @ApiModelProperty(value = "id") 31 | private Long id; 32 | /** 33 | * 编号 34 | */ 35 | @ApiModelProperty(value = "编号") 36 | private Long value; 37 | /** 38 | * 作用 39 | */ 40 | @ApiModelProperty(value = "作用") 41 | private String name; 42 | /** 43 | * 短信签名 44 | */ 45 | @ApiModelProperty(value = "短信签名") 46 | private String signName; 47 | /** 48 | * 来源平台 49 | */ 50 | @ApiModelProperty(value = "来源平台") 51 | private Integer source; 52 | /** 53 | * 短信模板CODE 54 | */ 55 | @ApiModelProperty(value = "短信模板CODE") 56 | private String templateCode; 57 | /** 58 | * 模板内容 59 | */ 60 | @ApiModelProperty(value = "模板内容") 61 | private String content; 62 | /** 63 | * 创建时间 64 | */ 65 | @ApiModelProperty(value = "创建时间") 66 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 67 | private Date createTime; 68 | /** 69 | * 修改时间 70 | */ 71 | @ApiModelProperty(value = "修改时间") 72 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 73 | private Date modifyTime; 74 | /** 75 | * 有效状态:0->无效;1->有效 76 | */ 77 | @ApiModelProperty(value = "有效状态:0->无效;1->有效") 78 | @TableLogic 79 | private Integer valid; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/entity/SysUserRole.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * 后台用户和角色关系表 11 | * 12 | * @author honghh 13 | * Date 2019-10-14 10:39:24 14 | * Copyright (C) www.honghh.top 15 | */ 16 | @Data 17 | @TableName("sys_user_role") 18 | public class SysUserRole implements Serializable { 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * 23 | */ 24 | @TableId 25 | private Long id; 26 | /** 27 | * 28 | */ 29 | private Long userId; 30 | /** 31 | * 32 | */ 33 | private Long roleId; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/DataScopeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: DataScopeEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2020/04/28 17:21 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum DataScopeEnums { 17 | // 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限) 18 | ALL(1, "所有数据权限"), 19 | CUSTOMIZE(2, "自定义数据权限"), 20 | SELF(3, "本部门数据权限"), 21 | ; 22 | private Integer key; 23 | private String name; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/MenuTypeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * 菜单类型 8 | * 9 | * @author honghh 10 | * Date 2019-10-12 10:55:44 11 | * Copyright (C) www.honghh.top 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | public enum MenuTypeEnums { 16 | /** 17 | * 目录 18 | */ 19 | CATALOG(0), 20 | /** 21 | * 菜单 22 | */ 23 | MENU(1), 24 | /** 25 | * 按钮 26 | */ 27 | BUTTON(2); 28 | 29 | private int value; 30 | } 31 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/SmsCodeTypeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: SmsCodeTypeEnums 8 | * Description: 短信验证码类型(作用) 9 | * 10 | * @author honghh 11 | * Date 2019/09/06 11:32 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum SmsCodeTypeEnums { 17 | /** 18 | * 用户注册验证码 19 | */ 20 | USER_REGISTER(1001, "user_register", "user_register_", "用户注册验证码"), 21 | /** 22 | * 用户修改密码验证码 23 | */ 24 | USER_UPDATE_PASSWORD(1002, "user_password", "user_update_password_", "用户修改密码验证码"), 25 | ; 26 | 27 | 28 | private Integer code; 29 | private String type; 30 | private String value; 31 | private String name; 32 | 33 | public static String getValueByType(String type) { 34 | for (SmsCodeTypeEnums smsCodeTypeEnums : values()) { 35 | if (smsCodeTypeEnums.getType().equals(type)) { 36 | return smsCodeTypeEnums.getValue(); 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | /** 43 | * 根据type值获取 code 44 | * @param type 45 | * @return 46 | */ 47 | public static Integer getCodeByType(String type) { 48 | for (SmsCodeTypeEnums smsCodeTypeEnums : values()) { 49 | if (smsCodeTypeEnums.getType().equals(type)) { 50 | return smsCodeTypeEnums.getCode(); 51 | } 52 | } 53 | return null; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/SmsTemplateEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: SmsTypeEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/08/30 11:25 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum SmsTemplateEnums { 17 | /** 18 | * 注册验证码 19 | */ 20 | REGISTER_VERIFICATION_CODE(1001, "cbec注册验证码"), 21 | UPDATE_PASSWORD_VERIFICATION_CODE(1002, "修改密码验证码"), 22 | ; 23 | 24 | 25 | private Integer value; 26 | private String name; 27 | 28 | public static SmsTemplateEnums getByType(int value) { 29 | for (SmsTemplateEnums userType : values()) { 30 | if (userType.getValue().equals(value)) { 31 | return userType; 32 | } 33 | } 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/SmsTypeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: SmsTypeEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/08/30 11:25 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum SmsTypeEnums { 17 | /** 18 | * 单条信息 19 | */ 20 | SINGLE(10, "单条短信"), 21 | /** 22 | * 群发信息 23 | */ 24 | BATCH(20, "群发短信"), 25 | ; 26 | 27 | 28 | private Integer value; 29 | private String name; 30 | 31 | public static SmsTypeEnums getByType(int value) { 32 | for (SmsTypeEnums userType : values()) { 33 | if (userType.getValue().equals(value)) { 34 | return userType; 35 | } 36 | } 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/StatusEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: StatusEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2020/04/13 11:18 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum StatusEnums { 17 | /** 18 | * 禁用 19 | */ 20 | DISABLE("0", "禁用"), 21 | /** 22 | * 启用 23 | */ 24 | ENABLE("1", "启用"), 25 | ; 26 | 27 | 28 | private String key; 29 | private String name; 30 | } 31 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/enums/SysParamTypeEnums.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ClassName: SysParamTypeEnums 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/11/25 17:01 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Getter 15 | @AllArgsConstructor 16 | public enum SysParamTypeEnums { 17 | // 系统配置 订单取消原因 18 | ORDER_CANCEL_REASON("order_cancel_reason", "订单取消原因"), 19 | 20 | BANK("bank", "银行"), 21 | 22 | SHOP_TYPE("shop_type", "店铺类型"), 23 | 24 | CMS_HELP_CATEGORY("help_category", "帮助问题"), 25 | ; 26 | private String type; 27 | private String name; 28 | } 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/param/SmsCodeParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.param; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * ClassName: SmsCodeParam 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2019/08/30 10:13 13 | * Copyright (C) www.honghh.top 14 | */ 15 | @Data 16 | public class SmsCodeParam { 17 | /** 18 | * 手机号 19 | */ 20 | private String mobile; 21 | /** 22 | * 短信类型【非必须】 23 | */ 24 | private Integer msgType; 25 | /** 26 | * 验证码 27 | */ 28 | private String msgCode; 29 | /** 30 | * 参数 31 | */ 32 | private Map params; 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/param/SysUserCreatByMemberParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.param; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * ClassName: SysUserUpdatePasswordParam 8 | * Description: 修改密码参数 9 | * 10 | * @author honghh 11 | * Date 2019/10/24 10:00 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Data 15 | public class SysUserCreatByMemberParam { 16 | @ApiModelProperty(value = "密码", required = true) 17 | private String password; 18 | 19 | @ApiModelProperty(value = "手机号码") 20 | private String username; 21 | 22 | @ApiModelProperty(value = "商家信息id") 23 | private Long merchantId; 24 | 25 | @ApiModelProperty(value = "店铺ID") 26 | private Long shopId; 27 | 28 | /** 29 | * 店铺名称(数字、中文,英文(可混合,不可有特殊字符),可修改)、不唯一 30 | */ 31 | @ApiModelProperty(value = "店铺名称(数字、中文,英文(可混合,不可有特殊字符),可修改)、不唯一") 32 | private String shopName; 33 | } 34 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/param/SysUserLoginParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.param; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * 用户登录参数 8 | * 9 | * @author honghh 10 | * Date 2019/08/30 11:19 11 | * Copyright (C) www.honghh.top 12 | */ 13 | @Data 14 | public class SysUserLoginParam { 15 | @ApiModelProperty(value = "用户名", required = true) 16 | private String username; 17 | @ApiModelProperty(value = "密码", required = true) 18 | private String password; 19 | /** 20 | * 验证码 21 | */ 22 | @ApiModelProperty(value = "验证码", required = true) 23 | private String code; 24 | 25 | /** 26 | * 唯一标识 27 | */ 28 | @ApiModelProperty(value = "唯一标识", required = true) 29 | private String uuid = ""; 30 | } 31 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/param/SysUserUpdatePasswordParam.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.param; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * ClassName: SysUserUpdatePasswordParam 8 | * Description: 修改密码参数 9 | * 10 | * @author honghh 11 | * Date 2019/10/24 10:00 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Data 15 | public class SysUserUpdatePasswordParam { 16 | @ApiModelProperty(value = "密码", required = true) 17 | private String password; 18 | @ApiModelProperty(value = "新密码", required = true) 19 | private String newPassword; 20 | } 21 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/OnlineUserService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysUser; 4 | import cn.harry.sys.vo.OnlineUser; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import java.util.List; 8 | 9 | /** 10 | * ClassName: OnlineUserService 11 | * Description: 12 | * 13 | * @author honghh 14 | * Date 2020/03/07 16:34 15 | * Copyright (C) www.honghh.top 16 | */ 17 | public interface OnlineUserService { 18 | /** 19 | * 保存在线信息 20 | * 21 | * @param sysUser 22 | * @param token 23 | * @param expiration 24 | * @param request 25 | */ 26 | void save(SysUser sysUser, String token, String expiration, HttpServletRequest request); 27 | 28 | /** 29 | * 踢掉之前已经登录的token 30 | * 31 | * @param username 32 | * @param token 33 | */ 34 | void checkLoginOnUser(String username, String token); 35 | 36 | /** 37 | * 踢出用户 38 | * 39 | * @param key 40 | * @throws Exception 41 | */ 42 | void kickOut(String key) throws Exception; 43 | 44 | /** 45 | * 退出登录 46 | * 47 | * @param token 48 | */ 49 | void logout(String token); 50 | 51 | /** 52 | * 根据关键字获取所有 在线用户 53 | * 54 | * @param filter 55 | * @return 56 | */ 57 | List getAll(String filter); 58 | 59 | 60 | // void save(JwtUser jwtUser, String token, HttpServletRequest request); 61 | } 62 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SmsService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.param.SmsParam; 4 | 5 | /** 6 | * ClassName: SmsService 7 | * Description: 8 | * 9 | * @author honghh 10 | * Date 2019/08/30 08:56 11 | * Copyright (C) www.honghh.top 12 | */ 13 | public interface SmsService { 14 | /** 15 | * desc 获取短信验证码 16 | * 17 | * @param mobile 手机号 18 | * @param msgCodType 手机验证码类型 19 | * @return 20 | * @author honghh 21 | * date 2019-08-30 11:37 22 | */ 23 | String sendSmsCode(String mobile, String msgCodType); 24 | 25 | /** 26 | * desc 验证短信验证码 27 | * 28 | * @param mobile 手机号 29 | * @param msgCode 验证码 30 | * @param msgCodType 手机验证码类型 31 | * @return 32 | * @author honghh 33 | * date 2019-08-30 11:38 34 | */ 35 | boolean verifySmsCode(String mobile, String msgCode, String msgCodType); 36 | 37 | /** 38 | * desc 发送短信 39 | * 40 | * @param smsParam 手机号 41 | * @return Boolean 42 | * @author honghh 43 | * date 2019-08-30 11:37 44 | */ 45 | Boolean sendSms(SmsParam smsParam); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SmsStrategy.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; 4 | import cn.harry.sys.vo.SmsTemplateDto; 5 | import cn.harry.sys.param.SmsParam; 6 | 7 | /** 8 | * ClassName: SmsStrategy 9 | * Description: 10 | * 11 | * @author honghh 12 | * Date 2019/08/30 14:06 13 | * Copyright (C) www.honghh.top 14 | */ 15 | public interface SmsStrategy { 16 | 17 | /** 18 | * 第三方发送短信策略 19 | * 20 | * @param smsParam 21 | * @param smsTemplate 22 | * @return 返回第三方发送结果 23 | */ 24 | SendSmsResponse send(SmsParam smsParam, SmsTemplateDto smsTemplate); 25 | } 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysAreaService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.vo.SysAreaResult; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 地区表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public interface SysAreaService { 15 | 16 | /** 17 | * 地区 18 | * 19 | * @return 20 | */ 21 | List allList(); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysCaptchaService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import java.awt.image.BufferedImage; 4 | 5 | /** 6 | * 图片验证码 7 | * 8 | * @author honghh 9 | * Date 2019-10-12 10:55:44 10 | * Copyright (C) www.honghh.top 11 | */ 12 | public interface SysCaptchaService { 13 | 14 | /** 15 | * 获取图片验证码 16 | * @param uuid 17 | * @return 18 | */ 19 | BufferedImage getCaptcha(String uuid); 20 | /** 21 | * 验证码效验 22 | * @param uuid uuid 23 | * @param code 验证码 24 | * @return true:成功 false:失败 25 | */ 26 | boolean validate(String uuid, String code); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysConfigService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysConfig; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 系统配置信息表/枚举值表 10 | * 11 | * @author honghh 12 | * Date 2019-11-25 16:36:48 13 | * Copyright (C) www.honghh.top 14 | */ 15 | public interface SysConfigService { 16 | /** 17 | * 分页获取字典 18 | * 19 | * @param sysConfig 20 | * @param pageSize 21 | * @param pageNum 22 | * @return 23 | */ 24 | IPage getPage(SysConfig sysConfig, Integer pageSize, Integer pageNum); 25 | 26 | 27 | /** 28 | * 获取系统配置信息 29 | * 30 | * @param id 31 | * @return 32 | */ 33 | SysConfig selectById(Long id); 34 | 35 | /** 36 | * 新建配置参数 37 | * 38 | * @param sysConfig 39 | * @return 40 | */ 41 | int create(SysConfig sysConfig); 42 | 43 | /** 44 | * 修改配置参数状态 45 | * 46 | * @param id 47 | * @param status 48 | * @return 49 | */ 50 | int updateStatus(Long id, String status); 51 | 52 | /** 53 | * 删除指定配置参数 54 | * 55 | * @param id 56 | * @return 57 | */ 58 | int delete(Long id); 59 | 60 | /** 61 | * 修改指定配置参数 62 | * 63 | * @param id 64 | * @param sysConfig 65 | * @return 66 | */ 67 | int update(Long id, SysConfig sysConfig); 68 | 69 | /** 70 | * 批量删除 71 | * 72 | * @param ids 73 | * @return 74 | */ 75 | int deleteByIds(Long[] ids); 76 | 77 | /** 78 | * 导出 79 | * 80 | * @param sysConfig 81 | * @return 82 | */ 83 | List getExportList(SysConfig sysConfig); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysCountryService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysCountry; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 世界国旗图标 9 | * 10 | * @author honghh 11 | * Date 2019-10-22 10:38:46 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public interface SysCountryService { 15 | 16 | /** 17 | * 获取全部世界国旗图标 18 | * 19 | * @return 20 | */ 21 | List allList(); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysDeptService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysDept; 4 | import cn.harry.sys.vo.TreeSelect; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * 部门表 11 | * 12 | * @author honghh 13 | * Date 2020-03-16 08:51:37 14 | * Copyright (C) www.tech-harry.cn 15 | */ 16 | public interface SysDeptService { 17 | 18 | 19 | /** 20 | * 新增部门信息 21 | * 22 | * @param sysDept 23 | * @return 24 | */ 25 | int create(SysDept sysDept); 26 | 27 | /** 28 | * 修改部门状态 29 | * 30 | * @param id 31 | * @param status 32 | * @return 33 | */ 34 | int updateStatus(Long id, String status); 35 | 36 | /** 37 | * 修改部门信息 38 | * 39 | * @param id 40 | * @param sysDept 41 | * @return 42 | */ 43 | int update(Long id, SysDept sysDept); 44 | 45 | /** 46 | * 删除部门信息 47 | * 48 | * @param id 49 | * @return 50 | */ 51 | int delete(Long id); 52 | 53 | /** 54 | * 查询部门管理数据 55 | * 56 | * @param params 部门信息 57 | * @return 部门信息集合 58 | */ 59 | List selectDeptList(Map params); 60 | 61 | /** 62 | * 根据角色ID查询部门树信息 63 | * 64 | * @param roleId 角色ID 65 | * @return 选中部门列表 66 | */ 67 | List selectDeptListByRoleId(Long roleId); 68 | 69 | /** 70 | * 构建前端所需要下拉树结构 71 | * 72 | * @param depts 部门列表 73 | * @return 下拉树结构列表 74 | */ 75 | List buildDeptTreeSelect(List depts); 76 | 77 | /** 78 | * 构建前端所需要树结构 79 | * 80 | * @param depts 部门列表 81 | * @return 树结构列表 82 | */ 83 | List buildDeptTree(List depts); 84 | 85 | /** 86 | * 根据部门编号获取详细信息 87 | * 88 | * @param id 89 | * @return 90 | */ 91 | SysDept selectById(Long id); 92 | 93 | /** 94 | * 获取子部门ID,用于数据过滤 95 | * 96 | * @param deptId 97 | * @return 98 | */ 99 | List getSubDeptIdList(Long deptId); 100 | } 101 | 102 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysDictDetailService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysDictDetail; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 数据字典详情 10 | * 11 | * @author honghh 12 | * Date 2020-03-16 09:53:38 13 | * Copyright (C) www.tech-harry.cn 14 | */ 15 | public interface SysDictDetailService { 16 | 17 | /** 18 | * 根据字典类型查询字典数据信息 19 | * 20 | * @param dictType 21 | * @return 22 | */ 23 | List selectDictDataByType(String dictType); 24 | 25 | /** 26 | * 分页查询字典数据 27 | * 28 | * @param dictDetail 29 | * @param pageSize 30 | * @param pageNum 31 | * @return 32 | */ 33 | IPage getPage(SysDictDetail dictDetail, Integer pageSize, Integer pageNum); 34 | 35 | /** 36 | * 详情 37 | * 38 | * @param id 39 | * @return 40 | */ 41 | SysDictDetail selectById(Long id); 42 | 43 | /** 44 | * 创建 45 | * 46 | * @param dictDetail 47 | * @return 48 | */ 49 | int create(SysDictDetail dictDetail); 50 | 51 | /** 52 | * 修改状态 53 | * 54 | * @param id 55 | * @param status 56 | * @return 57 | */ 58 | int updateStatus(Long id, String status); 59 | 60 | /** 61 | * 修改 62 | * 63 | * @param id 64 | * @param dictDetail 65 | * @return 66 | */ 67 | int update(Long id, SysDictDetail dictDetail); 68 | 69 | /** 70 | * 批量删除 71 | * 72 | * @param ids 73 | * @return 74 | */ 75 | int deleteByIds(Long[] ids); 76 | 77 | /** 78 | * 导出 79 | * @param dictDetail 80 | * @return 81 | */ 82 | List getExportList(SysDictDetail dictDetail); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysDictService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysDict; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 数据字典 10 | * 11 | * @author honghh 12 | * Date 2020-03-16 09:53:38 13 | * Copyright (C) www.tech-harry.cn 14 | */ 15 | public interface SysDictService { 16 | 17 | /** 18 | * 根据关键字查询字典信息 19 | * 20 | * @param sysDict 21 | * @param pageSize 22 | * @param pageNum 23 | * @return 24 | */ 25 | IPage getPage(SysDict sysDict, Integer pageSize, Integer pageNum); 26 | 27 | /** 28 | * 创建字典信息 29 | * 30 | * @param sysDict 31 | * @return 32 | */ 33 | int create(SysDict sysDict); 34 | 35 | /** 36 | * 修改字典状态 37 | * 38 | * @param id 39 | * @param status 40 | * @return 41 | */ 42 | int updateStatus(Long id, String status); 43 | 44 | /** 45 | * 更新字典 46 | * 47 | * @param id 48 | * @param sysDict 49 | * @return 50 | */ 51 | int update(Long id, SysDict sysDict); 52 | 53 | /** 54 | * 根据ID 获取字典信息 55 | * 56 | * @param id 57 | * @return 58 | */ 59 | SysDict selectById(Long id); 60 | 61 | /** 62 | * 批量删除 63 | * 64 | * @param ids 65 | * @return 66 | */ 67 | int deleteByIds(Long[] ids); 68 | 69 | /** 70 | * 获取导出的数据 71 | * 72 | * @param sysDict 73 | * @return 74 | */ 75 | List getExportList(SysDict sysDict); 76 | } 77 | 78 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysMenuService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysMenu; 4 | import cn.harry.sys.vo.RouterVo; 5 | import cn.harry.sys.vo.TreeSelect; 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * 后台用户权限表 12 | * 13 | * @author honghh 14 | * Date 2019-10-12 10:55:44 15 | * Copyright (C) www.honghh.top 16 | */ 17 | public interface SysMenuService extends IService { 18 | 19 | /** 20 | * 获取用户所有权限 包括:根/菜单/按钮 21 | * 22 | * @param userId 23 | * @return 24 | */ 25 | List selectMenuList(Long userId); 26 | 27 | /** 28 | * 根据用户ID查询菜单树信息 29 | * 30 | * @param userId 31 | * @return 32 | */ 33 | List selectMenuTreeByUserId(Long userId); 34 | 35 | /** 36 | * 构建前端路由所需要的菜单 37 | * 38 | * @param menus 菜单列表 39 | * @return 路由列表 40 | */ 41 | List buildMenus(List menus); 42 | 43 | 44 | /** 45 | * 根据用户查询系统菜单列表 46 | * 47 | * @param menu 菜单信息 48 | * @param userId 用户ID 49 | * @return 菜单列表 50 | */ 51 | List selectMenuList(SysMenu menu, Long userId); 52 | 53 | /** 54 | * 根据角色ID查询菜单树信息 55 | * 56 | * @param roleId 角色ID 57 | * @return 选中菜单列表 58 | */ 59 | List selectMenuListByRoleId(Long roleId); 60 | 61 | /** 62 | * 构建前端所需要下拉树结构 63 | * 64 | * @param menus 菜单列表 65 | * @return 下拉树结构列表 66 | */ 67 | List buildMenuTreeSelect(List menus); 68 | 69 | /** 70 | * 构建前端所需要树结构 71 | * 72 | * @param menus 菜单列表 73 | * @return 树结构列表 74 | */ 75 | List buildMenuTree(List menus); 76 | 77 | /** 78 | * 新增保存菜单信息 79 | * 80 | * @param menu 81 | * @return 82 | */ 83 | int create(SysMenu menu); 84 | 85 | /** 86 | * 修改保存菜单信息 87 | * 88 | * @param id 89 | * @param menu 90 | * @return 91 | */ 92 | int update(Long id, SysMenu menu); 93 | 94 | /** 95 | * 删除菜单管理信息 96 | * 97 | * @param id 98 | * @return 99 | */ 100 | int deleteById(Long id); 101 | } 102 | 103 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysRoleDeptService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysRoleDept; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 角色部门关联 9 | * 10 | * @author honghh 11 | * Date 2020-03-16 08:51:37 12 | * Copyright (C) www.tech-harry.cn 13 | */ 14 | public interface SysRoleDeptService { 15 | 16 | /** 17 | * 通过角色ID删除角色和部门关联 18 | * 19 | * @param roleId 20 | * @return 21 | */ 22 | int deleteRoleDeptByRoleId(Long roleId); 23 | 24 | /** 25 | * 批量新增角色部门信息 26 | * 27 | * @param list 28 | * @return 29 | */ 30 | int batchRoleDept(List list); 31 | 32 | /** 33 | * 根据角色ID,获取部门ID列表 34 | * @param roleIdList 35 | * @return 36 | */ 37 | List queryDeptIdList(List roleIdList); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysRoleMenuService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysRoleMenu; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 后台用户角色和权限关系表 10 | * 11 | * @author honghh 12 | * Date 2019-10-12 10:55:44 13 | * Copyright (C) www.honghh.top 14 | */ 15 | public interface SysRoleMenuService extends IService { 16 | 17 | /** 18 | * 根据菜单id 删除菜单关联角色信息 19 | * 20 | * @param menuId 21 | */ 22 | void deleteByMenuId(Long menuId); 23 | 24 | /** 25 | * 根据角色ID,获取菜单列表 26 | * 27 | * @param roleId 角色id 28 | * @return 角色所拥有的菜单id列表 29 | */ 30 | List listMenuIdByRoleId(Long roleId); 31 | 32 | /** 33 | * 查询菜单使用数量 34 | * 35 | * @param menuId 36 | * @return 37 | */ 38 | int checkMenuExistRole(Long menuId); 39 | 40 | /** 41 | * 根据角色id 批量添加角色与菜单关系 42 | * @param id 43 | * @param menuIds 44 | */ 45 | void insertRoleAndRoleMenu(Long id, List menuIds); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysRoleService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import cn.harry.sys.entity.SysRole; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * 后台用户角色表 11 | * 12 | * @author honghh 13 | * Date 2019-10-12 10:55:44 14 | * Copyright (C) www.honghh.top 15 | */ 16 | public interface SysRoleService extends IService { 17 | 18 | /** 19 | * 分页获取用户角色 20 | * 21 | * @param sysRole 22 | * @param pageSize 23 | * @param pageNum 24 | * @return 25 | */ 26 | IPage getPage(SysRole sysRole, Integer pageSize, Integer pageNum); 27 | 28 | /** 29 | * 创建 30 | * 31 | * @param sysRole 32 | * @return 33 | */ 34 | int create(SysRole sysRole); 35 | 36 | /** 37 | * 更新 38 | * 39 | * @param id 40 | * @param sysRole 41 | * @return 42 | */ 43 | int update(Long id, SysRole sysRole); 44 | 45 | /** 46 | * 删除 47 | * 48 | * @param id 49 | * @return 50 | */ 51 | int delete(Long id); 52 | 53 | /** 54 | * 批量删除角色信息 55 | * 56 | * @param ids 57 | * @return 58 | */ 59 | int deleteByIds(Long[] ids); 60 | 61 | /** 62 | * 修改数据权限信息 63 | * 64 | * @param id 65 | * @param sysRole 66 | * @return 67 | */ 68 | int dataScope(Long id, SysRole sysRole); 69 | 70 | /** 71 | * 修改角色状态 72 | * 73 | * @param role 角色信息 74 | * @return 结果 75 | */ 76 | int updateRoleStatus(SysRole role); 77 | 78 | /** 79 | * 获取所有的角色列表 80 | * 81 | * @return 82 | */ 83 | List getListAll(); 84 | 85 | /** 86 | * 导出 87 | * @param role 88 | * @return 89 | */ 90 | List getExportList(SysRole role); 91 | } 92 | 93 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysSmsLogService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.param.SmsParam; 4 | import cn.harry.sys.vo.SmsTemplateDto; 5 | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; 6 | 7 | /** 8 | * 短信日志表 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | public interface SysSmsLogService { 15 | /** 16 | * 17 | * desc 保存短信发送日志 18 | * 19 | * @author honghh 20 | * date 2019-08-30 14:38 21 | * @param smsParam 22 | * @param smsTemplate 23 | * @param sendSmsResponse 24 | * @return 25 | */ 26 | Boolean addSmsLog(SmsParam smsParam, SmsTemplateDto smsTemplate, SendSmsResponse sendSmsResponse); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysSmsTemplateService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.vo.SmsTemplateDto; 4 | 5 | /** 6 | * 短信模板 7 | * 8 | * @author honghh 9 | * Date 2019-10-12 10:55:44 10 | * Copyright (C) www.honghh.top 11 | */ 12 | public interface SysSmsTemplateService { 13 | 14 | /** 15 | * 16 | * desc 获取短信模板 17 | * 18 | * @author honghh 19 | * date 2019-08-30 14:28 20 | * @param value 21 | * @return 22 | */ 23 | SmsTemplateDto geSmsTemplateByCode(Long value); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysUserLoginLogService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysUserLoginLog; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 后台用户登录日志表 10 | * 11 | * @author honghh 12 | * Date 2019-10-12 10:55:44 13 | * Copyright (C) www.honghh.top 14 | */ 15 | public interface SysUserLoginLogService { 16 | 17 | /** 18 | * 创建用户登陆历史 19 | * 20 | * @param sysUserLoginLog 21 | * @return 22 | */ 23 | int create(SysUserLoginLog sysUserLoginLog); 24 | 25 | /** 26 | * 根据关键字删除key 27 | * 28 | * @param key 29 | */ 30 | boolean deleteByKey(String key); 31 | 32 | /** 33 | * 分页获取日志信息 34 | * 35 | * @param loginLog 36 | * @param pageSize 37 | * @param pageNum 38 | * @return 39 | */ 40 | IPage getPage(SysUserLoginLog loginLog, Integer pageSize, Integer pageNum); 41 | 42 | /** 43 | * 批量删除 44 | * 45 | * @param ids 46 | * @return 47 | */ 48 | int deleteByIds(Long[] ids); 49 | 50 | /** 51 | * 清空 52 | * 53 | * @return 54 | */ 55 | int clean(); 56 | 57 | /** 58 | * 导出 59 | * 60 | * @param loginLog 61 | * @return 62 | */ 63 | List getExportList(SysUserLoginLog loginLog); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysUserRoleService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import cn.harry.sys.entity.SysUserRole; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 后台用户和角色关系表 10 | * 11 | * @author honghh 12 | * Date 2019-10-12 10:55:44 13 | * Copyright (C) www.honghh.top 14 | */ 15 | public interface SysUserRoleService extends IService { 16 | 17 | /** 18 | * 根据用户ID,获取角色ID列表 19 | * 20 | * @param userId 用户id 21 | * @return 角色id列表 22 | */ 23 | List listRoleIdByUserId(Long userId); 24 | 25 | /** 26 | * 根据用户id 批量添加用户角色关系 27 | * @param userId 28 | * @param roleIdList 29 | */ 30 | void insertUserAndUserRole(Long userId, List roleIdList); 31 | 32 | /** 33 | * 删除历史角色 创建新的角色 34 | * @param userId 35 | * @param roleIdList 36 | * @return 37 | */ 38 | void delAndCreateRole(Long userId, List roleIdList); 39 | 40 | /** 41 | * 根据用户ID 获取权限标识 42 | * @param id 43 | * @return 44 | */ 45 | List listDataScopesByUserId(Long id); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/SysUserService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import cn.harry.sys.entity.SysUser; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * 后台用户表 12 | * 13 | * @author honghh 14 | * Date 2019-10-12 10:55:44 15 | * Copyright (C) www.honghh.top 16 | */ 17 | public interface SysUserService { 18 | 19 | /** 20 | * 根据用户名获取后台管理员 21 | * 22 | * @param username 用户名 23 | * @return cn.harry.sys.entity.SysUser 24 | */ 25 | SysUser getByUserName(String username); 26 | 27 | /** 28 | * 登录功能 29 | * 30 | * @param username 用户名 31 | * @param password 密码 32 | * @param request 33 | * @return 生成的JWT的token 34 | */ 35 | String login(String username, String password, HttpServletRequest request); 36 | 37 | /** 38 | * 刷新token的功能 39 | * 40 | * @param oldToken 旧的token 41 | * @return String 42 | */ 43 | String refreshToken(String oldToken); 44 | 45 | /** 46 | * 根据用户id获取用户 47 | * 48 | * @param id 49 | * @return 50 | */ 51 | SysUser getUserById(Long id); 52 | 53 | /** 54 | * 修改指定用户信息 55 | * 56 | * @param id 57 | * @param admin 58 | * @return 59 | */ 60 | int update(Long id, SysUser admin); 61 | 62 | /** 63 | * 删除指定用户 64 | * 65 | * @param id 66 | * @return 67 | */ 68 | int delete(Long id); 69 | 70 | 71 | /** 72 | * 分页获取数据 73 | * 74 | * @param params 75 | * @return 76 | */ 77 | IPage getPage(Map params); 78 | 79 | /** 80 | * 更新用户以及权限 81 | * 82 | * @param user 83 | * @return 84 | */ 85 | int updateUserAndRole(SysUser user); 86 | 87 | /** 88 | * 修改密码 89 | * 90 | * @param userId 用户ID 91 | * @param newPassword 新密码 92 | * @return 93 | */ 94 | int updatePasswordByUserId(Long userId, String newPassword); 95 | 96 | /** 97 | * 修改用户状态 98 | * 99 | * @param id 100 | * @param status 101 | * @return 102 | */ 103 | int updateStatus(Long id, String status); 104 | 105 | /** 106 | * 创建用户及权限 107 | * 108 | * @param user 109 | * @return 110 | */ 111 | int insertUserAndRole(SysUser user); 112 | 113 | /** 114 | * 批量删除用户 115 | * 116 | * @param ids 117 | * @return 118 | */ 119 | int deleteByIds(Long[] ids); 120 | 121 | /** 122 | * 导出 123 | * @param params 124 | * @return 125 | */ 126 | List getExportList(Map params); 127 | } 128 | 129 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/FakeSmsStrategy.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.param.SmsParam; 4 | import cn.harry.sys.service.SmsStrategy; 5 | import cn.harry.sys.vo.SmsTemplateDto; 6 | import com.alibaba.fastjson.JSON; 7 | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * ClassName: FakeSmsStrategy 14 | * Description: 伪造发送短信信息 15 | * 16 | * @author honghh 17 | * Date 2019/08/30 14:13 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Slf4j 21 | @Component 22 | @ConditionalOnProperty(value = "harry.sms.enabled", havingValue = "false") 23 | public class FakeSmsStrategy implements SmsStrategy { 24 | 25 | @Override 26 | public SendSmsResponse send(SmsParam smsParam, SmsTemplateDto smsTemplate) { 27 | return JSON.parseObject("{\"bizId\":\"111111111\",\"code\":\"OK\",\"message\":\"并未真实发送\",\"requestId\":\"111111111\"}", SendSmsResponse.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysAreaServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.common.utils.BeanUtils; 4 | import cn.harry.common.utils.TreeUtils; 5 | import cn.harry.sys.dao.SysAreaDao; 6 | import cn.harry.sys.entity.SysArea; 7 | import cn.harry.sys.service.SysAreaService; 8 | import cn.harry.sys.vo.SysAreaResult; 9 | import cn.hutool.core.collection.CollectionUtil; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | /** 17 | * 地区表 18 | * 19 | * @author honghh 20 | * Date 2019-10-12 10:55:44 21 | * Copyright (C) www.honghh.top 22 | */ 23 | @Service("sysAreaService") 24 | public class SysAreaServiceImpl extends ServiceImpl implements SysAreaService { 25 | 26 | @Override 27 | public List allList() { 28 | List mainCategoryList = new ArrayList<>(); 29 | TreeUtils treeUtils = new TreeUtils(); 30 | List list = list(); 31 | if (CollectionUtil.isNotEmpty(list)) { 32 | List results = BeanUtils.transformList(SysAreaResult.class, list); 33 | mainCategoryList = treeUtils.menuList(results); 34 | } 35 | 36 | return mainCategoryList; 37 | } 38 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysCaptchaServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.common.exception.ApiException; 4 | import cn.harry.common.exption.KaptchaEnum; 5 | import cn.harry.sys.dao.SysCaptchaDao; 6 | import cn.harry.sys.entity.SysCaptcha; 7 | import cn.harry.sys.service.SysCaptchaService; 8 | import cn.hutool.core.date.DateUtil; 9 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import com.google.code.kaptcha.Producer; 12 | import org.apache.commons.lang.StringUtils; 13 | import org.springframework.stereotype.Service; 14 | 15 | import javax.annotation.Resource; 16 | import java.awt.image.BufferedImage; 17 | import java.util.Date; 18 | 19 | /** 20 | * 图片验证码 21 | * 22 | * @author honghh 23 | * Date 2019-10-12 10:55:44 24 | * Copyright (C) www.honghh.top 25 | */ 26 | @Service("sysCaptchaService") 27 | public class SysCaptchaServiceImpl extends ServiceImpl implements SysCaptchaService { 28 | @Resource 29 | private Producer producer; 30 | 31 | @Override 32 | public BufferedImage getCaptcha(String uuid) { 33 | if (StringUtils.isBlank(uuid)) { 34 | throw new ApiException(KaptchaEnum.UUID_NOT_NULL); 35 | } 36 | //生成文字验证码 37 | String code = producer.createText(); 38 | 39 | SysCaptcha captchaEntity = new SysCaptcha(); 40 | captchaEntity.setUuid(uuid); 41 | captchaEntity.setCode(code); 42 | //5分钟后过期 43 | captchaEntity.setExpireTime(DateUtil.offsetMinute(new Date(), 5)); 44 | save(captchaEntity); 45 | return producer.createImage(code); 46 | } 47 | 48 | @Override 49 | public boolean validate(String uuid, String code) { 50 | SysCaptcha captchaEntity = this.baseMapper.selectOne(new LambdaQueryWrapper() 51 | .eq(SysCaptcha::getUuid, uuid)); 52 | if (captchaEntity == null) { 53 | return false; 54 | } 55 | //删除验证码 56 | removeById(uuid); 57 | 58 | if (captchaEntity.getCode().equalsIgnoreCase(code) && captchaEntity.getExpireTime().getTime() >= System.currentTimeMillis()) { 59 | return true; 60 | } 61 | 62 | return false; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysCountryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.entity.SysCountry; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import cn.harry.sys.dao.SysCountryDao; 6 | import cn.harry.sys.service.SysCountryService; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * 世界国旗图标 13 | * 14 | * @author honghh 15 | * Date 2019-10-22 10:38:46 16 | * Copyright (C) www.honghh.top 17 | */ 18 | @Service("sysCountryService") 19 | public class SysCountryServiceImpl extends ServiceImpl implements SysCountryService { 20 | 21 | 22 | @Override 23 | public List allList() { 24 | return list(); 25 | } 26 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysDictDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysDictDetailDao; 4 | import cn.harry.sys.entity.SysDictDetail; 5 | import cn.harry.sys.enums.StatusEnums; 6 | import cn.harry.sys.service.SysDictDetailService; 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 8 | import com.baomidou.mybatisplus.core.metadata.IPage; 9 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | /** 17 | * 数据字典详情 18 | * 19 | * @author honghh 20 | * Date 2020-03-16 09:53:38 21 | * Copyright (C) www.tech-harry.cn 22 | */ 23 | @Service("sysDictDetailService") 24 | public class SysDictDetailServiceImpl extends ServiceImpl implements SysDictDetailService { 25 | 26 | 27 | @Override 28 | public List selectDictDataByType(String dictType) { 29 | return list(new LambdaQueryWrapper() 30 | .eq(SysDictDetail::getDictType, dictType) 31 | .eq(SysDictDetail::getStatus, StatusEnums.ENABLE.getKey())); 32 | } 33 | 34 | @Override 35 | public IPage getPage(SysDictDetail dictDetail, Integer pageSize, Integer pageNum) { 36 | return page(new Page<>(pageNum, pageSize), new LambdaQueryWrapper<>(dictDetail)); 37 | } 38 | 39 | @Override 40 | public SysDictDetail selectById(Long id) { 41 | return this.baseMapper.selectById(id); 42 | } 43 | 44 | @Override 45 | public int create(SysDictDetail dictDetail) { 46 | return this.baseMapper.insert(dictDetail); 47 | } 48 | 49 | @Override 50 | public int updateStatus(Long id, String status) { 51 | SysDictDetail sysDictDetail = new SysDictDetail(); 52 | sysDictDetail.setId(id); 53 | sysDictDetail.setStatus(status); 54 | return this.baseMapper.updateById(sysDictDetail); 55 | } 56 | 57 | @Override 58 | public int update(Long id, SysDictDetail dictDetail) { 59 | dictDetail.setId(id); 60 | return this.baseMapper.updateById(dictDetail); 61 | } 62 | 63 | @Override 64 | public int deleteByIds(Long[] ids) { 65 | return this.baseMapper.deleteBatchIds(Arrays.asList(ids)); 66 | } 67 | 68 | @Override 69 | public List getExportList(SysDictDetail dictDetail) { 70 | return list(new LambdaQueryWrapper<>(dictDetail)); 71 | } 72 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysRoleDeptServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysRoleDeptDao; 4 | import cn.harry.sys.entity.SysRoleDept; 5 | import cn.harry.sys.service.SysRoleDeptService; 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 7 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * 角色部门关联 14 | * 15 | * @author honghh 16 | * Date 2020-03-16 08:51:37 17 | * Copyright (C) www.tech-harry.cn 18 | */ 19 | @Service("sysRoleDeptService") 20 | public class SysRoleDeptServiceImpl extends ServiceImpl implements SysRoleDeptService { 21 | 22 | @Override 23 | public int deleteRoleDeptByRoleId(Long roleId) { 24 | return this.baseMapper.delete(new LambdaQueryWrapper() 25 | .eq(SysRoleDept::getRoleId, roleId)); 26 | } 27 | 28 | @Override 29 | public int batchRoleDept(List list) { 30 | return saveBatch(list) ? 1 : 0; 31 | } 32 | 33 | @Override 34 | public List queryDeptIdList(List roleIdList) { 35 | return baseMapper.queryDeptIdList(roleIdList); 36 | } 37 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysRoleMenuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysRoleMenuDao; 4 | import cn.harry.sys.entity.SysRoleMenu; 5 | import cn.harry.sys.service.SysRoleMenuService; 6 | import cn.hutool.core.collection.CollectionUtil; 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 8 | import org.springframework.stereotype.Service; 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 10 | 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * 后台用户角色和权限关系表 17 | * 18 | * @author honghh 19 | * Date 2019-10-12 10:55:44 20 | * Copyright (C) www.honghh.top 21 | */ 22 | @Service("sysRoleMenuService") 23 | public class SysRoleMenuServiceImpl extends ServiceImpl implements SysRoleMenuService { 24 | 25 | 26 | @Override 27 | public void deleteByMenuId(Long menuId) { 28 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); 29 | wrapper.eq(SysRoleMenu::getMenuId, menuId); 30 | this.baseMapper.delete(wrapper); 31 | } 32 | 33 | @Override 34 | public List listMenuIdByRoleId(Long roleId) { 35 | List ids = new ArrayList<>(); 36 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); 37 | wrapper.eq(SysRoleMenu::getRoleId, roleId); 38 | List sysRoleMenus = list(wrapper); 39 | if (CollectionUtil.isNotEmpty(sysRoleMenus)) { 40 | sysRoleMenus.forEach(item -> { 41 | ids.add(item.getMenuId()); 42 | }); 43 | return ids; 44 | } 45 | return null; 46 | } 47 | 48 | @Override 49 | public int checkMenuExistRole(Long menuId) { 50 | return count(new LambdaQueryWrapper() 51 | .eq(SysRoleMenu::getMenuId, menuId)); 52 | } 53 | 54 | @Override 55 | public void insertRoleAndRoleMenu(Long id, List menuIds) { 56 | this.baseMapper.insertRoleAndRoleMenu(id,menuIds); 57 | } 58 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysSmsLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysSmsLogDao; 4 | import cn.harry.sys.enums.StatusEnums; 5 | import cn.harry.sys.vo.SmsTemplateDto; 6 | import com.alibaba.fastjson.JSON; 7 | import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import cn.harry.sys.entity.SysSmsLog; 10 | import cn.harry.sys.enums.SmsTypeEnums; 11 | import cn.harry.sys.param.SmsParam; 12 | import cn.harry.sys.service.SysSmsLogService; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.Map; 16 | 17 | /** 18 | * 短信日志表 19 | * 20 | * @author honghh 21 | * Date 2019-10-12 10:55:44 22 | * Copyright (C) www.honghh.top 23 | */ 24 | @Service("sysSmsLogService") 25 | public class SysSmsLogServiceImpl extends ServiceImpl implements SysSmsLogService { 26 | 27 | private static final String SMS_CODE = "OK"; 28 | 29 | @Override 30 | public Boolean addSmsLog(SmsParam smsParam, SmsTemplateDto smsTemplate, SendSmsResponse sendSmsResponse) { 31 | SysSmsLog smsLog = new SysSmsLog(); 32 | if (SMS_CODE.equals(sendSmsResponse.getCode())) { 33 | smsLog.setStatus(StatusEnums.ENABLE.getKey()); 34 | } else { 35 | smsLog.setStatus(StatusEnums.DISABLE.getKey()); 36 | } 37 | smsLog.setMobiles(String.join(",", smsParam.getMobileList())); 38 | smsLog.setParam(JSON.toJSONString(smsParam.getParams())); 39 | if (smsParam.getMobileList().size() > 1) { 40 | smsLog.setType(SmsTypeEnums.BATCH.getValue()); 41 | } else { 42 | smsLog.setType(SmsTypeEnums.SINGLE.getValue()); 43 | } 44 | smsLog.setTypeName(smsTemplate.getName()); 45 | smsLog.setSource(smsTemplate.getSource()); 46 | smsLog.setTemplateCode(smsTemplate.getTemplateCode()); 47 | smsLog.setContent(format(smsTemplate.getContent(), smsParam.getParams())); 48 | smsLog.setResult(JSON.toJSONString(sendSmsResponse)); 49 | if (this.baseMapper.insert(smsLog) > 0) { 50 | return true; 51 | } else { 52 | return false; 53 | } 54 | } 55 | 56 | /** 57 | * desc 遍历map,用value替换掉key 58 | * 59 | * @param input 60 | * @param map 61 | * @return 62 | * @author honghh 63 | * date 2019-08-30 14:43 64 | */ 65 | private static String format(String input, Map map) { 66 | // 遍历map,用value替换掉key 67 | for (Map.Entry entry : map.entrySet()) { 68 | input = input.replace(entry.getKey(), entry.getValue()); 69 | } 70 | return input; 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysSmsTemplateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.common.exception.ApiException; 4 | import cn.harry.sys.vo.SmsTemplateDto; 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import cn.harry.common.exption.SmsExceptionEnum; 8 | import cn.harry.common.utils.BeanUtils; 9 | import cn.harry.sys.dao.SysSmsTemplateDao; 10 | import cn.harry.sys.entity.SysSmsTemplate; 11 | import cn.harry.sys.service.SysSmsTemplateService; 12 | import org.springframework.stereotype.Service; 13 | 14 | /** 15 | * 短信模板 16 | * 17 | * @author honghh 18 | * Date 2019-10-12 10:55:44 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Service("sysSmsTemplateService") 22 | public class SysSmsTemplateServiceImpl extends ServiceImpl implements SysSmsTemplateService { 23 | 24 | 25 | @Override 26 | public SmsTemplateDto geSmsTemplateByCode(Long code) { 27 | if (code == null) { 28 | throw new ApiException(SmsExceptionEnum.MSG_TYPE_ERROR); 29 | } 30 | 31 | SysSmsTemplate smsTemplate = this.baseMapper.selectOne(new LambdaQueryWrapper() 32 | .eq(SysSmsTemplate::getValue, code) 33 | ); 34 | 35 | return BeanUtils.transform(SmsTemplateDto.class, smsTemplate); 36 | } 37 | 38 | 39 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysUserLoginLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysUserLoginLogDao; 4 | import cn.harry.sys.entity.SysUserLoginLog; 5 | import cn.harry.sys.service.SysUserLoginLogService; 6 | import cn.hutool.core.util.StrUtil; 7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 8 | import com.baomidou.mybatisplus.core.metadata.IPage; 9 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 10 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | /** 17 | * 后台用户登录日志表 18 | * 19 | * @author honghh 20 | * Date 2019-10-12 10:55:44 21 | * Copyright (C) www.honghh.top 22 | */ 23 | @Service("sysUserLoginLogService") 24 | public class SysUserLoginLogServiceImpl extends ServiceImpl implements SysUserLoginLogService { 25 | 26 | 27 | @Override 28 | public int create(SysUserLoginLog sysUserLoginLog) { 29 | return this.baseMapper.insert(sysUserLoginLog); 30 | } 31 | 32 | @Override 33 | public boolean deleteByKey(String key) { 34 | return remove(new LambdaQueryWrapper() 35 | .eq(SysUserLoginLog::getKeyword, key)); 36 | } 37 | 38 | @Override 39 | public IPage getPage(SysUserLoginLog loginLog, Integer pageSize, Integer pageNum) { 40 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(loginLog); 41 | if (StrUtil.isNotEmpty(loginLog.getBeginTime())) { 42 | wrapper.gt(SysUserLoginLog::getCreateTime, loginLog.getBeginTime()); 43 | } 44 | 45 | if (StrUtil.isNotEmpty(loginLog.getEndTime())) { 46 | wrapper.lt(SysUserLoginLog::getCreateTime, loginLog.getEndTime()); 47 | } 48 | return page(new Page<>(pageNum, pageSize), wrapper); 49 | } 50 | 51 | @Override 52 | public int deleteByIds(Long[] ids) { 53 | return this.baseMapper.deleteBatchIds(Arrays.asList(ids)); 54 | } 55 | 56 | @Override 57 | public int clean() { 58 | return this.baseMapper.clean(); 59 | } 60 | 61 | @Override 62 | public List getExportList(SysUserLoginLog loginLog) { 63 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(loginLog); 64 | if (StrUtil.isNotEmpty(loginLog.getBeginTime())) { 65 | wrapper.gt(SysUserLoginLog::getCreateTime, loginLog.getBeginTime()); 66 | } 67 | 68 | if (StrUtil.isNotEmpty(loginLog.getEndTime())) { 69 | wrapper.lt(SysUserLoginLog::getCreateTime, loginLog.getEndTime()); 70 | } 71 | return list(wrapper); 72 | } 73 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/service/impl/SysUserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.service.impl; 2 | 3 | import cn.harry.sys.dao.SysUserRoleDao; 4 | import cn.harry.sys.entity.SysUserRole; 5 | import cn.harry.sys.service.SysUserRoleService; 6 | import cn.hutool.core.collection.CollUtil; 7 | import cn.hutool.core.collection.CollectionUtil; 8 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * 后台用户和角色关系表 17 | * 18 | * @author honghh 19 | * Date 2019-10-12 10:55:44 20 | * Copyright (C) www.honghh.top 21 | */ 22 | @Service("sysUserRoleService") 23 | public class SysUserRoleServiceImpl extends ServiceImpl implements SysUserRoleService { 24 | 25 | @Override 26 | public List listRoleIdByUserId(Long userId) { 27 | List ids = new ArrayList<>(); 28 | List sysUserRoles = this.baseMapper.selectList(new LambdaQueryWrapper().eq(SysUserRole::getUserId, userId)); 29 | if (CollectionUtil.isNotEmpty(sysUserRoles)) { 30 | sysUserRoles.forEach(item -> { 31 | ids.add(item.getRoleId()); 32 | }); 33 | return ids; 34 | } 35 | return null; 36 | } 37 | 38 | @Override 39 | public void insertUserAndUserRole(Long userId, List roleIdList) { 40 | this.baseMapper.insertUserAndUserRole(userId, roleIdList); 41 | } 42 | 43 | @Override 44 | public void delAndCreateRole(Long userId, List roleIdList) { 45 | remove(new LambdaQueryWrapper().eq(SysUserRole::getUserId, userId)); 46 | if (CollUtil.isNotEmpty(roleIdList)) { 47 | //保存用户与角色关系 48 | insertUserAndUserRole(userId, roleIdList); 49 | } 50 | } 51 | 52 | @Override 53 | public List listDataScopesByUserId(Long userId) { 54 | return this.baseMapper.listDataScopesByUserId(userId); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/MetaVo.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * ClassName: MetaVo 7 | * Description: 8 | * 9 | * @author honghh 10 | * Date 2020/04/13 12:43 11 | * Copyright (C) www.honghh.top 12 | */ 13 | @Data 14 | public class MetaVo { 15 | /** 16 | * 设置该路由在侧边栏和面包屑中展示的名字 17 | */ 18 | private String title; 19 | 20 | /** 21 | * 设置该路由的图标,对应路径src/icons/svg 22 | */ 23 | private String icon; 24 | 25 | public MetaVo() { 26 | } 27 | 28 | public MetaVo(String title, String icon) { 29 | this.title = title; 30 | this.icon = icon; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/OnlineUser.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import cn.hutool.core.date.DatePattern; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * ClassName: OnlineUser 14 | * Description: 15 | * 16 | * @author honghh 17 | * Date 2020/03/07 16:12 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Data 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | public class OnlineUser { 24 | 25 | /** 26 | * 用户名 27 | */ 28 | @ApiModelProperty(value = "用户名") 29 | private String username; 30 | /** 31 | * 用户昵称 32 | */ 33 | @ApiModelProperty(value = "用户昵称") 34 | private String nickName; 35 | /** 36 | * 岗位 37 | */ 38 | @ApiModelProperty(value = "岗位") 39 | private String job; 40 | /** 41 | * 浏览器 42 | */ 43 | @ApiModelProperty(value = "浏览器") 44 | private String browser; 45 | /** 46 | * 登陆IP 47 | */ 48 | @ApiModelProperty(value = "登陆IP") 49 | private String ip; 50 | /** 51 | * 登陆地点 52 | */ 53 | @ApiModelProperty(value = "登陆地点") 54 | private String address; 55 | /** 56 | * key 57 | */ 58 | @ApiModelProperty(value = "key") 59 | private String key; 60 | /** 61 | * 创建时间 62 | */ 63 | @ApiModelProperty(value = "创建时间") 64 | @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") 65 | private Date loginTime; 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/RouterVo.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ClassName: RouterVo 10 | * Description: 11 | * 12 | * @author honghh 13 | * Date 2020/04/13 12:42 14 | * Copyright (C) www.honghh.top 15 | */ 16 | @Data 17 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 18 | public class RouterVo { 19 | 20 | /** 21 | * 路由名字 22 | */ 23 | private String name; 24 | 25 | /** 26 | * 路由地址 27 | */ 28 | private String path; 29 | 30 | /** 31 | * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 32 | */ 33 | private String hidden; 34 | 35 | /** 36 | * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 37 | */ 38 | private String redirect; 39 | 40 | /** 41 | * 组件地址 42 | */ 43 | private String component; 44 | 45 | /** 46 | * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 47 | */ 48 | private Boolean alwaysShow; 49 | 50 | /** 51 | * 其他元素 52 | */ 53 | private MetaVo meta; 54 | 55 | /** 56 | * 子路由 57 | */ 58 | private List children; 59 | } 60 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/SmsTemplateDto.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * ClassName: SmsTemplateDto 7 | * Description: 8 | * 9 | * @author honghh 10 | * Date 2019/08/30 14:12 11 | * Copyright (C) www.honghh.top 12 | */ 13 | @Data 14 | public class SmsTemplateDto { 15 | 16 | /** 17 | * 编号 18 | */ 19 | private Long value; 20 | /** 21 | * 作用 22 | */ 23 | private String name; 24 | /** 25 | * 短信签名 26 | */ 27 | private String signName; 28 | /** 29 | * 来源平台 30 | */ 31 | private Integer source; 32 | /** 33 | * 短信模板CODE 34 | */ 35 | private String templateCode; 36 | /** 37 | * 第三方返回结果 38 | */ 39 | private String content; 40 | } 41 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/SysAreaResult.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * ClassName: SysAreaResult 12 | * Description: 13 | * 14 | * @author honghh 15 | * Date 2019/09/25 11:48 16 | * Copyright (C) www.honghh.top 17 | */ 18 | @Data 19 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 20 | public class SysAreaResult implements Serializable { 21 | private static final long serialVersionUID = 1L; 22 | 23 | /** 24 | * ID 25 | * 26 | * @mbggenerated 27 | */ 28 | private Long id; 29 | 30 | /** 31 | * 地区名称 32 | * 33 | * @mbggenerated 34 | */ 35 | private String areaName; 36 | 37 | /** 38 | * 上级id 39 | * 40 | * @mbggenerated 41 | */ 42 | private Long parentId; 43 | 44 | /** 45 | * 层级 46 | * 47 | * @mbggenerated 48 | */ 49 | private Integer level; 50 | /** 51 | * 子目录 52 | */ 53 | @ApiModelProperty(value = "子目录") 54 | private List children; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/SysConfigResult.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Data; 5 | 6 | /** 7 | * ClassName: SysConfigResult 8 | * Description: 9 | * 10 | * @author honghh 11 | * Date 2019/12/04 11:40 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @Data 15 | public class SysConfigResult { 16 | /** 17 | * key 18 | */ 19 | @ApiModelProperty(value = "key") 20 | private String paramKey; 21 | /** 22 | * name 23 | */ 24 | @ApiModelProperty(value = "name") 25 | private String paramName; 26 | /** 27 | * 备注 28 | */ 29 | @ApiModelProperty(value = "备注") 30 | private String remark; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /harry-biz/src/main/java/cn/harry/sys/vo/TreeSelect.java: -------------------------------------------------------------------------------- 1 | package cn.harry.sys.vo; 2 | 3 | import cn.harry.sys.entity.SysDept; 4 | import cn.harry.sys.entity.SysMenu; 5 | import com.fasterxml.jackson.annotation.JsonInclude; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | import java.util.stream.Collectors; 11 | 12 | /** 13 | * ClassName: TreeSelect 14 | * Description: 15 | * 16 | * @author honghh 17 | * Date 2020/04/14 15:57 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Data 21 | public class TreeSelect implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * 节点ID 26 | */ 27 | private Long id; 28 | 29 | /** 30 | * 节点名称 31 | */ 32 | private String label; 33 | 34 | /** 35 | * 子节点 36 | */ 37 | @JsonInclude(JsonInclude.Include.NON_EMPTY) 38 | private List children; 39 | 40 | public TreeSelect() { 41 | 42 | } 43 | 44 | public TreeSelect(SysDept dept) { 45 | this.id = dept.getId(); 46 | this.label = dept.getName(); 47 | this.children = dept.getChildren() == null ? null : dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); 48 | } 49 | 50 | public TreeSelect(SysMenu menu) { 51 | 52 | this.id = menu.getId(); 53 | this.label = menu.getName(); 54 | this.children = menu.getChildren() == null ? null : menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/ip2region/ip2region.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/honghh/harry/35892433b130bbb686f7a68decd9ea0f4533bbea/harry-biz/src/main/resources/ip2region/ip2region.db -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysAreaDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysCaptchaDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysConfigDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysCountryDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysDeptDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysDictDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysDictDetailDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysRoleDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysRoleDeptDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysRoleMenuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | insert into sys_role_menu (role_id,menu_id) values 14 | 15 | (#{roleId},#{menuId}) 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysSmsLogDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysSmsTemplateDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysUserDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysUserLoginLogDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | truncate table sys_user_login_log 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/SysUserRoleDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | insert into sys_user_role (user_id,role_id) values 14 | 15 | (#{userId},#{roleId}) 16 | 17 | 18 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /harry-biz/src/main/resources/mapper/sys/monitor/SysOperationDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | truncate table sys_operation_log 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /harry-platform/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | cn.harry 8 | harry-fast 9 | 1.0.0 10 | 11 | 12 | harry-platform 13 | jar 14 | 15 | 16 | 17 | cn.harry 18 | harry-biz 19 | 1.0.0 20 | 21 | 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-maven-plugin 28 | 29 | true 30 | 31 | 32 | 33 | 34 | org.apache.maven.plugins 35 | maven-surefire-plugin 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/PlatformApplication.java: -------------------------------------------------------------------------------- 1 | package cn.harry; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 6 | 7 | /** 8 | * 启动类 9 | * 10 | * @author honghh 11 | * Date 2019-10-12 10:55:44 12 | * Copyright (C) www.honghh.top 13 | */ 14 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) 15 | public class PlatformApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(PlatformApplication.class, args); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/component/security/handle/RestAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | package cn.harry.component.security.handle; 2 | 3 | 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.common.utils.JsonUtil; 6 | import org.springframework.security.core.AuthenticationException; 7 | import org.springframework.security.web.AuthenticationEntryPoint; 8 | import org.springframework.stereotype.Component; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | 14 | /** 15 | * 当未登录或者token失效访问接口时,自定义的返回结果 16 | * 17 | * @author honghh 18 | * Date 2019/10/08 10:47 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Component 22 | public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint { 23 | @Override 24 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { 25 | response.setCharacterEncoding("UTF-8"); 26 | response.setContentType("application/json"); 27 | response.getWriter().println(JsonUtil.objectToJson(CommonResult.unauthorized(authException.getMessage()))); 28 | response.getWriter().flush(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/component/security/handle/RestfulAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | package cn.harry.component.security.handle; 2 | 3 | 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.common.utils.JsonUtil; 6 | import org.springframework.security.access.AccessDeniedException; 7 | import org.springframework.security.web.access.AccessDeniedHandler; 8 | import org.springframework.stereotype.Component; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | 14 | /** 15 | * 当访问接口没有权限时,自定义的返回结果 16 | * 17 | * @author honghh 18 | * Date 2019/10/08 10:47 19 | * Copyright (C) www.honghh.top 20 | */ 21 | @Component 22 | public class RestfulAccessDeniedHandler implements AccessDeniedHandler { 23 | @Override 24 | public void handle(HttpServletRequest request, 25 | HttpServletResponse response, 26 | AccessDeniedException e) throws IOException { 27 | response.setCharacterEncoding("UTF-8"); 28 | response.setContentType("application/json"); 29 | response.getWriter().println(JsonUtil.objectToJson(CommonResult.forbidden(e.getMessage()))); 30 | response.getWriter().flush(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/component/security/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | package cn.harry.component.security.service; 2 | 3 | import cn.harry.common.utils.SecurityUtils; 4 | import cn.harry.common.utils.StringUtils; 5 | import org.springframework.security.core.GrantedAuthority; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.Arrays; 9 | import java.util.List; 10 | import java.util.stream.Collectors; 11 | 12 | /** 13 | * ClassName: PermissionService 14 | * Description: 15 | * 16 | * @author honghh 17 | * Date 2020/04/28 15:53 18 | * Copyright (C) www.honghh.top 19 | */ 20 | @Service("ss") 21 | public class PermissionService { 22 | /** 所有权限标识 */ 23 | private static final String ALL_PERMISSION = "*:*:*"; 24 | 25 | public Boolean hasPermi(String... permissions) { 26 | if (StringUtils.isEmpty(permissions)) { 27 | return false; 28 | } 29 | // 获取当前用户的所有权限 30 | List harryPermissions = SecurityUtils.getUserDetails().getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()); 31 | // 判断当前用户的所有权限是否包含接口上定义的权限 32 | return harryPermissions.contains(ALL_PERMISSION) || Arrays.stream(permissions).anyMatch(harryPermissions::contains); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/component/security/service/UserDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package cn.harry.component.security.service; 2 | 3 | import cn.harry.common.exception.ApiException; 4 | import cn.harry.common.exption.SysExceptionEnum; 5 | import cn.harry.common.utils.BeanUtils; 6 | import cn.harry.common.utils.SysUserDetails; 7 | import cn.harry.sys.entity.SysMenu; 8 | import cn.harry.sys.entity.SysUser; 9 | import cn.harry.sys.service.SysMenuService; 10 | import cn.harry.sys.service.SysUserService; 11 | import org.springframework.security.core.userdetails.UserDetails; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 14 | import org.springframework.stereotype.Service; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | /** 20 | * ClassName: UserDetailsServiceImpl 21 | * Description: 22 | * 23 | * @author honghh 24 | * Date 2020/04/13 11:01 25 | * Copyright (C) www.honghh.top 26 | */ 27 | @Service("userDetailsService") 28 | public class UserDetailsServiceImpl implements UserDetailsService { 29 | @Resource 30 | private SysUserService sysUserService; 31 | @Resource 32 | private SysMenuService sysMenuService; 33 | 34 | @Override 35 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 36 | //获取登录用户信息 37 | SysUser user = sysUserService.getByUserName(username); 38 | if (BeanUtils.isNull(user)) { 39 | throw new ApiException(SysExceptionEnum.WRONG_USERNAME_OR_PASSWORD); 40 | } 41 | 42 | List permissions = sysMenuService.selectMenuList(user.getId()); 43 | return new SysUserDetails(user, permissions); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/config/GlobalWebConfig.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import cn.harry.common.interceptor.TokenInterceptor; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.config.annotation.*; 6 | 7 | import javax.annotation.Resource; 8 | 9 | /** 10 | * 全局跨域配置 11 | * 12 | * @author honghh 13 | * Date 2019-10-12 10:55:44 14 | * Copyright (C) www.honghh.top 15 | */ 16 | @Configuration 17 | @EnableWebMvc 18 | public class GlobalWebConfig implements WebMvcConfigurer { 19 | @Resource 20 | private TokenInterceptor vueViewInterceptor; 21 | 22 | @Override 23 | public void addCorsMappings(CorsRegistry registry) { 24 | registry.addMapping("/**") 25 | .allowedOrigins("*") 26 | .allowCredentials(true) 27 | .allowedHeaders("*") 28 | .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") 29 | .maxAge(3600); 30 | } 31 | 32 | @Override 33 | public void addInterceptors(InterceptorRegistry registry) { 34 | registry.addInterceptor(vueViewInterceptor) 35 | .addPathPatterns("/**") 36 | // 排除配置 37 | .excludePathPatterns( 38 | "/admin/login", 39 | "/captchaImage", 40 | "/swagger-resources/**", 41 | "*.js", 42 | "/**/*.js", 43 | "*.css", 44 | "/**/*.css", 45 | "*.html", 46 | "/v2/*", 47 | "/**/*.html"); 48 | 49 | } 50 | 51 | @Override 52 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 53 | registry.addResourceHandler("doc.html") 54 | .addResourceLocations("classpath:/META-INF/resources/"); 55 | 56 | registry.addResourceHandler("/webjars/**") 57 | .addResourceLocations("classpath:/META-INF/resources/webjars/"); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/config/Swagger2Config.java: -------------------------------------------------------------------------------- 1 | package cn.harry.config; 2 | 3 | import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; 4 | import com.google.common.collect.Lists; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import springfox.documentation.builders.ApiInfoBuilder; 8 | import springfox.documentation.builders.PathSelectors; 9 | import springfox.documentation.builders.RequestHandlerSelectors; 10 | import springfox.documentation.service.ApiInfo; 11 | import springfox.documentation.service.ApiKey; 12 | import springfox.documentation.service.Contact; 13 | import springfox.documentation.spi.DocumentationType; 14 | import springfox.documentation.spring.web.plugins.Docket; 15 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * Swagger2API文档的配置 21 | * 22 | * @author honghh 23 | * Date 2019/10/08 10:47 24 | * Copyright (C) www.honghh.top 25 | */ 26 | @Configuration 27 | @EnableSwagger2 28 | @EnableKnife4j 29 | public class Swagger2Config { 30 | @Bean 31 | public Docket createRestApi() { 32 | return new Docket(DocumentationType.SWAGGER_2) 33 | .apiInfo(this.apiInfo()) 34 | .select() 35 | .apis(RequestHandlerSelectors.basePackage("cn.harry.controller")) 36 | .paths(PathSelectors.any()) 37 | .build() 38 | .securitySchemes(this.securitySchemes()); 39 | } 40 | 41 | private ApiInfo apiInfo() { 42 | return new ApiInfoBuilder() 43 | .title("Harry 后台管理系统") 44 | .description("Harry 后台商家管理系统") 45 | .termsOfServiceUrl("http://localhost:9001/") 46 | .contact(new Contact("honghh","www.honghh.top","honghh1217@163.com")) 47 | .version("1.0") 48 | .build(); 49 | } 50 | 51 | private List securitySchemes() { 52 | return Lists.newArrayList(new ApiKey("Authorization", "Authorization", "header")); 53 | } 54 | } -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/controller/monitor/SysOnlineUserController.java: -------------------------------------------------------------------------------- 1 | package cn.harry.controller.monitor; 2 | 3 | import cn.harry.common.api.CommonPage; 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.sys.service.OnlineUserService; 6 | import cn.harry.sys.vo.OnlineUser; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiOperation; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.annotation.Resource; 15 | import java.util.List; 16 | 17 | /** 18 | * ClassName: SysOnlineUserController 19 | * Description: 20 | * 21 | * @author honghh 22 | * Date 2019/10/15 12:42 23 | * Copyright (C) www.honghh.top 24 | */ 25 | @RestController 26 | @Api(tags = "Monitor-online => 在线用户管理") 27 | @RequestMapping("/monitor/online") 28 | public class SysOnlineUserController { 29 | @Resource 30 | private OnlineUserService onlineUserService; 31 | 32 | @ApiOperation("list => 根据关键字分页获取用户列表") 33 | @GetMapping(value = "/list") 34 | public CommonResult> list(@RequestParam(value = "keyword", required = false) String keyword, 35 | @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, 36 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { 37 | List onlineUsers = onlineUserService.getAll(keyword); 38 | return CommonResult.success(CommonPage.listToPage(pageNum , pageSize, onlineUsers)); 39 | 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/controller/oss/OssController.java: -------------------------------------------------------------------------------- 1 | package cn.harry.controller.oss; 2 | 3 | 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.oss.impl.OssServiceImpl; 6 | import cn.harry.oss.vo.OssCallbackResult; 7 | import cn.harry.oss.vo.OssPolicyResult; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.annotation.Resource; 15 | import javax.servlet.http.HttpServletRequest; 16 | 17 | /** 18 | * ClassName: OssController 19 | * Description: Oss相关操作接口 20 | * 21 | * @author honghh 22 | * Date 2019/10/08 14:58 23 | * Copyright (C) www.honghh.top 24 | */ 25 | 26 | @RestController 27 | @Api(tags = "Oss-aliyun => 文件管理") 28 | @RequestMapping("/oss/aliyun") 29 | public class OssController { 30 | @Resource 31 | private OssServiceImpl ossService; 32 | 33 | @ApiOperation(value = "policy => 上传签名生成") 34 | @RequestMapping(value = "/policy", method = RequestMethod.GET) 35 | public CommonResult policy() { 36 | OssPolicyResult result = ossService.policy(); 37 | return CommonResult.success(result); 38 | } 39 | 40 | @ApiOperation(value = "callback => 上传成功回调") 41 | @RequestMapping(value = "callback", method = RequestMethod.POST) 42 | public CommonResult callback(HttpServletRequest request) { 43 | OssCallbackResult ossCallbackResult = ossService.callback(request); 44 | return CommonResult.success(ossCallbackResult); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/controller/sys/SysCaptchaController.java: -------------------------------------------------------------------------------- 1 | package cn.harry.controller.sys; 2 | 3 | import cn.harry.common.api.CommonResult; 4 | import cn.harry.sys.service.SysCaptchaService; 5 | import cn.hutool.core.codec.Base64; 6 | import cn.hutool.core.util.IdUtil; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiOperation; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import javax.annotation.Resource; 13 | import javax.imageio.ImageIO; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.awt.image.BufferedImage; 16 | import java.io.ByteArrayOutputStream; 17 | import java.io.IOException; 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | /** 22 | * ClassName: CaptchaController 23 | * Description: 24 | * 25 | * @author honghh 26 | * Date 2020/04/13 14:02 27 | * Copyright (C) www.honghh.top 28 | */ 29 | @RestController 30 | @Api(tags = "Sys-captcha => 图形验证码") 31 | public class SysCaptchaController { 32 | 33 | @Resource 34 | private SysCaptchaService sysCaptchaService; 35 | 36 | /** 37 | * 生成验证码 38 | */ 39 | @ApiOperation("captchaImage => 生成验证码") 40 | @GetMapping("captchaImage") 41 | public CommonResult> captcha(HttpServletResponse response) throws IOException { 42 | response.setHeader("Cache-Control", "no-store, no-cache"); 43 | response.setContentType("image/jpeg"); 44 | // 唯一标识 45 | String uuid = IdUtil.simpleUUID(); 46 | //获取图片验证码 47 | BufferedImage image = sysCaptchaService.getCaptcha(uuid); 48 | Map map = new HashMap<>(); 49 | ByteArrayOutputStream stream = new ByteArrayOutputStream(); 50 | 51 | ImageIO.write(image, "jpg", stream); 52 | 53 | map.put("uuid", uuid); 54 | map.put("img", Base64.encode(stream.toByteArray())); 55 | return CommonResult.success(map); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/controller/sys/SysProfileController.java: -------------------------------------------------------------------------------- 1 | package cn.harry.controller.sys; 2 | 3 | import cn.harry.common.annotation.SysLog; 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.common.enums.BusinessType; 6 | import cn.harry.common.utils.SysUserUtils; 7 | import cn.harry.sys.entity.SysUser; 8 | import cn.harry.sys.param.SysUserUpdatePasswordParam; 9 | import cn.harry.sys.service.SysUserService; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.security.crypto.password.PasswordEncoder; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import javax.annotation.Resource; 17 | 18 | /** 19 | * ClassName: SysProfileController 20 | * Description: 21 | * 22 | * @author honghh 23 | * Date 2020/04/29 13:42 24 | * Copyright (C) www.honghh.top 25 | */ 26 | @RestController 27 | @Api(tags = "Sys-user => 后台用户管理") 28 | @RequestMapping("/sys/user/profile") 29 | public class SysProfileController { 30 | @Resource 31 | private SysUserService sysUserService; 32 | @Autowired 33 | private PasswordEncoder passwordEncoder; 34 | 35 | @ApiOperation("获取个人信息") 36 | @GetMapping 37 | public CommonResult getPersonalInfo() { 38 | // 1. 获取用户基本信息 39 | SysUser user = SysUserUtils.getSysUser(); 40 | return CommonResult.success(user); 41 | } 42 | 43 | @ApiOperation("update => 修改指定用户信息") 44 | @SysLog(title = "用户管理", businessType = BusinessType.UPDATE) 45 | @PutMapping(value = "/update") 46 | public CommonResult update(@RequestBody SysUser user) { 47 | int count = sysUserService.update(user.getId(),user); 48 | if (count > 0) { 49 | return CommonResult.success(count); 50 | } 51 | return CommonResult.failed(); 52 | } 53 | 54 | @ApiOperation(value = "updatePassword => 修改密码", notes = "修改当前登陆用户的密码") 55 | @PutMapping(value = "/updatePassword") 56 | public CommonResult updatePassword(@RequestBody SysUserUpdatePasswordParam passwordParam) { 57 | Long userId = SysUserUtils.getSysUser().getId(); 58 | SysUser dbUser = sysUserService.getUserById(userId); 59 | if (!passwordEncoder.matches(passwordParam.getPassword(), dbUser.getPassword())) { 60 | return CommonResult.failed("原密码不正确"); 61 | } 62 | // 新密码 63 | String newPass = passwordEncoder.encode(passwordParam.getNewPassword()); 64 | // 更新密码 65 | int result = sysUserService.updatePasswordByUserId(userId, newPass); 66 | if (result > 0) { 67 | return CommonResult.success(result); 68 | } 69 | return CommonResult.failed(); 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /harry-platform/src/main/java/cn/harry/controller/test/TestController.java: -------------------------------------------------------------------------------- 1 | package cn.harry.controller.test; 2 | 3 | import cn.harry.common.annotation.IgnoreAuth; 4 | import cn.harry.common.api.CommonResult; 5 | import cn.harry.oss.vo.OssPolicyResult; 6 | import cn.harry.sys.entity.SysDict; 7 | import cn.harry.sys.service.SysDictService; 8 | import com.alibaba.excel.EasyExcel; 9 | import com.baomidou.mybatisplus.core.metadata.IPage; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import javax.annotation.Resource; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | import java.net.URLEncoder; 18 | 19 | /** 20 | * ClassName: TestController 21 | * Description: 22 | * 23 | * @author honghh 24 | * Date 2020/05/18 16:09 25 | * Copyright (C) 洛阳乾发供应链管理有限公司 26 | */ 27 | 28 | @RestController 29 | @RequestMapping("/test") 30 | public class TestController { 31 | 32 | @Resource 33 | private SysDictService sysDictService; 34 | @IgnoreAuth 35 | @GetMapping(value = "/hello") 36 | public CommonResult hello() { 37 | 38 | return CommonResult.success(); 39 | } 40 | @IgnoreAuth 41 | @GetMapping("/export") 42 | public void export(HttpServletResponse response, SysDict sysDict) { 43 | IPage page = sysDictService.getPage(sysDict, 10, 1); 44 | // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman 45 | response.setContentType("application/vnd.ms-excel"); 46 | response.setCharacterEncoding("utf-8"); 47 | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 48 | String fileName = null; 49 | try { 50 | fileName = URLEncoder.encode("测试", "UTF-8"); 51 | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); 52 | EasyExcel.write(response.getOutputStream(), SysDict.class).sheet("模板").doWrite(page.getRecords()); 53 | } catch (IOException e) { 54 | e.printStackTrace(); 55 | } 56 | 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /harry-platform/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 9001 6 | 7 | 8 | spring: 9 | # 环境 dev|test|prod 10 | profiles: 11 | active: dev 12 | 13 | logging: 14 | config: classpath:logback-spring.xml 15 | file: 16 | path: ../logs/harry-platform -------------------------------------------------------------------------------- /harry-platform/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | 欢迎使用 harry 后台管理系统 - Powered By http://www.tech-harry.cn/ 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | cn.harry 7 | harry-fast 8 | 1.0.0 9 | pom 10 | harry-fast 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 2.3.3.RELEASE 16 | 17 | 18 | 19 | harry-biz 20 | harry-platform 21 | 22 | 23 | 24 | 25 | 26 | 27 | cn.harry 28 | harry-biz 29 | ${project.version} 30 | 31 | 32 | cn.harry 33 | harry-platform 34 | ${project.version} 35 | 36 | 37 | 38 | 39 | 40 | 41 | public 42 | aliyun nexus 43 | http://maven.aliyun.com/nexus/content/groups/public/ 44 | 45 | true 46 | 47 | 48 | 49 | 50 | 51 | public 52 | aliyun nexus 53 | http://maven.aliyun.com/nexus/content/groups/public/ 54 | 55 | true 56 | 57 | 58 | false 59 | 60 | 61 | 62 | 63 | 64 | --------------------------------------------------------------------------------