Helius
2021-06-03 cf62910fb3288aa84f81862aa26abb3bb3252ed4
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
110
111
112
113
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.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
@SpringBootTest
public class OtcTest {
 
    @Autowired
    private OtcProducter otcProducter;
 
    @Test
    public void rabbitTest() {
        otcProducter.sendDelayOrderMsg("123456");
 
        while(true){
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
 
        }
    }
 
    @Autowired
//    private OtcOrderJob otcOrderJob;
 
    @Test
    public void jobTest() {
//        otcOrderJob.marketBussinessJob();
    }
 
    @Test
    public void mbProducterTest() {
//        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(15.64);
 
        System.out.println(one.multiply(two));
    }
}