Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

周箭河 5 лет назад
Родитель
Сommit
55c7cc2202

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

@@ -170,9 +170,11 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
             courseHomework.setGroupType(courseSchedule.getGroupType());
             courseHomework.setClassGroupId(courseSchedule.getClassGroupId());
             courseHomework.setExpiryDate(DateUtil.addDays(date,7));
-            courseHomework.setExpectNum(courseScheduleDao.countCourseStudentNum(courseSchedule.getId()));
-            courseHomeworkService.insert(courseHomework);
             List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseSchedule.getId());
+
+            courseHomework.setExpectNum(CollectionUtils.isEmpty(courseScheduleStudentPayments)?0:courseScheduleStudentPayments.size());
+            courseHomeworkService.insert(courseHomework);
+
             if(!CollectionUtils.isEmpty(courseScheduleStudentPayments)){
                 List<StudentCourseHomework> studentCourseHomeworks=new ArrayList<>();
                 for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
@@ -235,6 +237,15 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
             throw new BizException("评论不存在");
         }
         courseScheduleReviewDao.update(courseScheduleReview);
+
+        if(StringUtils.isNotBlank(courseScheduleReview.getHomeWork())){
+            CourseHomework homework = courseHomeworkDao.findByCourseSchedule(courseScheduleReview.getCourseScheduleId().longValue());
+            if(!homework.getContent().equals(courseScheduleReview.getHomeWork())){
+                homework.setContent(courseScheduleReview.getHomeWork());
+                courseHomeworkDao.update(homework);
+            }
+        }
+
         return courseScheduleReview;
     }
 }

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

@@ -90,21 +90,16 @@
 			<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>
+			update_time_ = NOW()
 		</set>
 		WHERE id_ = #{id}
 	</update>