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
1b87a152
Commit
1b87a152
authored
Jan 26, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
d549c9e0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
22 deletions
+45
-22
WorkTimeOrderMapper.xml
...-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
+1
-1
WorkTimeOrderServiceImpl.java
...a/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
+44
-6
WorkTimeOrderController.java
...rgy/web/admin/controller/app/WorkTimeOrderController.java
+0
-15
No files found.
wisenergy-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
View file @
1b87a152
...
...
@@ -122,7 +122,7 @@
</foreach>
</if>
</where>
ORDER BY work_day,project_
name
DESC
ORDER BY work_day,project_
id
DESC
</select>
<!-- 通用查询结果列 -->
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
View file @
1b87a152
...
...
@@ -164,6 +164,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List
<
WorkTimeOrderDto
>
result
=
this
.
saveWorkOrderInfo
(
dto
.
getWorkTimeOrders
());
log
.
info
(
"WorkOrderServiceImpl[]add[]add.success"
);
return
result
;
}
/**
...
...
@@ -183,10 +184,24 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 判断是否超过8小时
int
count
=
0
;
List
<
WorkTimeOrder
>
byDayToDto
=
getByDayToDto
(
workTimeOrders
.
get
(
0
).
getUserId
(),
workTimeOrders
.
get
(
0
).
getWorkDay
());
// 判断是否重复填报
isRepeat
(
workTimeOrders
);
for
(
WorkTimeOrder
orderDto
:
byDayToDto
)
{
if
(
2
==
orderDto
.
getStatus
()
||
5
==
orderDto
.
getStatus
())
if
(
2
==
orderDto
.
getStatus
()
||
5
==
orderDto
.
getStatus
())
{
count
+=
orderDto
.
getWorkTime
();
for
(
WorkTimeOrderDto
workTimeOrder
:
workTimeOrders
)
{
if
(
orderDto
.
getType
().
equals
(
workTimeOrder
.
getType
()))
{
if
(
1
==
orderDto
.
getType
()
||
2
==
orderDto
.
getType
()
&&
orderDto
.
getProjectId
().
equals
(
workTimeOrder
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
}
}
}
// 判断是否超过8小时
...
...
@@ -198,6 +213,23 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
private
void
isRepeat
(
List
<
WorkTimeOrderDto
>
list
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
int
size
=
list
.
size
();
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
(
1
==
list
.
get
(
i
).
getType
()
||
2
==
list
.
get
(
i
).
getType
()
&&
list
.
get
(
i
).
getProjectId
().
equals
(
list
.
get
(
j
).
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
}
}
}
/**
* 功能:获取待审批数据
*
...
...
@@ -414,7 +446,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List
<
ProjectManagerDto
>
projectManagerDtos
=
new
ArrayList
<>();
if
(
1
==
user
.
getLevel
())
{
List
<
ProjectDto
>
projectDtos
=
workProjectService
.
getByManagerId
(
userId
);
ProjectManagerDto
projectManagerDto
;
ProjectManagerDto
projectManagerDto
;
for
(
ProjectDto
projectDto
:
projectDtos
)
{
projectManagerDto
=
new
ProjectManagerDto
();
BeanUtils
.
copyProperties
(
projectDto
,
projectManagerDto
);
...
...
@@ -423,7 +455,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
if
(
2
==
user
.
getLevel
())
{
ProjectManagerDto
projectManagerDto
=
new
ProjectManagerDto
();
for
(
int
i
=
5
;
i
<
8
;
i
++)
{
for
(
int
i
=
5
;
i
<
8
;
i
++)
{
projectManagerDto
.
setType
(
i
).
setTypeName
(
getTypeName
(
i
));
projectManagerDtos
.
add
(
projectManagerDto
);
}
...
...
@@ -448,7 +480,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
ProjectInfoDto
projectInfoDto2
=
new
ProjectInfoDto
().
setType
(
2
).
setTypeName
(
getTypeName
(
2
)).
setDeptManagerName
(
deptManagerName
);
List
<
ProjectDto
>
projectDto1
=
new
ArrayList
<>();
List
<
ProjectDto
>
projectDto2
=
new
ArrayList
<>();
WorkProject
workProject
;
WorkProject
workProject
;
for
(
Integer
projectId
:
projectIds
)
{
workProject
=
workProjectService
.
getById
(
projectId
);
if
(
1
==
workProject
.
getType
())
{
...
...
@@ -469,10 +501,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
projectList
.
add
(
new
ProjectInfoDto
().
setType
(
7
).
setTypeName
(
getTypeName
(
7
)).
setDeptManagerName
(
deptManagerName
));
return
projectList
;
}
// project转ProjectDto
private
ProjectDto
projectToProjectDto
(
WorkProject
workProject
)
{
ProjectDto
projectDto
=
new
ProjectDto
();
BeanUtils
.
copyProperties
(
workProject
,
projectDto
);
BeanUtils
.
copyProperties
(
workProject
,
projectDto
);
// 获取项目管理
projectDto
.
setManagerName
(
workUserService
.
getById
(
workProject
.
getManagerId
()).
getName
());
...
...
@@ -527,6 +560,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
Date
date
=
new
Date
();
WorkSubmitAdopt
workSubmitAdopt
=
workSubmitAdoptService
.
getById
(
1
);
Integer
submitTime
=
workSubmitAdopt
.
getSubmitTime
();
// 判断是否重复填报
isRepeat
(
list
);
for
(
WorkTimeOrderDto
dto
:
list
)
{
if
(
null
==
dto
.
getDes
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
DES_NOT_NULL
);
...
...
@@ -563,7 +601,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
//3.每天工时累加不得超过八小时
private
void
timeNotEight
(
int
count
,
List
<
WorkTimeOrderDto
>
list
)
{
for
(
WorkTimeOrderDto
workOrder
:
list
)
{
if
(
null
==
workOrder
.
getWorkDay
()
)
{
if
(
null
==
workOrder
.
getWorkDay
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
if
(
0
==
workOrder
.
getWorkTime
())
{
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/WorkTimeOrderController.java
View file @
1b87a152
...
...
@@ -32,19 +32,6 @@ public class WorkTimeOrderController extends BaseController {
@Autowired
private
WorkTimeOrderService
workTimeOrderService
;
@Autowired
private
WorkProjectService
workProjectService
;
@Autowired
private
WorkUserProjectService
workUserProjectService
;
@Autowired
private
WorkUserDeptService
workUserDeptService
;
@Autowired
private
WorkUserService
workUserService
;
@ApiOperation
(
value
=
"获取某日工单详情"
,
notes
=
"获取某日工单详情"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
...
...
@@ -182,6 +169,4 @@ public class WorkTimeOrderController extends BaseController {
return
getResult
(
workTimeOrderDtos
);
}
}
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