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
711e3814
Commit
711e3814
authored
Mar 08, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善工时统计
parent
920123fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
17 deletions
+40
-17
StatisticsServiceImpl.java
...java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
+40
-17
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
View file @
711e3814
...
...
@@ -508,7 +508,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
// 将字符串中的1到9的数字相加
private
Integer
getNumberOfString
(
String
value
)
{
Integer
getNumberOfString
(
String
value
)
{
value
=
value
.
trim
();
if
(
StringUtil
.
isEmpty
(
value
))
{
return
null
;
...
...
@@ -558,9 +558,9 @@ public class StatisticsServiceImpl implements StatisticsService {
map
.
put
(
"startDate"
,
startDate
);
map
.
put
(
"endDate"
,
endDate
);
//
查询所有项目的工
加班工时和正常工时
//
存所有项目的
加班工时和正常工时
List
<
UserWorkTimeStatisticsByProject
>
userProjectWorkTimeStatistics
;
//
查询
各个项目下所有人的加班工时和平常工时
//
存
各个项目下所有人的加班工时和平常工时
List
<
UserWorkTimeStatisticsByProject
>
userProjectWorkTimeStatistics1
;
// 当前权限最高为中心级别权限
...
...
@@ -613,9 +613,9 @@ public class StatisticsServiceImpl implements StatisticsService {
// 查询结果为空,新建一个“合计”对象添加到集合
if
(
CollectionUtils
.
isEmpty
(
userProjectWorkTimeStatistics
))
{
List
<
ProjectWorkTimeAndType
>
projectWorkTimeAndTypes
=
new
ArrayList
<>();
UserWorkTimeStatisticsByProject
userWorkTimeStatisticsByProject
=
new
UserWorkTimeStatisticsByProject
();
userWorkTimeStatisticsByProject
.
setUserName
(
"合计"
);
List
<
ProjectWorkTimeAndType
>
projectWorkTimeAndTypes
=
new
ArrayList
<>();
userWorkTimeStatisticsByProject
.
setProjectWorkTimeAndType
(
projectWorkTimeAndTypes
);
userProjectWorkTimeStatistics
.
add
(
userWorkTimeStatisticsByProject
);
}
...
...
@@ -723,17 +723,7 @@ public class StatisticsServiceImpl implements StatisticsService {
totalTime
+=
projectWorkTimeAndType
.
getOverTime
();
}
}
// 最后一个对象
// if (projectWorkTimeAndType1.size() != 0) {
// ProjectWorkTimeAndType projectWorkTimeAndTypes = projectWorkTimeAndType1.get(projectWorkTimeAndType1.size() - 1);
// if (projectWorkTimeAndTypes.getOverTime() != null) {
// totalTime += projectWorkTimeAndTypes.getOverTime();
// }
// if (projectWorkTimeAndTypes.getNormalTime() != null) {
// totalTime += projectWorkTimeAndTypes.getNormalTime();
// }
// }
userProjectWorkTimeStatistic
.
setTotalTime
(
totalTime
);
}
...
...
@@ -753,6 +743,11 @@ public class StatisticsServiceImpl implements StatisticsService {
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
list
);
List
<
Integer
>
rank
=
this
.
getUserRank
(
workLevels
,
LevelEnum
.
PROJECT_STATISTICS
.
getLevelName
());
// 非中心级不能选择部门
if
(!
rank
.
contains
(
LevelRankEnum
.
CENTRAL_LEVEL
.
getRank
())
&&
deptId
!=
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NO_AUTHORITY
);
}
// 默认查询时间为当前
if
(
year
==
null
)
{
year
=
DateUtil
.
getYear
(
new
Date
());
...
...
@@ -779,13 +774,41 @@ public class StatisticsServiceImpl implements StatisticsService {
}
else
{
map
.
put
(
"projectId"
,
projectId
);
}
// 查询所管理项目的项目统计
// 查询所管理项目的项目统计总计
List
<
ProjectStatisticsByMonth
>
projectStatisticsByMonths
=
workProjectTimeCostMapper
.
selectListByMonth
(
map
);
// 合计统计为空,造合计对象
if
(
CollectionUtil
.
isEmpty
(
projectStatisticsByMonths
))
{
return
null
;
ProjectStatisticsByMonth
projectStatisticsByMonth
=
new
ProjectStatisticsByMonth
();
projectStatisticsByMonth
.
setProjectName
(
"合计"
);
List
<
ProjectStatisticsByMonth
.
StatisticsDateAndWorkTime
>
statisticsDateAndWorkTimes
=
new
ArrayList
<>();
projectStatisticsByMonth
.
setStatisticsDateAndWorkTimes
(
statisticsDateAndWorkTimes
);
projectStatisticsByMonths
.
add
(
projectStatisticsByMonth
);
}
// 查询每个项目单独统计的集合
List
<
ProjectStatisticsByMonth
>
projectStatisticsByMonths1
=
workProjectTimeCostMapper
.
selectListStatistics
(
map
);
// 将在查询时间端内未存在填报信息的项目补齐
if
(
projectId
==
null
)
{
// 查询项目
List
<
WorkProject
>
projects
=
workProjectMapper
.
getListByCriteria
(
map
);
// 查询统计结果中的项目主键
List
<
Integer
>
queryProjectId
=
projectStatisticsByMonths1
.
stream
().
map
(
ProjectStatisticsByMonth:
:
getProjectId
).
collect
(
Collectors
.
toList
());
for
(
WorkProject
project
:
projects
)
{
// 如果在查询结果中未存在所管理的项目,新建对象加入统计
if
(!
queryProjectId
.
contains
(
project
.
getId
()))
{
ProjectStatisticsByMonth
projectStatisticsByMonth
=
new
ProjectStatisticsByMonth
();
projectStatisticsByMonth
.
setProjectName
(
project
.
getProjectName
());
projectStatisticsByMonth
.
setProjectId
(
project
.
getId
());
List
<
ProjectStatisticsByMonth
.
StatisticsDateAndWorkTime
>
statisticsDateAndWorkTimes
=
new
ArrayList
<>();
projectStatisticsByMonth
.
setStatisticsDateAndWorkTimes
(
statisticsDateAndWorkTimes
);
projectStatisticsByMonths1
.
add
(
projectStatisticsByMonth
);
}
}
}
/**
if (projectId != null) {
// 项目的全周期统计
List<ProjectStatisticsByMonth.StatisticsDateAndWorkTime> statisticsDateAndWorkTimes = projectStatisticsByMonths.get(0).getStatisticsDateAndWorkTimes();
...
...
@@ -813,7 +836,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
}
**/
// 将查询结果封装在一起
projectStatisticsByMonths
.
addAll
(
0
,
projectStatisticsByMonths1
);
...
...
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