Commit f7427bee by 丁伟峰

合并后残余清理

1 parent 3da0bfae
......@@ -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) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!