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
667b9522
Commit
667b9522
authored
Sep 28, 2023
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员审批重复扣除假期余额bug
parent
78b4ac17
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
31 deletions
+37
-31
src/main/java/cn/timer/api/controller/spmk/AdminSpmkController.java
+37
-31
No files found.
src/main/java/cn/timer/api/controller/spmk/AdminSpmkController.java
View file @
667b9522
...
@@ -51,7 +51,7 @@ import java.util.*;
...
@@ -51,7 +51,7 @@ import java.util.*;
@Api
(
tags
=
"3.0Admin审批模块"
)
@Api
(
tags
=
"3.0Admin审批模块"
)
@RestController
@RestController
@Transactional
@Transactional
@RequestMapping
(
value
=
"/admin/spmk"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
@RequestMapping
(
value
=
"/admin/spmk"
,
produces
=
{
"application/json"
,
"multipart/form-data"
})
public
class
AdminSpmkController
{
public
class
AdminSpmkController
{
...
@@ -74,6 +74,7 @@ public class AdminSpmkController {
...
@@ -74,6 +74,7 @@ public class AdminSpmkController {
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
//TODO 管理员审批
//TODO 管理员审批
/**
/**
* 管理员审批
* 管理员审批
*/
*/
...
@@ -82,13 +83,13 @@ public class AdminSpmkController {
...
@@ -82,13 +83,13 @@ public class AdminSpmkController {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ApiOperationSupport
(
order
=
20
)
@ApiOperationSupport
(
order
=
20
)
@Log
(
title
=
"审批-审批流程"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"审批-审批流程"
,
businessType
=
BusinessType
.
UPDATE
)
public
Result
<
Object
>
approving
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
AdminApprovingDto
approvingDto
)
throws
Exception
{
public
Result
<
Object
>
approving
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
AdminApprovingDto
approvingDto
)
throws
Exception
{
/*判断是否有权限转派*/
/*判断是否有权限转派*/
//if(approvingDto.getSts()==4){
//if(approvingDto.getSts()==4){
QyzxEmpEntAsso
ent
=
QyzxEmpEntAsso
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
QyzxEmpEntAsso
>().
lambda
().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
()).
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
()));
QyzxEmpEntAsso
ent
=
QyzxEmpEntAsso
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
QyzxEmpEntAsso
>().
lambda
().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
()).
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
()));
if
(
ent
!=
null
)
{
if
(
ent
!=
null
)
{
/*超管和管理员不受权限控制*/
/*超管和管理员不受权限控制*/
if
(
ent
.
getUserType
()
==
2
)
{
if
(
ent
.
getUserType
()
==
2
)
{
ZzglAuth
zzglAuth
=
ZzglAuth
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglAuth
>().
lambda
().
eq
(
ZzglAuth:
:
getBmgwId
,
userBean
.
getUserInfo
().
getBmgwId
())
ZzglAuth
zzglAuth
=
ZzglAuth
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglAuth
>().
lambda
().
eq
(
ZzglAuth:
:
getBmgwId
,
userBean
.
getUserInfo
().
getBmgwId
())
.
eq
(
ZzglAuth:
:
getMenuId
,
"/Approvalspbutonspbuton020102"
));
.
eq
(
ZzglAuth:
:
getMenuId
,
"/Approvalspbutonspbuton020102"
));
if
(
zzglAuth
==
null
)
{
if
(
zzglAuth
==
null
)
{
...
@@ -99,11 +100,11 @@ public class AdminSpmkController {
...
@@ -99,11 +100,11 @@ public class AdminSpmkController {
//}
//}
Integer
asId
=
approvingDto
.
getAsId
();
Integer
asId
=
approvingDto
.
getAsId
();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer
approStatus
=
Integer
.
parseInt
(
redisUtil
.
get
(
asId
.
toString
())==
null
?
"0"
:
redisUtil
.
get
(
asId
.
toString
()).
toString
());
Integer
approStatus
=
Integer
.
parseInt
(
redisUtil
.
get
(
asId
.
toString
())
==
null
?
"0"
:
redisUtil
.
get
(
asId
.
toString
()).
toString
());
if
(
approStatus
==
1
)
{
if
(
approStatus
==
1
)
{
return
ResultUtil
.
error
(
"该审批已在审批中!"
);
return
ResultUtil
.
error
(
"该审批已在审批中!"
);
}
else
{
}
else
{
redisUtil
.
set
(
asId
.
toString
(),
1
,
2
);
redisUtil
.
set
(
asId
.
toString
(),
1
,
2
);
}
}
SpmkApproveDetailSummary
ad
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
SpmkApproveDetailSummary
ad
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
.
lambda
()
.
lambda
()
...
@@ -115,7 +116,7 @@ public class AdminSpmkController {
...
@@ -115,7 +116,7 @@ public class AdminSpmkController {
// 查询 SpmkApproveSummary 状态,
// 查询 SpmkApproveSummary 状态,
SpmkApproveSummary
aSummary
=
spmkApproveSummaryMapper
.
selectOne
(
new
QueryWrapper
<
SpmkApproveSummary
>().
lambda
()
SpmkApproveSummary
aSummary
=
spmkApproveSummaryMapper
.
selectOne
(
new
QueryWrapper
<
SpmkApproveSummary
>().
lambda
()
.
select
(
SpmkApproveSummary:
:
getSts
,
SpmkApproveSummary:
:
getAssoType
,
SpmkApproveSummary:
:
getEmpNum
,
SpmkApproveSummary:
:
getOrgCode
)
.
select
(
SpmkApproveSummary:
:
getSts
,
SpmkApproveSummary:
:
getAssoType
,
SpmkApproveSummary:
:
getEmpNum
,
SpmkApproveSummary:
:
getOrgCode
)
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
// if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
// if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
...
@@ -133,8 +134,8 @@ public class AdminSpmkController {
...
@@ -133,8 +134,8 @@ public class AdminSpmkController {
// return ResultUtil.error("您已审批过!");
// return ResultUtil.error("您已审批过!");
// }
// }
//判断是否是请假审批
//判断是否是请假审批
if
(
aSummary
.
getAssoType
()==
ApproveEnum
.
LEAVE
.
getType
())
{
if
(
aSummary
.
getAssoType
()
==
ApproveEnum
.
LEAVE
.
getType
())
{
if
(
approvingDto
.
getSts
()==
2
)
{
if
(
approvingDto
.
getSts
()
==
2
)
{
JSONObject
jSONObject
=
jsonObject
.
parseObject
(
ad
.
getRequestData
(),
JSONObject
.
class
);
JSONObject
jSONObject
=
jsonObject
.
parseObject
(
ad
.
getRequestData
(),
JSONObject
.
class
);
// 请假类型 - 前端传中文
// 请假类型 - 前端传中文
String
LeaveType
=
ObjectUtil
.
isNull
(
jSONObject
.
get
(
"__LeaveType"
,
FromData
.
class
))
?
null
:
jSONObject
.
get
(
"__LeaveType"
,
FromData
.
class
).
getValue
();
String
LeaveType
=
ObjectUtil
.
isNull
(
jSONObject
.
get
(
"__LeaveType"
,
FromData
.
class
))
?
null
:
jSONObject
.
get
(
"__LeaveType"
,
FromData
.
class
).
getValue
();
...
@@ -144,13 +145,13 @@ public class AdminSpmkController {
...
@@ -144,13 +145,13 @@ public class AdminSpmkController {
KqglAssoLeaveEmployeeBalance
emba
=
KqglAssoLeaveEmployeeBalance
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveEmployeeBalance
>().
lambda
().
eq
(
KqglAssoLeaveEmployeeBalance:
:
getLeaveRulesId
,
Convert
.
toInt
(
LeaveType
))
KqglAssoLeaveEmployeeBalance
emba
=
KqglAssoLeaveEmployeeBalance
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
KqglAssoLeaveEmployeeBalance
>().
lambda
().
eq
(
KqglAssoLeaveEmployeeBalance:
:
getLeaveRulesId
,
Convert
.
toInt
(
LeaveType
))
.
eq
(
KqglAssoLeaveEmployeeBalance:
:
getUserid
,
aSummary
.
getEmpNum
()).
eq
(
KqglAssoLeaveEmployeeBalance:
:
getOrgCode
,
aSummary
.
getOrgCode
()));
.
eq
(
KqglAssoLeaveEmployeeBalance:
:
getUserid
,
aSummary
.
getEmpNum
()).
eq
(
KqglAssoLeaveEmployeeBalance:
:
getOrgCode
,
aSummary
.
getOrgCode
()));
if
(
emba
!=
null
)
{
if
(
emba
!=
null
)
{
if
(
emba
.
getBalanceDays
()!=-
1
&&
emba
.
getBalanceDays
()
<
Convert
.
toInt
(
longTime
))
{
if
(
emba
.
getBalanceDays
()
!=
-
1
&&
emba
.
getBalanceDays
()
<
Convert
.
toInt
(
longTime
))
{
return
ResultUtil
.
error
(
"当前发起人假期余额不足"
);
return
ResultUtil
.
error
(
"当前发起人假期余额不足"
);
}
}
}
}
}
}
}
}
if
(
spmkExecutorMapper
.
selectCount
(
new
QueryWrapper
<
SpmkExecutor
>().
lambda
()
if
(
spmkExecutorMapper
.
selectCount
(
new
QueryWrapper
<
SpmkExecutor
>().
lambda
()
.
eq
(
SpmkExecutor:
:
getId
,
approvingDto
.
getExecutorId
())
.
eq
(
SpmkExecutor:
:
getId
,
approvingDto
.
getExecutorId
())
.
eq
(
SpmkExecutor:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
SpmkExecutor:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
SpmkExecutor:
:
getSts
,
ExecutorSts
.
IN_EXECUTION
.
ordinal
()))
==
0
)
{
.
eq
(
SpmkExecutor:
:
getSts
,
ExecutorSts
.
IN_EXECUTION
.
ordinal
()))
==
0
)
{
...
@@ -158,22 +159,22 @@ public class AdminSpmkController {
...
@@ -158,22 +159,22 @@ public class AdminSpmkController {
Integer
adminNum
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
Integer
adminNum
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_ADMIN
,
SysRoleType
.
U_TYPE_C_ADMIN
)
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
SysRoleType
.
U_TYPE_ADMIN
,
SysRoleType
.
U_TYPE_C_ADMIN
)
.
count
();
.
count
();
if
(
adminNum
<=
0
)
{
if
(
adminNum
<=
0
)
{
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
error
(
"非当前审批人 或 管理员,无法操作!"
);
return
ResultUtil
.
error
(
"非当前审批人 或 管理员,无法操作!"
);
}
}
}
}
//如果是再次审批
//如果是再次审批
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
SpmkApproveExecuteRecord
.
builder
().
id
(
approvingDto
.
getExecuteRecordId
()).
build
().
selectById
();
SpmkApproveExecuteRecord
spmkApproveExecuteRecord
=
SpmkApproveExecuteRecord
.
builder
().
id
(
approvingDto
.
getExecuteRecordId
()).
build
().
selectById
();
if
(
spmkApproveExecuteRecord
.
getSts
()>
1
)
{
if
(
spmkApproveExecuteRecord
.
getSts
()
>
1
)
{
spmkApproveExecuteRecordMapper
.
delExecuteRecord
(
approvingDto
.
getExecuteRecordId
(),
asId
);
spmkApproveExecuteRecordMapper
.
delExecuteRecord
(
approvingDto
.
getExecuteRecordId
(),
asId
);
}
}
List
<
FlowChildren
>
listFlowChildren
=
jsonObject
.
parseArray
(
ad
.
getFlowChildren
(),
FlowChildren
.
class
);
List
<
FlowChildren
>
listFlowChildren
=
jsonObject
.
parseArray
(
ad
.
getFlowChildren
(),
FlowChildren
.
class
);
RouterUtils
.
updateRefuseToAgree
(
RouterUtils
.
updateRefuseToAgree
(
listFlowChildren
,
listFlowChildren
,
...
@@ -192,16 +193,16 @@ public class AdminSpmkController {
...
@@ -192,16 +193,16 @@ public class AdminSpmkController {
);
);
listFlowChildren
.
forEach
(
l
->
{
listFlowChildren
.
forEach
(
l
->
{
//如果大节点已经完成
//如果大节点已经完成
if
(
l
.
getClassName
().
equals
(
"audit"
))
{
if
(
l
.
getClassName
().
equals
(
"audit"
))
{
if
(
l
.
getExecute
().
equals
(
"2"
))
{
if
(
l
.
getExecute
().
equals
(
"2"
))
{
l
.
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
l
.
getRelation
().
get
(
0
).
getUsers
().
forEach
(
v
->
{
if
(!
v
.
getExecute
().
equals
(
"2"
))
{
if
(!
v
.
getExecute
().
equals
(
"2"
))
{
v
.
setExecute
(
"2"
);
v
.
setExecute
(
"2"
);
}
}
});
});
}
else
if
(
l
.
getExecute
().
equals
(
"1"
))
{
}
else
if
(
l
.
getExecute
().
equals
(
"1"
))
{
//大节点未执行完
//大节点未执行完
}
}
...
@@ -227,35 +228,41 @@ public class AdminSpmkController {
...
@@ -227,35 +228,41 @@ public class AdminSpmkController {
*/
*/
if
(
fc
.
getExecute
()
==
"2"
)
{
if
(
fc
.
getExecute
()
==
"2"
)
{
//未更新sts前
int
lastSts
=
aSummary
.
getSts
();
// 查询 SpmkApproveSummary 状态
// 查询 SpmkApproveSummary 状态
aSummary
=
spmkApproveSummaryMapper
.
selectOne
(
new
QueryWrapper
<
SpmkApproveSummary
>().
lambda
()
aSummary
=
spmkApproveSummaryMapper
.
selectOne
(
new
QueryWrapper
<
SpmkApproveSummary
>().
lambda
()
.
select
(
SpmkApproveSummary:
:
getSts
,
SpmkApproveSummary:
:
getAssoTyp
e
)
.
select
(
SpmkApproveSummary:
:
getSts
,
SpmkApproveSummary:
:
getAssoType
,
SpmkApproveSummary:
:
getEmpNum
,
SpmkApproveSummary:
:
getOrgCod
e
)
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
.
eq
(
SpmkApproveSummary:
:
getId
,
asId
));
// if (aSummary.getSts() != 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
();
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
);
JSONObject
jSONObject
=
jsonObject
.
parseObject
(
ad
.
getRequestData
(),
JSONObject
.
class
);
jSONObject
.
set
(
"approveId"
,
FromData
.
builder
().
value
(
String
.
valueOf
(
asId
)).
build
());
jSONObject
.
set
(
"approveId"
,
FromData
.
builder
().
value
(
String
.
valueOf
(
asId
)).
build
());
jSONObject
.
set
(
"orgCode"
,
userBean
.
getOrgCode
());
jSONObject
.
set
(
"orgCode"
,
userBean
.
getOrgCode
());
//如果请假审批,并且上一次是同意这次重复同意不会扣除假期余额
if
(
aSummary
.
getAssoType
()
==
ApproveEnum
.
LEAVE
.
getType
()
&&
Integer
.
parseInt
(
fc
.
getExecute
())
==
lastSts
)
{
}
else
{
//审批完成后 业务
//审批完成后 业务
SpmkAssoBusiness
sab
=
spmkAssoBusinessFactory
.
createSpmkService
(
ApproveEnum
.
getEnums
(
aSummary
.
getAssoType
()));
SpmkAssoBusiness
sab
=
spmkAssoBusinessFactory
.
createSpmkService
(
ApproveEnum
.
getEnums
(
aSummary
.
getAssoType
()));
if
(
sab
!=
null
){
log
.
info
(
"1----------{}"
,
sab
);
if
(
sab
!=
null
)
{
log
.
info
(
"1----------{}"
,
sab
);
}
}
log
.
info
(
"2----------{}"
,
jSONObject
);
log
.
info
(
"2----------{}"
,
jSONObject
);
sab
.
handleApprove
(
jSONObject
);
sab
.
handleApprove
(
jSONObject
);
}
}
}
// }
// }
// }else {
// }else {
// redisUtil.set(asId.toString(),0,500);
// redisUtil.set(asId.toString(),0,500);
// return ResultUtil.error("该审批已结束!");
// return ResultUtil.error("该审批已结束!");
// }
// }
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
redisUtil
.
set
(
asId
.
toString
(),
0
,
500
);
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
}
}
/**
/**
...
@@ -264,8 +271,7 @@ public class AdminSpmkController {
...
@@ -264,8 +271,7 @@ public class AdminSpmkController {
@DeleteMapping(value = "/del_appraisal_t/{id}")
@DeleteMapping(value = "/del_appraisal_t/{id}")
@ApiOperation(value = "2.移除-审批人", httpMethod = "DELETE", notes = "移除-审批人")
@ApiOperation(value = "2.移除-审批人", httpMethod = "DELETE", notes = "移除-审批人")
@ApiOperationSupport(order = 6)
@ApiOperationSupport(order = 6)
@Role
@Role public Result<Object> delAT(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
public Result<Object> delAT(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
jxglAppraisalTMapper.delete(new QueryWrapper<JxglAppraisalT>().lambda().eq(JxglAppraisalT::getId, id)
jxglAppraisalTMapper.delete(new QueryWrapper<JxglAppraisalT>().lambda().eq(JxglAppraisalT::getId, id)
.eq(JxglAppraisalT::getOrgCode, userBean.getOrgCode()));
.eq(JxglAppraisalT::getOrgCode, userBean.getOrgCode()));
...
...
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