Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
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
liyuan
byit-myth-job
Commits
276177a5
Commit
276177a5
authored
May 09, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
死锁BUG
parent
22a70438
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
43 deletions
+45
-43
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+45
-43
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
276177a5
...
@@ -972,7 +972,6 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -972,7 +972,6 @@ public class ApiFlowServiceImpl implements ApiFlowService {
@Override
@Override
public
void
repairFlow
(
String
param
)
{
public
void
repairFlow
(
String
param
)
{
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
//获取工作空间名称
//获取工作空间名称
...
@@ -998,51 +997,54 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -998,51 +997,54 @@ public class ApiFlowServiceImpl implements ApiFlowService {
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
List
<
Node
>
nodeList
=
nodeMapper
.
findByFlowIdAndName
(
flow
.
getFlowId
(),
nodeNameList
);
List
<
Node
>
nodeList
=
nodeMapper
.
findByFlowIdAndName
(
flow
.
getFlowId
(),
nodeNameList
);
RedissLockUtil
.
lock
(
flow
.
getFlowId
().
toString
(),
60
);
//设置触发时间
try
{
Long
triggerTime
=
System
.
currentTimeMillis
();
RedissLockUtil
.
lock
(
flow
.
getFlowId
().
toString
(),
60
);
//设置触发时间
Long
triggerTime
=
System
.
currentTimeMillis
();
Map
<
String
,
List
<
WaitingTask
>>
waitTaskMap
=
buildTask
(
nodeList
,
nodeNameList
,
repairTimeList
,
triggerTime
,
flowName
);
Map
<
String
,
List
<
WaitingTask
>>
waitTaskMap
=
buildTask
(
nodeList
,
nodeNameList
,
repairTimeList
,
triggerTime
,
flowName
);
//将时间排序
//将时间排序
Collections
.
sort
(
repairTimeList
);
Collections
.
sort
(
repairTimeList
);
//查看当前排队的工作流最大排队序号
//查看当前排队的工作流最大排队序号
Integer
order
=
waitingRecordMapper
.
findOrderByFlowId
(
flow
.
getFlowId
());
Integer
order
=
waitingRecordMapper
.
findOrderByFlowId
(
flow
.
getFlowId
());
if
(
order
==
null
){
if
(
order
==
null
){
order
=
0
;
order
=
0
;
}
}
String
userName
=
currentUserUtils
.
account
();
String
userName
=
currentUserUtils
.
account
();
for
(
String
repairTime
:
repairTimeList
){
for
(
String
repairTime
:
repairTimeList
){
WaitingRecord
waitingRecord
=
new
WaitingRecord
();
WaitingRecord
waitingRecord
=
new
WaitingRecord
();
RunRecording
runRecording
=
new
RunRecording
();
RunRecording
runRecording
=
new
RunRecording
();
String
runId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
String
runId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
//设置排期
//设置排期
BeanUtils
.
copyProperties
(
flow
,
waitingRecord
);
BeanUtils
.
copyProperties
(
flow
,
waitingRecord
);
waitingRecord
.
setFlowVersionName
(
flow
.
getVersionName
());
waitingRecord
.
setFlowVersionName
(
flow
.
getVersionName
());
waitingRecord
.
setRunId
(
runId
);
waitingRecord
.
setRunId
(
runId
);
waitingRecord
.
setFlowNodeCount
(
nodeList
.
size
());
waitingRecord
.
setFlowNodeCount
(
nodeList
.
size
());
waitingRecord
.
setOperator
(
userName
);
waitingRecord
.
setOperator
(
userName
);
waitingRecord
.
setScheduleType
(
ScheduleTypeEnum
.
REPAIR
.
getCode
());
waitingRecord
.
setScheduleType
(
ScheduleTypeEnum
.
REPAIR
.
getCode
());
waitingRecord
.
setWaitOrder
(++
order
);
waitingRecord
.
setWaitOrder
(++
order
);
//需要按着时间先后来设置时间
//需要按着时间先后来设置时间
waitingRecord
.
setTriggerTime
(
System
.
currentTimeMillis
());
waitingRecord
.
setTriggerTime
(
System
.
currentTimeMillis
());
//设置实例
//设置实例
BeanUtils
.
copyProperties
(
waitingRecord
,
runRecording
);
BeanUtils
.
copyProperties
(
waitingRecord
,
runRecording
);
runRecording
.
setFlowStatus
(
"1"
);
runRecording
.
setFlowStatus
(
"1"
);
runRecording
.
setTriggerTime
(
System
.
currentTimeMillis
());
runRecording
.
setTriggerTime
(
System
.
currentTimeMillis
());
Integer
waitId
=
waitingRecordMapper
.
insertSelective
(
waitingRecord
);
Integer
waitId
=
waitingRecordMapper
.
insertSelective
(
waitingRecord
);
runRecordingMapper
.
saveRunRecording
(
runRecording
);
runRecordingMapper
.
saveRunRecording
(
runRecording
);
List
<
WaitingTask
>
repairTaskList
=
waitTaskMap
.
get
(
repairTime
);
List
<
WaitingTask
>
repairTaskList
=
waitTaskMap
.
get
(
repairTime
);
repairTaskList
.
forEach
(
waitingTask
->
{
repairTaskList
.
forEach
(
waitingTask
->
{
waitingTask
.
setWaitId
(
waitingRecord
.
getWaitId
());
waitingTask
.
setWaitId
(
waitingRecord
.
getWaitId
());
waitingTaskMapper
.
insertSelective
(
waitingTask
);
waitingTaskMapper
.
insertSelective
(
waitingTask
);
});
});
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
RedissLockUtil
.
unlock
(
flow
.
getFlowId
().
toString
());
}
}
RedissLockUtil
.
unlock
(
flow
.
getFlowId
().
toString
());
}
}
...
...
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