feat: 添加利息趋势图

This commit is contained in:
橙子
2024-03-16 17:57:17 +08:00
parent 822febba2e
commit 534b03ef5c
5 changed files with 34 additions and 15 deletions

View File

@@ -13,12 +13,13 @@ namespace Yi.Framework.Bbs.Application.Jobs
JobDetail = JobBuilder.Create<InterestRecordsJob>().WithIdentity(nameof(InterestRecordsJob)).Build(); JobDetail = JobBuilder.Create<InterestRecordsJob>().WithIdentity(nameof(InterestRecordsJob)).Build();
//每个小时整点执行一次 //每个小时整点执行一次
Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).WithCronSchedule("0 */1 * * *").Build();
Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).WithCronSchedule("* 0 * * * ?").Build();
//测试 //测试
// Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)) // Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob))
//.WithSimpleSchedule(x => x //.WithSimpleSchedule(x => x
// .WithIntervalInSeconds(5) // .WithIntervalInSeconds(10)
// .RepeatForever()) // .RepeatForever())
//.Build(); //.Build();
} }

View File

@@ -30,7 +30,7 @@ namespace Yi.Framework.Bbs.Application.Services.Bank
[HttpGet("bank/interest")] [HttpGet("bank/interest")]
public async Task<List<InterestRecordsDto>> GetInterestRecordsAsync() public async Task<List<InterestRecordsDto>> GetInterestRecordsAsync()
{ {
var entities = await _interestRepository._DbQueryable.OrderByDescending(x => x.CreationTime).ToPageListAsync(1, 24); var entities = await _interestRepository._DbQueryable.OrderBy(x => x.CreationTime).ToPageListAsync(1, 24);
var output = entities.Adapt<List<InterestRecordsDto>>(); var output = entities.Adapt<List<InterestRecordsDto>>();
return output; return output;
} }

View File

@@ -51,6 +51,10 @@ namespace Yi.Framework.Bbs.Domain.Managers
output.ComparisonValue = currentInterestRecords.ComparisonValue; output.ComparisonValue = currentInterestRecords.ComparisonValue;
output.CreationTime = currentInterestRecords.CreationTime; output.CreationTime = currentInterestRecords.CreationTime;
output.Value = currentInterestRecords.Value; output.Value = currentInterestRecords.Value;
_currentRateStore=new BankInterestRecordDto() { ComparisonValue= currentInterestRecords .ComparisonValue,
CreationTime=currentInterestRecords.CreationTime,Value=currentInterestRecords.Value};
} }
return output; return output;
} }
@@ -101,7 +105,7 @@ namespace Yi.Framework.Bbs.Domain.Managers
//根据上一次的老值进行变化率比较 //根据上一次的老值进行变化率比较
var currentValue = oldValue * changeRate; var currentValue = oldValue + (oldValue* changeRate);
var entity = new InterestRecordsEntity(lastThirdPartyStandardValue, currentValue); var entity = new InterestRecordsEntity(lastThirdPartyStandardValue, currentValue);
var output = await _interestRepository.InsertReturnEntityAsync(entity); var output = await _interestRepository.InsertReturnEntityAsync(entity);

View File

@@ -4,7 +4,7 @@
<div> <div>
<ExchangeRate :option="statisOptions" /> <ExchangeRate :option="statisOptions" />
<div class="div-show"> <div class="div-show">
<p class="p-rate">当前实时利息<span>130%</span>可获取投入的百分之130%的本金</p> <p class="p-rate">当前实时利息<span>{{currentRate}}%</span>可获取投入的百分之{{currentRate}}的本金</p>
<el-button type="primary" @click="applying()"><el-icon> <el-button type="primary" @click="applying()"><el-icon>
<AddLocation /> <AddLocation />
</el-icon>申领银行卡</el-button> </el-icon>申领银行卡</el-button>
@@ -65,10 +65,12 @@ const refreshData = async () => {
bankCardList.value = data; bankCardList.value = data;
} }
const { data2: data } = await getInterestList(); const { data: data2 } = await getInterestList();
interestList.value = data; interestList.value = data2;
} }
onMounted(async () => { onMounted(async () => {
await refreshData(); await refreshData();
}) })
@@ -137,14 +139,26 @@ const sendDeposit = async () => {
message: '钱钱提款成功', message: '钱钱提款成功',
}) })
} }
const getHours=(timeString)=>{
const date = new Date(timeString);
return date.getHours();
}
const currentRate=computed(()=>{
return (interestList.value.map(x=>x.value).slice(-1)[0])*100
})
const statisOptions = computed(() => { const statisOptions = computed(() => {
return { return {
xAxis: { xAxis: {
data: ['1时', '2时', '3时', '4时', '5时', '6时', '7时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '5时', '6时', '7时', '1时', '2时', '3时', '4时', '5时', '6时', '7时'] data:interestList.value.map(x=>getHours(x.creationTime)+"时")
}, },
series: { series: {
data: [10, 6, 13, 11, 12, 12, 9, 10, 11, 13, 11, 8, 14, 9, 12, 12, 9, 10, 11, 13, 11, 8, 14, 9] data: interestList.value.map(x=>(x.value*100))
}, },
}; };
}); });

View File

@@ -1,6 +1,6 @@
export const exchangeRateConfig ={ export const exchangeRateConfig ={
title: { title: {
text: '银行利息趋势图-(暂未开放)' text: '银行利息趋势图'
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
@@ -26,7 +26,7 @@ export const exchangeRateConfig ={
yAxis: { yAxis: {
type: 'value', type: 'value',
axisLabel: { axisLabel: {
formatter: '{value} ' formatter: '{value} %'
} }
}, },
series: [ series: [