diff --git a/README.md b/README.md index a98bde53..796d57fb 100644 --- a/README.md +++ b/README.md @@ -41,13 +41,18 @@ ### 其他 -* 同步升级 RuoYi-Vue 3.4.0 +* 同步升级 RuoYi-Vue 3.5.0 * 单模块 fast 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/tree/fast/) ## 关注作者(扫码请备注: "加群") ![](https://images.gitee.com/uploads/images/2021/0508/235345_5503356a_1766278.jpeg) +## 捐献作者 +作者为兼职做开源,平时还需要工作,如果帮到了您可以请作者吃个盒饭 + + + ## 重点注意事项 若依文档对事务注解的描述 [关于事务](https://doc.ruoyi.vip/ruoyi/document/htsc.html#%E4%BA%8B%E5%8A%A1%E7%AE%A1%E7%90%86) 以下对多数据源事务做补充: diff --git a/pom.xml b/pom.xml index ef4b26af..a197fd39 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ - 4.0.0 + 4.0.0 com.ruoyi ruoyi-vue-plus @@ -13,21 +13,21 @@ RuoYi-Vue-Plus后台管理系统 - 2.1.2 + 2.2.0 2.3.11.RELEASE UTF-8 UTF-8 1.8 3.1.1 - 1.2.4 + 1.2.6 3.0.2 1.5.22 - 1.2.75 + 1.2.76 4.1.2 1.7 0.9.1 3.4.3 - 5.5.8 + 5.6.5 2.2.6.RELEASE 11.0 2.3.1 diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index e51c7dab..031427fc 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -1,89 +1,89 @@ - - - - ruoyi-vue-plus - com.ruoyi - ${ruoyi-vue-plus.version} - - 4.0.0 - jar - ruoyi-admin - - - web服务入口 - - - - - - - org.springframework.boot - spring-boot-devtools - true - - - - - mysql - mysql-connector-java - - - - - com.ruoyi - ruoyi-framework - - - - - com.ruoyi - ruoyi-quartz - - - - - com.ruoyi - ruoyi-generator - - - - - com.ruoyi - ruoyi-demo - - - - - - ${project.artifactId} - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot.version} - - true - - - - - repackage - - - - - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 - - false - ${project.artifactId} - - - - - - \ No newline at end of file + + + + ruoyi-vue-plus + com.ruoyi + ${ruoyi-vue-plus.version} + + 4.0.0 + jar + ruoyi-admin + + + web服务入口 + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + mysql + mysql-connector-java + + + + + com.ruoyi + ruoyi-framework + + + + + com.ruoyi + ruoyi-quartz + + + + + com.ruoyi + ruoyi-generator + + + + + com.ruoyi + ruoyi-demo + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + ${project.artifactId} + + + + + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 09886560..2f303ba9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -52,6 +52,12 @@ public class CaptchaController { */ @GetMapping("/captchaImage") public AjaxResult getCode() { + Map ajax = new HashMap<>(); + Boolean enabled = captchaProperties.getEnabled(); + ajax.put("enabled", enabled); + if (!enabled) { + return AjaxResult.success(ajax); + } // 保存验证码信息 String uuid = IdUtil.simpleUUID(); String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; @@ -90,7 +96,6 @@ public class CaptchaController { code = captcha.getCode(); } redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); - Map ajax = new HashMap<>(); ajax.put("uuid", uuid); ajax.put("img", captcha.getImageBase64()); return AjaxResult.success(ajax); diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index e16a18d9..3a2a03d6 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,3 +1,7 @@ +--- +server: + port: 8081 +--- # 数据源配置 spring: datasource: @@ -6,9 +10,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true - username: root - password: root + url: jdbc:mysql://39.101.143.184:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true + username: ruoyi-vue + password: ryvue # 从库数据源 slave: # 从数据源开关/默认关闭 @@ -58,13 +62,13 @@ spring: # redis 配置 redis: # 地址 - host: localhost + host: 39.101.143.184 # 端口,默认为6379 port: 6379 # 数据库索引 database: 0 # 密码 - password: + password: ryvue # 连接超时时间 timeout: 10s lettuce: @@ -76,4 +80,4 @@ spring: # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1ms \ No newline at end of file + max-wait: -1ms diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 535da0a9..3838ff50 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -14,6 +14,8 @@ ruoyi: addressEnabled: false captcha: + # 验证码开关 + enabled: true # 验证码类型 math 数组计算 char 字符验证 type: math # line 线段干扰 circle 圆圈干扰 shear 扭曲干扰 diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 4e990764..5f1404e1 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -46,7 +46,7 @@ org.apache.commons commons-lang3 - + com.fasterxml.jackson.core @@ -153,4 +153,4 @@ - \ No newline at end of file + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index bb5b96eb..e13ec1ee 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -12,7 +12,7 @@ import java.util.Set; /** * 登录用户身份权限 - * + * * @author ruoyi */ @@ -81,6 +81,7 @@ public class LoginUser implements UserDetails return user.getPassword(); } + @JsonIgnore @Override public String getUsername() { @@ -99,7 +100,7 @@ public class LoginUser implements UserDetails /** * 指定用户是否解锁,锁定的用户无法进行身份验证 - * + * * @return */ @JsonIgnore @@ -111,7 +112,7 @@ public class LoginUser implements UserDetails /** * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 - * + * * @return */ @JsonIgnore @@ -123,7 +124,7 @@ public class LoginUser implements UserDetails /** * 是否可用 ,禁用的用户不能身份验证 - * + * * @return */ @JsonIgnore @@ -133,6 +134,7 @@ public class LoginUser implements UserDetails return true; } + @JsonIgnore @Override public Collection getAuthorities() { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java index 05489342..0170e1d7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -1,6 +1,7 @@ package com.ruoyi.common.filter; import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HtmlUtil; import org.apache.commons.io.IOUtils; import org.springframework.http.HttpHeaders; @@ -15,7 +16,7 @@ import java.io.IOException; /** * XSS过滤处理 - * + * * @author ruoyi */ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper @@ -94,12 +95,12 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper /** * 是否是Json请求 - * + * * @param request */ public boolean isJsonRequest() { String header = super.getHeader(HttpHeaders.CONTENT_TYPE); - return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header); + return StrUtil.startWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); } -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java new file mode 100644 index 00000000..e69de29b diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 3e18105d..4313ce55 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -1,72 +1,72 @@ - - - - ruoyi-vue-plus - com.ruoyi - ${ruoyi-vue-plus.version} - - 4.0.0 - - ruoyi-framework - - - framework框架核心 - - - - - - - - org.springframework.boot - spring-boot-starter-web - - - spring-boot-starter-tomcat - org.springframework.boot - - - - - - org.springframework.boot - spring-boot-starter-undertow - - - - - - - - - - - - - org.springframework.boot - spring-boot-starter-aop - - - - - org.springframework.boot - spring-boot-starter-validation - - - - - com.alibaba - druid-spring-boot-starter - - - - - com.ruoyi - ruoyi-system - - - - - \ No newline at end of file + + + + ruoyi-vue-plus + com.ruoyi + ${ruoyi-vue-plus.version} + + 4.0.0 + + ruoyi-framework + + + framework框架核心 + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + spring-boot-starter-tomcat + org.springframework.boot + + + + + + org.springframework.boot + spring-boot-starter-undertow + + + + + + + + + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + com.alibaba + druid-spring-boot-starter + + + + + com.ruoyi + ruoyi-system + + + + + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 42b0031e..442d2589 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -1,5 +1,6 @@ package com.ruoyi.framework.aspectj; +import cn.hutool.core.lang.Validator; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.ruoyi.common.annotation.Log; @@ -36,7 +37,7 @@ import java.util.Map; /** * 操作日志记录处理 - * + * * @author ruoyi */ @Aspect @@ -64,7 +65,7 @@ public class LogAspect /** * 拦截异常操作 - * + * * @param joinPoint 切点 * @param e 异常 */ @@ -130,7 +131,7 @@ public class LogAspect /** * 获取注解中对方法的描述信息 用于Controller层注解 - * + * * @param log 日志 * @param operLog 操作日志 * @throws Exception @@ -153,7 +154,7 @@ public class LogAspect /** * 获取请求的参数,放到log中 - * + * * @param operLog 操作日志 * @throws Exception 异常 */ @@ -198,7 +199,7 @@ public class LogAspect { for (int i = 0; i < paramsArray.length; i++) { - if (!isFilterObject(paramsArray[i])) + if (Validator.isNotNull(paramsArray[i]) && !isFilterObject(paramsArray[i])) { Object jsonObj = JSON.toJSON(paramsArray[i]); params += jsonObj.toString() + " "; @@ -210,7 +211,7 @@ public class LogAspect /** * 判断是否需要过滤的对象。 - * + * * @param o 对象信息。 * @return 如果是需要过滤的对象,则返回true;否则返回false。 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java deleted file mode 100644 index 59812ea5..00000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.ruoyi.framework.config; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.data.redis.serializer.SerializationException; -import com.alibaba.fastjson.parser.ParserConfig; -import org.springframework.util.Assert; -import java.nio.charset.Charset; - -/** - * Redis使用FastJson序列化 - * - * @author ruoyi - */ -public class FastJson2JsonRedisSerializer implements RedisSerializer -{ - @SuppressWarnings("unused") - private ObjectMapper objectMapper = new ObjectMapper(); - - public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); - - private Class clazz; - - static - { - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); - } - - public FastJson2JsonRedisSerializer(Class clazz) - { - super(); - this.clazz = clazz; - } - - @Override - public byte[] serialize(T t) throws SerializationException - { - if (t == null) - { - return new byte[0]; - } - return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); - } - - @Override - public T deserialize(byte[] bytes) throws SerializationException - { - if (bytes == null || bytes.length <= 0) - { - return null; - } - String str = new String(bytes, DEFAULT_CHARSET); - - return JSON.parseObject(str, clazz); - } - - public void setObjectMapper(ObjectMapper objectMapper) - { - Assert.notNull(objectMapper, "'objectMapper' must not be null"); - this.objectMapper = objectMapper; - } - - protected JavaType getJavaType(Class clazz) - { - return TypeFactory.defaultInstance().constructType(clazz); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java index a65626aa..af471f49 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -1,5 +1,6 @@ package com.ruoyi.framework.config; +import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; @@ -7,15 +8,10 @@ import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.StringRedisSerializer; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; /** * redis配置 - * + * * @author ruoyi */ @Configuration @@ -29,16 +25,17 @@ public class RedisConfig extends CachingConfigurerSupport RedisTemplate template = new RedisTemplate<>(); template.setConnectionFactory(connectionFactory); - FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + GenericFastJsonRedisSerializer serializer = new GenericFastJsonRedisSerializer(); + StringRedisSerializer keySerializer = new StringRedisSerializer(); - ObjectMapper mapper = new ObjectMapper(); - mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); - serializer.setObjectMapper(mapper); - - template.setValueSerializer(serializer); // 使用StringRedisSerializer来序列化和反序列化redis的key值 - template.setKeySerializer(new StringRedisSerializer()); + template.setKeySerializer(keySerializer); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(keySerializer); + template.setHashValueSerializer(serializer); + template.afterPropertiesSet(); return template; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java index 24356bca..86ac7060 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/CaptchaProperties.java @@ -13,12 +13,29 @@ import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "captcha") public class CaptchaProperties { - // 验证码类型 + + /** + * 验证码开关 + */ + private Boolean enabled; + + /** + * 验证码类型 + */ private String type; - // 验证码类别 + + /** + * 验证码类别 + */ private String category; - // 数字验证码位数 + + /** + * 数字验证码位数 + */ private Integer numberLength; - // 字符验证码长度 + + /** + * 字符验证码长度 + */ private Integer charLength; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index b56b4370..bc22ca04 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -1,26 +1,33 @@ package com.ruoyi.framework.web.service; -import javax.annotation.Resource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.Authentication; -import org.springframework.stereotype.Component; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaExpireException; import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.config.properties.CaptchaProperties; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; /** * 登录校验方法 - * + * * @author ruoyi */ @Component @@ -35,9 +42,15 @@ public class SysLoginService @Autowired private RedisCache redisCache; + @Autowired + private CaptchaProperties captchaProperties; + + @Autowired + private ISysUserService userService; + /** * 登录验证 - * + * * @param username 用户名 * @param password 密码 * @param code 验证码 @@ -46,19 +59,19 @@ public class SysLoginService */ public String login(String username, String password, String code, String uuid) { - String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; - String captcha = redisCache.getCacheObject(verifyKey); - redisCache.deleteObject(verifyKey); - if (captcha == null) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); - throw new CaptchaExpireException(); - } - if (!code.equalsIgnoreCase(captcha)) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); - throw new CaptchaException(); - } + if(captchaProperties.getEnabled()) { + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + } // 用户验证 Authentication authentication = null; try @@ -82,7 +95,19 @@ public class SysLoginService } AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + recordLoginInfo(loginUser.getUser()); // 生成token return tokenService.createToken(loginUser); } + + /** + * 记录登录信息 + */ + public void recordLoginInfo(SysUser user) + { + user.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest())); + user.setLoginDate(DateUtils.getNowDate()); + user.setUpdateBy(user.getUserName()); + userService.updateUserProfile(user); + } } diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index 3d359605..80737062 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -1,34 +1,34 @@ - - - - ruoyi-vue-plus - com.ruoyi - ${ruoyi-vue-plus.version} - - 4.0.0 - - ruoyi-generator - - - generator代码生成 - - - - - - - org.apache.velocity - velocity - - - - - com.ruoyi - ruoyi-common - - - - - \ No newline at end of file + + + + ruoyi-vue-plus + com.ruoyi + ${ruoyi-vue-plus.version} + + 4.0.0 + + ruoyi-generator + + + generator代码生成 + + + + + + + org.apache.velocity + velocity + + + + + com.ruoyi + ruoyi-common + + + + + diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index e71e8896..f156e4f5 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -143,6 +143,7 @@ public class GenTableServiceImpl extends ServiceImpl i .set(cenTableColumn.getIsEdit() == null, GenTableColumn::getIsEdit, null) .set(cenTableColumn.getIsList() == null, GenTableColumn::getIsList, null) .set(cenTableColumn.getIsQuery() == null, GenTableColumn::getIsQuery, null) + .set(cenTableColumn.getIsRequired() == null, GenTableColumn::getIsRequired, null) .eq(GenTableColumn::getColumnId,cenTableColumn.getColumnId())); } } @@ -458,4 +459,4 @@ public class GenTableServiceImpl extends ServiceImpl i } return genPath + File.separator + VelocityUtils.getFileName(template, table); } -} \ No newline at end of file +} diff --git a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm index 41fa0e95..98a14970 100644 --- a/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/addBo.java.vm @@ -29,10 +29,12 @@ public class ${ClassName}AddBo { #if($column.javaType == 'Date') @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") #end +#if($column.isRequired==1) #if($column.javaType == 'String') @NotBlank(message = "$column.columnComment不能为空") #else @NotNull(message = "$column.columnComment不能为空") +#end #end private $column.javaType $column.javaField; #end diff --git a/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm b/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm index 3f3d9885..60b7e34c 100644 --- a/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/editBo.java.vm @@ -29,10 +29,12 @@ public class ${ClassName}EditBo { #if($column.javaType == 'Date') @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") #end +#if($column.isRequired==1) #if($column.javaType == 'String') @NotBlank(message = "$column.columnComment不能为空") #else @NotNull(message = "$column.columnComment不能为空") +#end #end private $column.javaType $column.javaField; #end diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index c6b6573e..b384ba5e 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -108,6 +108,7 @@ plain icon="el-icon-download" size="mini" + :loading="exportLoading" @click="handleExport" v-hasPermi="['${moduleName}:${businessName}:export']" >导出 @@ -158,7 +159,7 @@ - + { + this.exportLoading = true; return export${BusinessName}(queryParams); }).then(response => { this.download(response.msg); + this.exportLoading = false; }) } } diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml index 0a23e04c..cfcbffcb 100644 --- a/ruoyi-quartz/pom.xml +++ b/ruoyi-quartz/pom.xml @@ -1,40 +1,40 @@ - - - - ruoyi-vue-plus - com.ruoyi - ${ruoyi-vue-plus.version} - - 4.0.0 - - ruoyi-quartz - - - quartz定时任务 - - - - - - - org.springframework.boot - spring-boot-starter-quartz - - - com.mchange - c3p0 - - - - - - - com.ruoyi - ruoyi-common - - - - - \ No newline at end of file + + + + ruoyi-vue-plus + com.ruoyi + ${ruoyi-vue-plus.version} + + 4.0.0 + + ruoyi-quartz + + + quartz定时任务 + + + + + + + org.springframework.boot + spring-boot-starter-quartz + + + com.mchange + c3p0 + + + + + + + com.ruoyi + ruoyi-common + + + + + diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index 98e02d3e..b1c8941a 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -1,134 +1,134 @@ -package com.ruoyi.quartz.domain; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.quartz.util.CronUtils; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 定时任务调度表 sys_job - * - * @author ruoyi - */ - -@Data -@NoArgsConstructor -@Accessors(chain = true) -@TableName("sys_job") -public class SysJob implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 任务ID - */ - @Excel(name = "任务序号", cellType = ColumnType.NUMERIC) - @TableId(value = "job_id", type = IdType.AUTO) - private Long jobId; - - /** - * 任务名称 - */ - @NotBlank(message = "任务名称不能为空") - @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") - @Excel(name = "任务名称") - private String jobName; - - /** - * 任务组名 - */ - @Excel(name = "任务组名") - private String jobGroup; - - /** - * 调用目标字符串 - */ - @NotBlank(message = "调用目标字符串不能为空") - @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") - @Excel(name = "调用目标字符串") - private String invokeTarget; - - /** - * cron执行表达式 - */ - @NotBlank(message = "Cron执行表达式不能为空") - @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") - @Excel(name = "执行表达式 ") - private String cronExpression; - - /** - * cron计划策略 - */ - @Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行") - private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; - - /** - * 是否并发执行(0允许 1禁止) - */ - @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") - private String concurrent; - - /** - * 任务状态(0正常 1暂停) - */ - @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") - private String status; - - /** - * 创建者 - */ - @TableField(fill = FieldFill.INSERT) - private String createBy; - - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 更新者 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private String updateBy; - - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - /** - * 备注 - */ - private String remark; - - /** - * 请求参数 - */ - @TableField(exist = false) - private Map params = new HashMap<>(); - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - public Date getNextValidTime() { - if (StrUtil.isNotEmpty(cronExpression)) { - return CronUtils.getNextExecution(cronExpression); - } - return null; - } - -} +package com.ruoyi.quartz.domain; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.quartz.util.CronUtils; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 定时任务调度表 sys_job + * + * @author ruoyi + */ + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("sys_job") +public class SysJob implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 任务ID + */ + @Excel(name = "任务序号", cellType = ColumnType.NUMERIC) + @TableId(value = "job_id", type = IdType.AUTO) + private Long jobId; + + /** + * 任务名称 + */ + @NotBlank(message = "任务名称不能为空") + @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") + @Excel(name = "任务名称") + private String jobName; + + /** + * 任务组名 + */ + @Excel(name = "任务组名") + private String jobGroup; + + /** + * 调用目标字符串 + */ + @NotBlank(message = "调用目标字符串不能为空") + @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") + @Excel(name = "调用目标字符串") + private String invokeTarget; + + /** + * cron执行表达式 + */ + @NotBlank(message = "Cron执行表达式不能为空") + @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") + @Excel(name = "执行表达式 ") + private String cronExpression; + + /** + * cron计划策略 + */ + @Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行") + private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; + + /** + * 是否并发执行(0允许 1禁止) + */ + @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") + private String concurrent; + + /** + * 任务状态(0正常 1暂停) + */ + @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") + private String status; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新者 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 备注 + */ + private String remark; + + /** + * 请求参数 + */ + @TableField(exist = false) + private Map params = new HashMap<>(); + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date getNextValidTime() { + if (StrUtil.isNotEmpty(cronExpression)) { + return CronUtils.getNextExecution(cronExpression); + } + return null; + } + +} diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 7563b1a0..2f5579f4 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -1,33 +1,28 @@ - - - - ruoyi-vue-plus - com.ruoyi - ${ruoyi-vue-plus.version} - - 4.0.0 - - ruoyi-system - - - system系统模块 - - - - - - - com.ruoyi - ruoyi-common - - - - com.github.xiaoymin - knife4j-spring-boot-starter - - - - - \ No newline at end of file + + + + ruoyi-vue-plus + com.ruoyi + ${ruoyi-vue-plus.version} + + 4.0.0 + + ruoyi-system + + + system系统模块 + + + + + + + com.ruoyi + ruoyi-common + + + + + diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index fb9064f9..4bdce363 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,6 +1,6 @@ { "name": "ruoyi-vue-plus", - "version": "2.1.2", + "version": "2.2.0", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", diff --git a/ruoyi-ui/public/html/ie.html b/ruoyi-ui/public/html/ie.html new file mode 100644 index 00000000..390ce8ab --- /dev/null +++ b/ruoyi-ui/public/html/ie.html @@ -0,0 +1,46 @@ + + + + + + 请升级您的浏览器 + + + + + + +

请升级您的浏览器,以便我们更好的为您提供服务!

+

您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

+
+

请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

+

自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

+
+

您可以选择更先进的浏览器

+

推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

+ +
+ + \ No newline at end of file diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html index 6d64bf95..925455ca 100644 --- a/ruoyi-ui/public/index.html +++ b/ruoyi-ui/public/index.html @@ -7,6 +7,7 @@ <%= webpackConfig.name %> +