xiaochanghai 11 months ago
parent a73decbcad
commit 3ecd458f1b
  1. 8
      Model/Tiobon.Web.pdm
  2. 9
      Tiobon.Core.Common/Helper/NPOIHelper.cs
  3. 2
      Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs
  4. 2
      Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs
  5. 5
      Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs
  6. 3
      Tiobon.Core.Model/ViewModels/Extend/CoursePublicSearchField.cs
  7. 2
      Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs
  8. 8
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
  9. 91
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  10. 2
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  11. 7
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs
  12. 20
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1723168103" Name="Tiobon" Objects="7364" Symbols="309" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1723191811" Name="Tiobon" Objects="7364" Symbols="309" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -108793,11 +108793,11 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:Code>AnswerContent</a:Code>
<a:CreationDate>1714100011</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1718094009</a:ModificationDate>
<a:ModificationDate>1723191811</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>答案内容</a:Comment>
<a:DataType>nvarchar(64)</a:DataType>
<a:Length>64</a:Length>
<a:DataType>nvarchar(2000)</a:DataType>
<a:Length>2000</a:Length>
</o:Column>
<o:Column Id="o6595">
<a:ObjectID>A52547CF-D5F2-40A4-AF47-7E613EE8DB7D</a:ObjectID>

@ -291,7 +291,16 @@ public class NPOIHelper
}
}
}
try
{
sheet.SetColumnWidth(columnNum, columnWidth * 300); // 256
}
catch (Exception e)
{
}
}
rowIndex++;

@ -40,7 +40,7 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 答案内容
/// </summary>
[Display(Name = "AnswerContent"), Description("答案内容"), MaxLength(64, ErrorMessage = "答案内容 不能超过 64 个字符")]
[Display(Name = "AnswerContent"), Description("答案内容"), MaxLength(2000, ErrorMessage = "答案内容 不能超过 64 个字符")]
public string AnswerContent { get; set; }
/// <summary>

@ -42,7 +42,7 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 答案内容
/// </summary>
[Display(Name = "AnswerContent"), Description("答案内容"), MaxLength(64, ErrorMessage = "答案内容 不能超过 64 个字符")]
[Display(Name = "AnswerContent"), Description("答案内容"), MaxLength(2000, ErrorMessage = "答案内容 不能超过 64 个字符")]
public string AnswerContent { get; set; }
/// <summary>

@ -38,6 +38,8 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord
public string DeptNo { get; set; }
public string DepteName { get; set; }
public string DeptFullPateName { get; set; }
public string TitleName { get; set; }
public DateTime? Indate { get; set; }
public string InStatus { get; set; }
@ -46,6 +48,9 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord
public string ExamNo { get; set; }
public string ExamName { get; set; }
public string CourseName { get; set; }
public string ScoreMethod { get; set; }
public string ScoreMethodLabel { get; set; }
public decimal? TotalScore { get; set; } = 0;

@ -39,9 +39,12 @@ public class CoursePublic
public bool? DisableBtn { get; set; }
public string BtnActionType { get; set; } = "Add";
public string DateType { get; set; }
public int AfterHowLong { get; set; }
public string ExamDateString { get; set; }
public long? StudyRecordId { get; set; }
public long? ExamId { get; set; }
}

@ -44,6 +44,8 @@ public class Ghre_StudyRecordESS
public string CourseDateString { get; set; }
public string ExamDateString { get; set; }
public long? ExamId { get; set; }
public long? FeedbackOrderId { get; set; }
}

@ -756,9 +756,13 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins
data.ForEach(x =>
{
if (x.ExamBeginDate != null && x.ExamEndDate != null)
if (!x.ExamId.IsNull())
{
if (x.ExamBeginDate != null && x.ExamEndDate != null && x.DateType == DicExamDateType.EXAM_DATE)
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + " ~ " + DateTimeHelper.ConvertToDayString(x.ExamEndDate);
else x.ExamDateString = $"学完{x.AfterHowLong}天";
else if (x.DateType == DicExamDateType.AFTER_HOW_LONG)
x.ExamDateString = $"学完{x.AfterHowLong}天";
}
if (!x.StudyRecordId.IsNull())
x.DisableBtn = true;

@ -16,6 +16,7 @@ using Tiobon.Core.DataAccess;
using System.Data;
using static Tiobon.Core.Model.Consts;
using Mysqlx.Crud;
using MongoDB.Driver.Linq;
namespace Tiobon.Core.Services;
@ -109,6 +110,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
entitys.ForEach(async x =>
{
x.ScoreMethodLabel = await GetParaLabel("ScoreMethod", x.ScoreMethod);
x.ScoreStatus = await GetParaLabel("TrainingExamScoreStatus", x.ScoreStatus);
//x.CourseStatusLabel = await GetParaLabel("TrainingCourseStatus", x.CourseStatus);
//x.StudyStatusLabel = await GetParaLabel("TrainingStudyStatus", x.StudyStatus);
@ -362,35 +364,29 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
body.pageNum = 1;
body.pageSize = 10000;
long examRecordId = 0;
//if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id))
//{
// var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.ExamId == id);
// if (examRecord != null)
// examRecordId = examRecord.Id;
// else
// {
// var insrt = new InsertGhre_ExamRecordInput()
// {
// };
// examRecordId = await base.Add(insrt);
// }
//}
var staffId = GetStaffId();
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id))
long? examRecordId = null;
Ghre_StudyRecord studyRecord = null;
if (await Db.Queryable<Ghre_Exam>().AnyAsync(x => x.Id == id))
{
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.StudyRecordId == id);
studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.ExamId == id && x.StaffId == staffId);
if (studyRecord != null)
id = studyRecord.Id;
}
Ghre_Exam exam = null;
if (await Db.Queryable<Ghre_StudyRecord>().AnyAsync(x => x.Id == id && x.StaffId == staffId))
{
var examRecord = await Db.Queryable<Ghre_ExamRecord>().FirstAsync(x => x.StudyRecordId == id && x.StaffId == staffId);
if (!examRecord.IsNull())
examRecordId = examRecord.Id;
else
{
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == id);
studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == id && x.StaffId == staffId);
var exam = await Db.Queryable<Ghre_Exam>()
exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == studyRecord.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED);
if (exam.IsNull())
@ -429,20 +425,42 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
}
}
if (examRecordId == 0) examRecordId = id;
var records = await QueryFilterPage(body, $"Id='{examRecordId}' AND StaffId='{staffId}'");
if (!records.result.DT_TableDataT1.Any())
return ServiceResult<QueryExam>.OprateFailed("无效的考试ID!");
return ServiceResult<QueryExam>.OprateFailed("无效的考试链接!");
var record = records.result.DT_TableDataT1.FirstOrDefault();
if (studyRecord.IsNull())
studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId);
if (studyRecord.StudyProgress.IsNull() || (!studyRecord.StudyProgress.IsNull() && studyRecord.StudyProgress < 100))
return ServiceResult<QueryExam>.OprateFailed("学习尚未结束暂不可考试!");
if (exam.IsNull())
exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == studyRecord.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED);
if (exam.IsNull())
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !");
var dt = Db.GetDate();
if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG)
{
record.BeginTime = studyRecord?.EndTime;
if (!record.BeginTime.IsNull())
record.EndTime = record.BeginTime.Value.AddDays(exam.AfterHowLong ?? 7);
}
if (!(record.BeginTime.Value.Date <= dt.Date && record.EndTime.Value.Date >= dt.Date))
return ServiceResult<QueryExam>.OprateFailed("考试已结束!");
var details = await Db.Queryable<Ghre_ExamRecordDetail>().Where(x => x.ExamRecordId == record.Id).ToListAsync();
var detailIds = details.Select(x => x.Id).ToList();
var recordAnswers = await Db.Queryable<Ghre_ExamRecordAnswer>()
@ -640,8 +658,20 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
if (entity is null)
return ServiceResult.OprateFailed("无效的考试ID!");
var exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == entity.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED);
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == entity.StudyRecordId);
if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG)
{
entity.BeginTime = studyRecord?.EndTime;
if (!entity.BeginTime.IsNull())
entity.EndTime = entity.BeginTime.Value.AddDays(exam.AfterHowLong ?? 7);
}
var dt = Db.GetDate();
if (!(entity.BeginTime.Value <= dt.Date && entity.EndTime.Value >= dt.Date))
if (!(entity.BeginTime.Value.Date <= dt.Date && entity.EndTime.Value.Date >= dt.Date))
return ServiceResult.OprateFailed("考试已结束!");
#region 试卷 引用次数
@ -702,8 +732,21 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
var exampaper = await Db.Queryable<Ghre_ExamPaper>().FirstAsync(x => x.Id == record.ExamPaperId);
var dt = Db.GetDate();
var exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == record.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED);
var studyRecord = await Db.Queryable<Ghre_StudyRecord>().FirstAsync(x => x.Id == record.StudyRecordId);
if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG)
{
record.BeginTime = studyRecord?.EndTime;
if (!record.BeginTime.IsNull())
record.EndTime = record.BeginTime.Value.AddDays(exam.AfterHowLong ?? 7);
}
var endTime = record.EndTime.Value.AddDays(1).AddSeconds(9);
if (!(record.BeginTime <= dt && record.EndTime >= dt))
if (!(record.BeginTime.Value.Date <= dt.Date && record.EndTime.Value.Date >= dt.Date))
return ServiceResult.OprateFailed("考试已结束!");
string sql = $@"UPDATE Ghre_ExamRecordDetail set IsEnable=0 where ExamRecordId='{record.Id}';

