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
766c3941
Commit
766c3941
authored
Nov 11, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
华颐————
删除审批人 删除抄送人
parent
8cf2afa1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
165 additions
and
3 deletions
+165
-3
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+156
-2
src/main/java/cn/timer/api/dao/spmk/SpmkApproveExecuteRecordMapper.java
+2
-0
src/main/java/cn/timer/api/utils/router/RouterUtils.java
+1
-1
src/main/resources/mapping/spmk/SpmkApproveExecuteRecordMapper.xml
+6
-0
No files found.
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
766c3941
...
@@ -3,8 +3,10 @@ package cn.timer.api.controller.spmk;
...
@@ -3,8 +3,10 @@ package cn.timer.api.controller.spmk;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
cn.timer.api.bean.crm.CrmClientContacts
;
import
cn.timer.api.bean.crm.CrmClientContacts
;
import
cn.timer.api.bean.sche.ScheduleTask
;
import
cn.timer.api.bean.spmk.*
;
import
cn.timer.api.bean.spmk.*
;
import
cn.timer.api.bean.zzgl.ZzglAuth
;
import
cn.timer.api.bean.zzgl.ZzglAuth
;
import
cn.timer.api.dao.spmk.*
;
import
cn.timer.api.dao.spmk.*
;
...
@@ -12,7 +14,9 @@ import cn.timer.api.dto.spmk.*;
...
@@ -12,7 +14,9 @@ import cn.timer.api.dto.spmk.*;
import
cn.timer.api.utils.redis.RedisUtil
;
import
cn.timer.api.utils.redis.RedisUtil
;
import
cn.timer.api.utils.router.RequestDataUtils
;
import
cn.timer.api.utils.router.RequestDataUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
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
net.sf.json.JSONArray
;
import
net.sf.json.JSONArray
;
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
;
...
@@ -1220,12 +1224,12 @@ public class SpmkController {
...
@@ -1220,12 +1224,12 @@ public class SpmkController {
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
();
//只有添加审批人才会有值
//只有添加审批人才会有值
if
(
spmkApproveDetailDto
.
getIndex
()
!=
null
&&
spmkApproveDetailDto
.
getIndex
()
!=
null
)
{
if
(
spmkApproveDetailDto
.
getIndex
()
!=
null
&&
spmkApproveDetailDto
.
get
User
Index
()
!=
null
)
{
//如果当前索引下的都要变更为0未执行
//如果当前索引下的都要变更为0未执行
int
currentIndex
=
spmkApproveDetailDto
.
getIndex
();
int
currentIndex
=
spmkApproveDetailDto
.
getIndex
();
for
(
int
i
=
currentIndex
+
1
;
i
<
listFlowChildren
.
size
();
i
++)
{
for
(
int
i
=
currentIndex
+
1
;
i
<
listFlowChildren
.
size
();
i
++)
{
if
(
i
==
currentIndex
+
1
)
{
if
(
i
==
currentIndex
+
1
)
{
if
(!
listFlowChildren
.
get
(
currentIndex
).
getExecute
().
equals
(
"1"
)
&&
!
listFlowChildren
.
get
(
currentIndex
).
getExecute
().
equals
(
"0"
))
{
if
(!
listFlowChildren
.
get
(
currentIndex
).
getExecute
().
equals
(
"1"
)
&&
!
listFlowChildren
.
get
(
currentIndex
).
getExecute
().
equals
(
"0"
))
{
//如果当前索引下的都要变更为0未执行
//如果当前索引下的都要变更为0未执行
FlowChildren
flowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
());
FlowChildren
flowChildren
=
listFlowChildren
.
get
(
spmkApproveDetailDto
.
getIndex
());
User
user
=
flowChildren
.
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
());
User
user
=
flowChildren
.
getRelation
().
get
(
0
).
getUsers
().
get
(
spmkApproveDetailDto
.
getUserIndex
());
...
@@ -1283,6 +1287,156 @@ public class SpmkController {
...
@@ -1283,6 +1287,156 @@ public class SpmkController {
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
return
ResultUtil
.
data
(
JSON
.
toJSONString
(
detailSummary
));
}
}
//移除审批人
@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
(
userList
.
size
()
==
1
)
{
onlyOne
=
true
;
}
if
(
currentChildren
.
getExecute
().
equals
(
"1"
))
{
isExecute
=
true
;
if
(
userList
.
get
(
spmkApproveDetailDto
.
getUserIndex
()).
getExecute
().
equals
(
"1"
))
{
//如果是最后一个
if
(
userList
.
size
()
-
1
==
spmkApproveDetailDto
.
getUserIndex
())
{
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
;
}
//如果是并序
if
(
"1"
.
equals
(
currentChildren
.
getRelation
().
get
(
0
).
getApprovalOrder
()))
{
isAbreas
=
true
;
}
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
spmkApproveExecuteRecordMapper
.
selectExecuteRecordById
(
Integer
.
parseInt
(
currentUser
.
getId
()),
spmkApproveDetailSummary
.
getApproveSummaryId
());
//删除审批过的人记录
if
(
spmkApproveExecuteRecord
!=
null
)
{
if
(
onlyOne
||
isAbreas
)
{
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
();
}
}
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
(
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
));
}
@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 @
766c3941
...
@@ -2,6 +2,7 @@ package cn.timer.api.dao.spmk;
...
@@ -2,6 +2,7 @@ package cn.timer.api.dao.spmk;
import
java.util.List
;
import
java.util.List
;
import
io.swagger.models.auth.In
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -20,4 +21,5 @@ public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveEx
...
@@ -20,4 +21,5 @@ public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveEx
List
<
SpmkApproveExecuteRecord
>
selectListByAsId
(
@Param
(
"id"
)
Integer
id
);
List
<
SpmkApproveExecuteRecord
>
selectListByAsId
(
@Param
(
"id"
)
Integer
id
);
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
);
}
}
src/main/java/cn/timer/api/utils/router/RouterUtils.java
View file @
766c3941
...
@@ -1103,7 +1103,7 @@ public class RouterUtils {
...
@@ -1103,7 +1103,7 @@ public class RouterUtils {
.
approveExecuteRecordId
(
executeRecordId
)
.
approveExecuteRecordId
(
executeRecordId
)
.
empNum
(
Integer
.
parseInt
(
listUser
.
get
(
i_user
).
getId
()))
.
empNum
(
Integer
.
parseInt
(
listUser
.
get
(
i_user
).
getId
()))
.
executorName
(
listUser
.
get
(
i_user
).
getName
())
.
executorName
(
listUser
.
get
(
i_user
).
getName
())
.
operatorHeaderUrl
(
listUser
.
get
(
i
_user
).
getHeadUrl
())
.
operatorHeaderUrl
(
listUser
.
get
(
i
).
getHeadUrl
())
.
sts
(
ExecutorSts
.
IN_EXECUTION
.
ordinal
())
.
sts
(
ExecutorSts
.
IN_EXECUTION
.
ordinal
())
.
build
()
.
build
()
.
insert
();
.
insert
();
...
...
src/main/resources/mapping/spmk/SpmkApproveExecuteRecordMapper.xml
View file @
766c3941
...
@@ -178,4 +178,10 @@
...
@@ -178,4 +178,10 @@
WHERE sr.approve_summary_id = #{approveSummaryId} and sr.id
<![CDATA[ > ]]>
#{recordId}
WHERE sr.approve_summary_id = #{approveSummaryId} and sr.id
<![CDATA[ > ]]>
#{recordId}
</delete>
</delete>
<delete
id=
"delExecuteRecordByRecordIds"
>
DELETE sr,se FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
WHERE sr.id =#{id} and se.emp_num =#{uid}
</delete>
</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