|
@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dao.*;
|
|
|
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.OrganCloudStudyStudentDataQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.StudentQueryInfo;
|
|
|
import com.ym.mec.biz.service.StudentService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
@@ -502,6 +503,146 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public PageInfo<EduOrganStudentDataDto> queryOrganStudentOverView(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;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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().toString())){
|
|
|
+ organStudentVipData.setTotalStudentNum(organsStudentNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ if(organsVipStudentNumMap.containsKey(organ.getId().toString())){
|
|
|
+ organStudentVipData.setVipStudentNum(organsVipStudentNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ if(organsEVipStudentNumMap.containsKey(organ.getId().toString())){
|
|
|
+ organStudentVipData.seteVipStudentNum(organsEVipStudentNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ if(organCloudStudyStudentNumMap.containsKey(organ.getId().toString())){
|
|
|
+ organStudentVipData.setCloudStudyUseStudentNum(organCloudStudyStudentNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ if(organCloudStudyLivelyStudentNumMap.containsKey(organ.getId().toString())){
|
|
|
+ organStudentVipData.setCloudStudyLivelyStudentNum(organCloudStudyLivelyStudentNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ if(organStudentVipData.getVipStudentNum()>0&&organStudentVipData.getTotalStudentNum()>0){
|
|
|
+ organStudentVipData.setVipStudentDuty(new BigDecimal(organStudentVipData.getVipStudentNum()).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());
|
|
|
+ }
|
|
|
+ if(organsNewCloudStudyNumMap.containsKey(organ.getId().toString())){
|
|
|
+ organStudentVipData.setNewCloudStudyStudentNum(organsNewCloudStudyNumMap.get(organ.getId().toString()).intValue());
|
|
|
+ }
|
|
|
+ result.add(organStudentVipData);
|
|
|
+ }
|
|
|
+ Comparator<EduOrganStudentDataDto> comparing = null;
|
|
|
+ if(StringUtils.isNotBlank(queryInfo.getTotalStudentNum())){
|
|
|
+ if(Objects.isNull(comparing)){
|
|
|
+ comparing = Comparator.comparing(EduOrganStudentDataDto::getTotalStudentNum, "ASC".equals(queryInfo.getTotalStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
|
|
|
+ }else{
|
|
|
+ comparing.thenComparing(EduOrganStudentDataDto::getTotalStudentNum, "ASC".equals(queryInfo.getTotalStudentNum())?Comparator.naturalOrder():Comparator.reverseOrder());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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.getCloudStudyUseStudentDuty())){
|
|
|
+ if(Objects.isNull(comparing)){
|
|
|
+ comparing = Comparator.comparing(EduOrganStudentDataDto::getCloudStudyUseStudentDuty, "ASC".equals(queryInfo.getCloudStudyUseStudentDuty())?Comparator.naturalOrder():Comparator.reverseOrder());
|
|
|
+ }else{
|
|
|
+ comparing.thenComparing(EduOrganStudentDataDto::getCloudStudyUseStudentDuty, "ASC".equals(queryInfo.getCloudStudyUseStudentDuty())?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.getVipStudentDuty())){
|
|
|
+ if(Objects.isNull(comparing)){
|
|
|
+ comparing = Comparator.comparing(EduOrganStudentDataDto::getVipStudentDuty, "ASC".equals(queryInfo.getVipStudentDuty())?Comparator.naturalOrder():Comparator.reverseOrder());
|
|
|
+ }else{
|
|
|
+ comparing.thenComparing(EduOrganStudentDataDto::getVipStudentDuty, "ASC".equals(queryInfo.getVipStudentDuty())?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;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public CloudStudyStudentDataDto getCloudStudyStudentOverView(List<Integer> organIds) {
|
|
|
CloudStudyStudentDataDto result = new CloudStudyStudentDataDto();
|
|
|
result.setTotalStudentNum(studentDao.getOrgansTotalStudentNum(organIds));
|