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
02c9d567
Commit
02c9d567
authored
Feb 26, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善工时统计
parent
b9902faf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
StatisticsServiceImpl.java
...java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
+12
-13
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
View file @
02c9d567
...
@@ -286,11 +286,12 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -286,11 +286,12 @@ public class StatisticsServiceImpl implements StatisticsService {
List
<
Integer
>
list
=
UserRoleLevelUtils
.
getlevelIds
(
role
);
List
<
Integer
>
list
=
UserRoleLevelUtils
.
getlevelIds
(
role
);
// 获取角色对应的权限
// 获取角色对应的权限
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
list
);
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
list
);
List
<
Integer
>
rank
=
getUserRank
(
workLevels
);
// 用户该权限的级别
List
<
Integer
>
rank
=
this
.
getUserRank
(
workLevels
,
LevelEnum
.
EXAMINE
.
getLevelName
());
// 获取所有的类型
// 获取所有的类型
List
<
WorkType
>
workTypes
=
workTypeMapper
.
getAll
();
List
<
WorkType
>
workTypes
=
workTypeMapper
.
getAll
();
// 存储
所有
查询的类型
// 存储查询的类型
List
<
Integer
>
types
=
new
ArrayList
<>();
List
<
Integer
>
types
=
new
ArrayList
<>();
// 只存储项目和商机之外的类型
// 只存储项目和商机之外的类型
for
(
WorkType
workType
:
workTypes
)
{
for
(
WorkType
workType
:
workTypes
)
{
...
@@ -317,8 +318,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -317,8 +318,7 @@ public class StatisticsServiceImpl implements StatisticsService {
workTimeAndCostCollects
.
addAll
(
workTimeAndCostCollect
);
workTimeAndCostCollects
.
addAll
(
workTimeAndCostCollect
);
}
}
// 如果用户的审批权限的级别最高为部门级别
else
if
(
rank
.
contains
(
LevelRankEnum
.
DEPARTMENT_LEVEL
.
getRank
())
)
{
// 如果用户的审批权限的级别最高为部门级别
if
(
rank
.
contains
(
LevelRankEnum
.
DEPARTMENT_LEVEL
.
getRank
())
&&
!
rank
.
contains
(
LevelRankEnum
.
CENTRAL_LEVEL
.
getRank
()))
{
// 获取部门下的所有项目和商机的工时统计
// 获取部门下的所有项目和商机的工时统计
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"deptId"
,
user
.
getDeptId
());
map
.
put
(
"deptId"
,
user
.
getDeptId
());
...
@@ -330,11 +330,8 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -330,11 +330,8 @@ public class StatisticsServiceImpl implements StatisticsService {
// 获取这些类型的所有工单
// 获取这些类型的所有工单
List
<
WorkTimeAndCostCollect
>
workTimeAndCostCollect
=
workTimeOrderMapper
.
getWorkTimeAndCostCollect
(
map
);
List
<
WorkTimeAndCostCollect
>
workTimeAndCostCollect
=
workTimeOrderMapper
.
getWorkTimeAndCostCollect
(
map
);
workTimeAndCostCollects
.
addAll
(
workTimeAndCostCollect
);
workTimeAndCostCollects
.
addAll
(
workTimeAndCostCollect
);
}
}
else
if
(
rank
.
contains
(
LevelRankEnum
.
PROJECT_LEVEL
.
getRank
()))
{
// 如果用户的审批权限的级别最高为项目/商机级别,与其他两种级别不同的是只汇总项目和商机类型的工单
// 如果用户的审批权限的级别最高为项目/商机级别,与其他两种级别不同的是只汇总项目和商机类型的工单
if
(
rank
.
contains
(
LevelRankEnum
.
PROJECT_LEVEL
.
getRank
())
&&
!
rank
.
contains
(
LevelRankEnum
.
DEPARTMENT_LEVEL
.
getRank
()))
{
// 获取部门下的所有项目和商机的工时统计
// 获取部门下的所有项目和商机的工时统计
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
// 获取用户负责项目和商机id
// 获取用户负责项目和商机id
...
@@ -342,7 +339,6 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -342,7 +339,6 @@ public class StatisticsServiceImpl implements StatisticsService {
map
.
put
(
"projectIds"
,
projectIdByManager
);
map
.
put
(
"projectIds"
,
projectIdByManager
);
map
.
put
(
"firstDayOfMonth"
,
startTime
);
map
.
put
(
"firstDayOfMonth"
,
startTime
);
workTimeAndCostCollects
=
workProjectTimeCostMapper
.
selectList
(
map
);
workTimeAndCostCollects
=
workProjectTimeCostMapper
.
selectList
(
map
);
}
}
// 获取查询结果中的类型
// 获取查询结果中的类型
...
@@ -350,6 +346,10 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -350,6 +346,10 @@ public class StatisticsServiceImpl implements StatisticsService {
// 如果查询结果不包含查询条件中的类型,造对象传前端
// 如果查询结果不包含查询条件中的类型,造对象传前端
for
(
WorkType
workType
:
workTypes
)
{
for
(
WorkType
workType
:
workTypes
)
{
if
(!
typeList
.
contains
(
workType
.
getId
()))
{
if
(!
typeList
.
contains
(
workType
.
getId
()))
{
// 权限级别为项目级别的用户只返回项目和商机类型的汇总
if
(
rank
.
contains
(
LevelRankEnum
.
PROJECT_LEVEL
.
getRank
())
&&
rank
.
size
()
==
1
&&
types
.
contains
(
workType
.
getId
()))
{
continue
;
}
WorkTimeAndCostCollect
workTimeAndCostCollect1
=
new
WorkTimeAndCostCollect
();
WorkTimeAndCostCollect
workTimeAndCostCollect1
=
new
WorkTimeAndCostCollect
();
workTimeAndCostCollect1
.
setType
(
workType
.
getId
());
workTimeAndCostCollect1
.
setType
(
workType
.
getId
());
workTimeAndCostCollect1
.
setTypeName
(
workType
.
getName
());
workTimeAndCostCollect1
.
setTypeName
(
workType
.
getName
());
...
@@ -357,7 +357,6 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -357,7 +357,6 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
}
}
// 给类型赋值类型名称
// 给类型赋值类型名称
for
(
WorkTimeAndCostCollect
timeAndCostCollect
:
workTimeAndCostCollects
)
{
for
(
WorkTimeAndCostCollect
timeAndCostCollect
:
workTimeAndCostCollects
)
{
for
(
WorkType
workType
:
workTypes
)
{
for
(
WorkType
workType
:
workTypes
)
{
...
@@ -520,7 +519,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -520,7 +519,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// 获取用户权限的级别
// 获取用户权限的级别
List
<
Integer
>
list
=
UserRoleLevelUtils
.
getlevelIds
(
role
);
List
<
Integer
>
list
=
UserRoleLevelUtils
.
getlevelIds
(
role
);
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
list
);
List
<
WorkLevel
>
workLevels
=
UserRoleLevelUtils
.
getlevelByIds
(
list
);
List
<
Integer
>
rank
=
this
.
getUserRank
(
workLevels
);
List
<
Integer
>
rank
=
this
.
getUserRank
(
workLevels
,
LevelEnum
.
USER_STATISTICS
.
getLevelName
()
);
// 不是中心级不能选择部门
// 不是中心级不能选择部门
if
(!
rank
.
contains
(
LevelRankEnum
.
CENTRAL_LEVEL
.
getRank
())
&&
deptId
!=
null
)
{
if
(!
rank
.
contains
(
LevelRankEnum
.
CENTRAL_LEVEL
.
getRank
())
&&
deptId
!=
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NO_AUTHORITY
);
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NO_AUTHORITY
);
...
@@ -791,10 +790,10 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -791,10 +790,10 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
// 获取用户当前权限对应的级别
// 获取用户当前权限对应的级别
public
List
<
Integer
>
getUserRank
(
List
<
WorkLevel
>
workLevels
){
public
List
<
Integer
>
getUserRank
(
List
<
WorkLevel
>
workLevels
,
String
levelName
){
List
<
Integer
>
rank
=
new
ArrayList
<>();
List
<
Integer
>
rank
=
new
ArrayList
<>();
for
(
WorkLevel
workLevel
:
workLevels
)
{
for
(
WorkLevel
workLevel
:
workLevels
)
{
if
(
workLevel
.
getName
().
equals
(
LevelEnum
.
EXAMINE
.
getLevelName
()
))
{
if
(
workLevel
.
getName
().
equals
(
levelName
))
{
rank
.
add
(
workLevel
.
getRank
());
rank
.
add
(
workLevel
.
getRank
());
}
}
}
}
...
...
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