ifx
Helius
2022-08-12 914b789d830d887ebdce2e87e9d29c409f3618a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package cc.mrbird.febs.dapp.utils;
 
import cc.mrbird.febs.common.utils.SpringContextUtil;
import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
import cc.mrbird.febs.dapp.entity.DappOnlineTransferEntity;
import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity;
import cc.mrbird.febs.dapp.mapper.DappFundFlowDao;
import cc.mrbird.febs.dapp.mapper.DappOnlineTransferDao;
import cc.mrbird.febs.dapp.mapper.DappTransferRecordDao;
 
import java.math.BigDecimal;
 
public class OnlineTransferUtil {
 
    private static final DappOnlineTransferDao dappOnlineTransferDao = SpringContextUtil.getBean(DappOnlineTransferDao.class);
    private static final DappTransferRecordDao dappTransferRecordDao = SpringContextUtil.getBean(DappTransferRecordDao.class);
 
    public static void addTransfer(String address, BigDecimal amount, Integer type, Integer targetType, String fromType, String symbol, String batchNo) {
        addTransfer(address, amount, type, targetType, fromType, symbol, "BSC", batchNo);
    }
 
    public static void addTransfer(String address, BigDecimal amount, Integer type, Integer targetType, String fromType, String symbol, String chain, String batchNo) {
        DappOnlineTransferEntity transfer = new DappOnlineTransferEntity();
        transfer.setAddress(address);
        transfer.setAmount(amount);
        transfer.setType(type);
        transfer.setTargetType(targetType);
        transfer.setFromType(fromType);
        transfer.setSymbol(symbol);
        transfer.setChain(chain);
        transfer.setBatchNo(batchNo);
        transfer.setHasFinish(2);
 
        dappOnlineTransferDao.insert(transfer);
    }
 
    public static void addTransferRecord(String fromAddress, String toAddress, BigDecimal amount, String hash, String chainType, String sourceFlag, String symbol) {
        DappTransferRecordEntity record = dappTransferRecordDao.selectByHash(hash);
        if (record != null) {
            return;
        }
        record = new DappTransferRecordEntity();
        record.setFromAddress(fromAddress);
        record.setToAddress(toAddress);
        record.setAmount(amount);
        record.setHash(hash);
        record.setChainType(chainType);
        record.setSourceFlag(sourceFlag);
        record.setSymbol(symbol);
        dappTransferRecordDao.insert(record);
    }
 
    public static void addTransferRecord(String fromAddress, String toAddress, BigDecimal amount, String hash, String sourceFlag, String symbol) {
        addTransferRecord(fromAddress, toAddress, amount, hash, "BSC", sourceFlag, symbol);
    }
 
}