| | |
| | | package com.xcong.excoin.modules.coin.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xcong.excoin.common.enumerates.CoinTypeEnum; |
| | | import com.xcong.excoin.modules.blackchain.service.BtcService; |
| | |
| | | import com.xcong.excoin.modules.member.entity.MemberEntity; |
| | | import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; |
| | | import com.xcong.excoin.utils.LogRecordUtils; |
| | | import com.xcong.excoin.utils.ThreadPoolUtils; |
| | | import com.xcong.excoin.utils.dingtalk.DingTalkUtils; |
| | | import com.xcong.excoin.utils.mail.Sms106Send; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | BigDecimal newBalance = balance.subtract(early); |
| | | memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), newBalance, balance, 0); |
| | | |
| | | insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "ERC20", balance); |
| | | // TODO 钉钉发送, 短信提醒 |
| | | String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "ERC20", balance); |
| | | // 插入财务记录 |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.USDT.name(), 1, 1); |
| | | |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = newBalance.toPlainString() + "USDT-ERC20"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | BigDecimal newBalance = balance.subtract(early); |
| | | memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0); |
| | | insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.ETH.name(), null, balance); |
| | | String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.ETH.name(), null, balance); |
| | | |
| | | // 插入财务记录 |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.ETH.name(), 1, 1); |
| | | // TODO 钉钉消息, 短信提醒 |
| | | |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = newBalance.toPlainString() + "ETH"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | BigDecimal newBalance = balance.subtract(early); |
| | | |
| | | memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0); |
| | | insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "OMNI", balance); |
| | | String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "OMNI", balance); |
| | | |
| | | // TODO 钉钉消息, 短信提醒 |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = newBalance.toPlainString() + "USDT-OMNI"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | BigDecimal newBalance = balance.subtract(early); |
| | | memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0); |
| | | |
| | | insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.BTC.name(), null, balance); |
| | | String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.BTC.name(), null, balance); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.BTC.name(), 1, 1); |
| | | |
| | | // TODO 钉钉提醒, 短信提醒 |
| | | |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = newBalance.toPlainString() + "BTC"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return String.valueOf(timestamp).substring(2) + random; |
| | | } |
| | | |
| | | public void insertCoinCharge(String address, Long memberId, BigDecimal newBalance, String symbol, String tag, BigDecimal lastAmount) { |
| | | public String insertCoinCharge(String address, Long memberId, BigDecimal newBalance, String symbol, String tag, BigDecimal lastAmount) { |
| | | MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity(); |
| | | memberCoinChargeEntity.setAddress(address); |
| | | memberCoinChargeEntity.setMemberId(memberId); |
| | |
| | | memberCoinChargeEntity.setTag(tag); |
| | | memberCoinChargeEntity.setStatus(1); |
| | | memberCoinChargeEntity.setLastAmount(lastAmount); |
| | | memberCoinChargeEntity.setOrderCode(generateNo()); |
| | | String orderNo = generateNo(); |
| | | memberCoinChargeEntity.setOrderCode(orderNo); |
| | | memberCoinChargeDao.insert(memberCoinChargeEntity); |
| | | return orderNo; |
| | | } |
| | | } |