From bf639aa40cf5212214ba8f1ba4d3dc8101c252fa Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Thu, 13 Nov 2025 17:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=91=E6=89=B9=20=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/SEController.cs | 53 ++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs index 81d7269..0aad77d 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SEController.cs @@ -85,7 +85,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP CheckCreateTrainSurvey(filter, dtNow, config); //部门培训计划 - CheckDepTrainPlan(filter, dtNow, config); + //CheckDepTrainPlan(filter, dtNow, config); + CreateYearTrainPlan(filter, dtNow, config); //到时间触发年度培训计划,搜集完成的部门培训计划 FinishYearTrainPlan(filter, dtNow, config); //培训通知 @@ -1308,12 +1309,12 @@ namespace APT.PP.WebApi.Controllers.Api.PP return true; }); } - private JsonActionResult CreateYearTrainPlan([FromBody] KeywordFilter filter) + private JsonActionResult CreateYearTrainPlan(KeywordFilter filter, DateTime dtNow, T_SE_SECONFIG config) { return SafeExecute(() => { - var config = GetEntity(t => true); - var dt = DateTime.Now; + //var config = GetEntity(t => true); + //var dt = DateTime.Now; var mm = 12; var dd = 1; if (config != null && config.DEP_TRAIN_PLAN_START_TIME != null) @@ -1321,10 +1322,14 @@ namespace APT.PP.WebApi.Controllers.Api.PP mm = config.DEP_TRAIN_PLAN_START_TIME.Value.Month; dd = config.DEP_TRAIN_PLAN_START_TIME.Value.Day; } - if (mm == dt.Month && dd == dt.Day) + if (mm == dtNow.Month && dd == dtNow.Day) { - int year = int.Parse(dt.Year.ToString()); - var yearPlan = this.GetEntity(e => e.PLAN_YEAR == year || e.PLAN_YEAR == year + 1); + int year = int.Parse(dtNow.Year.ToString()); + if (mm > 9) + { + year++;//超过9月算 制定 明年的代办 + } + var yearPlan = this.GetEntity(e => e.YEAR == year); if (yearPlan != null) { return true; @@ -1333,20 +1338,44 @@ namespace APT.PP.WebApi.Controllers.Api.PP if (approveRole != null) { var user = GetEntity(e => e.APPROVE_ROLE_ID.HasValue && e.APPROVE_ROLE_ID.Value == approveRole.ID && e.ENABLE_STATUS == 0); + if (user == null) + { + approveRole = this.GetEntity(e => e.NAME.Contains("总监") && e.NAME.Contains("安")); + if (approveRole != null) + { + user = GetEntity(e => e.APPROVE_ROLE_ID.HasValue && e.APPROVE_ROLE_ID.Value == approveRole.ID && e.ENABLE_STATUS == 0); + } + } if (user != null) { - T_SE_YEAR_TRAIN_PLAN yearTrainPlan = new T_SE_YEAR_TRAIN_PLAN + //T_SE_YEAR_TRAIN_PLAN yearTrainPlan = new T_SE_YEAR_TRAIN_PLAN + //{ + // ID = Guid.NewGuid(), + // PLAN_YEAR = year, + // LAUNCH_TIME = dtNow, + // LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID, + // LAUNCH_USER_ID = user.ID, + // STATUS = PFStandardStatus.Draft, + // ORG_ID = filter.GetOrgId(), + // PLAN_NAME = "年度安全培训计划" + //}; + //NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE012", () => + //{ + // AddEntityNoCommit(yearTrainPlan); + //}); + T_SE_TRAIN_PLAN yearTrainPlan = new T_SE_TRAIN_PLAN { ID = Guid.NewGuid(), - PLAN_YEAR = year, - LAUNCH_TIME = dt, - LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID, + TYPE = PlanType.Company, + YEAR = year, + LAUNCH_TIME = dtNow, + DEPARTMENT_ID = user.DEPARTMENT_ID, LAUNCH_USER_ID = user.ID, STATUS = PFStandardStatus.Draft, ORG_ID = filter.GetOrgId(), PLAN_NAME = "年度安全培训计划" }; - NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE012", () => + NotificationTaskService.SendNotificationTask("年度安全培训计划", yearTrainPlan.ID, filter.GetOrgId(), user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 1, "SE071", () => { AddEntityNoCommit(yearTrainPlan); });