@@ -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/', | |||
@@ -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)) | |||
@@ -61,9 +61,9 @@ | |||
<div id="ResidenceNo"></div> | |||
</div> | |||
@*<div class="col-xs-6 lr-form-item" data-table="StuInfoFresh"> | |||
<div class="lr-form-item-title">考生类型 </div> | |||
<div id="TestStuSortNo"></div> | |||
</div>*@ | |||
<div class="lr-form-item-title">考生类型 </div> | |||
<div id="TestStuSortNo"></div> | |||
</div>*@ | |||
<div class="col-xs-6 lr-form-item" data-table="StuInfoFresh"> | |||
<div class="lr-form-item-title">第几志愿 <font face="宋体">*</font> </div> | |||
<input id="WillNo" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
@@ -129,6 +129,10 @@ | |||
<div class="lr-form-item-title">精准贫困户</div> | |||
<div id="IsPoor"></div> | |||
</div> | |||
@*<div class="col-xs-12 lr-form-item" data-table="StuInfoFresh"> | |||
<div class="lr-form-item-title">附件</div> | |||
<div id="Files"></div> | |||
</div>*@ | |||
<div class="col-xs-12" id="photoBox"> | |||
@@ -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: [ | |||
@@ -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("保存成功!"); | |||
} | |||
/// <summary> | |||
/// 上传附件图片文件 | |||
/// <summary> | |||
/// <returns></returns> | |||
public Response Upload(dynamic _) | |||
{ | |||
var files = (List<HttpFile>)this.Context.Request.Files; | |||
var folderId = this.GetReq<FileModel>().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); | |||
} | |||
/// <summary> | |||
/// 删除附件 | |||
/// </summary> | |||
/// <param name="_"></param> | |||
/// <returns></returns> | |||
public Response DeleteFiles(dynamic _) | |||
{ | |||
var fileId = this.GetReqData<FileModel>().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 私有类 | |||
/// <summary> | |||
@@ -389,6 +484,7 @@ namespace Learun.Application.WebApi.Modules | |||
/// </summary> | |||
public List<StuInfoFreshEmergePeopleEntity> 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; } | |||
} | |||
} | |||
} |
@@ -65,7 +65,7 @@ | |||
<add key="userKey" value="14B417B0-463D-4F2B-8075-0A20EEDB773A" /> | |||
<!-- ==================注意附件上传地址 修改到主网站部署目录下的Resource要不然飞星会报错================== --> | |||
<add key="AnnexesFile" value="D:\leiprojects\西昌单校区\Learun.Application.Web\Resource" /> | |||
<add key="AnnexesFile" value="D:\Job\DigitalScholl\Learun.Framework.Ultimate V7\Learun.Application.Web\Resource" /> | |||
<add key="ReportFile" value="~/Reports" /> | |||
<!-- ================== 工作流服务地址 ================== --> | |||
<add key="workflowapi" value="http://localhost:8013" /> | |||
@@ -13,7 +13,7 @@ namespace Learun.Application.Base.SystemModule | |||
/// 日 期:2017.03.08 | |||
/// 描 述:附件管理 | |||
/// </summary> | |||
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<AnnexesFileEntity>(x => x.F_Id == fileId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -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; } | |||
/// <summary> | |||
/// 图片显示地址 | |||
/// </summary> | |||
[NotMapped] | |||
public string Url { get; set; } | |||
/// <summary> | |||
/// 附件(文件夹id) | |||
/// </summary> | |||
[NotMapped] | |||
public string Files { get; set; } | |||
/// <summary> | |||
/// 附件列表 | |||
/// </summary> | |||
[NotMapped] | |||
public List<AnnexesFileEntity> FilesList { get; set; } | |||
#endregion | |||
} | |||
} | |||
@@ -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, | |||