|
@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService {
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private VipGroupDao vipGroupDao;
|
|
|
@Autowired
|
|
@@ -137,6 +137,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
private OrganizationDao organizationDao;
|
|
|
@Autowired
|
|
|
private GroupClassService groupClassService;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory
|
|
|
.getLogger(VipGroup.class);
|
|
@@ -233,7 +235,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
}else{
|
|
|
VipGroupDefaultClassesCycle vipGroupDefaultClassesCycle = vipGroupDefaultClassesCycleDao.findByOrganAndClassTimes(totalClassTimes);
|
|
|
-
|
|
|
+
|
|
|
if (vipGroupDefaultClassesCycle != null) {
|
|
|
int month = DateUtil.monthsBetween(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
|
|
|
if (month > vipGroupDefaultClassesCycle.getMonth()) {
|
|
@@ -1242,7 +1244,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) {
|
|
|
+ public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
if(user == null){
|
|
|
throw new BizException("用户信息获取失败");
|
|
@@ -1321,11 +1323,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
+ studentPaymentOrder.setOrganId(vipGroup.getOrganId());
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
studentPaymentOrderDao.insert(studentPaymentOrder);
|
|
|
|
|
|
BigDecimal amount=vipGroup.getTotalPrice();
|
|
|
+ BigDecimal balance = BigDecimal.ZERO;
|
|
|
if("36".equals(user.getOrganId())){
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, vipGroup.getOrganId(), vipGroup.getTotalPrice());
|
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
@@ -1342,6 +1347,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() >= 0){
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, vipGroup.getOrganId(), vipGroup.getTotalPrice());
|
|
|
// 更新订单信息
|
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
@@ -1360,7 +1366,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return result;
|
|
|
}else{
|
|
|
if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
|
- sysUserCashAccountService.updateBalance(user.getId(), userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
|
|
|
+ balance = userCashAccount.getBalance();
|
|
|
+ sysUserCashAccountService.updateBalance(user.getId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
|
|
|
amount = amount.subtract(userCashAccount.getBalance());
|
|
|
studentPaymentOrder.setActualAmount(amount);
|
|
|
studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
|
|
@@ -1384,17 +1391,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
classFee.put("instrument",BigDecimal.ZERO);
|
|
|
classFee.put("accessories",BigDecimal.ZERO);
|
|
|
classFee.put("other",BigDecimal.ZERO);
|
|
|
- try {
|
|
|
Map<String,Object> payMap = payService.getPayMap(
|
|
|
amount,
|
|
|
+ balance,
|
|
|
orderNo,
|
|
|
baseApiUrl+"/api-student/studentOrder/notify",
|
|
|
baseApiUrl+"/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
"vip课购买",
|
|
|
vipGroup.getName(),
|
|
|
- user.getId(),
|
|
|
- classFee,
|
|
|
- vipGroup.getOrganId()
|
|
|
+ vipGroup.getOrganId(),
|
|
|
+ "vipBuy"
|
|
|
);
|
|
|
|
|
|
Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee");
|
|
@@ -1408,9 +1414,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
|
|
|
return payMap;
|
|
|
- } catch (Exception e) {
|
|
|
- throw new BizException("调用支付接口出错", e);
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -2059,7 +2062,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if (null == studentPaymentOrder) {
|
|
|
throw new BizException("未找到原订单信息!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(status ==StudentApplyRefundsStatus.ING){
|
|
|
throw new BizException("状态不正确");
|
|
|
}
|
|
@@ -2925,7 +2928,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
if(noCreateSuccessVipGroups != null && noCreateSuccessVipGroups.size() > 0){
|
|
|
vipGroupDao.batchUpdate(noCreateSuccessVipGroups);
|
|
|
-
|
|
|
+
|
|
|
for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) {
|
|
|
//推送消息
|
|
|
if(noCreateSuccessVipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) {
|