瀏覽代碼

1、添加教务老师字段
2、布置作业

Joburgess 5 年之前
父節點
當前提交
f85ea02479

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

@@ -1682,7 +1682,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         StringBuffer errInfo = new StringBuffer("在");
         errInfo.append(DateUtil.dateToString(courseSchedules.get(1).getStartClassTime(), "yyyy-MM-dd HH:mm"));
         errInfo.append("至");
-        errInfo.append(DateUtil.dateToString(courseSchedules.get(0).getEndClassTime().before(courseSchedules.get(1).getEndClassTime())?courseSchedules.get(0).getEndClassTime():courseSchedules.get(1).getEndClassTime(), "yyyy-MM-dd HH:mm"));
+        errInfo.append(DateUtil.dateToString(courseSchedules.get(0).getEndClassTime().before(courseSchedules.get(1).getEndClassTime())?courseSchedules.get(0).getEndClassTime():courseSchedules.get(1).getEndClassTime(), "HH:mm"));
         errInfo.append("的时间段内");
         errInfo.append("安排的课程存在冲突,");
         errInfo.append("冲突课程为:");

+ 23 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CoursesGroupServiceImpl.java

@@ -124,7 +124,12 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
         //总课程时长
         Integer totalCourseTime=courseCycleInfo.getCourseCount()*courseCycleInfo.getSingleClassMinutes();
 
-        sysTenantAccountService.update(courseGroup.getTeacherId(), -totalCourseTime, "", SysTenantAccountDetail.TransType.CONSUME, "",BigDecimal.ZERO,"课程组创建");
+        try {
+            sysTenantAccountService.update(courseGroup.getTeacherId(), -totalCourseTime, "", SysTenantAccountDetail.TransType.CONSUME, "",BigDecimal.ZERO,"课程组创建");
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            return BaseController.failed("余额不足,请充值。");
+        }
 
         Teacher teacher = teacherDao.get(courseGroup.getTeacherId());
 
@@ -148,7 +153,14 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             String errMessage;
-            errMessage="抱歉啦,当前所选时段组合,「" + teacher.getRealName() + "」老师已被预约,请重新选择时段或更换老师后重试。";
+            String courseName=e.getMessage().substring(e.getMessage().indexOf(")-")+2);
+            courseName = courseName.substring(0,courseName.indexOf("("));
+            String courseTime = e.getMessage().substring(e.getMessage().indexOf("在") + 1);
+            courseTime = courseTime.substring(0, courseTime.indexOf("的时间段内"));
+            errMessage="现在课程:xxx";
+            errMessage+=courseName;
+            errMessage+="<br/>冲突时间:";
+            errMessage+=courseTime;
             return BaseController.failed(HttpStatus.FOUND, errMessage);
         }
 
@@ -367,18 +379,18 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
             throw new BizException("此课程组不存在");
         }
         if(coursesGroup.getStatus().equals(GroupStatusEnum.CANCEL)){
-            throw new BizException("无法加入,此课程已关闭");
+            throw new BizException("课程已关闭,请联系老师了解详细情况。");
         }
         List<ClassGroupStudentMapper> groupStudents = classGroupStudentMapperDao.findGroupStudents(courseGroupId.toString(), GroupType.COMM, userId, null);
         if(!CollectionUtils.isEmpty(groupStudents)){
-            throw new BizException("无法重复加入,您已在此课程组");
+            throw new BizException("您完成此课程组报名,无需重复报名。");
         }
 
         Date now=new Date();
 
         ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(courseGroupId.toString(), GroupType.COMM.getCode());
         if(classGroup.getStudentNum()>=classGroup.getExpectStudentNum()){
-            throw new BizException("无法加入,此课程组人数已达上限");
+            throw new BizException("课程人数已满");
         }
 
         BigDecimal amount = coursesGroup.getTotalCoursesPrice();
@@ -589,7 +601,7 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
         List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
         List<CourseSchedule> groupNotStartCourses = courseScheduleDao.findGroupNotStartCourses(order.getMusicGroupId(), GroupType.COMM);
         if(CollectionUtils.isEmpty(groupNotStartCourses)){
-            throw new BizException("无法加入,此课程已关闭");
+            throw new BizException("课程已关闭,请联系老师了解详细情况。");
         }
         BigDecimal singleCoursePrice = order.getExpectAmount().divide(new BigDecimal(groupNotStartCourses.size()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
         for (CourseSchedule courseSchedule : groupNotStartCourses) {
@@ -613,9 +625,12 @@ public class CoursesGroupServiceImpl extends BaseServiceImpl<Long, CoursesGroup>
 
             String courseName=e.getMessage().substring(e.getMessage().indexOf(")-")+2);
             courseName = courseName.substring(0,courseName.indexOf("("));
-            errMessage="抱歉啦,当前所选时段组合,与您现有课程「";
+            String courseTime = e.getMessage().substring(e.getMessage().indexOf("在") + 1);
+            courseTime = courseTime.substring(0, courseTime.indexOf("的时间段内"));
+            errMessage="现在课程:xxx";
             errMessage+=courseName;
-            errMessage+="」时段冲突,请选择其他时段重试。";
+            errMessage+="<br/>冲突时间:";
+            errMessage+=courseTime;
 
             return BaseController.failed(HttpStatus.FOUND, errMessage);
         }