|
@@ -978,6 +978,65 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentApplyRefundsDao.insert(studentApplyRefunds);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void applyRefundForStudent(Long vipGroupId, Integer studentId, BigDecimal amount) {
|
|
|
+ if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
+ throw new BizException("请指定小课与学生");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(amount)){
|
|
|
+ throw new BizException("请确定退费金额");
|
|
|
+ }
|
|
|
+ VipGroup vipGroup=vipGroupDao.get(vipGroupId);
|
|
|
+ if(Objects.isNull(vipGroup)){
|
|
|
+ throw new BizException("指定的课程不存在");
|
|
|
+ }
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
+ sysUserCashAccountService.updateBalance(studentId, amount);
|
|
|
+ SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);
|
|
|
+ SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
|
|
|
+ sysUserCashAccountDetail.setUserId(studentId);
|
|
|
+ sysUserCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS);
|
|
|
+ sysUserCashAccountDetail.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ sysUserCashAccountDetail.setAmount(amount);
|
|
|
+ sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
|
+ sysUserCashAccountDetail.setAttribute(studentId.toString());
|
|
|
+ sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
+
|
|
|
+ ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
|
|
|
+ studentId);
|
|
|
+
|
|
|
+ classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
+ classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
|
+
|
|
|
+ //学员退出班级群
|
|
|
+ ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
|
|
|
+ imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, null));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ 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课");
|
|
|
+ }
|
|
|
+ Map<String,BigDecimal> result=new HashMap<>();
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+ 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);
|
|
|
+ result.put("suplusCourseFee",Objects.isNull(bigDecimal)?new BigDecimal(0):bigDecimal);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void applyRefundAudit(Long id, StudentApplyRefundsStatus status, String remark,BigDecimal amount) {
|