Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
work_service
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
work_service
Commits
c3104827
Commit
c3104827
authored
Jan 28, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
74a4a493
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
27 deletions
+35
-27
ProjectInfoDto.java
.../src/main/java/cn/wisenergy/model/dto/ProjectInfoDto.java
+2
-2
WorkProjectService.java
...rc/main/java/cn/wisenergy/service/WorkProjectService.java
+1
-1
WorkProjectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
+2
-2
WorkTimeOrderServiceImpl.java
...a/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
+22
-19
Examine.java
...n/src/main/java/cn/wisenergy/web/config/auto/Examine.java
+8
-3
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/dto/ProjectInfoDto.java
View file @
c3104827
...
...
@@ -24,8 +24,8 @@ public class ProjectInfoDto {
@ApiModelProperty
(
name
=
"typeName"
,
value
=
"类型名称"
)
private
String
typeName
;
@ApiModelProperty
(
name
=
"
m
anagerName"
,
value
=
"部门经理姓名"
)
private
String
m
anagerName
;
@ApiModelProperty
(
name
=
"
deptM
anagerName"
,
value
=
"部门经理姓名"
)
private
String
deptM
anagerName
;
private
List
<
ProjectDto
>
projectDto
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/WorkProjectService.java
View file @
c3104827
...
...
@@ -23,7 +23,7 @@ public interface WorkProjectService {
WorkProject
getById
(
Integer
id
);
List
<
ProjectDto
>
getNameById
(
List
<
Integer
>
ids
);
List
<
WorkProject
>
getNameById
(
List
<
Integer
>
ids
);
/**
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
View file @
c3104827
...
...
@@ -69,7 +69,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
}
@Override
public
List
<
ProjectDto
>
getNameById
(
List
<
Integer
>
ids
)
{
public
List
<
WorkProject
>
getNameById
(
List
<
Integer
>
ids
)
{
log
.
info
(
"WorkProjectServiceImpl[]getNameById[]input.param.ids:"
+
ids
);
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
...
...
@@ -78,7 +78,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
if
(
CollectionUtils
.
isEmpty
(
workProjects
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
MANAGER_NOT_PROJECT
);
}
return
workProject
ToDto
(
workProjects
)
;
return
workProject
s
;
}
/**
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
View file @
c3104827
...
...
@@ -369,7 +369,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
for
(
int
j
=
i
+
1
;
j
<
size
;
j
++)
{
if
(
list
.
get
(
i
).
getType
().
equals
(
list
.
get
(
j
).
getType
()))
{
if
(
null
!=
list
.
get
(
i
).
getProjectId
()
&&
null
!=
list
.
get
(
j
).
getProjectId
()
&&
list
.
get
(
i
).
getProjectId
().
equals
(
list
.
get
(
j
).
getProjectId
()))
{
if
(
null
!=
list
.
get
(
i
).
getProjectId
()
&&
null
!=
list
.
get
(
j
).
getProjectId
()
&&
!
list
.
get
(
i
).
getProjectId
().
equals
(
list
.
get
(
j
).
getProjectId
()))
{
continue
;
}
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
...
...
@@ -617,6 +617,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 获取可以填报的数据
private
List
<
ProjectInfoDto
>
getProjectInfoDto
(
Integer
userId
)
{
// 获取该用户参与的项目
List
<
Integer
>
projectIds
=
workUserProjectService
.
getProjectIdByUserId
(
userId
);
// 1.获取当前用户的部门管理
...
...
@@ -625,8 +626,25 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
String
deptManagerName
=
workUserService
.
getById
(
workDeptService
.
getById
(
deptId
).
getDeptManagerId
()).
getName
();
// 2.获取可填报的类型
List
<
ProjectInfoDto
>
projectList
=
new
ArrayList
<>();
ProjectInfoDto
projectInfoDto1
=
new
ProjectInfoDto
().
setType
(
PROJECT
).
setTypeName
(
getTypeName
(
PROJECT
)).
setManagerName
(
deptManagerName
);
ProjectInfoDto
projectInfoDto2
=
new
ProjectInfoDto
().
setType
(
BUSINESS_OPPORTUNITY
).
setTypeName
(
getTypeName
(
BUSINESS_OPPORTUNITY
)).
setManagerName
(
deptManagerName
);
List
<
WorkProject
>
projects
=
workProjectService
.
getNameById
(
projectIds
);
ProjectInfoDto
projectInfoDto
;
for
(
ProjectTypeEnum
value
:
ProjectTypeEnum
.
values
())
{
projectInfoDto
=
new
ProjectInfoDto
().
setType
(
value
.
getType
()).
setTypeName
(
value
.
getTypeName
()).
setDeptManagerName
(
deptManagerName
);
if
(
1
==
value
.
getReviewer
())
{
List
<
ProjectDto
>
projectDtos
=
new
ArrayList
<>();
for
(
WorkProject
project
:
projects
)
{
if
(
project
.
getType
().
equals
(
value
.
getType
()))
{
ProjectDto
projectDto
=
new
ProjectDto
();
BeanUtils
.
copyProperties
(
project
,
projectDto
);
projectDto
.
setManagerName
(
workUserService
.
getById
(
project
.
getManagerId
()).
getName
());
projectDtos
.
add
(
projectDto
);
}
}
projectInfoDto
.
setProjectDto
(
projectDtos
);
projectList
.
add
(
projectInfoDto
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
projectIds
))
{
List
<
ProjectDto
>
projectDto1
=
new
ArrayList
<>();
List
<
ProjectDto
>
projectDto2
=
new
ArrayList
<>();
...
...
@@ -640,18 +658,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
projectDto2
.
add
(
projectToProjectDto
(
workProject
));
}
}
if
(!
CollectionUtils
.
isEmpty
(
projectDto1
))
projectInfoDto1
.
setProjectDto
(
projectDto1
);
if
(!
CollectionUtils
.
isEmpty
(
projectDto2
))
projectInfoDto2
.
setProjectDto
(
projectDto2
);
}
projectList
.
add
(
projectInfoDto1
);
projectList
.
add
(
projectInfoDto2
);
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
LEAVE
).
setTypeName
(
getTypeName
(
LEAVE
)).
setManagerName
(
deptManagerName
));
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
COMPENSATORY_LEAVE
).
setTypeName
(
getTypeName
(
COMPENSATORY_LEAVE
)).
setManagerName
(
deptManagerName
));
List
<
WorkType
>
workTypes
=
workTypeService
.
getByDeptId
(
deptId
);
for
(
WorkType
workType
:
workTypes
)
{
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
workType
.
getType
()).
setTypeName
(
workType
.
getName
()).
setManagerName
(
workUserService
.
getById
(
workType
.
getManagerId
()).
getName
()));
}
return
projectList
;
}
...
...
@@ -703,8 +710,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
}
// 判断是否重复填报
isRepeat
(
list
);
// 4.每天工时累加不得超过八小时
...
...
@@ -928,9 +933,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
public
int
statusYes
(
Integer
userId
,
Date
workDay
)
{
int
status
=
PROJECT
;
int
size
=
0
;
List
<
WorkTimeOrder
>
workTimeOrderDtos
=
workTimeOrderMapper
.
getByDay
(
userId
,
workDay
);
for
(
WorkTimeOrder
dto
:
workTimeOrderDtos
)
{
if
(
APPROVED
.
equals
(
dto
.
getStatus
())
||
AUTOMATIC_AUDIT
.
equals
(
dto
.
getStatus
()))
{
size
++;
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/auto/Examine.java
View file @
c3104827
...
...
@@ -10,6 +10,7 @@ import cn.wisenergy.mapper.WorkSubmitAdoptMapper;
import
cn.wisenergy.mapper.WorkTimeOrderMapper
;
import
cn.wisenergy.model.app.WorkSubmitAdopt
;
import
cn.wisenergy.model.app.WorkTimeOrder
;
import
cn.wisenergy.model.enums.StatusEnum
;
import
cn.wisenergy.service.WorkCollectService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
...
...
@@ -41,6 +42,10 @@ public class Examine {
@Autowired
private
WorkSubmitAdoptMapper
workSubmitAdoptMapper
;
private
final
static
Integer
COMPLETED
=
StatusEnum
.
COMPLETED
.
getCode
();
private
final
static
Integer
RE_SUBMIT
=
StatusEnum
.
RE_SUBMIT
.
getCode
();
private
final
static
Integer
AUTOMATIC_AUDIT
=
StatusEnum
.
AUTOMATIC_AUDIT
.
getCode
();
// 每天凌晨自动审核
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
public
void
autoExamine
()
{
...
...
@@ -53,14 +58,14 @@ public class Examine {
Date
yesterdayDate
=
getAutoExamineDay
(
autoAdopt
);
Date
now
=
DateUtil
.
getToday
();
QueryWrapper
<
WorkTimeOrder
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
in
(
"status"
,
1
,
4
);
wrapper
.
in
(
"status"
,
COMPLETED
,
RE_SUBMIT
);
wrapper
.
le
(
"work_day"
,
yesterdayDate
);
List
<
WorkTimeOrder
>
workTimeOrders
=
workTimeOrderMapper
.
selectList
(
wrapper
);
UpdateWrapper
<
WorkTimeOrder
>
wtoWrapper
=
new
UpdateWrapper
<>();
wtoWrapper
.
in
(
"status"
,
1
,
4
);
wtoWrapper
.
in
(
"status"
,
COMPLETED
,
RE_SUBMIT
);
wtoWrapper
.
le
(
"work_day"
,
yesterdayDate
);
WorkTimeOrder
workTimeOrder1
=
new
WorkTimeOrder
();
workTimeOrder1
.
setStatus
(
5
);
workTimeOrder1
.
setStatus
(
AUTOMATIC_AUDIT
);
workTimeOrder1
.
setModifyTime
(
now
);
int
wtoRow
=
workTimeOrderMapper
.
update
(
workTimeOrder1
,
wtoWrapper
);
System
.
out
.
println
(
"一共审核:"
+
wtoRow
+
"条工单"
);
...
...
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