From 1e4cab335b1cb68ad3438e522ea410c2d2e753ed Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 07 Sep 2021 14:54:16 +0800
Subject: [PATCH] data_move
---
src/test/java/com/xcong/excoin/OtcTest.java | 87 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 84 insertions(+), 3 deletions(-)
diff --git a/src/test/java/com/xcong/excoin/OtcTest.java b/src/test/java/com/xcong/excoin/OtcTest.java
index 5c12aa9..aaa786e 100644
--- a/src/test/java/com/xcong/excoin/OtcTest.java
+++ b/src/test/java/com/xcong/excoin/OtcTest.java
@@ -1,12 +1,23 @@
package com.xcong.excoin;
+import cn.hutool.crypto.SecureUtil;
+import com.xcong.excoin.common.system.dto.RegisterDto;
+import com.xcong.excoin.modules.member.dao.MemberDao;
+import com.xcong.excoin.modules.member.dao.MemberPaymentMethodDao;
+import com.xcong.excoin.modules.member.entity.MemberEntity;
+import com.xcong.excoin.modules.member.entity.MemberPaymentMethodEntity;
+import com.xcong.excoin.modules.otc.dao.OtcMarketBussinessDao;
+import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness;
import com.xcong.excoin.quartz.job.OtcOrderJob;
+import com.xcong.excoin.rabbit.consumer.OtcConsumer;
import com.xcong.excoin.rabbit.producer.OtcProducter;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;
@Slf4j
@@ -31,15 +42,85 @@
}
@Autowired
- private OtcOrderJob otcOrderJob;
+// private OtcOrderJob otcOrderJob;
@Test
public void jobTest() {
- otcOrderJob.marketBussinessJob();
+// otcOrderJob.marketBussinessJob();
}
@Test
public void mbProducterTest() {
- otcProducter.sendMarketBussinessMsg(11L, 3);
+// otcProducter.sendMarketBussinessMsg(11L, 3);
+ }
+
+ @Autowired
+ private MemberDao memberDao;
+
+ @Autowired
+ private OtcMarketBussinessDao otcMarketBussinessDao;
+
+ @Autowired
+ private MemberPaymentMethodDao memberPaymentMethodDao;
+
+ @Test
+// @Transactional(rollbackFor = Exception.class)
+ public void mbInsertTest() {
+ for(int i = 0; i < 50; i++) {
+ String phonePrefix = "199999999";
+ if (i < 10) {
+ phonePrefix = phonePrefix + "0" + i;
+ } else {
+ phonePrefix = phonePrefix + i;
+ }
+
+ MemberEntity member = memberDao.selectMemberInfoByAccount(phonePrefix);
+
+ OtcMarketBussiness otcMb = new OtcMarketBussiness();
+ otcMb.setMemberId(member.getId());
+ otcMb.setAvgCoinTime(0);
+ otcMb.setAvgPayTime(0);
+ otcMb.setTotalOrderCnt(0);
+ otcMb.setBuyCnt(0);
+ otcMb.setFinishRatio(BigDecimal.ZERO);
+ otcMb.setStatus(OtcMarketBussiness.CHECK_PASS);
+
+ member.setIsTrader(1);
+ member.setCertifyStatus(2);
+ member.setTradePassword(SecureUtil.md5("123456"));
+
+ memberDao.updateById(member);
+ otcMarketBussinessDao.insert(otcMb);
+
+ MemberPaymentMethodEntity memberPaymentMethodEntity = new MemberPaymentMethodEntity();
+ memberPaymentMethodEntity.setMemberId(member.getId());
+ memberPaymentMethodEntity.setAccount("123456789");
+ memberPaymentMethodEntity.setBank("中国银行");
+ memberPaymentMethodEntity.setName("无名");
+ memberPaymentMethodEntity.setPaymentType(MemberPaymentMethodEntity.PAYMENTTYPE_CARD.toString());
+ memberPaymentMethodEntity.setSubBank("中国银行");
+ memberPaymentMethodEntity.setIsDefualt("1");
+ memberPaymentMethodDao.insert(memberPaymentMethodEntity);
+ }
+ }
+
+ @Test
+ public void bigdecimalTest() {
+ BigDecimal one = BigDecimal.valueOf(6.39);
+ BigDecimal two = BigDecimal.valueOf(3129.860025);
+ BigDecimal three = BigDecimal.valueOf(19999.80);
+
+ BigDecimal cny = one.multiply(two).setScale(2, BigDecimal.ROUND_DOWN);
+ BigDecimal usdt = three.divide(one, 2, BigDecimal.ROUND_DOWN);
+ System.out.println(cny.compareTo(three) != 0 && usdt.compareTo(two) != 0);
+ }
+
+// @Autowired
+// private OtcConsumer otcConsumer;
+
+ @Test
+ public void returnMoneyTest() {
+// otcConsumer.orderReturn("20210605446780002");
+// otcProducter.sendOrderReturn("20210605446780002");
}
}
--
Gitblit v1.9.1