diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs
index 14ae43cb..98af6211 100644
--- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs
+++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs
@@ -1,4 +1,6 @@
-namespace Tiobon.Core.Api.Controllers;
+using Tiobon.Core.Model.ViewModels.Extend;
+
+namespace Tiobon.Core.Api.Controllers;
///
/// 开班管理(Controller)
@@ -230,4 +232,14 @@ public class Ghre_OpenClassController : BaseController Email(long Id) => await _service.Email(Id);
#endregion
+
+ #region 统计
+ ///
+ /// 统计
+ ///
+ /// 开班ID
+ ///
+ [HttpPost, Route("QueryStatistic/{Id}")]
+ public async Task> QueryStatistic(long Id) => await _service.QueryStatistic(Id);
+ #endregion
}
\ No newline at end of file
diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 5d0f50c6..4ce6e477 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -42483,6 +42483,41 @@
问卷调查题目
+
+
+ 课程得分
+
+
+
+
+ 讲师得分
+
+
+
+
+ 反馈统计得发
+
+
+
+
+ 今日新增
+
+
+
+
+ 已填写
+
+
+
+
+ 未填写
+
+
+
+
+ 全部
+
+
人力需求维护ID
diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml
index fde5df77..8ad11a2a 100644
--- a/Tiobon.Core.Api/Tiobon.Core.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.xml
@@ -1298,6 +1298,13 @@
开班ID
+
+
+ 统计
+
+ 开班ID
+
+
开班费用(Controller)
diff --git a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs
index f4bfcaa4..11512961 100644
--- a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs
+++ b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs
@@ -1,4 +1,5 @@
using Tiobon.Core.Model;
+using Tiobon.Core.Model.ViewModels.Extend;
namespace Tiobon.Core.IServices;
@@ -37,4 +38,6 @@ public interface IGhre_OpenClassServices : IBaseServices Attend(long Id, string type);
Task Email(long Id);
+
+ Task> QueryStatistic(long id);
}
\ No newline at end of file
diff --git a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs
index b76c14ea..f409322a 100644
--- a/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs
+++ b/Tiobon.Core.Model/ViewModels/Extend/InsertGhre_SurveyExtend.cs
@@ -189,7 +189,7 @@ public class Ghre_SurveyQuestionExtendBase
///
[Display(Name = "RemarkSz"), Description("备注"), MaxLength(2000, ErrorMessage = "备注 不能超过 2000 个字符")]
public string RemarkSz { get; set; }
-
+
///
/// 内置
///
@@ -359,4 +359,85 @@ public class Ghre_SurveyStatisticQuestionTable
public string Percent { get; set; }
public decimal? Percent1 { get; set; } = 0;
+}
+
+public class Ghre_OpenClassStatistic
+{
+ ///
+ /// 课程得分
+ ///
+ public decimal? CourseScore { get; set; } = 0;
+
+ ///
+ /// 讲师得分
+ ///
+ public decimal? TeacherScore { get; set; } = 0;
+
+ ///
+ /// 反馈统计得发
+ ///
+ public int TotalScore { get; set; } = 0;
+
+ public Ghre_OpenClassGroup CourseGroup { get; set; } = new Ghre_OpenClassGroup();
+ public Ghre_OpenClassGroup TeacherGroup { get; set; } = new Ghre_OpenClassGroup();
+
+
+ public Ghre_OpenClassTotalGroup TotalGroup { get; set; } = new Ghre_OpenClassTotalGroup();
+ public List Records { get; set; } = new List();
+
+}
+
+public class Ghre_OpenClassStatisticRecord
+{
+ public long Id { get; set; }
+ public string StaffNo { get; set; }
+ public string StaffName { get; set; }
+ public string DeptName { get; set; }
+ public string CourseName { get; set; }
+ public string ScoreStatus { get; set; }
+ public decimal Score { get; set; }
+ public string Source { get; set; }
+}
+
+
+public class Ghre_OpenClassGroup
+{
+ public List Trainee { get; set; } = new List();
+ public List ParentTeacher { get; set; } = new List();
+}
+
+public class Ghre_OpenClassQuestion
+{
+ public long Id { get; set; }
+ public string QuestionContent { get; set; }
+ public string QuestionType { get; set; }
+ public string FullName { get; set; }
+ public decimal? Score { get; set; }
+}
+
+public class Ghre_OpenClassTotalGroup
+{
+ ///
+ /// 今日新增
+ ///
+ public int New { get; set; }
+
+ ///
+ /// 已填写
+ ///
+ public int Has { get; set; }
+
+ ///
+ /// 未填写
+ ///
+ public int Not { get; set; }
+
+ ///
+ /// 全部
+ ///
+ public int All { get; set; }
+
+
+ public Ghre_SurveyStatistic Trainee { get; set; }
+ public Ghre_SurveyStatistic ParentTeacher { get; set; }
}
\ No newline at end of file
diff --git a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs
index ee0570f0..dcfebdd9 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs
@@ -12,6 +12,7 @@ public class Ghre_OpenClassServices : BaseServices _dal;
public Ghre_OpenClassServices(ICaching caching,
IBaseRepository dal,
@@ -19,6 +20,7 @@ public class Ghre_OpenClassServices : BaseServices> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
@@ -857,12 +860,84 @@ WHERE A.OpenClassId = '{Id}' AND A.IsEnable = 1";
///
/// 开班ID
///
-
- public async Task> QueryStatistic(long id)
+ public async Task> QueryStatistic(long id)
{
- var data = new Ghre_SurveyStatistic();
+ var data = new Ghre_OpenClassStatistic();
+
+ var entity = await base.QueryById(id);
+
+ var surveyRecords = await Db.Queryable().Where(x => x.OpenClassId == id).ToListAsync();
+
+ var surveyIds = surveyRecords.Select(x => x.SurveyId).Distinct().ToList();
+ var recordOptions = await Db.Queryable()
+ .Where(x => surveyIds.Contains(x.SurveyId))
+ .ToListAsync();
+
+ data.CourseScore = surveyRecords.Sum(x => x.Score);
+ data.TeacherScore = surveyRecords.Sum(x => x.Score);
+
+ var questions = await Db.Queryable()
+ .OrderBy(x => x.SortNo)
+ .Where(x => x.SurveyId == entity.FeedbackId)
+ .Select(x => new Ghre_OpenClassQuestion()
+ {
+ Id = x.Id,
+ QuestionContent = x.QuestionContent,
+ QuestionType = x.QuestionType,
+ Score = 0
+ }).ToListAsync();
+
+ var parentQuestions = await Db.Queryable()
+ .OrderBy(x => x.SortNo)
+ .Where(x => x.SurveyId == entity.ParentFeedbackId)
+ .Select(x => new Ghre_OpenClassQuestion()
+ {
+ Id = x.Id,
+ QuestionContent = x.QuestionContent,
+ QuestionType = x.QuestionType,
+ Score = 0
+ }).ToListAsync();
+
+ questions.ForEach(async x =>
+ {
+ x.QuestionType = await GetParaLabel("SurveyQuestionType", x.QuestionType);
+ x.Score = recordOptions.Where(o => o.SurveyQuestionId == x.Id).Sum(x => x.Score);
+ });
+
+ parentQuestions.ForEach(async x =>
+ {
+ x.QuestionType = await GetParaLabel("SurveyQuestionType", x.QuestionType);
+ x.Score = recordOptions.Where(o => o.SurveyQuestionId == x.Id).Sum(x => x.Score);
+ });
- return ServiceResult.OprateSuccess("查询成功!", data);
+ data.CourseGroup.Trainee = questions;
+ data.CourseGroup.ParentTeacher = parentQuestions;
+
+ data.TeacherGroup.Trainee = questions;
+ data.TeacherGroup.ParentTeacher = parentQuestions;
+
+ data.TotalGroup.Trainee = (await _ghre_SurveyServices.QueryStatistic(entity.FeedbackId.Value)).Data;
+ data.TotalGroup.ParentTeacher = (await _ghre_SurveyServices.QueryStatistic(entity.ParentFeedbackId.Value)).Data;
+
+ string sql = @$"SELECT A.Id,
+ B.StaffNo,
+ B.StaffName,
+ C.DeptName,
+ D.CourseName,
+ '已评' ScoreStatus,
+ 0 Score,
+ CASE A.Source
+ WHEN 'ParentTeacher' THEN '讲师上级'
+ WHEN 'Trainee' THEN '学员'
+ END AS Source
+FROM Ghre_OpenClassFeedback A
+ LEFT JOIN Ghra_Staff B ON A.StaffId = B.StaffID
+ LEFT JOIN Ghro_Dept C ON C.DeptID = B.DeptID
+ LEFT JOIN Ghre_Course D ON A.CourseId = D.Id
+WHERE A.SurveyId = {entity.FeedbackId} OR A.SurveyId = {entity.ParentFeedbackId}";
+ data.Records = DbAccess.QueryList(sql);
+
+ return ServiceResult.OprateSuccess("查询成功!", data);
}
#endregion
}
\ No newline at end of file
diff --git a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
index ffe503ca..afdb9475 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
@@ -428,6 +428,7 @@ public class Ghre_SurveyServices : BaseServices x.OptionNo == question.Value1[j]).FirstOrDefault();
option1.SurveyQuestionOptionId = questionOption1?.Id;
+ option1.Score = questionOption1?.Score;
option1.OptionContent = question.Value1[j];
if (questionOption1.IsOther == true)
@@ -455,6 +456,7 @@ public class Ghre_SurveyServices : BaseServices x.OptionNo == question.Value).FirstOrDefault();
option.SurveyQuestionOptionId = questionOption?.Id;
+ option.Score = questionOption?.Score;
option.OptionContent = question.Value;
if (questionOption.IsOther == true)
option.Reverse1 = questionOption.OtherContent;
diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml
index 5d0f50c6..4ce6e477 100644
--- a/Tiobon.Core/Tiobon.Core.Model.xml
+++ b/Tiobon.Core/Tiobon.Core.Model.xml
@@ -42483,6 +42483,41 @@
问卷调查题目
+
+
+ 课程得分
+
+
+
+
+ 讲师得分
+
+
+
+
+ 反馈统计得发
+
+
+
+
+ 今日新增
+
+
+
+
+ 已填写
+
+
+
+
+ 未填写
+
+
+
+
+ 全部
+
+
人力需求维护ID
diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml
index fde5df77..8ad11a2a 100644
--- a/Tiobon.Core/Tiobon.Core.xml
+++ b/Tiobon.Core/Tiobon.Core.xml
@@ -1298,6 +1298,13 @@
开班ID
+
+
+ 统计
+
+ 开班ID
+
+
开班费用(Controller)