Browse Source

Merge branch '塔里木分支' of 123.57.209.16:bjquanjiang/DigitalScholl into 塔里木分支

新疆影视学院高职
liangkun 2 years ago
parent
commit
63b475eb36
6 changed files with 221 additions and 14 deletions
  1. +15
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/InputScoreIndexInTeacher.js
  3. +19
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs
  4. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs
  5. +100
    -13
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs
  6. +85
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/ZipHelper.cs

+ 15
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs View File

@@ -532,6 +532,21 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers

return Success(data);
}

/// <summary>
/// 班级下拉框信息【成绩录入】
/// </summary>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetClassNoDataForInput(string lessonNo)
{
var loginInfo = LoginUserInfo.Get();
var semesterAndYear = Common.GetSemesterAndYear();
var data = stuScoreIBLL.GetClassNoDataForInput(loginInfo.account, loginInfo.Description, lessonNo, semesterAndYear.AcademicYearShort, semesterAndYear.Semester);
return Success(data);
}
/// <summary>
/// 班级下拉框信息【全院班级成绩查看】
/// </summary>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/InputScoreIndexInTeacher.js View File

@@ -562,7 +562,7 @@ var bootstrap = function ($, learun) {
select: function (item) {
if (!!item) {
$("#ClassNo").lrselectRefresh({
url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetClassNoData?lessonNo=' + item.value,
url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetClassNoDataForInput?lessonNo=' + item.value,
value: 'value',
text: 'text',
});


+ 19
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs View File

@@ -540,6 +540,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
}
}

public IEnumerable<WebHelper.YearGrade> GetClassNoDataForInput(string userAccount, string userType, string lessonNo, string academicYearShort, string semester)
{
try
{
return stuScoreService.GetClassNoDataForInput(userAccount, userType, lessonNo, academicYearShort, semester);
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowBusinessException(ex);
}
}
}

/// <summary>
/// 教师下拉框信息【学生成绩录入可去审核】
/// </summary>


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs View File

@@ -135,6 +135,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
/// </summary>
/// <returns></returns>
IEnumerable<WebHelper.YearGrade> GetClassNoData(string userAccount, string userType, string lessonNo);
IEnumerable<WebHelper.YearGrade> GetClassNoDataForInput(string userAccount, string userType, string lessonNo,string academicYearShort,string semester);

/// <summary>
/// 教师下拉框信息【学生成绩录入可去审核】


+ 100
- 13
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs View File

@@ -1151,6 +1151,51 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
}
}

