|
@@ -288,6 +288,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
//课程结束时间为排课的最后一节课的结束时间
|
|
|
vipGroupApplyBaseInfoDto.setCoursesExpireDate(latestCourseSchedule.getEndClassTime());
|
|
|
|
|
|
+ vipGroupApplyBaseInfoDto.setPaymentExpireDate(DateUtil.getLastSecondWithDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate()));
|
|
|
+
|
|
|
//获取vip课类型信息
|
|
|
VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId().intValue());
|
|
|
|
|
@@ -387,7 +389,40 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void checkVipCourseIsInScore(Long vipGroupId) {
|
|
|
+ if(Objects.isNull(vipGroupId)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ VipGroup vipGroup=vipGroupDao.get(vipGroupId);
|
|
|
+ if(Objects.isNull(vipGroup)){
|
|
|
+ throw new BizException("课程不存在");
|
|
|
+ }
|
|
|
+ Date groupCourseStartTime=courseScheduleDao.findGroupCourseStartTime(GroupType.VIP,vipGroupId.toString());
|
|
|
+ Date groupCourseEndTime=courseScheduleDao.findGroupCourseEndTime(GroupType.VIP,vipGroupId.toString());
|
|
|
+
|
|
|
+ //获取活动信息
|
|
|
+ VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
|
|
|
+ if(Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime())){
|
|
|
+ if(groupCourseEndTime.after(vipGroupActivity.getCoursesEndTime())
|
|
|
+ ||groupCourseStartTime.before(vipGroupActivity.getCoursesStartTime())){
|
|
|
+ throw new BizException("课时安排时间超出范围!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ int totalClassTimes = courseScheduleDao.countGroupAllCourses(GroupType.VIP, vipGroupId.toString());
|
|
|
+ VipGroupDefaultClassesCycle vipGroupDefaultClassesCycle = vipGroupDefaultClassesCycleDao.findByOrganAndClassTimes(totalClassTimes);
|
|
|
+
|
|
|
+ if (vipGroupDefaultClassesCycle != null) {
|
|
|
+ int month = DateUtil.monthsBetween(groupCourseStartTime, groupCourseEndTime);
|
|
|
+ if (month > vipGroupDefaultClassesCycle.getMonth()) {
|
|
|
+ throw new BizException("课时安排时间超出范围!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateVipGroup(VipGroupApplyDto vipGroupApplyInfo) {
|
|
|
VipGroupApplyBaseInfoDto vipGroupUpdateInfo = vipGroupApplyInfo.getVipGroupApplyBaseInfo();
|
|
@@ -472,9 +507,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
map.put(vipGroup.getUserId(),vipGroup.getUserId().toString());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,MessageTypeEnum.TEACHER_SMS_VIP_COURSE_APPLY_RESULT,
|
|
|
map,null,0,"7","TEACHER",vipGroup.getName(),vipGroup.getAuditStatus().getMsg());
|
|
|
- map.put(vipGroup.getUserId(),teacher.getPhone());
|
|
|
+ Map<Integer,String> map1 = new HashMap<>(1);
|
|
|
+ map1.put(vipGroup.getUserId(),teacher.getPhone());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,MessageTypeEnum.TEACHER_SMS_VIP_COURSE_APPLY_RESULT,
|
|
|
- map,null,0,"7","",vipGroup.getName(),vipGroup.getAuditStatus().getMsg());
|
|
|
+ map1,null,0,"7","",vipGroup.getName(),vipGroup.getAuditStatus().getMsg());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1661,59 +1697,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return studentRecoverInfoDto;
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// @Transactional(rollbackFor = Exception.class)
|
|
|
-// public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
-// if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
-// throw new BizException("请指定课程和学生");
|
|
|
-// }
|
|
|
-// VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
-// if(Objects.isNull(vipGroup)){
|
|
|
-// throw new BizException("未找到指定vip课");
|
|
|
-// }
|
|
|
-// if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
-// throw new BizException("不能对已停止的课程进行退课操作");
|
|
|
-// }
|
|
|
-// Date now = new Date();
|
|
|
-// BigDecimal bigDecimal;
|
|
|
-// List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
|
|
|
-// if(CollectionUtils.isEmpty(userCourseInfos)&&vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
-// StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
-// if(Objects.isNull(studentPaymentOrder)){
|
|
|
-// bigDecimal=new BigDecimal(0);
|
|
|
-// }else{
|
|
|
-// bigDecimal=studentPaymentOrder.getActualAmount();
|
|
|
-// }
|
|
|
-// }else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
|
-// BigDecimal historyPrice=new BigDecimal(0);
|
|
|
-// BigDecimal allPrice=new BigDecimal(0);
|
|
|
-// for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
|
-// allPrice=allPrice.add(userCourseInfo.getExpectPrice());
|
|
|
-// if(now.after(userCourseInfo.getStartClassTime())){
|
|
|
-// historyPrice=historyPrice.add(userCourseInfo.getTeachMode().equals(TeachModeEnum.ONLINE)?vipGroup.getOnlineClassesUnitPrice():vipGroup.getOfflineClassesUnitPrice());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// bigDecimal=allPrice.subtract(historyPrice);
|
|
|
-// if(bigDecimal.longValue()<0){
|
|
|
-// bigDecimal=new BigDecimal(0);
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// bigDecimal=new BigDecimal(0);
|
|
|
-// }
|
|
|
-// Map<String,BigDecimal> result=new HashMap<>();
|
|
|
-// ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
-// if(Objects.isNull(classGroup)){
|
|
|
-// throw new BizException("未找到对应班级");
|
|
|
-// }
|
|
|
-// if(Objects.isNull(bigDecimal)){
|
|
|
-// bigDecimal = new BigDecimal(0);
|
|
|
-// }
|
|
|
-// bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
|
|
|
-// result.put("suplusCourseFee", bigDecimal);
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
@@ -1726,26 +1710,37 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
throw new BizException("不能对已停止的课程进行退课操作");
|
|
|
}
|
|
|
- Map<String,BigDecimal> result=new HashMap<>();
|
|
|
- if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
- if(Objects.isNull(studentPaymentOrder)){
|
|
|
- BigDecimal surplusCourseFee = studentPaymentOrderDao.sumSurplusCourseFee(vipGroupId.toString(), studentId);
|
|
|
- if(Objects.isNull(surplusCourseFee)){
|
|
|
- result.put("suplusCourseFee",new BigDecimal(0));
|
|
|
- }else{
|
|
|
- result.put("suplusCourseFee",surplusCourseFee);
|
|
|
- }
|
|
|
- }else{
|
|
|
- result.put("suplusCourseFee",studentPaymentOrder.getActualAmount());
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
+ Date now = new Date();
|
|
|
+ BigDecimal bigDecimal;
|
|
|
+ List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
|
|
|
+ if(CollectionUtils.isEmpty(userCourseInfos)&&vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+ if(Objects.isNull(studentPaymentOrder)){
|
|
|
+ bigDecimal=new BigDecimal(0);
|
|
|
+ }else{
|
|
|
+ bigDecimal=studentPaymentOrder.getActualAmount();
|
|
|
+ }
|
|
|
+ }else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
|
+ BigDecimal historyPrice=new BigDecimal(0);
|
|
|
+ BigDecimal allPrice=new BigDecimal(0);
|
|
|
+ for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
|
+ allPrice=allPrice.add(userCourseInfo.getExpectPrice());
|
|
|
+ if(now.after(userCourseInfo.getStartClassTime())){
|
|
|
+ historyPrice=historyPrice.add(userCourseInfo.getTeachMode().equals(TeachModeEnum.ONLINE)?vipGroup.getOnlineClassesUnitPrice():vipGroup.getOfflineClassesUnitPrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bigDecimal=allPrice.subtract(historyPrice);
|
|
|
+ if(bigDecimal.longValue()<0){
|
|
|
+ bigDecimal=new BigDecimal(0);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ bigDecimal=new BigDecimal(0);
|
|
|
+ }
|
|
|
+ Map<String,BigDecimal> result=new HashMap<>();
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
if(Objects.isNull(classGroup)){
|
|
|
throw new BizException("未找到对应班级");
|
|
|
}
|
|
|
- BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
|
|
|
if(Objects.isNull(bigDecimal)){
|
|
|
bigDecimal = new BigDecimal(0);
|
|
|
}
|
|
@@ -1754,6 +1749,47 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+// @Override
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
+// if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
+// throw new BizException("请指定课程和学生");
|
|
|
+// }
|
|
|
+// VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
+// if(Objects.isNull(vipGroup)){
|
|
|
+// throw new BizException("未找到指定vip课");
|
|
|
+// }
|
|
|
+// if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
+// throw new BizException("不能对已停止的课程进行退课操作");
|
|
|
+// }
|
|
|
+// Map<String,BigDecimal> result=new HashMap<>();
|
|
|
+// if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
+// StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+// if(Objects.isNull(studentPaymentOrder)){
|
|
|
+// BigDecimal surplusCourseFee = studentPaymentOrderDao.sumSurplusCourseFee(vipGroupId.toString(), studentId);
|
|
|
+// if(Objects.isNull(surplusCourseFee)){
|
|
|
+// result.put("suplusCourseFee",new BigDecimal(0));
|
|
|
+// }else{
|
|
|
+// result.put("suplusCourseFee",surplusCourseFee);
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// result.put("suplusCourseFee",studentPaymentOrder.getActualAmount());
|
|
|
+// }
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
+// if(Objects.isNull(classGroup)){
|
|
|
+// throw new BizException("未找到对应班级");
|
|
|
+// }
|
|
|
+// BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
|
|
|
+// if(Objects.isNull(bigDecimal)){
|
|
|
+// bigDecimal = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
|
|
|
+// result.put("suplusCourseFee", bigDecimal);
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void applyRefundAudit(Long id, StudentApplyRefundsStatus status, String remark,BigDecimal amount) {
|