Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
a249971a
Commit
a249971a
authored
Nov 27, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化-fxj
parent
a305dc3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
15 deletions
+25
-15
Common.java
.../com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
+13
-5
ExcelUtil.java
...m/yifu/cloud/plus/v1/yifu/common/core/util/ExcelUtil.java
+11
-1
SysBaseSetInfoServiceImpl.java
...1/yifu/social/service/impl/SysBaseSetInfoServiceImpl.java
+1
-9
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
View file @
a249971a
...
@@ -148,7 +148,17 @@ public class Common {
...
@@ -148,7 +148,17 @@ public class Common {
Matcher
match
=
pattern
.
matcher
(
str
);
Matcher
match
=
pattern
.
matcher
(
str
);
return
match
.
matches
()
!=
false
;
return
match
.
matches
()
!=
false
;
}
}
// 字符串为数字 可以带N位小数点
private
static
final
Pattern
NUMBER_PATTERN
=
compile
(
"^-?\\d+(\\.\\d+)?$"
);
public
static
boolean
isNumberStr
(
String
str
)
{
// 判断字符串为数字 可以带N位小数点的正则表达式
if
(
str
==
null
||
str
.
isEmpty
())
{
return
false
;
}
Matcher
match
=
NUMBER_PATTERN
.
matcher
(
str
);
return
match
.
matches
();
}
/**
/**
* 允许上传的文件类型
* 允许上传的文件类型
*
*
...
@@ -793,10 +803,8 @@ public class Common {
...
@@ -793,10 +803,8 @@ public class Common {
return
false
;
return
false
;
}
}
// 使用正则表达式匹配格式
// 使用正则表达式匹配格式 10.01,10;12,13 ,数字最多两位小数
// 格式要求: 数字(可带小数),数字(可带小数);数字(可带小数),数字(可带小数);...
return
str
.
matches
(
"\\d+(\\.\\d{1,2})?,\\d+(\\.\\d{1,2})?(;\\d+(\\.\\d{1,2})?,\\d+(\\.\\d{1,2})?)*"
);
// 其中数字为一个或多个数字字符,可能包含小数点
return
str
.
matches
(
"\\d+(\\.\\d+)?,\\d+(\\.\\d+)?(;\\d+(\\.\\d+)?,\\d+(\\.\\d+)?)*"
);
}
}
/**
/**
* 校验字符串是否符合格式 2025-11 或 2025/11 或202511
* 校验字符串是否符合格式 2025-11 或 2025/11 或202511
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/ExcelUtil.java
View file @
a249971a
...
@@ -697,6 +697,11 @@ public class ExcelUtil <T> implements Serializable {
...
@@ -697,6 +697,11 @@ public class ExcelUtil <T> implements Serializable {
}
}
//最大值校验
//最大值校验
if
(
Common
.
isNotNull
(
attr
.
max
())
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
attr
.
max
()))
{
if
(
Common
.
isNotNull
(
attr
.
max
())
&&
!
CommonConstants
.
ZERO_STRING
.
equals
(
attr
.
max
()))
{
//先判断是否为科学计数的数,然后转换成非科学计数的字符串
if
(
c
.
indexOf
(
"E+"
)
>=
0
&&
Common
.
isNumberStr
(
c
.
replace
(
"E+"
,
""
))){
//如果金额科学计数,转出正常值 如 c = 1.23456789E+9 转换成 c = 1234567890
c
=
new
BigDecimal
(
c
).
toPlainString
();
}
if
(
Common
.
isNumber
(
c
))
{
if
(
Common
.
isNumber
(
c
))
{
if
(
attr
.
isDouble
()
&&
Double
.
doubleToLongBits
(
Double
.
valueOf
(
c
).
doubleValue
())
>
Double
.
valueOf
(
attr
.
max
()).
doubleValue
()){
if
(
attr
.
isDouble
()
&&
Double
.
doubleToLongBits
(
Double
.
valueOf
(
c
).
doubleValue
())
>
Double
.
valueOf
(
attr
.
max
()).
doubleValue
()){
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
...
@@ -708,12 +713,17 @@ public class ExcelUtil <T> implements Serializable {
...
@@ -708,12 +713,17 @@ public class ExcelUtil <T> implements Serializable {
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
return
errorInfo
(
attr
,
"_超出最大值"
,
i
);
}
}
}
}
}
else
{
}
else
{
return
errorInfo
(
attr
,
"_必须为数字且最多两位小数"
,
i
);
return
errorInfo
(
attr
,
"_必须为数字且最多两位小数"
,
i
);
}
}
}
}
//最小值校验
//最小值校验
if
(
attr
.
min
()
>
0
)
{
if
(
attr
.
min
()
>
0
)
{
//先判断是否为科学计数的数,然后转换成非科学计数的字符串
if
(
c
.
indexOf
(
"E+"
)
>=
0
&&
Common
.
isNumberStr
(
c
.
replace
(
"E+"
,
""
))){
//如果金额科学计数,转出正常值 如 c = 1.23456789E+9 转换成 c = 1234567890
c
=
new
BigDecimal
(
c
).
toPlainString
();
}
if
(
Common
.
isNumber
(
c
))
{
if
(
Common
.
isNumber
(
c
))
{
if
(
attr
.
isFloat
()){
if
(
attr
.
isFloat
()){
if
(
Float
.
valueOf
(
c
).
compareTo
(
attr
.
min
())
<
CommonConstants
.
ZERO_INT
)
{
if
(
Float
.
valueOf
(
c
).
compareTo
(
attr
.
min
())
<
CommonConstants
.
ZERO_INT
)
{
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/SysBaseSetInfoServiceImpl.java
View file @
a249971a
...
@@ -906,15 +906,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
...
@@ -906,15 +906,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
infoVo
.
setUpBig
(
excel
.
getUpBig
());
infoVo
.
setUpBig
(
excel
.
getUpBig
());
infoVo
.
setLowerBig
(
excel
.
getLowerBig
());
infoVo
.
setLowerBig
(
excel
.
getLowerBig
());
}
}
//大病缴纳周期为按月缴纳方式为按比例需要填写比例无值提示
if
(
null
==
excel
.
getPayCompanyPro
()
||
null
==
excel
.
getPayPersonalPro
()
||
excel
.
getPayPersonalPro
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
||
excel
.
getPayPersonalPro
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
){
errorMsg
=
new
ErrorMessage
(
excel
.
getRowIndex
(),
"大病是否收取为是时,大病缴纳周期为“按月”的,单位或个人大病比例字段必填,且填写正确比例即可,请修改后重新提交"
,
excel
);
errorMessageList
.
add
(
errorMsg
);
continue
;
}
infoVo
.
setPayCompanyPro
(
excel
.
getPayCompanyPro
());
infoVo
.
setPayCompanyPro
(
excel
.
getPayCompanyPro
());
infoVo
.
setPayPersonalPro
(
excel
.
getPayPersonalPro
());
infoVo
.
setPayPersonalPro
(
excel
.
getPayPersonalPro
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment