From e4c6bc529a8d8b8ff535f762b47f2f01ec345ddb Mon Sep 17 00:00:00 2001
From: dyy <807692433@qq.com>
Date: Thu, 25 Aug 2022 18:02:44 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E5=AD=A6?=
=?UTF-8?q?=E7=B1=8D=EF=BC=9A=E5=90=8C=E6=AD=A5=E7=85=A7=E7=89=87=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Views/StuInfoBasic/Index.cshtml | 4 +-
.../StuInfoBasic/StuInfoBasicService.cs | 61 ++++++++++---------
2 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml
index a9455599d..ee33a818c 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.cshtml
@@ -71,7 +71,7 @@
@@ -95,7 +95,7 @@
审核全部
生成帐号
更新帐号
- @* 同步照片*@
+ 同步照片
查看异动
拍照
学生简历表
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 e2b8631b6..8eb9af102 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
@@ -498,13 +498,38 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
var url = AppDomain.CurrentDomain.BaseDirectory;
foreach (var stuInfo in stuList)
{
- //照片不为空
- if (!string.IsNullOrEmpty(stuInfo.Photo))
+ //判断要上传的照片在本地服务器中是否存在
+ var photoPath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
+ if (System.IO.File.Exists(photoPath))
{
- var annex = this.BaseRepository()
- .FindEntity(a => a.F_FolderId == stuInfo.Photo);
- if (annex == null)
+ //学籍表中照片字段不为空
+ if (!string.IsNullOrEmpty(stuInfo.Photo))
{
+ var annex = this.BaseRepository()
+ .FindEntity(a => a.F_FolderId == stuInfo.Photo);
+ if (annex == null)
+ {
+ var annexEntity = new AnnexesFileEntity()
+ {
+ F_Id = Guid.NewGuid().ToString(),
+ F_FileName = stuInfo.IdentityCardNo + ".jpg",
+ F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
+ F_FolderId = stuInfo.Photo
+ };
+ this.BaseRepository().Insert(annexEntity);
+
+ }
+ else
+ {
+ annex.F_FileName = stuInfo.IdentityCardNo + ".jpg";
+ annex.F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
+ this.BaseRepository().Update(annex);
+ }
+ }
+ else
+ {
+ stuInfo.Photo = Guid.NewGuid().ToString();
+
var annexEntity = new AnnexesFileEntity()
{
F_Id = Guid.NewGuid().ToString(),
@@ -512,32 +537,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
};
+ annexEntity.Create();
+ this.BaseRepository("CollegeMIS").Update(stuInfo);
this.BaseRepository().Insert(annexEntity);
-
- }
- else
- {
- annex.F_FileName = stuInfo.IdentityCardNo + ".jpg";
- annex.F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
- this.BaseRepository().Update(annex);
}
}
- else
- {
- stuInfo.Photo = Guid.NewGuid().ToString();
-
- var annexEntity = new AnnexesFileEntity()
- {
- F_Id = Guid.NewGuid().ToString(),
- F_FileName = stuInfo.IdentityCardNo + ".jpg",
- F_FilePath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
- F_FolderId = stuInfo.Photo
- };
- annexEntity.Create();
- this.BaseRepository("CollegeMIS").Update(stuInfo);
- this.BaseRepository().Insert(annexEntity);
- }
-
+
}
}
catch (Exception ex)