|
@@ -26,6 +26,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+import com.ym.mec.util.date.DateConvertor;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.string.MessageFormatter;
|
|
|
|
|
@@ -43,18 +44,23 @@ import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
+import static com.ym.mec.biz.dal.enums.GroupType.MUSIC;
|
|
|
+import static com.ym.mec.biz.dal.enums.GroupType.VIP;
|
|
|
+
|
|
|
@Service
|
|
|
public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService {
|
|
|
|
|
@@ -157,6 +163,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
@Autowired
|
|
|
private VipGroupStudentCoursePriceDao vipGroupStudentCoursePriceDao;
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(VipGroup.class);
|
|
@@ -471,6 +479,592 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
+ public HttpResponseResult createActivityVipGroup(VipGroupApplyDto vipGroup) {
|
|
|
+ if (Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getUserId())){
|
|
|
+ throw new BizException("请选择指导老师");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(vipGroup.getCourseSchedules().size()!=(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()+vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())){
|
|
|
+ throw new BizException("建课失败,当前课程存在未排课课程,请调整相关设置");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroup;
|
|
|
+ try {
|
|
|
+ courseScheduleGroup = vipGroup.getCourseSchedules().stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("教学模式错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(vipGroup.getVipGroupApplyBaseInfo().getSubjectIdList())){
|
|
|
+ throw new BizException("请选择声部");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ List<VipGroupCategory> vipGroupCategories = vipGroupCategoryDao.findAllByOrgan(vipGroup.getVipGroupApplyBaseInfo().getOrganId().toString());
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategories.stream().filter(v -> v.getName().equals("1v2")).findFirst().get();
|
|
|
+ vipGroup.getVipGroupApplyBaseInfo().setVipGroupCategoryId(vipGroupCategory.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if((Objects.isNull(courseScheduleGroup.get(TeachModeEnum.OFFLINE))&&vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()!=0)
|
|
|
+ ||(!Objects.isNull(courseScheduleGroup.get(TeachModeEnum.OFFLINE))&&(courseScheduleGroup.get(TeachModeEnum.OFFLINE).size()<vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()))){
|
|
|
+ throw new BizException("线下课课时数量安排有误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if((Objects.isNull(courseScheduleGroup.get(TeachModeEnum.ONLINE))&&vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum()!=0)
|
|
|
+ ||(!Objects.isNull(courseScheduleGroup.get(TeachModeEnum.ONLINE))&&(courseScheduleGroup.get(TeachModeEnum.ONLINE).size()<vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum()))){
|
|
|
+ throw new BizException("线上课课时数量安排有误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()>0
|
|
|
+ &&Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId())){
|
|
|
+ throw new BizException("请设置教学点");
|
|
|
+ }
|
|
|
+
|
|
|
+ String studentIds=vipGroup.getVipGroupApplyBaseInfo().getStudentIdList();
|
|
|
+ if(StringUtils.isBlank(studentIds)){
|
|
|
+ throw new BizException("请选择学员");
|
|
|
+ }
|
|
|
+ List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<Student> studentDetail = studentDao.lockStudents(studentIdList);
|
|
|
+ List<SimpleUserDto> studentSimpleInfos = teacherDao.getUsersSimpleInfo(studentIdList);
|
|
|
+ if(studentDetail.size()!=studentSimpleInfos.size()){
|
|
|
+ throw new BizException("学员信息错误");
|
|
|
+ }
|
|
|
+ Map<Integer, SimpleUserDto> idUserInfoMap = studentSimpleInfos.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s -> s, (s1, s2) -> s1));
|
|
|
+ Map<Integer, BigDecimal> studentTheoryPriceMap = new HashMap<>();
|
|
|
+ for (Student student : studentDetail) {
|
|
|
+ if(StringUtils.isEmpty(student.getActivityCourseDetail())){
|
|
|
+ SimpleUserDto studentInfo = idUserInfoMap.get(student.getUserId());
|
|
|
+ throw new BizException("{}暂无排课资格", studentInfo.getNickName());
|
|
|
+ }
|
|
|
+ JSONObject courseDetail = JSON.parseObject(student.getActivityCourseDetail());
|
|
|
+ Integer surplusTimes = courseDetail.getInteger(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType().getCode());
|
|
|
+ if(surplusTimes<=0){
|
|
|
+ SimpleUserDto studentInfo = idUserInfoMap.get(student.getUserId());
|
|
|
+ throw new BizException("{}暂无排课资格", studentInfo.getNickName());
|
|
|
+ }
|
|
|
+ courseDetail.fluentPut(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType().getCode(), surplusTimes-1);
|
|
|
+ student.setActivityCourseDetail(courseDetail.toJSONString());
|
|
|
+ if(ActivityCourseType.MUSIC_THEORY.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ studentTheoryPriceMap.put(student.getUserId(), courseDetail.getBigDecimal("music_theory_price"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ studentDao.batchUpdate(studentDetail);
|
|
|
+
|
|
|
+ Date now=new Date();
|
|
|
+
|
|
|
+ VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
|
|
|
+
|
|
|
+ if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
|
|
|
+ &&Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())){
|
|
|
+ throw new BizException("请设置课程单价");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
+ throw new BizException("请选择学员");
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer totalClassTimes=vipGroupApplyBaseInfoDto.getOnlineClassesNum()+vipGroupApplyBaseInfoDto.getOfflineClassesNum();
|
|
|
+ //获取第一节课
|
|
|
+ CourseSchedule firstCourseSchedule = vipGroup.getCourseSchedules().stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
|
|
|
+ //获取最后一节课
|
|
|
+ CourseSchedule latestCourseSchedule = vipGroup.getCourseSchedules().stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
|
|
|
+
|
|
|
+ if(firstCourseSchedule.getStartClassTime().before(now)){
|
|
|
+ throw new BizException("开课时间不能小于当前时间");
|
|
|
+ }
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setRegistrationStartTime(now);
|
|
|
+ vipGroupApplyBaseInfoDto.setPaymentExpireDate(now);
|
|
|
+
|
|
|
+ if(vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())){
|
|
|
+ throw new BizException("报名开始时间必须在报名截至时间之前");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Integer> canBuyStudentIds = Arrays.stream(vipGroupApplyBaseInfoDto.getStudentIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
+ List<VipGroupStudentCoursePrice> vscps = vipGroup.getVipGroupApplyBaseInfo().getVipGroupStudentCoursePrices();
|
|
|
+
|
|
|
+ //获取活动信息
|
|
|
+ VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId());
|
|
|
+// if(!vipGroup.getAllowOverstepActivityStudentNum()&&Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
+// List<String> tempStudentIds = Arrays.asList(vipGroupApplyBaseInfoDto.getStudentIdList().split(","));
|
|
|
+// List<Integer> errStudentIds = new ArrayList<>();
|
|
|
+// for (String studentIdStr : tempStudentIds) {
|
|
|
+// int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId(), Integer.valueOf(studentIdStr));
|
|
|
+// if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
|
|
|
+// errStudentIds.add(Integer.valueOf(studentIdStr));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(errStudentIds.size()>0){
|
|
|
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+// String studentNames = StringUtils.join(studentSimpleInfos.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
|
+// return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员创建及成课之和已达上限,是否继续创建该课程?");
|
|
|
+// }
|
|
|
+// }
|
|
|
+ //判断课程安排是否超出范围
|
|
|
+ if(Objects.nonNull(vipGroupActivity)&&(Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime()))){
|
|
|
+ if(latestCourseSchedule.getEndClassTime().after(vipGroupActivity.getCoursesEndTime())
|
|
|
+ ||firstCourseSchedule.getStartClassTime().before(vipGroupActivity.getCoursesStartTime())){
|
|
|
+ throw new BizException("课时安排时间超出范围!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ VipGroupDefaultClassesCycle vipGroupDefaultClassesCycle = vipGroupDefaultClassesCycleDao.findByOrganAndClassTimes(totalClassTimes);
|
|
|
+
|
|
|
+ if (vipGroupDefaultClassesCycle != null) {
|
|
|
+ int month = DateUtil.monthsBetween(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
+ if (month > vipGroupDefaultClassesCycle.getMonth()) {
|
|
|
+ throw new BizException("课时安排时间超出范围!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getMinCourseNum())&&vipGroupActivity.getMinCourseNum()!=-1&&Objects.nonNull(vipGroupActivity.getMaxCourseNum())&&vipGroupActivity.getMaxCourseNum()!=-1){
|
|
|
+ Integer requestCourseNum = vipGroupApplyBaseInfoDto.getOnlineClassesNum() + vipGroupApplyBaseInfoDto.getOfflineClassesNum();
|
|
|
+ if(requestCourseNum.compareTo(vipGroupActivity.getMinCourseNum())<0||requestCourseNum.compareTo(vipGroupActivity.getMaxCourseNum())>0){
|
|
|
+ throw new BizException("该活动课时数为{}节~{}节", vipGroupActivity.getMinCourseNum(), vipGroupActivity.getMaxCourseNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
+ if(repeatVipGroups>0){
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ throw new BizException("{}课程时间冲突({}-{})", sysUser.getRealName(), DateUtil.dateToString(firstCourseSchedule.getStartClassTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.dateToString(latestCourseSchedule.getEndClassTime(), "HH:mm:ss"));
|
|
|
+ }
|
|
|
+
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroupApplyBaseInfoDto.getVipGroupCategoryId());
|
|
|
+ if(Objects.isNull(vipGroupCategory)){
|
|
|
+ throw new BizException("课程形式不存在");
|
|
|
+ }
|
|
|
+ List<String> studentNames = studentDao.getStudentNames(canBuyStudentIds);
|
|
|
+
|
|
|
+ //生成vip课信息
|
|
|
+ List<String> bySubIds = subjectDao.findBySubIds(vipGroupApplyBaseInfoDto.getSubjectIdList());
|
|
|
+ StringBuffer className=new StringBuffer();
|
|
|
+ if(ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ className.append("考前辅导课•");
|
|
|
+ }else if(Objects.isNull(vipGroupCategory.getMusicTheory())||!vipGroupCategory.getMusicTheory()){
|
|
|
+ className.append(StringUtils.join(bySubIds,","));
|
|
|
+ className.append(vipGroupCategory.getName());
|
|
|
+ }else{
|
|
|
+ className.append("乐理课•");
|
|
|
+ }
|
|
|
+ className.append(StringUtils.join(studentNames, ","));
|
|
|
+ vipGroupApplyBaseInfoDto.setName(className.toString());
|
|
|
+
|
|
|
+
|
|
|
+ if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ //计算课程相关费用信息
|
|
|
+ Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
+ vipGroupApplyBaseInfoDto.getUserId(), null);
|
|
|
+ vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
|
|
|
+ vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
|
|
|
+ vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
|
|
|
+ }else{
|
|
|
+ vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(BigDecimal.ZERO);
|
|
|
+ vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(BigDecimal.ZERO);
|
|
|
+ vipGroupApplyBaseInfoDto.setTotalPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
+ vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(vscps)){
|
|
|
+ vscps = new ArrayList<>();
|
|
|
+ for (Integer canBuyStudentId : canBuyStudentIds) {
|
|
|
+ vscps.add(new VipGroupStudentCoursePrice(canBuyStudentId, vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getTotalPrice()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Teacher teacher = teacherService.get(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ if(Objects.isNull(teacher)){
|
|
|
+ throw new BizException("教师不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ //开课时间为排课的第一节课的开始时间
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseStartDate(firstCourseSchedule.getStartClassTime());
|
|
|
+ //课程结束时间为排课的最后一节课的结束时间
|
|
|
+ vipGroupApplyBaseInfoDto.setCoursesExpireDate(latestCourseSchedule.getEndClassTime());
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setPaymentExpireDate(DateUtil.getLastSecondWithDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate()));
|
|
|
+
|
|
|
+ vipGroupDao.insert(vipGroupApplyBaseInfoDto);
|
|
|
+
|
|
|
+ vscps.forEach(e->e.setVipGroupId(vipGroupApplyBaseInfoDto.getId()));
|
|
|
+ vipGroupStudentCoursePriceDao.batchInsert(vscps);
|
|
|
+
|
|
|
+ vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfoDto.getId());
|
|
|
+
|
|
|
+ //创建班级信息
|
|
|
+ ClassGroup classGroup=new ClassGroup();
|
|
|
+ classGroup.setSubjectIdList(vipGroupApplyBaseInfoDto.getSubjectIdList());
|
|
|
+ classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum());
|
|
|
+ classGroup.setStudentNum(studentIdList.size());
|
|
|
+ classGroup.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ classGroup.setTotalClassTimes(totalClassTimes);
|
|
|
+ classGroup.setType(ClassGroupTypeEnum.VIP);
|
|
|
+ classGroup.setDelFlag(0);
|
|
|
+ classGroup.setGroupType(GroupType.VIP);
|
|
|
+ classGroup.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroup.setCreateTime(now);
|
|
|
+ classGroup.setUpdateTime(now);
|
|
|
+ classGroupDao.insert(classGroup);
|
|
|
+
|
|
|
+ //创建班级老师关联记录
|
|
|
+ ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper();
|
|
|
+ classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
+ classGroupTeacherMapper.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ classGroupTeacherMapper.setGroupType(GroupType.VIP);
|
|
|
+ classGroupTeacherMapper.setCreateTime(now);
|
|
|
+ classGroupTeacherMapper.setUpdateTime(now);
|
|
|
+ classGroupTeacherMapperDao.insert(classGroupTeacherMapper);
|
|
|
+
|
|
|
+ //创建班级与老师课酬记录
|
|
|
+ ClassGroupTeacherSalary classGroupTeacherSalary=new ClassGroupTeacherSalary();
|
|
|
+ classGroupTeacherSalary.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroupTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
+ classGroupTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ classGroupTeacherSalary.setSalary(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setOnlineClassesSalary(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setGroupType(GroupType.VIP);
|
|
|
+ classGroupTeacherSalary.setCreateTime(now);
|
|
|
+ classGroupTeacherSalary.setUpdateTime(now);
|
|
|
+ classGroupTeacherSalaryDao.insert(classGroupTeacherSalary);
|
|
|
+
|
|
|
+ //班级学员关联记录
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
|
|
|
+ for (Integer studentId : studentIdList) {
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
+ classGroupStudentMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapper.setUserId(studentId);
|
|
|
+ classGroupStudentMapper.setCreateTime(now);
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapper.setGroupType(GroupType.VIP);
|
|
|
+ classGroupStudentMapperList.add(classGroupStudentMapper);
|
|
|
+ }
|
|
|
+ classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
|
|
|
+
|
|
|
+ //课程信息调整
|
|
|
+ vipGroup.getCourseSchedules().forEach(courseSchedule -> {
|
|
|
+ courseSchedule.setGroupType(GroupType.VIP);
|
|
|
+ courseSchedule.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
|
+ courseSchedule.setSchoolId(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId());
|
|
|
+ }
|
|
|
+ courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ courseSchedule.setActualTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
+ courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ courseSchedule.setClassGroupId(classGroup.getId());
|
|
|
+ courseSchedule.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ courseSchedule.setOrganId(vipGroupApplyBaseInfoDto.getOrganId());
|
|
|
+ });
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(vipGroup.getCourseSchedules()));
|
|
|
+ vipGroupDao.update(vipGroupApplyBaseInfoDto);
|
|
|
+
|
|
|
+ //创建课程
|
|
|
+ List<CourseSchedule> courseSchedules = vipGroup.getCourseSchedules();
|
|
|
+ courseScheduleService.batchAddCourseSchedule(courseSchedules);
|
|
|
+ //创建老师单节课课酬信息
|
|
|
+ if(ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = new ArrayList<>();
|
|
|
+ BigDecimal teacherDefaultSalary = new BigDecimal("16.67");
|
|
|
+ SysConfig practiceCourseSalaryConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_SALARY);
|
|
|
+ if(Objects.nonNull(practiceCourseSalaryConfig)&&StringUtils.isNotBlank(practiceCourseSalaryConfig.getParanValue())){
|
|
|
+ teacherDefaultSalary = new BigDecimal(practiceCourseSalaryConfig.getParanValue());
|
|
|
+ }
|
|
|
+ for (CourseSchedule courseSchedule : courseSchedules) {
|
|
|
+ CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
+ courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseScheduleTeacherSalary.setGroupType(GroupType.VIP);
|
|
|
+ courseScheduleTeacherSalary.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ courseScheduleTeacherSalary.setTeacherRole(classGroupTeacherMapper.getTeacherRole());
|
|
|
+ courseScheduleTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getTeacherId().intValue());
|
|
|
+ courseScheduleTeacherSalary.setExpectSalary(teacherDefaultSalary);
|
|
|
+ courseScheduleTeacherSalary.setCreateTime(now);
|
|
|
+ courseScheduleTeacherSalary.setUpdateTime(now);
|
|
|
+ courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
+ courseScheduleTeacherSalary.setEnableChangeSalary(false);
|
|
|
+ courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
+ }
|
|
|
+ List<TeacherAttendance> teacherAttendances = new ArrayList<>();
|
|
|
+ for (CourseScheduleTeacherSalary courseScheduleTeacherSalary : courseScheduleTeacherSalaries) {
|
|
|
+ TeacherAttendance teacherAttendance = new TeacherAttendance();
|
|
|
+ teacherAttendance.setGroupType(courseScheduleTeacherSalary.getGroupType());
|
|
|
+ teacherAttendance.setClassGroupId(courseScheduleTeacherSalary.getClassGroupId());
|
|
|
+ teacherAttendance.setMusicGroupId(courseScheduleTeacherSalary.getMusicGroupId());
|
|
|
+ teacherAttendance.setTeacherId(courseScheduleTeacherSalary.getUserId());
|
|
|
+ teacherAttendance.setCourseScheduleId(courseScheduleTeacherSalary.getCourseScheduleId());
|
|
|
+ teacherAttendances.add(teacherAttendance);
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
+ if (!CollectionUtils.isEmpty(teacherAttendances)) {
|
|
|
+ teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroupApplyBaseInfoDto,
|
|
|
+ courseSchedules,
|
|
|
+ classGroupTeacherSalary.getOnlineClassesSalary(),
|
|
|
+ classGroupTeacherSalary.getSalary());
|
|
|
+ courseScheduleTeacherSalaryDao.updateEnableChangeSalaryByClassGroup(classGroup.getId().longValue(), false);
|
|
|
+ }
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
|
|
|
+
|
|
|
+ Map<Integer,String> userRoleMap = new HashMap<>();
|
|
|
+ if(Objects.nonNull(vipGroupApplyBaseInfoDto.getEducationalTeacherId())){
|
|
|
+ userRoleMap.put(vipGroupApplyBaseInfoDto.getEducationalTeacherId(),"乐团主管");
|
|
|
+ }
|
|
|
+ userRoleMap.put(vipGroupApplyBaseInfoDto.getUserId(),"指导老师");
|
|
|
+ //生成学生单课缴费信息
|
|
|
+ for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
|
+ if(ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())
|
|
|
+ ||ActivityCourseType.MUSIC_THEORY.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
|
|
|
+ BigDecimal price = studentTheoryPriceMap.get(classGroupStudent.getUserId());
|
|
|
+ BigDecimal coursePrice = BigDecimal.ZERO;
|
|
|
+ if(Objects.nonNull(price)){
|
|
|
+ coursePrice = price.divide(new BigDecimal(courseSchedules.size()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ for (CourseSchedule courseSchedule : courseSchedules) {
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
+ courseScheduleStudentPayment.setUserId(classGroupStudent.getUserId());
|
|
|
+ courseScheduleStudentPayment.setGroupType(courseSchedule.getGroupType());
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
+ if(ActivityCourseType.MUSIC_THEORY.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(coursePrice);
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(coursePrice);
|
|
|
+ }else{
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(BigDecimal.ZERO);
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
+ }
|
|
|
+ courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
+ }else{
|
|
|
+ courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupApplyBaseInfoDto.getId(),classGroupStudent.getUserId());
|
|
|
+ }
|
|
|
+ userRoleMap.put(classGroupStudent.getUserId(),null);
|
|
|
+ studentDao.updateStudentServiceTag(classGroupStudent.getUserId(), null, YesOrNoEnum.YES.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ courseScheduleService.checkNewCourseSchedules(courseSchedules, false,false);
|
|
|
+
|
|
|
+ try {
|
|
|
+ imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroupApplyBaseInfoDto.getName(), null, null, GroupType.VIP.getCode());
|
|
|
+ imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(),classGroup.getGroupType());
|
|
|
+ //发送推送
|
|
|
+ Map<Integer,String> map = new HashMap<>(1);
|
|
|
+ map.put(vipGroupApplyBaseInfoDto.getUserId(),sysUser.getPhone());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,MessageTypeEnum.CHILDREN_DAY_VIP_COURSE_TEACHER_PUSH,
|
|
|
+ map,null,0,"","TEACHER", StringUtils.join(studentNames, ","),vipGroupApplyBaseInfoDto.getName());
|
|
|
+
|
|
|
+ Map<Integer,String> studentIdStrMap = new HashMap<>(1);
|
|
|
+ studentIdList.forEach(id->studentIdStrMap.put(id, id.toString()));
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.CHILDREN_DAY_VIP_COURSE_STUDENT_PUSH, studentIdStrMap, null, 0, "","STUDENT",
|
|
|
+ vipGroupApplyBaseInfoDto.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpResponseResult importActivityVipGroup(String data) {
|
|
|
+ if(StringUtils.isBlank(data)){
|
|
|
+ return BaseController.succeed();
|
|
|
+ }
|
|
|
+ List<JSONObject> datas = JSON.parseArray(data, JSONObject.class);
|
|
|
+ Date date = new Date();
|
|
|
+ for (JSONObject courseData : datas) {
|
|
|
+ boolean skipHoliday = "是".equals(courseData.getString("skip_holiday"))?true:false;
|
|
|
+ String vipGroupActivityName = courseData.getString("vip_group_activity");
|
|
|
+ String vipGroupCategoryStr = courseData.getString("vip_group_category");
|
|
|
+ boolean freeCourse = "考前辅导课".equals(vipGroupCategoryStr);
|
|
|
+ int courseMinute = freeCourse?25:45;
|
|
|
+ String vipGroupCategoryName = "1v1".equals(vipGroupCategoryStr)?"1v1":"1v2";
|
|
|
+ Integer schoolId = courseData.getInteger("school_id");
|
|
|
+ int onlineCourseNum = StringUtils.isBlank(courseData.getString("online_course_num"))?0:courseData.getIntValue("online_course_num");
|
|
|
+ int onlineWeekNum = 0;
|
|
|
+ if(onlineCourseNum>0){
|
|
|
+ onlineWeekNum = courseData.getIntValue("online_course_week_num");
|
|
|
+ }
|
|
|
+ String onlineCourseStartTime = courseData.getString("online_course_start_time");
|
|
|
+ int offlineCourseNum = StringUtils.isBlank(courseData.getString("offline_course_num"))?0:courseData.getIntValue("offline_course_num");
|
|
|
+ int offlineWeekNum = 0;
|
|
|
+ if(offlineCourseNum>0){
|
|
|
+ offlineWeekNum = courseData.getIntValue("offline_course_week_num");
|
|
|
+ }
|
|
|
+ String offlineCourseStartTime = courseData.getString("offline_course_start_time");
|
|
|
+ int totalCourseNum = onlineCourseNum + offlineCourseNum;
|
|
|
+ Integer teacherId = courseData.getInteger("teacher_id");
|
|
|
+ Integer eduTeacherId = StringUtils.isBlank(courseData.getString("edu_teacher_id"))?null:courseData.getInteger("edu_teacher_id");
|
|
|
+ String studentIdsStr= courseData.getString("student_ids");
|
|
|
+ if(StringUtils.isBlank(studentIdsStr)){
|
|
|
+ throw new BizException("请选择学员");
|
|
|
+ }
|
|
|
+ List<Integer> studentIds = Arrays.stream(studentIdsStr.split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
+ SysUser student = studentDao.getUser(studentIds.get(0));
|
|
|
+ Student stu = studentDao.get(studentIds.get(0));
|
|
|
+ if(Objects.isNull(student)){
|
|
|
+ throw new BizException("学员信息异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<VipGroupCategory> vipGroupCategories = vipGroupCategoryDao.findAllByOrgan(student.getOrganId().toString());
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategories.stream().filter(v -> v.getName().equals(vipGroupCategoryName)).findFirst().get();
|
|
|
+
|
|
|
+ List<VipGroupActivity> vipGroupActivities = vipGroupActivityDao.findByName(vipGroupActivityName);
|
|
|
+ VipGroupActivity vipGroupActivity = null;
|
|
|
+ if(!CollectionUtils.isEmpty(vipGroupActivities)){
|
|
|
+ vipGroupActivity = vipGroupActivities.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ LocalDate courseStartDay = null;
|
|
|
+ LocalDate onlineCourseStartDay = null;
|
|
|
+ LocalDate offlineCourseStartDay = null;
|
|
|
+
|
|
|
+ if(onlineCourseNum>0){
|
|
|
+ onlineCourseStartDay = LocalDate.parse(courseData.getString("online_course_start_day").replace(" 00:00:00", ""), DateUtil.dateFormatter);
|
|
|
+ courseStartDay = onlineCourseStartDay;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(offlineCourseNum>0){
|
|
|
+ offlineCourseStartDay = LocalDate.parse(courseData.getString("offline_course_start_day").replace(" 00:00:00", ""), DateUtil.dateFormatter);
|
|
|
+ if(Objects.isNull(courseStartDay)||onlineCourseStartDay.compareTo(offlineCourseStartDay)>0){
|
|
|
+ courseStartDay = offlineCourseStartDay;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> holidayDays = new HashSet<>();
|
|
|
+
|
|
|
+ if (skipHoliday) {
|
|
|
+ SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
|
|
|
+ if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
|
|
|
+ holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseSchedule> courseSchedules = new ArrayList<>();
|
|
|
+ int onlineCourseNumCreated = 0;
|
|
|
+ int offlineCourseNumCreated = 0;
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ if (skipHoliday && holidayDays.contains(courseStartDay.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) {
|
|
|
+ courseStartDay = courseStartDay.plusDays(1);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ int dayOfWeek = courseStartDay.getDayOfWeek().getValue();//当前星期
|
|
|
+
|
|
|
+ if (onlineCourseNumCreated<onlineCourseNum&&(onlineWeekNum < 1 || onlineWeekNum > 7)) {
|
|
|
+ throw new BizException("排课循环周期错误,请核查");
|
|
|
+ }
|
|
|
+ if(onlineCourseNumCreated<onlineCourseNum&&courseStartDay.compareTo(onlineCourseStartDay)>=0&&dayOfWeek==onlineWeekNum){
|
|
|
+ Date classDate = DateConvertor.toDate(courseStartDay);
|
|
|
+ String startClassTime = DateUtil.getDate(classDate) + " " + onlineCourseStartTime;
|
|
|
+ String endClassTime = DateUtil.dateToString(DateUtil.addMinutes(DateUtil.stringToDate(startClassTime, "yyyy-MM-dd HH:mm:ss"), courseMinute), "yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ CourseSchedule courseSchedule = new CourseSchedule();
|
|
|
+ courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
+ courseSchedule.setClassDate(classDate);
|
|
|
+ courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
|
|
|
+ courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime));
|
|
|
+ courseSchedule.setCreateTime(date);
|
|
|
+ courseSchedule.setUpdateTime(date);
|
|
|
+ courseSchedule.setTeachMode(TeachModeEnum.ONLINE);
|
|
|
+ courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ courseSchedule.setGroupType(VIP);
|
|
|
+ courseSchedule.setOrganId(student.getOrganId());
|
|
|
+ courseSchedule.setTeacherId(teacherId);
|
|
|
+ courseSchedule.setActualTeacherId(teacherId);
|
|
|
+ courseSchedules.add(courseSchedule);
|
|
|
+
|
|
|
+ onlineCourseNumCreated++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (offlineCourseNumCreated<offlineCourseNum&&(offlineWeekNum < 1 || offlineWeekNum > 7)) {
|
|
|
+ throw new BizException("排课循环周期错误,请核查");
|
|
|
+ }
|
|
|
+ if(offlineCourseNumCreated<offlineCourseNum&&courseStartDay.compareTo(offlineCourseStartDay)>=0&&dayOfWeek==offlineWeekNum){
|
|
|
+ Date classDate = DateConvertor.toDate(courseStartDay);
|
|
|
+ String startClassTime = DateUtil.getDate(classDate) + " " + offlineCourseStartTime;
|
|
|
+ String endClassTime = DateUtil.dateToString(DateUtil.addMinutes(DateUtil.stringToDate(startClassTime, "yyyy-MM-dd HH:mm:ss"), courseMinute), "yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ CourseSchedule courseSchedule = new CourseSchedule();
|
|
|
+ courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
+ courseSchedule.setClassDate(classDate);
|
|
|
+ courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
|
|
|
+ courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime));
|
|
|
+ courseSchedule.setCreateTime(date);
|
|
|
+ courseSchedule.setUpdateTime(date);
|
|
|
+ courseSchedule.setSchoolId(schoolId);
|
|
|
+ courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
|
|
|
+ courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ courseSchedule.setGroupType(VIP);
|
|
|
+ courseSchedule.setOrganId(student.getOrganId());
|
|
|
+ courseSchedule.setTeacherId(teacherId);
|
|
|
+ courseSchedule.setActualTeacherId(teacherId);
|
|
|
+ courseSchedules.add(courseSchedule);
|
|
|
+
|
|
|
+ offlineCourseNumCreated++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (courseSchedules.size()>=totalCourseNum) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ courseStartDay = courseStartDay.plusDays(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ VipGroupApplyDto vipGroupApplyDto = new VipGroupApplyDto();
|
|
|
+ VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto = new VipGroupApplyBaseInfoDto();
|
|
|
+ vipGroupApplyBaseInfoDto.setStudentIdList(studentIdsStr);
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setAllCourseNum(totalCourseNum);
|
|
|
+ vipGroupApplyBaseInfoDto.setTeacherId(teacherId.longValue());
|
|
|
+ vipGroupApplyBaseInfoDto.setEducationalTeacherId(eduTeacherId);
|
|
|
+ vipGroupApplyBaseInfoDto.setSubjectIdList(stu.getSubjectIdList());
|
|
|
+ vipGroupApplyBaseInfoDto.setFirstStudentId(studentIds.get(0));
|
|
|
+ vipGroupApplyBaseInfoDto.setUserId(teacherId);
|
|
|
+ vipGroupApplyBaseInfoDto.setSingleClassMinutes(courseMinute);
|
|
|
+ vipGroupApplyBaseInfoDto.setRegistrationStartTime(date);
|
|
|
+ vipGroupApplyBaseInfoDto.setPaymentExpireDate(date);
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseStartDate(courseSchedules.get(0).getStartClassTime());
|
|
|
+ vipGroupApplyBaseInfoDto.setCoursesExpireDate(courseSchedules.get(courseSchedules.size()-1).getEndClassTime());
|
|
|
+ vipGroupApplyBaseInfoDto.setTeacherSchoolId(schoolId);
|
|
|
+ vipGroupApplyBaseInfoDto.setOnlineClassesNum(onlineCourseNum);
|
|
|
+ vipGroupApplyBaseInfoDto.setOfflineClassesNum(offlineCourseNum);
|
|
|
+ vipGroupApplyBaseInfoDto.setVipGroupCategoryId(vipGroupCategory.getId());
|
|
|
+ if(freeCourse){
|
|
|
+ vipGroupApplyBaseInfoDto.setActivityCourseType(ActivityCourseType.FREE_VIP);
|
|
|
+ }
|
|
|
+ if(Objects.nonNull(vipGroupActivity)){
|
|
|
+ vipGroupApplyBaseInfoDto.setVipGroupActivityId(vipGroupActivity.getId());
|
|
|
+ }
|
|
|
+ vipGroupApplyBaseInfoDto.setOrganId(student.getOrganId());
|
|
|
+ vipGroupApplyBaseInfoDto.setOnlineClassesUnitPrice(vipGroupCategory.getOnlineClassesUnitPrice());
|
|
|
+ vipGroupApplyBaseInfoDto.setOfflineClassesUnitPrice(vipGroupCategory.getOfflineClassesUnitPrice());
|
|
|
+ vipGroupApplyDto.setVipGroupApplyBaseInfo(vipGroupApplyBaseInfoDto);
|
|
|
+
|
|
|
+ vipGroupApplyDto.setCourseSchedules(courseSchedules);
|
|
|
+ createActivityVipGroup(vipGroupApplyDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ return BaseController.succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<Organization> getPublicOrgans(Integer eduTeacherId, Integer teacherId) {
|
|
|
if(Objects.isNull(eduTeacherId)){
|
|
|
throw new BizException("教务老师不存在");
|
|
@@ -1872,6 +2466,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
throw new BizException("不能对已停止的课程进行此操作");
|
|
|
}
|
|
|
+ if(vipGroup.getName().startsWith("考前辅导课")){
|
|
|
+ throw new BizException("当前课程类型不支持退学");
|
|
|
+ }
|
|
|
|
|
|
VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
|
|
|
|