From 7aab9367ce22fe7d86d254d984e3432128e34eb4 Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Tue, 25 Nov 2025 21:43:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E6=95=99=E8=82=B2=E7=AD=94?= =?UTF-8?q?=E9=A2=98=20=E5=B2=97=E4=BD=8D=E8=B4=A3=E4=BB=BB=E5=88=B6=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/SEController/SENewUsers.cs | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) 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(() => {