mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-08 12:00:11 +08:00
支付占桩订单
This commit is contained in:
@@ -2907,7 +2907,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||||||
}
|
}
|
||||||
BigDecimal principalAmount = memberVO.getPrincipalBalance(); // 会员剩余本金金额
|
BigDecimal principalAmount = memberVO.getPrincipalBalance(); // 会员剩余本金金额
|
||||||
// BigDecimal giftAmount = memberVO.getGiftBalance(); // 会员剩余赠送余额
|
BigDecimal giftAmount = memberVO.getGiftBalance(); // 会员剩余赠送余额
|
||||||
|
|
||||||
BigDecimal principalPay = null; // 30
|
BigDecimal principalPay = null; // 30
|
||||||
BigDecimal giftPay = null; // 10
|
BigDecimal giftPay = null; // 10
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Maps;
|
|||||||
import com.jsowell.adapay.service.AdapayService;
|
import com.jsowell.adapay.service.AdapayService;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.enums.DelFlagEnum;
|
import com.jsowell.common.enums.DelFlagEnum;
|
||||||
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
import com.jsowell.common.enums.ykc.OrderPayModeEnum;
|
||||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
@@ -15,13 +16,12 @@ import com.jsowell.pile.dto.PayOrderDTO;
|
|||||||
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
import com.jsowell.pile.dto.QueryOccupyOrderDTO;
|
||||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||||
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
import com.jsowell.pile.mapper.OrderPileOccupyMapper;
|
||||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
import com.jsowell.pile.service.*;
|
||||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
|
||||||
import com.jsowell.pile.service.IPileBillingTemplateService;
|
|
||||||
import com.jsowell.pile.service.OrderPileOccupyService;
|
|
||||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||||
|
import com.jsowell.pile.vo.uniapp.MemberVO;
|
||||||
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
import com.jsowell.pile.vo.web.BillingTemplateVO;
|
||||||
import com.jsowell.pile.vo.web.OrderListVO;
|
import com.jsowell.pile.vo.web.OrderListVO;
|
||||||
|
import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -50,6 +50,9 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
|||||||
@Resource
|
@Resource
|
||||||
private AdapayService adapayService;
|
private AdapayService adapayService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IMemberBasicInfoService memberBasicInfoService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int deleteByPrimaryKey(Integer id) {
|
public int deleteByPrimaryKey(Integer id) {
|
||||||
return orderPileOccupyMapper.deleteByPrimaryKey(id);
|
return orderPileOccupyMapper.deleteByPrimaryKey(id);
|
||||||
@@ -302,10 +305,35 @@ public class OrderPileOccupyServiceImpl implements OrderPileOccupyService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void balancePayOccupyPileOrder(PayOrderDTO dto) {
|
private void balancePayOccupyPileOrder(PayOrderDTO dto) {
|
||||||
|
// 查会员余额
|
||||||
|
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||||
|
if (memberVO == null) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_MEMBER_NOT_FOUND_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验金额
|
||||||
|
BigDecimal principalBalance = memberVO.getPrincipalBalance();
|
||||||
|
if (dto.getPayAmount().compareTo(principalBalance) > 0) {
|
||||||
|
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||||||
|
}
|
||||||
|
// 扣除会员余额
|
||||||
|
UpdateMemberBalanceDTO updateMemberBalanceDTO = new UpdateMemberBalanceDTO();
|
||||||
|
updateMemberBalanceDTO.setMemberId(dto.getMemberId());
|
||||||
|
updateMemberBalanceDTO.setUpdatePrincipalBalance(dto.getPayAmount()); // 更新会员本金金额,单位元
|
||||||
|
updateMemberBalanceDTO.setType(MemberWalletEnum.TYPE_OUT.getValue());
|
||||||
|
updateMemberBalanceDTO.setSubType(MemberWalletEnum.SUBTYPE_PAYMENT_FOR_ORDER.getValue());
|
||||||
|
memberBasicInfoService.updateMemberBalance(updateMemberBalanceDTO);
|
||||||
|
|
||||||
|
// 更新占桩订单状态
|
||||||
|
OrderPileOccupy orderPileOccupy = queryByOccupyCode(dto.getOrderCode());
|
||||||
|
// orderPileOccupy.setStatus(order);
|
||||||
|
updateByPrimaryKeySelective(orderPileOccupy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void whiteListPayOccupyPileOrder(PayOrderDTO dto) {
|
private void whiteListPayOccupyPileOrder(PayOrderDTO dto) {
|
||||||
|
// 更新占桩订单状态
|
||||||
|
OrderPileOccupy orderPileOccupy = queryByOccupyCode(dto.getOrderCode());
|
||||||
|
// orderPileOccupy.setStatus(order);
|
||||||
|
updateByPrimaryKeySelective(orderPileOccupy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class MemberVO {
|
|||||||
/**
|
/**
|
||||||
* 赠送金额
|
* 赠送金额
|
||||||
*/
|
*/
|
||||||
// private BigDecimal giftBalance;
|
private BigDecimal giftBalance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 总账户余额
|
* 总账户余额
|
||||||
|
|||||||
Reference in New Issue
Block a user