|
|
@@ -1,20 +1,15 @@
|
|
|
package com.xjrsoft.module.student.service.impl;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
-import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.base.entity.BaseMajorSet;
|
|
|
-import com.xjrsoft.module.oa.vo.NewsAppendixVo;
|
|
|
+import com.xjrsoft.module.student.dto.EnrollmentStatisticsCalendarInfoDto;
|
|
|
+import com.xjrsoft.module.student.dto.EnrollmentStatisticsGraduationInfoDto;
|
|
|
import com.xjrsoft.module.student.entity.*;
|
|
|
import com.xjrsoft.module.student.mapper.PbCseFeeobjupdateMapper;
|
|
|
import com.xjrsoft.module.student.service.IPbCseFeeobjupdateService;
|
|
|
-import com.xjrsoft.module.student.vo.ChargingSituationVo;
|
|
|
-import com.xjrsoft.module.student.vo.EnrollmentStatisticsInfoKeyValue;
|
|
|
-import com.xjrsoft.module.student.vo.EnrollmentStatisticsInfoVo;
|
|
|
-import com.xjrsoft.module.student.vo.PbCseFeeobjupdatePageVo;
|
|
|
-import com.xjrsoft.module.system.entity.File;
|
|
|
-import com.xjrsoft.module.textbook.dto.EnrollmentStatisticsInfoDto;
|
|
|
+import com.xjrsoft.module.student.vo.*;
|
|
|
+import com.xjrsoft.module.student.dto.EnrollmentStatisticsInfoDto;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -40,84 +35,6 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
@Override
|
|
|
public EnrollmentStatisticsInfoVo getEnrollmentStatisticsInfo(EnrollmentStatisticsInfoDto dto) {
|
|
|
EnrollmentStatisticsInfoVo result = new EnrollmentStatisticsInfoVo();
|
|
|
- String firstDayOfMonthStr;
|
|
|
- String lastDayOfMonthStr;
|
|
|
- if(dto.getYearMonth() != null && !dto.getYearMonth().equals("")){
|
|
|
- LocalDate date = LocalDate.parse(dto.getYearMonth() + "-01"); // 假设给定日期为2022年9月15日
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- // 获取本月的第一天
|
|
|
- LocalDate firstDayOfMonth = date.withDayOfMonth(1);
|
|
|
- firstDayOfMonthStr = firstDayOfMonth.format(formatter);
|
|
|
- // 获取下月的第一天
|
|
|
- LocalDate lastDayOfMonth = date.plusMonths(1).withDayOfMonth(1);
|
|
|
- lastDayOfMonthStr = lastDayOfMonth.format(formatter);
|
|
|
- }else {
|
|
|
- LocalDate today = LocalDate.now();
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- // 获取月份的第一天
|
|
|
- LocalDate firstDayOfMonth = today.withDayOfMonth(1);
|
|
|
- firstDayOfMonthStr = firstDayOfMonth.format(formatter);
|
|
|
- // 获取下月的第一天
|
|
|
- LocalDate lastDayOfMonth = today.plusMonths(1).withDayOfMonth(1);
|
|
|
- lastDayOfMonthStr = lastDayOfMonth.format(formatter);
|
|
|
- }
|
|
|
-
|
|
|
- //根据年月获取招生数量
|
|
|
- MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateByYearMonth = new MPJLambdaWrapper<>();
|
|
|
- pbCseFeeobjupdateByYearMonth
|
|
|
- .distinct()
|
|
|
- .selectAs(PbCseFeeobjupdate::getPersonalid, PbCseFeeobjupdate::getPersonalid)
|
|
|
- .selectAs(PbCseFeeobjupdate::getCratetime, PbCseFeeobjupdate::getCratetime)
|
|
|
- .eq(dto.getYear() != null, PbCseFeeobjupdate::getEnteryear, dto.getYear())
|
|
|
- .between(PbCseFeeobjupdate::getCratetime, firstDayOfMonthStr, lastDayOfMonthStr)
|
|
|
- ;
|
|
|
-
|
|
|
- List<PbCseFeeobjupdate> pbCseFeeobjupdateByYearMonthList = this.selectJoinList(PbCseFeeobjupdate.class, pbCseFeeobjupdateByYearMonth);
|
|
|
-
|
|
|
- if(pbCseFeeobjupdateByYearMonthList != null && !pbCseFeeobjupdateByYearMonthList.isEmpty()) {
|
|
|
- //每日招生人数
|
|
|
- Map<String, Long> cratetime = pbCseFeeobjupdateByYearMonthList.stream().collect(Collectors.groupingBy(pbCseFeeobjupdate -> pbCseFeeobjupdate.getCratetime().substring(0,10), Collectors.counting()));
|
|
|
- if(!cratetime.isEmpty()){
|
|
|
- cratetime = cratetime.entrySet().stream()
|
|
|
- .sorted(Map.Entry.comparingByKey())
|
|
|
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
- (e1, e2) -> e1, LinkedHashMap::new));
|
|
|
- }
|
|
|
- List<EnrollmentStatisticsInfoKeyValue> cratetimeRes = new ArrayList<>();
|
|
|
- for (Map.Entry<String, Long> entry : cratetime.entrySet()) {
|
|
|
- cratetimeRes.add(new EnrollmentStatisticsInfoKeyValue(entry.getKey(), entry.getValue()));
|
|
|
- }
|
|
|
-
|
|
|
- result.setCratetimeList(cratetimeRes);
|
|
|
- }
|
|
|
-
|
|
|
- //根据天获取毕业院校
|
|
|
- MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateByDay = new MPJLambdaWrapper<>();
|
|
|
- pbCseFeeobjupdateByDay
|
|
|
- .distinct()
|
|
|
- .selectAs(PbCseFeeobjupdate::getPersonalid, PbCseFeeobjupdate::getPersonalid)
|
|
|
- .select("ifnull(t.graduations,'未知') as graduations")
|
|
|
- .eq(dto.getYear() != null, PbCseFeeobjupdate::getEnteryear, dto.getYear())
|
|
|
- .like(dto.getDay() != null, PbCseFeeobjupdate::getCratetime, dto.getDay())
|
|
|
- ;
|
|
|
- List<PbCseFeeobjupdate> pbCseFeeobjupdateByDayList = this.selectJoinList(PbCseFeeobjupdate.class, pbCseFeeobjupdateByDay);
|
|
|
- if(pbCseFeeobjupdateByDayList != null && !pbCseFeeobjupdateByDayList.isEmpty()){
|
|
|
- //毕业学校排行
|
|
|
- Map<String, Long> graduations = pbCseFeeobjupdateByDayList.stream().collect(Collectors.groupingBy(PbCseFeeobjupdate::getGraduations, Collectors.counting()));
|
|
|
- if(!graduations.isEmpty()){
|
|
|
- graduations = graduations.entrySet().stream()
|
|
|
- .sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
|
|
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
- (e1, e2) -> e1, LinkedHashMap::new));
|
|
|
- }
|
|
|
- List<EnrollmentStatisticsInfoKeyValue> graduationRes = new ArrayList<>();
|
|
|
- for (Map.Entry<String, Long> entry : graduations.entrySet()) {
|
|
|
- graduationRes.add(new EnrollmentStatisticsInfoKeyValue(entry.getKey(), entry.getValue()));
|
|
|
- }
|
|
|
-
|
|
|
- result.setGraduationList(graduationRes);
|
|
|
- }
|
|
|
-
|
|
|
//获取所有学生的信息
|
|
|
MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
pbCseFeeobjupdateMPJLambdaWrapper
|
|
|
@@ -228,4 +145,79 @@ public class PbCseFeeobjupdateServiceImpl extends MPJBaseServiceImpl<PbCseFeeobj
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public EnrollmentStatisticsCalendarInfoVo getEnrollmentStatisticsCalendarInfo(EnrollmentStatisticsCalendarInfoDto dto) {
|
|
|
+ EnrollmentStatisticsCalendarInfoVo result = new EnrollmentStatisticsCalendarInfoVo();
|
|
|
+ LocalDate endDate = LocalDate.parse(dto.getEndDay());
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LocalDate nextDay = endDate.plusDays(1);
|
|
|
+ dto.setEndDay(nextDay.format(formatter));
|
|
|
+ String year = String.valueOf(endDate.getYear());
|
|
|
+ //根据年月获取招生数量
|
|
|
+ MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateByYearMonth = new MPJLambdaWrapper<>();
|
|
|
+ pbCseFeeobjupdateByYearMonth
|
|
|
+ .distinct()
|
|
|
+ .selectAs(PbCseFeeobjupdate::getPersonalid, PbCseFeeobjupdate::getPersonalid)
|
|
|
+ .selectAs(PbCseFeeobjupdate::getCratetime, PbCseFeeobjupdate::getCratetime)
|
|
|
+ .eq(PbCseFeeobjupdate::getEnteryear, year)
|
|
|
+ .between(PbCseFeeobjupdate::getCratetime, dto.getStartDay(), dto.getEndDay())
|
|
|
+ ;
|
|
|
+
|
|
|
+ List<PbCseFeeobjupdate> pbCseFeeobjupdateByYearMonthList = this.selectJoinList(PbCseFeeobjupdate.class, pbCseFeeobjupdateByYearMonth);
|
|
|
+
|
|
|
+ if(pbCseFeeobjupdateByYearMonthList != null && !pbCseFeeobjupdateByYearMonthList.isEmpty()) {
|
|
|
+ //每日招生人数
|
|
|
+ Map<String, Long> cratetime = pbCseFeeobjupdateByYearMonthList.stream().collect(Collectors.groupingBy(pbCseFeeobjupdate -> pbCseFeeobjupdate.getCratetime().substring(0,10), Collectors.counting()));
|
|
|
+ if(!cratetime.isEmpty()){
|
|
|
+ cratetime = cratetime.entrySet().stream()
|
|
|
+ .sorted(Map.Entry.comparingByKey())
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
+ (e1, e2) -> e1, LinkedHashMap::new));
|
|
|
+ }
|
|
|
+ List<EnrollmentStatisticsInfoKeyValue> cratetimeRes = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, Long> entry : cratetime.entrySet()) {
|
|
|
+ cratetimeRes.add(new EnrollmentStatisticsInfoKeyValue(entry.getKey(), entry.getValue()));
|
|
|
+ }
|
|
|
+
|
|
|
+ result.setCratetimeList(cratetimeRes);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public EnrollmentStatisticsGraduationInfoVo getEnrollmentStatisticsGraduationInfo(EnrollmentStatisticsGraduationInfoDto dto) {
|
|
|
+ EnrollmentStatisticsGraduationInfoVo result = new EnrollmentStatisticsGraduationInfoVo();
|
|
|
+ LocalDate day = LocalDate.parse(dto.getDay());
|
|
|
+ String year = String.valueOf(day.getYear());
|
|
|
+ //根据天获取毕业院校
|
|
|
+ MPJLambdaWrapper<PbCseFeeobjupdate> pbCseFeeobjupdateByDay = new MPJLambdaWrapper<>();
|
|
|
+ pbCseFeeobjupdateByDay
|
|
|
+ .distinct()
|
|
|
+ .selectAs(PbCseFeeobjupdate::getPersonalid, PbCseFeeobjupdate::getPersonalid)
|
|
|
+ .select("ifnull(t.graduations,'未知') as graduations")
|
|
|
+ .eq(PbCseFeeobjupdate::getEnteryear, year)
|
|
|
+ .like(PbCseFeeobjupdate::getCratetime, day)
|
|
|
+ ;
|
|
|
+ List<PbCseFeeobjupdate> pbCseFeeobjupdateByDayList = this.selectJoinList(PbCseFeeobjupdate.class, pbCseFeeobjupdateByDay);
|
|
|
+
|
|
|
+ if(pbCseFeeobjupdateByDayList != null && !pbCseFeeobjupdateByDayList.isEmpty()){
|
|
|
+ //毕业学校排行
|
|
|
+ Map<String, Long> graduations = pbCseFeeobjupdateByDayList.stream().collect(Collectors.groupingBy(PbCseFeeobjupdate::getGraduations, Collectors.counting()));
|
|
|
+ if(!graduations.isEmpty()){
|
|
|
+ graduations = graduations.entrySet().stream()
|
|
|
+ .sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
+ (e1, e2) -> e1, LinkedHashMap::new));
|
|
|
+ }
|
|
|
+ List<EnrollmentStatisticsInfoKeyValue> graduationRes = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, Long> entry : graduations.entrySet()) {
|
|
|
+ graduationRes.add(new EnrollmentStatisticsInfoKeyValue(entry.getKey(), entry.getValue()));
|
|
|
+ }
|
|
|
+
|
|
|
+ result.setGraduationList(graduationRes);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|