@@ -30,6 +30,7 @@ namespace Learun.Application.WebApi.Modules | |||||
} | } | ||||
private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL(); | private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL(); | ||||
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); | |||||
private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); | private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); | ||||
private CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); | private CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); | ||||
private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); | private ClassInfoIBLL classInfoIBLL = new ClassInfoBLL(); | ||||
@@ -92,15 +93,25 @@ namespace Learun.Application.WebApi.Modules | |||||
} | } | ||||
} | } | ||||
//获取头像地址 | |||||
if (StuInfoFreshEntity.IsPhoto == true && !string.IsNullOrEmpty(StuInfoFreshEntity.Photo)) | |||||
//获取头像地址 20210913修改为获取学生学籍表中的照片 | |||||
var basicPhoto = stuInfoBasicIBLL.GetPhotoByStuNo(GetReqData()); | |||||
if (!string.IsNullOrEmpty(basicPhoto)) | |||||
{ | { | ||||
var annexesFileEntity = annexesFileIBLL.GetEntity(StuInfoFreshEntity.Photo); | |||||
var annexesFileEntity = annexesFileIBLL.GetEntity(basicPhoto); | |||||
if (annexesFileEntity != null) | if (annexesFileEntity != null) | ||||
{ | { | ||||
url = annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource")); | url = annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource")); | ||||
} | } | ||||
} | } | ||||
//if (StuInfoFreshEntity.IsPhoto == true && !string.IsNullOrEmpty(StuInfoFreshEntity.Photo)) | |||||
//{ | |||||
// var annexesFileEntity = annexesFileIBLL.GetEntity(StuInfoFreshEntity.Photo); | |||||
// if (annexesFileEntity != null) | |||||
// { | |||||
// url = annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource")); | |||||
// } | |||||
//} | |||||
StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID); | StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID); | ||||
if (StuInfoFreshEntity.IsPoor != "1") | if (StuInfoFreshEntity.IsPoor != "1") | ||||
{ | { | ||||
@@ -172,6 +172,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
public string GetPhotoByStuNo(string enCode) | |||||
{ | |||||
try | |||||
{ | |||||
return stuInfoBasicService.GetPhotoByStuNo(enCode); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
public StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name) | public StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name) | ||||
{ | { | ||||
try | try | ||||
@@ -33,6 +33,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
List<string> GetSaveClassStudents(string account); | List<string> GetSaveClassStudents(string account); | ||||
StuInfoBasicEntity GetStuInfoBasicEntityByStuNo(string enCode); | StuInfoBasicEntity GetStuInfoBasicEntityByStuNo(string enCode); | ||||
string GetPhotoByStuNo(string enCode); | |||||
StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name); | StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name); | ||||
/// <summary> | /// <summary> | ||||
@@ -172,6 +172,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
public string GetPhotoByStuNo(string enCode) | |||||
{ | |||||
try | |||||
{ | |||||
var data = this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicEntity>(a => a.StuNo == enCode); | |||||
if (data != null) | |||||
{ | |||||
return data.Photo; | |||||
} | |||||
return ""; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
public StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name) | public StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name) | ||||
{ | { | ||||
try | try | ||||
@@ -396,13 +421,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
public void SynPhoto() | public void SynPhoto() | ||||
{ | { | ||||
var logpath = @"D:\新版数字化校园\Publish\log"; | |||||
//var logpath = @"D:\新版数字化校园\Publish\log\0913.txt"; | |||||
try | try | ||||
{ | { | ||||
var stuList = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(x => x.Grade == "21") | var stuList = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>(x => x.Grade == "21") | ||||
.ToList(); | .ToList(); | ||||
var url = AppDomain.CurrentDomain.BaseDirectory; | var url = AppDomain.CurrentDomain.BaseDirectory; | ||||
System.IO.File.AppendAllText(logpath, "同步照片\r\n"); | |||||
//System.IO.File.AppendAllText(logpath, "同步照片\r\n"); | |||||
var num = 0; | var num = 0; | ||||
foreach (var stuInfo in stuList) | foreach (var stuInfo in stuList) | ||||
{ | { | ||||
@@ -451,19 +476,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
this.BaseRepository().Insert(annexEntity); | this.BaseRepository().Insert(annexEntity); | ||||
} | } | ||||
num++; | |||||
//num++; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
System.IO.File.AppendAllText(logpath, F_FilePath + "学生:" + stuInfo.StuName + "文件不存在" + "\r\n"); | |||||
//System.IO.File.AppendAllText(logpath, F_FilePath + "学生:" + stuInfo.StuName + "文件不存在" + "\r\n"); | |||||
} | } | ||||
} | } | ||||
System.IO.File.AppendAllText(logpath, "同步照片:" + num + "个学生\r\n"); | |||||
//System.IO.File.AppendAllText(logpath, "同步照片:" + num + "个学生\r\n"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
System.IO.File.AppendAllText(logpath, "同步照片异常:" + ex.Message + "\r\n"); | |||||
if (ex is ExceptionEx) | if (ex is ExceptionEx) | ||||
{ | { | ||||
throw; | throw; | ||||