Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
scrm
/
platform-merchants
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bcd4b02e
authored
Feb 28, 2026
by
叶立庆
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/v5.6.0'
2 parents
b01e249b
f1cabaf4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
platform-merchants-container/src/main/java/cn/com/glsx/merchants/service/BeiSenService.java
platform-merchants-container/src/main/java/cn/com/glsx/merchants/util/NumberUtils.java
platform-merchants-container/src/main/java/cn/com/glsx/merchants/service/BeiSenService.java
View file @
bcd4b02
...
...
@@ -34,6 +34,7 @@ import cn.com.glsx.merchants.service.beisen.EmployeeMappingService;
import
cn.com.glsx.merchants.service.beisen.EmployeeRole
;
import
cn.com.glsx.merchants.service.beisen.EmployeeRoleService
;
import
cn.com.glsx.merchants.service.beisen.ExecutorFactory
;
import
cn.com.glsx.merchants.util.NumberUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.nacos.common.utils.StringUtils
;
...
...
@@ -741,16 +742,19 @@ public class BeiSenService {
}
if
(
customProperties
!=
null
)
{
String
s1
=
customProperties
.
get
(
beiSenProperty
.
getTrialBasicSalary
());
if
(
StringUtils
.
isEmpty
(
s1
))
{
log
.
info
(
"北森员工{},trialBasicSalary空"
,
employeeInfo
.
getName
());
BigDecimal
trialSalary
=
NumberUtils
.
safeParseBigDecimal
(
s1
);
if
(
trialSalary
==
null
)
{
log
.
info
(
"北森员工{}, trialBasicSalary 为空或非数字: '{}'"
,
employeeInfo
.
getName
(),
s1
);
}
else
{
beisenEmployeeInfonew
.
setTrialBasicSalary
(
new
BigDecimal
(
s1
)
);
beisenEmployeeInfonew
.
setTrialBasicSalary
(
trialSalary
);
}
String
s2
=
customProperties
.
get
(
beiSenProperty
.
getFormalBasicSalary
());
if
(
StringUtils
.
isEmpty
(
s2
))
{
log
.
info
(
"北森员工{},formalBasicSalary空"
,
employeeInfo
.
getName
());
BigDecimal
formalSalary
=
NumberUtils
.
safeParseBigDecimal
(
s2
);
if
(
formalSalary
==
null
)
{
log
.
info
(
"北森员工{}, formalBasicSalary 为空或非数字: '{}'"
,
employeeInfo
.
getName
(),
s2
);
}
else
{
beisenEmployeeInfonew
.
setFormalBasicSalary
(
new
BigDecimal
(
s2
)
);
beisenEmployeeInfonew
.
setFormalBasicSalary
(
formalSalary
);
}
String
s3
=
customProperties
.
get
(
beiSenProperty
.
getMerchantName
());
if
(
StringUtils
.
isEmpty
(
s3
))
{
...
...
@@ -818,4 +822,5 @@ public class BeiSenService {
return
beisenEmployeeInfoDTO
;
}).
collect
(
Collectors
.
toList
());
}
}
platform-merchants-container/src/main/java/cn/com/glsx/merchants/util/NumberUtils.java
0 → 100644
View file @
bcd4b02
package
cn
.
com
.
glsx
.
merchants
.
util
;
import
java.math.BigDecimal
;
import
java.util.regex.Pattern
;
public
class
NumberUtils
{
// 可选:预编译正则(性能更好)
private
static
final
Pattern
NUMBER_PATTERN
=
Pattern
.
compile
(
"^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$"
);
/**
* 安全地将字符串解析为 BigDecimal
* @param str 输入字符串
* @return 有效的 BigDecimal,或 null(如果无效)
*/
public
static
BigDecimal
safeParseBigDecimal
(
String
str
)
{
if
(
str
==
null
||
str
.
trim
().
isEmpty
())
{
return
null
;
}
try
{
// 可选1:先用正则快速过滤明显非法格式(提升性能,避免异常开销)
if
(!
NUMBER_PATTERN
.
matcher
(
str
.
trim
()).
matches
())
{
return
null
;
}
// 可选2:直接尝试 new BigDecimal(更严格,支持科学计数法等)
return
new
BigDecimal
(
str
.
trim
());
}
catch
(
NumberFormatException
e
)
{
return
null
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment