Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8cc60c43b3
|
|
@ -113,6 +113,9 @@ public class PayServiceImpl implements PayService {
|
|||
* @return 是否是霸王餐充值
|
||||
*/
|
||||
private boolean checkPayVip(VipPayParamDTO payParam) {
|
||||
if (payParam.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new ValidateException("充值金额不正确");
|
||||
}
|
||||
if (payParam.getOrderId() != null) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
|
|
@ -135,7 +138,7 @@ public class PayServiceImpl implements PayService {
|
|||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Object> creditPayOrder(OrderPayParamDTO payParam) {
|
||||
AssertUtil.isNull(payParam.getCreditBuyerId(), "挂账人不可为空");
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
|
|
@ -149,7 +152,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Object> cashPayOrder(OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||
|
|
@ -163,7 +166,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Object> vipPayOrder(OrderPayParamDTO payParam) {
|
||||
AssertUtil.isNull(payParam.getCheckOrderPay().getUserId(), "会员支付,订单用户不能为空");
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
|
|
@ -215,7 +218,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> h5PayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
String payOrderNo = orderInfo.getPlatformType() + IdUtil.getSnowflakeNextId();
|
||||
|
|
@ -228,7 +231,7 @@ public class PayServiceImpl implements PayService {
|
|||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> jsPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
||||
|
|
@ -242,7 +245,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> js2PayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
||||
AssertUtil.isBlank(payParam.getOpenId(), "用户小程序ID不能为空");
|
||||
|
|
@ -262,7 +265,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> ltPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
AssertUtil.isBlank(payParam.getPayType(), "支付方式不能为空");
|
||||
|
|
@ -276,7 +279,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> scanPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
|
||||
|
|
@ -289,7 +292,7 @@ public class PayServiceImpl implements PayService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(noRollbackFor = PaySuccessException.class)
|
||||
public CzgResult<Map<String, Object>> microPayOrder(OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
|
||||
AssertUtil.isBlank(payParam.getAuthCode(), "扫描码不能为空");
|
||||
|
|
@ -487,6 +490,9 @@ public class PayServiceImpl implements PayService {
|
|||
@Transactional
|
||||
public CzgResult<Object> refundOrderBefore(OrderInfoRefundDTO param) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(param.getOrderId());
|
||||
if (orderInfo.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||
return CzgResult.failure("订单未支付,无法退款");
|
||||
}
|
||||
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
||||
boolean isPay = true;
|
||||
String refPayOrderNo = "REFO" + IdUtil.getSnowflakeNextId();
|
||||
|
|
@ -557,45 +563,23 @@ public class PayServiceImpl implements PayService {
|
|||
//总退款金额
|
||||
//TODO 退款 券 未处理
|
||||
if (isPay) {
|
||||
if (param.isModify()) {
|
||||
//非现金退款
|
||||
if (!param.isCash()) {
|
||||
if (orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue())) {
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
|
||||
//会员支付 退钱
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
|
||||
.id(shopUser.getId())
|
||||
.money(param.getRefundAmount())
|
||||
.type(1)
|
||||
.relationId(orderInfo.getId())
|
||||
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
|
||||
.build();
|
||||
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
|
||||
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())) {
|
||||
//退款 param.getRefundAmount()
|
||||
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
||||
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//非现金退款
|
||||
if (!param.isCash()) {
|
||||
if (orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue())) {
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
|
||||
//会员支付 退钱
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
|
||||
.id(shopUser.getId())
|
||||
.money(param.getRefundAmount())
|
||||
.type(1)
|
||||
.relationId(orderInfo.getId())
|
||||
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
|
||||
.build();
|
||||
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
|
||||
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())) {
|
||||
//退款 param.getRefundAmount()
|
||||
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
||||
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
|
||||
}
|
||||
//非现金退款
|
||||
if (!param.isCash()) {
|
||||
if (orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue())) {
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
|
||||
//会员支付 退钱
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
|
||||
.id(shopUser.getId())
|
||||
.money(param.getRefundAmount())
|
||||
.type(1)
|
||||
.relationId(orderInfo.getId())
|
||||
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
|
||||
.build();
|
||||
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
|
||||
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())) {
|
||||
//退款 param.getRefundAmount()
|
||||
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
||||
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue