| | |
| | | package com.taoke.autopay.manager; |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.taoke.autopay.dao.credit.CreditExchangeRecordMapper; |
| | | import com.taoke.autopay.dao.credit.ExchangeRateMapper; |
| | | import com.taoke.autopay.entity.credit.*; |
| | | import com.taoke.autopay.exception.UserCreditExchangeException; |
| | | import com.taoke.autopay.service.credit.*; |
| | | import com.taoke.autopay.utils.AlipayUtil; |
| | | import com.taoke.autopay.utils.TimeUtil; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | // 如果是红包兑换,调用通过兑换逻辑(TODO) |
| | | if (exchangeRecord.getExchangeType() == CreditExchangeRecord.ExchangeType.FUND_EXCHANGE) { |
| | | // TODO: 调用通过兑换逻辑 |
| | | try { |
| | | AlipayUtil.transfer("credit_exchange_"+exchangeRecordId, exchangeRecord.getExchangeInfo2(), exchangeRecord.getExchangeInfo1(), exchangeRecord.getExchangeValue(), "红包兑换", "红包兑换"); |
| | | } catch (AlipayApiException e) { |
| | | throw new UserCreditExchangeException(UserCreditExchangeException.CODE_ALIPAY_TRANSFER_FAILED, e.getErrCode()+ ":"+ e.getErrMsg()); |
| | | } catch (AlipayUtil.AlipayTransferException e) { |
| | | throw new UserCreditExchangeException(UserCreditExchangeException.CODE_ALIPAY_TRANSFER_FAILED, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // 改变兑换记录状态 |