|  |  | 
 |  |  | package com.xcong.excoin;/** | 
 |  |  | * | 
 |  |  | * @author wzy | 
 |  |  | * @date 2020-11-05 | 
 |  |  | **/ | 
 |  |  | 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.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) { | 
 |  |  |         Map<String, Object> param = new HashMap<>(); | 
 |  |  |         String orderNo = "123445"; | 
 |  |  |         String userid = "11"; | 
 |  |  |         String symbol = "USDT"; | 
 |  |  |         String amount = "1"; | 
 |  |  |         String toAddress = "Ox"; | 
 |  |  |         param.put("orderno", orderNo); | 
 |  |  |         param.put("userid", userid); | 
 |  |  |         param.put("symbol", symbol); | 
 |  |  |         param.put("toAddress", toAddress); | 
 |  |  |         param.put("amount", new BigDecimal(amount)); | 
 |  |  |         param.put("sign", SecureUtil.md5(orderNo + userid + symbol + amount + toAddress + SIGN_STR)); | 
 |  |  |         HttpRequest request = HttpRequest.post(SRC_API + "transout/created"); | 
 |  |  |         String body = request.body(JSONObject.toJSONString(param)).execute().body(); | 
 |  |  |         System.out.println(body); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private static void sign() { | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TrcAddressDao srcAddressDao; | 
 |  |  |  | 
 |  |  |     @Test | 
 |  |  |     public void addressInsertTest() throws IOException { | 
 |  |  |         File file = new File("/Users/helius/Desktop/src20.xls"); | 
 |  |  |         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()); | 
 |  |  |     } | 
 |  |  | } |