|
@@ -89,6 +89,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleRewardsRulesService courseScheduleRewardsRulesService;
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
|
|
@@ -137,13 +139,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
className.append(vipGroupApplyBaseInfoDto.getName());
|
|
|
vipGroupApplyBaseInfoDto.setName(className.toString());
|
|
|
|
|
|
- Map<String, BigDecimal> stringBigDecimalMap = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
+ //计算课程相关费用信息
|
|
|
+ Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
|
|
|
vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
|
|
|
|
|
|
- vipGroupApplyBaseInfoDto.setTotalPrice(countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
- vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
|
|
|
- vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice()).get("totalPrice"));
|
|
|
+ //如果默认课酬与实际课酬不匹配则需要审批
|
|
|
+ if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())!=0||
|
|
|
+ costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())!=0){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ }else{
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
+ }
|
|
|
+
|
|
|
+ vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
|
|
|
vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
|
|
|
vipGroupApplyBaseInfoDto.setOrganId(sysUser.getOrganId());
|
|
|
vipGroupDao.insert(vipGroupApplyBaseInfoDto);
|
|
@@ -210,6 +219,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void vipApplyAudit(Long vipGroupId, AuditStatusEnum auditStatus, String reason) {
|
|
|
+ if(Objects.isNull(vipGroupId)||Objects.isNull(auditStatus)){
|
|
|
+ throw new BizException("请指定vip课及审核结果");
|
|
|
+ }
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
|
+ if(Objects.isNull(vipGroup)){
|
|
|
+ throw new BizException("vip课不存在");
|
|
|
+ }
|
|
|
+ if(vipGroup.getAuditStatus()!=AuditStatusEnum.ING){
|
|
|
+ throw new BizException("该课程已被审核");
|
|
|
+ }
|
|
|
+ if(auditStatus==AuditStatusEnum.REJECT&&StringUtils.isBlank(reason)){
|
|
|
+ throw new BizException("请填写拒绝原因");
|
|
|
+ }
|
|
|
+ vipGroup.setAuditStatus(auditStatus);
|
|
|
+ vipGroup.setStopReason(reason);
|
|
|
+ vipGroupDao.update(vipGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public PageInfo findStudentVipGroupList(StudentVipGroupQueryInfo queryInfo) {
|
|
|
PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
@@ -427,7 +456,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("请指定课程形式");
|
|
|
}
|
|
|
|
|
|
- TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());
|
|
|
+ if(Objects.isNull(vipGroupCategory)){
|
|
|
+ throw new BizException("未找到课程形式");
|
|
|
+ }
|
|
|
+
|
|
|
+ TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
|
|
|
vipGroup.getVipGroupCategoryId());
|
|
|
|
|
|
VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
|
|
@@ -444,6 +478,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
Map<String,BigDecimal> results=new HashMap<>(1);
|
|
|
|
|
|
+ BigDecimal teacherSalaryTimeUnit=new BigDecimal(sysConfigService.findByParamName(SysConfigService.TEACHER_SALARY_TIME_UNIT).getParanValue());
|
|
|
+ //课程时长与结算单位时长占比
|
|
|
+ BigDecimal classTimeDuty=new BigDecimal(vipGroupCategory.getSingleClassMinutes()).divide(teacherSalaryTimeUnit);
|
|
|
BigDecimal offlineClassNum=new BigDecimal(vipGroup.getOfflineClassesNum());
|
|
|
BigDecimal onlineClassNum=new BigDecimal(vipGroup.getOnlineClassesNum());
|
|
|
BigDecimal onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum);
|
|
@@ -456,7 +493,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
throw new BizException("未设置教师默认课酬");
|
|
|
}
|
|
|
- results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
|
|
|
+ results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
|
|
|
break;
|
|
|
case RATIO_DISCOUNT:
|
|
|
results.put("onlineTeacherSalary",onlineClassesUnitPrice.multiply((vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())));
|
|
@@ -478,7 +515,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
throw new BizException("未设置教师默认课酬");
|
|
|
}
|
|
|
- results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
|
|
|
+ results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
|
|
|
break;
|
|
|
case RATIO_DISCOUNT:
|
|
|
results.put("offlineTeacherSalary",offlineClassesUnitPrice.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
|
|
@@ -606,13 +643,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void orderCallback(String callbackParams) {
|
|
|
+ public void orderCallback(StudentPaymentOrder order) {
|
|
|
/*
|
|
|
根据回调信息调整订单状态及vip课程状态等相关信息
|
|
|
*/
|
|
|
- Long vipGroupId=1L;
|
|
|
- Integer userId = 1;
|
|
|
- boolean isOk=true;
|
|
|
+ Long vipGroupId=Long.parseLong(order.getMusicGroupId());
|
|
|
+ Integer userId = order.getUserId();
|
|
|
+ boolean isOk=order.getStatus().equals(DealStatusEnum.SUCCESS);
|
|
|
|
|
|
//将学生加入到班级,更新班级报名状态及人数信息
|
|
|
if(!isOk){
|