|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.COMM;
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.MUSIC;
|
|
|
import static com.ym.mec.biz.dal.enums.GroupType.PRACTICE;
|
|
@@ -27,7 +28,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.service.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -39,24 +42,6 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
-import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
|
|
|
-import com.ym.mec.biz.dal.dto.ClassGroupImGroupDto;
|
|
|
-import com.ym.mec.biz.dal.dto.ClassGroupTeacherMapDto;
|
|
|
-import com.ym.mec.biz.dal.dto.ClassGroupTeachersDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseListDto;
|
|
|
-import com.ym.mec.biz.dal.dto.CourseTimeDto;
|
|
|
-import com.ym.mec.biz.dal.dto.HighClassGroupDto;
|
|
|
-import com.ym.mec.biz.dal.dto.MusicGroupClassGroupDto;
|
|
|
-import com.ym.mec.biz.dal.dto.MusicGroupCourseScheduleDto;
|
|
|
-import com.ym.mec.biz.dal.dto.RemainCourseTypeDurationDto;
|
|
|
-import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
|
|
|
-import com.ym.mec.biz.dal.dto.StudentPayInfoDto;
|
|
|
-import com.ym.mec.biz.dal.dto.SuperClassGroupDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherClassGroupDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherClassHeadInfo;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
|
|
|
-import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
|
|
|
-import com.ym.mec.biz.dal.dto.UserMusicGroupQueryInfo;
|
|
|
import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
|
|
@@ -76,17 +61,6 @@ import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.TeacherMusicClassQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.VipClassQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.queryMusicGroupCourseScheduleQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ClassGroupRelationService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupService;
|
|
|
-import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
|
|
|
-import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
-import com.ym.mec.biz.service.SubjectService;
|
|
|
-import com.ym.mec.biz.service.SysConfigService;
|
|
|
-import com.ym.mec.biz.service.TeacherDefaultMusicGroupSalaryService;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
@@ -183,9 +157,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
|
|
|
@Autowired
|
|
|
- private MusicGroupOrganizationCourseSettingsDetailDao musicGroupOrganizationCourseSettingsDetailDao;
|
|
|
+ private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, ClassGroup> getDAO() {
|
|
@@ -1790,6 +1766,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
//创建IM群组
|
|
|
addImGroup(classGroup, userIds);
|
|
|
|
|
|
+
|
|
|
Map<String, Integer> courseTypeMinutesMap = musicGroupPaymentCalenderCourseSettingsService.getMusicCourseSettingsWithStudents(musicGroupId, studentIdList);
|
|
|
|
|
|
//计算每节课的课酬
|
|
@@ -1799,6 +1776,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
|
|
|
+ if(classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0){
|
|
|
+ break;
|
|
|
+ }
|
|
|
//5、插入班级排课信息
|
|
|
LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
|
|
|
|
|
@@ -1978,14 +1958,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //检测新排课冲突
|
|
|
- courseScheduleService.checkNewCourseSchedules(courseScheduleList, false);
|
|
|
+ if(courseScheduleList.size() > 0){
|
|
|
+ //检测新排课冲突
|
|
|
+ courseScheduleService.checkNewCourseSchedules(courseScheduleList, false);
|
|
|
+ }
|
|
|
+
|
|
|
//老师结算表
|
|
|
if (courseScheduleTeacherSalaryList.size() > 0) {
|
|
|
courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
|
|
|
}
|
|
|
//学生结算表
|
|
|
- if (!CollectionUtils.isEmpty(studentIdList)) {
|
|
|
+ if (courseScheduleList.size() > 0) {
|
|
|
courseScheduleStudentPaymentService.createForMusicGroup(musicGroupId, courseScheduleList, studentIdList);
|
|
|
}
|
|
|
return classGroup;
|
|
@@ -3256,7 +3239,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
|
|
|
//获取所选班级最大剩余课时
|
|
|
Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
|
|
|
- //获取每个班级对应课程类型最后一节课
|
|
|
+ //获取分布默认的课程类型单价
|
|
|
+ MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
|
|
|
+ Map<String,BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(),musicGroup.getOrganId()));
|
|
|
Set<String> courseTypes = map.keySet();
|
|
|
for (Integer classGroupId : classGroupIds) {
|
|
|
Map<String,MusicGroupOrganizationCourseSettingsDetail> courseMap = new HashMap<>();
|
|
@@ -3274,15 +3259,69 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
}
|
|
|
Long subNum = maxNum - currentNum;
|
|
|
//生成缴费项目
|
|
|
- MusicGroupOrganizationCourseSettingsDetail settingsDetail = musicGroupOrganizationCourseSettingsDetailDao.getClassLastSetting(classGroupId,courseType);
|
|
|
+// MusicGroupOrganizationCourseSettingsDetail settingsDetail = musicGroupOrganizationCourseSettingsDetailDao.getClassLastSetting(classGroupId,courseType);
|
|
|
+ MusicGroupOrganizationCourseSettingsDetail settingsDetail = new MusicGroupOrganizationCourseSettingsDetail();
|
|
|
+ BigDecimal unitPrice = unitPriceMap.get(courseType);
|
|
|
+ if(unitPrice == null){
|
|
|
+ throw new BizException("分部默认课程类型单价不存在,请设置");
|
|
|
+ }
|
|
|
settingsDetail.setCourseType(CourseScheduleType.valueOf(courseType));
|
|
|
settingsDetail.setCourseTotalMinuties(Integer.parseInt(jsonObject.get(courseType).toString()) * subNum.intValue());
|
|
|
- settingsDetail.setCourseCurrentPrice(settingsDetail.getCourseCurrentPrice().multiply(new BigDecimal(subNum)));
|
|
|
- settingsDetail.setCourseOriginalPrice(settingsDetail.getCourseOriginalPrice().multiply(new BigDecimal(subNum)));
|
|
|
+ settingsDetail.setCourseCurrentPrice(unitPrice.multiply(new BigDecimal(subNum)).multiply(new BigDecimal(settingsDetail.getCourseTotalMinuties())));
|
|
|
+ settingsDetail.setCourseOriginalPrice(settingsDetail.getCourseCurrentPrice());
|
|
|
courseMap.put(courseType,settingsDetail);
|
|
|
}
|
|
|
resultMap.put(classGroupId,courseMap);
|
|
|
}
|
|
|
return resultMap;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Object mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
|
|
|
+ List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
|
|
|
+ if(classGroupIds == null || classGroupIds.size() == 0){
|
|
|
+ throw new BizException("参数校验失败");
|
|
|
+ }
|
|
|
+ MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
|
|
|
+ //生成缴费记录
|
|
|
+ List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
|
|
|
+ if(paymentCalenderDtos != null && paymentCalenderDtos.size() > 0){
|
|
|
+ MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
|
|
|
+ for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
+ if(status != null && status != AUDITING){
|
|
|
+ List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
|
|
|
+ for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
|
|
|
+ OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
|
|
|
+ musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
|
|
|
+ if (defaultUnitPrice == null) {
|
|
|
+ throw new BizException("请先设置分部课程类型单价");
|
|
|
+ }
|
|
|
+ if (courseSettings.getCourseCurrentPrice()
|
|
|
+ .divide(new BigDecimal(courseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN)
|
|
|
+ .compareTo(defaultUnitPrice.getUnitPrice()) != 0) {
|
|
|
+ status = AUDITING;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
|
|
|
+ if(status != null && status == AUDITING){
|
|
|
+ calenderDto.setStatus(AUDITING);
|
|
|
+ }
|
|
|
+ musicGroupPaymentCalenderService.create(calenderDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新增班级
|
|
|
+ List<ClassGroup4MixDto> classGroup4MixDtos = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos();
|
|
|
+ if(CollectionUtils.isEmpty(classGroup4MixDtos)){
|
|
|
+ throw new BizException("请填写班级信息");
|
|
|
+ }
|
|
|
+ classGroupService.classGroupAdjust(classGroup4MixDtos);
|
|
|
+ //冻结所选班级的课程
|
|
|
+ courseScheduleDao.batchUpdateLockByClassGroupIds(classGroupIds,1);
|
|
|
+ //保存学员应该增加的课程时长
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|