Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
zlmy-cloud
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
zlmy
zlmy-cloud
Commits
547c69c6
Commit
547c69c6
authored
Jan 07, 2026
by
鲁鸿波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
死循环
parent
ab3bc547
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
2 deletions
+86
-2
THazardWorkPlanServiceImpl.java
...odule/hazard/service/impl/THazardWorkPlanServiceImpl.java
+86
-2
No files found.
zlmy-modules/zlmy-boot/src/main/java/com/testor/module/hazard/service/impl/THazardWorkPlanServiceImpl.java
View file @
547c69c6
...
@@ -964,7 +964,7 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
...
@@ -964,7 +964,7 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
* @param allUserIds
* @param allUserIds
* @return
* @return
*/
*/
@Override
/*
@Override
public String getUserNamesByUserIds(String allUserIds) {
public String getUserNamesByUserIds(String allUserIds) {
List<String> userNames = new ArrayList<>();
List<String> userNames = new ArrayList<>();
if (StringUtils.isNotBlank(allUserIds)) {
if (StringUtils.isNotBlank(allUserIds)) {
...
@@ -974,8 +974,47 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
...
@@ -974,8 +974,47 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
}
}
}
}
return StringUtils.join(userNames, ",");
return StringUtils.join(userNames, ",");
}*/
@Override
public
String
getUserNamesByUserIds
(
String
allUserIds
)
{
if
(
StringUtils
.
isBlank
(
allUserIds
))
{
return
null
;
}
String
[]
userIds
=
allUserIds
.
split
(
","
);
// 1️⃣ 限流保护(防止异常数据)
if
(
userIds
.
length
>
50
)
{
log
.
warn
(
"userIds 数量异常:{},已截断"
,
userIds
.
length
);
}
List
<
String
>
userNames
=
new
ArrayList
<>();
Set
<
String
>
processed
=
new
HashSet
<>();
// 防重复
for
(
String
userId
:
userIds
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
continue
;
}
// 2️⃣ 防止同一个 userId 被反复查
if
(!
processed
.
add
(
userId
))
{
continue
;
}
String
name
=
getUserNamesByUserId
(
userId
);
// 3️⃣ 严格过滤 null,防止上层反复触发
if
(
StringUtils
.
isNotBlank
(
name
))
{
userNames
.
add
(
name
);
}
}
return
userNames
.
isEmpty
()
?
null
:
String
.
join
(
","
,
userNames
);
}
}
@Override
@Override
public
String
getOrgNamesByUserIds
(
String
allUserIds
)
{
public
String
getOrgNamesByUserIds
(
String
allUserIds
)
{
List
<
String
>
orgNames
=
new
ArrayList
<>();
List
<
String
>
orgNames
=
new
ArrayList
<>();
...
@@ -1985,7 +2024,7 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
...
@@ -1985,7 +2024,7 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
* @param userId
* @param userId
* @return
* @return
*/
*/
public
String
getUserNamesByUserId
(
String
userId
)
{
/*
public String getUserNamesByUserId(String userId) {
if (StringUtils.isNotBlank(userId)) {
if (StringUtils.isNotBlank(userId)) {
String[] split = userId.split("-");
String[] split = userId.split("-");
//0为企业内部人员
//0为企业内部人员
...
@@ -2008,9 +2047,54 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
...
@@ -2008,9 +2047,54 @@ public class THazardWorkPlanServiceImpl extends SuperServiceImpl<THazardWorkPlan
}
}
}
}
return null;
return null;
}*/
public
String
getUserNamesByUserId
(
String
userId
)
{
// 1. 快速失败(避免无效请求反复进入)
if
(
StringUtils
.
isBlank
(
userId
))
{
return
null
;
}
// 2. userId 必须包含 -
if
(!
userId
.
contains
(
"-"
))
{
log
.
warn
(
"非法 userId 格式:{}"
,
userId
);
return
userId
;
// 直接返回原值,避免反复计算
}
String
[]
split
=
userId
.
split
(
"-"
,
2
);
// 最多分 2 段
if
(
split
.
length
<
2
||
StringUtils
.
isBlank
(
split
[
1
]))
{
log
.
warn
(
"userId 分割异常:{}"
,
userId
);
return
userId
;
}
String
type
=
split
[
0
];
String
id
=
split
[
1
];
try
{
switch
(
type
)
{
case
"0"
:
SysUser
sysUser
=
sysUserService
.
getById
(
id
);
return
sysUser
!=
null
?
sysUser
.
getUserName
()
:
null
;
case
"1"
:
TContractorPerson
person
=
tContractorPersonService
.
getById
(
id
);
return
person
!=
null
?
person
.
getName
()
:
null
;
default
:
log
.
warn
(
"未知 userId 类型:{}"
,
userId
);
return
id
;
}
}
catch
(
Exception
e
)
{
// 3. 兜底防止异常导致上层重试
log
.
error
(
"getUserNamesByUserId 异常,userId={}"
,
userId
,
e
);
return
null
;
}
}
}
@SneakyThrows
@SneakyThrows
@Override
@Override
@XxlJob
(
"hazardousWorkMessageAlerts"
)
@XxlJob
(
"hazardousWorkMessageAlerts"
)
...
...
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