|
@@ -6,6 +6,7 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -28,11 +29,6 @@ import com.ym.mec.biz.dal.entity.Student;
|
|
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
|
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.PeriodEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
@@ -128,7 +124,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if(activeRemark.equals(202109)){
|
|
if(activeRemark.equals(202109)){
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findByUserAndActive(userId,activeRemark,remark);
|
|
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findByUserAndActive(userId,activeRemark,remark,null);
|
|
if(studentPaymentOrder != null){
|
|
if(studentPaymentOrder != null){
|
|
DealStatusEnum status = studentPaymentOrder.getStatus();
|
|
DealStatusEnum status = studentPaymentOrder.getStatus();
|
|
if(status == DealStatusEnum.SUCCESS){
|
|
if(status == DealStatusEnum.SUCCESS){
|
|
@@ -414,6 +410,38 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
|
|
|
|
+ public Object ActiveBuy(Integer userId, Integer memberRankId, PeriodEnum month, BigDecimal amount, boolean isUseBalance, Integer buyNum, int giveNum, int activeRemark, String remark) throws Exception {
|
|
|
|
+ //判断用户是否已存在订单
|
|
|
|
+ StudentPaymentOrder applyOrder = studentPaymentOrderService.findByUserAndActive(userId,202109,remark,"ING");
|
|
|
|
+ if (applyOrder != null) {
|
|
|
|
+ // 查询订单状态
|
|
|
|
+ PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
|
+ if(payStatus == PayStatus.SUCCESSED){
|
|
|
|
+ throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
|
+ }else if(payStatus == PayStatus.PAYING){
|
|
|
|
+ throw new BizException("订单还在交易中,请稍后重试");
|
|
|
|
+ }
|
|
|
|
+ //处理关闭订单
|
|
|
|
+ applyOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
|
+ applyOrder.setMemo("关闭云教练活动订单");
|
|
|
|
+ if (applyOrder.getBalancePaymentAmount() != null && applyOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
+ sysUserCashAccountService.updateBalance(applyOrder.getUserId(), applyOrder.getBalancePaymentAmount(),
|
|
|
|
+ PlatformCashAccountDetailTypeEnum.REFUNDS, "购买云教练活动支付失败");
|
|
|
|
+ }
|
|
|
|
+ studentPaymentOrderService.update(applyOrder);
|
|
|
|
+ }
|
|
|
|
+ return this.buy(userId,
|
|
|
|
+ memberRankId,
|
|
|
|
+ month,
|
|
|
|
+ amount,
|
|
|
|
+ isUseBalance,
|
|
|
|
+ buyNum,
|
|
|
|
+ giveNum,
|
|
|
|
+ activeRemark,remark);
|
|
|
|
+ }
|
|
|
|
+
|
|
//云教练活动赠送优惠券
|
|
//云教练活动赠送优惠券
|
|
public void cloudTeacherActiveGiveCoupon(CloudTeacherOrder cloudTeacherOrder){
|
|
public void cloudTeacherActiveGiveCoupon(CloudTeacherOrder cloudTeacherOrder){
|
|
Integer activeRemark = cloudTeacherOrder.getActiveRemark();
|
|
Integer activeRemark = cloudTeacherOrder.getActiveRemark();
|