|  | @@ -5,19 +5,19 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUserRole;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.IndexBaseDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.IndexErrorDataExportDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.OrganVipGroupCategoryCourseNumDto;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.dto.SimpleUserDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dto.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.IndexDataQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.page.OrganCloudStudyStudentDataQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.EmployeeService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.constant.CommonConstants;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.date.DateUtil;
 | 
	
	
		
			
				|  | @@ -505,36 +505,40 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		//云教练相关
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organsStudentNumMapList = studentDao.getOrgansStudentNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organsStudentNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organsStudentNumMapList)){
 | 
	
		
			
				|  |  | -//			organsStudentNumMap = MapUtil.convertIntegerMap(organsStudentNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organsVipStudentNumMapList = cloudTeacherDao.getOrgansVipStudentNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organsVipStudentNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organsVipStudentNumMapList)){
 | 
	
		
			
				|  |  | -//			organsVipStudentNumMap = MapUtil.convertIntegerMap(organsVipStudentNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organsEVipStudentNumMapList = studentDao.getOrgansEVipStudentNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organsEVipStudentNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organsEVipStudentNumMapList)){
 | 
	
		
			
				|  |  | -//			organsEVipStudentNumMap = MapUtil.convertIntegerMap(organsEVipStudentNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organCloudStudyStudentNumMapList = studentDao.getOrganCloudStudyStudentNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organCloudStudyStudentNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organCloudStudyStudentNumMapList)){
 | 
	
		
			
				|  |  | -//			organCloudStudyStudentNumMap = MapUtil.convertIntegerMap(organCloudStudyStudentNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organCloudStudyLivelyStudentNumMapList = studentDao.getOrganCloudStudyLivelyStudentNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organCloudStudyLivelyStudentNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organCloudStudyLivelyStudentNumMapList)){
 | 
	
		
			
				|  |  | -//			organCloudStudyLivelyStudentNumMap = MapUtil.convertIntegerMap(organCloudStudyLivelyStudentNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | -//		List<Map<Integer, Integer>> organsNewCloudStudyNumMapList = sysMusicCompareRecordDao.getOrgansNewCloudStudyNum(organIds);
 | 
	
		
			
				|  |  | -//		Map<String, Long> organsNewCloudStudyNumMap = new HashMap<>();
 | 
	
		
			
				|  |  | -//		if(!CollectionUtils.isEmpty(organsNewCloudStudyNumMapList)){
 | 
	
		
			
				|  |  | -//			organsNewCloudStudyNumMap = MapUtil.convertIntegerMap(organsNewCloudStudyNumMapList);
 | 
	
		
			
				|  |  | -//		}
 | 
	
		
			
				|  |  | +		//分部学员数量
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.ORGAN_TOTAL_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getOrgansStudentNumData(dayStr), dayStr, IndexDataType.ORGAN_TOTAL_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//会员数量
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.MEMBER_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getMemberStudentNumData(dayStr), dayStr, IndexDataType.MEMBER_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//新增会员数量
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.NEW_MEMBER_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getNewMemberStudentNumData(dayStr), dayStr, IndexDataType.NEW_MEMBER_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//试用会员数量
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.EXPERIENCE_MEMBER_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getExperienceMemberStudentNumData(dayStr), dayStr, IndexDataType.EXPERIENCE_MEMBER_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//云教练使用用户
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.CLOUD_STUDY_DAY_USE_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getCloudStudyDayUseStudentNumData(dayStr), dayStr, IndexDataType.CLOUD_STUDY_DAY_USE_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//活跃用户
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.CLOUD_STUDY_LIVELY_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getCloudStudyLivelyStudentNumData(dayStr), dayStr, IndexDataType.CLOUD_STUDY_LIVELY_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		//云教练新增人数
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.CLOUD_STUDY_NEW_STUDENT_NUM)) {
 | 
	
		
			
				|  |  | +			saveData(indexBaseMonthDataDao.getCloudStudyLivelyStudentNumData(dayStr), dayStr, IndexDataType.CLOUD_STUDY_NEW_STUDENT_NUM);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1222,4 +1226,111 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		return resultMap;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  | +	public PageInfo<EduOrganStudentDataDto> organStudentOverView(List<Integer> organIds, OrganCloudStudyStudentDataQueryInfo queryInfo) {
 | 
	
		
			
				|  |  | +		PageInfo<EduOrganStudentDataDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 | 
	
		
			
				|  |  | +		List<Organization> organs = organizationDao.getOrgans(organIds);
 | 
	
		
			
				|  |  | +		pageInfo.setTotal(organs.size());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if(CollectionUtils.isEmpty(organs)){
 | 
	
		
			
				|  |  | +			return pageInfo;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		Set<String> dataTypes = new HashSet<String>(){{
 | 
	
		
			
				|  |  | +			add(CLOUD_STUDY_LIVELY_STUDENT_NUM.getCode());add(MEMBER_STUDENT_NUM.getCode());add(EXPERIENCE_MEMBER_STUDENT_NUM.getCode());
 | 
	
		
			
				|  |  | +			add(NEW_MEMBER_STUDENT_NUM.getCode());add(ORGAN_TOTAL_STUDENT_NUM.getCode());add(CLOUD_STUDY_NEW_STUDENT_NUM.getCode());}};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<IndexBaseMonthData> indexBaseDatas = indexBaseMonthDataDao.getIndexBaseData(new HashSet<>(organIds), dataTypes, queryInfo.getDate(), queryInfo.getDate());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organsStudentNumMap = indexBaseDatas.stream().filter(i->ORGAN_TOTAL_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organsVipStudentNumMap = indexBaseDatas.stream().filter(i->MEMBER_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organsEVipStudentNumMap = indexBaseDatas.stream().filter(i->EXPERIENCE_MEMBER_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organCloudStudyLivelyStudentNumMap =indexBaseDatas.stream().filter(i->CLOUD_STUDY_LIVELY_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organsNewMemberStudentNumMap = indexBaseDatas.stream().filter(i->NEW_MEMBER_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Map<Integer, Integer> organsNewCloudStudyStudentNumMap = indexBaseDatas.stream().filter(i->CLOUD_STUDY_NEW_STUDENT_NUM.equals(i.getDataType())).collect(Collectors.toMap(IndexBaseMonthData::getOrganId, i->i.getActivateNum().intValue(), (i1, i2)->i1));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<EduOrganStudentDataDto> result = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		for (Organization organ : organs) {
 | 
	
		
			
				|  |  | +			EduOrganStudentDataDto organStudentVipData = new EduOrganStudentDataDto();
 | 
	
		
			
				|  |  | +			organStudentVipData.setOrganId(organ.getId());
 | 
	
		
			
				|  |  | +			organStudentVipData.setOrganName(organ.getName());
 | 
	
		
			
				|  |  | +			if(organsStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.setTotalStudentNum(organsStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organsVipStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.setVipStudentNum(organsVipStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organsEVipStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.seteVipStudentNum(organsEVipStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organCloudStudyLivelyStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.setCloudStudyLivelyStudentNum(organCloudStudyLivelyStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organsNewMemberStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.setNewMemberStudentNum(organsNewMemberStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organsNewCloudStudyStudentNumMap.containsKey(organ.getId())){
 | 
	
		
			
				|  |  | +				organStudentVipData.setNewCloudStudyStudentNum(organsNewCloudStudyStudentNumMap.get(organ.getId()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organStudentVipData.getCloudStudyLivelyStudentNum()>0&&organStudentVipData.getTotalStudentNum()>0){
 | 
	
		
			
				|  |  | +				organStudentVipData.setCloudStudyLivelyStudentDuty(new BigDecimal(organStudentVipData.getCloudStudyLivelyStudentNum()).divide(new BigDecimal(organStudentVipData.getTotalStudentNum()), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).floatValue());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			if(organStudentVipData.getCloudStudyUseStudentNum()>0&&organStudentVipData.getTotalStudentNum()>0){
 | 
	
		
			
				|  |  | +				organStudentVipData.setCloudStudyUseStudentDuty(new BigDecimal(organStudentVipData.getCloudStudyUseStudentNum()).divide(new BigDecimal(organStudentVipData.getTotalStudentNum()), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).floatValue());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			result.add(organStudentVipData);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		Comparator<EduOrganStudentDataDto> comparing = null;
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotBlank(queryInfo.getCloudStudyLivelyStudentNum())){
 | 
	
		
			
				|  |  | +			if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +				comparing = Comparator.comparing(EduOrganStudentDataDto::getCloudStudyLivelyStudentNum, "ASC".equals(queryInfo.getCloudStudyLivelyStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}else{
 | 
	
		
			
				|  |  | +				comparing.thenComparing(EduOrganStudentDataDto::getCloudStudyLivelyStudentNum, "ASC".equals(queryInfo.getCloudStudyLivelyStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotBlank(queryInfo.getVipStudentNum())){
 | 
	
		
			
				|  |  | +			if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +				comparing = Comparator.comparing(EduOrganStudentDataDto::getVipStudentNum, "ASC".equals(queryInfo.getVipStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}else{
 | 
	
		
			
				|  |  | +				comparing.thenComparing(EduOrganStudentDataDto::getVipStudentNum, "ASC".equals(queryInfo.getVipStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotBlank(queryInfo.geteVipStudentNum())){
 | 
	
		
			
				|  |  | +			if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +				comparing = Comparator.comparing(EduOrganStudentDataDto::geteVipStudentNum, "ASC".equals(queryInfo.geteVipStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}else{
 | 
	
		
			
				|  |  | +				comparing.thenComparing(EduOrganStudentDataDto::geteVipStudentNum, "ASC".equals(queryInfo.geteVipStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotBlank(queryInfo.getNewMemberStudentNum())){
 | 
	
		
			
				|  |  | +			if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +				comparing = Comparator.comparing(EduOrganStudentDataDto::getNewMemberStudentNum, "ASC".equals(queryInfo.getNewMemberStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}else{
 | 
	
		
			
				|  |  | +				comparing.thenComparing(EduOrganStudentDataDto::getNewMemberStudentNum, "ASC".equals(queryInfo.getNewMemberStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotBlank(queryInfo.getCloudStudyLivelyStudentDuty())){
 | 
	
		
			
				|  |  | +			if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +				comparing = Comparator.comparing(EduOrganStudentDataDto::getCloudStudyLivelyStudentDuty, "ASC".equals(queryInfo.getCloudStudyLivelyStudentDuty())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}else{
 | 
	
		
			
				|  |  | +				comparing.thenComparing(EduOrganStudentDataDto::getCloudStudyLivelyStudentDuty, "ASC".equals(queryInfo.getCloudStudyLivelyStudentDuty())?Comparator.naturalOrder():Comparator.reverseOrder());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if(Objects.isNull(comparing)){
 | 
	
		
			
				|  |  | +			comparing = Comparator.comparing(EduOrganStudentDataDto::getOrganId);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		result = result.stream().skip(pageInfo.getOffset()).limit(pageInfo.getLimit()).sorted(comparing).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +		pageInfo.setRows(result);
 | 
	
		
			
				|  |  | +		return pageInfo;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  }
 |