wzy
2020-12-10 66e4200836f1e34c324fab2fda13dbb5d1fd9480
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.xcong.excoin;
 
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.xcong.excoin.modules.coin.dao.TrcAddressDao;
import com.xcong.excoin.modules.coin.entity.TrcAddressEntity;
import com.xcong.excoin.utils.TRC20ApiUtils;
import org.apache.catalina.security.SecurityUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
 
/**
 * @author wzy
 * @date 2020-11-05
 **/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class SRCTest {
 
    private static final String SRC_API = "http://27.50.59.35:5002/";
 
    private static final String SIGN_STR = "w@a!llokmet";
 
    public static void main(String[] args) throws NoSuchAlgorithmException {
//        String applyOrderInfo = TRC20ApiUtils.getApplyOrderInfo("2020111140230002");
//        System.out.println(applyOrderInfo);
 
        md5Test();
    }
 
    private static void sign() {
 
    }
 
    @Autowired
    private TrcAddressDao srcAddressDao;
 
    @Test
    public void addressInsertTest() throws IOException {
//        String src = "/Users/helius/Desktop/src20.xls";
        String src = "C:/Users/wzy19/Desktop/ace2.xls";
        File file = new File(src);
        FileInputStream input = new FileInputStream(file);
 
        Workbook wb = null;
        if (file.getName().endsWith(".xls")) {
            wb = new HSSFWorkbook(input);
        } else if (file.getName().endsWith(".xlsx")) {
            wb = new XSSFWorkbook(input);
        }
 
        Sheet sheet = wb.getSheetAt(0);
        int lastRowNum = sheet.getLastRowNum();
        for (int i = 0; i <= lastRowNum; i++) {
            Row row = sheet.getRow(i);
            Cell cell = row.getCell(0);
            TrcAddressEntity addressEntity =  new TrcAddressEntity();
            addressEntity.setAddress(cell.getStringCellValue().trim());
            addressEntity.setIsUse(2);
            srcAddressDao.insert(addressEntity);
        }
    }
 
    @Test
    public void createTest() {
        System.out.println(System.currentTimeMillis());
        TRC20ApiUtils.createWallet(1L, "111111", "USDT", "111111111");
        System.out.println(System.currentTimeMillis());
    }
 
 
 
    public static void md5Test() throws NoSuchAlgorithmException {
        String str = "88" + "100.00000000" + "USDT" + "1" + TRC20ApiUtils.SIGN_STR;
        MessageDigest md5 = MessageDigest.getInstance("md5");
        md5.update(str.getBytes());
 
        str = new BigInteger(1, md5.digest()).toString(16);
 
        if (str.length() < 32) {
            String str0 = "";
            for (int i = 0; i < 32 - str.length(); i++) {
                str0 += "0";
            }
            str = str0 + str;
        }
        System.out.println(str);
 
    }
}