|
@@ -82,14 +82,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
return indexBaseMonthDataDao;
|
|
|
}
|
|
|
|
|
|
- public IndexBaseDto getIndexBaseDto(IndexDataType indexDataType,List<IndexBaseMonthData> indexBaseMonthData) {
|
|
|
- BigDecimal reduce = indexBaseMonthData.stream().map(e -> e.getPercent()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- indexBaseMonthData.stream().forEach(e -> {
|
|
|
- e.setDataType(indexDataType);
|
|
|
- e.setTitle(indexDataType.getMsg());
|
|
|
- });
|
|
|
- return new IndexBaseDto(indexDataType,reduce,indexBaseMonthData);
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public List<IndexBaseDto> getIndexBaseData(IndexDataQueryInfo queryInfo) {
|
|
@@ -386,10 +378,11 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
return decimalMapDtos1.stream().sorted(Comparator.comparing(DecimalMapDto::getAmount).reversed()).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
- private List<IndexBaseMonthData> completedList(List<IndexBaseMonthData> renew, List<Organization> organs) {
|
|
|
+ public IndexBaseDto getIndexBaseDto(IndexDataType indexDataType, List<IndexBaseMonthData> renew, List<Organization> organs) {
|
|
|
// 将 renew 转换为 Map,以组织 ID 为键,IndexBaseMonthData 为值
|
|
|
Map<Integer, IndexBaseMonthData> renewMap = renew.stream()
|
|
|
.collect(Collectors.toMap(IndexBaseMonthData::getOrganId, Function.identity()));
|
|
|
+ BigDecimal reduce = renew.stream().map(e -> e.getPercent()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
// 遍历 organs,根据组织 ID 获取对应的 IndexBaseMonthData,并进行处理
|
|
|
for (Organization organ : organs) {
|
|
|
IndexBaseMonthData indexBaseMonthData = renewMap.get(organ.getId());
|
|
@@ -399,11 +392,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
renew.add(indexBaseMonthData); // 将新的 IndexBaseMonthData 对象添加到 renew 集合中
|
|
|
}
|
|
|
indexBaseMonthData.setOrganName(organ.getName());
|
|
|
+ indexBaseMonthData.setDataType(indexDataType);
|
|
|
+ indexBaseMonthData.setTitle(indexDataType.getMsg());
|
|
|
}
|
|
|
- return renew;
|
|
|
+ return new IndexBaseDto(indexDataType,reduce,renew);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//异步处理经营数据查询
|
|
|
public void syncOperation(String startDate1,String endDate1,List<Integer> arrayList,Integer tenantId,List<IndexBaseDto> indexBaseDtoList,Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap){
|
|
|
// System.out.println(System.currentTimeMillis());
|
|
@@ -411,17 +405,17 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
CompletableFuture future1 = this.async(() -> {
|
|
|
// long l = System.currentTimeMillis();
|
|
|
List<IndexBaseMonthData> renew = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "RENEW", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,this.completedList(renew,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,renew,organs));
|
|
|
List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,this.completedList(details,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,details,organs));
|
|
|
// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
});
|
|
|
CompletableFuture future2 = this.async(() -> {
|
|
|
// long l = System.currentTimeMillis();
|
|
|
List<IndexBaseMonthData> data = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,this.completedList(data,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,data,organs));
|
|
|
List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,this.completedList(details,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,details,organs));
|
|
|
// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
});
|
|
|
CompletableFuture future6 = this.async(()->{
|
|
@@ -441,17 +435,15 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
CompletableFuture future3 = this.async(() -> {
|
|
|
// long l = System.currentTimeMillis();
|
|
|
List<IndexBaseMonthData> details = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimely(startDate1, endDate1, arrayList, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,this.completedList(details,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,details,organs));
|
|
|
List<IndexBaseMonthData> apply = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList, "APPLY,ADD_STUDENT", null, tenantId);
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,this.completedList(apply,organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,apply,organs));
|
|
|
// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
});
|
|
|
CompletableFuture future4 = this.async(() -> {
|
|
|
// long l = System.currentTimeMillis();
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,
|
|
|
- this.completedList(indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs)));
|
|
|
- indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,
|
|
|
- this.completedList(indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs)));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
+ indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId),organs));
|
|
|
// System.out.println("Thread.currentThread :" + Thread.currentThread() + "---" + (System.currentTimeMillis() - l));
|
|
|
});
|
|
|
|