cy 3 anos atrás
pai
commit
60a9f8d41b

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseRepliedServiceImpl.java

@@ -77,7 +77,7 @@ public class CourseRepliedServiceImpl extends ServiceImpl<CourseScheduleRepliedD
         }
 
         //当前用户为老师
-        if (userId == courseSchedule.getTeacherId()) {
+        if (userId.equals(courseSchedule.getTeacherId())) {
             if (studentId == null) {
                 throw new RuntimeException("评价的学生id不能为空");
             }

+ 5 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -1883,7 +1883,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
         //计算课时
         List<CourseScheduleStudentPayment> studentPaymentList = paymentDao.selectList(Wrappers.<CourseScheduleStudentPayment>lambdaQuery().eq(CourseScheduleStudentPayment::getCourseId, courseId));
-        int time = studentPaymentList.size() * schedule.getSingleCourseTime();
+
+        String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
+        Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentPaymentList.size() + 1));//人数计算 公式n*(n-1) n包含老师
+        Integer time = schedule.getSingleCourseTime() * n;//消耗时长 课程数*单课时长*人数
+
         PianoRoomTime pianoRoomTime = pianoRoomTimeDao.selectOne(Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, teacherId));
         if (pianoRoomTime == null) {
             throw new BizException("未查到剩余时长");