소스 검색

首页查询优化

zouxuan 2 년 전
부모
커밋
73a93b0b38
1개의 변경된 파일128개의 추가작업 그리고 66개의 파일을 삭제
  1. 128 66
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

+ 128 - 66
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.extension.api.R;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
@@ -19,6 +20,7 @@ import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -29,6 +31,10 @@ import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.enums.IndexDataType.*;
@@ -58,13 +64,12 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	@Autowired
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
-	private MusicGroupPerformanceDao musicGroupPerformanceDao;
-	@Autowired
 	private StudentDao studentDao;
 	@Autowired
 	private SysEmployeePositionService employeePositionService;
 	@Autowired
 	private MusicGroupCalenderRefundPeriodDao musicGroupCalenderRefundPeriodDao;
+	private static final ExecutorService exportExecutorService = Executors.newFixedThreadPool(10);
 
 	private static ThreadLocal<Set<Integer>> organIds = new ThreadLocal<Set<Integer>>(){
 		@Override
@@ -116,7 +121,11 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			dataTypes = Arrays.stream(queryInfo.getDataTypes().split(",")).collect(Collectors.toSet());
 		}
 
-		List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(organIds, dataTypes, startDate.toString(), endDate.toString(),queryInfo.getTenantId());
+		String startDate1 = startDate.toString();
+		String endDate1 = endDate.toString();
+		List<Integer> arrayList = new ArrayList<>(organIds);
+		Integer tenantId = queryInfo.getTenantId();
+		List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(organIds, dataTypes, startDate1, endDate1,tenantId);
 		if(Objects.isNull(indexBaseDatas)){
 			indexBaseDatas = new ArrayList<>();
 		}
@@ -127,7 +136,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			vipDataTypes.add("VIP_GROUP_COURSE");
 			vipDataTypes.add("VIP_GROUP_ONLINE_COURSE");
 			vipDataTypes.add("VIP_GROUP_OFFLINE_COURSE");
-			List<IndexBaseMonthData> indexBaseDataList = indexBaseMonthDataDao.getVipCourseDataList(organIds, vipDataTypes, startDate.toString(), endDate.toString(),queryInfo.getTenantId());
+			List<IndexBaseMonthData> indexBaseDataList = indexBaseMonthDataDao.getVipCourseDataList(organIds, vipDataTypes, startDate1, endDate1,tenantId);
 			if(!CollectionUtils.isEmpty(indexBaseDataList)){
 				for (IndexBaseMonthData indexBaseMonthData : indexBaseDataList) {
 					if(StringUtils.isBlank(indexBaseMonthData.getExtendInfo())){
@@ -152,61 +161,24 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().filter(d->Objects.nonNull(d.getDataType())).collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 
-		//按天汇总
-		if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(FINANCE_PAY.getCode())||dataTypes.contains(FINANCE_BALANCE_AMOUNT.getCode())||dataTypes.contains(FINANCE_AMOUNT.getCode())) && organIds != null){
-			List<IndexBaseMonthData> financePayDataWithTimely = indexBaseMonthDataDao.getFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			typeDateMap.put(IndexDataType.FINANCE_PAY,financePayDataWithTimely);
-			typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId()));
-			typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId()));
-			List<IndexBaseMonthData> totalAmountDataWithTimely = indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			typeDateMap.put(IndexDataType.TOTAL_AMOUNT,totalAmountDataWithTimely);
-			//经营报表细化
-			List<IndexBaseMonthData> applyAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"APPLY,ADD_STUDENT",null,queryInfo.getTenantId());
-			typeDateMap.put(APPLY_AMOUNT,applyAmount);
-			List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"RENEW",null,queryInfo.getTenantId());
-			typeDateMap.put(RENEW_AMOUNT,renewAmount);
-			List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getVipAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			typeDateMap.put(VIP_AMOUNT,vipAmount);
-			List<IndexBaseMonthData> practiceAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,queryInfo.getTenantId());
-			typeDateMap.put(PRACTICE_AMOUNT,practiceAmount);
-			List<IndexBaseMonthData> otherAmount = indexBaseMonthDataDao.getOtherAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			typeDateMap.put(OTHER_AMOUNT,otherAmount);
-		}
 		//按分部汇总
