|
@@ -102,6 +102,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
private TeacherAttendanceDao teacherAttendanceDao;
|
|
|
@Autowired
|
|
|
private ClassGroupService classGroupService;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, VipGroup> getDAO() {
|
|
@@ -927,6 +929,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
}
|
|
|
|
|
|
+ Date date=new Date();
|
|
|
+
|
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules,false);
|
|
|
|
|
@@ -942,6 +946,35 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
+ studentPaymentOrderDao.insert(studentPaymentOrder);
|
|
|
+
|
|
|
+ BigDecimal amount=vipGroup.getTotalPrice();
|
|
|
+
|
|
|
+ if(vipGroupBuyParams.isUseBalancePayment() || amount.doubleValue() == 0){
|
|
|
+ SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(vipGroupBuyParams.getUserId());
|
|
|
+ if(userCashAccount == null){
|
|
|
+ throw new BizException("用户账户找不到");
|
|
|
+ }
|
|
|
+ if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() > 0){
|
|
|
+ // 更新订单信息
|
|
|
+ studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
|
+ studentPaymentOrder.setUpdateTime(date);
|
|
|
+ studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
+
|
|
|
+ sysUserCashAccountService.updateBalance(vipGroupBuyParams.getUserId(), amount.negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"乐团续费");
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }else{
|
|
|
+ if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(vipGroupBuyParams.getUserId(), userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团续费");
|
|
|
+ amount = amount.subtract(userCashAccount.getBalance());
|
|
|
+ studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
|
|
|
+ } else {
|
|
|
+ studentPaymentOrder.setBalancePaymentAmount(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// try {
|
|
|
// contractService.register(user.getId(),user.getRealName(),user.getIdCardNo(),user.getPhone());
|
|
@@ -949,18 +982,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
|
|
|
- //生成回调地址
|
|
|
- Map<String,Object> payMap = payService.getPayMap(
|
|
|
- vipGroup.getTotalPrice(),
|
|
|
- orderNo,
|
|
|
- "http://mstudev.dayaedu.com/api-student/studentOrder/notify",
|
|
|
- "http://mstudev.dayaedu.com/#/paymentresult?orderNo=" + orderNo,
|
|
|
- "vip课购买",
|
|
|
- vipGroup.getName());
|
|
|
- studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
- studentPaymentOrderDao.insert(studentPaymentOrder);
|
|
|
-
|
|
|
- return payMap;
|
|
|
+ try {
|
|
|
+ Map<String,Object> payMap = payService.getPayMap(
|
|
|
+ amount,
|
|
|
+ orderNo,
|
|
|
+ "http://mstudev.dayaedu.com/api-student/studentOrder/notify",
|
|
|
+ "http://mstudev.dayaedu.com/#/paymentresult?orderNo=" + orderNo,
|
|
|
+ "vip课购买",
|
|
|
+ vipGroup.getName());
|
|
|
+ studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
+
|
|
|
+ return payMap;
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("调用支付接口出错", e);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|