Ver código fonte

Merge remote-tracking branch 'origin/master'

周箭河 5 anos atrás
pai
commit
f770935187

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

@@ -15,7 +15,7 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
      * @Date: 2019/9/18
      * 统计已提交作业的人数
      */
-    @Select("SELECT COUNT(*) FROM student_course_homework WHERE course_homework_id_=#{courseHomeworkID} FOR UPDATE")
+    @Select("SELECT COUNT(*) FROM student_course_homework WHERE course_homework_id_=#{courseHomeworkID} AND attachments_ IS NOT NULL")
     int countCompletedStudentNum(Long courseHomeworkID);
 
     /**

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

@@ -21,4 +21,4 @@ public interface StudentCourseHomeworkReplyDao extends BaseDAO<Long, StudentCour
      */
     int batchDeleteReplys(List<Long> ids);
 	
-}
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentCourseHomeworkReplyQueryInfo.java

@@ -15,6 +15,16 @@ public class StudentCourseHomeworkReplyQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "父级评论ID")
     private Long parentID;
 
+    private Integer userId;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
     public Long getStudentCourseHomeworkId() {
         return studentCourseHomeworkId;
     }

+ 14 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -48,8 +48,6 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 	@Autowired
 	private SysMessageService sysMessageService;
 
-	private String url = "http://auth-server/queryUserInfo";
-
 	@Override
 	public BaseDAO<Long, StudentCourseHomework> getDAO() {
 		return studentCourseHomeworkDao;
@@ -75,6 +73,20 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 	}
 
 	@Override
+	public int update(StudentCourseHomework bean) {
+		super.update(bean);
+		bean=studentCourseHomeworkDao.get(bean.getId());
+		CourseSchedule courseSchedule = courseScheduleDao.get(bean.getCourseScheduleId());
+
+		CourseHomework courseHomework = new CourseHomework();
+		courseHomework.setId(bean.getCourseHomeworkId());
+		courseHomework.setGroupType(courseSchedule.getGroupType());
+		courseHomework.setCompletedNum(studentCourseHomeworkDao.countCompletedStudentNum(bean.getCourseHomeworkId()));
+
+		return courseHomeworkService.update(courseHomework);
+	}
+
+	@Override
 	public CourseHomeworkStudentDetailDto findCourseHomeworkStudentDetail(Long courseScheduleID, Long userId) {
 		return studentCourseHomeworkDao.findCourseHomeworkStudentDetail(courseScheduleID, userId);
 	}

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

@@ -174,15 +174,15 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			courseHomework.setMusicGroupId(currentCourseDetail.getMusicGroupId());
 			courseHomework.setGroupType(teacherAttendance.getGroupType());
 			courseHomework.setClassGroupId(currentCourseDetail.getClassId().intValue());
-			courseHomework.setExpectNum(studentAttendanceDao.countNormalAttendanceStudentNums(teacherAttendance.getCourseScheduleId()));
 			courseHomework.setExpiryDate(DateUtil.addDays(date,7));
-			courseHomeworkService.insert(courseHomework);
 			List<StudentCourseHomework> studentCourseHomeworks = studentCourseHomeworkDao
 					.constructInitialStudentHomeworkRecordsWithPayment(teacherAttendance.getCourseScheduleId(),
 							courseHomework.getId());
 			if(CollectionUtils.isEmpty(studentCourseHomeworks)){
 				throw new BizException("此课程没有学生");
 			}
+			courseHomework.setExpectNum(studentCourseHomeworks.size());
+			courseHomeworkService.insert(courseHomework);
 			studentCourseHomeworkDao.batchInsertStudentCourseHomeworkRecord(studentCourseHomeworks);
 			return result;
 		}

+ 42 - 39
mec-biz/src/main/resources/config/mybatis/CourseHomeworkMapper.xml

@@ -66,45 +66,47 @@
 	
 	<!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseHomework">
-		UPDATE course_homework <set>
-		<if test="attachments != null">
-			attachments_ = #{attachments},
-		</if>
-		<if test="id != null">
-		id_ = #{id},
-		</if>
-		<if test="classGroupId != null">
-		class_group_id_ = #{classGroupId},
-		</if>
-		<if test="courseScheduleId != null">
-		course_schedule_id_ = #{courseScheduleId},
-		</if>
-		<if test="completedNum != null">
-			completed_num_ = #{completedNum},
-		</if>
-        <if test="groupType != null">
-            group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        </if>
+		UPDATE course_homework
+		<set>
+			<if test="attachments != null">
+				attachments_ = #{attachments},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="classGroupId != null">
+				class_group_id_ = #{classGroupId},
+			</if>
+			<if test="courseScheduleId != null">
+				course_schedule_id_ = #{courseScheduleId},
+			</if>
+			<if test="completedNum != null">
+				completed_num_ = #{completedNum},
+			</if>
+			<if test="groupType != null">
+				group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+			</if>
 
