diff --git a/udf-api/pom.xml b/udf-api/pom.xml
index ef7bf6a..4b16f2d 100644
--- a/udf-api/pom.xml
+++ b/udf-api/pom.xml
@@ -14,7 +14,7 @@
${maven.build.timestamp}
1.0
1.0.0
- 2.3.0.RELEASE
+ 2.4.3
UTF-8
1.8
3.8.1
diff --git a/udf-app/manifest.json b/udf-app/manifest.json
index a11828c..21290e9 100644
--- a/udf-app/manifest.json
+++ b/udf-app/manifest.json
@@ -1,7 +1,7 @@
{
- "name" : "udf-app",
+ "name" : "itkk",
"appid" : "__UNI__71A3799",
- "description" : "udf-app",
+ "description" : "itkk",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
diff --git a/udf-starter/pom.xml b/udf-starter/pom.xml
index 8bc94d9..4ddb690 100644
--- a/udf-starter/pom.xml
+++ b/udf-starter/pom.xml
@@ -12,19 +12,19 @@
1.0.0
- 2.3.0.RELEASE
+ 2.4.3
UTF-8
1.8
3.8.1
3.2.1
4.4
- 3.10
+ 3.11
1.20
- 1.1.22
- 2.1.2
- 3.3.2
- 29.0-jre
- 4.1.2
+ 1.2.5
+ 2.1.4
+ 3.4.2
+ 30.1-jre
+ 5.0.0
0.4.11
diff --git a/udf-starter/udf-starter-cache-db/src/main/java/org/itkk/udf/starter/cache/db/service/DbCacheService.java b/udf-starter/udf-starter-cache-db/src/main/java/org/itkk/udf/starter/cache/db/service/DbCacheService.java
index 39462bd..b447d87 100644
--- a/udf-starter/udf-starter-cache-db/src/main/java/org/itkk/udf/starter/cache/db/service/DbCacheService.java
+++ b/udf-starter/udf-starter-cache-db/src/main/java/org/itkk/udf/starter/cache/db/service/DbCacheService.java
@@ -174,16 +174,29 @@ public class DbCacheService {
DbCacheEntity entity = getEntity(key);
//判空
if (entity == null) {
- //新增缓存
+ //实例化
entity = new DbCacheEntity();
- entity.setK(key);
- entity.setV(value);
- entity.setCreateTime(System.currentTimeMillis());
- entity.setExpire(expire);
- entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
- entity.setCreateDate(new Date());
- entity.setUpdateDate(new Date());
- iDbCacheRepository.insert(entity);
+ //新增缓存
+ try {
+ entity.setK(key);
+ entity.setV(value);
+ entity.setCreateTime(System.currentTimeMillis());
+ entity.setExpire(expire);
+ entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
+ entity.setCreateDate(new Date());
+ entity.setUpdateDate(new Date());
+ iDbCacheRepository.insert(entity);
+ } catch (Exception e) {
+ log.warn("添加缓存失败,转为更新缓存");
+ //更新缓存
+ entity.setK(key);
+ entity.setV(value);
+ entity.setCreateTime(System.currentTimeMillis());
+ entity.setExpire(expire);
+ entity.setExpireTime(entity.getCreateTime() + entity.getExpire());
+ entity.setUpdateDate(new Date());
+ iDbCacheRepository.updateById(entity);
+ }
} else {
//更新缓存
entity.setV(value);
diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreConfiguration.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreConfiguration.java
index 29a4350..7eb3b6e 100644
--- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreConfiguration.java
+++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreConfiguration.java
@@ -1,10 +1,11 @@
package org.itkk.udf.starter.core;
+import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
-import com.baomidou.mybatisplus.core.parser.ISqlParser;
import com.baomidou.mybatisplus.extension.MybatisMapWrapperFactory;
-import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.cache.Cache;
@@ -22,6 +23,7 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
@@ -32,7 +34,6 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -54,7 +55,10 @@ public class CoreConfiguration {
*/
@Bean
public List configurationCustomizersProvider() {
- return Lists.newArrayList(configuration -> configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory()));
+ return Lists.newArrayList(
+ configuration -> configuration.setObjectWrapperFactory(new MybatisMapWrapperFactory()),
+ configuration -> configuration.setUseDeprecatedExecutor(false)
+ );
}
/**
@@ -132,18 +136,14 @@ public class CoreConfiguration {
}
/**
- * 分页插件
- *
- * @return
+ * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
*/
@Bean
- public PaginationInterceptor paginationInterceptor() {
- PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
- List sqlParserList = new ArrayList<>();
- // 攻击 SQL 阻断解析器、加入解析链
- sqlParserList.add(new BlockAttackSqlParser());
- paginationInterceptor.setSqlParserList(sqlParserList);
- return paginationInterceptor;
+ public MybatisPlusInterceptor mybatisPlusInterceptor() {
+ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+ interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
+ interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
+ return interceptor;
}
/**
@@ -219,9 +219,9 @@ public class CoreConfiguration {
public ClientHttpRequestFactory requestFactory() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(coreProperties.getHttpConnectTimeout());
- //requestFactory.setReadTimeout(coreProperties.getHttpReadTimeout());
+ requestFactory.setReadTimeout(coreProperties.getHttpReadTimeout());
requestFactory.setBufferRequestBody(coreProperties.getBufferRequestBody());
- return requestFactory;
+ return new BufferingClientHttpRequestFactory(requestFactory);
}
/**
diff --git a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreProperties.java b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreProperties.java
index 8e4af03..01b7e42 100644
--- a/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreProperties.java
+++ b/udf-starter/udf-starter-core/src/main/java/org/itkk/udf/starter/core/CoreProperties.java
@@ -77,8 +77,8 @@ public class CoreProperties implements ApplicationContextAware {
/**
* http读取超时时间
*/
- //@NotNull(message = CORE_PROPERTIES_PRE_FIX + ".httpReadTimeout不能为空")
- //private Integer httpReadTimeout = 5000;
+ @NotNull(message = CORE_PROPERTIES_PRE_FIX + ".httpReadTimeout不能为空")
+ private Integer httpReadTimeout = 5000;
/**
* RestTemplate是否允许大消息体