Administrator
2025-04-20 c95812b953a54e60c916c8ca375101376f58de57
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
package com.taoke.autopay.credit;
 
import com.taoke.autopay.dao.credit.ExchangeRateMapper;
import com.taoke.autopay.entity.credit.CreditSetting;
import com.taoke.autopay.entity.credit.ExchangeRate;
import com.taoke.autopay.service.credit.CreditSettingService;
import com.taoke.autopay.service.credit.ExchangeRateService;
import com.taoke.autopay.utils.TimeUtil;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
 
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
 
@SpringBootTest
public class RateTest {
    @Resource
    private ExchangeRateService exchangeRateService;
 
    @Test
    public void setRate(){
        exchangeRateService.addExchangeRate(ExchangeRate.builder()
                        .rate(new BigDecimal("0.03"))
                        .exchangeType(ExchangeRate.ExchangeRateType.NEW_USER_EXCHANGE)
                        .startTime(new Date(TimeUtil.convertToTimeTemp("19700101","yyyyMMdd")))
                        .endTime(new Date(TimeUtil.convertToTimeTemp("29990101","yyyyMMdd")))
 
                .build());
 
        exchangeRateService.addExchangeRate(ExchangeRate.builder()
                .rate(new BigDecimal("0.02"))
                .exchangeType(ExchangeRate.ExchangeRateType.GENERAL_EXCHANGE)
                .startTime(new Date(TimeUtil.convertToTimeTemp("19700101","yyyyMMdd")))
                .endTime(new Date(TimeUtil.convertToTimeTemp("29990101","yyyyMMdd")))
 
                .build());
 
    }
    @Test
    public void getSetting(){
        long uid = 2L;
        List<ExchangeRate> rateList =   exchangeRateService.listExchangeRates(ExchangeRateMapper.DaoQuery.builder()
                        .exchangeType(ExchangeRate.ExchangeRateType.NEW_USER_EXCHANGE)
                .build());
        System.out.println(rateList);
 
    }
 
 
}