Pre Merge pull request !538 from dark_wu/master

pull/538/MERGE
dark_wu 2025-02-27 02:57:28 +00:00 committed by Gitee
commit 6fbbba82ea
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 23 additions and 16 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" /> <property name="log.path" value="./logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@ -9,6 +9,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import org.springframework.lang.NonNull;
/** /**
* spring 便springbean * spring 便springbean
@ -24,13 +25,13 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
private static ApplicationContext applicationContext; private static ApplicationContext applicationContext;
@Override @Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException public void postProcessBeanFactory(@NonNull ConfigurableListableBeanFactory beanFactory) throws BeansException
{ {
SpringUtils.beanFactory = beanFactory; SpringUtils.beanFactory = beanFactory;
} }
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException public void setApplicationContext(@NonNull ApplicationContext applicationContext) throws BeansException
{ {
SpringUtils.applicationContext = applicationContext; SpringUtils.applicationContext = applicationContext;
} }

View File

@ -8,6 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver; import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import org.springframework.lang.NonNull;
/** /**
* *
@ -36,7 +37,7 @@ public class I18nConfig implements WebMvcConfigurer
} }
@Override @Override
public void addInterceptors(InterceptorRegistry registry) public void addInterceptors(@NonNull InterceptorRegistry registry)
{ {
registry.addInterceptor(localeChangeInterceptor()); registry.addInterceptor(localeChangeInterceptor());
} }

View File

@ -116,9 +116,9 @@ public class MyBatisConfig
@Bean @Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
{ {
String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage", "");
String mapperLocations = env.getProperty("mybatis.mapperLocations"); String mapperLocations = env.getProperty("mybatis.mapperLocations", "");
String configLocation = env.getProperty("mybatis.configLocation"); String configLocation = env.getProperty("mybatis.configLocation", "");
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
VFS.addImplClass(SpringBootVFS.class); VFS.addImplClass(SpringBootVFS.class);

View File

@ -10,6 +10,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
import org.springframework.lang.NonNull;
/** /**
* *
@ -32,13 +33,13 @@ public class ResourcesConfig implements WebMvcConfigurer
* *
*/ */
@Override @Override
public void addViewControllers(ViewControllerRegistry registry) public void addViewControllers(@NonNull ViewControllerRegistry registry)
{ {
registry.addViewController("/").setViewName("forward:" + indexUrl); registry.addViewController("/").setViewName("forward:" + indexUrl);
} }
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) public void addResourceHandlers(@NonNull ResourceHandlerRegistry registry)
{ {
/** 本地文件上传路径 */ /** 本地文件上传路径 */
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
@ -51,7 +52,7 @@ public class ResourcesConfig implements WebMvcConfigurer
* *
*/ */
@Override @Override
public void addInterceptors(InterceptorRegistry registry) public void addInterceptors(@NonNull InterceptorRegistry registry)
{ {
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Anonymous;
import org.springframework.lang.NonNull;
/** /**
* Anonymous访url * Anonymous访url
@ -40,7 +41,8 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
Class<?> beanClass; Class<?> beanClass;
if (bean instanceof Advised) if (bean instanceof Advised)
{ {
beanClass = ((Advised) bean).getTargetSource().getTarget().getClass(); Object target = ((Advised) bean).getTargetSource().getTarget();
beanClass = target != null ? target.getClass() : bean.getClass();
} }
else else
{ {
@ -134,7 +136,7 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
} }
@Override @Override
public void setApplicationContext(ApplicationContext context) throws BeansException public void setApplicationContext(@NonNull ApplicationContext context) throws BeansException
{ {
this.applicationContext = context; this.applicationContext = context;
} }

View File

@ -10,6 +10,7 @@ import com.ruoyi.common.json.JSON;
import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.ServletUtils;
import org.springframework.lang.NonNull;
/** /**
* *
@ -20,7 +21,7 @@ import com.ruoyi.common.utils.ServletUtils;
public abstract class RepeatSubmitInterceptor implements HandlerInterceptor public abstract class RepeatSubmitInterceptor implements HandlerInterceptor
{ {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception
{ {
if (handler instanceof HandlerMethod) if (handler instanceof HandlerMethod)
{ {

View File

@ -124,7 +124,9 @@ public class GlobalExceptionHandler
value = EscapeUtil.clean(value); value = EscapeUtil.clean(value);
} }
log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI, e); log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI, e);
return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), value)); Class<?> requiredType = e.getRequiredType();
String typeName = requiredType != null ? requiredType.getName() : "unknown";
return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), typeName, value));
} }
/** /**

View File

@ -1,6 +1,5 @@
package com.ruoyi.quartz.domain; package com.ruoyi.quartz.domain;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -17,7 +16,7 @@ import com.ruoyi.quartz.util.CronUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysJob extends BaseEntity implements Serializable public class SysJob extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;