Merge branch 'main' of http://47.122.43.22:3000/wjn/mh_sms
This commit is contained in:
commit
97e133e87d
61964
APT.Data.Migrations/Migrations/20240719034958_wjn202407-1902.Designer.cs
generated
Normal file
61964
APT.Data.Migrations/Migrations/20240719034958_wjn202407-1902.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace APT.Data.Migrations.Migrations
|
||||
{
|
||||
public partial class wjn2024071902 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IS_LEAF",
|
||||
table: "T_HM_RISK_AREA",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "PARENT_ID",
|
||||
table: "T_HM_RISK_AREA",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TEXT",
|
||||
table: "T_HM_RISK_AREA",
|
||||
type: "nvarchar(50)",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_HM_RISK_AREA_PARENT_ID",
|
||||
table: "T_HM_RISK_AREA",
|
||||
column: "PARENT_ID");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_T_HM_RISK_AREA_T_HM_RISK_AREA_PARENT_ID",
|
||||
table: "T_HM_RISK_AREA",
|
||||
column: "PARENT_ID",
|
||||
principalTable: "T_HM_RISK_AREA",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_T_HM_RISK_AREA_T_HM_RISK_AREA_PARENT_ID",
|
||||
table: "T_HM_RISK_AREA");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_T_HM_RISK_AREA_PARENT_ID",
|
||||
table: "T_HM_RISK_AREA");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IS_LEAF",
|
||||
table: "T_HM_RISK_AREA");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PARENT_ID",
|
||||
table: "T_HM_RISK_AREA");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TEXT",
|
||||
table: "T_HM_RISK_AREA");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4873,6 +4873,9 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Property<DateTime?>("MODIFY_TIME")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("NUM")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("ORG_ID")
|
||||
.IsRequired()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
@ -36128,6 +36131,9 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Property<bool>("IS_DELETED")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IS_LEAF")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("LEVEL")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -36145,15 +36151,24 @@ namespace APT.Data.Migrations.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("PARENT_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("STATUS")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TEXT")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("nvarchar(50)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("DEPARTMENT_ID");
|
||||
|
||||
b.HasIndex("ORG_ID");
|
||||
|
||||
b.HasIndex("PARENT_ID");
|
||||
|
||||
b.ToTable("T_HM_RISK_AREA");
|
||||
});
|
||||
|
||||
@ -57317,9 +57332,16 @@ namespace APT.Data.Migrations.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("APT.MS.Domain.Entities.HM.T_HM_RISK_AREA", "Nav_Parent")
|
||||
.WithMany("Nav_Children")
|
||||
.HasForeignKey("PARENT_ID")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Nav_Department");
|
||||
|
||||
b.Navigation("Nav_Org");
|
||||
|
||||
b.Navigation("Nav_Parent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.HM.T_HM_RISK_RECORD", b =>
|
||||
@ -61639,6 +61661,11 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Navigation("Nav_Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.HM.T_HM_RISK_AREA", b =>
|
||||
{
|
||||
b.Navigation("Nav_Children");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.HM.T_HM_RISK_RECORD", b =>
|
||||
{
|
||||
b.Navigation("Nav_Details");
|
||||
|
||||
@ -1632,7 +1632,7 @@ builder.HasOne(t => t.Nav_ImgFile).WithMany().HasForeignKey(t => t.IMG_FILE_ID).
|
||||
}
|
||||
#endregion
|
||||
#region RiskArea
|
||||
public partial class HMRiskAreaMap :APTEntityBaseMap<T_HM_RISK_AREA>
|
||||
public partial class HMRiskAreaMap :TreeEntityBaseMap<T_HM_RISK_AREA>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<T_HM_RISK_AREA> builder)
|
||||
{
|
||||
|
||||
@ -15,7 +15,7 @@ namespace APT.MS.Domain.Entities.HM
|
||||
/// 辨识区域
|
||||
/// </summary>
|
||||
[Description("辨识区域")]
|
||||
public class T_HM_RISK_AREA : MesEntityBase
|
||||
public partial class T_HM_RISK_AREA : TreeEntityBase<T_HM_RISK_AREA>
|
||||
{
|
||||
/// <summary>
|
||||
/// 编码
|
||||
|
||||
@ -368,15 +368,15 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
|
||||
#region //wyw 密码初始化 Xyy+code(姓名拼音首字母(第一个大写) + 工号(取数字)
|
||||
|
||||
if (!string.IsNullOrEmpty(entity.NAME) && !string.IsNullOrEmpty(entity.CODE))
|
||||
{
|
||||
MD5 md5 = MD5.Create();
|
||||
string code = DataHelper.GetCodeNO(entity.CODE);
|
||||
string nameHead = DataHelper.MkPinyinString(entity.NAME);
|
||||
string NewPwd = DataHelper.MD5Encrypt32(md5, nameHead + code);
|
||||
entity.PASSWORD = NewPwd;
|
||||
}
|
||||
|
||||
//if (!string.IsNullOrEmpty(entity.NAME) && !string.IsNullOrEmpty(entity.CODE))
|
||||
//{
|
||||
// MD5 md5 = MD5.Create();
|
||||
// string code = DataHelper.GetCodeNO(entity.CODE);
|
||||
// string nameHead = DataHelper.MkPinyinString(entity.NAME);
|
||||
// string NewPwd = DataHelper.MD5Encrypt32(md5, nameHead + code);
|
||||
// entity.PASSWORD = NewPwd;
|
||||
//}
|
||||
entity.PASSWORD = "E10ADC3949BA59ABBE56E057F20F883E";
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
|
||||
@ -300,11 +300,11 @@ namespace APT.HM.WebApi.Controllers.Api
|
||||
{
|
||||
if (evaluateType == HMRiskTypeEnmu.危险源辨识)
|
||||
{
|
||||
result.Data.Nav_Risks = result.Data.Nav_Risks.OrderBy(t => t.EVALUATE_SCORE).ToList();
|
||||
result.Data.Nav_Risks = result.Data.Nav_Risks.OrderByDescending(x=>x.MODIFY_TYPE).ThenBy(t => t.EVALUATE_SCORE).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Data.Nav_Hazards = result.Data.Nav_Hazards.OrderBy(t => t.HAZARD_LEVEL).ToList();
|
||||
result.Data.Nav_Hazards = result.Data.Nav_Hazards.OrderByDescending(x => x.MODIFY_TYPE).ThenBy(t => t.HAZARD_LEVEL).ToList();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -20,7 +20,7 @@ using System.Linq.Expressions;
|
||||
namespace APT.HM.WebApi.Controllers.Api
|
||||
{
|
||||
[Route("api/HM/HMRiskArea")]
|
||||
public partial class RiskAreaController : AuthorizeApiController<T_HM_RISK_AREA>
|
||||
public partial class RiskAreaController : AuthorizeTreeApiController<T_HM_RISK_AREA>
|
||||
{
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
|
||||
@ -1176,7 +1176,7 @@ using APT.BaseData.Domain.ApiModel.PF;
|
||||
/// 辨识区域
|
||||
/// </summary>
|
||||
[Route("api/HM/RiskArea")]
|
||||
public partial class RiskAreaController : AuthorizeApiController<T_HM_RISK_AREA>
|
||||
public partial class RiskAreaController : AuthorizeTreeApiController<T_HM_RISK_AREA>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
@ -1272,6 +1272,16 @@ using APT.BaseData.Domain.ApiModel.PF;
|
||||
public JsonActionResult<T_HM_RISK_AREA> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获得树形实体数据
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("TreeData")]
|
||||
public JsonActionResult<IEnumerable<TreeNode<T_HM_RISK_AREA>>> TreeData([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitTreeOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -195,14 +195,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
var riskFilter = new BaseFilter(filter.GetOrgId());
|
||||
riskFilter.SelectField = new string[] { "AREA_ID", "Nav_Area.NAME", "EVALUATE_LEVEL", "Nav_SourceDepartment.NAME", "CREATE_TIME" };
|
||||
IEnumerable<T_HM_EVALUATE_RISK> allrisk = null;
|
||||
if (filter.Parameter1 != null)
|
||||
{
|
||||
allrisk = GetEntities<T_HM_EVALUATE_RISK>(t => t.STATUS == (int)HMOperationStepEnum.有效 && t.SOURCE_DEPARTMENT_ID != null && t.MineType == int.Parse(filter.Parameter1), riskFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
allrisk = GetEntities<T_HM_EVALUATE_RISK>(t => t.STATUS == (int)HMOperationStepEnum.有效 && t.SOURCE_DEPARTMENT_ID != null, riskFilter);
|
||||
}
|
||||
var hazardFilter = new BaseFilter(filter.GetOrgId());
|
||||
hazardFilter.SelectField = new string[] { "CREATE_TIME" };
|
||||
var allhazard = GetEntities<T_HM_EVALUATE_HAZARD>(t => t.STATUS == (int)HMOperationStepEnum.有效, hazardFilter);
|
||||
@ -264,6 +257,401 @@ namespace APT.SC.WebApi.Controllers.Api.BI
|
||||
return riskData;
|
||||
});
|
||||
}
|
||||
public class riskPerformanceData
|
||||
{
|
||||
public List<dateCountModel> DATECOUNTS { get; set; }
|
||||
public PerformanceModel CHARTFXDJ1 { get; set; }
|
||||
public List<PerformanceModel1> CHARTFXDJ2 { get; set; }
|
||||
public List<PerformanceModel> CHARTLIST { get; set; }
|
||||
public List<PerformanceModel> TEAMLIST { get; set; }
|
||||
public List<PerformanceModel> AREALIST { get; set; }
|
||||
public List<PerformanceModel> RISKTYPELIST { get; set; }
|
||||
public List<PerformanceModel> SCDYLIST { get; set; }
|
||||
public List<PerformanceModel> CJLIST { get; set; }
|
||||
public PerformanceModel CHARTZYRW1 { get; set; }
|
||||
public List<PerformanceModel1> CHARTZYRW2 { get; set; }
|
||||
|
||||
|
||||
public riskPerformanceData()
|
||||
{
|
||||
CHARTLIST = new List<PerformanceModel>();
|
||||
TEAMLIST = new List<PerformanceModel>();
|
||||
AREALIST = new List<PerformanceModel>();
|
||||
RISKTYPELIST = new List<PerformanceModel>();
|
||||
SCDYLIST = new List<PerformanceModel>();
|
||||
CJLIST = new List<PerformanceModel>();
|
||||
}
|
||||
|
||||
}
|
||||
public class PerformanceModel1
|
||||
{
|
||||
public string name { get; set; }
|
||||
|
||||
public int value { get; set; }
|
||||
}
|
||||
public class PerformanceModel
|
||||
{
|
||||
public List<string> NAME { get; set; }
|
||||
public List<int> LEVEL1 { get; set; }
|
||||
public List<int> LEVEL2 { get; set; }
|
||||
public List<int> LEVEL3 { get; set; }
|
||||
public List<int> LEVEL4 { get; set; }
|
||||
public List<int> TOTAL { get; set; }
|
||||
|
||||
public PerformanceModel()
|
||||
{
|
||||
NAME = new List<string>();
|
||||
LEVEL1 = new List<int>();
|
||||
LEVEL2 = new List<int>();
|
||||
LEVEL3 = new List<int>();
|
||||
LEVEL4 = new List<int>();
|
||||
TOTAL = new List<int>();
|
||||
}
|
||||
|
||||
}
|
||||
public PerformanceModel SortByTotal(PerformanceModel item)
|
||||
{
|
||||
// 创建临时列表用于保存排序后的索引
|
||||
List<int> sortedIndexes = Enumerable.Range(0, item.TOTAL.Count)
|
||||
.OrderByDescending(index => item.TOTAL[index])
|
||||
.ToList();
|
||||
|
||||
// 新建排序后的数组
|
||||
List<string> sortedName = new List<string>();
|
||||
List<int> sortedLevel1 = new List<int>();
|
||||
List<int> sortedLevel2 = new List<int>();
|
||||
List<int> sortedLevel3 = new List<int>();
|
||||
List<int> sortedLevel4 = new List<int>();
|
||||
|
||||
// 按照排序后的索引填充新的数组
|
||||
for (int i = 0; i < sortedIndexes.Count; i++)
|
||||
{
|
||||
sortedName.Add(item.NAME[sortedIndexes[i]]);
|
||||
sortedLevel1.Add(item.LEVEL1[sortedIndexes[i]]);
|
||||
sortedLevel2.Add(item.LEVEL2[sortedIndexes[i]]);
|
||||
sortedLevel3.Add(item.LEVEL3[sortedIndexes[i]]);
|
||||
sortedLevel4.Add(item.LEVEL4[sortedIndexes[i]]);
|
||||
}
|
||||
|
||||
// 将排序后的数组赋值回原对象
|
||||
item.NAME = sortedName.GetRange(0, Math.Min(8, item.NAME.Count));
|
||||
item.LEVEL1 = sortedLevel1.GetRange(0, Math.Min(8, item.NAME.Count));
|
||||
item.LEVEL2 = sortedLevel2.GetRange(0, Math.Min(8, item.NAME.Count));
|
||||
item.LEVEL3 = sortedLevel3.GetRange(0, Math.Min(8, item.NAME.Count));
|
||||
item.LEVEL4 = sortedLevel4.GetRange(0, Math.Min(8, item.NAME.Count));
|
||||
|
||||
return item;
|
||||
}
|
||||
/// <summary>
|
||||
/// 风险库统计
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">返回系统用户数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("getRiskPerformanceData")]
|
||||
public JsonActionResult<riskPerformanceData> getRiskPerformanceData([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute<riskPerformanceData>(() =>
|
||||
{
|
||||
var riskFilter = new BaseFilter(filter.GetOrgId());
|
||||
riskFilter.SelectField = new string[] { "EVALUATE_LEVEL", "CREATE_TIME", "MineType", "SOURCE_DEPARTMENT_ID", "TYPE_ID", "LEVEL", "AREA_ID", "DEPARTMENT_LIABLE_ID" };
|
||||
IEnumerable<T_HM_EVALUATE_RISK> allrisk = null;
|
||||
allrisk = GetEntities<T_HM_EVALUATE_RISK>(t => t.STATUS == (int)HMOperationStepEnum.有效 && t.SOURCE_DEPARTMENT_ID != null, riskFilter);
|
||||
var hazardFilter = new BaseFilter(filter.GetOrgId());
|
||||
hazardFilter.SelectField = new string[] { "CREATE_TIME" };
|
||||
var allhazard = GetEntities<T_HM_EVALUATE_HAZARD>(t => t.STATUS == (int)HMOperationStepEnum.有效, hazardFilter);
|
||||
riskPerformanceData riskPerformanceData = new riskPerformanceData();
|
||||
List<dateCountModel> item3s = new List<dateCountModel>();
|
||||
var distinctType = GetEntities<T_HM_RISK_TYPE>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
var distinctDepartment = GetEntities<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == 0, new BaseFilter(filter.GetOrgId()));
|
||||
var distinctArea = GetEntities<T_HM_RISK_AREA>(t => t.IS_DELETED == false, new BaseFilter(filter.GetOrgId()));
|
||||
var distinctTeamDepartment = GetEntities<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == 2, new BaseFilter(filter.GetOrgId()));
|
||||
|
||||
#region 1
|
||||
PerformanceModel CHARTFXDJ1 = new PerformanceModel();
|
||||
CHARTFXDJ1.NAME = new List<string> { "重大风险", "较大风险", "一般风险", "低风险" };
|
||||
var type1 = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var type2 = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var type3 = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var type4 = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
CHARTFXDJ1.LEVEL1 = new List<int> { type1, type2, type3, type4 };
|
||||
riskPerformanceData.CHARTFXDJ1 = CHARTFXDJ1;
|
||||
#endregion
|
||||
#region 2
|
||||
List<PerformanceModel1> model2s = new List<PerformanceModel1> { };
|
||||
PerformanceModel1 model1 = new PerformanceModel1();
|
||||
PerformanceModel1 model2 = new PerformanceModel1();
|
||||
PerformanceModel1 model3 = new PerformanceModel1();
|
||||
PerformanceModel1 model4 = new PerformanceModel1();
|
||||
|
||||
model1.name = "重大风险";
|
||||
model1.value = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
model2s.Add(model1);
|
||||
model2.name = "较大风险";
|
||||
model2.value = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
model2s.Add(model2);
|
||||
model3.name = "一般风险";
|
||||
model3.value = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
model2s.Add(model3);
|
||||
model4.name = "低风险";
|
||||
model4.value = allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
model2s.Add(model4);
|
||||
riskPerformanceData.CHARTFXDJ2 = model2s;
|
||||
#endregion
|
||||
|
||||
|
||||
#region 3
|
||||
PerformanceModel modelMineType = new PerformanceModel();
|
||||
foreach (FMProductionUnit mineType in Enum.GetValues(typeof(FMProductionUnit)))
|
||||
{
|
||||
var mineTypeName = mineType.GetDescription();
|
||||
var mineTypeInt = mineType.GetInt();
|
||||
modelMineType.NAME.Add(mineTypeName);
|
||||
modelMineType.LEVEL1.Add(allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.一级));
|
||||
modelMineType.LEVEL2.Add(allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.二级));
|
||||
modelMineType.LEVEL3.Add(allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.三级));
|
||||
modelMineType.LEVEL4.Add(allrisk.Count(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.四级));
|
||||
}
|
||||
riskPerformanceData.CHARTLIST.Add(modelMineType);
|
||||
#endregion
|
||||
|
||||
#region 4
|
||||
PerformanceModel modelFXLB = new PerformanceModel();
|
||||
foreach (var type in distinctType)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
var totalCount = countLevel1 + countLevel2 + countLevel3 + countLevel4;
|
||||
if (totalCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelFXLB.NAME.Add(type.NAME);
|
||||
modelFXLB.LEVEL1.Add(countLevel1);
|
||||
modelFXLB.LEVEL2.Add(countLevel2);
|
||||
modelFXLB.LEVEL3.Add(countLevel3);
|
||||
modelFXLB.LEVEL4.Add(countLevel4);
|
||||
modelFXLB.TOTAL.Add(totalCount);
|
||||
}
|
||||
var newModelFXLB = SortByTotal(modelFXLB);
|
||||
riskPerformanceData.CHARTLIST.Add(modelFXLB);
|
||||
#endregion
|
||||
|
||||
#region 5
|
||||
PerformanceModel modelZRDY = new PerformanceModel();
|
||||
foreach (var department in distinctDepartment)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.SOURCE_DEPARTMENT_ID == department.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.SOURCE_DEPARTMENT_ID == department.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.SOURCE_DEPARTMENT_ID == department.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.SOURCE_DEPARTMENT_ID == department.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
if (countLevel1 + countLevel2 + countLevel3 + countLevel4 == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelZRDY.NAME.Add(department.NAME);
|
||||
modelZRDY.LEVEL1.Add(countLevel1);
|
||||
modelZRDY.LEVEL2.Add(countLevel2);
|
||||
modelZRDY.LEVEL3.Add(countLevel3);
|
||||
modelZRDY.LEVEL4.Add(countLevel4);
|
||||
}
|
||||
riskPerformanceData.CHARTLIST.Add(modelZRDY);
|
||||
#endregion
|
||||
|
||||
#region 6
|
||||
PerformanceModel modelDepartmentType = new PerformanceModel();
|
||||
foreach (FMDepartmentType level in Enum.GetValues(typeof(FMDepartmentType)))
|
||||
{
|
||||
var levelName = level.GetDescription();
|
||||
if(levelName == "车间")
|
||||
{
|
||||
continue ;
|
||||
}
|
||||
modelDepartmentType.NAME.Add(levelName);
|
||||
modelDepartmentType.LEVEL1.Add(allrisk.Count(t => t.LEVEL == level && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级));
|
||||
modelDepartmentType.LEVEL2.Add(allrisk.Count(t => t.LEVEL == level && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级));
|
||||
modelDepartmentType.LEVEL3.Add(allrisk.Count(t => t.LEVEL == level && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级));
|
||||
modelDepartmentType.LEVEL4.Add(allrisk.Count(t => t.LEVEL == level && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级));
|
||||
}
|
||||
riskPerformanceData.CHARTLIST.Add(modelDepartmentType);
|
||||
#endregion
|
||||
|
||||
#region 7
|
||||
PerformanceModel modelArea = new PerformanceModel();
|
||||
foreach (var area in distinctArea)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
var totalArea = countLevel1 + countLevel2 + countLevel3 + countLevel4;
|
||||
if (totalArea == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelArea.NAME.Add(area.NAME);
|
||||
modelArea.LEVEL1.Add(countLevel1);
|
||||
modelArea.LEVEL2.Add(countLevel2);
|
||||
modelArea.LEVEL3.Add(countLevel3);
|
||||
modelArea.LEVEL4.Add(countLevel4);
|
||||
modelArea.TOTAL.Add(totalArea);
|
||||
}
|
||||
var newModelArea = SortByTotal(modelArea);
|
||||
riskPerformanceData.CHARTLIST.Add(newModelArea);
|
||||
#endregion
|
||||
|
||||
#region 8
|
||||
var minTypeArr = new int[] { 30, 10, 20, 0 };
|
||||
var levelArr = new int[] { 3, 0, 1, 2 };
|
||||
foreach (var minetype in minTypeArr)
|
||||
{
|
||||
var templevel1 = allrisk.Where(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var templevel2 = allrisk.Where(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var templevel3 = allrisk.Where(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var templevel4 = allrisk.Where(t => t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
|
||||
PerformanceModel modelSCDY = new PerformanceModel();
|
||||
modelSCDY.NAME = new List<string> { "公司", "部门", "班组" };
|
||||
modelSCDY.LEVEL1 = new List<int> { templevel1.Count(t => (int)t.LEVEL == levelArr[0]), templevel1.Count(t => (int)t.LEVEL == levelArr[1]), templevel1.Count(t => (int)t.LEVEL == levelArr[2]), templevel1.Count(t => (int)t.LEVEL == levelArr[3]) };
|
||||
modelSCDY.LEVEL2 = new List<int> { templevel2.Count(t => (int)t.LEVEL == levelArr[0]), templevel2.Count(t => (int)t.LEVEL == levelArr[1]), templevel2.Count(t => (int)t.LEVEL == levelArr[2]), templevel2.Count(t => (int)t.LEVEL == levelArr[3]) };
|
||||
modelSCDY.LEVEL3 = new List<int> { templevel3.Count(t => (int)t.LEVEL == levelArr[0]), templevel3.Count(t => (int)t.LEVEL == levelArr[1]), templevel3.Count(t => (int)t.LEVEL == levelArr[2]), templevel3.Count(t => (int)t.LEVEL == levelArr[3]) };
|
||||
modelSCDY.LEVEL4 = new List<int> { templevel4.Count(t => (int)t.LEVEL == levelArr[0]), templevel4.Count(t => (int)t.LEVEL == levelArr[1]), templevel4.Count(t => (int)t.LEVEL == levelArr[2]), templevel4.Count(t => (int)t.LEVEL == levelArr[3]) };
|
||||
riskPerformanceData.SCDYLIST.Add(modelSCDY);
|
||||
}
|
||||
#endregion
|
||||
#region 10
|
||||
List<PerformanceModel> SubZRDY = new List<PerformanceModel>();
|
||||
foreach (int minetype in minTypeArr)
|
||||
{
|
||||
PerformanceModel modelSubZRDY = new PerformanceModel();
|
||||
foreach (var team in distinctTeamDepartment)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.DEPARTMENT_LIABLE_ID == team.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.DEPARTMENT_LIABLE_ID == team.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.DEPARTMENT_LIABLE_ID == team.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.DEPARTMENT_LIABLE_ID == team.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
var totalZRDY = countLevel1 + countLevel2 + countLevel3 + countLevel4;
|
||||
if (totalZRDY == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelSubZRDY.NAME.Add(team.NAME);
|
||||
modelSubZRDY.LEVEL1.Add(countLevel1);
|
||||
modelSubZRDY.LEVEL2.Add(countLevel2);
|
||||
modelSubZRDY.LEVEL3.Add(countLevel3);
|
||||
modelSubZRDY.LEVEL4.Add(countLevel4);
|
||||
modelSubZRDY.TOTAL.Add(totalZRDY);
|
||||
}
|
||||
SubZRDY.Add(SortByTotal(modelSubZRDY));
|
||||
}
|
||||
riskPerformanceData.TEAMLIST = SubZRDY;
|
||||
#endregion
|
||||
#region 11
|
||||
List<PerformanceModel> SubQY = new List<PerformanceModel>();
|
||||
foreach (int minetype in minTypeArr)
|
||||
{
|
||||
PerformanceModel modelSubQY = new PerformanceModel();
|
||||
foreach (var area in distinctArea)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.AREA_ID == area.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
var totalZRDY = countLevel1 + countLevel2 + countLevel3 + countLevel4;
|
||||
if (totalZRDY == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelSubQY.NAME.Add(area.NAME);
|
||||
modelSubQY.LEVEL1.Add(countLevel1);
|
||||
modelSubQY.LEVEL2.Add(countLevel2);
|
||||
modelSubQY.LEVEL3.Add(countLevel3);
|
||||
modelSubQY.LEVEL4.Add(countLevel4);
|
||||
modelSubQY.TOTAL.Add(totalZRDY);
|
||||
}
|
||||
SubQY.Add(SortByTotal(modelSubQY));
|
||||
}
|
||||
riskPerformanceData.AREALIST = SubQY;
|
||||
#endregion
|
||||
#region 12
|
||||
List<PerformanceModel> SubFXLB = new List<PerformanceModel>();
|
||||
foreach (int minetype in minTypeArr)
|
||||
{
|
||||
PerformanceModel modelSubFXLB = new PerformanceModel();
|
||||
foreach (var type in distinctType)
|
||||
{
|
||||
var countLevel1 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.一级);
|
||||
var countLevel2 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.二级);
|
||||
var countLevel3 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.三级);
|
||||
var countLevel4 = allrisk.Count(t => t.TYPE_ID == type.ID && t.EVALUATE_LEVEL == EvaluateLevelEnum.四级);
|
||||
var totalZRDY = countLevel1 + countLevel2 + countLevel3 + countLevel4;
|
||||
if (totalZRDY == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
modelSubFXLB.NAME.Add(type.NAME);
|
||||
modelSubFXLB.LEVEL1.Add(countLevel1);
|
||||
modelSubFXLB.LEVEL2.Add(countLevel2);
|
||||
modelSubFXLB.LEVEL3.Add(countLevel3);
|
||||
modelSubFXLB.LEVEL4.Add(countLevel4);
|
||||
modelSubFXLB.TOTAL.Add(totalZRDY);
|
||||
}
|
||||
SubFXLB.Add(SortByTotal(modelSubFXLB));
|
||||
}
|
||||
riskPerformanceData.RISKTYPELIST = SubFXLB;
|
||||
#endregion
|
||||
#region 13
|
||||
|
||||
PerformanceModel CHARTZYRW1 = new PerformanceModel();
|
||||
var allzyrw = GetEntities<T_HM_OPERATION_LINK>(t=>t.IS_DELETED==false, new BaseFilter(filter.GetOrgId()));
|
||||
CHARTZYRW1.NAME = new List<string> { "许可作业", "关键任务", "一般任务" };
|
||||
var zy1 = allzyrw.Count(t => t.TASK_LEVEL == 1);
|
||||
var zy2 = allzyrw.Count(t => t.TASK_LEVEL == 2);
|
||||
var zy3 = allzyrw.Count(t => t.TASK_LEVEL == 3);
|
||||
CHARTZYRW1.LEVEL1 = new List<int> { zy1, zy2, zy3 };
|
||||
riskPerformanceData.CHARTZYRW1 = CHARTZYRW1;
|
||||
#endregion
|
||||
#region 2
|
||||
List<PerformanceModel1> modelZyrws = new List<PerformanceModel1> { };
|
||||
PerformanceModel1 modelZyrw1 = new PerformanceModel1();
|
||||
PerformanceModel1 modelZyrw2 = new PerformanceModel1();
|
||||
PerformanceModel1 modelZyrw3 = new PerformanceModel1();
|
||||
|
||||
modelZyrw1.name = "许可作业";
|
||||
modelZyrw1.value = allzyrw.Count(t => t.TASK_LEVEL == 1);
|
||||
modelZyrws.Add(modelZyrw1);
|
||||
modelZyrw2.name = "关键任务";
|
||||
modelZyrw2.value = allzyrw.Count(t => t.TASK_LEVEL == 2);
|
||||
modelZyrws.Add(modelZyrw2);
|
||||
modelZyrw3.name = "一般任务";
|
||||
modelZyrw3.value = allzyrw.Count(t => t.TASK_LEVEL == 3);
|
||||
modelZyrws.Add(modelZyrw3);
|
||||
riskPerformanceData.CHARTZYRW2 = modelZyrws;
|
||||
#endregion
|
||||
#region
|
||||
var currMonth = DateTime.Now.Month;
|
||||
DateTime today = DateTime.Today;
|
||||
for (var i = 1; i < currMonth + 1; i++)
|
||||
{
|
||||
DateTime endOfMonth = new DateTime(today.Year, i, 1).AddMonths(1).AddSeconds(-1);
|
||||
dateCountModel riskDate = new dateCountModel();
|
||||
riskDate.DATE = endOfMonth;
|
||||
riskDate.COUNT = allrisk.Count(t => t.CREATE_TIME <= endOfMonth);
|
||||
riskDate.TYPE = 0;
|
||||
item3s.Add(riskDate);
|
||||
dateCountModel hazardDate = new dateCountModel();
|
||||
hazardDate.DATE = endOfMonth;
|
||||
hazardDate.COUNT = allhazard.Count(t => t.CREATE_TIME <= endOfMonth); ;
|
||||
hazardDate.TYPE = 1;
|
||||
item3s.Add(hazardDate);
|
||||
}
|
||||
#endregion
|
||||
|
||||
riskPerformanceData.DATECOUNTS = item3s.OrderBy(t => t.DATE).ToList();
|
||||
return riskPerformanceData;
|
||||
});
|
||||
}
|
||||
public class safeTrainData
|
||||
{
|
||||
/// 年度培训计划完成率
|
||||
|
||||
@ -4198,10 +4198,10 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
{
|
||||
throw new Exception("请先选择时间段");
|
||||
}
|
||||
if (string.IsNullOrEmpty(pageFilter.Keyword))
|
||||
{
|
||||
throw new Exception("请先选择部门");
|
||||
}
|
||||
//if (string.IsNullOrEmpty(pageFilter.Keyword))
|
||||
//{
|
||||
// throw new Exception("请先选择部门");
|
||||
//}
|
||||
var newFilter = new BaseFilter(pageFilter.OrgId);
|
||||
newFilter.SelectField = new List<string> { "ID","CODE", "NAME" };
|
||||
var formInfo = this.GetEntities<T_PF_FORM>(t => t.ENABLE_STATUS == 0, newFilter);
|
||||
@ -4211,7 +4211,7 @@ namespace APT.SC.WebApi.Controllers.Api.BIController
|
||||
int dayDidd = span.Days + 1;
|
||||
if (dayDidd >= 180)
|
||||
throw new Exception("查询时间不能超过6个月!");
|
||||
var result = GetEntities<T_BI_NOTIFICATION_TASK_NEW>(s => !s.IS_DELETED && s.CREATE_DATE >= startTime && s.CREATE_DATE <= endTime && s.DEPT_DEPARTMENT_ID == Guid.Parse(pageFilter.Keyword), pageFilter);
|
||||
var result = GetEntities<T_BI_NOTIFICATION_TASK_NEW>(s => !s.IS_DELETED && s.CREATE_DATE >= startTime && s.CREATE_DATE <= endTime, pageFilter);// && s.DEPT_DEPARTMENT_ID == Guid.Parse(pageFilter.Keyword)
|
||||
var userIds = result.Select(t => t.USER_ID).Distinct().ToList();
|
||||
var userInfos= GetEntities<T_FM_USER>(s => userIds.Contains(s.ID) && s.ENABLE_STATUS == 0, newFilter);
|
||||
//pageFilter.Sort = "CREATE_TIME";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user