From 636c1a07214f06eb46115d1a1262a81c48393f12 Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Fri, 10 Apr 2026 17:24:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E9=80=9A=E7=9F=A5=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=97=B6=E5=88=A4=E6=96=AD=E9=A2=98=E5=BA=93=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=A4=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SEController/5SETTrainNotifyController.cs | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs index 7c42120..292cf94 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/SEController/5SETTrainNotifyController.cs @@ -138,6 +138,101 @@ namespace APT.SC.WebApi.Controllers.Api.SE throw new Exception("培训时长不能为0!"); } + #region 如果没有课件 只有知识点 判断 题库数量是否足够 + + if (ListCour == null || ListCour.Count() < 1) + { + + #region 题目数量判断 + + var config = GetEntity(t => true); + var SCount = 1; + var MCount = 1; + var CCount = 1; + if (config != null) + { + if (config.M_TEST_COUNT > 0 || config.S_TEST_COUNT > 0 || config.C_TEST_COUNT > 0) + { + //王永文 只要有配置 就获取 + MCount = config.M_TEST_COUNT; + SCount = config.S_TEST_COUNT; + CCount = config.C_TEST_COUNT; + } + else + { + //保持原来的版本 + if (config.M_TEST_COUNT > 0) + { + MCount = config.M_TEST_COUNT; + } + if (config.S_TEST_COUNT > 0) + { + SCount = config.S_TEST_COUNT; + } + if (config.C_TEST_COUNT > 0) + { + CCount = config.C_TEST_COUNT; + } + } + } + var pointIDS = Nav_TrainContentList.Select(t => t.POINT_ID).ToList(); + var testidlist = new List(); + var testFilter = new BaseFilter(entity.ORG_ID); + testFilter.Include = new string[] { "Nav_Points" }; + + + var allTests = GetEntities(st => st.Nav_Points.Any(pt => pointIDS.Contains(pt.POINT_ID.Value)), testFilter).ToList(); + if (allTests.Count() == 0) + { + allTests = GetEntities(st => st.TRAINNAME.Contains(entity.NAME) && st.Nav_Points.Any(pt => pointIDS.Contains(pt.POINT_ID.Value)), testFilter).ToList(); + } + + 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); + } + + #endregion + + } + + + #endregion + + entity.STATUS = SETrainNotifyStatus.通知中; //触发培训通知给所有培训人员 var allSendUserNames = new List();