Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jeecg
jeecg-boot
提交
aec00d9b
J
jeecg-boot
项目概览
jeecg
/
jeecg-boot
上一次同步 3 年多
通知
865
Star
24375
Fork
84
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeecg-boot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
aec00d9b
编写于
12月 06, 2020
作者:
JEECG低代码平台
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
上传中文文件名转为拼音、Long类型精度丢失问题 issues/I24KXI、达梦数据库兼容修改
上级
341830c5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
58 addition
and
1 deletion
+58
-1
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml
+6
-0
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/CommonUtils.java
...core/src/main/java/org/jeecg/common/util/CommonUtils.java
+27
-1
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebMvcConfiguration.java
...e/src/main/java/org/jeecg/config/WebMvcConfiguration.java
+24
-0
jeecg-boot/pom.xml
jeecg-boot/pom.xml
+1
-0
未找到文件。
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml
浏览文件 @
aec00d9b
...
...
@@ -76,6 +76,12 @@
<version>
${commons.version}
</version>
</dependency>
<!-- 拼音库 -->
<dependency>
<groupId>
com.belerweb
</groupId>
<artifactId>
pinyin4j
</artifactId>
<version>
${pinyin4j.version}
</version>
</dependency>
<!-- freemarker -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/CommonUtils.java
浏览文件 @
aec00d9b
package
org.jeecg.common.util
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.extra.pinyin.PinyinUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.jeecg.common.constant.CommonConstant
;
import
org.jeecg.common.constant.DataBaseConstant
;
...
...
@@ -16,10 +18,15 @@ import java.io.InputStream;
import
java.sql.Connection
;
import
java.sql.DatabaseMetaData
;
import
java.sql.SQLException
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@Slf4j
public
class
CommonUtils
{
//中文正则
private
static
Pattern
ZHONGWEN_PATTERN
=
Pattern
.
compile
(
"[\u4e00-\u9fa5]"
);
public
static
String
uploadOnlineImage
(
byte
[]
data
,
String
basePath
,
String
bizPath
,
String
uploadType
){
String
dbPath
=
null
;
String
fileName
=
"image"
+
Math
.
round
(
Math
.
random
()
*
100000000000L
);
...
...
@@ -68,9 +75,28 @@ public class CommonUtils {
}
//替换上传文件名字的特殊字符
fileName
=
fileName
.
replace
(
"="
,
""
).
replace
(
","
,
""
).
replace
(
"&"
,
""
).
replace
(
"#"
,
""
);
//替换上传文件名字中的中文
if
(
ifContainChinese
(
fileName
)){
fileName
=
PinyinUtil
.
getPinyin
(
fileName
,
StrUtil
.
EMPTY
);
}
//替换上传文件名字中的空格
fileName
=
fileName
.
replaceAll
(
"\\s"
,
""
);
return
fileName
;
}
// java 判断字符串里是否包含中文字符
public
static
boolean
ifContainChinese
(
String
str
)
{
if
(
str
.
getBytes
().
length
==
str
.
length
()){
return
false
;
}
else
{
Matcher
m
=
ZHONGWEN_PATTERN
.
matcher
(
str
);
if
(
m
.
find
())
{
return
true
;
}
return
false
;
}
}
/**
* 统一全局上传
* @Return: java.lang.String
...
...
@@ -129,7 +155,7 @@ public class CommonUtils {
String
dbType
=
md
.
getDatabaseProductName
().
toLowerCase
();
if
(
dbType
.
indexOf
(
"mysql"
)>=
0
)
{
DB_TYPE
=
DataBaseConstant
.
DB_TYPE_MYSQL
;
}
else
if
(
dbType
.
indexOf
(
"oracle"
)>=
0
)
{
}
else
if
(
dbType
.
indexOf
(
"oracle"
)>=
0
||
dbType
.
indexOf
(
"dm"
)>=
0
)
{
DB_TYPE
=
DataBaseConstant
.
DB_TYPE_ORACLE
;
}
else
if
(
dbType
.
indexOf
(
"sqlserver"
)>=
0
||
dbType
.
indexOf
(
"sql server"
)>=
0
)
{
DB_TYPE
=
DataBaseConstant
.
DB_TYPE_SQLSERVER
;
...
...
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebMvcConfiguration.java
浏览文件 @
aec00d9b
package
org.jeecg.config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.module.SimpleModule
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Conditional
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.web.cors.CorsConfiguration
;
import
org.springframework.web.cors.UrlBasedCorsConfigurationSource
;
import
org.springframework.web.filter.CorsFilter
;
...
...
@@ -12,6 +17,8 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import
org.springframework.web.servlet.config.annotation.ViewControllerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.List
;
/**
* Spring Boot 2.0 解决跨域问题
*
...
...
@@ -64,6 +71,22 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
return
new
CorsFilter
(
urlBasedCorsConfigurationSource
);
}
/**
* 添加Long转json精度丢失是配置
* @Return: void
*/
@Override
public
void
configureMessageConverters
(
List
<
HttpMessageConverter
<?>>
converters
)
{
MappingJackson2HttpMessageConverter
jackson2HttpMessageConverter
=
new
MappingJackson2HttpMessageConverter
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
SimpleModule
simpleModule
=
new
SimpleModule
();
simpleModule
.
addSerializer
(
Long
.
class
,
ToStringSerializer
.
instance
);
simpleModule
.
addSerializer
(
Long
.
TYPE
,
ToStringSerializer
.
instance
);
objectMapper
.
registerModule
(
simpleModule
);
jackson2HttpMessageConverter
.
setObjectMapper
(
objectMapper
);
converters
.
add
(
jackson2HttpMessageConverter
);
}
/**
* SpringBootAdmin的Httptrace不见了
* https://blog.csdn.net/u013810234/article/details/110097201
...
...
@@ -72,4 +95,5 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
public
InMemoryHttpTraceRepository
getInMemoryHttpTrace
(){
return
new
InMemoryHttpTraceRepository
();
}
}
jeecg-boot/pom.xml
浏览文件 @
aec00d9b
...
...
@@ -45,6 +45,7 @@
<justauth-spring-boot-starter.version>
1.3.2
</justauth-spring-boot-starter.version>
<dom4j.version>
1.6.1
</dom4j.version>
<qiniu-java-sdk.version>
7.2.23
</qiniu-java-sdk.version>
<pinyin4j.version>
2.5.1
</pinyin4j.version>
</properties>
<modules>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录