Commit 16097b7d authored by 黄奎's avatar 黄奎

页面修改

parent ac0bf1b8
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Edu.Common.Data
{
public class XlsQuestionHelper
{
public List<XlsItem> GetXlsQuestionData(string filePath)
{
List<XlsItem> xlsItems = new List<XlsItem>();
var dt = Common.Plugin.NPOIHelper.ImportExcelToDatatable(filePath, 0, 0, true);
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow item in dt.Rows)
{
xlsItems.Add(DataRowToModel(item));
}
}
return xlsItems;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
public static XlsItem DataRowToModel(DataRow dr)
{
XlsItem model = new XlsItem();
if (dr != null)
{
if (dr.Table.Columns.Contains("目录") && !string.IsNullOrEmpty(dr["目录"].ToString()))
{
model.DirName = dr["目录"].ToString();
}
if (dr.Table.Columns.Contains("题型") && !string.IsNullOrEmpty(dr["题型"].ToString()))
{
model.QuestionTypeName = dr["题型"].ToString();
}
if (dr.Table.Columns.Contains("题干") && !string.IsNullOrEmpty(dr["题干"].ToString()))
{
model.QuestionTitle = dr["题干"].ToString();
}
if (dr.Table.Columns.Contains("正确答案") && !string.IsNullOrEmpty(dr["正确答案"].ToString()))
{
model.QuestionAnswer = dr["正确答案"].ToString();
}
if (dr.Table.Columns.Contains("答案解析") && !string.IsNullOrEmpty(dr["答案解析"].ToString()))
{
model.AnswerAnalysis = dr["答案解析"].ToString();
}
if (dr.Table.Columns.Contains("难易度") && !string.IsNullOrEmpty(dr["难易度"].ToString()))
{
model.EasyType = dr["难易度"].ToString();
}
if (dr.Table.Columns.Contains("选项数") && !string.IsNullOrEmpty(dr["选项数"].ToString()))
{
model.ChooseOptionCount = dr["选项数"].ToString();
}
if (dr.Table.Columns.Contains("A") && !string.IsNullOrEmpty(dr["A"].ToString()))
{
model.OptionA = dr["A"].ToString();
}
if (dr.Table.Columns.Contains("B") && !string.IsNullOrEmpty(dr["B"].ToString()))
{
model.OptionB = dr["B"].ToString();
}
if (dr.Table.Columns.Contains("C") && !string.IsNullOrEmpty(dr["C"].ToString()))
{
model.OptionC = dr["C"].ToString();
}
if (dr.Table.Columns.Contains("D") && !string.IsNullOrEmpty(dr["D"].ToString()))
{
model.OptionD = dr["D"].ToString();
}
if (dr.Table.Columns.Contains("E") && !string.IsNullOrEmpty(dr["E"].ToString()))
{
model.OptionE = dr["E"].ToString();
}
if (dr.Table.Columns.Contains("F") && !string.IsNullOrEmpty(dr["F"].ToString()))
{
model.OptionF = dr["F"].ToString();
}
if (dr.Table.Columns.Contains("G") && !string.IsNullOrEmpty(dr["G"].ToString()))
{
model.OptionG = dr["G"].ToString();
}
if (dr.Table.Columns.Contains("H") && !string.IsNullOrEmpty(dr["H"].ToString()))
{
model.OptionH = dr["H"].ToString();
}
}
return model;
}
}
/// <summary>
/// Excel列
/// </summary>
public class XlsItem
{
/// <summary>
/// 目录
/// </summary>
public string DirName { get; set; }
/// <summary>
/// 题型
/// </summary>
public string QuestionTypeName { get; set; }
/// <summary>
/// 题干
/// </summary>
public string QuestionTitle { get; set; }
/// <summary>
/// 正确答案
/// </summary>
public string QuestionAnswer { get; set; }
/// <summary>
/// 答案解析
/// </summary>
public string AnswerAnalysis { get; set; }
/// <summary>
/// 难易程度
/// </summary>
public string EasyType { get; set; }
/// <summary>
/// 选项数
/// </summary>
public string ChooseOptionCount { get; set; }
/// <summary>
/// A
/// </summary>
public string OptionA { get; set; }
/// <summary>
/// B
/// </summary>
public string OptionB { get; set; }
/// <summary>
/// C
/// </summary>
public string OptionC { get; set; }
/// <summary>
/// D
/// </summary>
public string OptionD { get; set; }
/// <summary>
/// E
/// </summary>
public string OptionE { get; set; }
/// <summary>
/// F
/// </summary>
public string OptionF { get; set; }
/// <summary>
/// G
/// </summary>
public string OptionG { get; set; }
/// <summary>
/// H
/// </summary>
public string OptionH { get; set; }
}
}
...@@ -23,7 +23,7 @@ namespace Edu.Common.Plugin ...@@ -23,7 +23,7 @@ namespace Edu.Common.Plugin
/// <param name="dtSource">源DataTable</param> /// <param name="dtSource">源DataTable</param>
/// <param name="strHeaderText">表头文本</param> /// <param name="strHeaderText">表头文本</param>
[Obsolete] [Obsolete]
static MemoryStream ExportDT(DataTable dtSource, String strHeaderText) static MemoryStream ExportDataTable(DataTable dtSource, String strHeaderText)
{ {
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.CreateSheet() as HSSFSheet; HSSFSheet sheet = workbook.CreateSheet() as HSSFSheet;
...@@ -193,7 +193,7 @@ namespace Edu.Common.Plugin ...@@ -193,7 +193,7 @@ namespace Edu.Common.Plugin
/// <param name="strHeaderText">表头文本</param> /// <param name="strHeaderText">表头文本</param>
/// <param name="fs">文件流</param> /// <param name="fs">文件流</param>
[Obsolete] [Obsolete]
static void ExportDTI(DataTable dtSource, String strHeaderText, FileStream fs) static void ExportDataTableI(DataTable dtSource, String strHeaderText, FileStream fs)
{ {
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.CreateSheet() as XSSFSheet; XSSFSheet sheet = workbook.CreateSheet() as XSSFSheet;
...@@ -379,12 +379,12 @@ namespace Edu.Common.Plugin ...@@ -379,12 +379,12 @@ namespace Edu.Common.Plugin
/// <param name="strHeaderText">表头文本</param> /// <param name="strHeaderText">表头文本</param>
/// <param name="strFileName">保存位置(路径+文件名)</param> /// <param name="strFileName">保存位置(路径+文件名)</param>
[Obsolete] [Obsolete]
public static void ExportDTtoExcel(DataTable dtSource, String strHeaderText, String strFileName) public static void ExportDataTableToExcel(DataTable dtSource, String strHeaderText, String strFileName)
{ {
String[] temp = strFileName.Split('.'); String[] temp = strFileName.Split('.');
if (temp[^1] == "xls" && dtSource.Columns.Count < 256 && dtSource.Rows.Count < 65536) if (temp[^1] == "xls" && dtSource.Columns.Count < 256 && dtSource.Rows.Count < 65536)
{ {
using MemoryStream ms = ExportDT(dtSource, strHeaderText); using MemoryStream ms = ExportDataTable(dtSource, strHeaderText);
using FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write); using FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write);
byte[] data = ms.ToArray(); byte[] data = ms.ToArray();
fs.Write(data, 0, data.Length); fs.Write(data, 0, data.Length);
...@@ -395,12 +395,12 @@ namespace Edu.Common.Plugin ...@@ -395,12 +395,12 @@ namespace Edu.Common.Plugin
if (temp[^1] == "xls") if (temp[^1] == "xls")
strFileName += "x"; strFileName += "x";
using FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write); using FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write);
ExportDTI(dtSource, strHeaderText, fs); ExportDataTableI(dtSource, strHeaderText, fs);
} }
} }
#endregion #endregion
#region excel中将数据导出到datatable #region excel文件中将数据导出到datatable
/// <summary> /// <summary>
/// 读取excel /// 读取excel
...@@ -410,7 +410,7 @@ namespace Edu.Common.Plugin ...@@ -410,7 +410,7 @@ namespace Edu.Common.Plugin
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param> /// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">列头</param> /// <param name="needHeader">列头</param>
/// <returns></returns> /// <returns></returns>
public static DataTable ImportExceltoDt(String strFileName, int SheetIndex, int HeaderRowIndex, bool needHeader) public static DataTable ImportExcelToDatatable(String strFileName, int SheetIndex, int HeaderRowIndex, bool needHeader)
{ {
IWorkbook wb; IWorkbook wb;
using (FileStream file = new FileStream(strFileName, FileMode.Open, FileAccess.Read)) using (FileStream file = new FileStream(strFileName, FileMode.Open, FileAccess.Read))
...@@ -418,7 +418,7 @@ namespace Edu.Common.Plugin ...@@ -418,7 +418,7 @@ namespace Edu.Common.Plugin
wb = WorkbookFactory.Create(file); wb = WorkbookFactory.Create(file);
} }
ISheet sheet = wb.GetSheetAt(SheetIndex); ISheet sheet = wb.GetSheetAt(SheetIndex);
DataTable table = ImportDt(sheet, HeaderRowIndex, needHeader); DataTable table = ImportDataTable(sheet, HeaderRowIndex, needHeader);
return table; return table;
} }
...@@ -429,7 +429,7 @@ namespace Edu.Common.Plugin ...@@ -429,7 +429,7 @@ namespace Edu.Common.Plugin
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param> /// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">是否导出表头</param> /// <param name="needHeader">是否导出表头</param>
/// <returns></returns> /// <returns></returns>
static DataTable ImportDt(ISheet sheet, int HeaderRowIndex, bool needHeader) static DataTable ImportDataTable(ISheet sheet, int HeaderRowIndex, bool needHeader)
{ {
DataTable table = new DataTable(); DataTable table = new DataTable();
IRow headerRow; IRow headerRow;
...@@ -568,20 +568,20 @@ namespace Edu.Common.Plugin ...@@ -568,20 +568,20 @@ namespace Edu.Common.Plugin
} }
catch (Exception exception) catch (Exception exception)
{ {
LogHelper.Write(exception, "ImportDt_1"); LogHelper.Write(exception, "ImportDataTable_1");
} }
} }
table.Rows.Add(dataRow); table.Rows.Add(dataRow);
} }
catch (Exception exception) catch (Exception exception)
{ {
LogHelper.Write(exception, "ImportDt_2"); LogHelper.Write(exception, "ImportDataTable_2");
} }
} }
} }
catch (Exception exception) catch (Exception exception)
{ {
LogHelper.Write(exception, "ImportDt_3"); LogHelper.Write(exception, "ImportDataTable_3");
} }
return table; return table;
} }
...@@ -707,7 +707,6 @@ namespace Edu.Common.Plugin ...@@ -707,7 +707,6 @@ namespace Edu.Common.Plugin
style.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; style.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
newCell.CellStyle = style; newCell.CellStyle = style;
String drValue = row[column].ToString(); String drValue = row[column].ToString();
newCell.SetCellValue(drValue); newCell.SetCellValue(drValue);
} }
...@@ -747,8 +746,9 @@ namespace Edu.Common.Plugin ...@@ -747,8 +746,9 @@ namespace Edu.Common.Plugin
} }
} }
rowIndex++; rowIndex++;
//最后一条数据
if (EndNum == rowIndex && startNum != rowIndex) if (EndNum == rowIndex && startNum != rowIndex)
{//最后一条数据 {
var region = new CellRangeAddress(startNum, rowIndex - 1, 2, 2); var region = new CellRangeAddress(startNum, rowIndex - 1, 2, 2);
sheet.AddMergedRegion(region); sheet.AddMergedRegion(region);
} }
......
...@@ -25,6 +25,11 @@ namespace Edu.Model.Entity.Course ...@@ -25,6 +25,11 @@ namespace Edu.Model.Entity.Course
/// </summary> /// </summary>
public string JobName { get; set; } public string JobName { get; set; }
/// <summary>
/// 作业类型(0-题目型作业,1-答题卡作业)
/// </summary>
public int JobType { get; set; }
/// <summary> /// <summary>
/// 评分机制(1-百分制,2-自定义) /// 评分机制(1-百分制,2-自定义)
/// </summary> /// </summary>
...@@ -55,6 +60,16 @@ namespace Edu.Model.Entity.Course ...@@ -55,6 +60,16 @@ namespace Edu.Model.Entity.Course
/// </summary> /// </summary>
public DateTime UpdateTime { get; set; } public DateTime UpdateTime { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary> /// <summary>
/// 接收对象(班级) /// 接收对象(班级)
/// </summary> /// </summary>
......
...@@ -8,5 +8,14 @@ namespace Edu.Model.ViewModel.Course ...@@ -8,5 +8,14 @@ namespace Edu.Model.ViewModel.Course
[Serializable] [Serializable]
public class RB_Course_Job_ViewModel : Model.Entity.Course.RB_Course_Job public class RB_Course_Job_ViewModel : Model.Entity.Course.RB_Course_Job
{ {
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateTime); } }
} }
} }
...@@ -774,8 +774,31 @@ namespace Edu.Module.Course ...@@ -774,8 +774,31 @@ namespace Edu.Module.Course
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Course_Job_ViewModel.JobName),model.JobName }, {nameof(RB_Course_Job_ViewModel.JobName),model.JobName },
{nameof(RB_Course_Job_ViewModel.JobType),model.JobType },
{nameof(RB_Course_Job_ViewModel.ScoreType),model.ScoreType }, {nameof(RB_Course_Job_ViewModel.ScoreType),model.ScoreType },
{nameof(RB_Course_Job_ViewModel.TopicType),model.TopicType }, {nameof(RB_Course_Job_ViewModel.TopicType),model.TopicType },
};
flag = courseJobRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Job_ViewModel.JobId), model.JobId));
}
else
{
var newId = courseJobRepository.Insert(model);
model.JobId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 设置作业其他配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetCourseJobOtherConfigModule(RB_Course_Job_ViewModel model)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Course_Job_ViewModel.ReciveClass),model.ReciveClass }, {nameof(RB_Course_Job_ViewModel.ReciveClass),model.ReciveClass },
{nameof(RB_Course_Job_ViewModel.StartTime),model.StartTime }, {nameof(RB_Course_Job_ViewModel.StartTime),model.StartTime },
{nameof(RB_Course_Job_ViewModel.EndTime),model.EndTime }, {nameof(RB_Course_Job_ViewModel.EndTime),model.EndTime },
...@@ -802,17 +825,22 @@ namespace Edu.Module.Course ...@@ -802,17 +825,22 @@ namespace Edu.Module.Course
{nameof(RB_Course_Job_ViewModel.IsBlankIgnoreComma),model.IsBlankIgnoreComma }, {nameof(RB_Course_Job_ViewModel.IsBlankIgnoreComma),model.IsBlankIgnoreComma },
{nameof(RB_Course_Job_ViewModel.IsMultiHalfScore),model.IsMultiHalfScore }, {nameof(RB_Course_Job_ViewModel.IsMultiHalfScore),model.IsMultiHalfScore },
}; };
flag = courseJobRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Job_ViewModel.JobId), model.JobId)); var flag = courseJobRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Job_ViewModel.JobId), model.JobId));
}
else
{
var newId = courseJobRepository.Insert(model);
model.JobId = newId;
flag = newId > 0;
}
return flag; return flag;
} }
/// <summary>
/// 获取课程作业分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Course_Job_ViewModel> GetCourseJobPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Course_Job_ViewModel query)
{
return courseJobRepository.GetCourseJobPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
#endregion #endregion
} }
} }
\ No newline at end of file
...@@ -2,9 +2,14 @@ ...@@ -2,9 +2,14 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course namespace Edu.Repository.Course
{ {
/// <summary>
/// 课程作业仓储层
/// </summary>
public class RB_Course_JobRepository : BaseRepository<Model.Entity.Course.RB_Course_Job> public class RB_Course_JobRepository : BaseRepository<Model.Entity.Course.RB_Course_Job>
{ {
/// <summary> /// <summary>
...@@ -17,6 +22,7 @@ namespace Edu.Repository.Course ...@@ -17,6 +22,7 @@ namespace Edu.Repository.Course
/// <returns></returns> /// <returns></returns>
public List<RB_Course_Job_ViewModel> GetCourseJobPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Course_Job_ViewModel query) public List<RB_Course_Job_ViewModel> GetCourseJobPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Course_Job_ViewModel query)
{ {
var parameters = new DynamicParameters();
rowsCount = 0; rowsCount = 0;
if (query == null) if (query == null)
{ {
...@@ -32,7 +38,16 @@ WHERE 1=1 ...@@ -32,7 +38,16 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Job_ViewModel.CourseId), query.CourseId); builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Job_ViewModel.CourseId), query.CourseId);
} }
return GetPage<RB_Course_Job_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList(); if (query.Group_Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Job_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.JobName))
{
builder.AppendFormat(" AND {0} LIKE @JobName ", nameof(RB_Course_Job_ViewModel.JobName));
parameters.Add("JobName", "%" + query.JobName.Trim() + "%");
}
return GetPage<RB_Course_Job_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
} }
} }
...@@ -704,6 +704,30 @@ namespace Edu.WebApi.Controllers.Course ...@@ -704,6 +704,30 @@ namespace Edu.WebApi.Controllers.Course
#region 课程作业管理 #region 课程作业管理
/// <summary>
/// 获取课程分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCourseJobPageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_Course_Job_ViewModel>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var list = courseModule.GetCourseJobPageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
}
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary> /// <summary>
/// 添加修改课程作业 /// 添加修改课程作业
/// </summary> /// </summary>
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Edu.WebApi.Controllers.Upload
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class UploadController : ControllerBase
{
/// <summary>
/// 上传Excel文件
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult UploadExcelQuestion()
{
try
{
var files = Request.Form.Files;
if (files.Count == 0)
{
return new ApiResult { Code = (int)ResultCode.Fail, Message = "未选择文件", Data = "" };
}
string filename = files[0].FileName;
string fileExtention = System.IO.Path.GetExtension(files[0].FileName);
//验证文件格式
List<string> ExtList = new List<string>() {
".xls",
".xlsx",
".csv"
};
if (!ExtList.Contains(fileExtention))
{
return new ApiResult { Code = (int)ResultCode.Fail, Message = "文件格式有误", Data = "" };
}
string path = Guid.NewGuid().ToString() + fileExtention;
string basepath = AppContext.BaseDirectory;
string path_server = basepath + "\\upfile\\temporary\\" + path;
if (!Directory.Exists(basepath + "\\upfile\\temporary"))
{
Directory.CreateDirectory(basepath + "\\upfile\\temporary");
}
using (FileStream fstream = new FileStream(path_server, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
files[0].CopyTo(fstream);
}
return ApiResult.Success("", new { Name = filename, Path = path_server });
}
catch (Exception ex)
{
LogHelper.Write(ex, "UploadFile");
return ApiResult.Failed();
}
}
}
}
...@@ -1280,7 +1280,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -1280,7 +1280,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(dr); Rdt.Rows.Add(dr);
} }
string FileName = StartTime + "-" + EndTime + "每日打卡记录表.xls"; string FileName = StartTime + "-" + EndTime + "每日打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName); NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName)); Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName); return ApiResult.Success("", "/ExportFile/" + FileName);
...@@ -1368,7 +1368,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -1368,7 +1368,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(dr); Rdt.Rows.Add(dr);
} }
string FileName = StartTime + "-" + EndTime + "原始打卡记录表.xls"; string FileName = StartTime + "-" + EndTime + "原始打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName); NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName)); Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName); return ApiResult.Success("", "/ExportFile/" + FileName);
...@@ -1477,7 +1477,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -1477,7 +1477,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(Rdr); Rdt.Rows.Add(Rdr);
} }
string FileName = StartTime + "-" + EndTime + "打卡时间表.xls"; string FileName = StartTime + "-" + EndTime + "打卡时间表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName); NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName)); Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName); return ApiResult.Success("", "/ExportFile/" + FileName);
...@@ -1751,7 +1751,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -1751,7 +1751,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(Rdr); Rdt.Rows.Add(Rdr);
} }
string FileName = MonthTime + "月打卡记录表.xls"; string FileName = MonthTime + "月打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName); NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName)); Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName); return ApiResult.Success("", "/ExportFile/" + FileName);
......
...@@ -4,6 +4,7 @@ using System.Linq; ...@@ -4,6 +4,7 @@ using System.Linq;
using Edu.AOP; using Edu.AOP;
using Edu.Cache.User; using Edu.Cache.User;
using Edu.Common.API; using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.User; using Edu.Common.Enum.User;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.ViewModel.Log; using Edu.Model.ViewModel.Log;
...@@ -254,7 +255,20 @@ namespace Edu.WebApi.Controllers.User ...@@ -254,7 +255,20 @@ namespace Edu.WebApi.Controllers.User
[HttpPost] [HttpPost]
public ApiResult SetSchool() public ApiResult SetSchool()
{ {
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_School_ViewModel>(RequestParm.Msg.ToString()); var extModel = new RB_School_ViewModel()
{
Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
ManagerId = base.ParmJObj.GetInt("ManagerId"),
Remark = base.ParmJObj.GetStringValue("Remark"),
SAddress = base.ParmJObj.GetStringValue("SAddress"),
SDomain = base.ParmJObj.GetStringValue("SDomain"),
SId =base.ParmJObj.GetInt("SId"),
SLinkTel = base.ParmJObj.GetStringValue("SLinkTel"),
SLogo=base.ParmJObj.GetStringValue("SLogo"),
SName = base.ParmJObj.GetStringValue("SName"),
Status=(DateStateEnum)base.ParmJObj.GetInt("Status"),
};
extModel.CreateBy = base.UserInfo.Id; extModel.CreateBy = base.UserInfo.Id;
extModel.CreateTime = DateTime.Now; extModel.CreateTime = DateTime.Now;
extModel.UpdateBy = base.UserInfo.Id; extModel.UpdateBy = base.UserInfo.Id;
......
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using System.Text.Unicode; using System.Text.Unicode;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -88,6 +89,19 @@ namespace Edu.WebApi ...@@ -88,6 +89,19 @@ namespace Edu.WebApi
{ {
Timers.TimerJobj.RunStop(); //网站停止完成执行 Timers.TimerJobj.RunStop(); //网站停止完成执行
}); });
string filePath= Path.Combine(Directory.GetCurrentDirectory(), "upfile");
if (System.IO.Directory.Exists(filePath) == false)//如果不存在就创建file文件夹
{
System.IO.Directory.CreateDirectory(filePath);
}
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "upfile")),
RequestPath = "/upfile"
});
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment