master
xiaochanghai 10 months ago
parent ea99693401
commit 0e7a1072ae
  1. 2
      Tiobon.Core.Api/Properties/launchSettings.json
  2. 2
      Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs
  3. 12
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  4. 64
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  5. 10
      Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs

@ -16,7 +16,7 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
//"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore"// skywalking //"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore"// skywalking
}, },
"applicationUrl": "http://localhost:9291" "applicationUrl": "http://localhost:9292"
}, },
"IIS Express": { "IIS Express": {
"commandName": "IISExpress", "commandName": "IISExpress",

@ -37,7 +37,7 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord
public string StaffName { get; set; } public string StaffName { get; set; }
public string DeptNo { get; set; } public string DeptNo { get; set; }
public string DepteName { get; set; } public string DeptName { get; set; }
public string DeptFullPateName { get; set; } public string DeptFullPateName { get; set; }
public string TitleName { get; set; } public string TitleName { get; set; }

@ -307,7 +307,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
dbo.FO_DeptInfo (A.DeptID, dbo.FO_DeptInfo (A.DeptID,
getdate (), getdate (),
1, 1,
'DeptFullPateName') DepteName, 'DeptName') DepteName,
A.PhotoUrl, A.PhotoUrl,
B.TitleName B.TitleName
FROM Ghra_Staff A LEFT JOIN Ghra_Title B ON B.TitleID = A.TitleID FROM Ghra_Staff A LEFT JOIN Ghra_Title B ON B.TitleID = A.TitleID
@ -446,11 +446,15 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
if (exam.IsNull()) if (exam.IsNull())
exam = await Db.Queryable<Ghre_Exam>() exam = await Db.Queryable<Ghre_Exam>()
.Where(x => x.Id == studyRecord.ExamId) .Where(x => x.Id == studyRecord.ExamId)
.FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED); .FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED || x.Status == Consts.DIC_EXAM_STATUS.DISABLED);
if (exam.IsNull()) if (exam.IsNull())
return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !"); return ServiceResult<QueryExam>.OprateFailed("该门课程尚未开启考试,请联系HR !");
if (exam.Status == Consts.DIC_EXAM_STATUS.DISABLED)
return ServiceResult<QueryExam>.OprateFailed("该考试已归档,暂不可考试 !");
var dt = Db.GetDate(); var dt = Db.GetDate();
if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG) if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG)
{ {
@ -606,8 +610,8 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
extend.StaffNo = record.StaffNo; extend.StaffNo = record.StaffNo;
extend.StaffName = record.StaffName; extend.StaffName = record.StaffName;
extend.DeptNo = record.StaffNo; extend.DeptNo = record.DeptNo;
extend.DeptName = record.DepteName; extend.DeptName = record.DeptName;
extend.StaffPhoto = record.StaffPhotoUrl; extend.StaffPhoto = record.StaffPhotoUrl;
extend.ExamName = record.ExamName + "(" + record.ExamNo + ")"; extend.ExamName = record.ExamName + "(" + record.ExamNo + ")";
extend.ExamBeginDate = DateTimeHelper.ConvertToDayString(record.BeginTime); extend.ExamBeginDate = DateTimeHelper.ConvertToDayString(record.BeginTime);

@ -1688,41 +1688,41 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
} }
} }
var Ghre_Courses = await Db.Queryable<Ghre_Course>().ToListAsync(); //var Ghre_Courses = await Db.Queryable<Ghre_Course>().ToListAsync();
for (int i = 0; i < Ghre_Courses.Count; i++) //for (int i = 0; i < Ghre_Courses.Count; i++)
{ //{
#region 课程ID 同步至课件 // #region 课程ID 同步至课件
if (!Ghre_Courses[i].CourseWareId.IsNull()) // if (!Ghre_Courses[i].CourseWareId.IsNull())
{ // {
var wares = await Db.Queryable<Ghre_CourseWare>().Where(x => x.CourseIds.Contains(Ghre_Courses[i].Id.ToString()) && x.Id != Ghre_Courses[i].CourseWareId).ToListAsync(); // var wares = await Db.Queryable<Ghre_CourseWare>().Where(x => x.CourseIds.Contains(Ghre_Courses[i].Id.ToString()) && x.Id != Ghre_Courses[i].CourseWareId).ToListAsync();
for (int j = 0; j < wares.Count; j++) // for (int j = 0; j < wares.Count; j++)
{ // {
var courseIds2 = new List<long>(); // var courseIds2 = new List<long>();
if (!string.IsNullOrWhiteSpace(wares[j].CourseIds)) // if (!string.IsNullOrWhiteSpace(wares[j].CourseIds))
courseIds2 = JsonConvert.DeserializeObject<List<long>>(wares[j].CourseIds); // courseIds2 = JsonConvert.DeserializeObject<List<long>>(wares[j].CourseIds);
courseIds2 = courseIds2.Where(x=>x!= Ghre_Courses[i].Id).ToList(); // courseIds2 = courseIds2.Where(x=>x!= Ghre_Courses[i].Id).ToList();
wares[j].CourseIds = JsonConvert.SerializeObject(courseIds2); // wares[j].CourseIds = JsonConvert.SerializeObject(courseIds2);
} // }
await Db.Updateable(wares).UpdateColumns(it => new { it.CourseIds }).ExecuteCommandAsync(); // await Db.Updateable(wares).UpdateColumns(it => new { it.CourseIds }).ExecuteCommandAsync();
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == Ghre_Courses[i].CourseWareId); // var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == Ghre_Courses[i].CourseWareId);
if (ware != null) // if (ware != null)
{ // {
var courseIds2 = new List<long>(); // var courseIds2 = new List<long>();
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) // if (!string.IsNullOrWhiteSpace(ware.CourseIds))
courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); // courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds);
if (!courseIds2.Any(x => x == Ghre_Courses[i].Id)) // if (!courseIds2.Any(x => x == Ghre_Courses[i].Id))
{ // {
courseIds2.Add(Ghre_Courses[i].Id); // courseIds2.Add(Ghre_Courses[i].Id);
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); // ware.CourseIds = JsonConvert.SerializeObject(courseIds2);
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); // await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync();
} // }
} // }
} // }
#endregion // #endregion
} //}
return ServiceResult.OprateSuccess("执行成功!"); return ServiceResult.OprateSuccess("执行成功!");
} }
} }

@ -382,12 +382,13 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
{ {
var staff = staffs[i]; var staff = staffs[i];
var record = await Db.Queryable<Ghre_StudyRecordDto>() var record = await Db.Queryable<Ghre_StudyRecord>()
.Where(x => x.StudyRuleId != ruleId && x.StaffId == staff.StaffID) .Where(x => x.StudyRuleId != ruleId && x.StaffId == staff.StaffID)
.WhereIF(!string.IsNullOrWhiteSpace(rule.Year), x => x.Year == rule.Year) .WhereIF(!string.IsNullOrWhiteSpace(rule.Year), x => x.Year == rule.Year)
.WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId) .WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId)
.WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId) .WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId)
.AS("Ghre_StudyRecord_V").FirstAsync(); //.AS("Ghre_StudyRecord_V")
.FirstAsync();
if (record is null) if (record is null)
{ {
inserts.Add(new Ghre_StudyRecord() inserts.Add(new Ghre_StudyRecord()
@ -460,10 +461,13 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
WHERE A.StaffName IS NULL"; WHERE A.StaffName IS NULL";
await Db.Ado.ExecuteCommandAsync(sql); await Db.Ado.ExecuteCommandAsync(sql);
} }
catch (Exception) catch (Exception E)
{ {
await Db.Ado.RollbackTranAsync(); await Db.Ado.RollbackTranAsync();
await Db.Updateable<Ghre_StudyRule>().Where(x => x.Id == ruleId)
.SetColumns(it => new Ghre_StudyRule() { Result = E.Message })//类只能在表达示里面不能提取
.ExecuteCommandAsync();
} }
return true; return true;
} }

Loading…
Cancel
Save