Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f7427bee
authored
Jul 12, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并后残余清理
1 parent
3da0bfae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
63 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/CapacityQueryServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/CapacityQueryServiceImpl.java
View file @
f7427be
...
...
@@ -73,69 +73,6 @@ public class CapacityQueryServiceImpl implements CapacityQueryService {
return
legends
;
}
@Override
public
Result
<?>
getTeamStatData
(
CapacityStatQueryDTO
.
Request
reqDTO
)
{
// 根据大区/分部/分站查询,分别返回分部/分站/工作队的容量
Page
<?>
stats
=
null
;
Pageable
pageable
=
PageRequest
.
of
(
reqDTO
.
getPage
()
-
1
,
reqDTO
.
getSize
());
Map
<
String
,
String
>
names
=
null
;
String
levelType
=
reqDTO
.
getLevelType
();
String
levelValue
=
reqDTO
.
getLevelValue
();
if
(
"cluster"
.
equals
(
levelType
))
{
names
=
orgBranchDao
.
findAllByClusterId
(
levelValue
).
stream
()
.
collect
(
Collectors
.
toMap
(
OrgBranchEntity:
:
getBranchId
,
OrgBranchEntity:
:
getBranchName
));
;
List
<
String
>
branchIds
=
new
ArrayList
<>(
names
.
keySet
());
log
.
info
(
"levelType: {} ==> branchIds: {}"
,
levelType
,
branchIds
);
stats
=
capacityOrgStatDao
.
findByBranchIdsAndWorkdayBetween
(
branchIds
,
reqDTO
.
getStartDate
(),
reqDTO
.
getEndDate
(),
pageable
);
}
else
if
(
"branch"
.
equals
(
reqDTO
.
getLevelType
()))
{
names
=
orgGroupDao
.
findAllByBranchId
(
levelValue
).
stream
()
.
collect
(
Collectors
.
toMap
(
OrgGroupEntity:
:
getGroupId
,
OrgGroupEntity:
:
getGroupName
));
List
<
String
>
groupIds
=
new
ArrayList
<>(
names
.
keySet
());
log
.
info
(
"levelType: {} ==> groupIds: {}"
,
levelType
,
groupIds
);
stats
=
capacityOrgStatDao
.
findByGroupIdsAndWorkdayBetween
(
groupIds
,
reqDTO
.
getStartDate
(),
reqDTO
.
getEndDate
(),
pageable
);
}
else
{
names
=
orgTeamDao
.
findAllByGroupId
(
levelValue
).
stream
()
.
collect
(
Collectors
.
toMap
(
OrgTeamEntity:
:
getTeamId
,
OrgTeamEntity:
:
getTeamName
));
List
<
String
>
teamIds
=
new
ArrayList
<>(
names
.
keySet
());
log
.
info
(
"levelType: {} ==> teamIds: {}"
,
levelType
,
teamIds
);
stats
=
capacityTeamStatDao
.
findByTeamIdsAndWorkdayBetween
(
teamIds
,
reqDTO
.
getStartDate
(),
reqDTO
.
getEndDate
(),
pageable
);
}
CapacityStatQueryDTO
.
Result
rs
=
new
CapacityStatQueryDTO
.
Result
();
rs
.
setLevelType
(
levelType
);
rs
.
setTotal
(
stats
.
getTotalElements
()).
setPages
(
stats
.
getTotalPages
()).
setPageSize
(
pageable
.
getPageSize
()).
setPageCurrent
(
stats
.
getNumber
());
List
<
CapacityStatQueryDTO
.
Content
>
contents
=
new
ArrayList
<>();
for
(
Object
item
:
stats
.
getContent
())
{
CapacityStatQueryDTO
.
Content
content
=
new
CapacityStatQueryDTO
.
Content
();
if
(
item
instanceof
CapacityOrgStatEntity
)
{
// cluster/branch查询,都是capacity_org_stat
CapacityOrgStatEntity
e
=
(
CapacityOrgStatEntity
)
item
;
content
.
setLevelType
(
e
.
getType
()).
setLevelValue
(
e
.
getOrgId
());
content
.
setShowName
(
names
.
get
(
e
.
getOrgId
()));
content
.
setDate
(
e
.
getWorkday
()).
setLayer
(
e
.
getLayer
())
.
setCapTotal
(
e
.
getCapTotal
()).
setCapUsed
(
e
.
getCapUsedTotal
())
.
setEngineerNum
(
e
.
getEngineerCount
()).
setUpdateTime
(
e
.
getUpdateTime
());
}
else
{
// group查询,是capacity_team_stat
CapacityTeamStatEntity
e
=
(
CapacityTeamStatEntity
)
item
;
// capacity_team_stat表中的team_id,直接就是字符串
content
.
setLevelType
(
"team"
).
setLevelValue
(
e
.
getTeamId
());
content
.
setShowName
(
names
.
get
(
e
.
getTeamId
()));
content
.
setDate
(
e
.
getWorkday
()).
setLayer
(
e
.
getLayer
()).
setShowName
(
e
.
getTeamId
())
.
setCapTotal
(
e
.
getCapTotal
()).
setCapUsed
(
e
.
getCapUsed
()).
setCapAdjust
(
e
.
getCapAdjust
())
.
setEngineerNum
(
e
.
getEngineerCount
()).
setUpdateTime
(
e
.
getUpdateTime
());
}
contents
.
add
(
content
);
}
contents
.
stream
().
sorted
(
Comparator
.
comparing
(
CapacityStatQueryDTO
.
Content
::
getDate
)).
collect
(
Collectors
.
toList
());
rs
.
setContent
(
contents
);
return
Result
.
success
(
rs
);
}
private
int
getSpanType
(
int
capLeft
,
int
capTotal
)
{
float
ratio
=
(
float
)
capLeft
/
capTotal
;
if
(
ratio
<
0.3
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment