Kaynağa Gözat

【修改】上传压缩文件后同步照片;

新疆警官学校中职
dyy 1 yıl önce
ebeveyn
işleme
9c6bfa9e8e
5 değiştirilmiş dosya ile 62 ekleme ve 51 silme
  1. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs
  2. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js
  3. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.cshtml
  4. +7
    -10
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.js
  5. +51
    -38
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs Dosyayı Görüntüle

@@ -756,7 +756,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
/// 同步照片
/// <summary>
/// <returns></returns>
[HttpGet]
[HttpPost]
[AjaxOnly]
public ActionResult SynPhoto(string folderId)
{


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js Dosyayı Görüntüle

@@ -332,8 +332,8 @@ var bootstrap = function ($, learun) {
id: 'SynPhotoForm',
title: '同步照片',
url: top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhotoForm',
width: 800,
height: 600,
width: 700,
height: 500,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.cshtml Dosyayı Görüntüle

@@ -3,6 +3,7 @@
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap">
<div class="" style="padding-left:20px;color:red;">提示:1.请对照片文件直接“全选-右键”进行压缩,压缩包中不能包含文件夹;2.照片格式为jpg格式;</div>
<div class="col-xs-12 lr-form-item" data-table="StuInfoBasic">
<div class="lr-form-item-title">照片压缩文件<font face="宋体">*</font></div>
<div id="Photo" isvalid="yes" checkexpession="NotNull"></div>


+ 7
- 10
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.js Dosyayı Görüntüle

@@ -26,17 +26,14 @@ var bootstrap = function ($, learun) {
return false;
}
var Photo = $('#Photo').lrUploaderGet();
console.log(Photo);
//console.log(Photo);
return false;

//$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhoto?fileId=' + keyValue, postData, function (res) {
// // 保存成功后才回调
// if (!!callBack) {
// callBack();
// }
//});
$.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhoto?folderId=' + Photo, {}, function (res) {
// 保存成功后才回调
if (!!callBack) {
callBack();
}
});
};
page.init();



+ 51
- 38
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs Dosyayı Görüntüle

@@ -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)


Yükleniyor…
İptal
Kaydet