|
@@ -29,7 +29,6 @@ using static TEAMModelOS.SDK.Models.Service.LessonService;
|
|
|
using DinkToPdf.Contracts;
|
|
|
using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
|
|
|
using static TEAMModelOS.SDK.StatisticsService;
|
|
|
-using TEAMModelOS.SDK.DI.CoreAPI;
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
using System.Xml.Linq;
|
|
@@ -57,7 +56,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
private readonly AzureRedisFactory _azureRedis;
|
|
|
private readonly AzureServiceBusFactory _serviceBus;
|
|
|
private readonly Option _option;
|
|
|
- private readonly NotificationService _notificationService;
|
|
|
private readonly CoreAPIHttpService _coreAPIHttpService;
|
|
|
private readonly IConfiguration _configuration;
|
|
|
private readonly IConverter _converter;
|
|
@@ -66,7 +64,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
public ActiveTaskTopic(SnowflakeId snowflakeId, IConverter converter, CoreAPIHttpService coreAPIHttpService,
|
|
|
AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis,
|
|
|
AzureServiceBusFactory serviceBus, IOptionsSnapshot<Option> option,
|
|
|
- NotificationService notificationService, IConfiguration configuration, IHttpClientFactory httpClient)
|
|
|
+ IConfiguration configuration, IHttpClientFactory httpClient)
|
|
|
{
|
|
|
_azureCosmos = azureCosmos;
|
|
|
_dingDing = dingDing;
|
|
@@ -74,7 +72,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
_azureRedis = azureRedis;
|
|
|
_serviceBus = serviceBus;
|
|
|
_option = option?.Value;
|
|
|
- _notificationService = notificationService;
|
|
|
_configuration = configuration;
|
|
|
_coreAPIHttpService = coreAPIHttpService;
|
|
|
_converter = converter;
|
|
@@ -1260,23 +1257,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
var result = await BatchCopyFileService.CopyFile(_dingDing, _azureStorage, bIBatchCopyFile);
|
|
|
if (result == 200)
|
|
|
{
|
|
|
- //发送消息实体
|
|
|
- Notification notification = new Notification
|
|
|
- {
|
|
|
- hubName = "hita",
|
|
|
- type = "msg",
|
|
|
- from = $"BI:{_option.Location}:private",
|
|
|
- to = bIBatchCopyFile.tmdIds,
|
|
|
- label = $"{bIBatchCopyFile.codeKey}_finish",
|
|
|
- body = new { location = $"{Environment.GetEnvironmentVariable("Option:Location")}", biz = $"{bIBatchCopyFile.codeKey}", tmdid = $"{bIBatchCopyFile.tmdid}", tmdname = $"{bIBatchCopyFile.tmdName}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
|
|
|
- expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
|
|
|
- };
|
|
|
-
|
|
|
- var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
|
|
|
- var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
|
|
|
- var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
- var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
|
|
|
- await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -1565,7 +1546,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
lessonRecord.upload = 1;
|
|
|
// await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} 更新完成", GroupNames.醍摩豆服務運維群組);
|
|
|
|
|
|
- LessonService.DoAutoDeleteSchoolLessonRecord(lessonRecord, scope, client, school, tmdid, teacher, _notificationService, _serviceBus, _azureStorage, _configuration,_coreAPIHttpService,_dingDing, _azureRedis);
|
|
|
+ LessonService.DoAutoDeleteSchoolLessonRecord(lessonRecord, scope, client, school, tmdid, teacher, _serviceBus, _azureStorage, _configuration,_coreAPIHttpService,_dingDing, _azureRedis);
|
|
|
long? size = await _azureStorage.GetBlobContainerClient(blobname).GetBlobsSize($"records/{_lessonId}");
|
|
|
Bloblog bloblog = new Bloblog
|
|
|
{
|
|
@@ -1588,7 +1569,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
//await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} blob刷新完成!", GroupNames.醍摩豆服務運維群組);
|
|
|
msgs.Add(update);
|
|
|
|
|
|
- DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher, _notificationService, _serviceBus, _azureStorage, _configuration, lessonBase);
|
|
|
+ DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher, _serviceBus, _azureStorage, _configuration, lessonBase);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -1849,35 +1830,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
//result.Add(Constant.private_lesson_expire, lessonRecordExpire.expire);
|
|
|
result.Add(Constant.private_lesson_expire, new ExpireTag { expire = lessonRecordExpire.expire, tag = "delete" });
|
|
|
string biz = "expire";
|
|
|
- Notification notification = new Notification
|
|
|
- {
|
|
|
- hubName = "hita",
|
|
|
- type = "msg",
|
|
|
- from = $"ies5:{Environment.GetEnvironmentVariable("Option:Location")}:private",
|
|
|
- to = new List<string> { tmdid },
|
|
|
- label = $"{biz}_lessonRecord",
|
|
|
- body = new
|
|
|
- {
|
|
|
- location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
|
|
|
- biz = biz,
|
|
|
- tmdid = teacher.id,
|
|
|
- tmdname = teacher.name,
|
|
|
- sid = lessonRecordExpire.id,
|
|
|
- sname = lessonRecordExpire.name,
|
|
|
- scope = scope,
|
|
|
- stime = lessonRecordExpire.startTime,
|
|
|
- expire = lessonRecordExpire.expire,
|
|
|
- status = 1,
|
|
|
- //day = Constant.private_lesson_expire,
|
|
|
- time = now
|
|
|
- }.ToJsonString(),
|
|
|
- expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
|
|
|
- };
|
|
|
- var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
|
|
|
- var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
|
|
|
- var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
- var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
|
|
|
- await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
|
|
|
string expireTime= DateTimeOffset.FromUnixTimeMilliseconds(lessonRecordExpire.expire).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
_coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = teacher.id, name = teacher.name, code = teacher.lang } }, "expire-private_lessonRecord", Constant.NotifyType_IES5_Course,
|
|
|
new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.name }, { "expireTime", expireTime }, { "lessonId", lessonRecordExpire.id }, { "lessonName", lessonRecordExpire. name } }, $"{Environment.GetEnvironmentVariable("Option:Location")}", _configuration, _dingDing, "");
|
|
@@ -2014,35 +1966,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
}
|
|
|
}
|
|
|
string biz = "expire";
|
|
|
- Notification notification = new Notification
|
|
|
- {
|
|
|
- hubName = "hita",
|
|
|
- type = "msg",
|
|
|
- from = $"ies5:{_option.Location}:private",
|
|
|
- to = new List<string> { $"{tmdid}" },
|
|
|
- label = $"{biz}_lessonRecord",
|
|
|
- body = new
|
|
|
- {
|
|
|
- location = $"{Environment.GetEnvironmentVariable("Option:Location")}",
|
|
|
- biz = biz,
|
|
|
- tmdid = $"{tmdid}",
|
|
|
- tmdname = tmdname,
|
|
|
- sid = $"{id}",
|
|
|
- sname = $"{name}",
|
|
|
- stime = long.Parse($"{startTime}"),
|
|
|
- expire = long.Parse($"{expire}"),
|
|
|
- status = 1,
|
|
|
- //day = Constant.private_lesson_expire,
|
|
|
- time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
|
|
- }.ToJsonString(),
|
|
|
- expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
|
|
|
- };
|
|
|
- var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
|
|
|
- var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
|
|
|
- var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
|
|
|
- var location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
|
|
|
- await _notificationService.SendNotification(clientID, clientSecret, location, url, notification); //站内发送消息
|
|
|
-
|
|
|
Teacher targetTeacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{tmdid}", new PartitionKey($"Base"));
|
|
|
string expireTime = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse($"{expire}")).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
_coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "expire-private_lessonRecord", Constant.NotifyType_IES5_Course,
|