|
|
@@ -88,8 +88,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Autowired
|
|
|
private TeacherDefaultVipGroupSalaryDao teacherDefaultVipGroupSalaryDao;
|
|
|
@Autowired
|
|
|
- private TeacherDefaultPracticeGroupSalaryDao teacherDefaultPracticeGroupSalaryDao;
|
|
|
- @Autowired
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
@Autowired
|
|
|
private StudentApplyRefundsDao studentApplyRefundsDao;
|
|
|
@@ -169,6 +167,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
private SysConfigService sysConfigService;
|
|
|
@Autowired
|
|
|
private SysCouponCodeService sysCouponCodeService;
|
|
|
+ @Autowired
|
|
|
+ private CloudTeacherOrderService cloudTeacherOrderService;
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(VipGroup.class);
|
|
|
@@ -182,12 +184,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Override
|
|
|
public HttpResponseResult createVipGroup(VipGroupApplyDto vipGroup) {
|
|
|
|
|
|
- VipGroupApplyBaseInfoDto vipGroupApplyBaseInfo = vipGroup.getVipGroupApplyBaseInfo();
|
|
|
- if (Objects.isNull(vipGroupApplyBaseInfo.getUserId())){
|
|
|
+ if (Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getUserId())){
|
|
|
throw new BizException("请选择指导老师");
|
|
|
}
|
|
|
|
|
|
- if(vipGroup.getCourseSchedules().size()!=(vipGroupApplyBaseInfo.getOfflineClassesNum() + vipGroupApplyBaseInfo.getOnlineClassesNum())){
|
|
|
+ if(vipGroup.getCourseSchedules().size()!=(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()+vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())){
|
|
|
throw new BizException("建课失败,当前课程存在未排课课程,请调整相关设置");
|
|
|
}
|
|
|
|
|
|
@@ -198,18 +199,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("教学模式错误");
|
|
|
}
|
|
|
|
|
|
- if((Objects.isNull(courseScheduleGroup.get(TeachModeEnum.OFFLINE)) && vipGroupApplyBaseInfo.getOfflineClassesNum()!=0)
|
|
|
- ||(!Objects.isNull(courseScheduleGroup.get(TeachModeEnum.OFFLINE))&&(courseScheduleGroup.get(TeachModeEnum.OFFLINE).size()<vipGroupApplyBaseInfo.getOfflineClassesNum()))){
|
|
|
+ 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)) && vipGroupApplyBaseInfo.getOnlineClassesNum()!=0)
|
|
|
- ||(!Objects.isNull(courseScheduleGroup.get(TeachModeEnum.ONLINE))&&(courseScheduleGroup.get(TeachModeEnum.ONLINE).size() < vipGroupApplyBaseInfo.getOnlineClassesNum()))){
|
|
|
+ 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(vipGroupApplyBaseInfo.getOfflineClassesNum()>0
|
|
|
- &&Objects.isNull(vipGroupApplyBaseInfo.getTeacherSchoolId())){
|
|
|
+ if(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()>0
|
|
|
+ &&Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId())){
|
|
|
throw new BizException("请设置教学点");
|
|
|
}
|
|
|
|
|
|
@@ -221,20 +222,22 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
Date now=new Date();
|
|
|
|
|
|
- if(Objects.isNull(vipGroupApplyBaseInfo.getOfflineClassesUnitPrice())
|
|
|
- &&Objects.isNull(vipGroupApplyBaseInfo.getOnlineClassesUnitPrice())){
|
|
|
+ VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
|
|
|
+
|
|
|
+ if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
|
|
|
+ &&Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())){
|
|
|
throw new BizException("请设置课程单价");
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isBlank(vipGroupApplyBaseInfo.getStudentIdList())){
|
|
|
+ if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
throw new BizException("请选择学员");
|
|
|
}
|
|
|
|
|
|
- if(Objects.isNull(vipGroupApplyBaseInfo.getOnlineTeacherSalary())||Objects.isNull(vipGroupApplyBaseInfo.getOfflineTeacherSalary())){
|
|
|
+ if(Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary()) || Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())){
|
|
|
throw new BizException("请设置教师课酬");
|
|
|
}
|
|
|
|
|
|
- Integer totalClassTimes=vipGroupApplyBaseInfo.getOnlineClassesNum()+vipGroupApplyBaseInfo.getOfflineClassesNum();
|
|
|
+ Integer totalClassTimes=vipGroupApplyBaseInfoDto.getOnlineClassesNum()+vipGroupApplyBaseInfoDto.getOfflineClassesNum();
|
|
|
//获取第一节课
|
|
|
CourseSchedule firstCourseSchedule = vipGroup.getCourseSchedules().stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
|
|
|
//获取最后一节课
|
|
|
@@ -244,29 +247,25 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("开课时间不能小于当前时间");
|
|
|
}
|
|
|
|
|
|
- if(vipGroupApplyBaseInfo.getRegistrationStartTime().after(vipGroupApplyBaseInfo.getPaymentExpireDate())){
|
|
|
+ if(vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())){
|
|
|
throw new BizException("报名开始时间必须在报名截至时间之前");
|
|
|
}
|
|
|
|
|
|
- if(vipGroupApplyBaseInfo.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
|
|
|
- ||DateUtil.isSameDay(vipGroupApplyBaseInfo.getPaymentExpireDate(),firstCourseSchedule.getEndClassTime())){
|
|
|
+ if(vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
|
|
|
+ ||DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(),firstCourseSchedule.getEndClassTime())){
|
|
|
throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
|
|
|
}
|
|
|
|
|
|
- List<Integer> canBuyStudentIds = Arrays.stream(vipGroupApplyBaseInfo.getStudentIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
- List<VipGroupStudentCoursePrice> vscps = vipGroupApplyBaseInfo.getVipGroupStudentCoursePrices();
|
|
|
+ List<Integer> canBuyStudentIds = Arrays.stream(vipGroupApplyBaseInfoDto.getStudentIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
+ List<VipGroupStudentCoursePrice> vscps = vipGroup.getVipGroupApplyBaseInfo().getVipGroupStudentCoursePrices();
|
|
|
|
|
|
//获取活动信息
|
|
|
- VipGroupActivity vipGroupActivity = null;
|
|
|
- if(vipGroupApplyBaseInfo.getVipGroupActivityId() != null){
|
|
|
- vipGroupActivity = vipGroupActivityDao.get(vipGroupApplyBaseInfo.getVipGroupActivityId());
|
|
|
- }
|
|
|
-
|
|
|
- if(vipGroupActivity != null && !vipGroup.getAllowOverstepActivityStudentNum() && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfo.getStudentIdList())){
|
|
|
- List<String> tempStudentIds = Arrays.asList(vipGroupApplyBaseInfo.getStudentIdList().split(","));
|
|
|
+ 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(vipGroupApplyBaseInfo.getVipGroupActivityId(), Integer.valueOf(studentIdStr));
|
|
|
+ int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId(), Integer.valueOf(studentIdStr));
|
|
|
if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
|
|
|
errStudentIds.add(Integer.valueOf(studentIdStr));
|
|
|
}
|
|
|
@@ -279,7 +278,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
}
|
|
|
//判断课程安排是否超出范围
|
|
|
- if(Objects.nonNull(vipGroupActivity) && (Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime()))){
|
|
|
+ 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("课时安排时间超出范围!");
|
|
|
@@ -295,26 +294,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getMinCourseNum())&&vipGroupActivity.getMinCourseNum()!=-1&&Objects.nonNull(vipGroupActivity.getMaxCourseNum())&&vipGroupActivity.getMaxCourseNum()!=-1){
|
|
|
- Integer requestCourseNum = vipGroupApplyBaseInfo.getOnlineClassesNum() + vipGroupApplyBaseInfo.getOfflineClassesNum();
|
|
|
+ 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(vipGroupApplyBaseInfo.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
+ int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
if(repeatVipGroups>0){
|
|
|
throw new BizException("请勿重复提交");
|
|
|
}
|
|
|
|
|
|
- VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroupApplyBaseInfo.getVipGroupCategoryId());
|
|
|
+ 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(vipGroupApplyBaseInfo.getSubjectIdList());
|
|
|
+ List<String> bySubIds = subjectDao.findBySubIds(vipGroupApplyBaseInfoDto.getSubjectIdList());
|
|
|
StringBuffer className=new StringBuffer();
|
|
|
if(Objects.isNull(vipGroupCategory.getMusicTheory())||!vipGroupCategory.getMusicTheory()){
|
|
|
className.append(StringUtils.join(bySubIds,","));
|
|
|
@@ -323,34 +322,34 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
className.append("乐理课•");
|
|
|
}
|
|
|
className.append(StringUtils.join(studentNames, ","));
|
|
|
- vipGroupApplyBaseInfo.setName(className.toString());
|
|
|
+ vipGroupApplyBaseInfoDto.setName(className.toString());
|
|
|
|
|
|
//计算课程相关费用信息
|
|
|
- Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfo,
|
|
|
- vipGroupApplyBaseInfo.getUserId(), null);
|
|
|
+ Map<String, BigDecimal> costInfo = countVipGroupPredictFee1(vipGroupApplyBaseInfoDto,
|
|
|
+ vipGroupApplyBaseInfoDto.getUserId(), null);
|
|
|
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
|
|
|
//如果默认课酬与实际课酬不匹配则需要审批
|
|
|
- if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfo.getOfflineTeacherSalary())<0||
|
|
|
- costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfo.getOnlineTeacherSalary())<0
|
|
|
+ if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())<0||
|
|
|
+ costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())<0
|
|
|
&&StringUtils.isBlank(studentIds)){
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
}
|
|
|
|
|
|
- vipGroupApplyBaseInfo.setTotalPrice(costInfo.get("totalPrice"));
|
|
|
+ vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
|
|
|
if(StringUtils.isNotBlank(studentIds)){
|
|
|
- vipGroupApplyBaseInfo.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
+ vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
}else{
|
|
|
- vipGroupApplyBaseInfo.setStatus(VipGroupStatusEnum.APPLYING);
|
|
|
+ vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
|
|
|
}
|
|
|
if(CollectionUtils.isEmpty(vscps)){
|
|
|
vscps = new ArrayList<>();
|
|
|
for (Integer canBuyStudentId : canBuyStudentIds) {
|
|
|
- vscps.add(new VipGroupStudentCoursePrice(canBuyStudentId, vipGroupApplyBaseInfo.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfo.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfo.getTotalPrice()));
|
|
|
+ vscps.add(new VipGroupStudentCoursePrice(canBuyStudentId, vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getTotalPrice()));
|
|
|
}
|
|
|
}
|
|
|
- Teacher teacher = teacherService.get(vipGroupApplyBaseInfo.getUserId());
|
|
|
+ Teacher teacher = teacherService.get(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
if(Objects.isNull(teacher)){
|
|
|
throw new BizException("教师不存在");
|
|
|
}
|
|
|
@@ -359,66 +358,66 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
// vipGroupApplyBaseInfoDto.setOrganId(Integer.parseInt(teacher.getOrganId()));
|
|
|
//开课时间为排课的第一节课的开始时间
|
|
|
- vipGroupApplyBaseInfo.setCourseStartDate(firstCourseSchedule.getStartClassTime());
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseStartDate(firstCourseSchedule.getStartClassTime());
|
|
|
//课程结束时间为排课的最后一节课的结束时间
|
|
|
- vipGroupApplyBaseInfo.setCoursesExpireDate(latestCourseSchedule.getEndClassTime());
|
|
|
+ vipGroupApplyBaseInfoDto.setCoursesExpireDate(latestCourseSchedule.getEndClassTime());
|
|
|
|
|
|
- vipGroupApplyBaseInfo.setPaymentExpireDate(DateUtil.getLastSecondWithDay(vipGroupApplyBaseInfo.getPaymentExpireDate()));
|
|
|
+ vipGroupApplyBaseInfoDto.setPaymentExpireDate(DateUtil.getLastSecondWithDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate()));
|
|
|
|
|
|
- VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroupApplyBaseInfo.getVipGroupCategoryId(), vipGroupApplyBaseInfo.getOrganId());
|
|
|
+ VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), vipGroup.getVipGroupApplyBaseInfo().getOrganId());
|
|
|
|
|
|
if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
}else{
|
|
|
- if(Objects.nonNull(vipGroupApplyBaseInfo.getOfflineClassesUnitPrice())
|
|
|
- &&vipGroupApplyBaseInfo.getOfflineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice())!=0){
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ if(Objects.nonNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
|
|
|
+ &&vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice())!=0){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
}
|
|
|
- if(Objects.nonNull(vipGroupApplyBaseInfo.getOnlineClassesUnitPrice())
|
|
|
- &&vipGroupApplyBaseInfo.getOnlineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice())!=0){
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ if(Objects.nonNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())
|
|
|
+ &&vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice())!=0){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isBlank(vipGroupApplyBaseInfo.getStudentIdList())){
|
|
|
- vipGroupApplyBaseInfo.setStudentIdList(StringUtils.join(vscps.stream().map(VipGroupStudentCoursePrice::getStudentId).collect(Collectors.toList()), ","));
|
|
|
+ if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
+ vipGroupApplyBaseInfoDto.setStudentIdList(StringUtils.join(vscps.stream().map(VipGroupStudentCoursePrice::getStudentId).collect(Collectors.toList()), ","));
|
|
|
}
|
|
|
|
|
|
if(vipGroup.getOnlyProgress()){
|
|
|
- vipGroupApplyBaseInfo.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
}
|
|
|
|
|
|
- vipGroupDao.insert(vipGroupApplyBaseInfo);
|
|
|
+ vipGroupDao.insert(vipGroupApplyBaseInfoDto);
|
|
|
|
|
|
- vscps.forEach(e->e.setVipGroupId(vipGroupApplyBaseInfo.getId()));
|
|
|
+ vscps.forEach(e->e.setVipGroupId(vipGroupApplyBaseInfoDto.getId()));
|
|
|
vipGroupStudentCoursePriceDao.batchInsert(vscps);
|
|
|
|
|
|
- vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfo.getId());
|
|
|
+ vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfoDto.getId());
|
|
|
|
|
|
//创建班级信息
|
|
|
ClassGroup classGroup=new ClassGroup();
|
|
|
- classGroup.setSubjectIdList(vipGroupApplyBaseInfo.getSubjectIdList());
|
|
|
+ classGroup.setSubjectIdList(vipGroupApplyBaseInfoDto.getSubjectIdList());
|
|
|
classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum());
|
|
|
if(StringUtils.isNotBlank(studentIds)){
|
|
|
classGroup.setStudentNum(studentIdList.size());
|
|
|
}
|
|
|
- classGroup.setName(vipGroupApplyBaseInfo.getName());
|
|
|
- classGroup.setExpectStudentNum(vipGroupApplyBaseInfo.getStudentNum());
|
|
|
+ classGroup.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ classGroup.setExpectStudentNum(vipGroupApplyBaseInfoDto.getStudentNum());
|
|
|
classGroup.setTotalClassTimes(totalClassTimes);
|
|
|
classGroup.setType(ClassGroupTypeEnum.VIP);
|
|
|
classGroup.setDelFlag(1);
|
|
|
classGroup.setGroupType(GroupType.VIP);
|
|
|
- classGroup.setMusicGroupId(vipGroupApplyBaseInfo.getId().toString());
|
|
|
+ classGroup.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
classGroup.setCreateTime(now);
|
|
|
classGroup.setUpdateTime(now);
|
|
|
classGroupDao.insert(classGroup);
|
|
|
|
|
|
//创建班级老师关联记录
|
|
|
ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper();
|
|
|
- classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfo.getId().toString());
|
|
|
+ classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
- classGroupTeacherMapper.setUserId(vipGroupApplyBaseInfo.getUserId());
|
|
|
+ classGroupTeacherMapper.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
classGroupTeacherMapper.setGroupType(GroupType.VIP);
|
|
|
classGroupTeacherMapper.setCreateTime(now);
|
|
|
classGroupTeacherMapper.setUpdateTime(now);
|
|
|
@@ -426,12 +425,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
//创建班级与老师课酬记录
|
|
|
ClassGroupTeacherSalary classGroupTeacherSalary=new ClassGroupTeacherSalary();
|
|
|
- classGroupTeacherSalary.setMusicGroupId(vipGroupApplyBaseInfo.getId().toString());
|
|
|
+ classGroupTeacherSalary.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
classGroupTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
classGroupTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
- classGroupTeacherSalary.setUserId(vipGroupApplyBaseInfo.getUserId());
|
|
|
- classGroupTeacherSalary.setSalary(vipGroupApplyBaseInfo.getOfflineTeacherSalary());
|
|
|
- classGroupTeacherSalary.setOnlineClassesSalary(vipGroupApplyBaseInfo.getOnlineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ classGroupTeacherSalary.setSalary(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setOnlineClassesSalary(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary());
|
|
|
classGroupTeacherSalary.setGroupType(GroupType.VIP);
|
|
|
classGroupTeacherSalary.setCreateTime(now);
|
|
|
classGroupTeacherSalary.setUpdateTime(now);
|
|
|
@@ -440,32 +439,32 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
//课程信息调整
|
|
|
vipGroup.getCourseSchedules().forEach(courseSchedule -> {
|
|
|
courseSchedule.setGroupType(GroupType.VIP);
|
|
|
- courseSchedule.setMusicGroupId(vipGroupApplyBaseInfo.getId().toString());
|
|
|
+ courseSchedule.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
|
courseSchedule.setSchoolId(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId());
|
|
|
}
|
|
|
- courseSchedule.setTeacherId(vipGroupApplyBaseInfo.getUserId());
|
|
|
- courseSchedule.setActualTeacherId(vipGroupApplyBaseInfo.getUserId());
|
|
|
+ courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ courseSchedule.setActualTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
|
|
|
courseSchedule.setClassGroupId(classGroup.getId());
|
|
|
- courseSchedule.setName(vipGroupApplyBaseInfo.getName());
|
|
|
- courseSchedule.setOrganId(vipGroupApplyBaseInfo.getOrganId());
|
|
|
+ courseSchedule.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ courseSchedule.setOrganId(vipGroupApplyBaseInfoDto.getOrganId());
|
|
|
});
|
|
|
courseScheduleService.checkNewCourseSchedules(vipGroup.getCourseSchedules(),false,false);
|
|
|
- vipGroupApplyBaseInfo.setCourseSchedulesJson(JSON.toJSONString(vipGroup.getCourseSchedules()));
|
|
|
- vipGroupDao.update(vipGroupApplyBaseInfo);
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(vipGroup.getCourseSchedules()));
|
|
|
+ vipGroupDao.update(vipGroupApplyBaseInfoDto);
|
|
|
|
|
|
if(StringUtils.isNotBlank(studentIds)){
|
|
|
List<Integer> collect = studentIdList.stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toList());
|
|
|
- classGroupService.addStudentIntoClassGroup(vipGroupApplyBaseInfo.getId().toString(),classGroup.getId(),collect);
|
|
|
- createVipGroupCourseScheInfo(vipGroupApplyBaseInfo.getId(),classGroup);
|
|
|
+ classGroupService.addStudentIntoClassGroup(vipGroupApplyBaseInfoDto.getId().toString(),classGroup.getId(),collect);
|
|
|
+ createVipGroupCourseScheInfo(vipGroupApplyBaseInfoDto.getId(),classGroup);
|
|
|
}
|
|
|
|
|
|
Set<Integer> roleIds = new HashSet<>(1);
|
|
|
roleIds.add(SysUserRole.SECTION_MANAGER);
|
|
|
Map<String,Long> memo = new HashMap<>(1);
|
|
|
- memo.put("vipGroupId",vipGroupApplyBaseInfo.getId());
|
|
|
+ memo.put("vipGroupId",vipGroupApplyBaseInfoDto.getId());
|
|
|
// SysUser sysUser = sysUserFeignService.queryUserById(vipGroup.getVipGroupApplyBaseInfo().getUserId());
|
|
|
if(Objects.isNull(teacher)){
|
|
|
throw new BizException("该用户不存在");
|
|
|
@@ -474,15 +473,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(CollectionUtils.isEmpty(userIds)){
|
|
|
throw new BizException("当前分部没有运营主管,无法创建,请联系总部工作人员!");
|
|
|
}
|
|
|
- if(vipGroupApplyBaseInfo.getEducationalTeacherId() != null){
|
|
|
- userIds.add(vipGroupApplyBaseInfo.getEducationalTeacherId());
|
|
|
+ if(vipGroupApplyBaseInfoDto.getEducationalTeacherId() != null){
|
|
|
+ userIds.add(vipGroupApplyBaseInfoDto.getEducationalTeacherId());
|
|
|
}
|
|
|
// if (vipGroup.getVipGroupApplyBaseInfo().getUserId() != null){
|
|
|
// sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_VIP_COURSE_APPLY, JSONObject.toJSONString(memo),sysUser.getUsername(),sysUser.getUsername());
|
|
|
// }else {
|
|
|
sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_TEACHER_APPLY_VIP, JSONObject.toJSONString(memo),teacher.getRealName());
|
|
|
// }
|
|
|
- return BaseController.succeed(vipGroupApplyBaseInfo.getAuditStatus().getCode());
|
|
|
+ return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -719,7 +718,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
if(!ActivityCourseType.FREE_VIP.equals(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType())){
|
|
|
//计算课程相关费用信息
|
|
|
- Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
+ Map<String, BigDecimal> costInfo = countVipGroupPredictFee1(vipGroupApplyBaseInfoDto,
|
|
|
vipGroupApplyBaseInfoDto.getUserId(), null);
|
|
|
vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(costInfo.get("onlineTeacherSalary"));
|
|
|
vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(costInfo.get("offlineTeacherSalary"));
|
|
|
@@ -1862,7 +1861,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("课程单价异常");
|
|
|
}
|
|
|
BigDecimal offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
|
|
|
- BigDecimal totalClassNum=offlineClassNum.add(onlineClassNum);
|
|
|
+ BigDecimal totalClassNum = offlineClassNum.add(onlineClassNum);
|
|
|
BigDecimal teacherOnlineSalary=null,teacherOfflineSalary=null;
|
|
|
|
|
|
//课程购买费用计算
|
|
|
@@ -2469,7 +2468,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
|
|
|
- ClassGroup classGroup=classGroupDao.get(order.getClassGroupId());
|
|
|
+ ClassGroup classGroup = classGroupDao.get(order.getClassGroupId());
|
|
|
|
|
|
//将学生加入到班级,更新班级报名状态及人数信息
|
|
|
if(!isOk){
|
|
|
@@ -2484,8 +2483,98 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
sysCouponCodeService.quit(order.getCouponCodeId());
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
try {
|
|
|
+ Integer vipGroupActivityId = vipGroup.getVipGroupActivityId();
|
|
|
+ if(vipGroupActivityId != null){
|
|
|
+ ActivityUserMapper activityUserMapper = new ActivityUserMapper();
|
|
|
+ VipGroupActivity activity = vipGroupActivityDao.get(vipGroupActivityId);
|
|
|
+ //是否赠送课程
|
|
|
+ if(activity.getGiveCourseNum() > 0){
|
|
|
+ if(activity.getGiveCourseType().equals("VIP")){
|
|
|
+ activityUserMapper.setGiveVipFlag(1);
|
|
|
+ }else {
|
|
|
+ activityUserMapper.setGivePracticeFlag(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //是否赠送会员(会员立即生效)
|
|
|
+ if(activity.getMemberTime() > 0){
|
|
|
+ Date now = new Date();
|
|
|
+ // 查询会员订单信息
|
|
|
+ CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
|
|
|
+ cloudTeacherOrder.setStatus(2);
|
|
|
+ cloudTeacherOrder.setUpdateTime(now);
|
|
|
+ cloudTeacherOrder.setAmount(BigDecimal.ZERO);
|
|
|
+ cloudTeacherOrder.setOrderId(studentPaymentOrder.getId());
|
|
|
+ cloudTeacherOrder.setRemark("购买vip活动赠送会员");
|
|
|
+ cloudTeacherOrder.setLevel(activity.getGiveMemberRankId());
|
|
|
+ cloudTeacherOrder.setStudentId(studentPaymentOrder.getUserId());
|
|
|
+ cloudTeacherOrder.setType(2);
|
|
|
+ PeriodEnum periodEnum = activity.getGivePeriodEnum();
|
|
|
+ switch (periodEnum){
|
|
|
+ case DAY:
|
|
|
+ cloudTeacherOrder.setType(1);
|
|
|
+ break;
|
|
|
+ case MONTH:
|
|
|
+ case QUARTERLY:
|
|
|
+ case YEAR_HALF:
|
|
|
+ cloudTeacherOrder.setType(2);
|
|
|
+ break;
|
|
|
+ case YEAR:
|
|
|
+ cloudTeacherOrder.setType(3);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("不支持的周期类型");
|
|
|
+ }
|
|
|
+ Student student = studentDao.get(userId);
|
|
|
+ if (student.getMemberRankSettingId() == null || now.after(student.getMembershipEndTime())) {
|
|
|
+ cloudTeacherOrder.setStartTime(now);
|
|
|
+ switch (periodEnum){
|
|
|
+ case DAY:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addDays(now, activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ case MONTH:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(now, activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ case QUARTERLY:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(now, activity.getGiveMemberTime() * 3));
|
|
|
+ break;
|
|
|
+ case YEAR_HALF:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(now, activity.getGiveMemberTime() * 6));
|
|
|
+ break;
|
|
|
+ case YEAR:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addYears(now, activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("不支持的周期类型");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ cloudTeacherOrder.setStartTime(DateUtil.addDays(student.getMembershipEndTime(), 1));
|
|
|
+ switch (periodEnum){
|
|
|
+ case DAY:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addDays(student.getMembershipEndTime(), activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ case MONTH:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(student.getMembershipEndTime(), activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ case QUARTERLY:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(student.getMembershipEndTime(), activity.getGiveMemberTime() * 3));
|
|
|
+ break;
|
|
|
+ case YEAR_HALF:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addMonths(student.getMembershipEndTime(), activity.getGiveMemberTime() * 6));
|
|
|
+ break;
|
|
|
+ case YEAR:
|
|
|
+ cloudTeacherOrder.setEndTime(DateUtil.addYears(student.getMembershipEndTime(), activity.getGiveMemberTime()));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("不支持的周期类型");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cloudTeacherOrderService.update(cloudTeacherOrder);
|
|
|
+ // 添加会员有效时长
|
|
|
+ studentService.updateMemberRank(cloudTeacherOrder, periodEnum);
|
|
|
+ }
|
|
|
+ }
|
|
|
if(classGroup.getDelFlag()==1){
|
|
|
updateVipGroupStudentNumAndStatus(vipGroupId, classGroup,0,true);
|
|
|
}
|
|
|
@@ -2495,11 +2584,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
|
|
|
|
|
|
- VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
-
|
|
|
//插入缴费明细
|
|
|
//收入
|
|
|
- if(Objects.nonNull(order.getActualAmount())&&order.getActualAmount().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ if(Objects.nonNull(order.getActualAmount()) && order.getActualAmount().compareTo(BigDecimal.ZERO)!=0){
|
|
|
SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
sysUserIncomeCashAccountDetail.setUserId(userId);
|
|
|
sysUserIncomeCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.RECHARGE);
|
|
|
@@ -2541,7 +2628,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
HashSet<Integer> hashSet = new HashSet<>(organIds);
|
|
|
String organIdsString = StringUtils.join(hashSet, ",");
|
|
|
vipGroup.setOrganIdList(organIdsString);
|
|
|
- classGroup=classGroupDao.get(order.getClassGroupId());
|
|
|
+ classGroup = classGroupDao.get(order.getClassGroupId());
|
|
|
if(classGroup.getDelFlag()==0&&classGroup.getExpectStudentNum().equals(classGroup.getStudentNum())){
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
}
|
|
|
@@ -2925,7 +3012,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
classGroupTeacherMapperDao.insert(classGroupTeacherMapper);
|
|
|
}
|
|
|
|
|
|
- Map<String, BigDecimal> salaryMap = countVipGroupPredictFee(vipGroup, vipGroup.getUserId(), null);
|
|
|
+ Map<String, BigDecimal> salaryMap = countVipGroupPredictFee1(vipGroup, vipGroup.getUserId(), null);
|
|
|
|
|
|
//创建老师单节课课酬信息
|
|
|
courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroup,
|
|
|
@@ -3577,7 +3664,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
courseScheduleService.batchAddCourseSchedule(vipGroupApplyDto.getCourseSchedules());
|
|
|
|
|
|
- Map<String, BigDecimal> map = countVipGroupPredictFee(vipGroup, vipGroup.getUserId(), null);
|
|
|
+ Map<String, BigDecimal> map = countVipGroupPredictFee1(vipGroup, vipGroup.getUserId(), null);
|
|
|
|
|
|
BigDecimal teacherSalary=BigDecimal.ZERO;
|
|
|
|
|
|
@@ -3727,7 +3814,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(courseNum==0){
|
|
|
courseScheduleService.batchAddCourseSchedule(courseSchedules);
|
|
|
|
|
|
- Map<String, BigDecimal> salaryMap = countVipGroupPredictFee(vipGroup, vipGroup.getUserId(), null);
|
|
|
+ Map<String, BigDecimal> salaryMap = countVipGroupPredictFee1(vipGroup, vipGroup.getUserId(), null);
|
|
|
|
|
|
//创建老师单节课课酬信息
|
|
|
courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroup,
|