Skip to content

Commit

Permalink
!86 同步dev分支
Browse files Browse the repository at this point in the history
Merge pull request !86 from 疯狂的狮子Li/dev
  • Loading branch information
JavaLionLi authored and gitee-org committed Sep 7, 2021
2 parents 94be46d + 3b5fb07 commit c2efaa5
Show file tree
Hide file tree
Showing 157 changed files with 3,744 additions and 882 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[*.java]
indent_style = tab

[*.{json,yml}]
indent_size = 2

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE)
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
<br>
[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-3.0.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-3.1.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus)
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.5-blue.svg)]()
[![JDK-8+](https://img.shields.io/badge/JDK-8+-green.svg)]()
[![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]()
Expand Down
7 changes: 6 additions & 1 deletion docker/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ port(){

##放置挂载文件
mount(){
#挂载配置文件
#挂载 nginx 配置文件
if test ! -f "/docker/nginx/conf/nginx.conf" ;then
mkdir -p /docker/nginx/conf
cp nginx/nginx.conf /docker/nginx/conf/nginx.conf
fi
#挂载 redis 配置文件
if test ! -f "/docker/redis/conf/redis.conf" ;then
mkdir -p /docker/redis/conf
cp redis/redis.conf /docker/redis/conf/redis.conf
fi
}

#启动基础模块
Expand Down
19 changes: 10 additions & 9 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ services:
TZ: Asia/Shanghai
volumes:
# 配置文件
- /docker/redis/conf/redis.conf:/redis.conf:rw
- /docker/redis/conf:/redis/config:rw
# 数据文件
- /docker/redis/data:/data:rw
command: "redis-server --appendonly yes"
- /docker/redis/data:/redis/data:rw
command: "redis-server /redis/config/redis.conf --appendonly yes"
privileged: true
restart: always
networks:
Expand All @@ -77,7 +77,7 @@ services:

minio:
image: minio/minio:RELEASE.2021-07-08T01-15-01Z
hostname: "minio"
container_name: minio
ports:
# api 端口
- 9000:9000
Expand All @@ -103,37 +103,38 @@ services:
ipv4_address: 172.30.0.54

ruoyi-server1:
image: "ruoyi/ruoyi-server:3.0.0"
image: "ruoyi/ruoyi-server:3.1.0"
container_name: ruoyi-server1
environment:
# 时区上海
TZ: Asia/Shanghai
volumes:
# 配置文件
- /docker/server1/logs/:/ruoyi/server/logs/
- /docker/ruoyi/uploadPath/:/ruoyi/server/ruoyi/uploadPath/
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.60

ruoyi-server2:
image: "ruoyi/ruoyi-server:3.0.0"
image: "ruoyi/ruoyi-server:3.1.0"
container_name: ruoyi-server2
environment:
# 时区上海
TZ: Asia/Shanghai
volumes:
# 配置文件
- /docker/server2/logs/:/ruoyi/server/logs/
- /docker/ruoyi/uploadPath/:/ruoyi/server/ruoyi/uploadPath/
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.61

ruoyi-monitor-admin:
image: "ruoyi/ruoyi-monitor-admin:3.0.0"
image: "ruoyi/ruoyi-monitor-admin:3.1.0"
container_name: ruoyi-monitor-admin
environment:
# 时区上海
TZ: Asia/Shanghai
Expand Down
1 change: 1 addition & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ http {
access_log /var/log/nginx/access.log main;

upstream server {
ip_hash;
server 172.30.0.60:8080;
server 172.30.0.61:8080;
}
Expand Down
2 changes: 2 additions & 0 deletions docker/redis/redis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# redis 密码
# requirepass 123456
24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@

<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-vue-plus</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>

<name>RuoYi-Vue-Plus</name>
<url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url>
<description>RuoYi-Vue-Plus后台管理系统</description>

<properties>
<ruoyi-vue-plus.version>3.0.0</ruoyi-vue-plus.version>
<spring-boot.version>2.5.3</spring-boot.version>
<ruoyi-vue-plus.version>3.1.0</ruoyi-vue-plus.version>
<spring-boot.version>2.5.4</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<druid.version>1.2.6</druid.version>
<knife4j.version>3.0.3</knife4j.version>
<poi.version>4.1.2</poi.version>
<easyexcel.version>2.2.10</easyexcel.version>
<velocity.version>1.7</velocity.version>
<jwt.version>0.9.1</jwt.version>
<mybatis-plus.version>3.4.3</mybatis-plus.version>
<mybatis-plus.version>3.4.3.3</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version>
<hutool.version>5.7.7</hutool.version>
<hutool.version>5.7.11</hutool.version>
<feign.version>3.0.3</feign.version>
<feign-okhttp.version>11.2</feign-okhttp.version>
<feign-okhttp.version>11.6</feign-okhttp.version>
<okhttp.version>4.9.1</okhttp.version>
<spring-boot-admin.version>2.5.0</spring-boot-admin.version>
<redisson.version>3.16.1</redisson.version>
<spring-boot-admin.version>2.5.1</spring-boot-admin.version>
<redisson.version>3.16.2</redisson.version>
<lock4j.version>2.2.1</lock4j.version>
<dynamic-ds.version>3.4.1</dynamic-ds.version>

<!-- OSS 配置 -->
<qiniu.version>7.8.0</qiniu.version>
<aliyun.oss.version>3.13.0</aliyun.oss.version>
<qcloud.cos.version>5.6.47</qcloud.cos.version>
<minio.version>8.2.0</minio.version>
<aliyun.oss.version>3.13.1</aliyun.oss.version>
<qcloud.cos.version>5.6.51</qcloud.cos.version>
<minio.version>8.3.0</minio.version>

<!-- docker 配置 -->
<docker.registry.url>localhost</docker.registry.url>
Expand Down
1 change: 0 additions & 1 deletion ruoyi-admin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ MAINTAINER Lion Li

RUN mkdir -p /ruoyi/server
RUN mkdir -p /ruoyi/server/logs
RUN mkdir -p /ruoyi/server/ruoyi/uploadPath

WORKDIR /ruoyi/server

Expand Down
2 changes: 1 addition & 1 deletion ruoyi-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi-vue-plus</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version>
<version>3.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
package com.ruoyi.web.controller.common;

import cn.hutool.captcha.AbstractCaptcha;
import cn.hutool.captcha.CircleCaptcha;
import cn.hutool.captcha.LineCaptcha;
import cn.hutool.captcha.ShearCaptcha;
import cn.hutool.captcha.generator.CodeGenerator;
import cn.hutool.captcha.generator.RandomGenerator;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.framework.captcha.UnsignedMathGenerator;
import com.ruoyi.common.enums.CaptchaType;
import com.ruoyi.common.utils.RedisUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.config.properties.CaptchaProperties;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
Expand All @@ -32,19 +29,6 @@
@RestController
public class CaptchaController {

// 圆圈干扰验证码
@Resource(name = "CircleCaptcha")
private CircleCaptcha circleCaptcha;
// 线段干扰的验证码
@Resource(name = "LineCaptcha")
private LineCaptcha lineCaptcha;
// 扭曲干扰验证码
@Resource(name = "ShearCaptcha")
private ShearCaptcha shearCaptcha;

@Autowired
private RedisCache redisCache;

@Autowired
private CaptchaProperties captchaProperties;

Expand All @@ -65,41 +49,16 @@ public AjaxResult getCode() {
// 保存验证码信息
String uuid = IdUtil.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String code = null;
// 生成验证码
CodeGenerator codeGenerator;
AbstractCaptcha captcha;
switch (captchaProperties.getType()) {
case "math":
codeGenerator = new UnsignedMathGenerator(captchaProperties.getNumberLength());
break;
case "char":
codeGenerator = new RandomGenerator(captchaProperties.getCharLength());
break;
default:
throw new IllegalArgumentException("验证码类型异常");
}
switch (captchaProperties.getCategory()) {
case "line":
captcha = lineCaptcha;
break;
case "circle":
captcha = circleCaptcha;
break;
case "shear":
captcha = shearCaptcha;
break;
default:
throw new IllegalArgumentException("验证码类别异常");
}
CaptchaType captchaType = captchaProperties.getType();
boolean isMath = CaptchaType.MATH == captchaType;
Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength();
CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length);
AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz());
captcha.setGenerator(codeGenerator);
captcha.createCode();
if ("math".equals(captchaProperties.getType())) {
code = getCodeResult(captcha.getCode());
} else if ("char".equals(captchaProperties.getType())) {
code = captcha.getCode();
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
String code = isMath ? getCodeResult(captcha.getCode()) : captcha.getCode();
RedisUtils.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
ajax.put("uuid", uuid);
ajax.put("img", captcha.getImageBase64());
return AjaxResult.success(ajax);
Expand All @@ -112,13 +71,13 @@ private String getCodeResult(String capStr) {
int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
switch (operator) {
case '*':
return a * b + "";
return Convert.toStr(a * b);
case '+':
return a + b + "";
return Convert.toStr(a + b);
case '-':
return a - b + "";
return Convert.toStr(a - b);
default:
return "";
return StringUtils.EMPTY;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.RedisUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
Expand All @@ -33,18 +33,15 @@ public class SysUserOnlineController extends BaseController
@Autowired
private ISysUserOnlineService userOnlineService;

@Autowired
private RedisCache redisCache;

@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
Collection<String> keys = RedisUtils.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
LoginUser user = RedisUtils.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
Expand Down Expand Up @@ -84,7 +81,7 @@ else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser(
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
RedisUtils.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false)
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down Expand Up @@ -40,9 +37,6 @@ public class SysLoginController
@Autowired
private SysPermissionService permissionService;

@Autowired
private TokenService tokenService;

/**
* 登录方法
*
Expand All @@ -68,8 +62,7 @@ public AjaxResult login(@RequestBody LoginBody loginBody)
@GetMapping("getInfo")
public AjaxResult getInfo()
{
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Expand Down
Loading

0 comments on commit c2efaa5

Please sign in to comment.