/// <summary>
/// 班级下拉框【成绩录入】
/// </summary>
/// <param name="userAccount"></param>
/// <param name="userType"></param>
/// <param name="lessonNo"></param>
/// <param name="academicYearShort"></param>
/// <param name="semester"></param>
/// <returns></returns>
public IEnumerable<WebHelper.YearGrade> GetClassNoDataForInput(string userAccount, string userType, string lessonNo, string academicYearShort, string semester)
{
try
{
var strSql = new StringBuilder();
strSql.Append("select distinct s.ClassNo as value,c.ClassName as text from stuscore s inner join ClassInfo c on s.ClassNo=c.ClassNo where s.LessonSortNo='1' ");
if (userType == "教师")
{
strSql.Append(" and s.EmpNo='" + userAccount + "' ");
}

if (!string.IsNullOrEmpty(academicYearShort))
{
strSql.Append(" and s.AcademicYearNo='" + academicYearShort + "' and s.Semester='" + semester + "' ");
}
if (!string.IsNullOrEmpty(lessonNo))
{
strSql.Append(" and s.LessonNo='" + lessonNo + "' ");
}
var data = this.BaseRepository("CollegeMIS").FindList<WebHelper.YearGrade>(strSql.ToString());
data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value);
return data;
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

/// <summary>
/// 教师下拉框信息【学生成绩录入可去审核】
/// </summary>
@@ -2202,8 +2247,10 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
/// <returns></returns>
private (DataTable failDt, int snum, int fnum) ExecuteImportExcelForRequired(DataTable dt, string fileGuid, string queryJson)
{
//成功记录数
int snum = 0;
int fnum = 0;
//总记录数
int num = 0;
var db = this.BaseRepository("CollegeMIS");
var msg = "";
try
@@ -2218,7 +2265,10 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
var Semester = queryParam["Semester"].ToString();
var LessonNo = queryParam["LessonNo"].ToString();
var ClassNo = queryParam["ClassNo"].ToString();
var classInfoEntity = db.FindEntity<ClassInfoEntity>(x => x.ClassNo == ClassNo);
var classInfoList = db.FindList<ClassInfoEntity>();
var lessonInfoList = db.FindList<LessonInfoEntity>();
var classInfoEntity = classInfoList.FirstOrDefault(x => x.ClassNo == ClassNo);
var lessonInfoEntity = lessonInfoList.FirstOrDefault(x => x.LessonNo == LessonNo && x.CheckMark == true);

if (classInfoEntity != null)
{
@@ -2241,16 +2291,30 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
try
{
var stuno = dr["学号"].ToString().Trim();
var academicYearNo_dr = dr["学年"].ToString().Trim();
var semester_dr = dr["学期"].ToString().Trim();
var lessoninfo_dr = dr["课程名称"].ToString().Trim();
var classinfo_dr = dr["班级"].ToString().Trim();
//var lessonNo_dr = lessonInfoList.FirstOrDefault(x => x.LessonName == lessoninfo_dr)?.LessonNo;
//var classNo_dr = classInfoList.FirstOrDefault(x => x.ClassName == classinfo_dr)?.ClassNo;

if (!string.IsNullOrEmpty(stuno))
{
var item = list.Find(x => x.StuNo == stuno);
if (item == null)
num++;
if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(Semester))
{
dr["导入错误"] = "学年学期与查询条件不符!";
failDt.Rows.Add(dr.ItemArray);
continue;
}

if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName) || !classinfo_dr.Equals(classInfoEntity.ClassName))
{
fnum++;
dr["导入错误"] = classInfoEntity.ClassName + "找不到学号为" + stuno + "的学生";
dr["导入错误"] = "课程:" + lessonInfoEntity.LessonName + ",班级:" + classInfoEntity.ClassName + "找不到学号为" + stuno + "的学生";
failDt.Rows.Add(dr.ItemArray);
continue;
}
var item = list.Find(x => x.StuNo == stuno && x.LessonNo == LessonNo && x.ClassNo == ClassNo);
var OrdinaryScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["平时成绩"].ToString().Trim()) ? "0" : dr["平时成绩"].ToString().Trim());
var TermInScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期中成绩"].ToString().Trim()) ? "0" : dr["期中成绩"].ToString().Trim());
var TermEndScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期末成绩"].ToString().Trim()) ? "0" : dr["期末成绩"].ToString().Trim());
@@ -2284,7 +2348,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad

cache.Write<string>(cacheKey + fileGuid, errordt, CacheId.excel);
}
snum = list.Count - failDt.Rows.Count;
snum = (num - failDt.Rows.Count) > 0 ? num - failDt.Rows.Count : 0;
}
}

