|
@@ -143,6 +143,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
private StudentService studentService;
|
|
|
@Autowired
|
|
|
private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
|
|
|
+ @Autowired
|
|
|
+ private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
|
|
|
+ @Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
+ @Autowired
|
|
|
+ private ImGroupMemberService imGroupMemberService;
|
|
|
|
|
|
private static Map<Integer, Map<Integer, List<Integer>>> schoolSubjectTeachersMap;
|
|
|
|
|
@@ -3696,6 +3702,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
return;
|
|
|
}
|
|
|
PracticeGroup practiceGroup = practiceGroupDao.get(Long.valueOf(order.getMusicGroupId()));
|
|
|
+ ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(order.getMusicGroupId(), GroupType.PRACTICE.getCode());
|
|
|
if (order.getStatus().equals(DealStatusEnum.SUCCESS)) {
|
|
|
Integer activityUserMapperId = studentPaymentOrderService.activityGive(practiceGroup.getVipGroupActivityId(),
|
|
|
order.getUserId(),
|
|
@@ -3703,6 +3710,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
null,
|
|
|
practiceGroup.getId(),order.getActivityBuyNum());
|
|
|
practiceGroup.setActivityUserMapperId(activityUserMapperId);
|
|
|
+ if(classGroup.getDelFlag() == 1){
|
|
|
+ updatePracticeGroupStudentNumAndStatus(practiceGroup, classGroup);
|
|
|
+ }
|
|
|
courseScheduleDao.updateGroupCourseLock(order.getMusicGroupId(), GroupType.PRACTICE, 0);
|
|
|
} else {
|
|
|
if (Objects.nonNull(order.getBalancePaymentAmount()) && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
@@ -3760,7 +3770,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
sysCouponCodeService.quit(order.getCouponCodeId());
|
|
|
return;
|
|
|
}
|
|
|
- ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(order.getMusicGroupId(), GroupType.PRACTICE.getCode());
|
|
|
|
|
|
practiceGroup.setGroupStatus(GroupStatusEnum.NORMAL);
|
|
|
practiceGroupDao.update(practiceGroup);
|
|
@@ -3842,6 +3851,96 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
imUserFriendService.refreshGroupImUserFriend(practiceGroup.getId().toString(),GroupType.PRACTICE);
|
|
|
}
|
|
|
|
|
|
+ private void updatePracticeGroupStudentNumAndStatus(PracticeGroup practiceGroup, ClassGroup classGroup) {
|
|
|
+ classGroup.setStudentNum(1);
|
|
|
+ classGroup.setDelFlag(0);
|
|
|
+ classGroupDao.update(classGroup);
|
|
|
+
|
|
|
+ List<CourseSchedule> courseSchedules = JSON.parseArray(practiceGroup.getCourseScheduleJson(),CourseSchedule.class);
|
|
|
+ int courseNum = courseScheduleDao.countVipGroupCourses(practiceGroup.getId().intValue(),"PRACTICE");
|
|
|
+ if(courseNum == 0){
|
|
|
+ courseScheduleService.batchAddCourseSchedule(courseSchedules);
|
|
|
+ }
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapper.setGroupType(GroupType.PRACTICE);
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapper.setMusicGroupId(practiceGroup.getId().toString());
|
|
|
+ classGroupStudentMapper.setUserId(practiceGroup.getStudentId());
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
+ courseSchedules.forEach(e->{
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
+ courseScheduleStudentPayment.setGroupType(GroupType.PRACTICE);
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(practiceGroup.getId().toString());
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(e.getId());
|
|
|
+ courseScheduleStudentPayment.setUserId(practiceGroup.getStudentId());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(BigDecimal.ZERO);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(BigDecimal.ZERO);
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(BigDecimal.ZERO);
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
+ });
|
|
|
+ for (CourseSchedule courseSchedule : courseSchedules) {
|
|
|
+ //课程与老师薪水表
|
|
|
+ CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
+ courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseScheduleTeacherSalary.setGroupType(GroupType.PRACTICE);
|
|
|
+ courseScheduleTeacherSalary.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
+ courseScheduleTeacherSalary.setTeacherRole(classGroupTeacherMapper.getTeacherRole());
|
|
|
+ courseScheduleTeacherSalary.setUserId(practiceGroupBuyParams.getUserId());
|
|
|
+ courseScheduleTeacherSalary.setExpectSalary(teacherDefaultSalary);
|
|
|
+ courseScheduleTeacherSalary.setCreateTime(now);
|
|
|
+ courseScheduleTeacherSalary.setUpdateTime(now);
|
|
|
+ courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
+ courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
+
|
|
|
+ //学生缴费记录
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
+ courseScheduleStudentPayment.setGroupType(GroupType.PRACTICE);
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(studentSingleCourseCost);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(studentSingleCourseOriginalCost);
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
+ courseScheduleStudentPayment.setCreateTime(now);
|
|
|
+ courseScheduleStudentPayment.setUpdateTime(now);
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
+
|
|
|
+ //教师签到记录
|
|
|
+ TeacherAttendance teacherAttendance = new TeacherAttendance();
|
|
|
+ teacherAttendance.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
+ teacherAttendance.setTeacherId(practiceGroupBuyParams.getUserId());
|
|
|
+ teacherAttendance.setClassGroupId(classGroup.getId());
|
|
|
+ teacherAttendance.setGroupType(GroupType.PRACTICE);
|
|
|
+ teacherAttendance.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ teacherAttendance.setCreateTime(now);
|
|
|
+ teacherAttendances.add(teacherAttendance);
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
+ courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
+ teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
+
|
|
|
+ courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForPracticeGroup(practiceGroup.getId(),classGroupStudentMapper.getUserId());
|
|
|
+ studentDao.updateStudentServiceTag(classGroupStudentMapper.getUserId(), null, YesOrNoEnum.YES.getCode());
|
|
|
+
|
|
|
+ Map<Integer,String> userRoleMap = new HashMap<Integer, String>();
|
|
|
+ userRoleMap.put(classGroupStudentMapper.getUserId(),null);
|
|
|
+ if(Objects.nonNull(practiceGroup.getEducationalTeacherId())){
|
|
|
+ userRoleMap.put(practiceGroup.getEducationalTeacherId(),"乐团主管");
|
|
|
+ }
|
|
|
+ userRoleMap.put(practiceGroup.getUserId(),"指导老师");
|
|
|
+ try {
|
|
|
+ imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), practiceGroup.getName(), null, null, GroupType.VIP.getCode());
|
|
|
+ imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(),classGroup.getGroupType());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
public void activityOrderCallback(StudentPaymentOrder studentPaymentOrder) {
|
|
@@ -4120,18 +4219,21 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if(Objects.nonNull(practiceGroup.getType())&&(PracticeGroupType.CARE_PACKAGE.equals(practiceGroup.getType())||PracticeGroupType.COME_ON_PACKAGE.equals(practiceGroup.getType()))){
|
|
|
practiceCourseMinutes = 50;
|
|
|
}
|
|
|
- JSONArray coursesArry = new JSONArray();
|
|
|
- JSONObject courseJson = JSON.parseObject(practiceGroup.getDrillTimesJson());
|
|
|
- for (String weekNumStr : courseJson.keySet()) {
|
|
|
- JSONObject newCourseJson = new JSONObject();
|
|
|
- newCourseJson.put("weekName", DateUtil.weekNumNormalWeekNameMap.get(Integer.parseInt(weekNumStr)));
|
|
|
- LocalTime courseStartTime = LocalTime.parse(courseJson.getString(weekNumStr), DateUtil.timeFormatter);
|
|
|
- LocalTime courseEndTime = courseStartTime.plusMinutes(practiceCourseMinutes);
|
|
|
- newCourseJson.put("startTime", courseStartTime.format(DateUtil.timeFormatter));
|
|
|
- newCourseJson.put("endTime", courseEndTime.format(DateUtil.timeFormatter));
|
|
|
- coursesArry.add(newCourseJson);
|
|
|
- }
|
|
|
- practiceBuyResult.setDrillTimesJson(coursesArry.toJSONString());
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(practiceGroup.getDrillTimesJson())){
|
|
|
+ JSONArray coursesArry = new JSONArray();
|
|
|
+ JSONObject courseJson = JSON.parseObject(practiceGroup.getDrillTimesJson());
|
|
|
+ for (String weekNumStr : courseJson.keySet()) {
|
|
|
+ JSONObject newCourseJson = new JSONObject();
|
|
|
+ newCourseJson.put("weekName", DateUtil.weekNumNormalWeekNameMap.get(Integer.parseInt(weekNumStr)));
|
|
|
+ LocalTime courseStartTime = LocalTime.parse(courseJson.getString(weekNumStr), DateUtil.timeFormatter);
|
|
|
+ LocalTime courseEndTime = courseStartTime.plusMinutes(practiceCourseMinutes);
|
|
|
+ newCourseJson.put("startTime", courseStartTime.format(DateUtil.timeFormatter));
|
|
|
+ newCourseJson.put("endTime", courseEndTime.format(DateUtil.timeFormatter));
|
|
|
+ coursesArry.add(newCourseJson);
|
|
|
+ }
|
|
|
+ practiceBuyResult.setDrillTimesJson(coursesArry.toJSONString());
|
|
|
+ }
|
|
|
practiceBuyResult.setCourseStartTime(practiceGroup.getCoursesStartDate());
|
|
|
practiceBuyResult.setCourseEndTime(practiceGroup.getCoursesExpireDate());
|
|
|
Teacher teacher = teacherDao.get(practiceGroup.getUserId());
|
|
@@ -4685,7 +4787,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
classGroupDao.insert(classGroup);
|
|
|
|
|
|
//创建班级老师关联记录
|
|
|
- ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper();
|
|
|
+ ClassGroupTeacherMapper classGroupTeacherMapper = new ClassGroupTeacherMapper();
|
|
|
classGroupTeacherMapper.setMusicGroupId(applyBaseInfoDto.getId().toString());
|
|
|
classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
|