ソースを参照

【增加】上传压缩文件后同步照片;

新疆警官学校中职
dyy 1年前
コミット
d1b757d4fb
6個のファイルの変更132行の追加18行の削除
  1. +33
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs
  2. +17
    -4
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js
  3. +12
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.cshtml
  4. +43
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.js
  5. +2
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  6. +25
    -12
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs

+ 33
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoBasicController.cs ファイルの表示

@@ -8,6 +8,7 @@ using System.IO;
using System.Linq;
using Learun.Application.Base.SystemModule;
using static Learun.Application.TwoDevelopment.EducationalAdministration.StuInfoBasicEntity;
using ZipOneCode.ZipProvider;

namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
@@ -274,6 +275,16 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
{
return View();
}

/// <summary>
/// 压缩包同步照片页面
/// <summary>
/// <returns></returns>
[HttpGet]
public ActionResult SynPhotoForm()
{
return View();
}
#endregion


@@ -747,10 +758,30 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult SynPhoto()
public ActionResult SynPhoto(string folderId)
{
stuInfoBasicIBLL.SynPhoto();
//一、服务器中照片直接同步
//stuInfoBasicIBLL.SynPhoto();
//return Success("同步成功!");

//二、上传压缩文件后同步照片
//找到附件地址-多个,解压到目标文件夹,解压成功后同步照片,否则提示;
var annexFileList = annexesFileIbll.GetList(folderId);
if (annexFileList.Any())
{
var targetPath = Config.GetValue("AnnexesFile") + "/UserPhoto";
foreach (var item in annexFileList)
{
var result = ZipHelper.UnZip(item.F_FilePath, targetPath);
if (!result)
{
return Fail($"{item.F_FileName}文件解压失败,同步中止!");
}
}
stuInfoBasicIBLL.SynPhoto();
}
return Success("同步成功!");

}




+ 17
- 4
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/Index.js ファイルの表示

@@ -322,10 +322,23 @@ var bootstrap = function ($, learun) {
})
//同步照片
$('#lr_synPhoto').on('click', function () {
learun.loading(true, '正在同步,请稍后')
learun.httpAsync('get', top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhoto', {}, function (res) {
learun.loading(false)
})
//一、服务器中照片直接同步
//learun.loading(true, '正在同步,请稍后')
//learun.httpAsync('get', top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhoto', {}, function (res) {
// learun.loading(false)
//})
//二、上传压缩文件后同步照片
learun.layerForm({
id: 'SynPhotoForm',
title: '同步照片',
url: top.$.rootUrl + '/EducationalAdministration/StuInfoBasic/SynPhotoForm',
width: 800,
height: 600,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});


})



+ 12
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.cshtml ファイルの表示

@@ -0,0 +1,12 @@
@{
ViewBag.Title = "压缩包同步照片";
Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="lr-form-wrap">
<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>
</div>
</div>
@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.js")

+ 43
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/SynPhotoForm.js ファイルの表示

@@ -0,0 +1,43 @@
/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:超级管理员
* 日 期:2019-02-21 16:53
* 描 述:压缩包同步照片
*/
var acceptClick;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
$('.lr-form-wrap').lrscroll();
page.bind();
page.initData();
},
bind: function () {
$('#Photo').lrUploader();
},
initData: function () {
}
};
// 保存数据
acceptClick = function (callBack) {
if (!$('body').lrValidform()) {
return false;
}
var Photo = $('#Photo').lrUploaderGet();
console.log(Photo);
return false;

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

}

+ 2
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj ファイルの表示

@@ -1216,6 +1216,7 @@
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasicChange\Form.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasicChange\FormView.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasicChange\Index.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\SynPhotoForm.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\GraduateDiplomaReceiveForm.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\FormTran.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\FormOfDC.js" />
@@ -1322,6 +1323,7 @@
<Content Include="Areas\EducationalAdministration\Views\BookPutIn\Form.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\BookPutIn\Index.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\ImportForm.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoBasic\SynPhotoForm.cshtml" />
<None Include="Areas\EducationalAdministration\Views\StuInfoBasic\Printxjk.cshtml" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\AllocationClassDC.js" />
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.js" />


+ 25
- 12
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoBasic/StuInfoBasicService.cs ファイルの表示

@@ -13,6 +13,7 @@ using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.LogisticsManagement;
using Learun.Cache.Base;
using Learun.Cache.Factory;
using System.IO;

namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
@@ -572,49 +573,61 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
{
try
{
var stuList = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>()
.ToList();
var url = AppDomain.CurrentDomain.BaseDirectory;
var stuList = this.BaseRepository("CollegeMIS").FindList<StuInfoBasicEntity>().ToList();
var url = Config.GetValue("AnnexesFile");
var loginUserInfo = LoginUserInfo.Get();
foreach (var stuInfo in stuList)
{
//判断要上传的照片在本地服务器中是否存在
var photoPath = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
var photoPath = $"{url}/UserPhoto/{stuInfo.IdentityCardNo}.jpg";
if (System.IO.File.Exists(photoPath))
{
//学籍表中照片字段不为空
if (!string.IsNullOrEmpty(stuInfo.Photo))
{
var annex = this.BaseRepository()
.FindEntity<AnnexesFileEntity>(a => a.F_FolderId == 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 = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
F_FilePath = photoPath,
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 = $"{url}/Resource/UserPhoto/{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 = $"{url}/Resource/UserPhoto/{stuInfo.IdentityCardNo}.jpg",
F_FolderId = stuInfo.Photo
F_FilePath = photoPath,
F_FileExtensions = ".jpg",
F_FileType = "jpg",
F_CreateUserId = loginUserInfo.userId,
F_CreateUserName = loginUserInfo.realName
};
annexEntity.Create();
this.BaseRepository("CollegeMIS").Update(stuInfo);


読み込み中…
キャンセル
保存