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);
|
|
}
|
|
|
}
|