新增 课程id主动获取
This commit is contained in:
parent
d3764e1d33
commit
eca3e9278e
|
|
@ -57,6 +57,8 @@
|
||||||
},
|
},
|
||||||
"DB": {
|
"DB": {
|
||||||
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
|
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
|
//"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
|
|
||||||
"SqlType": "MySql",
|
"SqlType": "MySql",
|
||||||
"UpdateTable": false
|
"UpdateTable": false
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ using VideoAnalysisCore.AICore.GPT.Dto;
|
||||||
using VideoAnalysisCore.Model;
|
using VideoAnalysisCore.Model;
|
||||||
using VideoAnalysisCore.Controllers.Dto;
|
using VideoAnalysisCore.Controllers.Dto;
|
||||||
using VideoAnalysisCore.Model.Dto;
|
using VideoAnalysisCore.Model.Dto;
|
||||||
|
using VideoAnalysisCore.Model.À¶¾¨ÖÇ¿â;
|
||||||
|
|
||||||
namespace VideoAnalysisCore.Controllers
|
namespace VideoAnalysisCore.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -32,6 +33,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
private readonly IMapper mp;
|
private readonly IMapper mp;
|
||||||
private readonly Repository<NodeSubscription> nodesubscriptionDB;
|
private readonly Repository<NodeSubscription> nodesubscriptionDB;
|
||||||
private readonly Repository<VideoTask> videoTaskDB;
|
private readonly Repository<VideoTask> videoTaskDB;
|
||||||
|
private readonly Repository<CourseInfo> courseInfoDB;
|
||||||
private readonly Repository<VideoKonwPoint> videoKonwPointDB;
|
private readonly Repository<VideoKonwPoint> videoKonwPointDB;
|
||||||
private readonly Repository<NodePackageInfo> nodePackageInfoDB;
|
private readonly Repository<NodePackageInfo> nodePackageInfoDB;
|
||||||
private readonly Repository<VideoQuestion> videoQuestionDB;
|
private readonly Repository<VideoQuestion> videoQuestionDB;
|
||||||
|
|
@ -39,7 +41,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
|
|
||||||
public LJZK_Controller(IMapper mp, Repository<NodeSubscription> nodesubscriptionDB,
|
public LJZK_Controller(IMapper mp, Repository<NodeSubscription> nodesubscriptionDB,
|
||||||
Repository<VideoTask> videoTaskDB = null, Repository<VideoKonwPoint> videoKonwPointDB = null
|
Repository<VideoTask> videoTaskDB = null, Repository<VideoKonwPoint> videoKonwPointDB = null
|
||||||
, Repository<NodePackageInfo> nodePackageInfoDB = null, Repository<VideoQuestion> videoQuestionDB = null, Repository<VideoQuestionKonw> videoQuestionKonwDB = null)
|
, Repository<NodePackageInfo> nodePackageInfoDB = null, Repository<VideoQuestion> videoQuestionDB = null, Repository<VideoQuestionKonw> videoQuestionKonwDB = null, Repository<CourseInfo> courseInfoDB = null)
|
||||||
{
|
{
|
||||||
this.mp = mp;
|
this.mp = mp;
|
||||||
this.nodesubscriptionDB = nodesubscriptionDB;
|
this.nodesubscriptionDB = nodesubscriptionDB;
|
||||||
|
|
@ -48,6 +50,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
this.nodePackageInfoDB = nodePackageInfoDB;
|
this.nodePackageInfoDB = nodePackageInfoDB;
|
||||||
this.videoQuestionDB = videoQuestionDB;
|
this.videoQuestionDB = videoQuestionDB;
|
||||||
this.videoQuestionKonwDB = videoQuestionKonwDB;
|
this.videoQuestionKonwDB = videoQuestionKonwDB;
|
||||||
|
this.courseInfoDB = courseInfoDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -66,11 +69,16 @@ namespace VideoAnalysisCore.Controllers
|
||||||
var videos = new List<VideoTask>(reqArr.Count());
|
var videos = new List<VideoTask>(reqArr.Count());
|
||||||
var nodePackages = new List<NodePackageInfo>(reqArr.Count());
|
var nodePackages = new List<NodePackageInfo>(reqArr.Count());
|
||||||
var videoIdArr = videoTaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray();
|
var videoIdArr = videoTaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray();
|
||||||
|
var courseArr = await courseInfoDB.AsQueryable().ToArrayAsync();
|
||||||
foreach (var sGroup in reqArr.GroupBy(s => s.ContentId))
|
foreach (var sGroup in reqArr.GroupBy(s => s.ContentId))
|
||||||
{
|
{
|
||||||
var s = sGroup.FirstOrDefault(s => s.VideoType == VideoType.摄像头);
|
var s = sGroup.FirstOrDefault(s => s.VideoType == VideoType.摄像头);
|
||||||
if (s is null)
|
if (s is null)
|
||||||
return BadRequest("无有效的老师授课视频");
|
return BadRequest("无有效的老师授课视频");
|
||||||
|
var stageId = s.StageId.GetHashCode();
|
||||||
|
var subjectId = s.SubjectId.GetHashCode();
|
||||||
|
var course = courseArr.FirstOrDefault(x => stageId == x.Stage_Id && subjectId == x.Subject_Id);
|
||||||
|
if (course == null) continue;
|
||||||
var sPPT = sGroup.FirstOrDefault(s => s.VideoType == VideoType.PPT课件);
|
var sPPT = sGroup.FirstOrDefault(s => s.VideoType == VideoType.PPT课件);
|
||||||
var np = new NodePackageInfo()
|
var np = new NodePackageInfo()
|
||||||
{
|
{
|
||||||
|
|
@ -78,7 +86,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
MaterialId = s.MaterialId,
|
MaterialId = s.MaterialId,
|
||||||
AttachmentId = s.AttachmentId,
|
AttachmentId = s.AttachmentId,
|
||||||
Stage = s.StageId,
|
Stage = s.StageId,
|
||||||
CourseId = s.CourseId,
|
CourseId = course.Id,
|
||||||
SubjectType = s.SubjectId,
|
SubjectType = s.SubjectId,
|
||||||
VideoUrl = s.VideoUrl,
|
VideoUrl = s.VideoUrl,
|
||||||
CourseType = s.CourseType,
|
CourseType = s.CourseType,
|
||||||
|
|
@ -87,8 +95,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
HostIP = s.HostIP,
|
HostIP = s.HostIP,
|
||||||
};
|
};
|
||||||
nodePackages.Add(np);
|
nodePackages.Add(np);
|
||||||
if (videoIdArr.Contains(s.VideoCode))
|
if (videoIdArr.Contains(s.VideoCode)) continue;
|
||||||
continue;
|
|
||||||
var pptCode = sPPT != null ? sPPT.VideoCode : string.Empty;
|
var pptCode = sPPT != null ? sPPT.VideoCode : string.Empty;
|
||||||
videos.Add(new VideoTask()
|
videos.Add(new VideoTask()
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +103,7 @@ namespace VideoAnalysisCore.Controllers
|
||||||
ComeFrom = GetClientIpAddress(),
|
ComeFrom = GetClientIpAddress(),
|
||||||
ApiToken = "",
|
ApiToken = "",
|
||||||
EducationStage = s.StageId,
|
EducationStage = s.StageId,
|
||||||
CourseId = s.CourseId,
|
CourseId = course.Id,
|
||||||
Subject = s.SubjectId,
|
Subject = s.SubjectId,
|
||||||
TagId = s.VideoCode,
|
TagId = s.VideoCode,
|
||||||
MediaUrl = s.VideoUrl,
|
MediaUrl = s.VideoUrl,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VideoAnalysisCore.Model.蓝鲸智库
|
||||||
|
{
|
||||||
|
[SugarTable(TableDescription = "课程表", TableName = "courseinfo")]
|
||||||
|
[Tenant("1001")]
|
||||||
|
public class CourseInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键Id 这里使用数据来源Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, ColumnDescription = "Id 主键", ColumnName = "id")] //设置主键
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 学科Id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "学科Id", ColumnName = "subject_id")]
|
||||||
|
public long Subject_Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 课程名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDataType = "varchar(500)", ColumnDescription = "课程名称", ColumnName = "name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 学段ID
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "学段ID", ColumnName = "stage_id", IsNullable = true)]
|
||||||
|
public long? Stage_Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "学科网数据创建时间", ColumnName = "create_time", IsNullable = true)]
|
||||||
|
public DateTime? Create_Time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnDescription = "学科网数据更新时间", ColumnName = "update_time", IsNullable = true)]
|
||||||
|
public DateTime? Update_Time { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue