Browse Source

学生-学生详情(课程计划)

肖玮 5 years ago
parent
commit
e5cacc1729

+ 9 - 0
mec-education/src/main/java/com/ym/mec/education/controller/StudentController.java

@@ -5,6 +5,7 @@ import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.StudentReq;
 import com.ym.mec.education.req.StudentReq;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;
 import com.ym.mec.education.service.IClassGroupStudentMapperService;
+import com.ym.mec.education.service.ICourseScheduleService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -28,6 +29,8 @@ public class StudentController {
 
 
     @Autowired
     @Autowired
     private IClassGroupStudentMapperService groupStudentMapperService;
     private IClassGroupStudentMapperService groupStudentMapperService;
+    @Autowired
+    private ICourseScheduleService courseScheduleService;
 
 
     @PostMapping("/list")
     @PostMapping("/list")
     @ApiOperation("学员名单列表")
     @ApiOperation("学员名单列表")
@@ -47,4 +50,10 @@ public class StudentController {
         return groupStudentMapperService.getInfo(studentReq);
         return groupStudentMapperService.getInfo(studentReq);
     }
     }
 
 
+    @PostMapping("/course")
+    @ApiOperation("根据学员id查询进行中的课程计划和历史课程计划")
+    public BaseResponse courseInfo(@RequestBody StudentReq studentReq) {
+        return courseScheduleService.getCourseScheduleByStudent(studentReq);
+    }
+
 }
 }

+ 41 - 27
mec-education/src/main/java/com/ym/mec/education/enums/TeachModeEnum.java

@@ -1,33 +1,47 @@
 package com.ym.mec.education.enums;
 package com.ym.mec.education.enums;
 
 
 import com.ym.mec.common.enums.BaseEnum;
 import com.ym.mec.common.enums.BaseEnum;
+import java.util.Arrays;
 
 
 public enum TeachModeEnum implements BaseEnum<String, TeachModeEnum> {
 public enum TeachModeEnum implements BaseEnum<String, TeachModeEnum> {
-	ONLINE("ONLINE", "线上"), OFFLINE("OFFLINE", "线下");
-
-	private String code;
-
-	private String msg;
-
-	TeachModeEnum(String code, String msg) {
-		this.code = code;
-		this.msg = msg;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public String getMsg() {
-		return msg;
-	}
-
-	public void setMsg(String msg) {
-		this.msg = msg;
-	}
-
-	@Override
-	public String getCode() {
-		return this.code;
-	}
+    ONLINE("ONLINE", "线上"), OFFLINE("OFFLINE", "线下");
+
+    private String code;
+
+    private String msg;
+
+    TeachModeEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+
+    /**
+     * 根据枚举值获取枚举信息
+     *
+     * @param code 枚举值
+     * @return 枚举信息
+     */
+    public static String getMsgByCode(String code) {
+        return Arrays.stream(TeachModeEnum.values())
+            .filter(TeachModeEnum -> TeachModeEnum.getCode().equals(code))
+            .findFirst()
+            .map(TeachModeEnum::getMsg).orElse(null);
+    }
 }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/mapper/MusicGroupPaymentCalenderMapper.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.mapper;
 package com.ym.mec.education.mapper;
 
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
-import com.baomidou.mybatisplus.mapper.BaseMapper;
 
 
 /**
 /**
  * <p>
  * <p>

+ 39 - 0
mec-education/src/main/java/com/ym/mec/education/resp/StudentResp.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.List;
 import java.util.List;
 
 
@@ -32,4 +33,42 @@ public class StudentResp implements Serializable {
     private String parentsPhone;
     private String parentsPhone;
     @ApiModelProperty(value = "备注")
     @ApiModelProperty(value = "备注")
     private String remark;
     private String remark;
+    @ApiModelProperty(value = "进行中课程计划")
+    private List<StudentCourseSchedule> inProgressCourseSchedule;
+    @ApiModelProperty(value = "已完成课程计划")
+    private List<StudentCourseSchedule> completedCourseSchedule;
+
+    @Data
+    @ApiModel(value = "课程计划")
+    @Accessors(chain = true)
+    public static class StudentCourseSchedule {
+        @ApiModelProperty(value = "乐团名称")
+        private String musicGroupName;
+        @ApiModelProperty(value = "乐团id", example = "1")
+        private Integer musicGroupId;
+        @ApiModelProperty(value = "课程日期", example = "9月19日")
+        private String classDate;
+        @ApiModelProperty(value = "课程星期", example = "星期一")
+        private String classWeek;
+        @ApiModelProperty(value = "课程时间", example = "12:00-17:00")
+        private String classTime;
+        @ApiModelProperty(value = "缴费状态,已缴费,待续费,已续费", example = "已续费")
+        private String renewStatus;
+        @ApiModelProperty(value = "学校经纬度", example = "118.800454,32.083998")
+        private String schoolLongitudeLatitude;
+        @ApiModelProperty(value = "课程类别 1 乐团 2 vip", example = "1")
+        private Integer courseType;
+        @ApiModelProperty(value = "讲课老师", example = "张老师")
+        private String teacher;
+        @ApiModelProperty(value = "教学形式 线上 线下", example = "线上")
+        private String teachMode;
+        @ApiModelProperty(value = "课程总数", example = "60分钟/次,共30节")
+        private String totalClassTimes;
+        @ApiModelProperty(value = "上课学生")
+        private List<String> studentList;
+    }
+
+    public static StudentCourseSchedule getStudentCourseSchedule() {
+        return new StudentCourseSchedule();
+    }
 }
 }

+ 12 - 0
mec-education/src/main/java/com/ym/mec/education/service/ICourseScheduleService.java

@@ -6,6 +6,7 @@ import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.CourseSchedule;
 import com.ym.mec.education.entity.CourseSchedule;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.req.CourseScheduleReq;
+import com.ym.mec.education.req.StudentReq;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -19,6 +20,7 @@ public interface ICourseScheduleService extends IService<CourseSchedule> {
 
 
     /**
     /**
      * 根据参数分页查询课程计划列表
      * 根据参数分页查询课程计划列表
+     *
      * @param classGroupReq
      * @param classGroupReq
      * @return
      * @return
      */
      */
@@ -26,6 +28,7 @@ public interface ICourseScheduleService extends IService<CourseSchedule> {
 
 
     /**
     /**
      * 根据课程计划id获取课程计划详情
      * 根据课程计划id获取课程计划详情
+     *
      * @param courseScheduleReq
      * @param courseScheduleReq
      * @return
      * @return
      */
      */
@@ -33,8 +36,17 @@ public interface ICourseScheduleService extends IService<CourseSchedule> {
 
 
     /**
     /**
      * 历史考勤统计-头信息
      * 历史考勤统计-头信息
+     *
      * @param classGroupReq
      * @param classGroupReq
      * @return
      * @return
      */
      */
     BaseResponse getStatisticsInfo(ClassGroupReq classGroupReq);
     BaseResponse getStatisticsInfo(ClassGroupReq classGroupReq);
+
+    /**
+     * 根据学生id查询进行中和已完成的课程计划
+     *
+     * @param studentReq
+     * @return
+     */
+    BaseResponse getCourseScheduleByStudent(StudentReq studentReq);
 }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/IMusicGroupPaymentCalenderService.java

@@ -1,7 +1,7 @@
 package com.ym.mec.education.service;
 package com.ym.mec.education.service;
 
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
-import com.baomidou.mybatisplus.service.IService;
 
 
 /**
 /**
  * <p>
  * <p>

+ 139 - 17
mec-education/src/main/java/com/ym/mec/education/service/impl/CourseScheduleServiceImpl.java

@@ -8,12 +8,16 @@ import com.google.common.collect.Lists;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.BaseResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.base.PageResponse;
 import com.ym.mec.education.entity.*;
 import com.ym.mec.education.entity.*;
+import com.ym.mec.education.enums.CourseStatusEnum;
 import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
 import com.ym.mec.education.enums.StudentAttendanceStatusEnum;
+import com.ym.mec.education.enums.TeachModeEnum;
 import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.enums.TeachTypeEnum;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
 import com.ym.mec.education.mapper.CourseScheduleMapper;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.ClassGroupReq;
 import com.ym.mec.education.req.CourseScheduleReq;
 import com.ym.mec.education.req.CourseScheduleReq;
+import com.ym.mec.education.req.StudentReq;
 import com.ym.mec.education.resp.CourseScheduleResp;
 import com.ym.mec.education.resp.CourseScheduleResp;
+import com.ym.mec.education.resp.StudentResp;
 import com.ym.mec.education.service.*;
 import com.ym.mec.education.service.*;
 import com.ym.mec.education.utils.DateUtil;
 import com.ym.mec.education.utils.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -21,11 +25,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -51,6 +51,16 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
     private IStudentAttendanceService studentAttendanceService;
     private IStudentAttendanceService studentAttendanceService;
     @Autowired
     @Autowired
     private IMusicGroupQuitService musicGroupQuitService;
     private IMusicGroupQuitService musicGroupQuitService;
+    @Autowired
+    private IClassGroupStudentMapperService classGroupStudentMapperService;
+    @Autowired
+    private IClassGroupService classGroupService;
+    @Autowired
+    private IMusicGroupService musicGroupService;
+    @Autowired
+    private ISchoolService schoolService;
+    @Autowired
+    private IMusicGroupStudentFeeService studentFeeService;
 
 
     @Override
     @Override
     public PageResponse getPage(ClassGroupReq classGroupReq) {
     public PageResponse getPage(ClassGroupReq classGroupReq) {
@@ -70,11 +80,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
             courseScheduleResp.setId(item.getId());
             courseScheduleResp.setId(item.getId());
             if (Objects.nonNull(item.getClassDate())) {
             if (Objects.nonNull(item.getClassDate())) {
                 courseScheduleResp.setClassDate(DateUtil.date2String(item.getClassDate())
                 courseScheduleResp.setClassDate(DateUtil.date2String(item.getClassDate())
-                        + " " + DateUtil.date2Week(item.getClassDate()));
+                    + " " + DateUtil.date2Week(item.getClassDate()));
             }
             }
             if (Objects.nonNull(item.getStartClassTime()) && Objects.nonNull(item.getEndClassTime())) {
             if (Objects.nonNull(item.getStartClassTime()) && Objects.nonNull(item.getEndClassTime())) {
                 courseScheduleResp.setClassTime(DateUtil.time2String(item.getStartClassTime()) + "-" +
                 courseScheduleResp.setClassTime(DateUtil.time2String(item.getStartClassTime()) + "-" +
-                        DateUtil.time2String(item.getEndClassTime()));
+                    DateUtil.time2String(item.getEndClassTime()));
             }
             }
             if (StringUtils.isNotBlank(classGroup.getSubjectIdList())) {
             if (StringUtils.isNotBlank(classGroup.getSubjectIdList())) {
                 List<String> subjectNameList = subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList());
                 List<String> subjectNameList = subjectService.getSubjectList(classGroup.getSubjectIdList()).stream().map(Subject::getName).collect(Collectors.toList());
@@ -84,8 +94,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
             }
             }
             QueryWrapper<ClassGroupTeacherMapper> classGroupTeacherMapperQueryWrapper = new QueryWrapper<>();
             QueryWrapper<ClassGroupTeacherMapper> classGroupTeacherMapperQueryWrapper = new QueryWrapper<>();
             classGroupTeacherMapperQueryWrapper.lambda().eq(ClassGroupTeacherMapper::getClassGroupId, item.getClassGroupId())
             classGroupTeacherMapperQueryWrapper.lambda().eq(ClassGroupTeacherMapper::getClassGroupId, item.getClassGroupId())
-                    .eq(ClassGroupTeacherMapper::getTeacherRole, TeachTypeEnum.BISHOP.getCode())
-                    .eq(ClassGroupTeacherMapper::getUserId, item.getTeacherId());
+                .eq(ClassGroupTeacherMapper::getTeacherRole, TeachTypeEnum.BISHOP.getCode())
+                .eq(ClassGroupTeacherMapper::getUserId, item.getTeacherId());
             ClassGroupTeacherMapper classGroupTeacherMapper = classGroupTeacherMapperService.getOne(classGroupTeacherMapperQueryWrapper);
             ClassGroupTeacherMapper classGroupTeacherMapper = classGroupTeacherMapperService.getOne(classGroupTeacherMapperQueryWrapper);
             if (Objects.nonNull(classGroupTeacherMapper)) {
             if (Objects.nonNull(classGroupTeacherMapper)) {
                 SysUser sysUser = sysUserService.getById(classGroupTeacherMapper.getUserId());
                 SysUser sysUser = sysUserService.getById(classGroupTeacherMapper.getUserId());
@@ -109,24 +119,24 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
         if (Objects.nonNull(courseSchedule)) {
         if (Objects.nonNull(courseSchedule)) {
             if (Objects.nonNull(courseSchedule.getClassDate())) {
             if (Objects.nonNull(courseSchedule.getClassDate())) {
                 courseScheduleResp.setClassDate(DateUtil.date2String(courseSchedule.getClassDate()) + "(" +
                 courseScheduleResp.setClassDate(DateUtil.date2String(courseSchedule.getClassDate()) + "(" +
-                        DateUtil.date2Week(courseSchedule.getClassDate()) + ")");
+                    DateUtil.date2Week(courseSchedule.getClassDate()) + ")");
             }
             }
             if (Objects.nonNull(courseSchedule.getStartClassTime()) &&
             if (Objects.nonNull(courseSchedule.getStartClassTime()) &&
-                    Objects.nonNull(courseSchedule.getEndClassTime())) {
+                Objects.nonNull(courseSchedule.getEndClassTime())) {
                 courseScheduleResp.setClassTime(DateUtil.time2String(courseSchedule.getStartClassTime()) + "-" +
                 courseScheduleResp.setClassTime(DateUtil.time2String(courseSchedule.getStartClassTime()) + "-" +
-                        DateUtil.time2String(courseSchedule.getEndClassTime()));
+                    DateUtil.time2String(courseSchedule.getEndClassTime()));
             }
             }
             if (Objects.nonNull(courseSchedule.getTeacherId())) {
             if (Objects.nonNull(courseSchedule.getTeacherId())) {
                 Optional.of(sysUserService.getById(courseSchedule.getTeacherId())).
                 Optional.of(sysUserService.getById(courseSchedule.getTeacherId())).
-                        ifPresent(sysUser -> courseScheduleResp.setTeacher(sysUser.getRealName()));
+                    ifPresent(sysUser -> courseScheduleResp.setTeacher(sysUser.getRealName()));
             }
             }
             QueryWrapper<StudentAttendance> studentAttendanceQueryWrapper = new QueryWrapper<>();
             QueryWrapper<StudentAttendance> studentAttendanceQueryWrapper = new QueryWrapper<>();
             studentAttendanceQueryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
             studentAttendanceQueryWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
-                    .orderByDesc(true, StudentAttendance::getCreateTime);
+                .orderByDesc(true, StudentAttendance::getCreateTime);
             List<StudentAttendance> studentAttendanceList = studentAttendanceService.list(studentAttendanceQueryWrapper);
             List<StudentAttendance> studentAttendanceList = studentAttendanceService.list(studentAttendanceQueryWrapper);
             if (!CollectionUtils.isEmpty(studentAttendanceList)) {
             if (!CollectionUtils.isEmpty(studentAttendanceList)) {
                 studentAttendanceList.stream().findFirst().ifPresent(studentAttendance ->
                 studentAttendanceList.stream().findFirst().ifPresent(studentAttendance ->
-                        courseScheduleResp.setLastCommitDate(DateUtil.date2String(studentAttendance.getCreateTime(), DateUtil.DATE_FORMAT_HOUR)));
+                    courseScheduleResp.setLastCommitDate(DateUtil.date2String(studentAttendance.getCreateTime(), DateUtil.DATE_FORMAT_HOUR)));
             }
             }
             QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
             QueryWrapper<StudentAttendance> leaveWrapper = new QueryWrapper<>();
             QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
             QueryWrapper<StudentAttendance> normalWrapper = new QueryWrapper<>();
@@ -134,11 +144,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
             Integer totalCount = count();
             Integer totalCount = count();
             //请假
             //请假
             leaveWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
             leaveWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
-                    .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.LEAVE.getCode());
+                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.LEAVE.getCode());
             Integer leaveCount = studentAttendanceService.count(leaveWrapper);
             Integer leaveCount = studentAttendanceService.count(leaveWrapper);
             //正常
             //正常
             normalWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
             normalWrapper.lambda().eq(true, StudentAttendance::getCourseScheduleId, courseSchedule.getId())
-                    .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
+                .eq(true, StudentAttendance::getStatus, StudentAttendanceStatusEnum.NORMAL.getCode());
             Integer normalCount = studentAttendanceService.count(normalWrapper);
             Integer normalCount = studentAttendanceService.count(normalWrapper);
             courseScheduleResp.setLeaveNum(leaveCount);
             courseScheduleResp.setLeaveNum(leaveCount);
             if (totalCount != 0) {
             if (totalCount != 0) {
@@ -172,4 +182,116 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper,
         }
         }
         return BaseResponse.success(courseScheduleResp);
         return BaseResponse.success(courseScheduleResp);
     }
     }
+
+    @Override
+    public BaseResponse getCourseScheduleByStudent(StudentReq studentReq) {
+        if (Objects.isNull(studentReq.getStudentId())) {
+            return BaseResponse.errorParam();
+        }
+        StudentResp studentResp = new StudentResp();
+        QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
+        classGroupStudentMapperQueryWrapper.lambda().eq(ClassGroupStudentMapper::getUserId, studentReq.getStudentId());
+        List<ClassGroupStudentMapper> classGroupStudentMapperList = classGroupStudentMapperService.list(classGroupStudentMapperQueryWrapper);
+        if (!CollectionUtils.isEmpty(classGroupStudentMapperList)) {
+            classGroupStudentMapperList.forEach(classGroupStudentMapper -> {
+                ClassGroup classGroup = classGroupService.getById(classGroupStudentMapper.getClassGroupId());
+                if (Objects.nonNull(classGroup)) {
+                    QueryWrapper<CourseSchedule> courseScheduleQueryWrapper = new QueryWrapper<>();
+                    courseScheduleQueryWrapper.lambda().eq(CourseSchedule::getClassGroupId, classGroup.getId())
+                        .in(CourseSchedule::getStatus, CourseStatusEnum.UNDERWAY.getCode(), CourseStatusEnum.OVER.getCode());
+                    List<CourseSchedule> courseScheduleList = list(courseScheduleQueryWrapper);
+                    //进行中的课程计划
+                    if (!CollectionUtils.isEmpty(courseScheduleList)) {
+                        List<StudentResp.StudentCourseSchedule> inProgressCourseSchedule = getCourseSchduleList(courseScheduleList.stream().filter(courseSchedule ->
+                            courseSchedule.getStatus().equals(CourseStatusEnum.UNDERWAY.getCode())).collect(Collectors.toList()), classGroup, studentReq);
+                        studentResp.setInProgressCourseSchedule(inProgressCourseSchedule);
+                        //已完成的课程计划
+                        List<StudentResp.StudentCourseSchedule> completedCourseSchedule = getCourseSchduleList(courseScheduleList.stream().filter(courseSchedule ->
+                            courseSchedule.getStatus().equals(CourseStatusEnum.OVER.getCode())).collect(Collectors.toList()), classGroup, studentReq);
+                        studentResp.setCompletedCourseSchedule(completedCourseSchedule);
+                    }
+                }
+            });
+        }
+        return BaseResponse.success(studentResp);
+    }
+
+    /**
+     * 获取
+     *
+     * @param courseScheduleList
+     * @param classGroup
+     * @return
+     */
+    private List<StudentResp.StudentCourseSchedule> getCourseSchduleList(List<CourseSchedule> courseScheduleList, ClassGroup classGroup, StudentReq studentReq) {
+        if (!CollectionUtils.isEmpty(courseScheduleList)) {
+            List<StudentResp.StudentCourseSchedule> studentCourseScheduleList = Lists.newArrayList();
+            courseScheduleList.forEach(courseSchedule -> {
+                StudentResp.StudentCourseSchedule studentCourseSchedule = StudentResp.getStudentCourseSchedule();
+                QueryWrapper<MusicGroupStudentFee> studentFeeQueryWrapper = new QueryWrapper<>();
+                studentFeeQueryWrapper.lambda().eq(MusicGroupStudentFee::getMusicGroupId, classGroup.getMusicGroupId())
+                    .eq(MusicGroupStudentFee::getUserId, studentReq.getStudentId());
+                MusicGroupStudentFee musicGroupStudentFee = studentFeeService.getOne(studentFeeQueryWrapper);
+                MusicGroup musicGroup = musicGroupService.getById(classGroup.getMusicGroupId());
+                Optional.ofNullable(musicGroup).ifPresent(musicGroupParam -> {
+                    studentCourseSchedule.setMusicGroupName(musicGroupParam.getName());
+                    studentCourseSchedule.setMusicGroupId(classGroup.getMusicGroupId());
+                    School school = schoolService.getById(musicGroup.getSchoolId());
+                    Optional.ofNullable(school).ifPresent(value -> studentCourseSchedule.
+                        setSchoolLongitudeLatitude(value.getLongitudeLatitude()));
+                });
+                Optional.ofNullable(courseSchedule.getClassDate()).ifPresent(classDate ->
+                    studentCourseSchedule.setClassDate(DateUtil.date2String(courseSchedule.getClassDate()))
+                        .setClassWeek(DateUtil.date2Week2(courseSchedule.getClassDate())));
+                if (Objects.nonNull(courseSchedule.getStartClassTime()) && Objects.nonNull(courseSchedule.getEndClassTime())) {
+                    studentCourseSchedule.setClassTime(DateUtil.time2String(courseSchedule.getStartClassTime()) + "-"
+                        + DateUtil.time2String(courseSchedule.getEndClassTime()))
+                        .setTotalClassTimes(DateUtil.timeDifference(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()) + "分钟/次,共" +
+                            classGroup.getTotalClassTimes() + "节");
+                }
+                QueryWrapper<MusicGroupPaymentCalender> paymentCalenderQueryWrapper = new QueryWrapper<>();
+                paymentCalenderQueryWrapper.lambda().eq(MusicGroupPaymentCalender::getMusicGroupId, musicGroup.getId());
+                //乐团课(单技课,合奏课,综合课,小班)
+                if (CourseSchedule.CourseScheduleType.SINGLE.getCode().equals(courseSchedule.getType()) ||
+                    CourseSchedule.CourseScheduleType.MIX.getCode().equals(courseSchedule.getType()) ||
+                    CourseSchedule.CourseScheduleType.COMPREHENSIVE.getCode().equals(courseSchedule.getType()) ||
+                    CourseSchedule.CourseScheduleType.HIGH.getCode().equals(courseSchedule.getType())) {
+                    studentCourseSchedule.setCourseType(1);
+                    //续费状态
+                    if (Objects.nonNull(musicGroupStudentFee)) {
+                        studentCourseSchedule.setRenewStatus("已缴费");
+                    }
+                } else if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(courseSchedule.getType())) {
+                    studentCourseSchedule.setCourseType(2);
+                    if (Objects.isNull(musicGroupStudentFee.getNextPaymentDate())){
+                        studentCourseSchedule.setRenewStatus("未续费");
+                    }else {
+                        studentCourseSchedule.setRenewStatus("已续费");
+                    }
+                    SysUser teacher = sysUserService.getById(courseSchedule.getTeacherId());
+                    if (Objects.nonNull(teacher)) {
+                        //讲课老师
+                        studentCourseSchedule.setTeacher(teacher.getRealName());
+                    }
+                    //教学形式
+                    studentCourseSchedule.setTeachMode(TeachModeEnum.getMsgByCode(courseSchedule.getTeachMode()));
+                    //上课学生
+                    QueryWrapper<ClassGroupStudentMapper> classGroupStudentMapperQueryWrapper = new QueryWrapper<>();
+                    classGroupStudentMapperQueryWrapper.lambda().eq(ClassGroupStudentMapper::getClassGroupId, courseSchedule.getClassGroupId());
+                    List<ClassGroupStudentMapper> groupStudentMapperList = classGroupStudentMapperService.list(classGroupStudentMapperQueryWrapper);
+                    if (!CollectionUtils.isEmpty(groupStudentMapperList)) {
+                        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
+                        sysUserQueryWrapper.lambda().in(SysUser::getId, groupStudentMapperList.stream().map(ClassGroupStudentMapper::getUserId).collect(Collectors.toList()));
+                        List<SysUser> sysUserList = sysUserService.list(sysUserQueryWrapper);
+                        if (!CollectionUtils.isEmpty(sysUserList)) {
+                            studentCourseSchedule.setStudentList(sysUserList.stream().map(SysUser::getRealName).collect(Collectors.toList()));
+                        }
+                    }
+                }
+                studentCourseScheduleList.add(studentCourseSchedule);
+            });
+            return studentCourseScheduleList;
+        }
+        return Collections.emptyList();
+    }
 }
 }

+ 1 - 1
mec-education/src/main/java/com/ym/mec/education/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1,9 +1,9 @@
 package com.ym.mec.education.service.impl;
 package com.ym.mec.education.service.impl;
 
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
 import com.ym.mec.education.entity.MusicGroupPaymentCalender;
 import com.ym.mec.education.mapper.MusicGroupPaymentCalenderMapper;
 import com.ym.mec.education.mapper.MusicGroupPaymentCalenderMapper;
 import com.ym.mec.education.service.IMusicGroupPaymentCalenderService;
 import com.ym.mec.education.service.IMusicGroupPaymentCalenderService;
-import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 /**
 /**

+ 44 - 3
mec-education/src/main/java/com/ym/mec/education/utils/DateUtil.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.sql.Time;
 import java.sql.Time;
 import java.text.DateFormat;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
+import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
@@ -55,6 +56,21 @@ public class DateUtil {
         return format;
         return format;
     }
     }
 
 
+    /**
+     * 返回分钟差
+     *
+     * @param time1
+     * @param time2
+     * @return
+     */
+    public static Integer timeDifference(Time time1, Time time2) {
+        LocalTime localTime1 = time1.toLocalTime();
+        LocalTime localTime2 = time2.toLocalTime();
+        Integer hour = localTime2.getHour() - localTime1.getHour();
+        Integer minute = localTime2.getMinute() - localTime1.getMinute();
+        return hour * 60 + minute;
+    }
+
     public static String date2Week(Date date) {
     public static String date2Week(Date date) {
         Calendar calendar = Calendar.getInstance();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.setTime(date);
@@ -79,8 +95,33 @@ public class DateUtil {
         }
         }
     }
     }
 
 
+    public static String date2Week2(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int i = calendar.get(Calendar.DAY_OF_WEEK);
+        switch (i) {
+            case 1:
+                return "周日";
+            case 2:
+                return "周一";
+            case 3:
+                return "周二";
+            case 4:
+                return "周三";
+            case 5:
+                return "周四";
+            case 6:
+                return "周五";
+            case 7:
+                return "周六";
+            default:
+                return "";
+        }
+    }
+
     /**
     /**
      * 获取下个月的第一天
      * 获取下个月的第一天
+     *
      * @param date
      * @param date
      * @return
      * @return
      */
      */
@@ -97,12 +138,12 @@ public class DateUtil {
     }
     }
 
 
 
 
-    public static Integer subMin(Date startTime,Date endTime){
+    public static Integer subMin(Date startTime, Date endTime) {
 
 
-        if(startTime != null && endTime != null){
+        if (startTime != null && endTime != null) {
             long from = startTime.getTime();
             long from = startTime.getTime();
             long to = endTime.getTime();
             long to = endTime.getTime();
-            Integer hours = (int) ((to - from)/(1000 * 60 * 60));
+            Integer hours = (int) ((to - from) / (1000 * 60 * 60));
 
 
             return hours;
             return hours;
         }
         }