|
|
@@ -14,6 +14,8 @@ using Learun.Application.TwoDevelopment.LogisticsManagement; |
|
|
|
using Learun.Cache.Base; |
|
|
|
using Learun.Cache.Factory; |
|
|
|
using System.IO; |
|
|
|
using System.Security.Policy; |
|
|
|
using System.Data.SqlClient; |
|
|
|
|
|
|
|
namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
{ |
|
|
@@ -578,63 +580,74 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
var loginUserInfo = LoginUserInfo.Get(); |
|
|
|
foreach (var stuInfo in stuList) |
|
|
|
{ |
|
|
|
//判断要上传的照片在本地服务器中是否存在 |
|
|
|
var photoPath = $"{url}/UserPhoto/{stuInfo.IdentityCardNo}.jpg"; |
|
|
|
if (System.IO.File.Exists(photoPath)) |
|
|
|
if (!string.IsNullOrEmpty(stuInfo.IdentityCardNo)) |
|
|
|
{ |
|
|
|
//学籍表中照片字段不为空 |
|
|
|
if (!string.IsNullOrEmpty(stuInfo.Photo)) |
|
|
|
//判断要上传的照片在本地服务器中是否存在 |
|
|
|
var photoPath = $"{url}/UserPhoto/{stuInfo.IdentityCardNo}.jpg"; |
|
|
|
if (System.IO.File.Exists(photoPath)) |
|
|
|
{ |
|
|
|
var annex = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_FolderId == stuInfo.Photo); |
|
|
|
if (annex == null) |
|
|
|
//文件大小 |
|
|
|
FileInfo fileInfo = new FileInfo(photoPath); |
|
|
|
var size = fileInfo.Length; |
|
|
|
//学籍表中照片字段不为空 |
|
|
|
if (!string.IsNullOrEmpty(stuInfo.Photo)) |
|
|
|
{ |
|
|
|
var annex = this.BaseRepository().FindEntity<AnnexesFileEntity>(a => a.F_FolderId == stuInfo.Photo); |
|
|
|
if (annex == null) |
|
|
|
{ |
|
|
|
var annexEntity = new AnnexesFileEntity() |
|
|
|
{ |
|
|
|
F_Id = Guid.NewGuid().ToString(), |
|
|
|
F_FolderId = stuInfo.Photo, |
|
|
|
F_FileName = stuInfo.IdentityCardNo + ".jpg", |
|
|
|
F_FilePath = photoPath, |
|
|
|
F_FileSize = size.ToString(), |
|
|
|
F_FileExtensions = ".jpg", |
|
|
|
F_FileType = "jpg", |
|
|
|
F_CreateUserId = loginUserInfo.userId, |
|
|
|
F_CreateUserName = loginUserInfo.realName |
|
|
|
}; |
|
|
|
annexEntity.Create(); |
|
|
|
this.BaseRepository().Insert(annexEntity); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
annex.F_FileName = stuInfo.IdentityCardNo + ".jpg"; |
|
|
|
annex.F_FilePath = photoPath; |
|
|
|
annex.F_FileSize = size.ToString(); |
|
|
|
annex.F_FileExtensions = ".jpg"; |
|
|
|
annex.F_FileType = "jpg"; |
|
|
|
annex.F_CreateDate = DateTime.Now; |
|
|
|
annex.F_CreateUserId = loginUserInfo.userId; |
|
|
|
annex.F_CreateUserName = loginUserInfo.realName; |
|
|
|
this.BaseRepository().Update(annex); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//学籍表 |
|
|
|
stuInfo.Photo = Guid.NewGuid().ToString(); |
|
|
|
//附件表 |
|
|
|
var annexEntity = new AnnexesFileEntity() |
|
|
|
{ |
|
|
|
F_Id = Guid.NewGuid().ToString(), |
|
|
|
F_FolderId = stuInfo.Photo, |
|
|
|
F_FileName = stuInfo.IdentityCardNo + ".jpg", |
|
|
|
F_FilePath = photoPath, |
|
|
|
F_FileSize = size.ToString(), |
|
|
|
F_FileExtensions = ".jpg", |
|
|
|
F_FileType = "jpg", |
|
|
|
F_CreateUserId = loginUserInfo.userId, |
|
|
|
F_CreateUserName = loginUserInfo.realName |
|
|
|
}; |
|
|
|
annexEntity.Create(); |
|
|
|
this.BaseRepository("CollegeMIS").Update(stuInfo); |
|
|
|
this.BaseRepository().Insert(annexEntity); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
annex.F_FileName = stuInfo.IdentityCardNo + ".jpg"; |
|
|
|
annex.F_FilePath = photoPath; |
|
|
|
annex.F_CreateDate = DateTime.Now; |
|
|
|
annex.F_CreateUserId = loginUserInfo.userId; |
|
|
|
annex.F_CreateUserName = loginUserInfo.realName; |
|
|
|
this.BaseRepository().Update(annex); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//学籍表 |
|
|
|
stuInfo.Photo = Guid.NewGuid().ToString(); |
|
|
|
//附件表 |
|
|
|
var annexEntity = new AnnexesFileEntity() |
|
|
|
{ |
|
|
|
F_Id = Guid.NewGuid().ToString(), |
|
|
|
F_FolderId = stuInfo.Photo, |
|
|
|
F_FileName = stuInfo.IdentityCardNo + ".jpg", |
|
|
|
F_FilePath = photoPath, |
|
|
|
F_FileExtensions = ".jpg", |
|
|
|
F_FileType = "jpg", |
|
|
|
F_CreateUserId = loginUserInfo.userId, |
|
|
|
F_CreateUserName = loginUserInfo.realName |
|
|
|
}; |
|
|
|
annexEntity.Create(); |
|
|
|
this.BaseRepository("CollegeMIS").Update(stuInfo); |
|
|
|
this.BaseRepository().Insert(annexEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|