-		List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
-		if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(ORGAN_FINANCE_PAY.getCode())||dataTypes.contains(ORGAN_FINANCE_BALANCE_AMOUNT.getCode())||
+		if((CollectionUtils.isEmpty(dataTypes) || dataTypes.contains(ORGAN_FINANCE_BALANCE_AMOUNT.getCode()) ||
 				dataTypes.contains(ORGAN_FINANCE_AMOUNT.getCode())) && organIds != null){
-			List<IndexBaseMonthData> financePayDataWithTimely = indexBaseMonthDataDao.getOrganFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_PAY,financePayDataWithTimely));
-
-			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId())));
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId())));
-			List<IndexBaseMonthData> totalAmountDataWithTimely = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,totalAmountDataWithTimely));
-			//经营报表细化
-			List<IndexBaseMonthData> applyAmount = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"APPLY,ADD_STUDENT",null,queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,applyAmount));
-			List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"RENEW",null,queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,renewAmount));
-			List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,vipAmount));
-			List<IndexBaseMonthData> practiceAmount = indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,practiceAmount));
-			List<IndexBaseMonthData> otherAmount = indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetails(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
-			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,otherAmount));
+			//经营数据查询
+			this.syncOperation(startDate1,endDate1,arrayList,tenantId,result,typeDateMap);
 		}
 
 		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(MUSIC_GROUP_COURSE.getCode())||dataTypes.contains(VIP_GROUP_COURSE.getCode())
 				||dataTypes.contains(VIP_GROUP_ONLINE_COURSE.getCode())||dataTypes.contains(VIP_GROUP_OFFLINE_COURSE.getCode())
 				||dataTypes.contains(PRACTICE_GROUP_COURSE.getCode())){
 			if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.MUSIC_GROUP_COURSE.getCode())) && organIds != null) {
-				List<IndexBaseMonthData> musicCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.MUSIC, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
+				List<IndexBaseMonthData> musicCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate1, endDate1, GroupType.MUSIC, null, null, arrayList,tenantId);
 				typeDateMap.put(MUSIC_GROUP_COURSE,musicCourseData);
 			}
 
 			if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.VIP_GROUP_COURSE.getCode())) && organIds != null) {
-				List<IndexBaseMonthData> vipCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
-				List<OrganVipGroupCategoryCourseNumDto> vipGroupCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
+				List<IndexBaseMonthData> vipCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate1, endDate1, GroupType.VIP, null, null, arrayList,tenantId);
+				List<OrganVipGroupCategoryCourseNumDto> vipGroupCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, null, arrayList,tenantId);
 				Map<Integer, Map<String, Integer>> organCategoryCourseMap = new HashMap<>();
 				if (!CollectionUtils.isEmpty(vipGroupCategoryCourseData)) {
 					organCategoryCourseMap = vipGroupCategoryCourseData.stream().collect(Collectors.groupingBy(OrganVipGroupCategoryCourseNumDto::getOrganId, Collectors.toMap(OrganVipGroupCategoryCourseNumDto::getCategoryName, o -> o.getCourseNum())));
@@ -220,8 +192,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 
 			if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.VIP_GROUP_ONLINE_COURSE.getCode())) && organIds != null) {
-				List<IndexBaseMonthData> vipOnlineCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, TeachModeEnum.ONLINE, new ArrayList<>(organIds),queryInfo.getTenantId());
-				List<OrganVipGroupCategoryCourseNumDto> vipGroupOnlineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, TeachModeEnum.ONLINE, new ArrayList<>(organIds),queryInfo.getTenantId());
+				List<IndexBaseMonthData> vipOnlineCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.ONLINE, arrayList,tenantId);
+				List<OrganVipGroupCategoryCourseNumDto> vipGroupOnlineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.ONLINE, arrayList,tenantId);
 				Map<Integer, Map<String, Integer>> organOnlineCategoryCourseMap = new HashMap<>();
 				if (!CollectionUtils.isEmpty(vipGroupOnlineCategoryCourseData)) {
 					organOnlineCategoryCourseMap = vipGroupOnlineCategoryCourseData.stream().collect(Collectors.groupingBy(OrganVipGroupCategoryCourseNumDto::getOrganId, Collectors.toMap(OrganVipGroupCategoryCourseNumDto::getCategoryName, o -> o.getCourseNum())));
@@ -235,8 +207,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 
 			if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.VIP_GROUP_OFFLINE_COURSE.getCode())) && organIds != null) {
-				List<IndexBaseMonthData> vipOfflineCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, TeachModeEnum.OFFLINE, new ArrayList<>(organIds),queryInfo.getTenantId());
-				List<OrganVipGroupCategoryCourseNumDto> vipGroupOfflineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate.toString(), endDate.toString(), GroupType.VIP, null, TeachModeEnum.OFFLINE, new ArrayList<>(organIds),queryInfo.getTenantId());
+				List<IndexBaseMonthData> vipOfflineCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.OFFLINE, arrayList,tenantId);
+				List<OrganVipGroupCategoryCourseNumDto> vipGroupOfflineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.OFFLINE, arrayList,tenantId);
 				Map<Integer, Map<String, Integer>> organOfflineCategoryCourseMap = new HashMap<>();
 				if (!CollectionUtils.isEmpty(vipGroupOfflineCategoryCourseData)) {
 					organOfflineCategoryCourseMap = vipGroupOfflineCategoryCourseData.stream().collect(Collectors.groupingBy(OrganVipGroupCategoryCourseNumDto::getOrganId, Collectors.toMap(OrganVipGroupCategoryCourseNumDto::getCategoryName, o -> o.getCourseNum())));
@@ -250,7 +222,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 
 			if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.PRACTICE_GROUP_COURSE.getCode())) && organIds != null) {
-				List<IndexBaseMonthData> practiceCourses = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.PRACTICE, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
+				List<IndexBaseMonthData> practiceCourses = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate1, endDate1, GroupType.PRACTICE, null, null, arrayList,tenantId);
 				typeDateMap.put(PRACTICE_GROUP_COURSE,practiceCourses);
 			}
 		}
