|
@@ -89,6 +89,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleRewardsRulesService courseScheduleRewardsRulesService;
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
|
|
@@ -136,9 +138,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
className.append("•");
|
|
|
className.append(vipGroupApplyBaseInfoDto.getName());
|
|
|
vipGroupApplyBaseInfoDto.setName(className.toString());
|
|
|
- vipGroupApplyBaseInfoDto.setTotalPrice(countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
+
|
|
|
+ //计算课程相关费用信息
|
|
|
+ Map<String, BigDecimal> costInfo = countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
|
|
|
vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
|
|
|
- vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice()).get("totalPrice"));
|
|
|
+ vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
|
|
|
+
|
|
|
+ //如果默认课酬与实际课酬不匹配则需要审批
|
|
|
+ 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);
|
|
@@ -205,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>();
|
|
@@ -422,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());
|
|
@@ -439,46 +478,59 @@ 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);
|
|
|
BigDecimal offlineVipGroupCharge = offlineClassesUnitPrice.multiply(offlineClassNum);
|
|
|
|
|
|
- //教师课酬线上单课酬计算
|
|
|
- switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
|
|
|
- case TEACHER_DEFAULT:
|
|
|
- if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
- throw new BizException("未设置教师默认课酬");
|
|
|
- }
|
|
|
- results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
|
|
|
- break;
|
|
|
- case RATIO_DISCOUNT:
|
|
|
- results.put("onlineTeacherSalary",onlineClassesUnitPrice.multiply((vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())));
|
|
|
- break;
|
|
|
- case FIXED_SALARY:
|
|
|
- results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("未指定课酬结算标准!");
|
|
|
+ if(vipGroup.getOnlineClassesNum()>0){
|
|
|
+ //教师课酬线上单课酬计算
|
|
|
+ switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
|
|
|
+ case TEACHER_DEFAULT:
|
|
|
+ if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
+ throw new BizException("未设置教师默认课酬");
|
|
|
+ }
|
|
|
+ results.put("onlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
|
|
|
+ break;
|
|
|
+ case RATIO_DISCOUNT:
|
|
|
+ results.put("onlineTeacherSalary",onlineClassesUnitPrice.multiply((vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue())));
|
|
|
+ break;
|
|
|
+ case FIXED_SALARY:
|
|
|
+ results.put("onlineTeacherSalary",vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("未指定课酬结算标准!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ results.put("onlineTeacherSalary",new BigDecimal(0));
|
|
|
}
|
|
|
- //教师线下单课酬计算
|
|
|
- switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
|
|
|
- case TEACHER_DEFAULT:
|
|
|
- if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
- throw new BizException("未设置教师默认课酬");
|
|
|
- }
|
|
|
- results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary());
|
|
|
- break;
|
|
|
- case RATIO_DISCOUNT:
|
|
|
- results.put("offlineTeacherSalary",offlineClassesUnitPrice.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
|
|
|
- break;
|
|
|
- case FIXED_SALARY:
|
|
|
- results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("未指定课酬结算标准!");
|
|
|
+
|
|
|
+ if(vipGroup.getOfflineClassesNum()>0){
|
|
|
+ //教师线下单课酬计算
|
|
|
+ switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
|
|
|
+ case TEACHER_DEFAULT:
|
|
|
+ if(Objects.isNull(teacherDefaultVipGroupSalary)){
|
|
|
+ throw new BizException("未设置教师默认课酬");
|
|
|
+ }
|
|
|
+ results.put("offlineTeacherSalary",teacherDefaultVipGroupSalary.getOfflineClassesSalary().multiply(classTimeDuty));
|
|
|
+ break;
|
|
|
+ case RATIO_DISCOUNT:
|
|
|
+ results.put("offlineTeacherSalary",offlineClassesUnitPrice.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
|
|
|
+ break;
|
|
|
+ case FIXED_SALARY:
|
|
|
+ results.put("offlineTeacherSalary",vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("未指定课酬结算标准!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ results.put("offlineTeacherSalary",new BigDecimal(0));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//课程购买费用计算
|
|
|
BigDecimal totalPrice;
|
|
|
switch (vipGroupActivity.getType()){
|
|
@@ -580,7 +632,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
Map payMap = payService.getPayMap(
|
|
|
vipGroup.getTotalPrice(),
|
|
|
orderNo,
|
|
|
- "https://pay.dayaedu.com/api/yqpay/notify",
|
|
|
+ "http://47.99.212.176:8000/api-student/studentOrder/notify",
|
|
|
"http://dev.dayaedu.com",
|
|
|
"vip课购买",
|
|
|
vipGroup.getName());
|
|
@@ -591,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){
|
|
@@ -653,47 +705,47 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void applyRefundAudit(StudentApplyRefunds studentApplyRefunds) {
|
|
|
- if(Objects.isNull(studentApplyRefunds.getId())){
|
|
|
- throw new BizException("请指定退费订单!");
|
|
|
- }
|
|
|
+ public void applyRefundAudit(Long id, AuditStatusEnum status, String remark) {
|
|
|
|
|
|
- StudentApplyRefunds oldStudentApplyRefunds=studentApplyRefundsDao.get(studentApplyRefunds.getId());
|
|
|
+ StudentApplyRefunds studentApplyRefunds = studentApplyRefundsDao.get(id);
|
|
|
+ if (studentApplyRefunds == null) {
|
|
|
+ throw new BizException("退课申请记录不存在");
|
|
|
+ }
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(oldStudentApplyRefunds.getOrigPaymentOrderId());
|
|
|
- if(null==studentPaymentOrder){
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(studentApplyRefunds.getOrigPaymentOrderId());
|
|
|
+ if (null == studentPaymentOrder) {
|
|
|
throw new BizException("未找到原订单信息!");
|
|
|
}
|
|
|
|
|
|
- oldStudentApplyRefunds.setStatus(studentApplyRefunds.getStatus());
|
|
|
- if(null==studentApplyRefunds.getActualAmount()){
|
|
|
- oldStudentApplyRefunds.setActualAmount(oldStudentApplyRefunds.getExpectAmount());
|
|
|
- }else{
|
|
|
- oldStudentApplyRefunds.setActualAmount(studentApplyRefunds.getActualAmount());
|
|
|
- }
|
|
|
- oldStudentApplyRefunds.setRemark(studentApplyRefunds.getRemark());
|
|
|
- studentApplyRefundsDao.update(oldStudentApplyRefunds);
|
|
|
- switch (studentApplyRefunds.getStatus()){
|
|
|
- case PASS:
|
|
|
- sysUserCashAccountService.updateBalance(oldStudentApplyRefunds.getUserId(),oldStudentApplyRefunds.getActualAmount());
|
|
|
- SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
- SysUserCashAccountDetail sysUserCashAccountDetail=new SysUserCashAccountDetail();
|
|
|
- sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
- sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
- sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
- sysUserCashAccountDetail.setAmount(oldStudentApplyRefunds.getActualAmount());
|
|
|
- sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
- sysUserCashAccountDetail.setAttribute(oldStudentApplyRefunds.getId().toString());
|
|
|
- sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
-
|
|
|
- classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(),
|
|
|
- studentPaymentOrder.getUserId().longValue());
|
|
|
- break;
|
|
|
- case REJECT:
|
|
|
+ studentApplyRefunds.setStatus(status);
|
|
|
+ if (studentApplyRefunds.getStatus() == AuditStatusEnum.PASS) {
|
|
|
+ studentApplyRefunds.setActualAmount(studentApplyRefunds.getExpectAmount());
|
|
|
+ } else {
|
|
|
+ studentApplyRefunds.setActualAmount(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ studentApplyRefunds.setRemark(remark);
|
|
|
+ studentApplyRefundsDao.update(studentApplyRefunds);
|
|
|
+ switch (studentApplyRefunds.getStatus()) {
|
|
|
+ case PASS:
|
|
|
+ sysUserCashAccountService.updateBalance(studentApplyRefunds.getUserId(), studentApplyRefunds.getActualAmount());
|
|
|
+ SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentApplyRefunds.getUserId().intValue());
|
|
|
+ SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
+ sysUserCashAccountDetail.setUserId(studentApplyRefunds.getUserId());
|
|
|
+ sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
+ sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ sysUserCashAccountDetail.setAmount(studentApplyRefunds.getActualAmount());
|
|
|
+ sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
+ sysUserCashAccountDetail.setAttribute(studentApplyRefunds.getId().toString());
|
|
|
+ sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("审核状态错误!");
|
|
|
+ classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(), studentPaymentOrder.getUserId()
|
|
|
+ .longValue());
|
|
|
+ break;
|
|
|
+ case REJECT:
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new BizException("审核状态错误!");
|
|
|
}
|
|
|
}
|
|
|
|