|
@@ -288,6 +288,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (chargeInfo == null) {
|
|
|
throw new BizException("支付项不存在");
|
|
|
}
|
|
|
+ if (chargeInfo.getOpenFlag().equals(1)) {
|
|
|
+ throw new BizException("项目已关闭");
|
|
|
+ }
|
|
|
BigDecimal amount = chargeInfo.getAmount();
|
|
|
if (chargeInfo.getDiscountAmount() != null && chargeInfo.getDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
amount = amount.subtract(chargeInfo.getDiscountAmount());
|
|
@@ -296,7 +299,31 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("订单金额异常");
|
|
|
}
|
|
|
|
|
|
+ if (chargeInfo.getMaxNum() != null) {
|
|
|
+ //重试避免人数过多频繁冲突
|
|
|
+ boolean flag = false;
|
|
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
+ chargeInfo = sporadicChargeInfoDao.get(sporadicPayDto.getSporadicId());
|
|
|
+ if (chargeInfo.getMaxNum() >= chargeInfo.getPaidNum()) {
|
|
|
+ throw new BizException("活动人数暂时已满,请稍后再试");
|
|
|
+ }
|
|
|
+ chargeInfo.setPaidNum(chargeInfo.getPaidNum() + 1);
|
|
|
+ chargeInfo.setUpdateTime(new Date());
|
|
|
+ int update = sporadicChargeInfoDao.update(chargeInfo);
|
|
|
+ if (update > 0) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ throw new BizException("活动火爆,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
OrderTypeEnum type = OrderTypeEnum.SPORADIC;
|
|
|
+ if (chargeInfo.getChargeType().equals(SporadicChargeTypeEnum.DOUBLE_ELEVEN2020)) {
|
|
|
+ type = OrderTypeEnum.DOUBLE_ELEVEN2020;
|
|
|
+ }
|
|
|
|
|
|
Integer userId = sporadicPayDto.getUserId();
|
|
|
String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
@@ -522,7 +549,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
String channelType = "";
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, courseForms,remitFee,courseRemitFee);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, courseForms, remitFee, courseRemitFee);
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
|
|
|
Date date = new Date();
|
|
@@ -729,7 +756,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
String channelType = "";
|
|
|
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder, courseForms,remitFee,courseRemitFee);
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentRegistrationService.reAddOrder(userId, amount, orderNo, channelType, courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(), ApplyOrder, courseForms, remitFee, courseRemitFee);
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
Date date = new Date();
|
|
|
|
|
@@ -1330,7 +1357,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean extensionApplyExpireDate(String musicGroupId, Date expireDate) {
|
|
|
+ public boolean extensionApplyExpireDate(String musicGroupId, Date expireDate) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null) {
|
|
|
throw new BizException("用户信息获取失败");
|
|
@@ -1357,7 +1384,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public boolean applyQuitMusicGroup(String musicGroupId) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
@@ -1419,7 +1446,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
|
|
|
classGroupService.delSingle(classGroupId);
|
|
|
} else {
|
|
|
- classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId,true);
|
|
|
+ classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId, true);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1521,7 +1548,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
|
|
|
classGroupService.delSingle(classGroupId);
|
|
|
} else {
|
|
|
- classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId,true);
|
|
|
+ classGroupStudentMapperService.delClassGroupStudent(userId, classGroupId, true);
|
|
|
}
|
|
|
}
|
|
|
|