@@ -277,16 +249,19 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			typeDateMap.put(dataType, new ArrayList<>(Arrays.asList(indexBaseMonthData)));
 		}
 
-
+		Boolean addFlag = false;
+		if(CollectionUtils.isEmpty(result)){
+			addFlag = true;
+		}
 		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
 			List<IndexBaseMonthData> value = typeDateMapEntry.getValue();
 			Set<String> hasMonths = value.stream().filter(e->e.getMonth() != null).map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
 			LocalDate currentMonthDate = startDate;
 			while (currentMonthDate.compareTo(endDate)<=0){
 				if((IndexDataType.HOMEWORK_CREATE_RATE.equals(typeDateMapEntry.getKey())
-						||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())
-						||IndexDataType.HOMEWORK_COMMENT_RATE.equals(typeDateMapEntry.getKey()))
-						&&currentMonthDate.getDayOfWeek()!=DayOfWeek.MONDAY){
+					||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())
+					||IndexDataType.HOMEWORK_COMMENT_RATE.equals(typeDateMapEntry.getKey()))
+					&&currentMonthDate.getDayOfWeek()!=DayOfWeek.MONDAY){
 					currentMonthDate = currentMonthDate.plusDays(1);
 					continue;
 				}
@@ -313,9 +288,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 					indexBaseMonthData.setPercent(indexBaseMonthData.getActivateNum().divide(indexBaseMonthData.getTotalNum(), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
 				}
 			}
-			IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
-			indexBaseData.setIndexMonthData(value, currentMonth);
+
 			if(OTHER_AMOUNT.equals(typeDateMapEntry.getKey())){
+				IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
+				indexBaseData.setIndexMonthData(value, currentMonth);
 				List<IndexBaseMonthData> otherAmountDetails = new ArrayList<>();
 				if(value != null && value.size() > 0){
 					Map<String, List<IndexBaseMonthData>> collect = value.stream().filter(c->StringUtils.isNotEmpty(c.getOrderType())).collect(Collectors.groupingBy(e -> e.getOrderType()));
@@ -328,41 +304,127 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 					});
 				}
 				indexBaseData.setIndexMonthDataDetail(otherAmountDetails);
+				indexBaseData.setIndexMonthData(value, currentMonth);
+				indexBaseData.setPercent(value.stream().map(IndexBaseMonthData::getPercent).reduce(BigDecimal.ZERO, BigDecimal::add));
+				result.add(indexBaseData);
+				continue;
 			}
-			if(FINANCE_PAY.equals(typeDateMapEntry.getKey()) || FINANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
-					FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
+			if(FINANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
+				FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 					TOTAL_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 					APPLY_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 					RENEW_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 					VIP_AMOUNT.equals(typeDateMapEntry.getKey()) ||
-					PRACTICE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
-					OTHER_AMOUNT.equals(typeDateMapEntry.getKey())){
+					PRACTICE_AMOUNT.equals(typeDateMapEntry.getKey())){
+				IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
+				indexBaseData.setIndexMonthData(value, currentMonth);
 				indexBaseData.setPercent(value.stream().map(IndexBaseMonthData::getPercent).reduce(BigDecimal.ZERO, BigDecimal::add));
+				result.add(indexBaseData);
+				continue;
 			}
 			if(IndexDataType.VIP_GROUP_COURSE.equals(typeDateMapEntry.getKey()) || VIP_GROUP_ONLINE_COURSE.equals(typeDateMapEntry.getKey()) ||
 					IndexDataType.VIP_GROUP_OFFLINE_COURSE.equals(typeDateMapEntry.getKey())){
+				IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
+				indexBaseData.setIndexMonthData(value, currentMonth);
 				for (IndexBaseMonthData indexBaseMonthData : indexBaseData.getIndexMonthData()) {
 					if(vipCategoryCourseListMap.containsKey(indexBaseMonthData.getMonth())&&vipCategoryCourseListMap.get(indexBaseMonthData.getMonth()).containsKey(indexBaseData.getDataType())){
 						TreeMap<String, Integer> extendSortMap = new TreeMap<>(vipCategoryCourseListMap.get(indexBaseMonthData.getMonth()).get(indexBaseData.getDataType()));
 						indexBaseMonthData.setExtendInfo(JSON.toJSONString(extendSortMap));
 					}
 				}
+				result.add(indexBaseData);
+				continue;
 			}
 			if(QUIT_MUSIC_GROUP_STUDENT_NUM.equals(typeDateMapEntry.getKey())){
 				//查询时间段内学员成功退团申请的数量
+				IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
+				indexBaseData.setIndexMonthData(value, currentMonth);
 				Integer quitNum = musicGroupDao.countQuitNum(queryInfo);
 				indexBaseData.setIndexMonthData(new ArrayList<>(),null);
 				indexBaseData.setIndexMonthDataDetail(new ArrayList<>());
 				indexBaseData.setDataType(QUIT_MUSIC_GROUP_STUDENT_NUM);
 				indexBaseData.setPercent(new BigDecimal(quitNum));
 				indexBaseData.setTitle(QUIT_MUSIC_GROUP_STUDENT_NUM.getMsg());
+				result.add(indexBaseData);
+				continue;
+			}
+			if(addFlag){
+				IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
+				indexBaseData.setIndexMonthData(value, currentMonth);
+				result.add(indexBaseData);
 			}
-			result.add(indexBaseData);
 		}
-		result.addAll(indexBaseDtoList);
 		return result;
 	}
 
