Commit 353a045f authored by 吴春's avatar 吴春

解决冲突

parents 497c327a 3ff47fb7
using Aspose.Words.Lists;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using NPOI.OpenXmlFormats;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
......
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Edu.Common.Data
{
/// <summary>
/// 导入问题帮助类
/// </summary>
public class QuestionHelper
{
/// <summary>
/// 根据Excel文件获取问题列表
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static 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>
/// 获取Word数据
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static object GetWordQuestionData(string filePath)
{
var questionList = Common.Plugin.AsposeWordHelper.GetWordData(filePath);
return questionList;
}
}
/// <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; }
}
}
......@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspose.Words" Version="21.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.8" />
......@@ -13,25 +14,4 @@
<PackageReference Include="NPOI" Version="2.5.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Aspose.Pdf">
<HintPath>..\lib\Aspose.Pdf.dll</HintPath>
</Reference>
<Reference Include="Aspose.Words">
<HintPath>..\lib\Aspose.Words.dll</HintPath>
</Reference>
<Reference Include="Spire.License">
<HintPath>..\lib\Spire.License.dll</HintPath>
</Reference>
<Reference Include="Spire.Pdf">
<HintPath>..\lib\Spire.Pdf.dll</HintPath>
</Reference>
<Reference Include="Spire.Presentation">
<HintPath>..\lib\Spire.Presentation.dll</HintPath>
</Reference>
<Reference Include="Spire.XLS">
<HintPath>..\lib\Spire.XLS.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.Course
{
/// <summary>
/// 销售端口
/// </summary>
public enum SaleplatEnum
{
/// <summary>
/// 内部销售
/// </summary>
[EnumField("内部销售")]
InternalSales = 1,
/// <summary>
/// 学员App
/// </summary>
[EnumField("学员App")]
StudentApp= 2,
/// <summary>
/// 网课端
/// </summary>
[EnumField("网课端")]
OnlineClass = 3,
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Edu.Common.Plugin
{
/// <summary>
/// AsposeWord帮助类
/// </summary>
public class AsposeWordHelper
{
/// <summary>
/// 获取Word内容
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static List<string> GetWordData(string fileName)
{
Aspose.Words.Document doc = new Aspose.Words.Document(fileName);
List<string> list =new List<string>();
if (doc.FirstSection.Body.Paragraphs.Count > 0)
{
//word中的所有段落
foreach (var item in doc.FirstSection.Body.Paragraphs)
{
string text = Regex.Replace(item.GetText(), "\r", "");
text = text.Replace("\f", "");
text = text.Replace("Evaluation Only. Created with Aspose.Words. Copyright 2003-2021 Aspose Pty Ltd.", "");
if (!string.IsNullOrEmpty(text))
{
list.Add(text);
}
}
}
return list;
}
}
}
......@@ -198,6 +198,21 @@ namespace Edu.Common
{
return Regex.IsMatch(StrSource, @"^((20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d)$");
}
/// <summary>
/// 获取英文字母
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public static string GetEnChar(int index)
{
string[] tempArray = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
if (index < tempArray.Length)
{
return tempArray[index];
}
return "";
}
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ namespace Edu.Common.Plugin
/// <param name="dtSource">源DataTable</param>
/// <param name="strHeaderText">表头文本</param>
[Obsolete]
static MemoryStream ExportDT(DataTable dtSource, String strHeaderText)
static MemoryStream ExportDataTable(DataTable dtSource, String strHeaderText)
{
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.CreateSheet() as HSSFSheet;
......@@ -193,7 +193,7 @@ namespace Edu.Common.Plugin
/// <param name="strHeaderText">表头文本</param>
/// <param name="fs">文件流</param>
[Obsolete]
static void ExportDTI(DataTable dtSource, String strHeaderText, FileStream fs)
static void ExportDataTableI(DataTable dtSource, String strHeaderText, FileStream fs)
{
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.CreateSheet() as XSSFSheet;
......@@ -379,12 +379,12 @@ namespace Edu.Common.Plugin
/// <param name="strHeaderText">表头文本</param>
/// <param name="strFileName">保存位置(路径+文件名)</param>
[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('.');
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);
byte[] data = ms.ToArray();
fs.Write(data, 0, data.Length);
......@@ -395,12 +395,12 @@ namespace Edu.Common.Plugin
if (temp[^1] == "xls")
strFileName += "x";
using FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write);
ExportDTI(dtSource, strHeaderText, fs);
ExportDataTableI(dtSource, strHeaderText, fs);
}
}
#endregion
#region excel中将数据导出到datatable
#region excel文件中将数据导出到datatable
/// <summary>
/// 读取excel
......@@ -410,7 +410,7 @@ namespace Edu.Common.Plugin
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">列头</param>
/// <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;
using (FileStream file = new FileStream(strFileName, FileMode.Open, FileAccess.Read))
......@@ -418,7 +418,7 @@ namespace Edu.Common.Plugin
wb = WorkbookFactory.Create(file);
}
ISheet sheet = wb.GetSheetAt(SheetIndex);
DataTable table = ImportDt(sheet, HeaderRowIndex, needHeader);
DataTable table = ImportDataTable(sheet, HeaderRowIndex, needHeader);
return table;
}
......@@ -429,7 +429,7 @@ namespace Edu.Common.Plugin
/// <param name="HeaderRowIndex">列头所在行号,-1表示没有列头</param>
/// <param name="needHeader">是否导出表头</param>
/// <returns></returns>
static DataTable ImportDt(ISheet sheet, int HeaderRowIndex, bool needHeader)
static DataTable ImportDataTable(ISheet sheet, int HeaderRowIndex, bool needHeader)
{
DataTable table = new DataTable();
IRow headerRow;
......@@ -568,20 +568,20 @@ namespace Edu.Common.Plugin
}
catch (Exception exception)
{
LogHelper.Write(exception, "ImportDt_1");
LogHelper.Write(exception, "ImportDataTable_1");
}
}
table.Rows.Add(dataRow);
}
catch (Exception exception)
{
LogHelper.Write(exception, "ImportDt_2");
LogHelper.Write(exception, "ImportDataTable_2");
}
}
}
catch (Exception exception)
{
LogHelper.Write(exception, "ImportDt_3");
LogHelper.Write(exception, "ImportDataTable_3");
}
return table;
}
......@@ -707,7 +707,6 @@ namespace Edu.Common.Plugin
style.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
newCell.CellStyle = style;
String drValue = row[column].ToString();
newCell.SetCellValue(drValue);
}
......@@ -747,8 +746,9 @@ namespace Edu.Common.Plugin
}
}
rowIndex++;
//最后一条数据
if (EndNum == rowIndex && startNum != rowIndex)
{//最后一条数据
{
var region = new CellRangeAddress(startNum, rowIndex - 1, 2, 2);
sheet.AddMergedRegion(region);
}
......
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
......@@ -44,6 +44,7 @@
<ItemGroup>
<ProjectReference Include="..\Edu.Module.Course\Edu.Module.Course.csproj" />
<ProjectReference Include="..\Edu.Module.OKR\Edu.Module.OKR.csproj" />
</ItemGroup>
<ItemGroup>
......
......@@ -25,6 +25,7 @@ namespace Edu.Education
protected override void OnStart(string[] args)
{
new QuarzHelper().TeachingPerfTimer().GetAwaiter().GetResult();
new QuarzHelper().OKRPeriodTimer().GetAwaiter().GetResult();
}
/// <summary>
......
......@@ -7,6 +7,8 @@ using Quartz.Impl;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Edu.Module.Course;
using Edu.Module.OKR;
using System.Linq;
namespace Edu.Education.Helper
{
......@@ -49,6 +51,38 @@ namespace Edu.Education.Helper
await scheduler.ScheduleJob(job, trigger);
}
/// <summary>
/// 定时执行OKR周期生成
/// </summary>
/// <returns></returns>
public async Task OKRPeriodTimer()
{
//string cronExpression = "0 0 */1 * * ?"; //每天凌晨1点
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
};
StdSchedulerFactory factory = new StdSchedulerFactory(props);
IScheduler scheduler = await factory.GetScheduler();
await scheduler.Start();
IJobDetail job = JobBuilder.Create<CreateOKRPeriod>()
.WithIdentity("job2", "group2")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger2", "group2")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInHours(2)
.RepeatForever())
.Build();
//ICronTrigger trigger = (ICronTrigger)TriggerBuilder.Create()
// .WithIdentity("trigger1", "group1")
// .WithCronSchedule(cronExpression)
// .Build();
await scheduler.ScheduleJob(job, trigger);
}
}
/// <summary>
......@@ -96,4 +130,60 @@ namespace Edu.Education.Helper
return null;
}
}
/// <summary>
/// 周期生成
/// </summary>
public class CreateOKRPeriod : IJob
{
/// <summary>
/// 这里是作业调度每次定时执行方法
/// </summary>
/// <param name="context"></param>
public Task Execute(IJobExecutionContext context)
{
try
{
LogHelper.Write("创建周期....");
OKRPeriodModule oKRPeriodModule = new OKRPeriodModule();
var clist = oKRPeriodModule.GetOKRPeriodConfigList();
foreach (var dmodel in clist)
{
//查询改配置下当前周期
var list = oKRPeriodModule.GetCurrentPeriodList(dmodel.Group_Id);
if (list.Any()) {
var model = list.FirstOrDefault();
//看是否已到可生成下周期时间
if (dmodel.BeforeType == 1)
{
//天
var ds = model.EndDate - DateTime.Now;
if (ds.TotalDays < dmodel.BeforeNum)
{
dmodel.EndDate = model.EndDate;
//生成下一个周期
oKRPeriodModule.CreatePeriodNext(dmodel, true);
}
}
else
{
//月
var ds = DateTime.Now.AddMonths(dmodel.BeforeNum);
if (ds > model.EndDate)
{
dmodel.EndDate = model.EndDate;
//生成下一个周期
oKRPeriodModule.CreatePeriodNext(dmodel, true);
}
}
}
}
}
catch (Exception ex)
{
LogHelper.Write(ex, "CreateOKRPeriod");
}
return null;
}
}
}
......@@ -25,6 +25,11 @@ namespace Edu.Model.Entity.Course
/// </summary>
public string JobName { get; set; }
/// <summary>
/// 作业类型(0-题目型作业,1-答题卡作业)
/// </summary>
public int JobType { get; set; }
/// <summary>
/// 评分机制(1-百分制,2-自定义)
/// </summary>
......@@ -55,6 +60,16 @@ namespace Edu.Model.Entity.Course
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 接收对象(班级)
/// </summary>
......
......@@ -3,31 +3,41 @@ using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 课程阶梯价格实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Course_StepPrice
/// <summary>
/// 课程阶梯价格实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Course_StepPrice
{
/// <summary>
/// 主键
/// </summary>
public int CoursePriceId { get; set; }
/// <summary>
/// 主键
/// </summary>
public int CoursePriceId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 人数
/// </summary>
public int PersionNum { get; set; }
/// <summary>
/// 人数
/// </summary>
public int PersionNum { get; set; }
/// <summary>
/// 售价
/// </summary>
public decimal SellPrice { get; set; }
}
/// <summary>
/// 售价
/// </summary>
public decimal PersionPrice { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
......@@ -36,6 +36,11 @@ namespace Edu.Model.Entity.OKR
/// </summary>
public int IsYear { get; set; }
/// <summary>
/// 是否正常配置的周期 1是 2否
/// </summary>
public int IsNormal { get; set; }
/// <summary>
/// 删除状态
/// </summary>
......
......@@ -27,6 +27,11 @@ namespace Edu.Model.Entity.Question
/// </summary>
public string Title { get; set; }
/// <summary>
/// 问题内容
/// </summary>
public string QuestionContent { get; set; }
/// <summary>
/// 难易程度(1-易,2-中,3-难)
/// </summary>
......
......@@ -40,5 +40,16 @@ namespace Edu.Model.ViewModel.Course
/// 下级列表
/// </summary>
public List<ChapterTree_ViewModel> ChildList { get; set; }
/// <summary>
/// 开发状态(1-开放,2-定时开放)
/// </summary>
public int OpenStatus { get; set; }
/// <summary>
/// 章节进度
/// </summary>
public int Progress { get; set; }
}
}
......@@ -8,5 +8,14 @@ namespace Edu.Model.ViewModel.Course
[Serializable]
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); } }
}
}
......@@ -23,7 +23,7 @@ namespace Edu.Model.ViewModel.Course
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return this.CreateTime.FormatTime();} }
public string CreateTimeStr { get { return this.CreateTime.FormatTime(); } }
/// <summary>
/// 更新时间
......@@ -44,5 +44,35 @@ namespace Edu.Model.ViewModel.Course
/// 课程阶梯价格列表
/// </summary>
public List<RB_Course_StepPrice_ViewModel> StepPriceList { get; set; }
/// <summary>
/// 教师团队
/// </summary>
public List<int> TeacherIdList
{
get
{
if (!string.IsNullOrEmpty(this.Teacher_Ids))
{
return Common.ConvertHelper.StringToList(this.Teacher_Ids);
}
return new List<int>();
}
}
/// <summary>
/// 销售平台
/// </summary>
public List<int> SalePlatList
{
get
{
if (!string.IsNullOrEmpty(this.Saleplat))
{
return Common.ConvertHelper.StringToList(this.Saleplat);
}
return new List<int>();
}
}
}
}
\ No newline at end of file
......@@ -43,6 +43,7 @@ namespace Edu.Model.ViewModel.Question
/// </summary>
public string QQuestionTypeStr { get; set; }
/// <summary>
/// 知识点【查询使用,多选】
/// </summary>
......@@ -56,7 +57,7 @@ namespace Edu.Model.ViewModel.Question
/// <summary>
/// 选项
/// </summary>
public object AnswerObj { get; set; }
public object QuestionContentObj { get; set; }
/// <summary>
/// 知识点名称
......
......@@ -55,5 +55,10 @@ namespace Edu.Model.ViewModel.User
/// 管理者姓名
/// </summary>
public string ManagerName { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public string QSIds { get; set; }
}
}
......@@ -15,6 +15,25 @@
"Edu.Model.dll": {}
}
},
"Aspose.Words/21.1.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.7.0",
"SkiaSharp": "2.80.1",
"System.Reflection.Emit": "4.3.0",
"System.Reflection.Emit.ILGeneration": "4.3.0",
"System.Text.Encoding.CodePages": "4.7.0"
},
"runtime": {
"lib/netstandard2.0/Aspose.Words.Pdf2Word.dll": {
"assemblyVersion": "21.1.0.0",
"fileVersion": "21.1.0.0"
},
"lib/netstandard2.0/Aspose.Words.dll": {
"assemblyVersion": "21.1.0.0",
"fileVersion": "21.1.0.0"
}
}
},
"BouncyCastle.NetCore/1.8.3": {
"dependencies": {
"NETStandard.Library": "1.6.1",
......@@ -890,6 +909,39 @@
}
}
},
"SkiaSharp/2.80.1": {
"dependencies": {
"System.Memory": "4.5.3"
},
"runtime": {
"lib/netstandard2.0/SkiaSharp.dll": {
"assemblyVersion": "2.80.0.0",
"fileVersion": "2.80.1.0"
}
},
"runtimeTargets": {
"runtimes/osx/native/libSkiaSharp.dylib": {
"rid": "osx",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/libSkiaSharp.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/libSkiaSharp.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x86/native/libSkiaSharp.dll": {
"rid": "win-x86",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"SSH.NET/2016.1.0": {
"dependencies": {
"Microsoft.CSharp": "4.5.0",
......@@ -1917,6 +1969,7 @@
},
"Edu.Common/1.0.0": {
"dependencies": {
"Aspose.Words": "21.1.0",
"Microsoft.AspNetCore.Http": "2.2.2",
"Microsoft.AspNetCore.Mvc.Formatters.Json": "2.2.0",
"Microsoft.Extensions.Configuration": "3.1.8",
......@@ -1936,6 +1989,13 @@
"serviceable": false,
"sha512": ""
},
"Aspose.Words/21.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BM2BJz3b8uvN6KzVNSwwrtt0SXQcmzRZ0Cbq6lLOgzCS1fCpS3ieQt2TfeEw3OtvZpNVEWLuJGo1YqQJpMh9Dw==",
"path": "aspose.words/21.1.0",
"hashPath": "aspose.words.21.1.0.nupkg.sha512"
},
"BouncyCastle.NetCore/1.8.3": {
"type": "package",
"serviceable": true,
......@@ -2503,6 +2563,13 @@
"path": "sharpziplib/1.2.0",
"hashPath": "sharpziplib.1.2.0.nupkg.sha512"
},
"SkiaSharp/2.80.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-CiQwnDzG+1JNGzjAN9G/9n/lJgUVA/NPOFgSlEtu6c7qQ0O7P1tMjrXp/+PtWfX0xyyY9ABsFAZK2kW34U7r/A==",
"path": "skiasharp/2.80.1",
"hashPath": "skiasharp.2.80.1.nupkg.sha512"
},
"SSH.NET/2016.1.0": {
"type": "package",
"serviceable": true,
......
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,14 @@ namespace Edu.Module.Question
break;
//填空题
case "fill-in":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(data);
if (!string.IsNullOrEmpty(data))
{
obj = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(data);
}
else
{
obj = null;
}
break;
//判断题
case "judge":
......
......@@ -80,6 +80,7 @@ namespace Edu.Module.Question
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Question_ViewModel.Title),model.Title },
{nameof(RB_Question_ViewModel.QuestionContent),(!string.IsNullOrEmpty(model.QuestionContent)?model.QuestionContent:"") },
{nameof(RB_Question_ViewModel.DifficultyType),(int)model.DifficultyType },
{nameof(RB_Question_ViewModel.AnswerParse),model.AnswerParse },
{nameof(RB_Question_ViewModel.QuestionTypeId),model.QuestionTypeId },
......@@ -151,7 +152,8 @@ namespace Edu.Module.Question
var extModel = questionRepository.GetEntity<RB_Question_ViewModel>(QuestionId);
if (extModel != null)
{
extModel.AnswerObj = analysisQuestion.ParsingQuestion(extModel.QuestionTypeKey, extModel.Answer);
extModel.QuestionContentObj = analysisQuestion.ParsingQuestion(extModel.QuestionTypeKey, extModel.QuestionContent);
if (!string.IsNullOrEmpty(extModel.Knowledge))
{
extModel.QuestionPointList = GetPointListModule(new RB_Question_Point_ViewModel() { QPointIds = extModel.Knowledge });
......
......@@ -194,7 +194,7 @@ namespace Edu.Module.System
var secondLevelList = list.Where(qitem => qitem.MenuLevel == 2 && qitem.ParentId == fItem.MenuId).ToList();
if (secondLevelList != null && secondLevelList.Count > 0)
{
foreach (var sItem in secondLevelList)
foreach (var sItem in secondLevelList.OrderBy(qitem => qitem.SortNum))
{
MenuTree_ViewModel sModel = new MenuTree_ViewModel()
{
......@@ -210,7 +210,7 @@ namespace Edu.Module.System
var thirdLevelList = list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == sItem.MenuId).ToList();
if (thirdLevelList != null && thirdLevelList.Count > 0)
{
foreach (var tItem in thirdLevelList)
foreach (var tItem in thirdLevelList.OrderBy(qitem => qitem.SortNum))
{
sModel.SubList.Add(new MenuTree_ViewModel()
{
......
......@@ -44,6 +44,16 @@ namespace Edu.Module.User
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 校区管理仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取助教列表
/// </summary>
......@@ -242,8 +252,14 @@ namespace Edu.Module.User
{nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime },
{nameof(RB_Assist.Dept_Id),model.Dept_Id },
{nameof(RB_Assist.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -254,7 +270,21 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.AId, AccountTypeEnum.Assist);
}
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.AId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Assist),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
}
}
else
{
......
......@@ -286,7 +286,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
......@@ -299,7 +298,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Assist:
......@@ -312,7 +310,6 @@ namespace Edu.Module.User
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
}
......
......@@ -43,6 +43,16 @@ namespace Edu.Module.User
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 校区管理
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取管理者列表
/// </summary>
......@@ -198,14 +208,17 @@ namespace Edu.Module.User
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id },
{ nameof(RB_Manager_ViewModel.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -217,7 +230,22 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.MId, AccountTypeEnum.Admin);
}
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.MId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Admin),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
}
return flag;
......
......@@ -51,6 +51,16 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_ClassRepository classRepository = new RB_ClassRepository();
/// <summary>
/// 校区管理
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
/// <summary>
/// 账号仓储层对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取讲师列表
/// </summary>
......@@ -269,9 +279,14 @@ namespace Edu.Module.User
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id },
{nameof(RB_Teacher_ViewModel.School_Id),model.School_Id },
};
string logContent = "";
if (model.School_Id != oldModel.School_Id)
{
var schoolList = schoolRepository.GetSchoolListRepository(new RB_School_ViewModel() { QSIds = model.School_Id + "," + oldModel.School_Id });
logContent += string.Format(",将校区由【{0}】修改为【{1}】。", (schoolList.Where(qitem => qitem.SId == oldModel.School_Id)?.FirstOrDefault()?.SName ?? "总部"), (schoolList.Where(qitem => qitem.SId == model.School_Id)?.FirstOrDefault()?.DeptName ?? "总部"));
}
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
......@@ -282,7 +297,22 @@ namespace Edu.Module.User
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent, model.TId, AccountTypeEnum.Teacher);
}
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
//修改账号表
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{ nameof(RB_Account_ViewModel.School_Id),model.School_Id },
};
List<WhereHelper> accountWhere = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.TId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType), (int) AccountTypeEnum.Teacher),
};
flag = accountRepository.Update(accountFileds, accountWhere);
if (flag)
{
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
}
}
else
{
......
......@@ -27,7 +27,7 @@ FROM RB_Course AS A LEFT JOIN rb_course_category AS B ON A.CateId=B.CateId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
//builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null)
{
......@@ -62,7 +62,7 @@ FROM RB_Course AS A LEFT JOIN rb_course_category AS B ON A.CateId=B.CateId
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.Group_Id), query.Group_Id);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
//builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_ViewModel.School_Id), query.School_Id);
if (query != null)
{
......
......@@ -2,9 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Course
{
/// <summary>
/// 课程作业仓储层
/// </summary>
public class RB_Course_JobRepository : BaseRepository<Model.Entity.Course.RB_Course_Job>
{
/// <summary>
......@@ -17,6 +22,7 @@ namespace Edu.Repository.Course
/// <returns></returns>
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;
if (query == null)
{
......@@ -32,7 +38,16 @@ WHERE 1=1
{
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();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.OKR;
using Edu.Model.ViewModel.OKR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -54,9 +55,32 @@ namespace Edu.Repository.OKR
{
where += $@" and {nameof(RB_OKR_Period_ViewModel.IsYear)} ={demodel.IsYear}";
}
if (demodel.IsNormal > 0)
{
where += $@" and {nameof(RB_OKR_Period_ViewModel.IsNormal)} ={demodel.IsNormal}";
}
if (demodel.IsCurrent == 1)
{
where += $@" and {nameof(RB_OKR_Period_ViewModel.StartDate)} <='{DateTime.Now.ToString("yyyy-MM-dd")}'";
where += $@" and {nameof(RB_OKR_Period_ViewModel.EndDate)} >='{DateTime.Now.ToString("yyyy-MM-dd")}'";
}
if (!string.IsNullOrEmpty(demodel.Name))
{
where += $@" and {nameof(RB_OKR_Period_ViewModel.Name)} ='{demodel.Name}'";
}
string sql = $@" select * from RB_OKR_Period where {where} order by StartDate desc,IsYear asc";
return Get<RB_OKR_Period_ViewModel>(sql).ToList();
}
/// <summary>
/// 更新周期全部未历史周期
/// </summary>
/// <param name="GroupId"></param>
/// <returns></returns>
public bool SetPeriodHistory(int GroupId) {
string sql = $" UPDATE rb_okr_period SET IsNormal =2 WHERE Group_Id={GroupId} AND IsNormal =1 AND IsYear =2";
return Execute(sql)> 0;
}
}
}
......@@ -215,6 +215,7 @@ WHERE 1=1 {1}
StringBuilder wheremanager = new StringBuilder();
StringBuilder whereteacher = new StringBuilder();
StringBuilder whereassist = new StringBuilder();
where.AppendFormat(" AND A.{0}={1} ", nameof(Employee_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.Group_Id > 0)
......@@ -346,7 +347,7 @@ FROM
,b.School_Id,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
,B.LeaveStatus,B.LeaveTime,B.AssistTel AS EmployeeTel,IFNULL(B.Email,'') AS Email
FROM rb_assist AS B LEFT JOIN rb_account AS A ON A.AccountId=B.AId AND A.AccountType=3
FROM rb_assist AS B LEFT JOIN rb_account AS A ON A.AccountId=B.AId AND A.AccountType=3
WHERE 1=1 {0} {3}
) AS A LEFT JOIN rb_group AS g ON A.Group_Id=g.GId
LEFT JOIN rb_school AS s ON A.School_Id=s.SId
......
......@@ -58,6 +58,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND s.{0}={1} ", nameof(RB_School_ViewModel.SId), query.SId);
}
if (!string.IsNullOrEmpty(query.QSIds))
{
builder.AppendFormat(" AND s.{0} IN({1}) ", nameof(RB_School_ViewModel.SId), query.QSIds);
}
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND s.{0}={1} ", nameof(RB_School_ViewModel.Group_Id), query.Group_Id);
......
......@@ -16,6 +16,25 @@
"Edu.Repository.dll": {}
}
},
"Aspose.Words/21.1.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.7.0",
"SkiaSharp": "2.80.1",
"System.Reflection.Emit": "4.3.0",
"System.Reflection.Emit.ILGeneration": "4.3.0",
"System.Text.Encoding.CodePages": "4.7.0"
},
"runtime": {
"lib/netstandard2.0/Aspose.Words.Pdf2Word.dll": {
"assemblyVersion": "21.1.0.0",
"fileVersion": "21.1.0.0"
},
"lib/netstandard2.0/Aspose.Words.dll": {
"assemblyVersion": "21.1.0.0",
"fileVersion": "21.1.0.0"
}
}
},
"BouncyCastle.NetCore/1.8.3": {
"dependencies": {
"NETStandard.Library": "1.6.1",
......@@ -891,6 +910,39 @@
}
}
},
"SkiaSharp/2.80.1": {
"dependencies": {
"System.Memory": "4.5.3"
},
"runtime": {
"lib/netstandard2.0/SkiaSharp.dll": {
"assemblyVersion": "2.80.0.0",
"fileVersion": "2.80.1.0"
}
},
"runtimeTargets": {
"runtimes/osx/native/libSkiaSharp.dylib": {
"rid": "osx",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/libSkiaSharp.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/libSkiaSharp.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x86/native/libSkiaSharp.dll": {
"rid": "win-x86",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"SSH.NET/2016.1.0": {
"dependencies": {
"Microsoft.CSharp": "4.5.0",
......@@ -1918,6 +1970,7 @@
},
"Edu.Common/1.0.0": {
"dependencies": {
"Aspose.Words": "21.1.0",
"Microsoft.AspNetCore.Http": "2.2.2",
"Microsoft.AspNetCore.Mvc.Formatters.Json": "2.2.0",
"Microsoft.Extensions.Configuration": "3.1.8",
......@@ -1946,6 +1999,13 @@
"serviceable": false,
"sha512": ""
},
"Aspose.Words/21.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BM2BJz3b8uvN6KzVNSwwrtt0SXQcmzRZ0Cbq6lLOgzCS1fCpS3ieQt2TfeEw3OtvZpNVEWLuJGo1YqQJpMh9Dw==",
"path": "aspose.words/21.1.0",
"hashPath": "aspose.words.21.1.0.nupkg.sha512"
},
"BouncyCastle.NetCore/1.8.3": {
"type": "package",
"serviceable": true,
......@@ -2513,6 +2573,13 @@
"path": "sharpziplib/1.2.0",
"hashPath": "sharpziplib.1.2.0.nupkg.sha512"
},
"SkiaSharp/2.80.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-CiQwnDzG+1JNGzjAN9G/9n/lJgUVA/NPOFgSlEtu6c7qQ0O7P1tMjrXp/+PtWfX0xyyY9ABsFAZK2kW34U7r/A==",
"path": "skiasharp/2.80.1",
"hashPath": "skiasharp.2.80.1.nupkg.sha512"
},
"SSH.NET/2016.1.0": {
"type": "package",
"serviceable": true,
......
......@@ -78,6 +78,17 @@ namespace Edu.WebApi.Controllers
}
}
/// <summary>
/// 根据Id获取用户信息
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public UserInfo GetUserInfo(object Id)
{
UserInfo userInfo = UserReidsCache.GetUserLoginInfo(Id);
return userInfo;
}
/// <summary>
/// 判断用户是否有功能权限
/// </summary>
......
using System;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Module.Course;
......@@ -216,6 +217,17 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 获取销售端口
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSaleplatList()
{
var list = Common.Plugin.EnumHelper.EnumToList(typeof(SaleplatEnum));
return ApiResult.Success(data: list);
}
/// <summary>
/// 删除课程
/// </summary>
......@@ -692,6 +704,30 @@ namespace Edu.WebApi.Controllers.Course
#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>
......
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.Controllers.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
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 UploadFile()
{
try
{
var files = Request.Form.Files;
if (files.Count == 0)
{
return new ApiResult { Code = (int)ResultCode.Fail, Message = "未选择文件", Data = "" };
}
var json = !string.IsNullOrEmpty(Request.Form["params"]) ? JObject.Parse(Request.Form["params"].ToString()) : null;
Int32.TryParse((json["Analysis"]!=null? json["Analysis"].ToString():"0"), out int Analysis);
Int32.TryParse((json["Excel"] != null ? json["Excel"].ToString() : "0"), out int Excel);
Int32.TryParse((json["Word"] != null ? json["Word"].ToString() : "0"), out int Word);
Int32.TryParse((json["CourseId"] != null ? json["CourseId"].ToString() : "0"), out int CourseId);
Int32.TryParse((json["Uid"] != null ? json["Uid"].ToString() : "0"), out int Uid);
string filename = files[0].FileName;
string fileExtention = System.IO.Path.GetExtension(files[0].FileName);
//验证文件格式
List<string> ExtList = new List<string>() {
".xls",
".xlsx",
".doc",
".docx"
};
if (!ExtList.Contains(fileExtention))
{
return new ApiResult { Code = (int)ResultCode.Fail, Message = "文件格式有误", Data = "" };
}
string path = Guid.NewGuid().ToString() + fileExtention;
string basepath = AppContext.BaseDirectory;
string tempPath = basepath + "\\upfile\\temporary\\" + DateTime.Now.ToString("yyyyMMdd")+"\\";
string path_server = tempPath + path;
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(tempPath);
}
using (FileStream fstream = new FileStream(path_server, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
files[0].CopyTo(fstream);
}
//导入Excel文件
if (Analysis == 1 && Excel == 1 && CourseId > 0)
{
return new QuestionController().ImportExcelQuestion(path_server, CourseId, Uid);
}
//导入Word文件
if (Analysis == 1 && Word == 1 && CourseId > 0)
{
return new QuestionController().ImportWordQuestion(path_server, CourseId, Uid);
}
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
Rdt.Rows.Add(dr);
}
string FileName = StartTime + "-" + EndTime + "每日打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName);
......@@ -1368,7 +1368,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(dr);
}
string FileName = StartTime + "-" + EndTime + "原始打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName);
......@@ -1477,7 +1477,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(Rdr);
}
string FileName = StartTime + "-" + EndTime + "打卡时间表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName);
......@@ -1751,7 +1751,7 @@ namespace Edu.WebApi.Controllers.User
Rdt.Rows.Add(Rdr);
}
string FileName = MonthTime + "月打卡记录表.xls";
NPOIHelper.ExportDTtoExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
NPOIHelper.ExportDataTableToExcel(Rdt, "报表", Config.FileExportPath + "\\" + FileName);
Task.Run(() => DeleteDownLoadFile(Config.FileExportPath + "\\" + FileName));
return ApiResult.Success("", "/ExportFile/" + FileName);
......
......@@ -4,6 +4,7 @@ using System.Linq;
using Edu.AOP;
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Log;
......@@ -254,7 +255,20 @@ namespace Edu.WebApi.Controllers.User
[HttpPost]
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.CreateTime = DateTime.Now;
extModel.UpdateBy = base.UserInfo.Id;
......@@ -768,7 +782,6 @@ namespace Edu.WebApi.Controllers.User
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.School_Id = base.UserInfo.School_Id;
bool flag = employeeModule.SetEmployeeDeptModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
......@@ -18,6 +18,7 @@
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspose.Words" Version="21.1.0" />
<PackageReference Include="JWT" Version="5.3.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
......
using System.Collections.Generic;
using System.IO;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading.Tasks;
......@@ -88,6 +89,19 @@ namespace Edu.WebApi
{
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