|
@@ -1,7 +1,6 @@
|
|
|
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.*;
|
|
@@ -20,7 +19,6 @@ 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;
|
|
@@ -31,10 +29,6 @@ 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.*;
|
|
@@ -64,12 +58,13 @@ 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
|
|
@@ -121,11 +116,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
dataTypes = Arrays.stream(queryInfo.getDataTypes().split(",")).collect(Collectors.toSet());
|
|
|
}
|
|
|
|
|
|
- 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);
|
|
|
+ List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(organIds, dataTypes, startDate.toString(), endDate.toString(),queryInfo.getTenantId());
|
|
|
if(Objects.isNull(indexBaseDatas)){
|
|
|
indexBaseDatas = new ArrayList<>();
|
|
|
}
|
|
@@ -136,7 +127,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, startDate1, endDate1,tenantId);
|
|
|
+ List<IndexBaseMonthData> indexBaseDataList = indexBaseMonthDataDao.getVipCourseDataList(organIds, vipDataTypes, startDate.toString(), endDate.toString(),queryInfo.getTenantId());
|
|
|
if(!CollectionUtils.isEmpty(indexBaseDataList)){
|
|
|
for (IndexBaseMonthData indexBaseMonthData : indexBaseDataList) {
|
|
|
if(StringUtils.isBlank(indexBaseMonthData.getExtendInfo())){
|
|
@@ -161,24 +152,61 @@ 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);
|
|
|
+ }
|
|
|
//按分部汇总
|
|
|
- if((CollectionUtils.isEmpty(dataTypes) || dataTypes.contains(ORGAN_FINANCE_BALANCE_AMOUNT.getCode()) ||
|
|
|
+ List<IndexBaseDto> indexBaseDtoList = new ArrayList<>();
|
|
|
+ if((CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(ORGAN_FINANCE_PAY.getCode())||dataTypes.contains(ORGAN_FINANCE_BALANCE_AMOUNT.getCode())||
|
|
|
dataTypes.contains(ORGAN_FINANCE_AMOUNT.getCode())) && organIds != null){
|
|
|
- //经营数据查询
|
|
|
- this.syncOperation(startDate1,endDate1,arrayList,tenantId,result,typeDateMap);
|
|
|
+ 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));
|
|
|
}
|
|
|
|
|
|
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, startDate1, endDate1, GroupType.MUSIC, null, null, arrayList,tenantId);
|
|
|
+ List<IndexBaseMonthData> musicCourseData = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.MUSIC, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
|
|
|
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, startDate1, endDate1, GroupType.VIP, null, null, arrayList,tenantId);
|
|
|
- List<OrganVipGroupCategoryCourseNumDto> vipGroupCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, null, arrayList,tenantId);
|
|
|
+ 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());
|
|
|
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())));
|
|
@@ -192,8 +220,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, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.ONLINE, arrayList,tenantId);
|
|
|
- List<OrganVipGroupCategoryCourseNumDto> vipGroupOnlineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.ONLINE, arrayList,tenantId);
|
|
|
+ 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());
|
|
|
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())));
|
|
@@ -207,8 +235,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, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.OFFLINE, arrayList,tenantId);
|
|
|
- List<OrganVipGroupCategoryCourseNumDto> vipGroupOfflineCategoryCourseData = indexBaseMonthDataDao.getVipGroupCategoryCourseData(null, startDate1, endDate1, GroupType.VIP, null, TeachModeEnum.OFFLINE, arrayList,tenantId);
|
|
|
+ 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());
|
|
|
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())));
|
|
@@ -222,7 +250,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, startDate1, endDate1, GroupType.PRACTICE, null, null, arrayList,tenantId);
|
|
|
+ List<IndexBaseMonthData> practiceCourses = indexBaseMonthDataDao.getGroupCourseDataWithGroup(null, startDate.toString(), endDate.toString(), GroupType.PRACTICE, null, null, new ArrayList<>(organIds),queryInfo.getTenantId());
|
|
|
typeDateMap.put(PRACTICE_GROUP_COURSE,practiceCourses);
|
|
|
}
|
|
|
}
|
|
@@ -256,9 +284,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
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()))
|
|
|
- &¤tMonthDate.getDayOfWeek()!=DayOfWeek.MONDAY){
|
|
|
+ ||IndexDataType.HOMEWORK_SUBMIT_RATE.equals(typeDateMapEntry.getKey())
|
|
|
+ ||IndexDataType.HOMEWORK_COMMENT_RATE.equals(typeDateMapEntry.getKey()))
|
|
|
+ &¤tMonthDate.getDayOfWeek()!=DayOfWeek.MONDAY){
|
|
|
currentMonthDate = currentMonthDate.plusDays(1);
|
|
|
continue;
|
|
|
}
|
|
@@ -285,10 +313,9 @@ 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()));
|
|
@@ -301,127 +328,46 @@ 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_AMOUNT.equals(typeDateMapEntry.getKey()) ||
|
|
|
- FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
|
|
|
+ if(FINANCE_PAY.equals(typeDateMapEntry.getKey()) || 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())){
|
|
|
- IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
|
|
|
- indexBaseData.setIndexMonthData(value, currentMonth);
|
|
|
+ PRACTICE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
|
|
|
+ OTHER_AMOUNT.equals(typeDateMapEntry.getKey())){
|
|
|
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;
|
|
|
}
|
|
|
+ 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) {
|
|
|
LocalDate nowDate = LocalDate.now();
|
|
|
-
|
|
|
+
|
|
|
List<Organization> allOrgans = organizationService.findAllOrgans(tenantId);
|
|
|
this.organIds.get().clear();
|
|
|
this.organIds.get().addAll(allOrgans.stream().map(Organization::getId).collect(Collectors.toSet()));
|
|
@@ -458,8 +404,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);
|
|
@@ -941,7 +887,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
|
|
|
Map<Integer, Integer> studentErrorLeaveMap = new HashMap<>();
|
|
|
//会员过期学员数
|
|
|
Map<Integer, Integer> noMemberStudentMap = new HashMap<>();
|
|
|
-
|
|
|
+
|
|
|
Integer tenantId = TenantContextHolder.getTenantId();
|
|
|
|
|
|
if(IndexErrorType.MUSIC_PATROL.equals(errorType)||Objects.isNull(errorType)){
|