diff --git a/APT.BaseData.Domain/Entities/FM/T_FM_RISK_LEVEL_PROPORTION.cs b/APT.BaseData.Domain/Entities/FM/T_FM_RISK_LEVEL_PROPORTION.cs index cf0c9c2..7785e35 100644 --- a/APT.BaseData.Domain/Entities/FM/T_FM_RISK_LEVEL_PROPORTION.cs +++ b/APT.BaseData.Domain/Entities/FM/T_FM_RISK_LEVEL_PROPORTION.cs @@ -17,5 +17,7 @@ namespace APT.BaseData.Domain.Entities.FM [Description("颜色")] public string COLOR { get; set; } + [Description("排序")] + public int NUM { get; set; } } } diff --git a/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs b/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs index c4d9405..3c10242 100644 --- a/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs +++ b/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs @@ -244,7 +244,13 @@ namespace APT.BaseData.Domain.IServices.FM /// List InsertUserNoticeTaskModels(List Name, List DataId, Guid? OrgId, List UserId, List userName, DateTime startTime, DateTime endTime, int noticeType, List formCode); - + /// + /// 发送新消息集合返回实体集合 + /// + /// 消息ID + /// + List InsertUserNoticeTaskModels(List Name, List DataId, Guid? OrgId, List UserId, List userName, + DateTime startTime, List endTime, int noticeType, List formCode); /// /// 发送新消息集合返回实体集合 /// diff --git a/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs b/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs index d3c80d8..1b0a9d2 100644 --- a/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs +++ b/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs @@ -581,7 +581,40 @@ namespace APT.BaseData.Services.Services.FM return notices; } + /// + /// 插入新消息集合返回实体集合(wjn240705) + /// + /// 消息ID + /// + public List InsertUserNoticeTaskModels(List Names, List DataIds, Guid? OrgId, List UserIds, List UserNames, + DateTime startTime, List endTimes, int noticeType, List formCode) + { + List notices = new List(); + if (UserIds.Count > 0) + { + var index = 0; + UserIds.ForEach(t => + { + T_FM_NOTIFICATION_TASK notice = new T_FM_NOTIFICATION_TASK(); + notice.CODE = DateTime.Now.ToString("yyyyMMddHHmmss"); + notice.NOTICE_TITLE = Names[index]; + notice.SOURCE_DATA_ID = DataIds[index]; + notice.ORG_ID = OrgId; + notice.ID = Guid.NewGuid(); + notice.TASK_STARTDT = startTime; + notice.TASK_ENDDT = endTimes[index]; + notice.NOTICE_TYPE = noticeType; + notice.NOTICE_STATUS = (int)FMNoticeStatusEnum.未处理; + notice.USER_ID = t; + notice.USER_NAME = UserNames[index]; + notice.SOURCE_FORMCODE = formCode[index]; + notices.Add(notice); + index++; + }); + } + return notices; + } /// /// 插入新消息集合返回实体集合(wjn0513) /// diff --git a/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs b/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs index 3e05e62..6337e9f 100644 --- a/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs +++ b/APT.BaseData.Services/Services/PF/PFApproveCallBackService.cs @@ -5406,6 +5406,7 @@ namespace APT.BaseData.Services.DomainServices var noticeUserNames = new List(); var noticeDataIds = new List(); var noticeFormCodes = new List(); + var noticeEndTime = new List(); SystemCodeFilter riskCode = new SystemCodeFilter { CodeType = (int)PFCodeRuleType.风险辨识任务编号, @@ -5510,6 +5511,7 @@ namespace APT.BaseData.Services.DomainServices noticeUserIds.Add((Guid)riskDetail.CHARGE_USER_ID); noticeUserNames.Add(user.NAME); noticeFormCodes.Add("HM062"); + noticeEndTime.Add(DateTime.Parse(riskTask.END_TIME.ToShortDateString() + " 23:59:59")); risks.Add(riskTask); } int hazardIndex = 0; @@ -5571,9 +5573,10 @@ namespace APT.BaseData.Services.DomainServices noticeUserIds.Add((Guid)hazardDetail.CHARGE_USER_ID); noticeUserNames.Add(user.NAME); noticeFormCodes.Add("HM102"); + noticeEndTime.Add(DateTime.Parse(hazardTask.END_TIME.ToShortDateString() + " 23:59:59")); hazards.Add(hazardTask); } - sendNoticeList = NotificationTaskService.InsertUserNoticeTaskModels(noticeTitles, noticeDataIds, entity.ORG_ID, noticeUserIds, noticeUserNames, DateTime.Now, DateTime.Parse(DateTime.Now.AddDays(1).ToShortDateString() + " 23:59:59"), (int)FMNoticeTypeEnum.消息, noticeFormCodes); + sendNoticeList = NotificationTaskService.InsertUserNoticeTaskModels( noticeTitles, noticeDataIds, entity.ORG_ID, noticeUserIds, noticeUserNames, DateTime.Now, noticeEndTime, (int)FMNoticeTypeEnum.消息, noticeFormCodes); this.UnifiedCommit(() => { if (entity != null) diff --git a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluateRiskController.cs b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluateRiskController.cs index 5bd9b6f..0b816be 100644 --- a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluateRiskController.cs +++ b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluateRiskController.cs @@ -525,7 +525,16 @@ namespace APT.HM.WebApi.Controllers.Api } if (!string.IsNullOrEmpty(dtSource.Rows[i][18].ToString().Trim()))//责任单位 { - item.DEPARTMENT_LIABLE_ID = deps.FirstOrDefault(t => t.NAME == dtSource.Rows[i][18].ToString().Trim()).ID; + var dep = deps.FirstOrDefault(t => t.NAME == dtSource.Rows[i][18].ToString().Trim()); + if (dep != null) + { + item.DEPARTMENT_LIABLE_ID = dep.ID; + } + else + { + var depName = dtSource.Rows[i][18].ToString().Trim(); + } + } if (!string.IsNullOrEmpty(dtSource.Rows[i][19].ToString().Trim()))//责任岗位 { diff --git a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluationPlanController.cs b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluationPlanController.cs index 9359647..fd9689c 100644 --- a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluationPlanController.cs +++ b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/EvaluationPlanController.cs @@ -75,10 +75,6 @@ namespace APT.HM.WebApi.Controllers.Api throw new Exception("辨识区域不能为空"); } }); - if (files == null || files.Count <= 0) - { - throw new Exception("附件未上传,无法发送"); - } if (entity.DEPUTY_GROUP_LEADER_ID == null || entity.GROUP_LEADER_ID == null) { throw new Exception("组长或副组长未填写"); diff --git a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/HazardTaskController.cs b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/HazardTaskController.cs index abbd7f8..0a5380a 100644 --- a/APT.MicroApi/APT.HM.WebApi/Controllers/Api/HazardTaskController.cs +++ b/APT.MicroApi/APT.HM.WebApi/Controllers/Api/HazardTaskController.cs @@ -297,7 +297,7 @@ namespace APT.HM.WebApi.Controllers.Api } allUsers.Add(recordUser); } - allUsers= allUsers.DistinctBy(u => new { u.USER_ID, u.AREA_ID }).ToList(); + allUsers = allUsers.DistinctBy(u => new { u.USER_ID, u.AREA_ID }).ToList(); } } //添加附件 @@ -408,5 +408,38 @@ namespace APT.HM.WebApi.Controllers.Api } return result; } + /// + /// 审批流回调 + /// + /// + /// + [HttpPost, Route("RejectUpdate")] + public JsonActionResult RejectUpdate([FromBody] T_PF_APPROVE entity) + { + return SafeExecute(() => + { + T_PF_APPROVE modelApp = null; + List listAppDetail = null; + T_FM_NOTIFICATION_TASK taskFinish = null; + string Msg = string.Empty; + var record = GetEntity(entity.DATA_ID, new string[] { "Nav_LiableUser" }); + bool ResultGetInfo = ApproveCallBackService.GetApproject(entity, ref modelApp, ref listAppDetail, ref taskFinish, ref Msg); + if (!ResultGetInfo) + throw new Exception("驳回失败!"); + record.STATUS = FOPreMeetingStatusEnum.审批拒绝; + var sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("职业危害辨识任务-驳回", entity.DATA_ID, record.ORG_ID, (Guid)record.LIABLE_USER_ID, record.Nav_LiableUser.NAME, DateTime.Now, DateTime.Now.AddDays(7), 0, "HM102"); + UnifiedCommit(() => + { + if (record != null) + UpdateEntityNoCommit(record); //保存主表 + if (sendNotice != null) + AddEntityNoCommit(sendNotice); + }); + + return true; + + + }); + } } } diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/FMController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/FMController.cs index 3569a6e..13994d1 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/FMController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/FMController.cs @@ -533,49 +533,46 @@ namespace APT.PP.WebApi.Controllers.Api.PP BaseFilter baseFilter = new BaseFilter(filter.GetOrgId()); var riskLevelProportions = new List(); var riskTypeProportions = new List(); - baseFilter.SelectField = new string[] { "EVALUATE_LEVEL", "Nav_Type.NAME", "MineType" }; - var evaluateRisks = GetEntities(t => t.TYPE_ID != null && t.EVALUATE_LEVEL != 0 && t.MineType != 0, baseFilter).Select(i => new { i.EVALUATE_LEVEL, i.Nav_Type.NAME, i.MineType }).OrderBy(i => i.EVALUATE_LEVEL).ToList(); - var distinctLevelTypes = evaluateRisks.GroupBy(m => new { m.EVALUATE_LEVEL, m.MineType }).Select(group => new { group.Key.EVALUATE_LEVEL, group.Key.MineType, count = group.Count() }).ToList(); + baseFilter.SelectField = new string[] { "EVALUATE_LEVEL", "Nav_Type.NAME" }; + var evaluateRisks = GetEntities(t => t.TYPE_ID != null && t.EVALUATE_LEVEL != 0 && t.STATUS == 0, baseFilter).Select(i => new { i.EVALUATE_LEVEL, i.Nav_Type.NAME }).OrderBy(i => i.EVALUATE_LEVEL).ToList(); + var distinctLevelTypes = evaluateRisks.GroupBy(m => new { m.EVALUATE_LEVEL }).Select(group => new { group.Key.EVALUATE_LEVEL, count = group.Count() }).ToList(); var levels = new int[] { 10, 20, 30, 40 }; - var mineTypes = new int[] { 10, 20, 30 }; - - foreach (var level in levels) { - foreach (var mineType in mineTypes) + var item = distinctLevelTypes.FirstOrDefault(t => (int)t.EVALUATE_LEVEL == level); + T_FM_RISK_LEVEL_PROPORTION riskLevelProportion = new T_FM_RISK_LEVEL_PROPORTION(); + if (item != null) { - var item = distinctLevelTypes.FirstOrDefault(t => (int)t.MineType.Value == mineType && (int)t.EVALUATE_LEVEL == level); - T_FM_RISK_LEVEL_PROPORTION riskLevelProportion = new T_FM_RISK_LEVEL_PROPORTION(); - riskLevelProportion.COLOR = mineType.ToString(); - if (item != null) - { - riskLevelProportion.COUNT = item.count; - } - else - { - riskLevelProportion.COUNT = 0; - } - var label = ""; - if (level == 10) - { - label = "一级"; - } - else if (level == 20) - { - label = "二级"; - } - else if (level == 30) - { - label = "三级"; - } - else if (level == 40) - { - label = "四级"; - } - riskLevelProportion.RISK_LEVEL = label; - riskLevelProportion.ORG_ID = filter.GetOrgId(); - riskLevelProportions.Add(riskLevelProportion); + riskLevelProportion.COUNT = item.count; } + else + { + riskLevelProportion.COUNT = 0; + } + var label = ""; + if (level == 10) + { + label = "重大风险"; + riskLevelProportion.NUM = 1; + } + else if (level == 20) + { + label = "较大风险"; + riskLevelProportion.NUM = 2; + } + else if (level == 30) + { + label = "一般风险"; + riskLevelProportion.NUM = 3; + } + else if (level == 40) + { + label = "低风险"; + riskLevelProportion.NUM = 4; + } + riskLevelProportion.RISK_LEVEL = label; + riskLevelProportion.ORG_ID = filter.GetOrgId(); + riskLevelProportions.Add(riskLevelProportion); } var distinctTypes = evaluateRisks.GroupBy(m => m.NAME).Select(group => new { group.Key, count = group.Count() }).ToList(); foreach (var item in distinctTypes) @@ -771,8 +768,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP { DeleteEntityNoCommit(t => true);//删除表数据 - //添加信息 - if (listResult.Any() && listResult.Count > 0) + //添加信息 + if (listResult.Any() && listResult.Count > 0) BantchAddEntityNoCommit(listResult); }); diff --git a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BIController.cs b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BIController.cs index 7da8670..7c18934 100644 --- a/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BIController.cs +++ b/APT.MicroApi/APT.SC.WebApi/Controllers/Api/BIController/BIController.cs @@ -28,7 +28,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI [Route("api/BI/BIController")] public class BIController : APTApiController { - + public class GoViewDataReturn { public int code { get; set; } @@ -213,7 +213,6 @@ namespace APT.SC.WebApi.Controllers.Api.BI var measure3 = GetEntities(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count(); var measure4 = GetEntities(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count(); var measure5 = GetEntities(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count(); - //var distinctDepartment = allrisk.Select(t => new { t.SOURCE_DEPARTMENT_ID, t.Nav_SourceDepartment.NAME }).Distinct(); var distinctDepartment = GetEntities(t => t.DEPARTMENT_TYPE == 0, new BaseFilter(filter.GetOrgId())); riskData riskData = new riskData(); @@ -234,24 +233,12 @@ namespace APT.SC.WebApi.Controllers.Api.BI var distinctArea = allrisk.Select(t => new { t.AREA_ID, AreaName = t.Nav_Area.NAME, SourceDepartmentName = t.Nav_SourceDepartment.NAME }).Distinct(); foreach (var area in distinctArea) { - - if (area.SourceDepartmentName.Contains("矿山") || area.SourceDepartmentName.Contains("选矿")) - { - areaCountModel item = new areaCountModel(); - - if (area.SourceDepartmentName.Contains("矿山")) - { - item.AREATYPE = 0; - } - else - { - item.AREATYPE = 1; - } - item.AREANAME = area.AreaName; - item.AREACOUNT = allrisk.Count(t => t.AREA_ID == area.AREA_ID); - item2s.Add(item); - } + areaCountModel item = new areaCountModel(); + item.AREANAME = area.AreaName; + item.AREACOUNT = allrisk.Count(t => t.AREA_ID == area.AREA_ID); + item2s.Add(item); } + var currMonth = DateTime.Now.Month; DateTime today = DateTime.Today; for (var i = 1; i < currMonth + 1; i++) @@ -581,10 +568,10 @@ namespace APT.SC.WebApi.Controllers.Api.BI sDatas.Add(Data); } } - var orderData = sDatas.OrderBy(t => t.NAME1).ThenBy(t=>t.NAME7).ToList(); + var orderData = sDatas.OrderBy(t => t.NAME1).ThenBy(t => t.NAME7).ToList(); return orderData; }); } - + } }