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
ac386e79
Commit
ac386e79
authored
Sep 07, 2021
by
陶湘宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
防止重复提交审批
parent
182d832f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+21
-6
No files found.
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
ac386e79
...
...
@@ -11,6 +11,7 @@ import java.util.Set;
import
cn.timer.api.bean.spmk.*
;
import
cn.timer.api.dao.spmk.*
;
import
cn.timer.api.dto.spmk.*
;
import
cn.timer.api.utils.redis.RedisUtil
;
import
com.baomidou.mybatisplus.core.toolkit.SerializationUtils
;
import
net.sf.json.JSONArray
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -73,6 +74,8 @@ import cn.timer.api.utils.router.enums.ApproveEnum;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.annotation.Resource
;
@Api
(
tags
=
"3.0审批模块"
)
@RestController
@Transactional
...
...
@@ -112,7 +115,8 @@ public class SpmkController {
private
boolean
ISFIRST
=
true
;
// 第一次启动审批流程
@Resource
private
RedisUtil
redisUtil
;
//TODO 审批模板组
...
...
@@ -726,8 +730,14 @@ public class SpmkController {
@Log
(
title
=
"审批-审批流程"
,
businessType
=
BusinessType
.
UPDATE
)
// @BindingResultCtrol(title = "审批人审批")
public
Result
<
Object
>
approving
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
ApprovingDto
approvingDto
)
throws
Exception
{
Integer
asId
=
approvingDto
.
getAsId
();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer
approStatus
=
Integer
.
parseInt
(
redisUtil
.
get
(
asId
.
toString
())==
null
?
"0"
:
redisUtil
.
get
(
asId
.
toString
()).
toString
());
if
(
approStatus
==
1
){
return
ResultUtil
.
error
(
"该审批已在审批中!"
);
}
else
{
redisUtil
.
set
(
asId
.
toString
(),
1
,
5000
);
}
SpmkApproveDetailSummary
ad
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
.
lambda
()
.
select
(
SpmkApproveDetailSummary:
:
getId
,
...
...
@@ -735,12 +745,13 @@ public class SpmkController {
SpmkApproveDetailSummary:
:
getFlowChildren
)
.
eq
(
SpmkApproveDetailSummary:
:
getApproveSummaryId
,
asId
));
// 查询 SpmkApproveSummary 状态
// 查询 SpmkApproveSummary 状态
,
SpmkApproveSummary
aSummary
=
spmkApproveSummaryMapper
.
selectOne
(
new
QueryWrapper
<
SpmkApproveSummary
>().
lambda
()
.
select
(
SpmkApproveSummary:
:
getSts
)
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
if
(
aSummary
.
getSts
()
>
SpmkEnumInterface
.
ApproveSummarySts
.
IN
.
ordinal
())
{
if
(
aSummary
.
getSts
()
>
ApproveSummarySts
.
IN
.
ordinal
())
{
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
error
(
"该审批已结束!"
);
}
...
...
@@ -750,13 +761,14 @@ public class SpmkController {
.
eq
(
SpmkExecutor:
:
getSts
,
ExecutorSts
.
IN_EXECUTION
.
ordinal
()));
if
(
count
==
0
)
{
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
error
(
"您已审批过!"
);
}
if
(
spmkExecutorMapper
.
selectCount
(
new
QueryWrapper
<
SpmkExecutor
>().
lambda
()
.
eq
(
SpmkExecutor:
:
getId
,
approvingDto
.
getExecutorId
())
.
eq
(
SpmkExecutor:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
SpmkExecutor:
:
getSts
,
SpmkEnumInterface
.
ExecutorSts
.
IN_EXECUTION
.
ordinal
()))
==
0
)
{
.
eq
(
SpmkExecutor:
:
getSts
,
ExecutorSts
.
IN_EXECUTION
.
ordinal
()))
==
0
)
{
Integer
adminNum
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
...
...
@@ -765,6 +777,7 @@ public class SpmkController {
.
count
();
if
(
adminNum
<=
0
)
{
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
error
(
"非当前审批人 或 管理员,无法操作!"
);
}
...
...
@@ -792,7 +805,7 @@ public class SpmkController {
.
select
(
SpmkApproveSummary:
:
getSts
,
SpmkApproveSummary:
:
getAssoType
)
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
if
(
aSummary
.
getSts
()
!=
SpmkEnumInterface
.
ApproveSummarySts
.
REFUSE
.
ordinal
())
{
if
(
aSummary
.
getSts
()
!=
ApproveSummarySts
.
REFUSE
.
ordinal
())
{
SpmkApproveSummary
.
builder
().
id
(
asId
).
currentApprover
(
CommonEnum
.
NULL_STR
.
getDesc
()).
endTime
(
new
Date
()).
sts
(
ApproveSummarySts
.
FINISH
.
ordinal
()).
build
().
updateById
();
JSONObject
jSONObject
=
jsonObject
.
parseObject
(
ad
.
getRequestData
(),
JSONObject
.
class
);
...
...
@@ -809,8 +822,10 @@ public class SpmkController {
}
}
else
{
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
error
(
"该审批已结束!"
);
}
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
success
();
}
...
...
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