Explorar o código

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge %!s(int64=5) %!d(string=hai) anos
pai
achega
73bf85e8b4
Modificáronse 18 ficheiros con 341 adicións e 161 borrados
  1. 6 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java
  3. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeGroupDao.java
  4. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupBuyDto.java
  5. 90 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleEvaluate.java
  6. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleEvaluateService.java
  7. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java
  8. 2 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  9. 45 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java
  10. 25 121
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  11. 30 16
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  12. 3 2
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  13. 29 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml
  14. 6 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  15. 6 1
      mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml
  16. 3 1
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  17. 4 4
      mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java
  18. 30 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java

+ 6 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -822,12 +822,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
                                   @Param("groupType") String groupType,
                                   @Param("schoolId") Integer schoolId);
 
-    /**
-     * 获取学员的课程列表
-     * @param params
-     * @return
-     */
-    PageInfo<CourseListDto> queryStudentCourse(Map<String, Object> params);
 
     int countVipGroupCourses(@Param("vipGroupId") Integer vipGroupId);
 
@@ -1190,4 +1184,10 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
                               @Param("groupType") GroupType groupType,
                               @Param("isLock") Integer isLock);
 
+    /**
+     * 获取当前课程是第几课时
+     * @param courseScheduleId
+     * @return
+     */
+    int countCurrentCourseTime(Long courseScheduleId);
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.TeacherCourseStatistics;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleEvaluate> {
+
+}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/PracticeGroupDao.java

@@ -61,6 +61,18 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
      */
     void updateUserId(@Param("practiceGroupId") String practiceGroupId, @Param("teacherId") Integer teacherId);
 
+
+    /**
+     * @describe 获取学生指定的课程组
+     * @author Joburgess
+     * @date 2020/2/19
+     * @param userId:
+     * @param groupId:
+     * @return com.ym.mec.biz.dal.entity.PracticeGroup
+     */
+    PracticeGroup findUserPracticeGroup(@Param("userId") Integer userId,
+                                        @Param("groupId") Long groupId);
+
     /**
      * @describe 获取学生最后一次购买的陪练课组
      * @author Joburgess

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PracticeGroupBuyDto.java

@@ -14,8 +14,28 @@ public class PracticeGroupBuyDto extends PracticeGroup {
     @ApiModelProperty(value = "是否使用账户余额支付")
     private boolean useBalancePayment;
 
+    private boolean renew;
+
+    private Long groupId;
+
     private List<PracticeDrillTimeDto> drillTimes;
 
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+    public boolean isRenew() {
+        return renew;
+    }
+
+    public void setRenew(boolean renew) {
+        this.renew = renew;
+    }
+
     public boolean isUseBalancePayment() {
         return useBalancePayment;
     }

+ 90 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleEvaluate.java

@@ -0,0 +1,90 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+public class CourseScheduleEvaluate {
+    private Long id;
+
+    private String musicGroupId;
+
+    @ApiModelProperty(value = "班级id")
+    private Integer classGroupId;
+
+    private Long courseScheduleId;
+
+    private Integer teacherId;
+
+    @ApiModelProperty(value = "评价选项,英文逗号分隔")
+    private String item;
+
+    @ApiModelProperty(value = "报告详情")
+    private String comment;
+
+    private Date createTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getClassGroupId() {
+        return classGroupId;
+    }
+
+    public void setClassGroupId(Integer classGroupId) {
+        this.classGroupId = classGroupId;
+    }
+
+    public Long getCourseScheduleId() {
+        return courseScheduleId;
+    }
+
+    public void setCourseScheduleId(Long courseScheduleId) {
+        this.courseScheduleId = courseScheduleId;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getItem() {
+        return item;
+    }
+
+    public void setItem(String item) {
+        this.item = item;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleEvaluateService.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.TeacherCourseStatistics;
+import com.ym.mec.biz.dal.page.TeacherCourseStatisticsQueryInfo;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.service.BaseService;
+
+
+public interface CourseScheduleEvaluateService extends BaseService<Long, CourseScheduleEvaluate> {
+
+    boolean addStudyReport(CourseScheduleEvaluate courseScheduleEvaluate);
+
+}

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/PracticeGroupService.java

@@ -120,7 +120,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
 	 * @param userId:
 	 * @return com.ym.mec.biz.dal.entity.PracticeGroup
 	 */
-	PracticeGroup findUserLatestPracticeGroup(Integer userId);
+	PracticeGroup findUserLatestPracticeGroup(Integer userId, Long groupId);
 
     /**
      * @describe 获取陪练课预约参数——付费
@@ -151,7 +151,7 @@ public interface PracticeGroupService extends BaseService<Long, PracticeGroup> {
      * @param buyMonths: 购买月数
      * @return java.util.Map
      */
-    Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, Date firstClassTime);
+    Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, boolean renew, Long groupId);
 
     /**
      * @describe 获取一周内可以预约课程的时间——付费

+ 2 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -674,8 +674,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public List<ImGroupModel> queryUserGroups(Integer userId, String search) {
-        //获取乐团群,vip群(进行中)
-        //获取学员乐团群
         List<ImGroupModel> imGroupModels = classGroupDao.queryUserMusicGroups(userId, search);
         imGroupModels.addAll(classGroupDao.queryUserVipGroups(userId, search));
         if (imGroupModels != null && imGroupModels.size() > 0) {
@@ -1011,8 +1009,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         TeacherClassHeadInfo teacherClassHeadInfo = new TeacherClassHeadInfo();
         teacherClassHeadInfo.setStudentNum(classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId()));
-        teacherClassHeadInfo.setCurrentClassTimes(classGroup.getCurrentClassTimes());
-        teacherClassHeadInfo.setTotalClassTimes(classGroup.getTotalClassTimes());
+        teacherClassHeadInfo.setCurrentClassTimes(courseScheduleDao.countCurrentTimes(classGroup.getId(),new Date()));
+        teacherClassHeadInfo.setTotalClassTimes(courseScheduleDao.countClassGroupCourses(classGroup.getId()));
         ClassGroupTeacherMapper bishopTeacher = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroupId, TeachTypeEnum.BISHOP);
         if (Objects.nonNull(bishopTeacher)) {
             teacherClassHeadInfo.setBishopTeacherId(bishopTeacher.getId());

+ 45 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ym.mec.biz.service.impl;
+
+
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+@Service
+public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, CourseScheduleEvaluate> implements CourseScheduleEvaluateService {
+
+    @Autowired
+    private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
+    @Autowired
+    private ClassGroupDao classGroupDao;
+
+    @Override
+    public BaseDAO<Long, CourseScheduleEvaluate> getDAO() {
+        return courseScheduleEvaluateDao;
+    }
+
+
+    @Override
+    public boolean addStudyReport(CourseScheduleEvaluate courseScheduleEvaluate) {
+        ClassGroup classGroup = classGroupDao.get(courseScheduleEvaluate.getClassGroupId());
+        if(classGroup==null){
+           throw new BizException("课程不存在!");
+        }
+        courseScheduleEvaluate.setMusicGroupId(classGroup.getMusicGroupId());
+        courseScheduleEvaluate.setCreateTime(new Date());
+        long num = courseScheduleEvaluateDao.insert(courseScheduleEvaluate);
+        if(num <= 0){
+            throw new BizException("报告添加失败,请重试");
+        }
+        return true;
+    }
+}

+ 25 - 121
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1,127 +1,20 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import org.apache.commons.collections.ListUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 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.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.ClassGroupTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleComplaintsDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleModifyLogDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.GroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.PracticeGroupDao;
-import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultMusicGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultPracticeGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
-import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
-import com.ym.mec.biz.dal.dto.CourseAttendanceDetailHeadInfoDto;
-import com.ym.mec.biz.dal.dto.CoursePostponeDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleEndDto;
-import com.ym.mec.biz.dal.dto.CourseScheduleStudentDto;
-import com.ym.mec.biz.dal.dto.CourseTimeDto;
-import com.ym.mec.biz.dal.dto.CreateCourseScheduleDto;
-import com.ym.mec.biz.dal.dto.IntegerAndIntegerListDto;
-import com.ym.mec.biz.dal.dto.Mapper;
-import com.ym.mec.biz.dal.dto.StudentNameAndPhoneDto;
-import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
-import com.ym.mec.biz.dal.dto.TeacherBasicDto;
-import com.ym.mec.biz.dal.dto.TeacherClassCourseSchudeleDto;
-import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
-import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
-import com.ym.mec.biz.dal.dto.VipGroupCourseAdjustInfoDto;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary;
-import com.ym.mec.biz.dal.entity.CourseGenerateDto;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
+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.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
-import com.ym.mec.biz.dal.entity.CourseScheduleModifyLog;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.Group;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.PracticeGroup;
-import com.ym.mec.biz.dal.entity.StudentAttendance;
-import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
-import com.ym.mec.biz.dal.entity.SysConfig;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.TeacherAttendance;
-import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
-import com.ym.mec.biz.dal.entity.TeacherDefaultPracticeGroupSalary;
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
-import com.ym.mec.biz.dal.enums.AuditStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.ParamEnum;
-import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
-import com.ym.mec.biz.dal.enums.TeachModeEnum;
-import com.ym.mec.biz.dal.enums.TeachTypeEnum;
-import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.EndCourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
-import com.ym.mec.biz.service.CourseHomeworkService;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -132,8 +25,23 @@ import com.ym.mec.util.collection.ListUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.json.JsonUtil;
-
 import feign.codec.DecodeException;
+import org.apache.commons.collections.ListUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule> implements CourseScheduleService {
@@ -2640,14 +2548,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             } else {
                 dataList = courseScheduleDao.queryTeacherHistoryClassCourseSchedule(params);
             }
-            List<Integer> courseIds = dataList.stream().map(teacherClassCourseSchudeleDto -> teacherClassCourseSchudeleDto.getCourseScheduleId().intValue()).collect(Collectors.toList());
-            List<Map<Integer, Integer>> currentClassTimesByCourses = studentAttendanceDao.getCurrentClassTimesByCourses(courseIds);
-            if (!CollectionUtils.isEmpty(currentClassTimesByCourses)) {
-                Map<Integer, Integer> currentClassTimesWithCourse = MapUtil.convertIntegerMap(currentClassTimesByCourses);
-                dataList.forEach(e -> {
-                    e.setCurrentClassTimes(currentClassTimesWithCourse.get(e.getCourseScheduleId()));
-                });
-            }
+            dataList.forEach(e -> {
+                e.setCurrentClassTimes(courseScheduleDao.countCurrentTimes(e.getClassGroupId().intValue(),new Date()));
+                e.setTotalClassTimes(courseScheduleDao.countCurrentCourseTime(e.getCourseScheduleId()));
+            });
         }
         if (count == 0) {
             dataList = new ArrayList<>();

+ 30 - 16
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -2082,8 +2082,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public PracticeGroup findUserLatestPracticeGroup(Integer userId) {
-        return practiceGroupDao.findUserLatestPracticeGroup(userId);
+    public PracticeGroup findUserLatestPracticeGroup(Integer userId, Long groupId) {
+        if(Objects.isNull(groupId)){
+            throw new BizException("请选择续费的课程");
+        }
+        return practiceGroupDao.findUserPracticeGroup(userId, groupId);
     }
 
     @Override
@@ -2234,7 +2237,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     }
 
     @Override
-    public Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, Date firstClassTime) {
+    public Map getPayPracticeTeacherFreeTimes(Integer userId, Integer teacherId, Integer buyMonths, boolean renew, Long groupId) {
         if (Objects.isNull(teacherId)) {
             throw new BizException("请选择教师");
         }
@@ -2245,6 +2248,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (Objects.isNull(student.getOrganId())) {
             throw new BizException("未找到用户分部属性");
         }
+        if(renew&&Objects.isNull(groupId)){
+            throw new BizException("请选择需要续费的课程");
+        }
         Teacher teacher = teacherDao.get(teacherId);
         if (Objects.isNull(teacher)) {
             throw new BizException("教师不存在");
@@ -2316,11 +2322,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY, 1);
         ZoneId zoneId = ZoneId.systemDefault();
 
-        LocalDateTime now = LocalDateTime.now();
+        LocalDate now = LocalDate.now();
+        if(renew){
+            PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(userId,groupId);
+            if(Objects.nonNull(userLatestPracticeGroup)){
+                LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
+                if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(now)>=0){
+                    now=lastExpiredDay;
+                }
+            }
+        }
         now.plusDays(1);
-        Date applyStartDate = Date.from(now.atZone(zoneId).toInstant());
+        Date applyStartDate = Date.from(now.atStartOfDay(zoneId).toInstant());
         now.plusMonths(buyMonths);
-        Date applyEndDate = Date.from(now.atZone(zoneId).toInstant());
+        Date applyEndDate = Date.from(now.atStartOfDay(zoneId).toInstant());
         Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
         Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
 
@@ -2337,10 +2352,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             checkTeacherLeaveDate = false;
         }
 
-        if (Objects.nonNull(firstClassTime)) {
-            LocalDateTime localFirstClassTime = LocalDateTime.ofInstant(firstClassTime.toInstant(), zoneId);
-            weekNumApplyTimesMap.remove(localFirstClassTime.getDayOfWeek().getValue());
-        }
         weekNumApplyTimesMap.remove(holiday);
 
         if (teacherId == 100473) {
@@ -2524,14 +2535,17 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         Date practiceBuyActivityExpireDate=DateUtil.stringToDate(practiceBuyActivityExpireDateConfig.getParanValue(),"yyyy-MM-dd HH:mm:ss");
 
         Date now=new Date();
-        PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserLatestPracticeGroup(practiceGroupBuyParams.getUserId());
         LocalDate courseStartDay=LocalDate.now();
-        if(Objects.nonNull(userLatestPracticeGroup)){
-            LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
-            if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
-                courseStartDay=lastExpiredDay;
+        if(practiceGroupBuyParams.isRenew()){
+            PracticeGroup userLatestPracticeGroup = practiceGroupDao.findUserPracticeGroup(practiceGroupBuyParams.getUserId(),practiceGroupBuyParams.getGroupId());
+            if(Objects.nonNull(userLatestPracticeGroup)){
+                LocalDate lastExpiredDay=LocalDateTime.ofInstant(userLatestPracticeGroup.getCoursesExpireDate().toInstant(),DateUtil.zoneId).toLocalDate();
+                if(Objects.nonNull(lastExpiredDay)&&lastExpiredDay.compareTo(courseStartDay)>=0){
+                    courseStartDay=lastExpiredDay;
+                }
             }
         }
+
         courseStartDay=courseStartDay.plusDays(1);
         Date courseStartDate=Date.from(courseStartDay.atStartOfDay(DateUtil.zoneId).toInstant());
         practiceGroupBuyParams.setCoursesStartDate(courseStartDate);
@@ -2712,7 +2726,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             courseScheduleService.checkNewCourseSchedules(practiceCourses,false);
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            return BaseController.failed(HttpStatus.FOUND, "课程冲突");
+            return BaseController.failed(HttpStatus.FOUND, e.getMessage());
         }
 
         StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -267,9 +267,10 @@
         SELECT cg.id_,cg.name_,cg.student_num_,cg.img_,mg.name_ group_name_
         FROM class_group_student_mapper cgsm
         LEFT JOIN class_group cg ON cgsm.class_group_id_ = cg.id_
-        LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
+        LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_ AND cg.group_type_ = 'MUSIC'
+        LEFT JOIN vip_group vg ON vg.id_ = cg.music_group_id_ AND cg.group_type_ = 'VIP'
         <where>
-            cg.del_flag_ = 0 AND cgsm.status_ != 'QUIT' AND mg.status_ = 'PROGRESS'
+            cg.del_flag_ = 0 AND cgsm.status_ != 'QUIT' AND (mg.status_ = 'PROGRESS' OR vg.group_status_ = 2)
             <if test="userId != null">
                 AND cgsm.user_id_ = #{userId}
             </if>

+ 29 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace=" com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao">
+  <resultMap id="CourseScheduleEvaluate" type="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate">
+    <id column="id_" jdbcType="BIGINT" property="id" />
+    <result column="music_group_id_" jdbcType="VARCHAR" property="musicGroupId" />
+    <result column="class_group_id_" jdbcType="INTEGER" property="classGroupId" />
+    <result column="course_schedule_id_" jdbcType="BIGINT" property="courseScheduleId" />
+    <result column="teacher_id_" jdbcType="INTEGER" property="teacherId" />
+    <result column="item_" jdbcType="VARCHAR" property="item" />
+    <result column="comment_" jdbcType="LONGVARCHAR" property="comment" />
+    <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id_, music_group_id_, class_group_id_, course_schedule_id_, teacher_id_, item_, comment_, 
+    create_time_
+  </sql>
+
+  <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate" useGeneratedKeys="true">
+    <!--@mbg.generated-->
+    insert into course_schedule_evaluate (music_group_id_, class_group_id_, course_schedule_id_,
+    teacher_id_, item_, comment_,
+    create_time_)
+    values (#{musicGroupId,jdbcType=VARCHAR}, #{classGroupId,jdbcType=INTEGER}, #{courseScheduleId,jdbcType=BIGINT},
+    #{teacherId,jdbcType=INTEGER}, #{item,jdbcType=VARCHAR}, #{comment,jdbcType=LONGVARCHAR},
+    #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+</mapper>

+ 6 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1766,7 +1766,7 @@
         LIMIT 1
     </select>
     <select id="countCurrentTimes" resultType="int">
-        SELECT COUNT(*) FROM course_schedule WHERE class_group_id_=#{classGroupId} AND CONCAT(class_date_,' ',end_class_time_)&lt;#{currentCourseDate}
+        SELECT COUNT(*) FROM course_schedule WHERE class_group_id_=#{classGroupId} AND CONCAT(class_date_,' ',end_class_time_)&lt;#{currentCourseDate} AND del_flag_ = 0
     </select>
     <select id="countCourseScheduleByMusicGroupId" resultType="java.lang.Integer">
         SELECT count(cs.id_) FROM course_schedule cs WHERE cs.music_group_id_ = #{musicGroupId} and cs.group_type_ = 'MUSIC' and cs.status_ != 'OVER' LIMIT 1
@@ -2369,4 +2369,9 @@
             #{id}
         </foreach>
     </select>
+    <select id="countCurrentCourseTime" resultType="java.lang.Integer">
+        SELECT COUNT(1) + 1 FROM course_schedule cs,
+        (SELECT CONCAT(class_date_," ",start_class_time_) class_date_,class_group_id_ FROM course_schedule WHERE id_ = #{courseScheduleId} AND del_flag_ = 0) c
+        WHERE cs.class_group_id_ = c.class_group_id_ AND CONCAT(cs.class_date_," ",cs.start_class_time_) &lt;= c.class_date_ AND cs.del_flag_ = 0
+    </select>
 </mapper>

+ 6 - 1
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -121,11 +121,16 @@
 			practice_group pg
 			LEFT JOIN sys_user su ON pg.user_id_ = su.id_
 			LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
+			LEFT JOIN student_payment_order spo ON spo.music_group_id_=pg.id_ AND spo.group_type_='PRACTICE'
 		WHERE
 			student_id_=#{userId}
+			AND spo.status_="SUCCESS"
+	</select>
+    <select id="findUserPracticeGroup" resultMap="PracticeGroup">
+		SELECT * FROM practice_group WHERE student_id_=#{userId} AND id_=#{groupId};
 	</select>
 
-	<sql id="practiceGroupQueryCondition">
+    <sql id="practiceGroupQueryCondition">
 		<where>
 			<if test="search!=null and search!=''">
 				AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})

+ 3 - 1
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -798,7 +798,9 @@
         GROUP BY su.id_
     </select>
     <select id="queryTeacherImModel" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.ImUserModel">
-        SELECT su.id_,su.avatar_,su.username_ FROM sys_user su
+        SELECT su.id_,su.avatar_,
+        CASE WHEN su.username_ IS NULL THEN su.real_name_ ELSE su.username_ END username_
+        FROM sys_user su
         WHERE su.id_ IN
         <foreach collection="teacherIds" item="userId" open="(" close=")" separator=",">
             #{userId}

+ 4 - 4
mec-student/src/main/java/com/ym/mec/student/controller/PracticeGroupController.java

@@ -120,22 +120,22 @@ public class PracticeGroupController extends BaseController {
 
     @ApiOperation("获取指定教师的空闲时间——付费")
     @GetMapping(value = "/getPayPracticeTeacherFreeTimes")
-    public Object getPayPracticeTeacherFreeTimes(Integer teacherId,Integer buyMonths, Date firstClassTime){
+    public Object getPayPracticeTeacherFreeTimes(Integer teacherId,Integer buyMonths, boolean renew, Long groupId){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return succeed(practiceGroupService.getPayPracticeTeacherFreeTimes(sysUser.getId(),teacherId, buyMonths,firstClassTime));
+        return succeed(practiceGroupService.getPayPracticeTeacherFreeTimes(sysUser.getId(),teacherId, buyMonths,renew,groupId));
     }
 
     @ApiOperation("获取学生上一次的购买信息--付费")
     @GetMapping(value = "/findUserLatestPracticeGroup")
-    public HttpResponseResult findUserLatestPracticeGroup(){
+    public HttpResponseResult findUserLatestPracticeGroup(Long groupId){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             return failed(HttpStatus.FORBIDDEN, "请登录");
         }
-        return succeed(practiceGroupService.findUserLatestPracticeGroup(sysUser.getId()));
+        return succeed(practiceGroupService.findUserLatestPracticeGroup(sysUser.getId(),groupId));
     }
 
     @ApiOperation("陪练课购买")

+ 30 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ClassGroupController.java

@@ -1,15 +1,21 @@
 package com.ym.mec.teacher.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
+import com.ym.mec.biz.service.CourseScheduleEvaluateService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Objects;
 
 /**
  * @Author Joburgess
@@ -22,6 +28,10 @@ public class ClassGroupController extends BaseController {
 
     @Autowired
     private ClassGroupService classGroupService;
+    @Autowired
+    private CourseScheduleEvaluateService courseScheduleEvaluateService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "教师关联班级获取")
     @GetMapping("/findTeacherClassGroups")
@@ -41,4 +51,21 @@ public class ClassGroupController extends BaseController {
         return succeed(classGroupService.findTeacherClassStudents(queryInfo));
     }
 
+    @ApiOperation(value = "提交陪练报告")
+    @PostMapping(value = "/addStudyReport")
+    public HttpResponseResult addStudyReport(@RequestBody CourseScheduleEvaluate courseScheduleEvaluate) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(sysUser)){
+            return failed(HttpStatus.FORBIDDEN,"请登录");
+        }
+        if(courseScheduleEvaluate.getClassGroupId()==null || courseScheduleEvaluate.getClassGroupId()<0){
+            return failed(HttpStatus.BAD_REQUEST,"班级id必须大于0");
+        }
+        if(courseScheduleEvaluate.getItem()==null || courseScheduleEvaluate.getItem().isEmpty()){
+            return failed(HttpStatus.BAD_REQUEST,"课程评价选项不能为空");
+        }
+        courseScheduleEvaluate.setTeacherId(sysUser.getId());
+        return succeed(courseScheduleEvaluateService.addStudyReport(courseScheduleEvaluate));
+    }
+
 }