From 0f0d5d21c0201a3656147c4a11b0bfb78b17dc6b Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Mon, 13 Sep 2021 14:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E6=8A=A5=E9=81=93=E7=9A=84=E7=85=A7=E7=89=87=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=AD=A6=E7=B1=8D=E8=A1=A8=E4=B8=AD=E7=9A=84=E7=85=A7=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/StuInfoFreshApi.cs | 17 +++++++-- .../StuInfoBasic/StuInfoBasicBLL.cs | 19 ++++++++++ .../StuInfoBasic/StuInfoBasicIBLL.cs | 1 + .../StuInfoBasic/StuInfoBasicService.cs | 36 +++++++++++++++---- 4 files changed, 64 insertions(+), 9 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs index 9da19806b..0733c7fe2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs @@ -30,6 +30,7 @@ namespace Learun.Application.WebApi.Modules } private StuInfoFreshIBLL stuInfoFreshIBLL = new StuInfoFreshBLL(); + private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); private CdMajorIBLL cdMajorIBLL = new CdMajorBLL(); private CdDeptIBLL cdDeptIBLL = new CdDeptBLL(); 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) { 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); if (StuInfoFreshEntity.IsPoor != "1") { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs index 1235a1458..4572c22fd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicBLL.cs @@ -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) { try diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs index fafb58369..739525f51 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicIBLL.cs @@ -33,6 +33,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration List GetSaveClassStudents(string account); StuInfoBasicEntity GetStuInfoBasicEntityByStuNo(string enCode); + string GetPhotoByStuNo(string enCode); StuInfoBasicEntity GetStuInfoBasicEntityByStuName(string name); /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs index bda745e6f..e9a943cb4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs @@ -172,6 +172,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public string GetPhotoByStuNo(string enCode) + { + try + { + var data = this.BaseRepository("CollegeMIS").FindEntity(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) { try @@ -396,13 +421,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } public void SynPhoto() { - var logpath = @"D:\新版数字化校园\Publish\log"; + //var logpath = @"D:\新版数字化校园\Publish\log\0913.txt"; try { var stuList = this.BaseRepository("CollegeMIS").FindList(x => x.Grade == "21") .ToList(); var url = AppDomain.CurrentDomain.BaseDirectory; - System.IO.File.AppendAllText(logpath, "同步照片\r\n"); + //System.IO.File.AppendAllText(logpath, "同步照片\r\n"); var num = 0; foreach (var stuInfo in stuList) { @@ -451,19 +476,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration this.BaseRepository().Insert(annexEntity); } - num++; + //num++; } 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) { - System.IO.File.AppendAllText(logpath, "同步照片异常:" + ex.Message + "\r\n"); if (ex is ExceptionEx) { throw;