|
@@ -44,6 +44,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.script.ScriptEngine;
|
|
|
+import javax.script.ScriptEngineManager;
|
|
|
+import javax.script.ScriptException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -1527,7 +1530,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
List<CourseScheduleStudentVo> userList = paymentDao.selectUser();
|
|
|
if (CollectionUtils.isNotEmpty(userList)) {
|
|
|
List<CourseScheduleStudentVo> practiceList = userList.stream().filter(s -> s.getType().equals(CourseScheduleEnum.PRACTICE.getCode())).collect(Collectors.toList());
|
|
|
- if(CollectionUtils.isNotEmpty(practiceList)){//添加陪练课评论
|
|
|
+ if (CollectionUtils.isNotEmpty(practiceList)) {//添加陪练课评论
|
|
|
repliedDao.insertBatch(practiceList);
|
|
|
}
|
|
|
|
|
@@ -1542,11 +1545,20 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
List<CourseScheduleRecord> recordList = recordDao.sumCourseTime();
|
|
|
if (CollectionUtils.isNotEmpty(recordList)) {
|
|
|
//时长消费记录
|
|
|
- recordDao.insertBatch(recordList);
|
|
|
+ String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
|
|
|
+ List<CourseScheduleRecord> records = recordList.stream()
|
|
|
+ .map(s -> {
|
|
|
+ Integer studentCount = s.getStudentCount();
|
|
|
+ Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentCount + 1));
|
|
|
+ s.setConsumTime(s.getSingleCourseTime() * n);
|
|
|
+ return s;
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ recordDao.insertBatch(records);
|
|
|
|
|
|
//释放冻结课时
|
|
|
List<PianoRoomTime> roomTimeList = new ArrayList<>();
|
|
|
- Map<Long, List<CourseScheduleRecord>> collect = recordList.stream().collect(Collectors.groupingBy(CourseScheduleRecord::getTeacherId, Collectors.toList()));
|
|
|
+ Map<Long, List<CourseScheduleRecord>> collect = records.stream().collect(Collectors.groupingBy(CourseScheduleRecord::getTeacherId, Collectors.toList()));
|
|
|
collect.forEach((key, list) -> {
|
|
|
PianoRoomTime pianoRoomTime = pianoRoomTimeDao.selectOne(Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, key));
|
|
|
Integer frozenTime = pianoRoomTime.getFrozenTime();
|
|
@@ -1651,7 +1663,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Integer classNum = arrangeCourseVo.getClassNum();//课时数
|
|
|
Integer singleClssTime = arrangeCourseVo.getSingleClssTime();//单课时长
|
|
|
List<Long> studentIds = arrangeCourseVo.getStudentIds();//学员id集合
|
|
|
- Integer consumTime = classNum * singleClssTime * studentIds.size();//消耗时长
|
|
|
+
|
|
|
+ String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
|
|
|
+ Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentIds.size() + 1));//人数计算 公式n*(n-1) n包含老师
|
|
|
+ Integer consumTime = classNum * singleClssTime * n;//消耗时长 课程数*单课时长*人数
|
|
|
+
|
|
|
List<CourseTimeEntity> timeList = arrangeCourseVo.getTimeList();//选课时间
|
|
|
Integer consumeTime = arrangeCourseVo.getConsumeTime();
|
|
|
|