|
@@ -17,6 +17,7 @@ import com.ym.mec.im.ImFeignService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Isolation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
@@ -169,7 +170,7 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public CourseScheduleReview addPracticeGroupReview(CourseScheduleReview courseScheduleReview) {
|
|
|
Integer courseScheduleId = courseScheduleReview.getCourseScheduleId();
|
|
|
if (courseScheduleId == null || courseScheduleId <= 0) {
|
|
@@ -207,16 +208,22 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
|
|
|
if (StringUtils.isNotBlank(courseScheduleReview.getHomeWork()) && Objects.isNull(existHomework)) {
|
|
|
//新增课堂作业
|
|
|
CourseHomework courseHomework = new CourseHomework();
|
|
|
- courseHomework.setContent(courseScheduleReview.getHomeWork());
|
|
|
- courseHomework.setCourseScheduleId(courseSchedule.getId());
|
|
|
- courseHomework.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
- courseHomework.setGroupType(courseSchedule.getGroupType());
|
|
|
- courseHomework.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
- courseHomework.setExpiryDate(DateUtil.addDays(date, 7));
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseSchedule.getId());
|
|
|
|
|
|
- courseHomework.setExpectNum(CollectionUtils.isEmpty(courseScheduleStudentPayments) ? 0 : courseScheduleStudentPayments.size());
|
|
|
- courseHomeworkService.insert(courseHomework);
|
|
|
+ if(Objects.nonNull(existHomework)){
|
|
|
+ existHomework.setContent(courseScheduleReview.getHomeWork());
|
|
|
+ existHomework.setExpiryDate(DateUtil.addDays(date, 7));
|
|
|
+ courseHomeworkService.insert(existHomework);
|
|
|
+ }else{
|
|
|
+ courseHomework.setContent(courseScheduleReview.getHomeWork());
|
|
|
+ courseHomework.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseHomework.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
+ courseHomework.setGroupType(courseSchedule.getGroupType());
|
|
|
+ courseHomework.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
+ courseHomework.setExpiryDate(DateUtil.addDays(date, 7));
|
|
|
+ courseHomework.setExpectNum(CollectionUtils.isEmpty(courseScheduleStudentPayments) ? 0 : courseScheduleStudentPayments.size());
|
|
|
+ courseHomeworkService.insert(courseHomework);
|
|
|
+ }
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(courseScheduleStudentPayments)) {
|
|
|
// List<StudentCourseHomework> studentCourseHomeworks = new ArrayList<>();
|
|
@@ -224,15 +231,19 @@ public class CourseReviewServiceImpl extends BaseServiceImpl<Integer, CourseSche
|
|
|
String dateStr = DateUtil.dateToString(DateUtil.addDays(date, 1), "MM月dd日");
|
|
|
for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
|
|
|
StudentCourseHomework studentCourseHomework = new StudentCourseHomework();
|
|
|
- studentCourseHomework.setCourseHomeworkId(courseHomework.getId());
|
|
|
- studentCourseHomework.setUserId(courseScheduleStudentPayment.getUserId());
|
|
|
- studentCourseHomework.setCourseScheduleId(courseSchedule.getId());
|
|
|
- studentCourseHomework.setCreateTime(date);
|
|
|
- studentCourseHomework.setUpdateTime(date);
|
|
|
- studentCourseHomework.setStatus(YesOrNoEnum.NO);
|
|
|
- studentCourseHomework.setIsView(YesOrNoEnum.NO);
|
|
|
- studentCourseHomework.setIsReplied(YesOrNoEnum.NO);
|
|
|
- studentCourseHomeworkDao.insert(studentCourseHomework);
|
|
|
+ if(Objects.isNull(existHomework)){
|
|
|
+ studentCourseHomework.setCourseHomeworkId(courseHomework.getId());
|
|
|
+ studentCourseHomework.setUserId(courseScheduleStudentPayment.getUserId());
|
|
|
+ studentCourseHomework.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ studentCourseHomework.setCreateTime(date);
|
|
|
+ studentCourseHomework.setUpdateTime(date);
|
|
|
+ studentCourseHomework.setStatus(YesOrNoEnum.NO);
|
|
|
+ studentCourseHomework.setIsView(YesOrNoEnum.NO);
|
|
|
+ studentCourseHomework.setIsReplied(YesOrNoEnum.NO);
|
|
|
+ studentCourseHomeworkDao.insert(studentCourseHomework);
|
|
|
+ }else{
|
|
|
+ studentCourseHomework = studentCourseHomeworkDao.findByStudentAndCourseHomewok(existHomework.getId(), courseScheduleStudentPayment.getUserId());
|
|
|
+ }
|
|
|
|
|
|
Map<Integer, String> userMap = new HashMap<>();
|
|
|
userMap.put(courseScheduleStudentPayment.getUserId(), courseScheduleStudentPayment.getUserId().toString());
|