return numRowsDeleted;
}
private List<ApplicationVersionStatisticSummaryModel> toApplicationVersionUserStatisticSummaryModel(List<ApplicationVersionUserStatistic> applicationVersionUserStatistics) {
ApplicationVersionStatisticSummaryModel applicationVersionUserStatisticSummaryModel = new ApplicationVersionStatisticSummaryModel();
List<ApplicationVersionStatisticSummaryModel> applicationVersionUserStatisticSummaryModelList = new CopyOnWriteArrayList<ApplicationVersionStatisticSummaryModel>();
if (applicationVersionUserStatistics == null || applicationVersionUserStatistics.isEmpty()) {
return applicationVersionUserStatisticSummaryModelList;
}
applicationVersionUserStatisticSummaryModel.setApplicationName(applicationVersionUserStatistics.get(0).getApplicationVersion().getApplication().getName());
applicationVersionUserStatisticSummaryModel.setApplicationVersionId(applicationVersionUserStatistics.get(0).getApplicationVersion().getId());
applicationVersionUserStatisticSummaryModel.setApplicationVersionName(applicationVersionUserStatistics.get(0).getApplicationVersion().getVersionName());
applicationVersionUserStatisticSummaryModelList.add(applicationVersionUserStatisticSummaryModel);
for (ApplicationVersionUserStatistic applicationVersionUserStatistic : applicationVersionUserStatistics) {
boolean listHasStatistic = false;
for (ApplicationVersionStatisticSummaryModel versionUserStatisticSummaryModel : applicationVersionUserStatisticSummaryModelList) {
if (versionUserStatisticSummaryModel.getApplicationVersionId().equals(applicationVersionUserStatistic.getApplicationVersion().getId())) {
versionUserStatisticSummaryModel.setTotal(versionUserStatisticSummaryModel.getTotal() + 1);
listHasStatistic = true;
break;
}
}
if (!listHasStatistic) {
ApplicationVersionStatisticSummaryModel summaryModel = new ApplicationVersionStatisticSummaryModel();
summaryModel.setTotal(1);
summaryModel.setApplicationName(applicationVersionUserStatistic.getApplicationVersion().getApplication().getName());
summaryModel.setApplicationVersionId(applicationVersionUserStatistic.getApplicationVersion().getId());
summaryModel.setApplicationVersionName(applicationVersionUserStatistic.getApplicationVersion().getVersionName());
applicationVersionUserStatisticSummaryModelList.add(summaryModel);
}
}
return applicationVersionUserStatisticSummaryModelList;