1. google map 修改

2. 寄信人 修改
This commit is contained in:
Kai 2021-08-19 18:53:21 +08:00
parent e60a82eaeb
commit 8f76245a13
8 changed files with 55 additions and 20 deletions

View File

@ -92,19 +92,31 @@ namespace SolarPower.Controllers
var per_auch_arr = auth.Split(','); var per_auch_arr = auth.Split(',');
foreach (var x in per_auch_arr) foreach (var x in per_auch_arr)
{ {
if (x.Contains("PowerStation"))
{
auth_arr.Add("PowerStation");
}
auth_arr.Add(x); auth_arr.Add(x);
} }
} }
if (myUser.Role.Layer != (int)RoleLayerEnum.PlatformAdmin && !auth_arr.Contains(controllerName)) if (myUser.Role.Layer != (int)RoleLayerEnum.PlatformAdmin && !auth_arr.Contains(controllerName))
{ {
filterContext.Result = new RedirectToRouteResult( if(auth_arr.Contains("StationOverview") && !auth_arr.Contains("PowerStation"))
new RouteValueDictionary {
{ //只有電站總覽 且未包含 電站管理
}
else
{
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary
{
{"controller", "Login"}, {"controller", "Login"},
{"action", "SignOut"} {"action", "SignOut"}
}); });
return; return;
}
} }

View File

@ -210,7 +210,7 @@ namespace SolarPower.Controllers
List<RoleAuth> roleAuths = new List<RoleAuth>(); List<RoleAuth> roleAuths = new List<RoleAuth>();
RoleAuth roleAuth = new RoleAuth(); RoleAuth roleAuth = new RoleAuth();
roleAuth.Id = role.Id; roleAuth.Id = id;
roleAuth.AuthCode = "A"; roleAuth.AuthCode = "A";
roleAuth.CreatedBy = myUser.Id; roleAuth.CreatedBy = myUser.Id;

View File

@ -102,8 +102,8 @@ namespace SolarPower.Quartz.Jobs
MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼 MyMail.SubjectEncoding = System.Text.Encoding.UTF8;//郵件標題編碼
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼 MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式 MyMail.IsBodyHtml = true; //是否使用html格式
var kkk = $"FIC 太陽能電站管理系統通知 <{smtp.UserName}>";
MyMail.From = new System.Net.Mail.MailAddress(smtp.UserName); //寄件人 MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人
foreach (var email in recipientEmails) foreach (var email in recipientEmails)
{ {
MyMail.To.Add(email); //設定收件者Email MyMail.To.Add(email); //設定收件者Email

View File

@ -463,7 +463,8 @@ namespace SolarPower.Repository.Implement
inv.KWH inv.KWH
FROM inverter_history_hour inv FROM inverter_history_hour inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m-%d') = @Day"; AND DATE_FORMAT(inv.timestamp, '%Y-%m-%d') = @Day
ORDER BY inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Day = day })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Day = day })).ToList();
} }
@ -487,7 +488,8 @@ namespace SolarPower.Repository.Implement
inv.KWH inv.KWH
FROM inverter_history_day inv FROM inverter_history_day inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m') = @Month"; AND DATE_FORMAT(inv.timestamp, '%Y-%m') = @Month
ORDER BY inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Month = month })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Month = month })).ToList();
} }
@ -511,7 +513,8 @@ namespace SolarPower.Repository.Implement
inv.KWH inv.KWH
FROM inverter_history_month inv FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m') BETWEEN @StartMonth AND @EndMonth"; AND DATE_FORMAT(inv.timestamp, '%Y-%m') BETWEEN @StartMonth AND @EndMonth
ORDER BY inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, StartMonth = startMonth, EndMonth = endMonth })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, StartMonth = startMonth, EndMonth = endMonth })).ToList();
} }
@ -535,7 +538,8 @@ namespace SolarPower.Repository.Implement
inv.KWH inv.KWH
FROM inverter_history_month inv FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y') = @Year"; AND DATE_FORMAT(inv.timestamp, '%Y') = @Year
ORDER BY inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Year = year })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Year = year })).ToList();
} }

View File

