Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
3bf10e80
Commit
3bf10e80
authored
Sep 14, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草稿箱发布审批流程bug
parent
0fd43ef2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
58 deletions
+61
-58
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+1
-1
src/main/java/cn/timer/api/utils/router/RouterUtils.java
+60
-57
No files found.
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
3bf10e80
...
...
@@ -1249,7 +1249,7 @@ public class SpmkController {
.
set
(
"initiator"
,
ygglMainEmp
.
getName
())
.
set
(
"headUrl"
,
ygglMainEmp
.
getHeadUrl
())
.
set
(
"id"
,
userBean
.
getEmpNum
());
RouterUtils
.
NextNode
(
listRouter
,
jSONObject
,
ISFIRST
);
RouterUtils
.
NextNode
(
listRouter
,
jSONObject
,
ISFIRST
,
true
);
List
<
FlowChildren
>
listFlowChildren
=
new
ArrayList
<
FlowChildren
>();
RouterUtils
.
getIsFlowChildren
(
listRouter
,
listFlowChildren
);
...
...
src/main/java/cn/timer/api/utils/router/RouterUtils.java
View file @
3bf10e80
...
...
@@ -41,7 +41,7 @@ import cn.timer.api.dto.spmk.User;
/**
* 流程节点工具类
*
*
* @author Administrator
*
*/
...
...
@@ -91,8 +91,8 @@ public class RouterUtils {
}
// 执行下一个节点
public
static
List
<
Router
>
NextNode
(
List
<
Router
>
listRouter
,
JSONObject
obj
,
boolean
isFirse
,
boolean
isAuditNext
)
throws
NumberFormatException
,
ConvertException
,
Exception
{
public
static
List
<
Router
>
NextNode
(
List
<
Router
>
listRouter
,
JSONObject
obj
,
boolean
isFirse
,
boolean
isAuditNext
,
boolean
...
isDrafts
)
throws
NumberFormatException
,
ConvertException
,
Exception
{
Router
router
;
if
(
CollectionUtil
.
isNotEmpty
(
listRouter
))
{
// 非条件节点
...
...
@@ -110,7 +110,7 @@ public class RouterUtils {
Console
.
log
(
"发起人逻辑"
);
router
.
setExecute
(
EXECUTED
);
router
.
setFlow
(
true
);
List
<
User
>
users
=
new
ArrayList
<
User
>();
User
userFirst
=
User
.
builder
()
.
name
(
obj
.
getStr
(
"initiator"
))
...
...
@@ -122,30 +122,30 @@ public class RouterUtils {
List
<
Relation
>
relations
=
new
ArrayList
<
Relation
>();
Relation
relation
=
Relation
.
builder
().
type
(
"user"
).
users
(
users
).
build
();
relations
.
add
(
relation
);
router
.
setRelation
(
relations
);
// router.getRelation().get(0).setName(obj.getStr("initiator"));
NextNode
(
router
.
getChildren
(),
obj
,
isFirse
,
isAuditNext
);
break
;
case
AUDIT:
Console
.
log
(
"审批人逻辑"
);
router
.
setFlow
(
true
);
Relation
r
=
CollectionUtil
.
isNotEmpty
(
router
.
getRelation
())
?
router
.
getRelation
().
get
(
0
)
:
null
;
// if (r != null && RELATION_TYPE_EXECUTIVE.equals(r.getType())) {
// Integer leaderId = selectLeaderEmpNumById(
// obj.getInt("orgCode"),
// obj.getInt("id"),
// obj.getInt("orgCode"),
// obj.getInt("id"),
// r.getUpward());
//
//
// if (leaderId != null) {
// YgglMainEmp emp = YgglMainEmp.builder().build();
// emp = emp.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
// .select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getHeadUrl)
// .eq(YgglMainEmp::getEmpNum, leaderId)
// .eq(YgglMainEmp::getOrgCode, obj.getInt("orgCode")));
//
//
// if (emp != null) {
// User user = User.builder()
// .name(emp.getName())
...
...
@@ -153,16 +153,17 @@ public class RouterUtils {
// .headUrl(emp.getHeadUrl())
// .execute(EXECUTING)
// .build();
//
//
// router.getRelation().get(0).setUsers(ListUtil.toList(user));
// }
// }
// }
if
(!
isAuditNext
)
{
router
.
setExecute
(
EXECUTING
);
//此处如果是草稿就不需要更改
if
(
isDrafts
!=
null
)
{
router
.
setExecute
(
EXECUTING
);
}
if
(
router
.
getRelation
().
size
()
>
0
)
{
// if (r != null && RELATION_TYPE_USERS.equals(r.getType())) {
List
<
User
>
listUser
=
router
.
getRelation
().
get
(
0
).
getUsers
();
...
...
@@ -175,7 +176,9 @@ public class RouterUtils {
}
switch
(
execute
)
{
case
UNEXECUTED:
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
if
(
isDrafts
!=
null
)
{
listUser
.
get
(
i
).
setExecute
(
EXECUTING
);
}
// 首次发起申请时,写入 审批人名称 至 obj 中
if
(
isFirse
&&
obj
.
getStr
(
"current_approver"
)
==
null
)
{
obj
.
set
(
"current_approver"
,
listUser
.
get
(
i
).
getName
());
...
...
@@ -183,18 +186,18 @@ public class RouterUtils {
isAuditNext
=
true
;
break
user
;
}
}
}
else
{
throw
new
Exception
(
"发起审批有误"
);
}
// }
}
else
{
throw
new
Exception
(
"审批流程配置有误,请联系管理员"
);
}
}
NextNode
(
router
.
getChildren
(),
obj
,
isFirse
,
isAuditNext
);
break
;
case
COPY:
...
...
@@ -207,13 +210,13 @@ public class RouterUtils {
for
(
int
i
=
0
;
i
<
listRelations
.
size
();
i
++)
{
// 装配 部门人员
if
(
RELATION_TYPE_DEPARTMENT
.
equals
(
listRelations
.
get
(
i
).
getType
())
&&
listRelations
.
get
(
i
).
getDepartmentId
()
!=
null
)
{
String
asd
=
listRelations
.
get
(
i
).
getDepartmentId
();
asd
=
asd
.
replaceAll
(
"\\["
,
""
).
replaceAll
(
"\\]"
,
""
).
replaceAll
(
"\\\""
,
""
);
// List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue().trim()), Integer.valueOf(listRelations.get(i).getDepartmentId().trim()));
List
<
YgglMainEmp
>
listYgglMainEmp
=
selectOtherlistent
(
Integer
.
parseInt
(
obj
.
get
(
"orgCode"
).
toString
()),
Integer
.
valueOf
(
asd
));
if
(
listYgglMainEmp
!=
null
&&
listYgglMainEmp
.
size
()
>
0
)
{
List
<
User
>
listUsers
=
new
ArrayList
<
User
>();
for
(
YgglMainEmp
emp
:
listYgglMainEmp
)
{
...
...
@@ -226,8 +229,8 @@ public class RouterUtils {
}
else
{
listRelations
.
get
(
i
).
setUsers
(
null
);
}
}
else
if
(
RELATION_TYPE_USERS
.
equals
(
listRelations
.
get
(
i
).
getType
()))
{
}
...
...
@@ -257,11 +260,11 @@ public class RouterUtils {
break
;
}
}
if
(
executeFlog
)
{
router
.
setExecute
(
EXECUTED
);
}
}
NextNode
(
router
.
getChildren
(),
obj
,
isFirse
,
isAuditNext
);
break
;
...
...
@@ -272,7 +275,7 @@ public class RouterUtils {
NextNode
(
router
.
getChildren
(),
obj
,
isFirse
,
isAuditNext
);
break
;
}
}
else
{
// 条件节点
rulefor:
...
...
@@ -305,7 +308,7 @@ public class RouterUtils {
}
}
}
routerRule
.
setFlow
(
condition_b
);
routerRule
.
setExecute
(
EXECUTED
);
if
(
routerRule
.
getFlow
())
{
...
...
@@ -319,9 +322,9 @@ public class RouterUtils {
}
break
rulefor
;
}
}
Console
.
log
(
"最后节点"
);
}
}
...
...
@@ -329,24 +332,24 @@ public class RouterUtils {
return
listRouter
;
};
public
static
Integer
selectLeaderEmpNumById
(
Integer
orgCode
,
Integer
id
,
Integer
leave
)
{
YgglMainEmp
mainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
()
.
select
(
YgglMainEmp:
:
getBmgwId
)
.
eq
(
YgglMainEmp:
:
getEmpNum
,
id
)
.
eq
(
YgglMainEmp:
:
getOrgCode
,
orgCode
));
Integer
gWId
=
mainEmp
!=
null
?
mainEmp
.
getBmgwId
()
:
null
;
// 企业所有部门岗位
List
<
ZzglBmgwM
>
listBM
=
ZzglBmgwM
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
ZzglBmgwM
>().
lambda
().
eq
(
ZzglBmgwM:
:
getOrgCode
,
orgCode
));
// 岗位
ZzglBmgwM
gW
=
CollUtil
.
getFirst
(
listBM
.
stream
().
filter
(
bM
->
bM
.
getId
().
equals
(
gWId
)).
collect
(
Collectors
.
toList
()));
// 岗位id
Integer
baseBmgwId
=
gW
!=
null
?
gW
.
getUpId
()
:
null
;
// 指定 主管id
Integer
leaderId
=
null
;
Integer
bmgwLeaderId
;
...
...
@@ -357,16 +360,16 @@ public class RouterUtils {
leaderId
=
bmgwLeaderId
;
}
}
return
leaderId
;
}
public
static
ZzglBmgwM
getLeaderEmp
(
List
<
ZzglBmgwM
>
listBM
,
Integer
baseBmgwId
)
{
ZzglBmgwM
zzglBmgwM
=
baseBmgwId
!=
null
?
ZzglBmgwM
zzglBmgwM
=
baseBmgwId
!=
null
?
CollUtil
.
getFirst
(
listBM
.
stream
().
filter
(
bM
->
bM
.
getId
().
equals
(
baseBmgwId
)).
collect
(
Collectors
.
toList
()))
:
null
;
return
zzglBmgwM
;
}
public
static
List
<
YgglMainEmp
>
selectOtherlistent
(
Integer
orgCode
,
Integer
id
){
ArrayList
<
Integer
>
list
=
new
ArrayList
<
Integer
>();
List
<
ZzglBmgwM
>
zzglBmgwMs
=
ZzglBmgwM
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
ZzglBmgwM
>().
lambda
()
...
...
@@ -387,13 +390,13 @@ public class RouterUtils {
}
}
public
static
void
getIsFlowChildren
(
List
<
Router
>
listRouter
,
List
<
FlowChildren
>
listFlowChildren
)
{
// TODO Auto-generated method stub
Router
router
;
if
(
listRouter
!=
null
&&
listRouter
.
size
()
==
1
)
{
router
=
listRouter
.
get
(
0
);
if
(
router
.
getRelation
()
!=
null
)
{
for
(
Relation
relation
:
router
.
getRelation
())
{
if
(
relation
!=
null
)
{
...
...
@@ -417,7 +420,7 @@ public class RouterUtils {
//未开发
}
}
}
}
}
}
// Relation relation = CollectionUtil.getFirst(router.getRelation());
...
...
@@ -430,10 +433,10 @@ public class RouterUtils {
}
};
// 审批执行记录 持久化
public
static
void
insertogExecuteRecord
(
List
<
FlowChildren
>
listFlowChildren
,
Integer
asId
)
throws
Exception
{
...
...
@@ -443,7 +446,7 @@ public class RouterUtils {
i
++;
continue
;
}
// ClassName 区分参与审批流程人的角色 CREATOR(发起人)、AUDIT(审核人)、COPY(抄送人)
// 各个角色的逻辑不同
switch
(
listFlowChildren
.
get
(
i
).
getClassName
())
{
...
...
@@ -457,7 +460,7 @@ public class RouterUtils {
.
build
();
// 新增 审批执行记录
aer
.
insert
();
// 新增 执行人
User
user
=
listFlowChildren
.
get
(
i
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
);
SpmkExecutor
.
builder
()
...
...
@@ -548,10 +551,10 @@ public class RouterUtils {
aer3
.
insert
();
List
<
Relation
>
listRelation
=
listFlowChildren
.
get
(
i
).
getRelation
();
for
(
Relation
relation
:
listRelation
)
{
List
<
User
>
listUser2
=
relation
.
getUsers
();
// 新增 执行人
for
(
User
user2
:
listUser2
)
{
SpmkExecutor
executor
=
SpmkExecutor
.
builder
()
...
...
@@ -568,7 +571,7 @@ public class RouterUtils {
}
}
}
/**
* 审批持久化
* @param listFlowChildren 节点
...
...
@@ -748,7 +751,7 @@ public class RouterUtils {
}
}
// 无下一个审批人 则更新 节点状态 为 EXECUTED(已执行)
if
(!
hasNextApprover
&&
es
<=
1
)
{
SpmkApproveExecuteRecord
aer
=
SpmkApproveExecuteRecord
...
...
@@ -780,7 +783,7 @@ public class RouterUtils {
.
build
();
// 新增 审批执行记录
aer
.
insert
();
// 新增 执行人
User
user
=
listFlowChildren
.
get
(
i
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
);
SpmkExecutor
.
builder
()
...
...
@@ -791,7 +794,7 @@ public class RouterUtils {
.
sts
(
ExecutorSts
.
AGREE
.
ordinal
())
.
build
()
.
insert
();
listFlowChildren
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
case
AUDIT:
//审批中
...
...
@@ -875,7 +878,7 @@ public class RouterUtils {
aer3
.
insert
();
List
<
Relation
>
listRelation
=
listFlowChildren
.
get
(
i
).
getRelation
();
for
(
Relation
relation
:
listRelation
)
{
List
<
User
>
listUser2
=
relation
.
getUsers
();
if
(
listUser2
!=
null
)
{
...
...
@@ -892,7 +895,7 @@ public class RouterUtils {
}
}
}
listFlowChildren
.
get
(
i
).
setExecute
(
EXECUTED
);
break
;
}
...
...
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