客戶端要求- 新增三個金額、只有J權限可觀看、修改文字

This commit is contained in:
wanling040@gmail.com 2022-07-24 21:05:23 +08:00
parent 8ae0ce46f3
commit 048106e9f8
5 changed files with 96 additions and 9 deletions

View File

@ -61,6 +61,12 @@ namespace SolarPower.Controllers
mapOverview.Today_carbon = powerStationSummary.Today_carbon;
mapOverview.Total_carbon = powerStationSummary.Total_carbon;
var solarTypeMoneys = await overviewRepository.GetSolarTypeMoneys();
mapOverview.today_solarTypeMoney_self_built_wholesale = solarTypeMoneys[0].Today_money;
mapOverview.today_solarTypeMoney_tenant_built_wholesale = solarTypeMoneys[1].Today_money;
mapOverview.today_solarTypeMoney_self_build = solarTypeMoneys[2].Today_money;
mapOverview.CapacityDataTables = await overviewRepository.GetCapacityDataTableByPowerStationIds(powerStationIds);
var totalPowerStationCount = 0;

View File

@ -29,9 +29,17 @@ namespace SolarPower.Models
public List<PowerStation.PowerStation> PowerStations { get; set; }
public int TotalPowerStationCount { get; set; }
public double TotalCapacity { get; set; }
public double today_solarTypeMoney_self_built_wholesale { get; set; } //自建躉售
public double today_solarTypeMoney_tenant_built_wholesale { get; set; } //租建
public double today_solarTypeMoney_self_build { get; set; } //自建自用
public string UpdatedAt { get; set; } //畫面資料更新時間
}
public class SolarTypeMoneys
{
public double Today_money { get; set; } //發電金額
}
public class CapacityDataTable
{
public string CityName { get; set; } //城市名稱

View File

@ -886,5 +886,30 @@ namespace SolarPower.Repository.Implement
};
return result;
}
public async Task<List<SolarTypeMoneys>> GetSolarTypeMoneys()
{
List<SolarTypeMoneys> result = new List<SolarTypeMoneys>();
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT
solartype,
sum(today_money) Today_money
FROM power_station
group by solartype
order by solartype
";
result = (await conn.QueryAsync<SolarTypeMoneys>(sql)).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
}
}

View File

@ -32,5 +32,6 @@ namespace SolarPower.Repository.Interface
Task<List<ExceptionDataTable>> GetExceptionTable2(ExceptionSent2 post);
Task<List<ExceptionEmailInfo>> GetEmailExceptionList();
Task<List<UserPowerStationTo>> GetUserListWithPowerstation(int id);
Task<List<SolarTypeMoneys>> GetSolarTypeMoneys();
}
}

View File

@ -36,11 +36,11 @@
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<p>今日日照度</p>
<p>今日累積日照量</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
</div>
<div class="d-flex justify-content-between">
<p>平均日照度(30天)</p>
<p>日均累積日照量(30天)</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_irradiance">0.00</span></p>
</div>
</div>
@ -68,11 +68,11 @@
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<p>今日日均發電度數(kwh/kwp)</p>
<p>日均發電度數(kwh/kwp)</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwhkwp">0.00</span></p>
</div>
<div class="d-flex justify-content-between">
<p>平均日均發電度數 (30天)</p>
<p>日均發電度數 (30天)</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="avg_kwhkwp">0.00</span></p>
</div>
</div>
@ -97,6 +97,45 @@
</div>
<div class="row">
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
{
<div class="card">
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 自建躉售</h4>
<div class="ml-auto">NTD</div>
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<p>今日發電金額</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh_money_by_myself">0.00</span></p>
</div>
</div>
</div>
<div class="card">
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 租建躉售</h4>
<div class="ml-auto">NTD</div>
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<p>今日發電金額</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh_money_from_tenant">0.00</span></p>
</div>
</div>
</div>
<div class="card">
<div class="card-header bg-fusion-25 py-2 pr-3 d-flex align-items-center flex-wrap">
<h4 class="mb-0 font-weight-bold"><span class="fal fa-bolt mr-1"></span> 自發自用</h4>
<div class="ml-auto">NTD</div>
</div>
<div class="card-body">
<div class="d-flex justify-content-between">
<p>今日省電金額</p>
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh_money_save_power">0.00</span></p>
</div>
</div>
</div>
}
<div class="col-md-8 col-sm-12">
<div id="panel-1" class="panel">
<div class="panel-hdr">
@ -256,6 +295,14 @@
$("#avg_kwhkwp").html(toThousands(mapOverview.avg_kwhkwp.toFixed(2)));
$("#today_carbon").html(toThousands(mapOverview.today_carbon.toFixed(2)));
$("#total_carbon").html(toThousands(mapOverview.total_carbon.toFixed(2)));
@if (ViewBag.myUser.Role.Auths.Contains("ShowMoney"))
{
<text>
$('#today_kwh_money_by_myself').html(toThousands(mapOverview.today_solarTypeMoney_self_built_wholesale.toFixed(2)));
$('#today_kwh_money_from_tenant').html(toThousands(mapOverview.today_solarTypeMoney_tenant_built_wholesale.toFixed(2)));
$('#today_kwh_money_save_power').html(toThousands(mapOverview.today_solarTypeMoney_self_build.toFixed(2)));
</text>
}
$("#total_power_station_count").html(toThousands(mapOverview.totalPowerStationCount));
$("#total_capacity").html(toThousands(mapOverview.totalCapacity.toFixed(3)));
$("#update_at").html(mapOverview.updatedAt);