@@ -2311,8 +2375,11 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
/// <returns></returns>
private (DataTable failDt, int snum, int fnum) ExecuteImportExcelForElective(DataTable dt, string fileGuid, string queryJson)
{

//成功记录数
int snum = 0;
int fnum = 0;
//总记录数
int num = 0;
var db = this.BaseRepository("CollegeMIS");
var msg = "";
try
@@ -2330,6 +2397,11 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
var LessonSection = queryParam["LessonSection"].ToString();
var ClassRoomNo = queryParam["ClassRoomNo"].ToString();

var classRoomList = db.FindList<ClassroomInfoEntity>();
var lessonInfoList = db.FindList<LessonInfoEntity>();
var lessonInfoEntity = lessonInfoList.FirstOrDefault(x => x.LessonNo == LessonNo && x.CheckMark == true);
var classRoomEntity = classRoomList.FirstOrDefault(x => x.ClassroomNo == ClassRoomNo);

//成绩比例数据
var stuSelectLessonListOfElectiveEntity = this.BaseRepository("CollegeMIS").FindEntity<StuSelectLessonListOfElectiveEntity>(x => x.F_SchoolId == F_SchoolId && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.LessonNo == LessonNo && x.LessonSortNo == "2" && x.ClassRoomNo == ClassRoomNo && x.LessonSection == LessonSection);

@@ -2350,13 +2422,28 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
try
{
var stuno = dr["学号"].ToString().Trim();
var academicYearNo_dr = dr["学年"].ToString().Trim();
var semester_dr = dr["学期"].ToString().Trim();
var lessoninfo_dr = dr["课程名称"].ToString().Trim();
var classRoominfo_dr = dr["教室名称"].ToString().Trim();
var lessonSection_dr = dr["节次"].ToString().Trim();

//var lessonNo_dr = lessonInfoList.FirstOrDefault(x => x.LessonName == lessoninfo_dr)?.LessonNo;
//var classRoomNo_dr = classRoomList.FirstOrDefault(x => x.ClassroomName == classRoominfo_dr)?.ClassroomNo;
if (!string.IsNullOrEmpty(stuno))
{
var item = list.Find(x => x.StuNo == stuno);
if (item == null)
num++;
var item = list.Find(x => x.StuNo == stuno && x.LessonNo == LessonNo && x.ClassRoomNo == ClassRoomNo && x.LessonSection == LessonSection);
if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(semester_dr))
{
dr["导入错误"] = "学年学期与查询条件不符!";
failDt.Rows.Add(dr.ItemArray);
continue;
}
if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName) || !classRoominfo_dr.Equals(classRoomEntity.ClassroomName) || !lessonSection_dr.Equals(LessonSection))
//if (item == null)
{
fnum++;
dr["导入错误"] = "当前课程在" + LessonSection + "节次找不到学号为" + stuno + "的学生";
dr["导入错误"] = "课程:" + lessonInfoEntity.LessonName + "在" + LessonSection + "节次找不到学号为" + stuno + "的学生";
failDt.Rows.Add(dr.ItemArray);
continue;
}
@@ -2393,7 +2480,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
cache.Write<string>(cacheKey + fileGuid, errordt, CacheId.excel);
}

snum = list.Count - failDt.Rows.Count;
snum = (num - failDt.Rows.Count) > 0 ? num - failDt.Rows.Count : 0;
}
return (failDt, snum, failDt.Rows.Count);
}


+ 85
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/ZipHelper.cs View File

@@ -71,5 +71,90 @@ namespace ZipOneCode.ZipProvider
}
}
}

/// <summary>
/// 功能:解压zip格式的文件。
/// </summary>
/// <param name="zipFilePath">压缩文件路径</param>
/// <param name="unZipDir">解压文件存放路径,为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹</param>
/// <returns>解压是否成功</returns>
public static bool UnZip(string zipFilePath, string unZipDir)
{
try
{
if (zipFilePath == string.Empty)
{
throw new Exception("压缩文件不能为空!");
}
if (!File.Exists(zipFilePath))
{
throw new FileNotFoundException("压缩文件不存在!");
}
//解压文件夹为空时默认与压缩文件同一级目录下,跟压缩文件同名的文件夹
if (unZipDir == string.Empty)
{
unZipDir = zipFilePath.Replace(Path.GetFileName(zipFilePath), Path.GetFileNameWithoutExtension(zipFilePath));
}
if (!unZipDir.EndsWith("/"))
{
unZipDir += "/";
}
if (!Directory.Exists(unZipDir))
{
Directory.CreateDirectory(unZipDir);
}
using (var s = new ZipInputStream(File.OpenRead(zipFilePath)))
{

ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null)
{
string directoryName = Path.GetDirectoryName(theEntry.Name);
string fileName = Path.GetFileName(theEntry.Name);
if (!string.IsNullOrEmpty(directoryName))
{
Directory.CreateDirectory(unZipDir + directoryName);
}
if (directoryName != null && !directoryName.EndsWith("/"))
{
}

if (fileName != String.Empty)
{
using (FileStream streamWriter = File.Create(unZipDir + theEntry.Name))
{

int size;
byte[] data = new byte[2048];
while (true)
{
size = s.Read(data, 0, data.Length);
if (size > 0)
{
streamWriter.Write(data, 0, size);
}
else
{
break;
}
}
streamWriter.Close();
}
}
}
s.Close();
}
return true;
}
catch (Exception e)
{

return false;
}

}


}
}

Loading…
Cancel
Save