Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
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
82c188ac
Commit
82c188ac
authored
Jan 28, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
c632f362
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
85 deletions
+123
-85
ProjectTypeEnum.java
...c/main/java/cn/wisenergy/model/enums/ProjectTypeEnum.java
+27
-11
StatusEnum.java
...el/src/main/java/cn/wisenergy/model/enums/StatusEnum.java
+32
-0
WorkTimeOrderServiceImpl.java
...a/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
+64
-74
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/enums/ProjectTypeEnum.java
View file @
82c188ac
package
cn
.
wisenergy
.
model
.
enums
;
public
enum
ProjectTypeEnum
{
PROJECT
(
1
,
"项目"
),
BUSINESS_OPPORTUNITY
(
2
,
"商机"
);
PROJECT
(
1
,
"项目"
,
1
),
BUSINESS_OPPORTUNITY
(
2
,
"商机"
,
1
),
LEAVE
(
3
,
"请假"
,
2
),
COMPENSATORY_LEAVE
(
4
,
"调休"
,
2
),
EXTERNAL_BUSINESS
(
5
,
"外部商务与技术交流"
,
3
),
INTERNAL_TRAINING
(
6
,
"内部培训、技术准备、管理"
,
3
),
OTHER_NON_PROJECTS
(
7
,
"其他非项目/商机工作"
,
3
),
private
Integer
code
;
private
String
msg
;
ProjectTypeEnum
(
Integer
code
,
String
msg
){
this
.
code
=
code
;
this
.
msg
=
msg
;
;
private
Integer
type
;
private
String
typeName
;
// 1:项目经理 2:自动审批 3:其他管理员
private
Integer
reviewer
;
ProjectTypeEnum
(
Integer
type
,
String
typeName
,
Integer
reviewer
)
{
this
.
reviewer
=
reviewer
;
this
.
type
=
type
;
this
.
typeName
=
typeName
;
}
public
Integer
getType
()
{
return
type
;
}
public
Integer
getCode
()
{
return
cod
e
;
public
String
getTypeName
()
{
return
typeNam
e
;
}
public
String
getMsg
()
{
return
msg
;
public
Integer
getReviewer
()
{
return
reviewer
;
}
}
wisenergy-model/src/main/java/cn/wisenergy/model/enums/StatusEnum.java
0 → 100644
View file @
82c188ac
package
cn
.
wisenergy
.
model
.
enums
;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
public
enum
StatusEnum
{
COMPLETED
(
1
,
"已填报"
),
APPROVED
(
2
,
"已审批"
),
REJECTED
(
3
,
"被驳回"
),
RE_SUBMIT
(
4
,
"重新填报"
),
AUTOMATIC_AUDIT
(
5
,
"自动审批"
)
;
private
Integer
status
;
private
String
msg
;
StatusEnum
(
Integer
status
,
String
msg
){
this
.
status
=
status
;
this
.
msg
=
msg
;
}
public
Integer
getCode
(){
return
status
;
}
public
String
getMsg
(){
return
msg
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
View file @
82c188ac
...
...
@@ -6,6 +6,8 @@ import cn.wisenergy.common.utils.exception.BaseCustomException;
import
cn.wisenergy.mapper.WorkTimeOrderMapper
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.dto.*
;
import
cn.wisenergy.model.enums.ProjectTypeEnum
;
import
cn.wisenergy.model.enums.StatusEnum
;
import
cn.wisenergy.service.*
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -63,6 +65,20 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
@Autowired
private
WorkTypeService
workTypeService
;
//填报类型
private
final
static
Integer
PROJECT
=
ProjectTypeEnum
.
PROJECT
.
getType
();
private
final
static
Integer
BUSINESS_OPPORTUNITY
=
ProjectTypeEnum
.
BUSINESS_OPPORTUNITY
.
getType
();
private
final
static
Integer
LEAVE
=
ProjectTypeEnum
.
LEAVE
.
getType
();
private
final
static
Integer
COMPENSATORY_LEAVE
=
ProjectTypeEnum
.
COMPENSATORY_LEAVE
.
getType
();
private
final
static
Integer
EXTERNAL_BUSINESS
=
ProjectTypeEnum
.
EXTERNAL_BUSINESS
.
getType
();
private
final
static
Integer
INTERNAL_TRAINING
=
ProjectTypeEnum
.
INTERNAL_TRAINING
.
getType
();
private
final
static
Integer
OTHER_NON_PROJECTS
=
ProjectTypeEnum
.
OTHER_NON_PROJECTS
.
getType
();
// 工单状态
private
final
static
Integer
COMPLETED
=
StatusEnum
.
COMPLETED
.
getCode
();
private
final
static
Integer
APPROVED
=
StatusEnum
.
APPROVED
.
getCode
();
private
final
static
Integer
REJECTED
=
StatusEnum
.
REJECTED
.
getCode
();
private
final
static
Integer
RE_SUBMIT
=
StatusEnum
.
RE_SUBMIT
.
getCode
();
private
final
static
Integer
AUTOMATIC_AUDIT
=
StatusEnum
.
AUTOMATIC_AUDIT
.
getCode
();
/**
* 功能; 获取某日填报情况
...
...
@@ -72,6 +88,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
* @return 工单集合
*/
@Override
public
List
<
WorkTimeOrder
>
getByDay
(
Integer
userId
,
Date
workDay
)
{
log
.
info
(
"WorkTimeOrderServiceImpl[]getByDay[]input.param.userId:{},workDay:{}"
+
userId
,
workDay
);
...
...
@@ -82,6 +99,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if
(
CollectionUtils
.
isEmpty
(
workTimeOrders
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_INFO_IS_NULL
);
}
return
workTimeOrders
;
}
...
...
@@ -117,7 +135,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if
(
null
!=
wto
.
getReason
())
{
reason
=
workProjectService
.
getById
(
wto
.
getProjectId
()).
getProjectName
()
+
":"
+
wto
.
getReason
()
+
";"
;
}
if
(
3
==
wto
.
getStatus
(
))
{
if
(
REJECTED
.
equals
(
wto
.
getStatus
()
))
{
rejectMonth
+=
1
;
}
}
...
...
@@ -171,8 +189,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
/**
* 功能:测试添加
*
* @param createWorkOrderDto
* @return
* @param createWorkOrderDto
dto
* @return
dto
*/
@Transactional
@Override
...
...
@@ -204,27 +222,28 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if
(
date
.
getTime
()
-
dto
.
getWorkDay
().
getTime
()
>
submitTime
*
24
*
60
*
60
*
1000
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_DAY_THAN_DATE
);
}
// 获取某些数据
Integer
type
=
dto
.
getType
();
dto
.
setUserName
(
workUserService
.
getById
(
dto
.
getUserId
()).
getName
());
dto
.
setTypeName
(
getTypeName
(
type
));
if
(
1
==
type
||
2
==
type
)
{
if
(
PROJECT
.
equals
(
type
)
||
BUSINESS_OPPORTUNITY
.
equals
(
type
)
)
{
dto
.
setProjectName
(
workProjectService
.
getById
(
dto
.
getProjectId
()).
getProjectName
());
dto
.
setManagerName
(
workUserService
.
getById
(
workProjectService
.
getById
(
dto
.
getProjectId
()).
getManagerId
()).
getName
());
}
if
(
1
!=
type
&&
2
!=
type
)
{
if
(
!
PROJECT
.
equals
(
type
)
&&
!
BUSINESS_OPPORTUNITY
.
equals
(
type
)
)
{
dto
.
setManagerName
(
workUserService
.
getById
(
workTypeService
.
getByDeptId
(
workUserService
.
getById
(
dto
.
getUserId
()).
getDeptId
()).
get
(
0
).
getManagerId
()).
getName
());
}
if
(
null
==
dto
.
getStatus
()
||
0
==
dto
.
getStatus
())
{
dto
.
setStatus
(
1
);
dto
.
setStatus
(
COMPLETED
);
}
if
(
3
==
type
||
4
==
type
)
{
dto
.
setStatus
(
2
);
if
(
LEAVE
.
equals
(
type
)
||
COMPENSATORY_LEAVE
.
equals
(
type
)
)
{
dto
.
setStatus
(
APPROVED
);
}
if
(
null
!=
dto
.
getStatus
()
&&
3
==
dto
.
getStatus
(
))
{
dto
.
setStatus
(
4
);
if
(
null
!=
dto
.
getStatus
()
&&
REJECTED
.
equals
(
dto
.
getStatus
()
))
{
dto
.
setStatus
(
RE_SUBMIT
);
}
dto
.
setIsOvertime
(
0
);
...
...
@@ -312,7 +331,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
// 填报和数据库的类型相同
if
(
workTimeOrder
.
getType
().
equals
(
orderDto
.
getType
()))
{
if
(
1
==
workTimeOrder
.
getType
()
||
2
==
workTimeOrder
.
getType
(
))
if
(
PROJECT
.
equals
(
workTimeOrder
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
workTimeOrder
.
getType
()
))
if
(
workTimeOrder
.
getProjectId
().
equals
(
orderDto
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
...
...
@@ -385,7 +404,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
* @param userId 用户id
* @param projectId 项目Id
* @param type 类型
* @return
* @return
dto
*/
@Override
public
List
<
AppletsPendApprovalDto
>
getExamineApplets
(
Integer
userId
,
Integer
projectId
,
Integer
type
)
{
...
...
@@ -397,7 +416,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
QueryWrapper
<
WorkTimeOrder
>
wrapper
=
new
QueryWrapper
<>();
projectId
=
projectId
==
null
?
workProjectService
.
getByManagerId
(
userId
).
get
(
0
).
getId
()
:
projectId
;
// wrapper.eq("dept_id", user.getDeptId());
wrapper
.
in
(
"status"
,
1
,
4
);
wrapper
.
in
(
"status"
,
COMPLETED
,
RE_SUBMIT
);
wrapper
.
eq
(
"project_id"
,
projectId
);
wrapper
.
orderByDesc
(
"work_day"
);
List
<
WorkTimeOrder
>
workTimeOrders
=
workTimeOrderMapper
.
selectList
(
wrapper
);
...
...
@@ -413,7 +432,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
Integer
deptId
=
user
.
getDeptId
();
QueryWrapper
<
WorkTimeOrder
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"dept_id"
,
deptId
);
wrapper
.
in
(
"status"
,
1
,
4
);
wrapper
.
in
(
"status"
,
COMPLETED
,
RE_SUBMIT
);
wrapper
.
eq
(
"type"
,
type
);
List
<
WorkTimeOrder
>
workTimeOrders
=
workTimeOrderMapper
.
selectList
(
wrapper
);
if
(
CollectionUtils
.
isEmpty
(
workTimeOrders
))
{
...
...
@@ -450,7 +469,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
BeanUtils
.
copyProperties
(
workTimeOrder
,
workTimeOrderDto
);
workTimeOrderDto
.
setManagerName
(
workUserService
.
getById
(
workTypeService
.
getByDeptId
(
workTimeOrder
.
getDeptId
()).
get
(
0
).
getManagerId
()).
getName
());
workTimeOrderDto
.
setUserName
(
workUserService
.
getById
(
workTimeOrderDto
.
getUserId
()).
getName
());
if
(
1
==
workTimeOrder
.
getType
()
||
2
==
workTimeOrder
.
getType
(
))
{
if
(
PROJECT
.
equals
(
workTimeOrder
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
workTimeOrder
.
getType
()
))
{
workTimeOrderDto
.
setProjectName
(
workProjectService
.
getById
(
workTimeOrderDto
.
getProjectId
()).
getProjectName
());
workTimeOrderDto
.
setManagerName
(
workUserService
.
getById
(
workProjectService
.
getById
(
workTimeOrderDto
.
getProjectId
()).
getManagerId
()).
getName
());
}
...
...
@@ -527,7 +546,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if
(
null
==
workCollect
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_INFO_IS_NULL
);
}
workCollect
.
setStatus
(
3
);
workCollect
.
setStatus
(
REJECTED
);
return
workCollectService
.
update
(
workCollect
);
}
...
...
@@ -544,7 +563,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
isManager
(
userId
);
QueryWrapper
<
WorkTimeOrder
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"reviewer_id"
,
userId
);
wrapper
.
eq
(
"status"
,
3
);
wrapper
.
eq
(
"status"
,
REJECTED
);
List
<
WorkTimeOrder
>
workTimeOrders
=
workTimeOrderMapper
.
selectList
(
wrapper
);
if
(
CollectionUtils
.
isEmpty
(
workTimeOrders
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_INFO_IS_NULL
);
...
...
@@ -556,8 +575,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
/**
* 功能:获取用户参与的项目
*
* @param userId
* @return
* @param userId
用户id
* @return
dto
*/
@Override
public
ProjectsDto
getProjectDto
(
Integer
userId
)
{
...
...
@@ -606,18 +625,18 @@ 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
(
1
).
setTypeName
(
getTypeName
(
1
)).
setManagerName
(
deptManagerName
);
ProjectInfoDto
projectInfoDto2
=
new
ProjectInfoDto
().
setType
(
2
).
setTypeName
(
getTypeName
(
2
)).
setManagerName
(
deptManagerName
);
ProjectInfoDto
projectInfoDto1
=
new
ProjectInfoDto
().
setType
(
PROJECT
).
setTypeName
(
getTypeName
(
PROJECT
)).
setManagerName
(
deptManagerName
);
ProjectInfoDto
projectInfoDto2
=
new
ProjectInfoDto
().
setType
(
BUSINESS_OPPORTUNITY
).
setTypeName
(
getTypeName
(
BUSINESS_OPPORTUNITY
)).
setManagerName
(
deptManagerName
);
if
(!
CollectionUtils
.
isEmpty
(
projectIds
))
{
List
<
ProjectDto
>
projectDto1
=
new
ArrayList
<>();
List
<
ProjectDto
>
projectDto2
=
new
ArrayList
<>();
WorkProject
workProject
;
for
(
Integer
projectId
:
projectIds
)
{
workProject
=
workProjectService
.
getById
(
projectId
);
if
(
1
==
workProject
.
getType
(
))
{
if
(
PROJECT
.
equals
(
workProject
.
getType
()
))
{
projectDto1
.
add
(
projectToProjectDto
(
workProject
));
}
if
(
2
==
workProject
.
getType
(
))
{
if
(
BUSINESS_OPPORTUNITY
.
equals
(
workProject
.
getType
()
))
{
projectDto2
.
add
(
projectToProjectDto
(
workProject
));
}
}
...
...
@@ -628,13 +647,12 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
projectList
.
add
(
projectInfoDto1
);
projectList
.
add
(
projectInfoDto2
);
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
3
).
setTypeName
(
getTypeName
(
3
)).
setManagerName
(
deptManagerName
));
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
4
).
setTypeName
(
getTypeName
(
4
)).
setManagerName
(
deptManagerName
));
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
;
}
...
...
@@ -655,7 +673,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
BeanUtils
.
copyProperties
(
workTimeOrder
,
dto
);
dto
.
setUserName
(
workUserService
.
getById
(
workTimeOrder
.
getUserId
()).
getName
());
dto
.
setManagerName
(
workUserService
.
getById
(
workTypeService
.
getByDeptId
(
workTimeOrder
.
getDeptId
()).
get
(
0
).
getManagerId
()).
getName
());
if
(
1
==
workTimeOrder
.
getType
()
||
2
==
workTimeOrder
.
getType
(
))
{
if
(
PROJECT
.
equals
(
workTimeOrder
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
workTimeOrder
.
getType
()
))
{
dto
.
setProjectName
(
workProjectService
.
getById
(
workTimeOrder
.
getProjectId
()).
getProjectName
());
dto
.
setManagerName
(
getManagerNameByOrder
(
workTimeOrder
));
}
...
...
@@ -666,29 +684,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
private
List
<
ExamineGroupbyProjectDto
>
getExamineGroupByProjectDto
(
Integer
projectId
)
{
QueryWrapper
<
WorkTimeOrder
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
"project_id"
,
projectId
);
wrapper
.
in
(
"status"
,
1
,
4
);
wrapper
.
orderByDesc
(
"work_day"
);
List
<
WorkTimeOrder
>
workTimeOrders
=
workTimeOrderMapper
.
selectList
(
wrapper
);
return
WorkTimeOrderTOEGPD
(
workTimeOrders
);
}
private
List
<
ExamineGroupbyProjectDto
>
WorkTimeOrderTOEGPD
(
List
<
WorkTimeOrder
>
workTimeOrders
)
{
if
(
CollectionUtils
.
isEmpty
(
workTimeOrders
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_END
);
}
List
<
ExamineGroupbyProjectDto
>
egpds
=
new
ArrayList
<>();
for
(
WorkTimeOrder
workTimeOrder
:
workTimeOrders
)
{
ExamineGroupbyProjectDto
dto
=
new
ExamineGroupbyProjectDto
();
BeanUtils
.
copyProperties
(
workTimeOrder
,
dto
);
egpds
.
add
(
dto
);
}
return
egpds
;
}
private
void
checkWorkOrderInfo
(
List
<
WorkTimeOrderDto
>
list
)
{
log
.
info
(
"WorkOrderServiceImpl[]checkWorkOrderInfo[]input.method"
);
// 1、工单时间不能大于当前天
...
...
@@ -773,14 +768,14 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if
(
new
Date
().
getTime
()
-
DateUtil
.
getStartOfDay
(
modifyTime
).
getTime
()
>
submitTime
*
24
*
60
*
60
*
1000
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_DAY_THAN_DATE
);
}
workTimeOrderDto
.
setStatus
(
4
);
workTimeOrderDto
.
setStatus
(
RE_SUBMIT
);
WorkTimeOrder
workTimeOrder
=
new
WorkTimeOrder
();
BeanUtils
.
copyProperties
(
workTimeOrderDto
,
workTimeOrder
);
// 获取用户名
workTimeOrderDto
.
setUserName
(
workUserService
.
getById
(
workTimeOrder
.
getUserId
()).
getName
());
// 获取项目名
if
(
1
==
workTimeOrder
.
getType
()
||
2
==
workTimeOrder
.
getType
(
))
{
if
(
PROJECT
.
equals
(
workTimeOrder
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
workTimeOrder
.
getType
()
))
{
workTimeOrderDto
.
setProjectName
(
workProjectService
.
getById
(
workTimeOrder
.
getProjectId
()).
getProjectName
());
}
// 获取类型名
...
...
@@ -805,7 +800,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
private
List
<
WorkTimeOrderDto
>
saveWorkOrderInfo
(
List
<
WorkTimeOrderDto
>
list
)
{
log
.
info
(
"WorkOrderServiceImpl[]saveWorkOrderInfo[]input.method"
);
int
totalTime
=
0
;
int
status
=
1
;
int
status
=
PROJECT
;
//根据用户id,获取用户信息
for
(
WorkTimeOrderDto
dto
:
list
)
{
...
...
@@ -813,7 +808,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 获取用户名
dto
.
setUserName
(
workUserService
.
getById
(
dto
.
getUserId
()).
getName
());
// 获取项目名
if
((
1
==
dto
.
getType
()
||
2
==
dto
.
getType
(
))
&&
null
==
dto
.
getProjectId
())
{
if
((
PROJECT
.
equals
(
dto
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
dto
.
getType
()
))
&&
null
==
dto
.
getProjectId
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NO_JOIN_EVERY_PROJECT_PLASE_JION
);
}
dto
.
setProjectName
(
null
!=
dto
.
getProjectId
()
?
workProjectService
.
getById
(
dto
.
getProjectId
()).
getProjectName
()
:
getTypeName
(
dto
.
getType
()));
...
...
@@ -833,8 +828,8 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
dto
.
setStatus
(
status
);
// 如果是请假或者调休直接通过
if
(
3
==
dto
.
getType
()
||
4
==
dto
.
getType
(
))
{
dto
.
setStatus
(
2
);
if
(
LEAVE
.
equals
(
dto
.
getType
())
||
COMPENSATORY_LEAVE
.
equals
(
dto
.
getType
()
))
{
dto
.
setStatus
(
APPROVED
);
dto
.
setProjectName
(
null
);
dto
.
setProjectId
(
null
);
}
...
...
@@ -890,18 +885,17 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
workTimeOrderDtos
.
add
(
workTimeOrderDto
);
}
PageInfo
<
WorkTimeOrderDto
>
pageInfo
=
new
PageInfo
<>(
workTimeOrderDtos
);
return
pageInfo
;
return
new
PageInfo
<>(
workTimeOrderDtos
);
}
// 根据工单获取管理员
private
String
getManagerNameByOrder
(
WorkTimeOrder
wto
)
{
if
(
1
==
wto
.
getType
()
||
2
==
wto
.
getType
(
))
{
if
(
PROJECT
.
equals
(
wto
.
getType
())
||
BUSINESS_OPPORTUNITY
.
equals
(
wto
.
getType
()
))
{
WorkProject
workProject
=
workProjectService
.
getById
(
wto
.
getProjectId
());
return
workProject
!=
null
?
workUserService
.
getById
(
workProject
.
getManagerId
()).
getName
()
:
""
;
}
if
(
1
!=
wto
.
getType
()
&&
2
!=
wto
.
getType
(
))
{
if
(
!
PROJECT
.
equals
(
wto
.
getType
())
&&
!
PROJECT
.
equals
(
wto
.
getType
()
))
{
return
workUserService
.
getById
(
workDeptService
.
getById
(
wto
.
getDeptId
()).
getDeptManagerId
())
.
getName
();
...
...
@@ -922,35 +916,31 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
private
String
getTypeName
(
Integer
type
)
{
List
<
WorkType
>
types
=
workTypeService
.
getType
();
String
[]
str
=
{
""
,
"项目"
,
"商机"
,
"请假"
,
"调休"
};
Map
<
Integer
,
String
>
map
=
new
HashMap
<>();
for
(
int
i
=
1
;
i
<
str
.
length
;
i
++)
{
map
.
put
(
i
,
str
[
i
]);
for
(
ProjectTypeEnum
value
:
ProjectTypeEnum
.
values
())
{
if
(
value
.
getType
().
equals
(
type
))
{
return
value
.
getTypeName
();
}
for
(
WorkType
workType
:
types
)
{
map
.
put
(
workType
.
getType
(),
workType
.
getName
());
}
return
map
.
get
(
type
)
;
return
null
;
}
// 判断当天是否全部审批通过
public
int
statusYes
(
Integer
userId
,
Date
workDay
)
{
int
status
=
1
;
int
status
=
PROJECT
;
int
size
=
0
;
List
<
WorkTimeOrder
>
workTimeOrderDtos
=
workTimeOrderMapper
.
getByDay
(
userId
,
workDay
);
for
(
WorkTimeOrder
dto
:
workTimeOrderDtos
)
{
if
(
2
==
dto
.
getStatus
()
||
5
==
dto
.
getStatus
(
))
{
if
(
APPROVED
.
equals
(
dto
.
getStatus
())
||
AUTOMATIC_AUDIT
.
equals
(
dto
.
getStatus
()
))
{
size
++;
}
if
(
3
==
dto
.
getStatus
(
))
{
status
=
3
;
if
(
REJECTED
.
equals
(
dto
.
getStatus
()
))
{
status
=
REJECTED
;
}
}
if
(
size
==
workTimeOrderDtos
.
size
())
{
status
=
2
;
status
=
APPROVED
;
}
return
status
;
}
...
...
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