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
002af6b3
Commit
002af6b3
authored
Nov 15, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除审批人
parent
2acffa17
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
300 additions
and
111 deletions
+300
-111
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+285
-107
src/main/java/cn/timer/api/dao/spmk/SpmkApproveExecuteRecordMapper.java
+2
-0
src/main/resources/mapping/spmk/SpmkApproveExecuteRecordMapper.xml
+6
-0
src/main/resources/mapping/spmk/SpmkExecutorMapper.xml
+7
-4
No files found.
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
002af6b3
...
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.SerializationUtils
;
import
com.baomidou.mybatisplus.core.toolkit.SerializationUtils
;
import
com.beust.jcommander.internal.Lists
;
import
com.beust.jcommander.internal.Lists
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONArray
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -1274,7 +1275,9 @@ public class SpmkController {
...
@@ -1274,7 +1275,9 @@ public class SpmkController {
SpmkApproveSummary
.
builder
().
sts
(
0
).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
SpmkApproveSummary
.
builder
().
sts
(
0
).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
}
}
// 更新 flowChildren
// 更新 flowChildren
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
())
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
())
.
flowChildren
(
JSONArray
.
fromObject
(
listFlowChildren
).
toString
()).
build
().
updateById
();
.
flowChildren
(
JSONArray
.
fromObject
(
listFlowChildren
).
toString
()).
build
().
updateById
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -1287,156 +1290,331 @@ public class SpmkController {
...
@@ -1287,156 +1290,331 @@ public class SpmkController {
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
}
}
//移除审批人
//移除审批人 1.0
// @Transactional(rollbackFor = Exception.class)
// @PostMapping(value = "/delteApprove")
// @ApiOperation(value = "移除审批人", httpMethod = "POST", notes = "")
// public Result<Object> delteApprove(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
//// try {
//
// SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
// List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
// //是否执行到下一个节点
// boolean onlyOne = false;//是否只有一条
// boolean isExecute = false;//是否执行中
// boolean isAbreas = false;//是否并序
// boolean isFinal = false;//是否最终审批人
// boolean isNext = false;//是否轮到下一个节点
// User u;
// //当前节点
// FlowChildren currentChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
// List<User> userList = currentChildren.getRelation().get(0).getUsers();
// User currentUser = userList.get(spmkApproveDetailDto.getUserIndex());
// //只有添加审批人才会有值
// if (spmkApproveDetailDto.getIndex() != null && spmkApproveDetailDto.getUserIndex() != null) {
// if (currentChildren.getClassName().equals("audit")) {
// //如果是并序
// if ("1".equals(currentChildren.getRelation().get(0).getApprovalOrder())) {
// isAbreas = true;
// }
// //如果只有一个人
// if (userList.size() == 1) {
// onlyOne = true;
// isNext=true;
// }
// if (currentChildren.getExecute().equals("1")) {
// isExecute = true;
// if (userList.get(spmkApproveDetailDto.getUserIndex()).getExecute().equals("1")) {
// //如果是最后一个
// if (userList.size() - 1 == spmkApproveDetailDto.getUserIndex() && !isAbreas) {
// isNext = true;
// }
// //出了自己其他人都审批过了
// if (isAbreas) {
// int num = currentChildren.getRelation().get(0).getUsers().stream().filter(v -> v.getExecute().equals("1") && v.getId() != currentUser.getId()).collect(Collectors.toList()).size();
// if (num == 0) {
// isNext = true;
// }
// }
// } else {
// isExecute = false;
// }
// }
// //是否最终审批人
// if (spmkApproveDetailDto.getIndex() == listFlowChildren.size() - 1) {
// if (isNext || onlyOne) {
// isFinal = true;
// }
// } else if (!listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getClassName().equals("audit")) {
// isFinal = true;
// }
//
// SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(currentUser.getId()), spmkApproveDetailSummary.getApproveSummaryId());
// //删除审批过的人记录
// if (spmkApproveExecuteRecord != null) {
// if (onlyOne) {
// spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
// } else {
// List<SpmkExecutor> spmkExecutorsList=SpmkExecutor.builder().build().selectList(new LambdaQueryWrapper<SpmkExecutor>()
// .eq(SpmkExecutor::getApproveExecuteRecordId,spmkApproveExecuteRecord.getId()));
// if(spmkExecutorsList.size()>0&&spmkExecutorsList.size()==1){
// spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
// }else{
// spmkExecutorsList.stream().filter(v->v.getEmpNum()==Integer.parseInt(currentUser.getId())).collect(Collectors.toList()).get(0).deleteById();
// }
// }
// }
// if (isExecute && !isFinal) {
// if (!isAbreas) {
// if (isNext) {
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0).setExecute("1");
// //并序
// u = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0);
// } else {
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1).setExecute("1");
// u = listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1);
// }
//
// if (onlyOne || isNext) {
// spmkApproveExecuteRecord = SpmkApproveExecuteRecord
// .builder()
// .approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
// .name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
// .type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
// .sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
// .build();
// spmkApproveExecuteRecord.insert();
// }
// SpmkExecutor.builder()
// .approveExecuteRecordId(spmkApproveExecuteRecord.getId())
// .empNum(Integer.parseInt(u.getId()))
// .operatorHeaderUrl(u.getHeadUrl())
// .executorName(u.getName())
// .sts(1)
// .build().insert();
// SpmkApproveSummary.builder().currentApprover(u.getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
// } else {
// //并序
// if (isNext) {
// FlowChildren nextFlowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1);
// if (nextFlowChildren.getRelation().get(0).getApprovalOrder().equals("1")) {
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().forEach(v -> {
// v.setExecute("1");
// SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
// .builder()
// .approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
// .name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
// .type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
// .sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
// .build();
// spmkApproveExecuteRecord1.insert();
// SpmkExecutor.builder()
// .approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
// .empNum(Integer.parseInt(v.getId()))
// .operatorHeaderUrl(v.getHeadUrl())
// .executorName(v.getName())
// .sts(1)
// .build().insert();
// });
// SpmkApproveSummary.builder().currentApprover(nextFlowChildren.getRelation().get(0).getUsers().get(0).getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
// }
// }
// }
// }
//
//
// if (isExecute && isFinal) {
// SpmkApproveSummary.builder().id(spmkApproveDetailSummary.getApproveSummaryId()).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
// }
//
// if (onlyOne) {
// listFlowChildren.removeIf(f -> f == currentChildren);
// } else {
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().removeIf(user -> user == currentUser);
// }
// }
// }
// // 更新 flowChildren
// SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId())
// .flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
//// } catch (Exception e) {
//// return ResultUtil.error(e);
//// }
//
// SpmkApproveDetailSummary detailSummary = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
// .lambda().eq(SpmkApproveDetailSummary::getId, spmkApproveDetailDto.getId()));
//
// return ResultUtil.data(JSON.toJSONString(detailSummary));
// }
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@PostMapping
(
value
=
"/delteApprove"
)
@PostMapping
(
value
=
"/delteApprove"
)
@ApiOperation
(
value
=
"移除审批人"
,
httpMethod
=
"POST"
,
notes
=
""
)
@ApiOperation
(
value
=
"移除审批人"
,
httpMethod
=
"POST"
,
notes
=
""
)
public
Result
<
Object
>
delteApprove
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
SpmkApproveDetailDto
spmkApproveDetailDto
)
{
public
Result
<
Object
>
delteApprove
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
SpmkApproveDetailDto
spmkApproveDetailDto
)
{
// try {
SpmkApproveDetailSummary
spmkApproveDetailSummary
=
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
()).
build
().
selectById
();
SpmkApproveDetailSummary
spmkApproveDetailSummary
=
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
()).
build
().
selectById
();
List
<
FlowChildren
>
listFlowChildren
=
spmkApproveDetailDto
.
getFlowChildren
();
List
<
FlowChildren
>
listFlowChildren
=
spmkApproveDetailDto
.
getFlowChildren
();
FlowChildren
currentFlowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
());
List
<
User
>
currentUserList
=
currentFlowChildren
.
getRelation
().
get
(
0
).
getUsers
();
User
currentUser
=
currentUserList
.
get
(
spmkApproveDetailDto
.
getUserIndex
());
//是否执行到下一个节点
//是否执行到下一个节点
boolean
onlyOne
=
false
;
boolean
onlyOne
=
false
;
//是否只有一条
boolean
isExecute
=
false
;
//是否执行中
boolean
isExecute
=
false
;
//是否执行中
boolean
isAbreas
=
false
;
//是否并序
boolean
isAbreas
=
false
;
//是否并序
boolean
isFinal
=
false
;
//是否最终审批人
boolean
isFinal
=
false
;
//是否最终审批人
boolean
isNext
=
false
;
boolean
isNext
=
false
;
//是否轮到下一个节点
User
u
;
StringBuffer
buffer
=
new
StringBuffer
();
//新当前审批人的名字
//当前节点
if
(
"1"
.
equals
(
currentFlowChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
()))
{
FlowChildren
currentChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
());
isAbreas
=
true
;
List
<
User
>
userList
=
currentChildren
.
getRelation
().
get
(
0
).
getUsers
();
}
User
currentUser
=
userList
.
get
(
spmkApproveDetailDto
.
getUserIndex
());
//如果只有一个人
//只有添加审批人才会有值
if
(
currentUserList
.
size
()
==
1
)
{
if
(
spmkApproveDetailDto
.
getIndex
()
!=
null
&&
spmkApproveDetailDto
.
getUserIndex
()
!=
null
)
{
onlyOne
=
true
;
if
(
currentChildren
.
getClassName
().
equals
(
"audit"
))
{
isNext
=
true
;
//如果只有一个人
}
if
(
userList
.
size
()
==
1
)
{
//大节点在执行中
onlyOne
=
true
;
if
(
currentFlowChildren
.
getExecute
().
equals
(
"1"
))
{
}
//小节点也在执行中
if
(
currentChildren
.
getExecute
().
equals
(
"1"
))
{
isExecute
=
true
;
isExecute
=
true
;
if
(
currentUser
.
getExecute
().
equals
(
"1"
))
{
if
(
userList
.
get
(
spmkApproveDetailDto
.
getUserIndex
()).
getExecute
().
equals
(
"1"
))
{
if
(
isAbreas
)
{
//如果是最后一个
if
(
currentUserList
.
stream
().
filter
(
u
->
u
.
getId
()
!=
currentUser
.
getId
()
&&
u
.
getExecute
().
equals
(
"1"
)).
collect
(
Collectors
.
toList
()).
size
()
==
0
)
{
if
(
userList
.
size
()
-
1
==
spmkApproveDetailDto
.
getUserIndex
())
{
isNext
=
true
;
isNext
=
true
;
}
}
else
{
isExecute
=
false
;
}
}
}
}
else
{
if
(
currentUserList
.
size
()
-
1
==
spmkApproveDetailDto
.
getUserIndex
())
{
//是否最终审批人
isNext
=
true
;
if
(
spmkApproveDetailDto
.
getIndex
()
==
listFlowChildren
.
size
()
-
1
)
{
if
(
isNext
||
onlyOne
)
{
isFinal
=
true
;
}
}
}
else
if
(!
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getClassName
().
equals
(
"audit"
))
{
isFinal
=
true
;
}
}
//如果是并序
}
else
{
if
(
"1"
.
equals
(
currentChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
()))
{
isExecute
=
false
;
isAbreas
=
true
;
}
}
//如果属于最后一个大节点
if
(
listFlowChildren
.
size
()
-
1
==
spmkApproveDetailDto
.
getIndex
())
{
if
(
isNext
)
{
isFinal
=
true
;
}
else
{
isFinal
=
false
;
}
}
else
if
(
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getClassName
().
equals
(
"copy"
))
{
isFinal
=
true
;
}
//执行中的人会存在操作记录
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
spmkApproveExecuteRecordMapper
.
selectExecuteRecordById
(
Integer
.
parseInt
(
currentUser
.
getId
()),
spmkApproveDetailSummary
.
getApproveSummaryId
());
//删除操作人记录
if
(
spmkApproveExecuteRecord
!=
null
)
{
SpmkExecutor
spmkExecutor
=
SpmkExecutor
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
SpmkExecutor
>()
.
eq
(
SpmkExecutor:
:
getApproveExecuteRecordId
,
spmkApproveExecuteRecord
.
getId
()).
eq
(
SpmkExecutor:
:
getEmpNum
,
currentUser
.
getId
()));
if
(
onlyOne
)
{
if
(
spmkExecutor
.
getSts
()!=
4
)
{
spmkApproveExecuteRecordMapper
.
delExecuteRecordByRecordIds
(
spmkApproveExecuteRecord
.
getId
(),
Integer
.
parseInt
(
currentUser
.
getId
()));
}
}
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
spmkApproveExecuteRecordMapper
.
selectExecuteRecordById
(
Integer
.
parseInt
(
currentUser
.
getId
()),
spmkApproveDetailSummary
.
getApproveSummaryId
());
}
else
{
//删除审批过的人记录
List
<
SpmkExecutor
>
spmkExecutorsList
=
SpmkExecutor
.
builder
().
build
().
selectList
(
new
LambdaQueryWrapper
<
SpmkExecutor
>()
if
(
spmkApproveExecuteRecord
!=
null
)
{
.
eq
(
SpmkExecutor:
:
getApproveExecuteRecordId
,
spmkApproveExecuteRecord
.
getId
()));
if
(
onlyOne
||
isAbreas
)
{
if
(
isAbreas
)
{
//正常的并序是一条对应一个id,转派的是同一个id
if
(
spmkExecutorsList
.
size
()
==
1
)
{
spmkApproveExecuteRecordMapper
.
delExecuteRecordByRecordIds
(
spmkApproveExecuteRecord
.
getId
(),
Integer
.
parseInt
(
currentUser
.
getId
()));
spmkApproveExecuteRecordMapper
.
delExecuteRecordByRecordIds
(
spmkApproveExecuteRecord
.
getId
(),
Integer
.
parseInt
(
currentUser
.
getId
()));
}
else
{
SpmkExecutor
spmkExecutor
=
SpmkExecutor
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
SpmkExecutor
>()
.
eq
(
SpmkExecutor:
:
getEmpNum
,
Integer
.
parseInt
(
currentUser
.
getId
())).
eq
(
SpmkExecutor:
:
getApproveExecuteRecordId
,
spmkApproveExecuteRecord
.
getId
()));
spmkExecutor
.
deleteById
();
}
}
}
}
spmkExecutor
.
deleteById
();
if
(
isExecute
&&
!
isFinal
)
{
}
if
(!
isAbreas
)
{
}
if
(
isNext
)
{
//当前被移除的人在执行中
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
if
(
isExecute
)
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
setExecute
(
"1"
);
//如果不是最终的就还存在下一个审批节点
//并序
if
(!
isFinal
)
{
u
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
);
if
(
isNext
)
{
}
else
{
FlowChildren
nextFlowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
setExecute
(
"1"
);
//如果下一个节点是并序的
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
()
+
1
).
setExecute
(
"1"
);
if
(
nextFlowChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
().
equals
(
"1"
))
{
u
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
()
+
1
);
}
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
if
(
onlyOne
||
isNext
)
{
v
.
setExecute
(
"1"
);
spmkApproveExecuteRecord
=
SpmkApproveExecuteRecord
SpmkApproveExecuteRecord
spmkApproveExecuteRecord1
=
SpmkApproveExecuteRecord
.
builder
()
.
builder
()
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
.
name
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
getName
())
.
name
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
getName
())
.
type
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
ordinal
())
.
type
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
ordinal
())
.
sts
(
SpmkEnumInterface
.
ExecuteRecordSts
.
IN_EXECUTION
.
ordinal
())
.
sts
(
SpmkEnumInterface
.
ExecuteRecordSts
.
IN_EXECUTION
.
ordinal
())
.
build
();
.
build
();
spmkApproveExecuteRecord
.
insert
();
spmkApproveExecuteRecord1
.
insert
();
}
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord1
.
getId
())
.
empNum
(
Integer
.
parseInt
(
v
.
getId
()))
.
operatorHeaderUrl
(
v
.
getHeadUrl
())
.
executorName
(
v
.
getName
())
.
sts
(
1
)
.
build
().
insert
();
buffer
.
append
(
v
.
getName
()
+
","
);
});
buffer
.
deleteCharAt
(
buffer
.
lastIndexOf
(
","
));
}
else
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
setExecute
(
"1"
);
User
u
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
);
SpmkApproveExecuteRecord
spmkApproveExecuteRecord1
=
SpmkApproveExecuteRecord
.
builder
()
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
.
name
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
getName
())
.
type
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
ordinal
())
.
sts
(
SpmkEnumInterface
.
ExecuteRecordSts
.
IN_EXECUTION
.
ordinal
())
.
build
();
spmkApproveExecuteRecord1
.
insert
();
SpmkExecutor
.
builder
()
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord
.
getId
())
.
approveExecuteRecordId
(
spmkApproveExecuteRecord
1
.
getId
())
.
empNum
(
Integer
.
parseInt
(
u
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
u
.
getId
()))
.
operatorHeaderUrl
(
u
.
getHeadUrl
())
.
operatorHeaderUrl
(
u
.
getHeadUrl
())
.
executorName
(
u
.
getName
())
.
executorName
(
u
.
getName
())
.
sts
(
1
)
.
sts
(
1
)
.
build
().
insert
();
.
build
().
insert
();
SpmkApproveSummary
.
builder
().
currentApprover
(
u
.
getName
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
buffer
.
append
(
u
.
getName
());
}
else
{
//并序
if
(
isNext
)
{
FlowChildren
nextFlowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
);
if
(
nextFlowChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
().
equals
(
"1"
))
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
v
.
setExecute
(
"1"
);
SpmkApproveExecuteRecord
spmkApproveExecuteRecord1
=
SpmkApproveExecuteRecord
.
builder
()
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
.
name
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
getName
())
.
type
(
SpmkEnumInterface
.
ParticipatorType
.
APPROVER
.
ordinal
())
.
sts
(
SpmkEnumInterface
.
ExecuteRecordSts
.
IN_EXECUTION
.
ordinal
())
.
build
();
spmkApproveExecuteRecord1
.
insert
();
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord1
.
getId
())
.
empNum
(
Integer
.
parseInt
(
v
.
getId
()))
.
operatorHeaderUrl
(
v
.
getHeadUrl
())
.
executorName
(
v
.
getName
())
.
sts
(
1
)
.
build
().
insert
();
});
SpmkApproveSummary
.
builder
().
currentApprover
(
nextFlowChildren
.
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
getName
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
}
}
}
}
}
if
(
isFinal
)
{
SpmkApproveSummary
.
builder
().
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
currentApprover
(
CommonEnum
.
NULL_STR
.
getDesc
()).
endTime
(
new
Date
()).
sts
(
ApproveSummarySts
.
FINISH
.
ordinal
()).
build
().
updateById
();
}
if
(
onlyOne
)
{
listFlowChildren
.
removeIf
(
f
->
f
==
currentChildren
);
}
else
{
}
else
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
removeIf
(
user
->
user
==
currentUser
);
if
(!
isAbreas
)
{
//顺序有一个同一个user里面的
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
()
+
1
).
setExecute
(
"1"
);
User
u
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
()
+
1
);
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord
.
getId
())
.
empNum
(
Integer
.
parseInt
(
u
.
getId
()))
.
operatorHeaderUrl
(
u
.
getHeadUrl
())
.
executorName
(
u
.
getName
())
.
sts
(
1
)
.
build
().
insert
();
buffer
.
append
(
u
.
getName
());
}
}
}
}
}
SpmkApproveSummary
.
builder
().
currentApprover
(
buffer
.
toString
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
}
//只有一条数据或者已经到下一个大节点
if
(
onlyOne
&&
isNext
)
{
listFlowChildren
.
removeIf
(
f
->
f
==
currentFlowChildren
);
}
else
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
removeIf
(
u
->
u
==
currentUser
);
}
//如果是最终执行人
if
(
isFinal
&&
isNext
&&
isExecute
)
{
SpmkApproveSummary
.
builder
().
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
currentApprover
(
CommonEnum
.
NULL_STR
.
getDesc
()).
endTime
(
new
Date
()).
sts
(
ApproveSummarySts
.
FINISH
.
ordinal
()).
build
().
updateById
();
}
}
// 更新 flowChildren
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
())
SpmkApproveDetailSummary
.
builder
().
id
(
spmkApproveDetailDto
.
getId
())
.
flowChildren
(
JSONArray
.
fromObject
(
listFlowChildren
).
toString
()).
build
().
updateById
();
.
flowChildren
(
JSONArray
.
fromObject
(
listFlowChildren
).
toString
()).
build
().
updateById
();
// } catch (Exception e) {
// return ResultUtil.error(e);
// }
SpmkApproveDetailSummary
detailSummary
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
SpmkApproveDetailSummary
detailSummary
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
.
lambda
().
eq
(
SpmkApproveDetailSummary:
:
getId
,
spmkApproveDetailDto
.
getId
()));
.
lambda
().
eq
(
SpmkApproveDetailSummary:
:
getId
,
spmkApproveDetailDto
.
getId
()));
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
}
}
@PostMapping
(
value
=
"/save_drafts"
)
@PostMapping
(
value
=
"/save_drafts"
)
@ApiOperation
(
value
=
"存入草稿箱"
,
httpMethod
=
"POST"
,
notes
=
"存入草稿箱"
)
@ApiOperation
(
value
=
"存入草稿箱"
,
httpMethod
=
"POST"
,
notes
=
"存入草稿箱"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
src/main/java/cn/timer/api/dao/spmk/SpmkApproveExecuteRecordMapper.java
View file @
002af6b3
...
@@ -22,4 +22,6 @@ public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveEx
...
@@ -22,4 +22,6 @@ public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveEx
int
delExecuteRecord
(
@Param
(
"recordId"
)
Integer
recordId
,
@Param
(
"approveSummaryId"
)
Integer
approveSummaryId
);
int
delExecuteRecord
(
@Param
(
"recordId"
)
Integer
recordId
,
@Param
(
"approveSummaryId"
)
Integer
approveSummaryId
);
SpmkApproveExecuteRecord
selectExecuteRecordById
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"approveSummaryId"
)
Integer
approveSummaryId
);
SpmkApproveExecuteRecord
selectExecuteRecordById
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"approveSummaryId"
)
Integer
approveSummaryId
);
int
delExecuteRecordByRecordIds
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"uid"
)
Integer
uid
);
int
delExecuteRecordByRecordIds
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"uid"
)
Integer
uid
);
SpmkApproveExecuteRecord
selectExecuteRecordReoId
(
@Param
(
"reoId"
)
Integer
reoId
,
@Param
(
"approveSummaryId"
)
Integer
approveSummaryId
);
}
}
src/main/resources/mapping/spmk/SpmkApproveExecuteRecordMapper.xml
View file @
002af6b3
...
@@ -172,6 +172,12 @@
...
@@ -172,6 +172,12 @@
WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId}
WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId}
</select>
</select>
<select
id=
"selectExecuteRecordReoId"
resultType=
"cn.timer.api.bean.spmk.SpmkApproveExecuteRecord"
>
SELECT sr.id FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se ON se.approve_execute_record_id=sr.id
WHERE sr.approve_summary_id = #{approveSummaryId} and se.uid = #{reoId}
</select>
<delete
id=
"delExecuteRecord"
>
<delete
id=
"delExecuteRecord"
>
DELETE sr,se FROM spmk_approve_execute_record sr
DELETE sr,se FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
...
...
src/main/resources/mapping/spmk/SpmkExecutorMapper.xml
View file @
002af6b3
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
update_time,
update_time,
signature_img,
signature_img,
</sql>
</sql>
<sql
id=
"Base_Column_List_Alias"
>
<sql
id=
"Base_Column_List_Alias"
>
id SpmkExecutor_id,
id SpmkExecutor_id,
approve_execute_record_id SpmkExecutor_approve_execute_record_id,
approve_execute_record_id SpmkExecutor_approve_execute_record_id,
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
update_time SpmkExecutor_update_time
update_time SpmkExecutor_update_time
</sql>
</sql>
<!--
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkExecutor">
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkExecutor">
INSERT INTO spmk_executor
INSERT INTO spmk_executor
...
@@ -140,5 +140,9 @@
...
@@ -140,5 +140,9 @@
</select>
</select>
-->
-->
<select
id=
"executor"
resultMap=
"BaseResultMap"
>
select
</select>
</mapper>
</mapper>
\ No newline at end of file
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