+	//异步处理经营数据查询
+	public void syncOperation(String startDate1,String endDate1,List<Integer> arrayList,Integer tenantId,List<IndexBaseDto> indexBaseDtoList,Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap){
+		CompletableFuture future1 = CompletableFuture.supplyAsync(() -> {
+//			List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_RENEW_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"RENEW",null,tenantId)));
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_VIP_AMOUNT,indexBaseMonthDataDao.getOrganVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId)));
+//			return indexBaseDtoList;
+			return true;
+		},exportExecutorService);
+		CompletableFuture future2 = CompletableFuture.supplyAsync(() -> {
+//			List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_PRACTICE_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,tenantId)));
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_OTHER_AMOUNT,indexBaseMonthDataDao.getOrganOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId)));
+//			return indexBaseDtoList;
+			return true;
+		},exportExecutorService);
+		CompletableFuture future3 = CompletableFuture.supplyAsync(() -> {
+//			List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
+			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_TOTAL_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimely(startDate1, endDate1, arrayList,tenantId)));
+			//经营报表细化
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_APPLY_AMOUNT,indexBaseMonthDataDao.getOrganTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"APPLY,ADD_STUDENT",null,tenantId)));
+//			return indexBaseDtoList;
+			return true;
+		},exportExecutorService);
+		CompletableFuture future4 = CompletableFuture.supplyAsync(() -> {
+//			List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
+			indexBaseDtoList.add(this.getIndexBaseDto(IndexDataType.ORGAN_FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId)));
+			indexBaseDtoList.add(this.getIndexBaseDto(ORGAN_FINANCE_AMOUNT,indexBaseMonthDataDao.getOrganFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId)));
+//			return indexBaseDtoList;
+			return true;
+		},exportExecutorService);
+
+		CompletableFuture future5 = CompletableFuture.supplyAsync(()->{
+//			Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = new HashMap<>(2);
+			typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate1, endDate1, arrayList,tenantId));
+			typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate1, endDate1, arrayList,tenantId));
+			return true;
+		},exportExecutorService);
+		CompletableFuture future6 = CompletableFuture.supplyAsync(()->{
+//			Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = new HashMap<>(2);
+			List<IndexBaseMonthData> renewAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"RENEW",null,tenantId);
+			typeDateMap.put(RENEW_AMOUNT,renewAmount);
+			List<IndexBaseMonthData> vipAmount = indexBaseMonthDataDao.getVipAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId);
+			typeDateMap.put(VIP_AMOUNT,vipAmount);
+			return true;
+		},exportExecutorService);
+		CompletableFuture future7 = CompletableFuture.supplyAsync(()->{
+//			Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = new HashMap<>(2);
+			List<IndexBaseMonthData> totalAmountDataWithTimely = indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate1, endDate1, arrayList,tenantId);
+			typeDateMap.put(IndexDataType.TOTAL_AMOUNT,totalAmountDataWithTimely);
+			//经营报表细化
+			List<IndexBaseMonthData> applyAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"APPLY,ADD_STUDENT",null,tenantId);
+			typeDateMap.put(APPLY_AMOUNT,applyAmount);
+			return true;
+		},exportExecutorService);
+		CompletableFuture future8 = CompletableFuture.supplyAsync(()->{
+//			Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = new HashMap<>(2);
+			List<IndexBaseMonthData> practiceAmount = indexBaseMonthDataDao.getTotalAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,"PRACTICE_GROUP_BUY,PRACTICE_GROUP_RENEW",null,tenantId);
+			typeDateMap.put(PRACTICE_AMOUNT,practiceAmount);
+			List<IndexBaseMonthData> otherAmount = indexBaseMonthDataDao.getOtherAmountDataWithTimelyDetails(startDate1, endDate1, arrayList,tenantId);
+			typeDateMap.put(OTHER_AMOUNT,otherAmount);
+			return true;
+		},exportExecutorService);
+		future1.join();future2.join();future3.join();future4.join();
+		future5.join();future6.join();future7.join();future8.join();
+	}
+
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void indexBaseDataTask(Integer tenantId, String dayStr, Set<IndexDataType> dataTypes) {
@@ -404,8 +466,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			if (transactionTeachers != null) {
 				for (SimpleUserDto transactionTeacher : transactionTeachers) {
 					Set<Integer> organIds = Arrays.stream(transactionTeacher.getOrganIds().split(","))
-							.map(s -> Integer.valueOf(s))
-							.collect(Collectors.toSet());
+												  .map(s -> Integer.valueOf(s))
+												  .collect(Collectors.toSet());
 					for (Integer organId : organIds) {
 						if (organTeacherNumMap.containsKey(organId)) {
 							organTeacherNumMap.put(organId, organTeacherNumMap.get(organId) + 1);