Commit 9f372145 authored by liudong1993's avatar liudong1993

1

parent 4e70c537
......@@ -16,5 +16,6 @@ namespace EduSpider.Repository
public interface IExamRepository : IDBRepository<RB_Exam>, IDependency
{
List<RB_Exam_Extend> GetExamPageList(int pageIndex, int pageSize, out long count, RB_Exam_Extend demodel);
List<RB_Exam_Extend> GetExamList(RB_Exam_Extend rB_Exam_Extend);
}
}
using EduSpider.Model.Extend;
using EduSpider.Model.Cache;
using EduSpider.Model.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -15,8 +16,12 @@ namespace EduSpider.IServices
{
string ImportExcelForStuExamScore(string path_server,int courseId, string examName, int userId);
List<RB_Exam_Extend> GetExamPageList(int pageIndex, int pageSize, out long count, RB_Exam_Extend demodel);
object GetExamStuScoreInfo(int examId, int stuId, int stuUId);
object GetExamStuScoreInfo(int examId, int stuId, int stuUId, out string msg);
object GetExamStuScoreInfo_Group(int examId, int stuId, int stuUId);
List<RB_Exam_Score_Extend> GetExamStuList(RB_Exam_Score_Extend demodel);
string DelExamInfo(int examId, int baseUserId);
string SetExamStatAnalysis(int courseId, UserInfo userInfo);
object GetExamStatAnalysisInfo(int examId, int stuId, int stuUId, out string msg);
}
}
......@@ -53,5 +53,10 @@ namespace EduSpider.Model.Entity
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 类型 1正常考试 2分组试题 3统计分析
/// </summary>
public int Type { get; set; }
}
}
......@@ -43,5 +43,10 @@ namespace EduSpider.Model.Entity
/// 分数
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 分组
/// </summary>
public string GroupName { get; set; }
}
}
......@@ -9,6 +9,14 @@ namespace EduSpider.Model.Extend
/// </summary>
public class RB_Exam_Questions_Extend : RB_Exam_Questions
{
/// <summary>
/// 考试ids
/// </summary>
public string ExamIds { get; set; }
/// <summary>
/// 分组排序
/// </summary>
public int GroupNum { get; set; }
}
}
......@@ -22,6 +22,26 @@ namespace EduSpider.Model.Extend
/// 考试导入时间
/// </summary>
public DateTime ExamCreateTime { get; set; }
/// <summary>
/// 考试ids
/// </summary>
public string ExamIds { get; set; }
/// <summary>
/// 1-8题得分
/// </summary>
public decimal PartScore { get; set; }
/// <summary>
/// 一试得分
/// </summary>
public decimal AScore { get; set; }
/// <summary>
/// 一试排名
/// </summary>
public int ARank { get; set; }
}
/// <summary>
......@@ -56,5 +76,84 @@ namespace EduSpider.Model.Extend
/// 题目分数
/// </summary>
public decimal QScore { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 分组排序
/// </summary>
public int GroupNum { get; set; }
}
/// <summary>
/// 1-8题得分
/// </summary>
public class ExamPartScoreModel {
/// <summary>
/// 学生ID
/// </summary>
public int StuId { get; set; }
/// <summary>
/// 第几次考试
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 考试名称 /知识点名称
/// </summary>
public string ExamName { get; set; }
/// <summary>
/// 个人得分/ 考试排名
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 平均得分
/// </summary>
public decimal AvgScore { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 分组次数
/// </summary>
public int GroupNum { get; set; }
/// <summary>
/// 总分
/// </summary>
public decimal TScore { get; set; }
}
/// <summary>
/// 统计分析
/// </summary>
public class ExamStatModel {
/// <summary>
/// 1-8题
/// </summary>
public List<ExamPartScoreModel> PartScoreList { get; set; }
/// <summary>
/// 分组排名
/// </summary>
public List<ExamPartScoreModel> GroupScoreList { get; set; }
/// <summary>
/// 总排名
/// </summary>
public List<ExamPartScoreModel> TRankScoreList { get; set; }
/// <summary>
/// 模块分析
/// </summary>
public List<ExamPartScoreModel> ModuleScoreList { get; set; }
}
}
......@@ -47,5 +47,37 @@ LEFT JOIN (
where {where} order by e.ExamId desc";
return GetPage<RB_Exam_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
/// <summary>
/// 获取考试列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Exam_Extend> GetExamList(RB_Exam_Extend demodel)
{
var parameters = new DynamicParameters();
string where = " 1=1 and e.Status =0";
if (demodel.CourseId > 0)
{
where += $@" and e.{nameof(RB_Exam_Extend.CourseId)} ={demodel.CourseId}";
}
if (!string.IsNullOrEmpty(demodel.ExamName))
{
where += $@" and e.{nameof(RB_Exam_Extend.ExamName)} like @ExamName";
parameters.Add("ExamName", "%" + demodel.ExamName.Trim() + "%");
}
if (demodel.CreateBy > 0)
{
where += $@" and e.{nameof(RB_Exam_Extend.CreateBy)} ={demodel.CreateBy}";
}
if (demodel.Type > 0)
{
where += $@" and e.{nameof(RB_Exam_Extend.Type)} ={demodel.Type}";
}
string sql = $@"select e.* FROM rb_exam e
where {where} order by e.ExamId desc";
return Get<RB_Exam_Extend>(sql, parameters).ToList();
}
}
}
......@@ -26,6 +26,11 @@ namespace EduSpider.Repository
{
where += $" and {nameof(RB_Exam_Questions_Extend.ExamId)} ={dmodel.ExamId}";
}
if (!string.IsNullOrEmpty(dmodel.ExamIds))
{
where += $" and {nameof(RB_Exam_Questions_Extend.ExamId)} in({dmodel.ExamIds})";
}
string sql = $"select * from RB_Exam_Questions where {where}";
return Get<RB_Exam_Questions_Extend>(sql).ToList();
}
......
......@@ -50,6 +50,10 @@ WHERE 1=1 and B.Status =0
{
where += $" and {nameof(RB_Exam_Score_Extend.ExamId)} ={dmodel.ExamId}";
}
if (!string.IsNullOrEmpty(dmodel.ExamIds))
{
where += $" and {nameof(RB_Exam_Score_Extend.ExamId)} in({dmodel.ExamIds})";
}
if (dmodel.StuId > 0)
{
where += $" and {nameof(RB_Exam_Score_Extend.StuId)} ={dmodel.StuId}";
......
This diff is collapsed.
......@@ -45,7 +45,8 @@ namespace EduSpider.WebApi.Controllers
x.FailNum,
x.TScore,
AvgScore = x.StuNum > 0 ? Math.Round(x.TScore / x.StuNum, 2, MidpointRounding.AwayFromZero) : 0,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm")
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm"),
x.Type
});
return ApiResult.Success("", pmodel);
}
......@@ -92,7 +93,34 @@ namespace EduSpider.WebApi.Controllers
return ApiResult.ParamIsNull();
}
var robj = ExamService.GetExamStuScoreInfo(ExamId, StuId, StuUId);
var robj = ExamService.GetExamStuScoreInfo(ExamId, StuId, StuUId, out string msg);
if (msg == "")
{
return ApiResult.Success("", robj);
}
else
{
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 获取学生考试明细(分组的)
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetExamStuScoreInfo_Group()
{
int ExamId = ReqParameters.GetInt("ExamId");//考试ID
int StuId = ReqParameters.GetInt("StuId");//学生id
int StuUId = ReqParameters.GetInt("StuUId");//学生Uid
if (ExamId <= 0 || (StuId <= 0 && StuUId <= 0))
{
return ApiResult.ParamIsNull();
}
var robj = ExamService.GetExamStuScoreInfo_Group(ExamId, StuId, StuUId);
return ApiResult.Success("", robj);
}
......@@ -122,5 +150,63 @@ namespace EduSpider.WebApi.Controllers
}
}
#region 统计分析
/// <summary>
/// 新增统计分析
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetExamStatAnalysis() {
int CourseId = ReqParameters.GetInt("CourseId");//课程ID
if (CourseId <= 0)
{
return ApiResult.ParamIsNull("请传递课程ID");
}
if (UserInfo.AccountType != Utility.Enum.AccountTypeEnum.Teacher)
{
return ApiResult.ParamIsNull("非老师账户,无法操作");
}
string rmsg = ExamService.SetExamStatAnalysis(CourseId, base.UserInfo);
if (rmsg == "")
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed(rmsg);
}
}
/// <summary>
/// 获取统计分析详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetExamStatAnalysisInfo() {
int ExamId = ReqParameters.GetInt("ExamId");//考试ID
int StuId = ReqParameters.GetInt("StuId");//学生id
int StuUId = ReqParameters.GetInt("StuUId");//学生Uid
if (ExamId <= 0 || (StuId <= 0 && StuUId <= 0))
{
return ApiResult.ParamIsNull();
}
var robj = ExamService.GetExamStatAnalysisInfo(ExamId, StuId, StuUId, out string msg);
if (msg == "")
{
return ApiResult.Success("", robj);
}
else
{
return ApiResult.Failed(msg);
}
}
#endregion
}
}
......@@ -126,10 +126,10 @@ namespace EduSpider.WebApi.Controllers
{
try
{
string path_server = "C:/Users/Administrator/Desktop/TempFile/化学成绩查询表.xlsx";
string path_server = "C:/Users/Administrator/Desktop/TempFile/进阶小程序考试导入/初中鸿志班第三次测试3组.xlsx";
#region 解析文档数据并保存
string rmsg = ExamService.ImportExcelForStuExamScore(path_server, 44977497, "测试考试化学2", 11759328);
string rmsg = ExamService.ImportExcelForStuExamScore(path_server, 208720463, "测试考试化学2", 646277);
if (rmsg == "")
{
return ApiResult.Success();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment