From c60228600c8ce7b5945c82179e90dbdb37670fa6 Mon Sep 17 00:00:00 2001 From: wjn Date: Tue, 9 Jul 2024 10:19:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/FM/T_FM_RISK_LEVEL_PROPORTION.cs | 2 + .../Api/EvaluationPlanController.cs | 4 - .../Controllers/Api/FMController.cs | 77 +++++++++---------- 3 files changed, 39 insertions(+), 44 deletions(-) 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.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.PP.WebApi/Controllers/Api/FMController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/FMController.cs index 3569a6e..27e6839 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, 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); });