@ -1332,7 +1332,7 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
else if (status == Consts.DIC_EXAM_STATUS.DRAFT)
return ServiceResult.OprateSuccess("取消发布成功!");
else
return ServiceResult.OprateSuccess("停用成功!");
return ServiceResult.OprateSuccess("归档成功!");
}

@ -847,6 +847,8 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
var x = types[jj];
string questionType = ConvertQuestionType1(x);
try
{
DataTable dt = NPOIHelper.ImportExcel(filepath, x);
if (dt.Columns["Comments"] == null)
dt.Columns.Add("Comments", typeof(string));
@ -1097,13 +1099,16 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
}
if (isExistError)
{
NPOIHelper.ExportExcel(dt, null, x, physicsPath + errorFileName);
data.filePath = errorFileName;
}
}
catch (Exception)
{
}
}
return ServiceResult<ExcelData>.OprateSuccess("导入成功!", data);
}

@ -9,9 +9,7 @@ using Tiobon.Core.Common;
using Tiobon.Core.Model;
using Newtonsoft.Json;
using Tiobon.Core.Common.Helper;
using MySqlX.XDevAPI.Common;
using SqlSugar;
using Google.Protobuf.WellKnownTypes;
using static Tiobon.Core.Model.Consts;
namespace Tiobon.Core.Services
@ -193,7 +191,7 @@ namespace Tiobon.Core.Services
A.DefaultCoverImageName,
A.CourseName,
A.StandardHour,
A.CreditPoints,
A.CourseCreditPoints CreditPoints,
A.CourseBeginTime CourseBeginDate,
A.CourseEndTime CourseEndDate,
A.ExamDate,
@ -321,6 +319,8 @@ namespace Tiobon.Core.Services
if (x.StudyProgress < 100 || x.ExamId.IsNull())
x.DisableExamBtn = true;
if (x.FeedbackOrderId.IsNull())
x.ShowFeedbackBtn = false;
});
return new ServicePageResult<Ghre_StudyRecordESS>(filter.pageNum, total, filter.pageSize, entitys);
@ -491,12 +491,19 @@ namespace Tiobon.Core.Services
var staffId = GetStaffId();
if (!await base.AnyAsync(x => x.CourseId == courseId && x.StaffId == staffId))
{
var course = await Db.Queryable<Ghre_Course>().Where(x => x.Id == courseId && x.Status == Consts.DIC_COURSE_STATUS.RELEASED).FirstAsync();
var course = await Db.Queryable<Ghre_Course>().Where(x => x.Id == courseId && x.Status == DIC_COURSE_STATUS.RELEASED).FirstAsync();
if (course.IsNull())
return ServiceResult.OprateFailed("无效的课程!");
DateTime courseTime = Db.GetDate();
var snap = await Db.Queryable<Ghre_CourseSnap>().FirstAsync(x => x.CourseId == courseId);
var exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Status == DIC_EXAM_STATUS.RELEASED &&
x.CourseId == courseId
&& ((x.DateType == DicExamDateType.EXAM_DATE
&& x.BeginTime.Value.Date <= DateTime.Now.Date && x.EndTime.Value.Date >= DateTime.Now.Date) || x.DateType == DicExamDateType.AFTER_HOW_LONG))
.FirstAsync();
await base.Add(new InsertGhre_StudyRecordInput
{
StaffId = staffId,
@ -506,8 +513,9 @@ namespace Tiobon.Core.Services
CourseBeginTime = courseTime.Date,
CourseEndTime = courseTime.Date.AddMonths(snap?.ValidityPeriod ?? 1),
CourseType = "ManualElective",
CourseStatus = Consts.DIC_STUDY_RECORD_COURSE_STATUS_IN,
StudyStatus = Consts.DicStudyRecordStudyStatus.NO_JOIN
CourseStatus = DIC_STUDY_RECORD_COURSE_STATUS_IN,
StudyStatus = DicStudyRecordStudyStatus.NO_JOIN,
ExamId = exam?.Id
});
}
return ServiceResult.OprateSuccess("加入成功!");

Loading…
Cancel
Save