運維儲存庫-寫入通知行程的函式調整為可更改emailType

This commit is contained in:
wanling040@gmail.com 2022-07-28 09:33:53 +08:00
parent d35e863ca8
commit b980f61f21
3 changed files with 31 additions and 4 deletions

View File

@ -176,7 +176,7 @@ namespace SolarPower.Quartz.Jobs
var personal = await operationRepository.GetOperationPersonnel(a.PowerStationId); var personal = await operationRepository.GetOperationPersonnel(a.PowerStationId);
var Title = $@"電站:{a.PowerStationName} - {WorkType}單 - 編號:{a.PlanId}"; var Title = $@"電站:{a.PowerStationName} - {WorkType}單 - 編號:{a.PlanId}";
var content = $@" {noticeName} {Environment.NewLine} 內容描述:{a.Description}"; var content = $@" {noticeName} {Environment.NewLine} 內容描述:{a.Description}";
await operationRepository.InsertNoticeSchedule(personal, Title, content); await operationRepository.InsertNoticeSchedule(personal, Title, content, 3);
var OperationPlans = new OperationCreatePlan() var OperationPlans = new OperationCreatePlan()
{ {

View File

@ -636,7 +636,7 @@ namespace SolarPower.Repository.Implement
} }
} }
public async Task InsertNoticeSchedule(List<MyUser> personal, string Title, string content) public async Task InsertNoticeSchedule(List<MyUser> personal, string Title, string content, int emailType)
{ {
using (IDbConnection conn = this._databaseHelper.GetConnection()) using (IDbConnection conn = this._databaseHelper.GetConnection())
{ {
@ -648,7 +648,7 @@ namespace SolarPower.Repository.Implement
List<string> value = new List<string>(); List<string> value = new List<string>();
foreach (MyUser a in personal) foreach (MyUser a in personal)
{ {
value.Add($@"(1,'{a.Name}','{a.Email}','{Title}','{content}',{a.Id},3)"); value.Add($@"(1,'{a.Name}','{a.Email}','{Title}','{content}',{a.Id}, {emailType})");
} }
string values = string.Join(",", value.ToArray()); string values = string.Join(",", value.ToArray());
@ -776,5 +776,26 @@ namespace SolarPower.Repository.Implement
} }
} }
public async Task<List<MyUser>> GetAllOperations()
{
List<MyUser> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT DISTINCT us.*
FROM power_station_operation_personnel ps
LEFT JOIN user us ON ps.UserId = us.Id
WHERE ps.Deleted = 0 AND us.Deleted = 0";
result = (await conn.QueryAsync<MyUser>(sql)).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
} }
} }

View File

@ -74,7 +74,7 @@ namespace SolarPower.Repository.Interface
Task<List<MyUser>> GetOperationPersonnel(int PowerStationId); Task<List<MyUser>> GetOperationPersonnel(int PowerStationId);
Task InsertNoticeSchedule(List<MyUser> personal, string Title, string content); Task InsertNoticeSchedule(List<MyUser> personal, string Title, string content, int emailType);
Task AddOperationRecordPersonnelAsync(List<OperationRecordPersonnel> entity, List<string> properties); Task AddOperationRecordPersonnelAsync(List<OperationRecordPersonnel> entity, List<string> properties);
@ -83,6 +83,12 @@ namespace SolarPower.Repository.Interface
Task DeleteOperationRecordPersonnel(List<OperationRecordPersonnel> operationRecordPersonnels); Task DeleteOperationRecordPersonnel(List<OperationRecordPersonnel> operationRecordPersonnels);
Task DeleteRecord(List<int> operations); Task DeleteRecord(List<int> operations);
/// <summary>
/// 取所有維運人員
/// </summary>
/// <returns></returns>
Task<List<MyUser>> GetAllOperations();
} }
} }