zouxuan 3 سال پیش
والد
کامیت
8ae1bad6d2
1فایلهای تغییر یافته به همراه45 افزوده شده و 46 حذف شده
  1. 45 46
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

+ 45 - 46
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -447,9 +447,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("请选择指导老师");
 		}
 
-	    if(vipGroup.getCourseSchedules().size()!=(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()+vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())){
-	        throw new BizException("建课失败,当前课程存在未排课课程,请调整相关设置");
-        }
+		if(vipGroup.getCourseSchedules().size()!=(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()+vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())){
+			throw new BizException("建课失败,当前课程存在未排课课程,请调整相关设置");
+		}
 
 		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroup;
 		try {
@@ -460,39 +460,39 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		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("线下课课时数量安排有误");
-        }
+			throw new BizException("线下课课时数量安排有误");
+		}
 
-        if((Objects.isNull(courseScheduleGroup.get(TeachModeEnum.ONLINE))&&vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum()!=0)
+		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("线上课课时数量安排有误");
-        }
+			throw new BizException("线上课课时数量安排有误");
+		}
 
 		if(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()>0
-			&&Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId())){
+				&&Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId())){
 			throw new BizException("请设置教学点");
 		}
 
-        String studentIds=vipGroup.getStudentIds();
+		String studentIds=vipGroup.getStudentIds();
 		List<String> studentIdList=new ArrayList<>();
 		if(StringUtils.isNotBlank(studentIds)){
 			studentIdList = Arrays.asList(studentIds.split(","));
 		}
 
-        Date now=new Date();
+		Date now=new Date();
 
 		VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
 
-        if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
-            &&Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())){
-            throw new BizException("请设置课程单价");
-        }
+		if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
+				&&Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())){
+			throw new BizException("请设置课程单价");
+		}
 
 		if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
 			throw new BizException("请选择学员");
 		}
 
-        if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())){
+		if(Objects.isNull(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary()))){
 			throw new BizException("请设置教师课酬");
 		}
 
@@ -507,13 +507,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		}
 
 		if(vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())){
-		    throw new BizException("报名开始时间必须在报名截至时间之前");
-        }
+			throw new BizException("报名开始时间必须在报名截至时间之前");
+		}
 
 		if(vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
-            ||DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(),firstCourseSchedule.getEndClassTime())){
-		    throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
-        }
+				||DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(),firstCourseSchedule.getEndClassTime())){
+			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();
@@ -529,7 +529,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 					errStudentIds.add(Integer.valueOf(studentIdStr));
 				}
 			}
-			if(errStudentIds.size() > 0){
+			if(errStudentIds.size()>0){
 				List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 				String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
@@ -584,16 +584,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		vipGroupApplyBaseInfoDto.setName(className.toString());
 
 		//计算课程相关费用信息
-		Map<String, BigDecimal> costInfo = countVipGroupPredictFee1(vipGroupApplyBaseInfoDto,
-				vipGroupApplyBaseInfoDto.getUserId(), null);
+		Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
+				vipGroupApplyBaseInfoDto.getUserId());
 
-        vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
+		vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
 
 		//如果默认课酬与实际课酬不匹配则需要审批
-//		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary()) < 0
-//			&& StringUtils.isBlank(studentIds)){
-//			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
-//		}
+		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())<0 && StringUtils.isBlank(studentIds)){
+			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
+		}
 
 		vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
 		if(StringUtils.isNotBlank(studentIds)){
@@ -604,16 +603,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(CollectionUtils.isEmpty(vscps)){
 			vscps = new ArrayList<>();
 			for (Integer canBuyStudentId : canBuyStudentIds) {
-				vscps.add(new VipGroupStudentCoursePrice(canBuyStudentId, vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getTotalPrice()));
+				vscps.add(new VipGroupStudentCoursePrice(canBuyStudentId, vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice(), vipGroupApplyBaseInfoDto.getTotalPrice()));
 			}
 		}
-        Teacher teacher = teacherService.get(vipGroupApplyBaseInfoDto.getUserId());
+		Teacher teacher = teacherService.get(vipGroupApplyBaseInfoDto.getUserId());
 		if(Objects.isNull(teacher)){
-		    throw new BizException("教师不存在");
-        }
+			throw new BizException("教师不存在");
+		}
 		if(Objects.isNull(teacher.getTeacherOrganId())){
-		    throw new BizException("教师部门异常");
-        }
+			throw new BizException("教师部门异常");
+		}
 //        vipGroupApplyBaseInfoDto.setOrganId(Integer.parseInt(teacher.getOrganId()));
 		//开课时间为排课的第一节课的开始时间
 		vipGroupApplyBaseInfoDto.setCourseStartDate(firstCourseSchedule.getStartClassTime());
@@ -622,11 +621,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		vipGroupApplyBaseInfoDto.setPaymentExpireDate(DateUtil.getLastSecondWithDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate()));
 
-        VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), vipGroup.getVipGroupApplyBaseInfo().getOrganId());
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), vipGroup.getVipGroupApplyBaseInfo().getOrganId());
 
-        if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
-            vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
-        }else{
+		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
+			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
+		}else{
 			if(Objects.nonNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
 					&&vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice())!=0){
 				vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
@@ -635,13 +634,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 					&&vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice())!=0){
 				vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
 			}
-        }
+		}
 
-        if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
+		if(StringUtils.isBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
 			vipGroupApplyBaseInfoDto.setStudentIdList(StringUtils.join(vscps.stream().map(VipGroupStudentCoursePrice::getStudentId).collect(Collectors.toList()), ","));
 		}
 
-        if(vipGroup.getOnlyProgress()){
+		if(vipGroup.getOnlyProgress()){
 			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
 		}
 
@@ -650,7 +649,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		vscps.forEach(e->e.setVipGroupId(vipGroupApplyBaseInfoDto.getId()));
 		vipGroupStudentCoursePriceDao.batchInsert(vscps);
 
-        vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfoDto.getId());
+		vipGroup.getVipGroupApplyBaseInfo().setId(vipGroupApplyBaseInfoDto.getId());
 
 		//创建班级信息
 		ClassGroup classGroup=new ClassGroup();
@@ -698,13 +697,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		vipGroup.getCourseSchedules().forEach(courseSchedule -> {
 			courseSchedule.setGroupType(GroupType.VIP);
 			courseSchedule.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
-		    if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
+			if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
 				courseSchedule.setSchoolId(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId());
 			}
-		    courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId());
+			courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId());
 			courseSchedule.setActualTeacherId(vipGroupApplyBaseInfoDto.getUserId());
 			courseSchedule.setStatus(CourseStatusEnum.NOT_START);
-		    courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
+			courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
 			courseSchedule.setClassGroupId(classGroup.getId());
 			courseSchedule.setName(vipGroupApplyBaseInfoDto.getName());
 			courseSchedule.setOrganId(vipGroupApplyBaseInfoDto.getOrganId());