Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
9019eb31
Commit
9019eb31
authored
Sep 23, 2021
by
chenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改逻辑执行方法
parent
87482ed6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
IWorkflowExcuteService.java
.../amos/boot/biz/common/service/IWorkflowExcuteService.java
+1
-1
WorkflowExcuteServiceImpl.java
...ot/biz/common/service/impl/WorkflowExcuteServiceImpl.java
+27
-20
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/service/IWorkflowExcuteService.java
View file @
9019eb31
...
...
@@ -9,7 +9,7 @@ public interface IWorkflowExcuteService{
* @param key 流程定义的key
* @param condition 执行控制条件
*/
void
startAndComplete
(
String
key
,
String
condition
)
throws
Exception
;
String
startAndComplete
(
String
key
,
String
condition
)
throws
Exception
;
/**
* 检查当前登录人有没有流程操作权限
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/service/impl/WorkflowExcuteServiceImpl.java
View file @
9019eb31
...
...
@@ -24,10 +24,10 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
@Transactional
@Override
public
void
startAndComplete
(
String
key
,
String
condition
)
throws
Exception
{
public
String
startAndComplete
(
String
key
,
String
condition
)
throws
Exception
{
JSONObject
body
=
new
JSONObject
();
String
businessKey
=
buildOrderNo
();
body
.
put
(
"businessKey"
,
businessKey
);
String
businessKey
=
buildOrderNo
();
body
.
put
(
"businessKey"
,
businessKey
);
body
.
put
(
"processDefinitionKey"
,
key
);
JSONObject
jsonObject
=
workflowFeignService
.
startByVariable
(
body
);
if
(
jsonObject
==
null
||
jsonObject
.
getJSONObject
(
"data"
)
==
null
)
{
...
...
@@ -39,6 +39,7 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
throw
new
RuntimeException
(
"初始执行任务失败"
);
}
}
return
jsonObject
.
getJSONObject
(
"data"
).
getString
(
"id"
);
}
@Override
...
...
@@ -105,15 +106,20 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
@Override
public
Object
setTaskAssign
(
String
processInstanceId
,
String
userId
)
{
JSONObject
teskObject
=
workflowFeignService
.
getTaskList
(
processInstanceId
);
if
(
ObjectUtils
.
isNotEmpty
(
teskObject
))
{
JSONArray
taskDetailArray
=
teskObject
.
getJSONArray
(
"data"
);
for
(
Object
obj
:
taskDetailArray
)
{
JSONObject
detail
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
obj
));
try
{
if
(
ObjectUtils
.
isEmpty
(
teskObject
))
{
throw
new
RuntimeException
(
"设置任务执行人失败, 任务不存在,请检查processInstanceId"
+
processInstanceId
+
"是否正确"
);
}
JSONArray
taskDetailArray
=
teskObject
.
getJSONArray
(
"data"
);
for
(
Object
obj
:
taskDetailArray
)
{
JSONObject
detail
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
obj
));
JSONObject
taskGroupNameObject
=
workflowFeignService
.
getTaskGroupName
(
detail
.
getString
(
"id"
));
try
{
if
(
taskGroupNameObject
.
getJSONArray
(
"data"
)
==
null
&&
taskGroupNameObject
.
getJSONArray
(
"data"
).
size
()
<
1
)
{
workflowFeignService
.
setTaskUser
(
detail
.
getString
(
"id"
),
userId
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"设置任务执行人失败"
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"设置任务执行人失败"
);
}
}
return
true
;
...
...
@@ -135,14 +141,15 @@ public class WorkflowExcuteServiceImpl implements IWorkflowExcuteService {
}
return
true
;
}
public
static
String
buildOrderNo
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
newDate
=
sdf
.
format
(
new
Date
());
String
result
=
""
;
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
result
+=
random
.
nextInt
(
10
);
}
return
newDate
+
result
;
}
public
static
String
buildOrderNo
()
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
newDate
=
sdf
.
format
(
new
Date
());
String
result
=
""
;
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
result
+=
random
.
nextInt
(
10
);
}
return
newDate
+
result
;
}
}
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