diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js index 60eeacebf..356c54ea0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/config/config.js @@ -7,8 +7,8 @@ // web:"http://112.230.201.53/:8081/"//web地址,用于配置logo //}; var config = { - webapi: 'http://localhost:31173/', - web: "http://localhost:20472/"//web地址,用于配置logo + webapi: 'http://localhost:8088/', + web: "http://localhost:8087/"//web地址,用于配置logo }; // var config = { // webapi: 'http://123.57.209.16:31173/', diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs index 2fb9f24e3..11d6ed1ed 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuInfoFreshController.cs @@ -316,6 +316,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers public ActionResult GetFormData(string keyValue) { var StuInfoFreshData = stuInfoFreshIBLL.GetStuInfoFreshEntity(keyValue); + StuInfoFreshData.Files = StuInfoFreshData.ID; //获取头像地址 var url = Config.GetValue("defaultheadimg"); if (StuInfoFreshData.IsPhoto == true && !string.IsNullOrEmpty(StuInfoFreshData.Photo)) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml index 9ca74af75..74fbe8dd9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.cshtml @@ -61,9 +61,9 @@
@*
-
考生类型
-
-
*@ +
考生类型
+
+ *@
第几志愿 *
@@ -129,6 +129,10 @@
精准贫困户
+ @*
+
附件
+
+
*@
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js index 32a3553ca..878a59462 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoFresh/Form.js @@ -25,6 +25,8 @@ var bootstrap = function ($, learun) { $("#MatriculateSort").lrDataItemSelect({ code: 'enrollType' }); $('#ResidenceNo').lrDataItemSelect({ code: 'ResidenceNo' }); $('#IsPoor').lrDataItemSelect({ code: 'YesOrNoInt' }); + //附件 + //$('#Files').lrUploader(); $('#StuInfoFreshFamily').jfGrid({ headData: [ 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 f090e2650..3d066f66a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/StuInfoFreshApi.cs @@ -26,6 +26,8 @@ namespace Learun.Application.WebApi.Modules Get["/pageList"] = GetPageList; Get["/form"] = GetForm; Post["/save"] = SaveForm; + Post["/upload"] = Upload; + Post["/deleteFiles"] = DeleteFiles; } @@ -99,8 +101,20 @@ namespace Learun.Application.WebApi.Modules if (annexesFileEntity != null) { url = annexesFileEntity.F_FilePath.Substring(annexesFileEntity.F_FilePath.IndexOf("Resource")); + StuInfoFreshEntity.Url = url; } } + //获取附件列表 + var annexesFileList = annexesFileIBLL.GetList(StuInfoFreshEntity.ID); + if (annexesFileList.Any()) + { + foreach (var item in annexesFileList) + { + item.F_FilePath = item.F_FilePath.Substring(item.F_FilePath.IndexOf("Resource")); + } + StuInfoFreshEntity.FilesList = annexesFileList.ToList(); + } + StuInfoFreshEntity.DormitoryName = accdormitoryIBLL.GetDormitoryInfoByPlanStuNo(StuInfoFreshEntity.ID); if (StuInfoFreshEntity.IsPoor != "1") { @@ -335,6 +349,87 @@ namespace Learun.Application.WebApi.Modules return Success("保存成功!"); } + /// + /// 上传附件图片文件 + /// + /// + public Response Upload(dynamic _) + { + var files = (List)this.Context.Request.Files; + var folderId = this.GetReq().folderId;//文件夹id=新生id + + string filePath = Config.GetValue("AnnexesFile"); + string uploadDate = DateTime.Now.ToString("yyyyMMdd"); + string FileEextension = Path.GetExtension(files[0].Name); + string fileGuid = Guid.NewGuid().ToString(); + + string virtualPath = string.Format("{0}/{1}/{2}/{3}{4}", filePath, userInfo.userId, uploadDate, fileGuid, FileEextension); + + //创建文件夹 + string path = Path.GetDirectoryName(virtualPath); + Directory.CreateDirectory(path); + AnnexesFileEntity fileAnnexesEntity = new AnnexesFileEntity(); + if (!System.IO.File.Exists(virtualPath)) + { + byte[] bytes = new byte[files[0].Value.Length]; + files[0].Value.Read(bytes, 0, bytes.Length); + FileInfo file = new FileInfo(virtualPath); + FileStream fs = file.Create(); + fs.Write(bytes, 0, bytes.Length); + fs.Close(); + + //文件信息写入数据库 + fileAnnexesEntity.F_Id = fileGuid; + fileAnnexesEntity.F_FolderId = folderId; + fileAnnexesEntity.F_FileName = files[0].Name; + fileAnnexesEntity.F_FilePath = virtualPath; + fileAnnexesEntity.F_FileSize = files[0].Value.Length.ToString(); + fileAnnexesEntity.F_FileExtensions = FileEextension; + fileAnnexesEntity.F_FileType = FileEextension.Replace(".", ""); + fileAnnexesEntity.F_CreateUserId = userInfo.userId; + fileAnnexesEntity.F_CreateUserName = userInfo.realName; + + annexesFileIBLL.SaveEntity(folderId, fileAnnexesEntity); + } + + //文件地址截取到resource后 + fileAnnexesEntity.F_FilePath = fileAnnexesEntity.F_FilePath.Substring(fileAnnexesEntity.F_FilePath.IndexOf("Resource")); + + return Success(fileAnnexesEntity); + } + + /// + /// 删除附件 + /// + /// + /// + public Response DeleteFiles(dynamic _) + { + var fileId = this.GetReqData().id; + + AnnexesFileEntity fileInfoEntity = annexesFileIBLL.GetEntity(fileId); + if (fileInfoEntity != null) + { + //删除附件表 + annexesFileIBLL.DeleteEntity(fileId); + //删除文件 + if (System.IO.File.Exists(fileInfoEntity.F_FilePath)) + { + System.IO.File.Delete(fileInfoEntity.F_FilePath); + } + + + //下载 + //if (FileDownHelper.FileExists(fileInfoEntity.F_FilePath)) + //{ + // FileDownHelper.DownLoadnew(fileInfoEntity.F_FilePath); + //} + } + + return Success("删除成功"); + } + + #region 私有类 /// @@ -389,6 +484,7 @@ namespace Learun.Application.WebApi.Modules /// public List StuInfoFreshEmergePeopleEntities { get; set; } + } public class PhotoModel @@ -397,5 +493,10 @@ namespace Learun.Application.WebApi.Modules public string account { get; set; } } + public class FileModel + { + public string folderId { get; set; } + public string id { get; set; } + } } } \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config index 9f5e1c6ec..a1e3c4b29 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/XmlConfig/system.config @@ -65,7 +65,7 @@ - + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs index 8c4039d9f..c4a8579cc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Base/SystemModule/Annexes/AnnexesFileService.cs @@ -13,7 +13,7 @@ namespace Learun.Application.Base.SystemModule /// 日 期:2017.03.08 /// 描 述:附件管理 /// - public class AnnexesFileService:RepositoryFactory + public class AnnexesFileService : RepositoryFactory { #region 属性 构造函数 private string fieldSql; @@ -188,7 +188,7 @@ namespace Learun.Application.Base.SystemModule { try { - this.BaseRepository().Delete(new AnnexesFileEntity() { F_Id = fileId }); + this.BaseRepository().Delete(x => x.F_Id == fileId); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs index b7a16a27b..a503d3216 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuInfoFresh/StuInfoFreshEntity.cs @@ -1,5 +1,7 @@ -using Learun.Util; +using Learun.Application.Base.SystemModule; +using Learun.Util; using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -716,6 +718,23 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [NotMapped] public bool? IsStudentEdit { get; set; } + /// + /// 图片显示地址 + /// + [NotMapped] + public string Url { get; set; } + + /// + /// 附件(文件夹id) + /// + [NotMapped] + public string Files { get; set; } + /// + /// 附件列表 + /// + [NotMapped] + public List FilesList { get; set; } + #endregion } } diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js index 826a1fd3c..e55579246 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js @@ -27,8 +27,8 @@ export default { "webHost":"http://192.168.10.85:8087/", // 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示 "devAccount": [ - // 20201130230 21364200000400266 老师 420528196310072253 学生 420528200606205026 - { username: "420528200507261428", password: "www.qj.com" } + // 20201130230 21364200000400266 老师 420528196310072253 学生 420528200606205026 420528200507261428 + { username: "21364200000400558", password: "www.qj.com" } ], //是否分布式部署 指WebApi与Web不在一台服务器 "isDistributed":true,