|
|
@@ -6,6 +6,7 @@ using System.Data; |
|
|
|
using Learun.Application.Base.SystemModule; |
|
|
|
using System; |
|
|
|
using System.Drawing; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
{ |
|
|
@@ -20,6 +21,8 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
{ |
|
|
|
private ExcelImportIBLL excelImportIBLL = new ExcelImportBLL(); |
|
|
|
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); |
|
|
|
private DataItemIBLL dataItemIBLL = new DataItemBLL(); |
|
|
|
private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); |
|
|
|
#region 视图功能 |
|
|
|
/// <summary> |
|
|
|
/// 导入模板管理页面 |
|
|
@@ -177,8 +180,12 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
excelconfig.FileName = Server.UrlDecode(templateInfo.F_Name) + ".xls"; |
|
|
|
excelconfig.IsAllSizeColumn = true; |
|
|
|
excelconfig.ColumnEntity = new List<ColumnModel>(); |
|
|
|
excelconfig.SpecialColumnEntity = new List<SpecialColumnModel>(); |
|
|
|
//表头 |
|
|
|
DataTable dt = new DataTable(); |
|
|
|
|
|
|
|
//数据字典 |
|
|
|
var dataItemList = dataItemIBLL.GetAllDetailList(); |
|
|
|
foreach (var col in fileds) |
|
|
|
{ |
|
|
|
if (col.F_RelationType != 1 && col.F_RelationType != 4 && col.F_RelationType != 5 && col.F_RelationType != 6 && col.F_RelationType != 7) |
|
|
@@ -191,9 +198,35 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
Background = col.F_IsMandatory == true ? Color.Red : new Color() |
|
|
|
}); |
|
|
|
dt.Columns.Add(col.F_Name, typeof(string)); |
|
|
|
|
|
|
|
//数据字典 |
|
|
|
if (col.F_RelationType == 2) |
|
|
|
{ |
|
|
|
excelconfig.SpecialColumnEntity.Add(new SpecialColumnModel() |
|
|
|
{ |
|
|
|
Name = col.F_ColName, |
|
|
|
ValueList = dataItemList.Where(x => x.F_ItemCode == col.F_DataItemCode).Select(x => x.F_ItemName).ToList() |
|
|
|
}); |
|
|
|
} |
|
|
|
else if (col.F_RelationType == 3) |
|
|
|
{ |
|
|
|
//数据源 |
|
|
|
var colDatasourceAry = col.F_DataSourceId.Split(','); |
|
|
|
var datasourceDt = dataSourceIBLL.GetDataTable($"{colDatasourceAry[0]}", ""); |
|
|
|
List<string> list = (from d in datasourceDt.AsEnumerable() select d.Field<string>($"{colDatasourceAry[1]}")).ToList(); |
|
|
|
|
|
|
|
excelconfig.SpecialColumnEntity.Add(new SpecialColumnModel() |
|
|
|
{ |
|
|
|
Name = col.F_ColName, |
|
|
|
ValueList = list |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ExcelHelper.ExcelDownload(dt, excelconfig); |
|
|
|
dataItemList = null; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -206,10 +239,10 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost] |
|
|
|
[ValidateAntiForgeryToken] |
|
|
|
public ActionResult ExecuteImportExcel(string templateId, string fileId, int chunks,string ext) |
|
|
|
public ActionResult ExecuteImportExcel(string templateId, string fileId, int chunks, string ext) |
|
|
|
{ |
|
|
|
UserInfo userInfo = LoginUserInfo.Get(); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); |
|
|
|
if (!string.IsNullOrEmpty(path)) |
|
|
|
{ |
|
|
|
DataTable dt = ExcelHelper.ExcelImport(path); |
|
|
@@ -236,14 +269,14 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost] |
|
|
|
[ValidateAntiForgeryToken] |
|
|
|
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks,string ext) |
|
|
|
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks, string ext) |
|
|
|
{ |
|
|
|
UserInfo userInfo = LoginUserInfo.Get(); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); |
|
|
|
if (!string.IsNullOrEmpty(path)) |
|
|
|
{ |
|
|
|
DataTable dt = ExcelHelper.ExcelImport(path); |
|
|
|
string res = excelImportIBLL.ImportSalaryInfo(dt,fileId); |
|
|
|
string res = excelImportIBLL.ImportSalaryInfo(dt, fileId); |
|
|
|
var data = new |
|
|
|
{ |
|
|
|
Success = res.Split('|')[0], |
|
|
@@ -266,14 +299,14 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost] |
|
|
|
[ValidateAntiForgeryToken] |
|
|
|
public ActionResult EmpInfoImport(string fileId, int chunks,string ext) |
|
|
|
public ActionResult EmpInfoImport(string fileId, int chunks, string ext) |
|
|
|
{ |
|
|
|
UserInfo userInfo = LoginUserInfo.Get(); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo); |
|
|
|
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); |
|
|
|
if (!string.IsNullOrEmpty(path)) |
|
|
|
{ |
|
|
|
DataTable dt = ExcelHelper.ExcelImport(path); |
|
|
|
string res = excelImportIBLL.EmpInfoImport(dt,fileId); |
|
|
|
string res = excelImportIBLL.EmpInfoImport(dt, fileId); |
|
|
|
var data = new |
|
|
|
{ |
|
|
|
Success = res.Split('|')[0], |
|
|
@@ -294,7 +327,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost] |
|
|
|
[ValidateAntiForgeryToken] |
|
|
|
public void DownImportErrorFile(string fileId,string fileName) |
|
|
|
public void DownImportErrorFile(string fileId, string fileName) |
|
|
|
{ |
|
|
|
//设置导出格式 |
|
|
|
ExcelConfig excelconfig = new ExcelConfig(); |
|
|
@@ -325,7 +358,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
ExcelHelper.ExcelDownload(dt, excelconfig); |
|
|
|
} |
|
|
|