diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs index d5a5308..a75fe18 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/SENewUsers.cs @@ -322,11 +322,48 @@ namespace APT.SC.WebApi.Controllers.Api.SE } var pointIDS = pointS.Select(t => t.ID).ToList(); var allTests = GetEntities(st => st.Nav_Points.Any(pt => pointIDS.Contains((Guid)pt.POINT_ID)), testFilter).ToList(); + //var errorMsg = ""; + //if (errorMsg != "") + //{ + // throw new Exception("知识点 " + errorMsg + " 没有题目!"); + //} var errorMsg = ""; + foreach (var testPoint in pointIDS) + { + var havepoint = allTests.Where(st => st.Nav_Points.Any(pt => pt.POINT_ID == testPoint)); + if (havepoint.Count() < 1) + { + var noPoint = GetEntity(testPoint); + errorMsg += noPoint.NAME + ","; + } + } if (errorMsg != "") { throw new Exception("知识点 " + errorMsg + " 没有题目!"); } + var SCurrentCount = allTests.Count(t => t.TYPE == SETestTypeEnum.单选题); + var MCurrentCount = allTests.Count(t => t.TYPE == SETestTypeEnum.多选题); + var CCurrentCount = allTests.Count(t => t.TYPE == SETestTypeEnum.是非题); + errorMsg = ""; + if (SCurrentCount < SCount) + { + errorMsg += "题库中题目数量不足!"; + errorMsg += "单选题还需" + (SCount - SCurrentCount) + "题\n"; + } + if (MCurrentCount < MCount) + { + errorMsg += "题库中题目数量不足!"; + errorMsg += "多选题还需" + (MCount - MCurrentCount) + "题\n"; + } + if (CCurrentCount < CCount) + { + errorMsg += "题库中题目数量不足!"; + errorMsg += "是非题还需" + (CCount - CCurrentCount) + "题\n"; + } + if (errorMsg != "") + { + throw new Exception(errorMsg); + } CreateTestList(allTests, testidlist, pointIDS, (int)SETestTypeEnum.是非题, CCount); CreateTestList(allTests, testidlist, pointIDS, (int)SETestTypeEnum.单选题, SCount); CreateTestList(allTests, testidlist, pointIDS, (int)SETestTypeEnum.多选题, MCount); @@ -548,9 +585,12 @@ namespace APT.SC.WebApi.Controllers.Api.SE T_OG_SAFE_PDT_SIGNED signRecord = null; T_OG_SAFE_PDT_SIGNED_POST signPost = null; var currUser = GetEntity(APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value); - var currPerson = GetEntity(currUser.PERSON_ID.Value); - var departInfo = GetEntity(currUser.DEPARTMENT_ID.Value); - GetOG001(entity.TaskID, currUser, currPerson, departInfo, ref signRecord, ref signPost, ref sendNotice); + if (currUser.DEPARTMENT_ID.HasValue) + { + var currPerson = GetEntity(currUser.PERSON_ID.Value); + var departInfo = GetEntity(currUser.DEPARTMENT_ID.Value); + GetOG001(entity.TaskID, currUser, currPerson, departInfo, ref signRecord, ref signPost, ref sendNotice); + } UnifiedCommit(() => {