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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
268 additions
and
78 deletions
+268
-78
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+256
-78
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
+4
-0
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,108 +1290,275 @@ public class SpmkController {
...
@@ -1287,108 +1290,275 @@ 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
(
spmkApproveDetailDto
.
getIndex
()
!=
null
&&
spmkApproveDetailDto
.
getUserIndex
()
!=
null
)
{
if
(
currentChildren
.
getClassName
().
equals
(
"audit"
))
{
//如果只有一个人
//如果只有一个人
if
(
u
serList
.
size
()
==
1
)
{
if
(
currentU
serList
.
size
()
==
1
)
{
onlyOne
=
true
;
onlyOne
=
true
;
isNext
=
true
;
}
}
if
(
currentChildren
.
getExecute
().
equals
(
"1"
))
{
//大节点在执行中
if
(
currentFlowChildren
.
getExecute
().
equals
(
"1"
))
{
//小节点也在执行中
isExecute
=
true
;
isExecute
=
true
;
if
(
userList
.
get
(
spmkApproveDetailDto
.
getUserIndex
()).
getExecute
().
equals
(
"1"
))
{
if
(
currentUser
.
getExecute
().
equals
(
"1"
))
{
//如果是最后一个
if
(
isAbreas
)
{
if
(
userList
.
size
()
-
1
==
spmkApproveDetailDto
.
getUserIndex
())
{
if
(
currentUserList
.
stream
().
filter
(
u
->
u
.
getId
()
!=
currentUser
.
getId
()
&&
u
.
getExecute
().
equals
(
"1"
)).
collect
(
Collectors
.
toList
()).
size
()
==
0
)
{
isNext
=
true
;
}
}
else
{
if
(
currentUserList
.
size
()
-
1
==
spmkApproveDetailDto
.
getUserIndex
())
{
isNext
=
true
;
isNext
=
true
;
}
}
}
}
else
{
}
else
{
isExecute
=
false
;
isExecute
=
false
;
}
}
}
}
//如果属于最后一个大节点
//是否最终审批人
if
(
listFlowChildren
.
size
()
-
1
==
spmkApproveDetailDto
.
getIndex
())
{
if
(
spmkApproveDetailDto
.
getIndex
()
==
listFlowChildren
.
size
()
-
1
)
{
if
(
isNext
)
{
if
(
isNext
||
onlyOne
)
{
isFinal
=
true
;
isFinal
=
true
;
}
else
{
isFinal
=
false
;
}
}
}
else
if
(!
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getClassName
().
equals
(
"audit
"
))
{
}
else
if
(
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getClassName
().
equals
(
"copy
"
))
{
isFinal
=
true
;
isFinal
=
true
;
}
}
//如果是并序
//执行中的人会存在操作记录
if
(
"1"
.
equals
(
currentChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
()))
{
isAbreas
=
true
;
}
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
spmkApproveExecuteRecordMapper
.
selectExecuteRecordById
(
Integer
.
parseInt
(
currentUser
.
getId
()),
spmkApproveDetailSummary
.
getApproveSummaryId
());
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
spmkApproveExecuteRecordMapper
.
selectExecuteRecordById
(
Integer
.
parseInt
(
currentUser
.
getId
()),
spmkApproveDetailSummary
.
getApproveSummaryId
());
//删除审批过的
人记录
//删除操作
人记录
if
(
spmkApproveExecuteRecord
!=
null
)
{
if
(
spmkApproveExecuteRecord
!=
null
)
{
if
(
onlyOne
||
isAbreas
)
{
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
()));
spmkApproveExecuteRecordMapper
.
delExecuteRecordByRecordIds
(
spmkApproveExecuteRecord
.
getId
(),
Integer
.
parseInt
(
currentUser
.
getId
()));
}
}
else
{
}
else
{
SpmkExecutor
spmkExecutor
=
SpmkExecutor
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
SpmkExecutor
>()
List
<
SpmkExecutor
>
spmkExecutorsList
=
SpmkExecutor
.
builder
().
build
().
selectList
(
new
LambdaQueryWrapper
<
SpmkExecutor
>()
.
eq
(
SpmkExecutor:
:
getEmpNum
,
Integer
.
parseInt
(
currentUser
.
getId
())).
eq
(
SpmkExecutor:
:
getApproveExecuteRecordId
,
spmkApproveExecuteRecord
.
getId
()));
.
eq
(
SpmkExecutor:
:
getApproveExecuteRecordId
,
spmkApproveExecuteRecord
.
getId
()));
if
(
isAbreas
)
{
//正常的并序是一条对应一个id,转派的是同一个id
if
(
spmkExecutorsList
.
size
()
==
1
)
{
spmkApproveExecuteRecordMapper
.
delExecuteRecordByRecordIds
(
spmkApproveExecuteRecord
.
getId
(),
Integer
.
parseInt
(
currentUser
.
getId
()));
}
}
spmkExecutor
.
deleteById
();
spmkExecutor
.
deleteById
();
}
}
}
}
//当前被移除的人在执行中
if
(
isExecute
&&
!
isFinal
)
{
if
(
isExecute
)
{
if
(!
isAbreas
)
{
//如果不是最终的就还存在下一个审批节点
if
(!
isFinal
)
{
if
(
isNext
)
{
if
(
isNext
)
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
FlowChildren
nextFlowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
setExecute
(
"1"
);
//如果下一个节点是并序的
//并序
if
(
nextFlowChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
().
equals
(
"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
)
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
setExecute
(
"1"
);
spmkApproveExecuteRecord
=
SpmkApproveExecuteRecord
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
v
.
setExecute
(
"1"
);
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
()
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord
.
getId
())
.
approveExecuteRecordId
(
spmkApproveExecuteRecord1
.
getId
())
.
empNum
(
Integer
.
parseInt
(
u
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
v
.
getId
()))
.
operatorHeaderUrl
(
u
.
getHeadUrl
())
.
operatorHeaderUrl
(
v
.
getHeadUrl
())
.
executorName
(
u
.
getName
())
.
executorName
(
v
.
getName
())
.
sts
(
1
)
.
sts
(
1
)
.
build
().
insert
();
.
build
().
insert
();
SpmkApproveSummary
.
builder
().
currentApprover
(
u
.
getName
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
buffer
.
append
(
v
.
getName
()
+
","
);
});
buffer
.
deleteCharAt
(
buffer
.
lastIndexOf
(
","
));
}
else
{
}
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
).
setExecute
(
"1"
);
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
setExecute
(
"1"
);
v
.
setExecute
(
"1"
);
User
u
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()
+
1
).
getRelation
().
get
(
0
).
getUsers
().
get
(
0
);
SpmkApproveExecuteRecord
spmkApproveExecuteRecord1
=
SpmkApproveExecuteRecord
SpmkApproveExecuteRecord
spmkApproveExecuteRecord1
=
SpmkApproveExecuteRecord
.
builder
()
.
builder
()
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
.
approveSummaryId
(
spmkApproveDetailSummary
.
getApproveSummaryId
())
...
@@ -1399,44 +1569,52 @@ public class SpmkController {
...
@@ -1399,44 +1569,52 @@ public class SpmkController {
spmkApproveExecuteRecord1
.
insert
();
spmkApproveExecuteRecord1
.
insert
();
SpmkExecutor
.
builder
()
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
spmkApproveExecuteRecord1
.
getId
())
.
approveExecuteRecordId
(
spmkApproveExecuteRecord1
.
getId
())
.
empNum
(
Integer
.
parseInt
(
v
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
u
.
getId
()))
.
operatorHeaderUrl
(
v
.
getHeadUrl
())
.
operatorHeaderUrl
(
u
.
getHeadUrl
())
.
executorName
(
v
.
getName
())
.
executorName
(
u
.
getName
())
.
sts
(
1
)
.
sts
(
1
)
.
build
().
insert
();
.
build
().
insert
();
});
buffer
.
append
(
u
.
getName
());
SpmkApproveSummary
.
builder
().
currentApprover
(
nextFlowChildren
.
getRelation
().
get
(
0
).
getUsers
().
get
(
0
).
getName
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
}
}
}
}
else
{
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
());
}
}
}
}
if
(
isFinal
)
{
SpmkApproveSummary
.
builder
().
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
currentApprover
(
CommonEnum
.
NULL_STR
.
getDesc
()).
endTime
(
new
Date
()).
sts
(
ApproveSummarySts
.
FINISH
.
ordinal
()).
build
().
updateById
();
}
}
SpmkApproveSummary
.
builder
().
currentApprover
(
buffer
.
toString
()).
id
(
spmkApproveDetailSummary
.
getApproveSummaryId
()).
build
().
updateById
();
if
(
onlyOne
)
{
listFlowChildren
.
removeIf
(
f
->
f
==
currentChildren
);
}
else
{
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
()).
getRelation
().
get
(
0
).
getUsers
().
removeIf
(
user
->
user
==
currentUser
);
}
}
//只有一条数据或者已经到下一个大节点
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
...
@@ -140,5 +140,9 @@
...
@@ -140,5 +140,9 @@
</select>
</select>
-->
-->
<select
id=
"executor"
resultMap=
"BaseResultMap"
>
select
</select>
</mapper>
</mapper>
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