-		<if test="expectNum != null">
-			expect_num_ = #{expectNum},
-		</if>
-		<if test="updateTime != null">
-		update_time_ = NOW(),
-		</if>
-		<if test="content != null">
-		content_ = #{content},
-		</if>
-		<if test="musicGroupId != null">
-		music_group_id_ = #{musicGroupId},
-		</if>
-		<if test="createTime != null">
-		create_time_ = #{createTime},
-		</if>
-		<if test="expiryDate != null">
-			expiry_date_ = #{expiryDate},
-		</if>
-		</set> WHERE id_ = #{id}
+			<if test="expectNum != null">
+				expect_num_ = #{expectNum},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = NOW(),
+			</if>
+			<if test="content != null">
+				content_ = #{content},
+			</if>
+			<if test="musicGroupId != null">
+				music_group_id_ = #{musicGroupId},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+			<if test="expiryDate != null">
+				expiry_date_ = #{expiryDate},
+			</if>
+		</set>
+		WHERE id_ = #{id}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -164,7 +166,7 @@
 		<result property="completedNum" column="completed_num_"/>
 		<result property="courseScheduleName" column="course_schedule_name_"/>
 		<result property="totalClassTimes" column="total_class_times_"/>
-		<result property="currentClassTimes" column="current_class_times"/>
+		<result property="currentClassTimes" column="current_class_times_"/>
 		<result property="musicGroupId" column="music_group_id_"/>
 		<result property="musicGroupName" column="music_group_name_"/>
 		<result property="createTime" column="create_time_"/>
@@ -181,6 +183,7 @@
 			ch.completed_num_,
 			cs.name_ course_schedule_name_,
 			cg.total_class_times_,
+			cg.current_class_times_,
 			cg.music_group_id_,
 			mg.name_ music_group_name_
 		FROM

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

@@ -186,7 +186,8 @@
             <if test="organId != null">
                 FIND_IN_SET(su.organ_id_,#{organId})
             </if>
-        </where> <include refid="global.limit"/>) ue
+        </where>
+        ORDER BY su.create_time_ DESC <include refid="global.limit"/>) ue
         LEFT JOIN sys_user_role sur ON sur.user_id_ = ue.user_id_
         LEFT JOIN sys_role sr ON sr.id_ = sur.role_id_
         LEFT JOIN organization o ON FIND_IN_SET(o.id_,ue.organ_id_)
@@ -194,7 +195,6 @@
         <if test="search != null">
             AND (ue.real_name_ LIKE CONCAT('%',#{search},'%') OR ue.phone_ LIKE CONCAT('%',#{search},'%'))
         </if>
-        ORDER BY ue.create_time_ DESC
     </select>
 
     <select id="queryEmployByOrganIdCount" resultType="int">

+ 7 - 2
mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkReplyMapper.xml

@@ -86,6 +86,9 @@
             <if test="studentCourseHomeworkId != null">
                AND schr.student_course_homework_id_=#{studentCourseHomeworkId}
             </if>
+            <if test="userId!=null">
+                AND sch.user_id_=#{userId}
+            </if>
         </where>
     </sql>
 
@@ -100,8 +103,9 @@
             schr.content_ comment_content_,
             schr.create_time_ comment_time
         FROM
-        student_course_homework_reply schr
-        LEFT JOIN sys_user suc ON schr.user_id_=suc.id_
+            student_course_homework_reply schr
+            LEFT JOIN sys_user suc ON schr.user_id_=suc.id_
+            LEFT JOIN student_course_homework sch ON schr.student_course_homework_id_=sch.id_
         <include refid="queryCondition"/>
         ORDER BY schr.id_ DESC
         <include refid="global.limit"/>
@@ -110,6 +114,7 @@
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM student_course_homework_reply schr
+        LEFT JOIN student_course_homework sch ON schr.student_course_homework_id_=sch.id_
 		<include refid="queryCondition"/>
 	</select>
     <select id="findAllReplyByStudentCourseHomeworkID" resultMap="StudentCourseHomeworkReply">

+ 1 - 2
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -239,7 +239,6 @@
 
     <sql id="studentManageAttendanceQueryCondition">
         <where>
-            CONCAT(cs.class_date_," ",cs.start_class_time_) &lt; NOW()
             <if test="studentId!=null">
                 and sa.user_id_=#{studentId}
             </if>
@@ -421,7 +420,7 @@
         SELECT COUNT(sr.user_id_) FROM student_registration sr
         LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
         WHERE sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_ != 'QUIT'
-        AND sr.create_time_ > mg.payment_expire_date_
+        AND DATE_FORMAT(sr.create_time_,'%Y-%m-%d') > DATE_FORMAT(mg.payment_expire_date_,'%Y-%m-%d')
     </select>
 
     <resultMap id="MusicGroupStudentSignDto" type="com.ym.mec.biz.dal.dto.MusicGroupStudentSignDto">