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
09c63150
Commit
09c63150
authored
Apr 30, 2020
by
tangzhaoqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
审批撤回,审批详情头像,validation参数校验+AOP切面统一处理 校验报错返回
parent
8434079e
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
275 additions
and
23 deletions
+275
-23
pom.xml
+5
-0
src/main/java/cn/timer/api/aspect/BindingResultAspect.java
+124
-0
src/main/java/cn/timer/api/aspect/lang/annotation/BindingResultCtrol.java
+25
-0
src/main/java/cn/timer/api/aspect/lang/bean/ValidationError.java
+19
-0
src/main/java/cn/timer/api/controller/spmk/SpmkServiceImpl.java
+33
-3
src/main/java/cn/timer/api/dto/spmk/ApprovingDto.java
+9
-3
src/main/java/cn/timer/api/dto/spmk/MySummaryQueryDto.java
+9
-1
src/main/java/cn/timer/api/dto/spmk/Router.java
+2
-0
src/main/java/cn/timer/api/dto/spmk/SpmkApproveSummaryDto.java
+20
-10
src/main/java/cn/timer/api/dto/spmk/SummaryQueryDto.java
+1
-1
src/main/java/cn/timer/api/dto/spmk/User.java
+2
-0
src/main/java/cn/timer/api/utils/ResultUtil.java
+13
-2
src/main/java/cn/timer/api/utils/router/RouterUtils.java
+9
-0
src/main/resources/mapping/spmk/SpmkApproveSummaryMapper.xml
+4
-3
No files found.
pom.xml
View file @
09c63150
...
@@ -80,6 +80,11 @@
...
@@ -80,6 +80,11 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<scope>
provided
</scope>
<scope>
provided
</scope>
...
...
src/main/java/cn/timer/api/aspect/BindingResultAspect.java
0 → 100644
View file @
09c63150
package
cn
.
timer
.
api
.
aspect
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.Signature
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.stereotype.Component
;
import
org.springframework.validation.BeanPropertyBindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
com.alibaba.fastjson.JSONObject
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.lang.Console
;
import
cn.hutool.core.util.ClassUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.timer.api.aspect.lang.annotation.BindingResultCtrol
;
import
cn.timer.api.aspect.lang.bean.ValidationError
;
import
cn.timer.api.utils.ResultUtil
;
/**
* 校验信息返回
*
* @author TZQ
*/
@Aspect
@Component
public
class
BindingResultAspect
{
// 配置织入点
@Pointcut
(
"@annotation(cn.timer.api.aspect.lang.annotation.BindingResultCtrol)"
)
public
void
bindingResultPointCut
()
{
}
@Before
(
"bindingResultPointCut()"
)
public
void
doBefore
(
JoinPoint
point
)
throws
Throwable
{
// handleDataScope(point);
}
@Around
(
"bindingResultPointCut() && args(..,bindingResult)"
)
public
Object
doAround
(
ProceedingJoinPoint
joinPoint
,
BindingResult
bindingResult
)
throws
Throwable
{
Long
startTime
=
System
.
currentTimeMillis
();
Object
retVal
;
if
(
bindingResult
.
hasErrors
()){
List
<
ObjectError
>
ls
=
bindingResult
.
getAllErrors
();
List
<
ValidationError
>
listVe
=
new
ArrayList
<
ValidationError
>();
ValidationError
ve
;
for
(
ObjectError
one
:
ls
)
{
String
fieldString
=
one
.
getCodes
().
length
>=
1
?
one
.
getCodes
()[
0
]
:
""
;
if
(
fieldString
!=
null
)
{
fieldString
=
fieldString
.
substring
(
fieldString
.
lastIndexOf
(
"."
)
+
1
);
}
for
(
String
str
:
one
.
getCodes
())
{
System
.
err
.
println
(
str
);
}
ve
=
ValidationError
.
builder
().
field
(
fieldString
).
msg
(
one
.
getDefaultMessage
()).
build
();
listVe
.
add
(
ve
);
}
retVal
=
ResultUtil
.
error
(
listVe
);
}
else
{
retVal
=
joinPoint
.
proceed
(
joinPoint
.
getArgs
());
}
Console
.
log
(
"返回内容 {}: "
,
JSONObject
.
toJSONString
(
retVal
));
Long
endtime
=
System
.
currentTimeMillis
();
Console
.
log
(
"执行耗时为{}:"
,
endtime
-
startTime
+
"ms"
);
return
retVal
;
}
protected
void
handleDataScope
(
final
JoinPoint
joinPoint
)
{
// 获得注解
BindingResultCtrol
controllerDataScope
=
getAnnotationLog
(
joinPoint
);
if
(
controllerDataScope
==
null
)
return
;
Console
.
log
(
"title"
+
controllerDataScope
.
title
());
Console
.
log
(
"paramType"
+
controllerDataScope
.
paramType
());
Object
[]
objs
=
joinPoint
.
getArgs
();
List
<
Object
>
listObj
=
CollectionUtil
.
toList
(
objs
);
BeanPropertyBindingResult
optional
=
(
BeanPropertyBindingResult
)
listObj
.
stream
()
.
filter
(
p
->
"BeanPropertyBindingResult"
.
equals
(
ClassUtil
.
getClassName
(
p
,
true
)))
.
findFirst
()
.
orElse
(
null
);
if
(
optional
!=
null
&&
optional
.
hasErrors
())
{
System
.
err
.
println
(
"Optional: "
+
optional
);
}
}
/**
* 是否存在注解,如果存在就获取
*/
private
BindingResultCtrol
getAnnotationLog
(
JoinPoint
joinPoint
)
{
Signature
signature
=
joinPoint
.
getSignature
();
MethodSignature
methodSignature
=
(
MethodSignature
)
signature
;
Method
method
=
methodSignature
.
getMethod
();
if
(
method
!=
null
)
{
return
method
.
getAnnotation
(
BindingResultCtrol
.
class
);
}
return
null
;
}
}
src/main/java/cn/timer/api/aspect/lang/annotation/BindingResultCtrol.java
0 → 100644
View file @
09c63150
package
cn
.
timer
.
api
.
aspect
.
lang
.
annotation
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
METHOD
,
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
BindingResultCtrol
{
/**
* 模块
*/
public
String
title
()
default
"8小时"
;
/**
* 参数类型
*/
public
String
paramType
()
default
"对象"
;
}
src/main/java/cn/timer/api/aspect/lang/bean/ValidationError.java
0 → 100644
View file @
09c63150
package
cn
.
timer
.
api
.
aspect
.
lang
.
bean
;
import
cn.timer.api.bean.spmk.SpmkApprovalG
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ValidationError
{
private
String
field
;
private
String
msg
;
}
src/main/java/cn/timer/api/controller/spmk/SpmkServiceImpl.java
View file @
09c63150
...
@@ -4,8 +4,11 @@ import java.util.ArrayList;
...
@@ -4,8 +4,11 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.Valid
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
@@ -26,6 +29,7 @@ import cn.hutool.core.lang.Console;
...
@@ -26,6 +29,7 @@ import cn.hutool.core.lang.Console;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.timer.api.aspect.lang.annotation.BindingResultCtrol
;
import
cn.timer.api.bean.spmk.SpmkApprovalG
;
import
cn.timer.api.bean.spmk.SpmkApprovalG
;
import
cn.timer.api.bean.spmk.SpmkApprovalTemplate
;
import
cn.timer.api.bean.spmk.SpmkApprovalTemplate
;
import
cn.timer.api.bean.spmk.SpmkApprovalTemplateG
;
import
cn.timer.api.bean.spmk.SpmkApprovalTemplateG
;
...
@@ -48,6 +52,7 @@ import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
...
@@ -48,6 +52,7 @@ import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
import
cn.timer.api.dao.spmk.SpmkCustomApprovalMapper
;
import
cn.timer.api.dao.spmk.SpmkCustomApprovalMapper
;
import
cn.timer.api.dao.spmk.SpmkExecutorMapper
;
import
cn.timer.api.dao.spmk.SpmkExecutorMapper
;
import
cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper
;
import
cn.timer.api.dao.spmk.SpmkInitiatorConfigMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.dto.spmk.ApprovingDto
;
import
cn.timer.api.dto.spmk.ApprovingDto
;
import
cn.timer.api.dto.spmk.FlowChildren
;
import
cn.timer.api.dto.spmk.FlowChildren
;
import
cn.timer.api.dto.spmk.FromData
;
import
cn.timer.api.dto.spmk.FromData
;
...
@@ -375,13 +380,23 @@ public class SpmkServiceImpl {
...
@@ -375,13 +380,23 @@ public class SpmkServiceImpl {
@ApiOperation
(
value
=
"17.发起审批"
,
httpMethod
=
"POST"
,
notes
=
"发起审批"
)
@ApiOperation
(
value
=
"17.发起审批"
,
httpMethod
=
"POST"
,
notes
=
"发起审批"
)
@ApiOperationSupport
(
order
=
17
)
@ApiOperationSupport
(
order
=
17
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Result
<
Object
>
saveCa
(
@CurrentUser
UserBean
userBean
,
@RequestBody
SpmkApproveSummaryDto
spmkApproveSummaryDto
)
throws
Exception
{
@BindingResultCtrol
(
title
=
"发起审批"
)
public
Result
<
Object
>
saveCa
(
@CurrentUser
UserBean
userBean
,
@Valid
@RequestBody
SpmkApproveSummaryDto
spmkApproveSummaryDto
,
BindingResult
bindingResult
)
throws
Exception
{
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>()
.
lambda
()
.
select
(
YgglMainEmp:
:
getHeadUrl
,
YgglMainEmp:
:
getName
)
.
eq
(
YgglMainEmp:
:
getEmpNum
,
userBean
.
getEmpNum
()));
if
(
ygglMainEmp
==
null
)
return
ResultUtil
.
error
(
"发起人异常!"
);
List
<
Router
>
listRouter
=
new
ArrayList
<
Router
>();
List
<
Router
>
listRouter
=
new
ArrayList
<
Router
>();
listRouter
.
add
(
spmkApproveSummaryDto
.
getRouter
());
listRouter
.
add
(
spmkApproveSummaryDto
.
getRouter
());
JSONObject
jSONObject
=
spmkApproveSummaryDto
.
getRequestData
()
JSONObject
jSONObject
=
spmkApproveSummaryDto
.
getRequestData
()
.
put
(
"orgCode"
,
FromData
.
builder
().
value
(
String
.
valueOf
(
userBean
.
getOrgCode
())).
build
())
.
put
(
"orgCode"
,
FromData
.
builder
().
value
(
String
.
valueOf
(
userBean
.
getOrgCode
())).
build
())
.
put
(
"initiator"
,
FromData
.
builder
().
value
(
spmkApproveSummaryDto
.
getInitiator
()).
build
())
.
put
(
"initiator"
,
FromData
.
builder
().
value
(
spmkApproveSummaryDto
.
getInitiator
()).
build
())
.
put
(
"headUrl"
,
FromData
.
builder
().
value
(
ygglMainEmp
.
getHeadUrl
()).
build
())
.
put
(
"id"
,
FromData
.
builder
().
value
(
StrUtil
.
toString
(
userBean
.
getEmpNum
())).
build
());
.
put
(
"id"
,
FromData
.
builder
().
value
(
StrUtil
.
toString
(
userBean
.
getEmpNum
())).
build
());
RouterUtils
.
NextNode
(
listRouter
,
jSONObject
,
ISFIRST
);
RouterUtils
.
NextNode
(
listRouter
,
jSONObject
,
ISFIRST
);
List
<
FlowChildren
>
listFlowChildren
=
new
ArrayList
<
FlowChildren
>();
List
<
FlowChildren
>
listFlowChildren
=
new
ArrayList
<
FlowChildren
>();
...
@@ -479,6 +494,20 @@ public class SpmkServiceImpl {
...
@@ -479,6 +494,20 @@ public class SpmkServiceImpl {
return
ResultUtil
.
data
(
adD
,
"操作成功!"
);
return
ResultUtil
.
data
(
adD
,
"操作成功!"
);
}
}
//TODO 撤销审批
/**
* 撤销审批
*/
@PutMapping
(
value
=
"/revoke_approval/{id}"
)
@ApiOperation
(
value
=
"22.撤销审批"
,
httpMethod
=
"PUT"
,
notes
=
"撤销审批"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ApiOperationSupport
(
order
=
22
)
public
Result
<
Object
>
revokeApproval
(
@PathVariable
Integer
id
)
throws
Exception
{
return
SpmkApproveSummary
.
builder
().
id
(
id
).
endTime
(
new
Date
()).
sts
(
1
).
build
().
updateById
()
?
ResultUtil
.
success
(
"操作成功!"
)
:
ResultUtil
.
error
(
"操作失败!"
);
}
//TODO 审批人审批
//TODO 审批人审批
/**
/**
* 审批人审批
* 审批人审批
...
@@ -487,7 +516,8 @@ public class SpmkServiceImpl {
...
@@ -487,7 +516,8 @@ public class SpmkServiceImpl {
@ApiOperation
(
value
=
"20.审批人审批"
,
httpMethod
=
"POST"
,
notes
=
"审批人审批"
)
@ApiOperation
(
value
=
"20.审批人审批"
,
httpMethod
=
"POST"
,
notes
=
"审批人审批"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ApiOperationSupport
(
order
=
20
)
@ApiOperationSupport
(
order
=
20
)
public
Result
<
Object
>
approving
(
@RequestBody
ApprovingDto
approvingDto
)
throws
Exception
{
// @BindingResultCtrol(title = "审批人审批")
public
Result
<
Object
>
approving
(
@Valid
@RequestBody
ApprovingDto
approvingDto
,
BindingResult
bindingResult
)
throws
Exception
{
SpmkApproveDetail
ad
=
SpmkApproveDetail
.
builder
().
build
()
SpmkApproveDetail
ad
=
SpmkApproveDetail
.
builder
().
build
()
.
selectOne
(
new
QueryWrapper
<
SpmkApproveDetail
>()
.
selectOne
(
new
QueryWrapper
<
SpmkApproveDetail
>()
.
lambda
()
.
lambda
()
...
@@ -498,7 +528,7 @@ public class SpmkServiceImpl {
...
@@ -498,7 +528,7 @@ public class SpmkServiceImpl {
.
select
(
SpmkApproveSummary:
:
getSts
)
.
select
(
SpmkApproveSummary:
:
getSts
)
.
eq
(
SpmkApproveSummary:
:
getId
,
approvingDto
.
getAsId
()));
.
eq
(
SpmkApproveSummary:
:
getId
,
approvingDto
.
getAsId
()));
if
(
aSummary
.
getSts
()
==
2
||
aSummary
.
getSts
()
==
3
)
{
if
(
aSummary
.
getSts
()
==
1
||
aSummary
.
getSts
()
==
2
||
aSummary
.
getSts
()
==
3
)
{
return
ResultUtil
.
error
(
"该审批已结束!"
);
return
ResultUtil
.
error
(
"该审批已结束!"
);
}
}
...
...
src/main/java/cn/timer/api/dto/spmk/ApprovingDto.java
View file @
09c63150
package
cn
.
timer
.
api
.
dto
.
spmk
;
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
javax.validation.constraints.NotNull
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
...
@@ -12,21 +14,25 @@ import lombok.NoArgsConstructor;
...
@@ -12,21 +14,25 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@AllArgsConstructor
public
class
ApprovingDto
{
public
class
ApprovingDto
{
@NotNull
(
message
=
"asId为空"
)
@ApiModelProperty
(
value
=
"审批汇总id"
,
example
=
"2"
,
required
=
true
)
@ApiModelProperty
(
value
=
"审批汇总id"
,
example
=
"2"
,
required
=
true
)
private
Integer
asId
;
private
Integer
asId
;
@NotNull
(
message
=
"executeRecordId为空"
)
@ApiModelProperty
(
value
=
"审批执行记录id"
,
example
=
"10"
,
required
=
true
)
@ApiModelProperty
(
value
=
"审批执行记录id"
,
example
=
"10"
,
required
=
true
)
private
Integer
executeRecordId
;
private
Integer
executeRecordId
;
@NotNull
(
message
=
"executorId为空"
)
@ApiModelProperty
(
value
=
"执行人记录id"
,
example
=
"10"
,
required
=
true
)
@ApiModelProperty
(
value
=
"执行人记录id"
,
example
=
"10"
,
required
=
true
)
private
Integer
executorId
;
private
Integer
executorId
;
@ApiModelProperty
(
value
=
"意见"
,
example
=
"
MMMMMMMM
"
)
@ApiModelProperty
(
value
=
"意见"
,
example
=
"
同意、拒绝
"
)
private
String
opinion
;
private
String
opinion
;
@ApiModelProperty
(
value
=
"状态 2同意 3拒绝"
,
example
=
"2"
,
required
=
true
)
@NotNull
(
message
=
"sts为空"
)
@ApiModelProperty
(
value
=
"状态 2同意 3拒绝 4转派"
,
example
=
"2"
,
required
=
true
)
private
Integer
sts
;
private
Integer
sts
;
@ApiModelProperty
(
value
=
"被转派人 "
,
example
=
"对象"
)
@ApiModelProperty
(
value
=
"被转派人 "
,
example
=
"对象"
)
private
User
user
;
private
User
user
;
...
...
src/main/java/cn/timer/api/dto/spmk/MySummaryQueryDto.java
View file @
09c63150
package
cn
.
timer
.
api
.
dto
.
spmk
;
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
javax.validation.constraints.DecimalMax
;
import
javax.validation.constraints.DecimalMin
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
cn.timer.api.utils.Page
;
import
cn.timer.api.utils.Page
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -17,7 +22,7 @@ public class MySummaryQueryDto extends Page{
...
@@ -17,7 +22,7 @@ public class MySummaryQueryDto extends Page{
private
Integer
empNum
;
private
Integer
empNum
;
@ApiModelProperty
(
value
=
"关键字"
,
example
=
"请假"
)
@ApiModelProperty
(
value
=
"关键字
标题/审批人名称/审批总汇id
"
,
example
=
"请假"
)
private
String
query
;
private
String
query
;
@ApiModelProperty
(
value
=
"状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝"
,
example
=
"0"
)
@ApiModelProperty
(
value
=
"状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝"
,
example
=
"0"
)
...
@@ -29,6 +34,9 @@ public class MySummaryQueryDto extends Page{
...
@@ -29,6 +34,9 @@ public class MySummaryQueryDto extends Page{
@ApiModelProperty
(
value
=
"结束时间 "
,
example
=
"2020-10-10 10:10:10"
)
@ApiModelProperty
(
value
=
"结束时间 "
,
example
=
"2020-10-10 10:10:10"
)
private
String
endTime
;
private
String
endTime
;
@NotNull
(
message
=
"type为空"
)
@DecimalMax
(
value
=
"2"
,
message
=
"assoType 只能为 0我发起的 1抄送我的 2我审批的"
)
@DecimalMin
(
value
=
"0"
,
message
=
"assoType 只能为 0我发起的 1抄送我的 2我审批的"
)
@ApiModelProperty
(
value
=
"0我发起的 1抄送我的 2我审批的"
,
example
=
"0"
)
@ApiModelProperty
(
value
=
"0我发起的 1抄送我的 2我审批的"
,
example
=
"0"
)
private
Integer
type
;
private
Integer
type
;
...
...
src/main/java/cn/timer/api/dto/spmk/Router.java
View file @
09c63150
...
@@ -3,6 +3,8 @@ package cn.timer.api.dto.spmk;
...
@@ -3,6 +3,8 @@ package cn.timer.api.dto.spmk;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.constraints.Size
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONSupport
;
import
cn.hutool.json.JSONSupport
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
...
src/main/java/cn/timer/api/dto/spmk/SpmkApproveSummaryDto.java
View file @
09c63150
package
cn
.
timer
.
api
.
dto
.
spmk
;
package
cn
.
timer
.
api
.
dto
.
spmk
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
javax.validation.Valid
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
javax.validation.constraints.DecimalMax
;
import
javax.validation.constraints.DecimalMin
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.timer.api.bean.spmk.SpmkApproveSummary
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
/**
* 审批汇总
*/
@Data
@Data
@Builder
@Builder
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
public
class
SpmkApproveSummaryDto
{
public
class
SpmkApproveSummaryDto
{
/*
@NotBlank
(
message
=
"title为空"
)
* 审批汇总
*/
@ApiModelProperty
(
value
=
"标题 "
,
example
=
"标题"
,
required
=
true
)
@ApiModelProperty
(
value
=
"标题 "
,
example
=
"标题"
,
required
=
true
)
private
String
title
;
private
String
title
;
@NotBlank
(
message
=
"approveName为空"
)
@ApiModelProperty
(
value
=
"审批名称 "
,
example
=
"审批名称"
,
required
=
true
)
@ApiModelProperty
(
value
=
"审批名称 "
,
example
=
"审批名称"
,
required
=
true
)
private
String
approveName
;
private
String
approveName
;
@NotBlank
(
message
=
"initiator为空"
)
@ApiModelProperty
(
value
=
"发起人名称 "
,
example
=
"发起人名称"
,
required
=
true
)
@ApiModelProperty
(
value
=
"发起人名称 "
,
example
=
"发起人名称"
,
required
=
true
)
private
String
initiator
;
private
String
initiator
;
@ApiModelProperty
(
value
=
"关联类型 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡 "
,
example
=
"5"
)
@NotNull
(
message
=
"assoType为空"
)
@DecimalMax
(
value
=
"9"
,
message
=
"assoType 只能为 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡"
)
@DecimalMin
(
value
=
"0"
,
message
=
"assoType 只能为 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡"
)
@ApiModelProperty
(
value
=
"关联类型 0无 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡 "
,
example
=
"5"
)
private
Integer
assoType
;
private
Integer
assoType
;
@NotNull
(
message
=
"requestData为空"
)
@ApiModelProperty
(
value
=
"申请数据 "
,
example
=
"申请数据"
,
required
=
true
)
@ApiModelProperty
(
value
=
"申请数据 "
,
example
=
"申请数据"
,
required
=
true
)
private
JSONObject
requestData
;
private
JSONObject
requestData
;
@NotNull
(
message
=
"froms为空"
)
@ApiModelProperty
(
value
=
"审批表单 "
,
example
=
"数组"
,
required
=
true
)
@ApiModelProperty
(
value
=
"审批表单 "
,
example
=
"数组"
,
required
=
true
)
private
List
<
JSONObject
>
froms
;
private
List
<
JSONObject
>
froms
;
@ApiModelProperty
(
value
=
"审批流程 "
,
example
=
"审批流程"
,
required
=
true
)
@NotNull
(
message
=
"router为空"
)
@ApiModelProperty
(
value
=
"审批流程"
,
example
=
"审批流程"
,
required
=
true
)
private
Router
router
;
private
Router
router
;
}
}
src/main/java/cn/timer/api/dto/spmk/SummaryQueryDto.java
View file @
09c63150
...
@@ -18,7 +18,7 @@ public class SummaryQueryDto extends Page{
...
@@ -18,7 +18,7 @@ public class SummaryQueryDto extends Page{
private
Integer
orgCode
;
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"关键字"
,
example
=
"请假"
)
@ApiModelProperty
(
value
=
"关键字
标题/审批人名称/审批总汇id
"
,
example
=
"请假"
)
private
String
query
;
private
String
query
;
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"部门id"
,
example
=
"10"
)
...
...
src/main/java/cn/timer/api/dto/spmk/User.java
View file @
09c63150
...
@@ -23,5 +23,7 @@ public class User implements Serializable{
...
@@ -23,5 +23,7 @@ public class User implements Serializable{
private
String
id
;
private
String
id
;
private
String
execute
;
private
String
execute
;
private
String
headUrl
;
}
}
src/main/java/cn/timer/api/utils/ResultUtil.java
View file @
09c63150
...
@@ -27,7 +27,7 @@ public class ResultUtil<T> {
...
@@ -27,7 +27,7 @@ public class ResultUtil<T> {
private
static
final
String
MESSAGE_UNLOGIN
=
"会话超时,请重新登录"
;
private
static
final
String
MESSAGE_UNLOGIN
=
"会话超时,请重新登录"
;
// private static final String MESSAGE_ERROR = "操作错误";
// private static final String MESSAGE_ERROR = "操作错误";
// private static final String MESSAGE_KICKOUT = "当前账户已在其他地方登录,请重新登录";
// private static final String MESSAGE_KICKOUT = "当前账户已在其他地方登录,请重新登录";
//
private static final String MESSAGE_PARAMERROR = "参数错误";
private
static
final
String
MESSAGE_PARAMERROR
=
"参数错误"
;
// private static final String MESSAGE_UNAUTHORIZED = "授权错误";
// private static final String MESSAGE_UNAUTHORIZED = "授权错误";
// private static final String MESSAGE_UNAUTHENTICATED = "认证错误";
// private static final String MESSAGE_UNAUTHENTICATED = "认证错误";
// private static final String MESSAGE_EXCEPTION = "服务器异常";
// private static final String MESSAGE_EXCEPTION = "服务器异常";
...
@@ -37,7 +37,7 @@ public class ResultUtil<T> {
...
@@ -37,7 +37,7 @@ public class ResultUtil<T> {
// private static final String STATUS_CODE_ERROR = "202";
// private static final String STATUS_CODE_ERROR = "202";
private
static
final
String
STATUS_CODE_UNLOGIN
=
"301"
;
private
static
final
String
STATUS_CODE_UNLOGIN
=
"301"
;
// private static final String STATUS_CODE_KICKOUT = "302";
// private static final String STATUS_CODE_KICKOUT = "302";
//
private static final String STATUS_CODE_UNPARAM = "400";
private
static
final
String
STATUS_CODE_UNPARAM
=
"400"
;
// private static final String STATUS_CODE_UNAUTHORIZED = "401";
// private static final String STATUS_CODE_UNAUTHORIZED = "401";
// private static final String STATUS_CODE_UNAUTHENTICATED = "405";
// private static final String STATUS_CODE_UNAUTHENTICATED = "405";
private
static
final
String
STATUS_CODE_EXCEPTION
=
"500"
;
private
static
final
String
STATUS_CODE_EXCEPTION
=
"500"
;
...
@@ -113,6 +113,13 @@ public class ResultUtil<T> {
...
@@ -113,6 +113,13 @@ public class ResultUtil<T> {
this
.
result
.
setMessage
(
msg
);
this
.
result
.
setMessage
(
msg
);
return
this
.
result
;
return
this
.
result
;
}
}
public
Result
<
T
>
setErrorMsg
(
T
t
)
{
this
.
result
.
setData
(
t
);
this
.
result
.
setCode
(
STATUS_CODE_UNPARAM
);
this
.
result
.
setMessage
(
MESSAGE_PARAMERROR
);
return
this
.
result
;
}
public
Result
<
T
>
setErrorMsg
(
String
msg
)
{
public
Result
<
T
>
setErrorMsg
(
String
msg
)
{
this
.
result
.
setResult
(
false
);
this
.
result
.
setResult
(
false
);
...
@@ -178,5 +185,9 @@ public class ResultUtil<T> {
...
@@ -178,5 +185,9 @@ public class ResultUtil<T> {
public
static
<
T
>
Result
<
T
>
error
(
String
code
,
String
msg
)
{
public
static
<
T
>
Result
<
T
>
error
(
String
code
,
String
msg
)
{
return
new
ResultUtil
<
T
>().
setErrorMsg
(
code
,
msg
);
return
new
ResultUtil
<
T
>().
setErrorMsg
(
code
,
msg
);
}
}
public
static
<
T
>
Result
<
T
>
error
(
T
t
)
{
return
new
ResultUtil
<
T
>().
setErrorMsg
(
t
);
}
}
}
src/main/java/cn/timer/api/utils/router/RouterUtils.java
View file @
09c63150
...
@@ -73,6 +73,7 @@ public class RouterUtils {
...
@@ -73,6 +73,7 @@ public class RouterUtils {
User
userFirst
=
User
.
builder
()
User
userFirst
=
User
.
builder
()
.
name
(
obj
.
get
(
"initiator"
,
FromData
.
class
).
getValue
())
.
name
(
obj
.
get
(
"initiator"
,
FromData
.
class
).
getValue
())
.
id
(
obj
.
get
(
"id"
,
FromData
.
class
).
getValue
())
.
id
(
obj
.
get
(
"id"
,
FromData
.
class
).
getValue
())
.
headUrl
(
obj
.
get
(
"headUrl"
,
FromData
.
class
).
getValue
())
.
execute
(
"0"
)
.
execute
(
"0"
)
.
build
();
.
build
();
users
.
add
(
userFirst
);
users
.
add
(
userFirst
);
...
@@ -342,6 +343,7 @@ public class RouterUtils {
...
@@ -342,6 +343,7 @@ public class RouterUtils {
SpmkExecutor
.
builder
()
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
aer
.
getId
())
.
approveExecuteRecordId
(
aer
.
getId
())
.
empNum
(
Integer
.
parseInt
(
user
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
user
.
getId
()))
.
operatorHeaderUrl
(
user
.
getHeadUrl
())
.
executorName
(
user
.
getName
())
.
executorName
(
user
.
getName
())
.
sts
(
2
)
.
sts
(
2
)
.
build
()
.
build
()
...
@@ -366,6 +368,7 @@ public class RouterUtils {
...
@@ -366,6 +368,7 @@ public class RouterUtils {
SpmkExecutor
executor
=
SpmkExecutor
.
builder
()
SpmkExecutor
executor
=
SpmkExecutor
.
builder
()
.
approveExecuteRecordId
(
aer2
.
getId
())
.
approveExecuteRecordId
(
aer2
.
getId
())
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
operatorHeaderUrl
(
user2
.
getHeadUrl
())
.
executorName
(
user2
.
getName
())
.
executorName
(
user2
.
getName
())
.
build
();
.
build
();
switch
(
user2
.
getExecute
())
{
switch
(
user2
.
getExecute
())
{
...
@@ -404,6 +407,7 @@ public class RouterUtils {
...
@@ -404,6 +407,7 @@ public class RouterUtils {
.
approveExecuteRecordId
(
aer3
.
getId
())
.
approveExecuteRecordId
(
aer3
.
getId
())
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
executorName
(
user2
.
getName
())
.
executorName
(
user2
.
getName
())
.
operatorHeaderUrl
(
user2
.
getHeadUrl
())
.
sts
(
2
)
.
sts
(
2
)
.
build
();
.
build
();
executor
.
insert
();
executor
.
insert
();
...
@@ -443,6 +447,7 @@ public class RouterUtils {
...
@@ -443,6 +447,7 @@ public class RouterUtils {
.
opinion
(
opinion
)
.
opinion
(
opinion
)
.
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
())
.
sts
(
sts
)
.
sts
(
sts
)
.
build
()
.
build
()
.
updateById
();
.
updateById
();
...
@@ -476,6 +481,7 @@ public class RouterUtils {
...
@@ -476,6 +481,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
())
.
sts
(
1
)
.
sts
(
1
)
.
build
()
.
build
()
.
insert
();
.
insert
();
...
@@ -522,6 +528,7 @@ public class RouterUtils {
...
@@ -522,6 +528,7 @@ public class RouterUtils {
.
approveExecuteRecordId
(
aer
.
getId
())
.
approveExecuteRecordId
(
aer
.
getId
())
.
empNum
(
Integer
.
parseInt
(
user
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
user
.
getId
()))
.
executorName
(
user
.
getName
())
.
executorName
(
user
.
getName
())
.
operatorHeaderUrl
(
user
.
getHeadUrl
())
.
sts
(
2
)
.
sts
(
2
)
.
build
()
.
build
()
.
insert
();
.
insert
();
...
@@ -545,6 +552,7 @@ public class RouterUtils {
...
@@ -545,6 +552,7 @@ public class RouterUtils {
.
approveExecuteRecordId
(
aer2
.
getId
())
.
approveExecuteRecordId
(
aer2
.
getId
())
.
empNum
(
Integer
.
parseInt
(
listUser
.
get
(
i_user2
).
getId
()))
.
empNum
(
Integer
.
parseInt
(
listUser
.
get
(
i_user2
).
getId
()))
.
executorName
(
listUser
.
get
(
i_user2
).
getName
())
.
executorName
(
listUser
.
get
(
i_user2
).
getName
())
.
operatorHeaderUrl
(
listUser
.
get
(
i_user2
).
getHeadUrl
())
.
sts
(
1
)
.
sts
(
1
)
.
build
();
.
build
();
executor
.
insert
();
executor
.
insert
();
...
@@ -576,6 +584,7 @@ public class RouterUtils {
...
@@ -576,6 +584,7 @@ public class RouterUtils {
.
approveExecuteRecordId
(
aer3
.
getId
())
.
approveExecuteRecordId
(
aer3
.
getId
())
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
empNum
(
Integer
.
parseInt
(
user2
.
getId
()))
.
executorName
(
user2
.
getName
())
.
executorName
(
user2
.
getName
())
.
operatorHeaderUrl
(
user2
.
getHeadUrl
())
.
sts
(
2
)
.
sts
(
2
)
.
build
();
.
build
();
executor
.
insert
();
executor
.
insert
();
...
...
src/main/resources/mapping/spmk/SpmkApproveSummaryMapper.xml
View file @
09c63150
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
and a.create_time
<![CDATA[ >= ]]>
#{param.startTime}
and a.create_time
<![CDATA[ >= ]]>
#{param.startTime}
</if>
</if>
<if
test=
"param.endTime != null and param.endTime != ''"
>
<if
test=
"param.endTime != null and param.endTime != ''"
>
and
qlb
.create_time
<![CDATA[ <= ]]>
#{param.endTime}
and
a
.create_time
<![CDATA[ <= ]]>
#{param.endTime}
</if>
</if>
<if
test=
"param.empNums != null and param.empNums.size() > 0"
>
<if
test=
"param.empNums != null and param.empNums.size() > 0"
>
and a.emp_num IN
and a.emp_num IN
...
@@ -125,7 +125,8 @@
...
@@ -125,7 +125,8 @@
(SELECT approve_summary_id FROM spmk_approve_execute_record WHERE id IN
(SELECT approve_summary_id FROM spmk_approve_execute_record WHERE id IN
(SELECT approve_execute_record_id FROM spmk_executor WHERE emp_num = #{param.empNum})
(SELECT approve_execute_record_id FROM spmk_executor WHERE emp_num = #{param.empNum})
and type = #{param.type}
and type = #{param.type}
)
)
and a.sts
<![CDATA[ <> ]]>
1
</if>
</if>
<if
test=
"param.type != null and param.type == 0"
>
<if
test=
"param.type != null and param.type == 0"
>
...
@@ -146,7 +147,7 @@
...
@@ -146,7 +147,7 @@
and a.create_time
<![CDATA[ >= ]]>
#{param.startTime}
and a.create_time
<![CDATA[ >= ]]>
#{param.startTime}
</if>
</if>
<if
test=
"param.endTime != null and param.endTime != ''"
>
<if
test=
"param.endTime != null and param.endTime != ''"
>
and
qlb
.create_time
<![CDATA[ <= ]]>
#{param.endTime}
and
a
.create_time
<![CDATA[ <= ]]>
#{param.endTime}
</if>
</if>
ORDER BY a.id DESC
ORDER BY a.id DESC
</select>
</select>
...
...
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