Commit 502c834f authored by 鲁鸿波's avatar 鲁鸿波

教育bug修改

parent 36df4199
...@@ -151,7 +151,7 @@ public class TrainProjectStatisticsAllServiceImpl implements TrainProjectStatist ...@@ -151,7 +151,7 @@ public class TrainProjectStatisticsAllServiceImpl implements TrainProjectStatist
return null; return null;
} }
@Override /*@Override
public List<ProjectStatTotalVo> findTrainTimeByOrgOrVisitType(String orgId, String startTime, String endTime, String type) { public List<ProjectStatTotalVo> findTrainTimeByOrgOrVisitType(String orgId, String startTime, String endTime, String type) {
List<ProjectStatTotalVo> voList = new ArrayList<>(); List<ProjectStatTotalVo> voList = new ArrayList<>();
...@@ -211,6 +211,69 @@ public class TrainProjectStatisticsAllServiceImpl implements TrainProjectStatist ...@@ -211,6 +211,69 @@ public class TrainProjectStatisticsAllServiceImpl implements TrainProjectStatist
item.setFanChartSort(sort.getAndIncrement()); item.setFanChartSort(sort.getAndIncrement());
}); });
return sortList;
}*/
@Override
public List<ProjectStatTotalVo> findTrainTimeByOrgOrVisitType(String orgId, String startTime, String endTime, String type) {
List<ProjectStatTotalVo> voList = new ArrayList<>();
if (StringUtils.isNotBlank(type) && ChartTypeEnum.ORG.getValue().equals(type)) {
List<NewSysOrg> sysOrgList = findChildOrgListByParentId(orgId);
if (CollectionUtils.isEmpty(sysOrgList)) {
return voList;
}
for (NewSysOrg sysOrg : sysOrgList) {
List<String> orgIdList = findOrgIdList(sysOrg.getOrgId());
String projectNum = safeFindTrainTimeSumByOrgId(orgIdList, startTime, endTime);
if (StringUtils.isNotBlank(projectNum) && !"0".equals(projectNum)) {
ProjectStatTotalVo projectStatTotalVo = new ProjectStatTotalVo();
projectStatTotalVo.setFanChartKey(sysOrg.getOrgName());
projectStatTotalVo.setFanChartValue(projectNum);
projectStatTotalVo.setOrgId(sysOrg.getOrgId());
voList.add(projectStatTotalVo);
}
}
}
if (StringUtils.isNotBlank(type) && ChartTypeEnum.ROLE.getValue().equals(type)) {
if (StringUtils.isBlank(orgId)) {
orgId = ContextUtils.getLoginUser().getOrgId();
}
List<String> orgIdList = findOrgIdList(orgId);
voList = tTrainProjectDao.findTrainTimeByOrgOrVisitType(orgIdList, startTime,
endTime, ChartTypeEnum.ROLE.getValue());
voList.forEach(item -> {
String fanChartKey = item.getFanChartKey();
if (StringUtils.isNotBlank(fanChartKey)) {
String name = VisitTypeEnum.getName(fanChartKey);
item.setFanChartKey(name);
}
});
}
String trainTimeTotal = tTrainProjectDao.findTrainTimeTotal(startTime, endTime);
if (StringUtils.isBlank(trainTimeTotal)) {
trainTimeTotal = "1";
}
// 修复:使用Double.parseDouble()而不是Integer.parseInt()
List<ProjectStatTotalVo> sortList = voList.stream()
.sorted(Comparator.comparingDouble(item -> Double.parseDouble(item.getFanChartValue())))
.collect(Collectors.toList());
Collections.reverse(sortList);
AtomicInteger sort = new AtomicInteger(1);
String finalTrainTimeTotal = trainTimeTotal;
sortList.forEach(item -> {
String ratio = getRatio(
Double.parseDouble(item.getFanChartValue()),
Double.parseDouble(finalTrainTimeTotal)
);
item.setFanChartRatio(ratio);
item.setFanChartSort(sort.getAndIncrement());
});
return sortList; return sortList;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment