Bläddra i källkod

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

zouxuan 5 år sedan
förälder
incheckning
d84f998521

+ 10 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java

@@ -39,7 +39,7 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param groupId
      * @return
      */
-    List<CourseScheduleEvaluate> findByGroupId(@Param("groupId") Integer groupId);
+    List<CourseScheduleEvaluate> findByGroupId(@Param("groupId") Integer groupId, @Param("status") Integer status);
 
     /**
      * 根据id获取报告
@@ -59,8 +59,17 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
 
     /**
      * 获取要提交的报告
+     *
      * @param teacherId
      * @return
      */
     List<CourseScheduleEvaluate> getNeedPostReports(@Param("teacherId") Integer teacherId);
+
+    /**
+     * 批量插入报告
+     *
+     * @param list
+     * @return
+     */
+    int batchAdd(@Param("list") List<CourseScheduleEvaluate> list);
 }

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

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.PracticeCourseDto;
 import com.ym.mec.biz.dal.dto.PracticeGroupDto;
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
 import com.ym.mec.biz.dal.entity.PracticeGroup;
 import com.ym.mec.biz.dal.enums.GroupStatusEnum;
 import org.apache.ibatis.annotations.Param;
@@ -181,4 +182,6 @@ public interface PracticeGroupDao extends com.ym.mec.common.dal.BaseDAO<Long, Pr
     List<PracticeGroupDto> findPracticeGroupsReviews(Map<String, Object> params);
 
     Integer countPracticeGroupReviews(Map<String, Object> params);
+
+    List<CourseScheduleEvaluate> getNeedPostReportPracticeGroups(@Param("nowDate") Date nowDate, @Param("afterDate") Date afterDate);
 }

+ 20 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleEvaluateService.java

@@ -1,12 +1,15 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.entity.ClassGroup;
 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.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 
@@ -22,7 +25,7 @@ public interface CourseScheduleEvaluateService extends BaseService<Long, CourseS
      * @param groupId
      * @return
      */
-    List<CourseScheduleEvaluate> findByGroupId(Integer groupId);
+    List<CourseScheduleEvaluate> findByGroupId(Integer groupId,Integer status);
 
     /**
      * 根据id获取报告
@@ -38,4 +41,20 @@ public interface CourseScheduleEvaluateService extends BaseService<Long, CourseS
      */
     List<CourseScheduleEvaluate> getNeedPostList(Integer teacherId);
 
+
+    /**
+     * 预生成学习报告
+     * @param NowDate
+     * @param afterDate
+     * @return
+     */
+    List<CourseScheduleEvaluate> createEvaluate(Date NowDate,Date afterDate);
+
+    /**
+     * 更新学习报告
+     * @param courseScheduleEvaluate
+     * @return
+     */
+    boolean updateStudyReport(CourseScheduleEvaluate courseScheduleEvaluate);
+
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -168,6 +168,11 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     String PRACTICE_RENEW_URL = "practice_renew_url";
 
     /**
+     * @describe 老师端baseUrl
+     */
+    String TEACHER_BASE_URL = "teacher_base_url";
+
+    /**
      * @return com.ym.mec.biz.dal.entity.SysConfig
      * @params paramName
      * @describe 根据配置名称获取配置信息

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

@@ -1024,9 +1024,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //剩余课程为显示陪练报告入口rul
             if(teacherClassGroupDto.getType() == ClassGroupTypeEnum.PRACTICE){
                 List<CourseScheduleEvaluate> courseScheduleEvaluates = courseScheduleEvaluateDao.findByClassGroupIds(classGroupIds);
-                Map<Integer, Long> reportMap = new HashMap<>();
-                if(courseScheduleEvaluates.size() >0 ) {
-                    reportMap = courseScheduleEvaluates.stream().collect(Collectors.toMap(CourseScheduleEvaluate::getClassGroupId, CourseScheduleEvaluate::getId));
+                Map<Integer, List<CourseScheduleEvaluate>> reportMap = new HashMap<>();
+                if(courseScheduleEvaluates.size()>0) {
+                    reportMap = courseScheduleEvaluates.stream().collect(Collectors.groupingBy(CourseScheduleEvaluate::getClassGroupId));
                 }
                 if(reportMap.containsKey(teacherClassGroupDto.getClassGroupId().intValue())){
                     teacherClassGroupDto.setHasReport(true);

+ 48 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -45,7 +46,6 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
 
 
     @Override
-    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public boolean addStudyReport(CourseScheduleEvaluate courseScheduleEvaluate) {
         ClassGroup classGroup = classGroupDao.get(courseScheduleEvaluate.getClassGroupId());
         if (classGroup == null) {
@@ -63,6 +63,7 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
             courseScheduleEvaluate.setMusicGroupId(classGroup.getMusicGroupId());
             courseScheduleEvaluate.setCreateTime(new Date());
             courseScheduleEvaluate.setStatus(1);
+            courseScheduleEvaluate.setVersion(1);
             long num = courseScheduleEvaluateDao.insert(courseScheduleEvaluate);
             if (num <= 0) {
                 throw new BizException("报告添加失败,请重试");
@@ -93,17 +94,60 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
     }
 
     @Override
-    public List<CourseScheduleEvaluate> findByGroupId(Integer groupId) {
-        return courseScheduleEvaluateDao.findByGroupId(groupId);
+    public List<CourseScheduleEvaluate> findByGroupId(Integer groupId,Integer status) {
+        return courseScheduleEvaluateDao.findByGroupId(groupId,status);
     }
 
     @Override
     public CourseScheduleEvaluate findById(Integer id) {
-        return courseScheduleEvaluateDao.findById(id);
+        CourseScheduleEvaluate studyReport = courseScheduleEvaluateDao.findById(id);
+        if (studyReport == null) {
+            throw new BizException("报告不存在");
+        }
+        SysUser user = teacherDao.getUser(studyReport.getStudentId());
+        BasicUserDto teacherInfo = teacherDao.findTeacherInfo(studyReport.getTeacherId());
+        studyReport.setStudent(user);
+        studyReport.setTeacher(teacherInfo);
+        long practiceGroupId = Long.parseLong(studyReport.getMusicGroupId());
+        PracticeGroup practiceGroup = practiceGroupDao.get(practiceGroupId);
+        ClassGroup classGroup = classGroupDao.get(studyReport.getClassGroupId());
+        studyReport.setTimes(classGroup.getTotalClassTimes());
+        studyReport.setTotalMinutes(classGroup.getTotalClassTimes() * practiceGroup.getSingleClassMinutes());
+        return studyReport;
     }
 
     @Override
     public List<CourseScheduleEvaluate> getNeedPostList(Integer teacherId) {
         return courseScheduleEvaluateDao.getNeedPostReports(teacherId);
     }
+
+    @Override
+    public List<CourseScheduleEvaluate> createEvaluate(Date NowDate, Date afterDate) {
+        List<CourseScheduleEvaluate> needPostReportPracticeGroups = practiceGroupDao.getNeedPostReportPracticeGroups(NowDate, afterDate);
+        for (CourseScheduleEvaluate needPostReportPracticeGroup : needPostReportPracticeGroups) {
+            needPostReportPracticeGroup.setCreateTime(NowDate);
+            needPostReportPracticeGroup.setStatus(0);
+            needPostReportPracticeGroup.setVersion(2);
+        }
+        if (needPostReportPracticeGroups.size() > 0) {
+            courseScheduleEvaluateDao.batchAdd(needPostReportPracticeGroups);
+        }
+        return needPostReportPracticeGroups;
+    }
+
+    @Override
+    public boolean updateStudyReport(CourseScheduleEvaluate courseScheduleEvaluate) {
+        ClassGroup classGroup = classGroupDao.get(courseScheduleEvaluate.getClassGroupId());
+        if (classGroup == null) {
+            throw new BizException("课程不存在!");
+        }
+        courseScheduleEvaluate.setMusicGroupId(classGroup.getMusicGroupId());
+        courseScheduleEvaluate.setStatus(1);
+        courseScheduleEvaluate.setVersion(2);
+        long num = courseScheduleEvaluateDao.update(courseScheduleEvaluate);
+        if (num <= 0) {
+            throw new BizException("报告添加失败,请重试");
+        }
+        return true;
+    }
 }

+ 67 - 7
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -36,8 +36,51 @@
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate">
         update course_schedule_evaluate
-        set is_pushed_=#{isPushed}
-        where id_ = #{id}
+        <set>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
+            <if test="classGroupId != null">
+                class_group_id_ = #{classGroupId},
+            </if>
+            <if test="courseScheduleId != null">
+                course_schedule_id_ = #{courseScheduleId},
+            </if>
+            <if test="musicTheory != null">
+                music_theory_ = #{musicTheory},
+            </if>
+            <if test="song != null">
+                song_ = #{song},
+            </if>
+            <if test="teachingMaterial != null">
+                teaching_material_ = #{teachingMaterial},
+            </if>
+            <if test="item != null">
+                item_ = #{item},
+            </if>
+            <if test="comment != null">
+                comment_ = #{comment},
+            </if>
+            <if test="classGroupId != null">
+                class_group_id_ = #{classGroupId},
+            </if>
+            <if test="studentIdList != null">
+                student_id_list_ = #{studentIdList},
+            </if>
+            <if test="teacherId != null">
+                teacher_id_ = #{teacherId},
+            </if>
+            <if test="version != null != null">
+                version_ = #{version},
+            </if>
+            <if test="status != null">
+                status_ = #{status},
+            </if>
+            <if test="isPushed != null">
+                is_pushed_ = #{isPushed}
+            </if>
+        </set>
+        WHERE id_ = #{id}
     </update>
 
     <select id="findByClassGroupId" resultMap="CourseScheduleEvaluate">
@@ -45,7 +88,7 @@
         FROM course_schedule_evaluate cse
                  LEFT JOIN practice_group pg ON pg.id_ = cse.music_group_id_
                  LEFT JOIN subject s on s.id_ = pg.subject_id_
-        WHERE cse.class_group_id_ = #{classGroupId}
+        WHERE cse.class_group_id_ = #{classGroupId} AND status_=1
         ORDER BY create_time_ DESC
         LIMIT 1
     </select>
@@ -55,6 +98,8 @@
         <foreach collection="classGroupIds" item="classGroupId" separator="," open="(" close=")">
             #{classGroupId}
         </foreach>
+        AND status_=1
+        ORDER BY create_time_ ASC
     </select>
 
     <resultMap id="PracticeGroupsOrgan" type="com.ym.mec.biz.dal.dto.PracticeGroupsDto">
@@ -94,6 +139,7 @@
                  LEFT JOIN practice_group pg on cse.music_group_id_ = pg.id_
             AND pg.buy_months_ IS NULL
             AND pg.group_status_ != 'LOCK'
+            AND cse.status_ = 1
         GROUP BY pg.organ_id_
     </select>
 
@@ -122,14 +168,17 @@
     <select id="findExpiredDateBeforeReport" resultMap="CourseScheduleEvaluate">
         SELECT *
         FROM course_schedule_evaluate
-        WHERE create_time_ &lt;= #{expiredDate}
+        WHERE status_ = 1 AND create_time_ &lt;= #{expiredDate}
           AND (is_pushed_ = 0 OR is_pushed_ IS NULL)
     </select>
 
     <select id="findByGroupId" resultMap="CourseScheduleEvaluate">
-        SELECT id_, DATE_FORMAT(create_time_, '%Y年%m月') month_
+        SELECT id_,status_,class_group_id_,version_, DATE_FORMAT(create_time_, '%Y年%m月') month_
         FROM course_schedule_evaluate
         WHERE music_group_id_ = #{groupId}
+        <if test="status != null">
+            AND status_ = #{status}
+        </if>
         ORDER BY create_time_ ASC
     </select>
 
@@ -149,12 +198,23 @@
     </select>
 
     <select id="getNeedPostReports" resultMap="CourseScheduleEvaluate">
-        SELECT cse.id_,DATE_FORMAT(cse.create_time_,'%Y年%m月') month_,pg.name_ group_name_ FROM course_schedule_evaluate
-        cse
+        SELECT cse.id_,DATE_FORMAT(cse.create_time_,'%Y年%m月') month_,pg.name_ group_name_ FROM course_schedule_evaluate cse
         LEFT JOIN practice_group pg on cse.music_group_id_ = pg.id_ WHERE status_= 0
         <if test="teacherId != null">
             AND cse.teacher_id_ = #{teacherId}
         </if>
         ORDER BY cse.create_time_ ASC
     </select>
+
+    <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        INSERT INTO course_schedule_evaluate (music_group_id_, class_group_id_, course_schedule_id_, music_theory_,
+        song_,teaching_material_, teacher_id_, item_, comment_, create_time_,student_id_list_, version_, status_)
+        VALUE
+        <foreach collection="list" item="evaluate" separator=",">
+            (#{evaluate.musicGroupId,jdbcType=VARCHAR}, #{evaluate.classGroupId,jdbcType=INTEGER}, #{evaluate.courseScheduleId,jdbcType=BIGINT},
+            #{evaluate.musicTheory,jdbcType=VARCHAR}, #{evaluate.song,jdbcType=VARCHAR}, #{evaluate.teachingMaterial,jdbcType=VARCHAR},
+            #{evaluate.teacherId,jdbcType=INTEGER}, #{evaluate.item,jdbcType=VARCHAR}, #{evaluate.comment,jdbcType=LONGVARCHAR}, #{evaluate.createTime,jdbcType=LONGVARCHAR},
+            #{evaluate.studentIdList}, #{evaluate.version,jdbcType=INTEGER}, #{evaluate.status,jdbcType=TINYINT})
+        </foreach>
+    </insert>
 </mapper>

+ 300 - 243
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -5,276 +5,333 @@
 不要修改此文件。所有改动将在下次重新自动生成时丢失。
 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.PracticeGroupDao">
-	
-	<resultMap type="com.ym.mec.biz.dal.entity.PracticeGroup" id="PracticeGroup">
-		<result column="id_" property="id" />
-		<result column="name_" property="name" />
-		<result column="subject_id_" property="subjectId" />
-		<result column="user_id_" property="userId" />
-		<result column="student_id_" property="studentId" />
-		<result column="single_class_minutes_" property="singleClassMinutes" />
-		<result column="organ_id_" property="organId" />
-		<result column="courses_start_date_" property="coursesStartDate" />
-		<result column="courses_expire_date_" property="coursesExpireDate" />
-		<result column="create_time_" property="createTime" />
-		<result column="update_time_" property="updateTime" />
-		<result column="memo_" property="memo" />
-		<result column="buy_months_" property="buyMonths" />
-		<result column="drill_times_on_week_" property="drillTimesOnWeek" />
-		<result column="drill_times_json_" property="drillTimesJson" />
-		<result column="group_status_" property="groupStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-		<result column="be_renew_group_id_" property="beRenewGroupId"/>
-	</resultMap>
 
-	<resultMap id="PracticeCourseDto" type="com.ym.mec.biz.dal.dto.PracticeCourseDto" extends="PracticeGroup">
-		<result property="teacherName" column="real_name_"/>
-		<result property="avatar" column="avatar_"/>
-		<result property="subjectName" column="subject_name_"/>
-	</resultMap>
+    <resultMap type="com.ym.mec.biz.dal.entity.PracticeGroup" id="PracticeGroup">
+        <result column="id_" property="id"/>
+        <result column="name_" property="name"/>
+        <result column="subject_id_" property="subjectId"/>
+        <result column="user_id_" property="userId"/>
+        <result column="student_id_" property="studentId"/>
+        <result column="single_class_minutes_" property="singleClassMinutes"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="courses_start_date_" property="coursesStartDate"/>
+        <result column="courses_expire_date_" property="coursesExpireDate"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="memo_" property="memo"/>
+        <result column="buy_months_" property="buyMonths"/>
+        <result column="drill_times_on_week_" property="drillTimesOnWeek"/>
+        <result column="drill_times_json_" property="drillTimesJson"/>
+        <result column="group_status_" property="groupStatus"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="be_renew_group_id_" property="beRenewGroupId"/>
+    </resultMap>
 
-	<resultMap type="com.ym.mec.biz.dal.dto.PracticeGroupDto" id="PracticeGroupDto" extends="PracticeGroup">
-		<result column="id_" property="id" />
-		<result column="name_" property="name" />
-		<result column="subject_id_" property="subjectId" />
-		<result column="user_id_" property="userId" />
-		<result column="single_class_minutes_" property="singleClassMinutes" />
-		<result column="organ_id_" property="organId" />
-		<result column="courses_start_date_" property="coursesStartDate" />
-		<result column="courses_expire_date_" property="coursesExpireDate" />
-		<result column="create_time_" property="createTime" />
-		<result column="update_time_" property="updateTime" />
-		<result column="memo_" property="memo" />
-		<result column="subject_name_" property="subjectName" />
-		<result column="teacher_name_" property="teacherName" />
-		<result column="evaluate_id_" property="evaluateId" />
-	</resultMap>
-	<update id="updateUserId">
-		UPDATE practice_group SET user_id_ = #{teacherId},update_time_ = NOW()
-		WHERE id_ = #{practiceGroupId}
-	</update>
+    <resultMap id="PracticeCourseDto" type="com.ym.mec.biz.dal.dto.PracticeCourseDto" extends="PracticeGroup">
+        <result property="teacherName" column="real_name_"/>
+        <result property="avatar" column="avatar_"/>
+        <result property="subjectName" column="subject_name_"/>
+    </resultMap>
 
-	<update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup">
-		UPDATE practice_group
-		<set>
-			<if test="subjectId!=null">
-				subject_id_=#{subjectId},
-			</if>
-			<if test="memo!=null">
-				memo_=#{memo},
-			</if>
-			<if test="name!=null">
-				name_=#{name},
-			</if>
-			<if test="groupStatus!=null">
-				group_status_=#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-			</if>
-			update_time_ = NOW()
-		</set>
-		WHERE id_ = #{id}
-	</update>
+    <resultMap type="com.ym.mec.biz.dal.dto.PracticeGroupDto" id="PracticeGroupDto" extends="PracticeGroup">
+        <result column="id_" property="id"/>
+        <result column="name_" property="name"/>
+        <result column="subject_id_" property="subjectId"/>
+        <result column="user_id_" property="userId"/>
+        <result column="single_class_minutes_" property="singleClassMinutes"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="courses_start_date_" property="coursesStartDate"/>
+        <result column="courses_expire_date_" property="coursesExpireDate"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="memo_" property="memo"/>
+        <result column="subject_name_" property="subjectName"/>
+        <result column="teacher_name_" property="teacherName"/>
+        <result column="evaluate_id_" property="evaluateId"/>
+    </resultMap>
+    <update id="updateUserId">
+        UPDATE practice_group
+        SET user_id_     = #{teacherId},
+            update_time_ = NOW()
+        WHERE id_ = #{practiceGroupId}
+    </update>
 
-	<update id="batchUpdate">
-		<foreach collection="groups" item="group" separator=";">
-			UPDATE practice_group
-			<set>
-				<if test="group.groupStatus!=null">
-					group_status_=#{group.groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-				</if>
-				update_time_ = NOW()
-			</set>
-			WHERE id_ = #{group.id}
-		</foreach>
-	</update>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup">
+        UPDATE practice_group
+        <set>
+            <if test="subjectId!=null">
+                subject_id_=#{subjectId},
+            </if>
+            <if test="memo!=null">
+                memo_=#{memo},
+            </if>
+            <if test="name!=null">
+                name_=#{name},
+            </if>
+            <if test="groupStatus!=null">
+                group_status_=#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            update_time_ = NOW()
+        </set>
+        WHERE id_ = #{id}
+    </update>
 
-	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE id_ = #{id}
-	</select>
-	
-	<!-- 全查询 -->
-	<select id="findAll" resultMap="PracticeGroup">
-		SELECT * FROM practice_group
-	</select>
-	
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO practice_group
-		(id_,name_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,be_renew_group_id_)
-		VALUES(#{id},#{name},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId})
-	</insert>
-	
-	<select id="getUserFreePracticeGroup" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE student_id_=#{userId} AND buy_months_ IS NULL
-	</select>
-	
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="PracticeGroup" parameterType="map">
-		SELECT * FROM practice_group <include refid="global.limit"/>
-	</select>
-	
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM practice_group
-	</select>
+    <update id="batchUpdate">
+        <foreach collection="groups" item="group" separator=";">
+            UPDATE practice_group
+            <set>
+                <if test="group.groupStatus!=null">
+                    group_status_=#{group.groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                </if>
+                update_time_ = NOW()
+            </set>
+            WHERE id_ = #{group.id}
+        </foreach>
+    </update>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE id_ = #{id}
+    </select>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+    </select>
+
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+        <!--
+        <selectKey resultClass="int" keyProperty="id" >
+        SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
+        </selectKey>
+        -->
+        INSERT INTO practice_group
+        (id_,name_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,be_renew_group_id_)
+        VALUES(#{id},#{name},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId})
+    </insert>
+
+    <select id="getUserFreePracticeGroup" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND buy_months_ IS NULL
+    </select>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="PracticeGroup" parameterType="map">
+        SELECT * FROM practice_group
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM practice_group
+    </select>
     <select id="getUserPracticeCoursesWithDateRange" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE user_id_=#{userId} AND (courses_start_date_ BETWEEN DATE_FORMAT(#{startDate},'%Y-%m-%d') AND DATE_FORMAT(#{endDate},'%Y-%m-%d'))
-	</select>
+        SELECT *
+        FROM practice_group
+        WHERE user_id_ = #{userId}
+          AND (courses_start_date_ BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d'))
+    </select>
     <select id="countUserPracticeApplyRecord" resultType="int">
-		SELECT COUNT(*) FROM practice_group WHERE student_id_=#{userId} AND group_status_='NORMAL' AND buy_months_ IS NULL;
+        SELECT COUNT(*)
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND group_status_ = 'NORMAL'
+          AND buy_months_ IS NULL;
     </select>
     <select id="countPracticeGroupByOrgan" resultType="java.lang.Integer">
-		SELECT count(*) FROM practice_group pg
-		<include refid="practiceGroupQueryCondition"/>
-	</select>
-	<select id="findAllByOrgan" resultMap="PracticeGroupDto">
-		SELECT pg.*,
-		su.real_name_ teacher_name_
-		FROM
-		practice_group pg
-		LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-		<include refid="practiceGroupQueryCondition"/>
-		ORDER BY pg.id_ DESC
-		<include refid="global.limit"/>
-	</select>
-	<select id="countPracticeGroupOverCourse" resultType="java.util.Map">
+        SELECT count(*) FROM practice_group pg
+        <include refid="practiceGroupQueryCondition"/>
+    </select>
+    <select id="findAllByOrgan" resultMap="PracticeGroupDto">
+        SELECT pg.*,
+        su.real_name_ teacher_name_
+        FROM
+        practice_group pg
+        LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+        <include refid="practiceGroupQueryCondition"/>
+        ORDER BY pg.id_ DESC
+        <include refid="global.limit"/>
+    </select>
+    <select id="countPracticeGroupOverCourse" resultType="java.util.Map">
 
-	</select>
+    </select>
 
     <select id="findUserLatestPracticeGroup" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE student_id_=#{userId} AND buy_months_ IS NOT NULL ORDER BY create_time_ DESC LIMIT 1;
-	</select>
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND buy_months_ IS NOT NULL
+        ORDER BY create_time_ DESC
+        LIMIT 1;
+    </select>
 
-	<select id="findUserBuyPracticeGroups" resultMap="PracticeCourseDto">
-		SELECT
-			pg.*,
-			su.real_name_,
-			su.avatar_,
-			s.name_ subject_name_
-		FROM
-			practice_group pg
-			LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-			LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
-		WHERE
-			student_id_=#{userId}
-			AND (pg.group_status_='NORMAL' OR pg.group_status_='LOCK')
-			AND pg.buy_months_ IS NOT NULL
-	</select>
+    <select id="findUserBuyPracticeGroups" resultMap="PracticeCourseDto">
+        SELECT pg.*,
+               su.real_name_,
+               su.avatar_,
+               s.name_ subject_name_
+        FROM practice_group pg
+                 LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+                 LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
+        WHERE student_id_ = #{userId}
+          AND (pg.group_status_ = 'NORMAL' OR pg.group_status_ = 'LOCK')
+          AND pg.buy_months_ IS NOT NULL
+    </select>
 
-	<select id="findUserBuyPracticeGroupsWithDate" resultMap="PracticeCourseDto">
-		SELECT
-			pg.*,
-			su.real_name_,
-			su.avatar_,
-			s.name_ subject_name_
-		FROM
-			practice_group pg
-			LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-			LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
-		WHERE
-			student_id_=#{userId}
-			AND courses_start_date_=#{date} AND group_status_='LOCK'
-			AND pg.buy_months_ IS NOT NULL
-	</select>
-	<select id="findUserPracticeGroup" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE student_id_=#{userId} AND id_=#{groupId};
-	</select>
-	<select id="findUserPracticeGroup2" resultMap="PracticeGroupDto">
-		SELECT pg.*,su.real_name_ teacher_name_ FROM practice_group pg
-		LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-		WHERE pg.student_id_=#{userId} AND pg.id_=#{groupId};
-	</select>
+    <select id="findUserBuyPracticeGroupsWithDate" resultMap="PracticeCourseDto">
+        SELECT pg.*,
+               su.real_name_,
+               su.avatar_,
+               s.name_ subject_name_
+        FROM practice_group pg
+                 LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+                 LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
+        WHERE student_id_ = #{userId}
+          AND courses_start_date_ = #{date}
+          AND group_status_ = 'LOCK'
+          AND pg.buy_months_ IS NOT NULL
+    </select>
+    <select id="findUserPracticeGroup" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND id_ = #{groupId};
+    </select>
+    <select id="findUserPracticeGroup2" resultMap="PracticeGroupDto">
+        SELECT pg.*, su.real_name_ teacher_name_
+        FROM practice_group pg
+                 LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+        WHERE pg.student_id_ = #{userId}
+          AND pg.id_ = #{groupId};
+    </select>
     <select id="findHistoryPracticeGroups" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE courses_expire_date_ &lt; NOW() AND group_status_='NORMAL'
+        SELECT *
+        FROM practice_group
+        WHERE courses_expire_date_ &lt; NOW()
+          AND group_status_ = 'NORMAL'
     </select>
 
     <sql id="practiceGroupQueryCondition">
-		<where>
-			pg.group_status_='NORMAL'
-			<if test="search!=null and search!=''">
-				AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
-			</if>
-			<if test="teacherId!=null">
-				AND pg.user_id_=#{teacherId}
-			</if>
-			<if test="organId != null">
-				AND FIND_IN_SET(pg.organ_id_,#{organId})
-			</if>
-		</where>
-	</sql>
+        <where>
+            pg.group_status_='NORMAL'
+            <if test="search!=null and search!=''">
+                AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
+            </if>
+            <if test="teacherId!=null">
+                AND pg.user_id_=#{teacherId}
+            </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(pg.organ_id_,#{organId})
+            </if>
+        </where>
+    </sql>
 
-	<!-- 根据主键查询一条记录 -->
-	<select id="lockPracticeGroup" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE id_ = #{groupId} FOR UPDATE
-	</select>
-	<select id="findUserStatusPracticeGroups" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE  student_id_=#{userId} AND group_status_=#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-	</select>
+    <!-- 根据主键查询一条记录 -->
+    <select id="lockPracticeGroup" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE id_ = #{groupId} FOR
+        UPDATE
+    </select>
+    <select id="findUserStatusPracticeGroups" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND group_status_ = #{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+    </select>
     <select id="findUserLockPracticeGroupWithDate" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE student_id_=#{userId} AND courses_start_date_=#{date} AND group_status_='LOCK'
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND courses_start_date_ = #{date}
+          AND group_status_ = 'LOCK'
+    </select>
+    <select id="findUserLockPracticeGroupWithDateBefore" resultMap="PracticeGroup">
+        SELECT *
+        FROM practice_group
+        WHERE student_id_ = #{userId}
+          AND courses_start_date_ &lt;= #{date}
+          AND group_status_ = 'LOCK'
     </select>
-	<select id="findUserLockPracticeGroupWithDateBefore" resultMap="PracticeGroup">
-		SELECT * FROM practice_group WHERE student_id_=#{userId} AND courses_start_date_&lt;=#{date} AND group_status_='LOCK'
-	</select>
 
-	<sql id="practiceGroupReviewsQueryCondition">
-		<where>
-			pg.group_status_='NORMAL'
-			<if test="search!=null and search!=''">
-				AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
-			</if>
-			<if test="teacherId!=null">
-				AND pg.user_id_=#{teacherId}
-			</if>
-			<if test="organId != null">
-				AND FIND_IN_SET(pg.organ_id_,#{organId})
-			</if>
-			<if test="month != null">
-				AND pg.courses_expire_date_ >= #{month}
-			</if>
-			<if test='isFree !=null and isFree=="0"'>
-				AND pg.buy_months_ > 0
-			</if>
-			<if test='isFree !=null and isFree=="1"'>
-				AND pg.buy_months_ IS NULL
-			</if>
-			<if test='isOver !=null and isOver=="0"'>
-				<![CDATA[AND pg.courses_expire_date_ > NOW()
+    <sql id="practiceGroupReviewsQueryCondition">
+        <where>
+            pg.group_status_='NORMAL'
+            <if test="search!=null and search!=''">
+                AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
+            </if>
+            <if test="teacherId!=null">
+                AND pg.user_id_=#{teacherId}
+            </if>
+            <if test="organId != null">
+                AND FIND_IN_SET(pg.organ_id_,#{organId})
+            </if>
+            <if test="month != null">
+                AND pg.courses_expire_date_ >= #{month}
+            </if>
+            <if test='isFree !=null and isFree=="0"'>
+                AND pg.buy_months_ > 0
+            </if>
+            <if test='isFree !=null and isFree=="1"'>
+                AND pg.buy_months_ IS NULL
+            </if>
+            <if test='isOver !=null and isOver=="0"'>
+                <![CDATA[AND pg.courses_expire_date_ > NOW()
 			]]>
-			</if>
-			<if test='isOver !=null and isOver=="1"'>
-				<![CDATA[ AND pg.courses_expire_date_ <= NOW()
+            </if>
+            <if test='isOver !=null and isOver=="1"'>
+                <![CDATA[ AND pg.courses_expire_date_ <= NOW()
 			]]></if>
-			<if test='hasReport !=null and hasReport=="0"'>
-				<![CDATA[AND cse.id_ IS NULL
+            <if test='hasReport !=null and hasReport=="0"'>
+                <![CDATA[AND cse.id_ IS NULL
 			]]>
-			</if>
-			<if test='hasReport !=null and hasReport=="1"'>
-				<![CDATA[ AND cse.id_ > 0
+            </if>
+            <if test='hasReport !=null and hasReport=="1"'>
+                <![CDATA[ AND cse.id_ > 0
 			]]></if>
-		</where>
-	</sql>
+        </where>
+    </sql>
+
+    <select id="findPracticeGroupsReviews" resultMap="PracticeGroupDto">
+        SELECT pg.*,cse.id_ evaluate_id_,
+        su.real_name_ teacher_name_
+        FROM
+        practice_group pg
+        LEFT JOIN sys_user su ON pg.user_id_ = su.id_
+        LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') =
+        DATE_FORMAT(#{month},'%Y%m')
+        <include refid="practiceGroupReviewsQueryCondition"/>
+        ORDER BY pg.id_ DESC
+        <include refid="global.limit"/>
+    </select>
 
-	<select id="findPracticeGroupsReviews" resultMap="PracticeGroupDto">
-		SELECT pg.*,cse.id_ evaluate_id_,
-		su.real_name_ teacher_name_
-		FROM
-		practice_group pg
-		LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-		LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') = DATE_FORMAT(#{month},'%Y%m')
-		<include refid="practiceGroupReviewsQueryCondition"/>
-		ORDER BY pg.id_ DESC
-		<include refid="global.limit"/>
-	</select>
 
+    <select id="countPracticeGroupReviews" resultType="java.lang.Integer">
+        SELECT count(*) FROM practice_group pg
+        LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') =
+        DATE_FORMAT(#{month},'%Y%m')
+        <include refid="practiceGroupReviewsQueryCondition"/>
+    </select>
 
-	<select id="countPracticeGroupReviews" resultType="java.lang.Integer">
-		SELECT count(*) FROM practice_group pg
-		LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_ AND DATE_FORMAT(cse.create_time_, '%Y%m') = DATE_FORMAT(#{month},'%Y%m')
-		<include refid="practiceGroupReviewsQueryCondition"/>
-	</select>
+    <select id="getNeedPostReportPracticeGroups"
+            resultMap="com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao.CourseScheduleEvaluate">
+        <![CDATA[
+        SELECT pg.id_ music_group_id_, pg.user_id_ teacher_id_, cg.id_ class_group_id_
+        FROM practice_group pg LEFT JOIN class_group cg on pg.id_ = cg.music_group_id_ AND cg.group_type_ = 'PRACTICE'
+        WHERE pg.courses_start_date_ <= #{nowDate}
+          AND pg.courses_expire_date_ >= #{afterDate}
+          AND DATE_FORMAT(pg.courses_expire_date_, '%m%d') = DATE_FORMAT(#{afterDate}, '%m%d')
+          AND cg.del_flag_ = 0
+          AND pg.group_status_ != 'CANCEL'
+          AND pg.group_status_ != 'LOCK'
+        ]]>
+    </select>
 </mapper>

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudyReportController.java

@@ -28,7 +28,7 @@ public class StudyReportController extends BaseController {
 	@ApiOperation(value = "课程组评论列表")
 	@GetMapping("getGroupReviews")
 	public Object getGroupReviews(Integer groupId) {
-		return succeed(courseScheduleEvaluateService.findByGroupId(groupId));
+		return succeed(courseScheduleEvaluateService.findByGroupId(groupId,1));
 	}
 
 	@ApiOperation(value = "评论详情")

+ 1 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/config/ResourceServerConfig.java

@@ -25,7 +25,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
-				.authorizeRequests().antMatchers("/v2/api-docs","/code/*","/teacher/queryStudentApply","/teacher/querySubByMusicGroupId","/studentRegistration/updateSubject").permitAll().anyRequest().authenticated().and().httpBasic();
+				.authorizeRequests().antMatchers("/v2/api-docs","/code/*","/teacher/queryStudentApply","/teacher/querySubByMusicGroupId","/studentRegistration/updateSubject","/studyReport/createEvaluate").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 44 - 17
mec-teacher/src/main/java/com/ym/mec/teacher/controller/StudyReportController.java

@@ -2,17 +2,19 @@ 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.dao.SysConfigDao;
 import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.service.CourseScheduleEvaluateService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
 import java.util.List;
@@ -27,6 +29,8 @@ public class StudyReportController extends BaseController {
     private CourseScheduleEvaluateService courseScheduleEvaluateService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
 
 
     @ApiOperation("获取学生陪练报告信息")
@@ -38,25 +42,17 @@ public class StudyReportController extends BaseController {
     @ApiOperation(value = "课程组评论列表")
     @GetMapping("getGroupReviews")
     public Object getGroupReviews(Integer groupId) {
-        List<CourseScheduleEvaluate> courseScheduleEvaluates = courseScheduleEvaluateService.findByGroupId(groupId);
-        boolean hasReport = false;
-        Date nowDate = new Date();
+        List<CourseScheduleEvaluate> courseScheduleEvaluates = courseScheduleEvaluateService.findByGroupId(groupId,null);
+        String teacherBaseUrl = sysConfigDao.findConfigValue(SysConfigService.TEACHER_BASE_URL);
         for (CourseScheduleEvaluate courseScheduleEvaluate : courseScheduleEvaluates) {
             courseScheduleEvaluate.setTimes(2);
             courseScheduleEvaluate.setTotalMinutes(100);
-            courseScheduleEvaluate.setReportLink("http://www.baidu.com");
-            if (DateUtil.format(courseScheduleEvaluate.getCreateTime(), "yyyy-MM").equals(DateUtil.format(nowDate, "yyyy-MM"))) {
-                hasReport = true;
+            if (courseScheduleEvaluate.getStatus().equals(1)) {
+                courseScheduleEvaluate.setReportLink(teacherBaseUrl + "/#/reportDetailNew?id=" + courseScheduleEvaluate.getId() + "&classGroupId=" + courseScheduleEvaluate.getClassGroupId());
+            } else {
+                courseScheduleEvaluate.setReportLink(teacherBaseUrl + "/#/studyReportNew?id=" + courseScheduleEvaluate.getId() + "&classGroupId=" + courseScheduleEvaluate.getClassGroupId());
             }
         }
-        if (!hasReport) {
-            CourseScheduleEvaluate courseScheduleEvaluate = new CourseScheduleEvaluate();
-            courseScheduleEvaluate.setReportLink("http://www.baidu.com");
-            courseScheduleEvaluate.setTimes(2);
-            courseScheduleEvaluate.setTotalMinutes(100);
-            courseScheduleEvaluate.setMonth(DateUtil.format(nowDate, "yyyy年MM月"));
-        }
-
         return succeed(courseScheduleEvaluates);
     }
 
@@ -75,4 +71,35 @@ public class StudyReportController extends BaseController {
         }
         return succeed(courseScheduleEvaluateService.getNeedPostList(sysUser.getId()));
     }
+
+    @ApiOperation(value = "预生成报告")
+    @GetMapping("createEvaluate")
+    public Object createEvaluate(Date date) {
+        Date nowDate = new Date();
+        if (date != null) {
+            nowDate = date;
+        }
+        Date afterDate = DateUtil.addDays1(nowDate, 5);
+        return succeed(courseScheduleEvaluateService.createEvaluate(nowDate, afterDate));
+    }
+
+    @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.getId() == null || courseScheduleEvaluate.getId() < 0) {
+            return failed(HttpStatus.BAD_REQUEST, "报告id不能为空");
+        }
+        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.updateStudyReport(courseScheduleEvaluate));
+    }
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupManageController.java

@@ -119,7 +119,7 @@ public class PracticeGroupManageController extends BaseController {
     @GetMapping("getGroupReviews")
     @PreAuthorize("@pcs.hasPermissions('practiceGroupManage/getGroupReviews')")
     public Object getGroupReviews(Integer groupId) {
-        return succeed(courseScheduleEvaluateService.findByGroupId(groupId));
+        return succeed(courseScheduleEvaluateService.findByGroupId(groupId,1));
     }
 
     @ApiOperation(value = "评论详情")