@ -28,7 +28,9 @@ namespace SolarPower.Services
MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼 MyMail.BodyEncoding = System.Text.Encoding.UTF8; //郵件內容編碼
MyMail.IsBodyHtml = true; //是否使用html格式 MyMail.IsBodyHtml = true; //是否使用html格式
MyMail.From = new System.Net.Mail.MailAddress(smtp.UserName); //寄件人 var kkk = $"FIC 太陽能電站管理系統通知 <{smtp.UserName}>";
MyMail.From = new System.Net.Mail.MailAddress(kkk); //寄件人
foreach(var email in recipientEmails) foreach(var email in recipientEmails)
{ {
MyMail.To.Add(email); //設定收件者Email MyMail.To.Add(email); //設定收件者Email

View File

@ -260,7 +260,11 @@
mapOverview.powerStations.forEach(function (item, index) { mapOverview.powerStations.forEach(function (item, index) {
var contentString = '<div id="content">' + var contentString = '<div id="content">' +
'<div id="siteNotice"></div>' + '<div id="siteNotice"></div>' +
'<h1 id="firstHeading" class="firstHeading">' + item.name + '</h1>' + '<h1 id="firstHeading" class="firstHeading">' +
'<a href="StationOverview/Info?stationId=' + item.id + '">' +
item.name +
'</a>' +
'</h1>' +
'<div id="bodyContent">' + '<div id="bodyContent">' +
'<div class="row">' + '<div class="row">' +
'<div class="col-12">' + '<div class="col-12">' +
@ -309,6 +313,12 @@
google.maps.event.addListener(marker, 'click', (function (marker, i) { google.maps.event.addListener(marker, 'click', (function (marker, i) {
return function () { return function () {
infowindow.setContent(location[1]); infowindow.setContent(location[1]);
google.maps.event.addListener(infowindow, 'domready', function () {
$(document).find('#content').parent().css('overflow-x', 'hidden');
});
infowindow.open(map, marker); infowindow.open(map, marker);
} }
})(marker, i)); })(marker, i));

View File

@ -23,10 +23,10 @@
//}, //},
"BackgroundServiceCron": { "BackgroundServiceCron": {
"CalcPowerStationJob": "0 5 * * * ?", "CalcPowerStationJob": "0 5 * * * ?",
"CalcAvgPowerStationJob": "0 0 2 * * ?", "CalcAvgPowerStationJob": "0/10 * * * * ?",
"OperationScheduleJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?",
"CalcInverter15minJob": "0 2/15 * * * ?", "CalcInverter15minJob": "0 2/15 * * * ?",
"SendEmailJob": "0 15 2 * * ?", "SendEmailJob": "0/10 * * * * ?",
"ExceptionSchedule": "0 0/5 * * * ?" "ExceptionSchedule": "0 0/5 * * * ?"
}, },
"SMTPConfig": { "SMTPConfig": {
@ -35,5 +35,12 @@
"UserName": "shanghohui@gmail.com", "UserName": "shanghohui@gmail.com",
"Password": "wswgnluvoodfexrb", "Password": "wswgnluvoodfexrb",
"EnableSsl": true "EnableSsl": true
} },
//"SMTPConfig": {
// "Host": "smtp.gmail.com",
// "Port": 25,
// "UserName": "ficgreen01@gmail.com",
// "Password": "qwe2015qwe",
// "EnableSsl": true
//}
} }

View File

@ -27,14 +27,14 @@
"CalcAvgPowerStationJob": "0 0 2 * * ?", "CalcAvgPowerStationJob": "0 0 2 * * ?",
"OperationScheduleJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?",
"CalcInverter15minJob": "0 2/15 * * * ?", "CalcInverter15minJob": "0 2/15 * * * ?",
"SendEmailJob": "0 15 2 * * ?", "SendEmailJob": "0 0/5 * * * ?",
"ExceptionSchedule": "0 0/5 * * * ?" "ExceptionSchedule": "0 0/5 * * * ?"
}, },
"SMTPConfig": { "SMTPConfig": {
"Host": "smtp.gmail.com", "Host": "smtp.gmail.com",
"Port": 25, "Port": 25,
"UserName": "shanghohui@gmail.com", "UserName": "ficgreen01@gmail.com",
"Password": "wswgnluvoodfexrb", "Password": "qwe2015qwe",
"EnableSsl": true "EnableSsl": true
} }
} }