安全意识调查、培训需求调查 功能完善与bug修改
This commit is contained in:
parent
424e057af4
commit
6b2e8b6b26
137955
APT.Data.Migrations/Migrations/20260209033459_wyw2026020901.Designer.cs
generated
Normal file
137955
APT.Data.Migrations/Migrations/20260209033459_wyw2026020901.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
117
APT.Data.Migrations/Migrations/20260209033459_wyw2026020901.cs
Normal file
117
APT.Data.Migrations/Migrations/20260209033459_wyw2026020901.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace APT.Data.Migrations.Migrations
|
||||
{
|
||||
public partial class wyw2026020901 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "T_SE_SAFE_SURVEY_USER",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
SURVEY_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
USER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
DEPARTMENT_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
|
||||
ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
|
||||
FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
|
||||
FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
|
||||
FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_T_SE_SAFE_SURVEY_USER", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_T_SE_SAFE_SURVEY_USER_T_FM_DEPARTMENT_DEPARTMENT_ID",
|
||||
column: x => x.DEPARTMENT_ID,
|
||||
principalTable: "T_FM_DEPARTMENT",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_T_SE_SAFE_SURVEY_USER_T_FM_ORGANIZATION_ORG_ID",
|
||||
column: x => x.ORG_ID,
|
||||
principalTable: "T_FM_ORGANIZATION",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_T_SE_SAFE_SURVEY_USER_T_FM_USER_USER_ID",
|
||||
column: x => x.USER_ID,
|
||||
principalTable: "T_FM_USER",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_T_SE_SAFE_SURVEY_USER_T_SE_SAFE_SURVEY_SURVEY_ID",
|
||||
column: x => x.SURVEY_ID,
|
||||
principalTable: "T_SE_SAFE_SURVEY",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_PF_PARAM_T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM",
|
||||
column: "T_SE_SAFE_SURVEY_USERID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_SE_SAFE_SURVEY_USER_DEPARTMENT_ID",
|
||||
table: "T_SE_SAFE_SURVEY_USER",
|
||||
column: "DEPARTMENT_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_SE_SAFE_SURVEY_USER_ORG_ID",
|
||||
table: "T_SE_SAFE_SURVEY_USER",
|
||||
column: "ORG_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_SE_SAFE_SURVEY_USER_SURVEY_ID",
|
||||
table: "T_SE_SAFE_SURVEY_USER",
|
||||
column: "SURVEY_ID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_T_SE_SAFE_SURVEY_USER_USER_ID",
|
||||
table: "T_SE_SAFE_SURVEY_USER",
|
||||
column: "USER_ID");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_T_PF_PARAM_T_SE_SAFE_SURVEY_USER_T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM",
|
||||
column: "T_SE_SAFE_SURVEY_USERID",
|
||||
principalTable: "T_SE_SAFE_SURVEY_USER",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_T_PF_PARAM_T_SE_SAFE_SURVEY_USER_T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "T_SE_SAFE_SURVEY_USER");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_T_PF_PARAM_T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "T_SE_SAFE_SURVEY_USERID",
|
||||
table: "T_PF_PARAM");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17346,12 +17346,17 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Property<Guid?>("ENTITY_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("T_SE_SAFE_SURVEY_USERID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("VALUE")
|
||||
.HasMaxLength(600)
|
||||
.HasColumnType("nvarchar(600)");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("T_SE_SAFE_SURVEY_USERID");
|
||||
|
||||
b.ToTable("T_PF_PARAM");
|
||||
});
|
||||
|
||||
@ -73343,6 +73348,85 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.ToTable("T_SE_SAFE_SURVEY_LIST_POINT");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_SAFE_SURVEY_USER", b =>
|
||||
{
|
||||
b.Property<Guid>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("CREATER_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("CREATE_TIME")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("DEPARTMENT_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("DbConn")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ENTITY_ORG_TPYE")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("FLOW_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("FLOW_SEND_STATUS")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FLOW_STATUS")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("FORM_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("IS_DELETED")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid?>("MODIFIER_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("MODIFY_TIME")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid?>("Nav_DepartmentID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("Nav_OrgID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("Nav_SurveyID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("Nav_UserID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("ORG_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("SURVEY_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("TaskID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("USER_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Nav_DepartmentID");
|
||||
|
||||
b.HasIndex("Nav_OrgID");
|
||||
|
||||
b.HasIndex("Nav_SurveyID");
|
||||
|
||||
b.HasIndex("Nav_UserID");
|
||||
|
||||
b.ToTable("T_SE_SAFE_SURVEY_USER");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_SECONFIG", b =>
|
||||
{
|
||||
b.Property<Guid>("ID")
|
||||
@ -103331,6 +103415,13 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Navigation("Nav_Org");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.Infrastructure.Core.T_PF_PARAM", b =>
|
||||
{
|
||||
b.HasOne("APT.MS.Domain.Entities.SE.T_SE_SAFE_SURVEY_USER", null)
|
||||
.WithMany("Nav_SysParams")
|
||||
.HasForeignKey("T_SE_SAFE_SURVEY_USERID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.AE.T_AE_ACCIDENT_EVENT_DAMAGE_OBJECT", b =>
|
||||
{
|
||||
b.HasOne("APT.Infrastructure.Core.T_FM_ORGANIZATION", "Nav_Org")
|
||||
@ -124839,6 +124930,33 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Navigation("Nav_Safe");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_SAFE_SURVEY_USER", b =>
|
||||
{
|
||||
b.HasOne("APT.BaseData.Domain.Entities.FM.T_FM_DEPARTMENT", "Nav_Department")
|
||||
.WithMany()
|
||||
.HasForeignKey("Nav_DepartmentID");
|
||||
|
||||
b.HasOne("APT.Infrastructure.Core.T_FM_ORGANIZATION", "Nav_Org")
|
||||
.WithMany()
|
||||
.HasForeignKey("Nav_OrgID");
|
||||
|
||||
b.HasOne("APT.MS.Domain.Entities.SE.T_SE_SAFE_SURVEY", "Nav_Survey")
|
||||
.WithMany("Nav_ListUsers")
|
||||
.HasForeignKey("Nav_SurveyID");
|
||||
|
||||
b.HasOne("APT.BaseData.Domain.Entities.FM.T_FM_USER", "Nav_User")
|
||||
.WithMany()
|
||||
.HasForeignKey("Nav_UserID");
|
||||
|
||||
b.Navigation("Nav_Department");
|
||||
|
||||
b.Navigation("Nav_Org");
|
||||
|
||||
b.Navigation("Nav_Survey");
|
||||
|
||||
b.Navigation("Nav_User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_SECONFIG", b =>
|
||||
{
|
||||
b.HasOne("APT.Infrastructure.Core.T_FM_ORGANIZATION", "Nav_Org")
|
||||
@ -136953,11 +137071,18 @@ namespace APT.Data.Migrations.Migrations
|
||||
|
||||
b.Navigation("Nav_JoinDepartment");
|
||||
|
||||
b.Navigation("Nav_ListUsers");
|
||||
|
||||
b.Navigation("Nav_Papers");
|
||||
|
||||
b.Navigation("Nav_Points");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_SAFE_SURVEY_USER", b =>
|
||||
{
|
||||
b.Navigation("Nav_SysParams");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("APT.MS.Domain.Entities.SE.T_SE_TEST", b =>
|
||||
{
|
||||
b.Navigation("Nav_Points");
|
||||
|
||||
@ -10321,6 +10321,7 @@ builder.HasOne(t => t.Nav_LaunchUser).WithMany().HasForeignKey(t => t.LAUNCH_USE
|
||||
builder.Property(t => t.SAFE_USER_IDS).HasMaxLength(500);
|
||||
builder.Ignore(t => t.PUBLISH);
|
||||
builder.Ignore(t => t.IS_OVERTIME);
|
||||
builder.Ignore(t => t.IS_DOWN);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -10382,6 +10383,7 @@ builder.HasOne(t => t.Nav_LaunchUser).WithMany().HasForeignKey(t => t.LAUNCH_USE
|
||||
builder.Property(t => t.SAFE_USER_IDS).HasMaxLength(500);
|
||||
builder.Ignore(t => t.PUBLISH);
|
||||
builder.Ignore(t => t.IS_OVERTIME);
|
||||
builder.Ignore(t => t.IS_DOWN);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -10892,6 +10894,18 @@ builder.Ignore(t => t.EXPIRY_DATE_EDIT);
|
||||
builder.HasOne(t => t.Nav_Renewal).WithMany(t=>t.Nav_Files).HasForeignKey(t => t.RENEWALD_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne(t => t.Nav_ImgFile).WithMany().HasForeignKey(t => t.IMG_FILE_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region SafeSurveyUser
|
||||
public partial class SESafeSurveyUserMap :APTEntityBaseMap<T_SE_SAFE_SURVEY_USER>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<T_SE_SAFE_SURVEY_USER> builder)
|
||||
{
|
||||
base.Configure(builder);
|
||||
builder.HasOne(t => t.Nav_Survey).WithMany(t=>t.Nav_ListUsers).HasForeignKey(t => t.SURVEY_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne(t => t.Nav_User).WithMany().HasForeignKey(t => t.USER_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne(t => t.Nav_Department).WithMany().HasForeignKey(t => t.DEPARTMENT_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Test
|
||||
|
||||
@ -118,5 +118,18 @@ namespace APT.MS.Domain.Entities.SE
|
||||
public string PUBLISH { get; set; }
|
||||
[DataFieldIngore]
|
||||
public int IS_OVERTIME { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 含下级组织成员
|
||||
/// </summary>
|
||||
[Description("含下级组织成员")]
|
||||
[DataFieldIngore]
|
||||
public bool IS_DOWN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 调查人员
|
||||
/// </summary>
|
||||
[Description("调查人员")]
|
||||
public ICollection<T_SE_SAFE_SURVEY_USER> Nav_ListUsers { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,9 +66,9 @@ namespace APT.MS.Domain.Entities.SE
|
||||
[FormFieldEdit]
|
||||
public DateTime? END_TIME { get; set; }
|
||||
/// <summary>
|
||||
/// 导航: 参与人员
|
||||
/// 参与部门
|
||||
/// </summary>
|
||||
[Description("导航: 参与人员")]
|
||||
[Description("参与部门")]
|
||||
[FormFieldEdit]
|
||||
public ICollection<T_SE_TRAIN_SURVEY_LIST_DEPARTMENT> Nav_JoinDepartment { get; set; }
|
||||
/// <summary>
|
||||
@ -77,6 +77,7 @@ namespace APT.MS.Domain.Entities.SE
|
||||
[Description("用户需求")]
|
||||
[FormFieldEdit]
|
||||
public ICollection<T_SE_TRAIN_SURVEY_LIST_DEMAND> Nav_Demands { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导航: 调查目的
|
||||
/// </summary>
|
||||
@ -105,5 +106,12 @@ namespace APT.MS.Domain.Entities.SE
|
||||
public string PUBLISH { get; set; }
|
||||
[DataFieldIngore]
|
||||
public int IS_OVERTIME { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 含下级组织成员
|
||||
/// </summary>
|
||||
[Description("含下级组织成员")]
|
||||
[DataFieldIngore]
|
||||
public bool IS_DOWN { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
61
APT.MS.Domain/Entities/SC/SE/T_SE_SAFE_SURVEY_USER.cs
Normal file
61
APT.MS.Domain/Entities/SC/SE/T_SE_SAFE_SURVEY_USER.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using APT.BaseData.Domain.Entities.FM;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.MS.Domain.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace APT.MS.Domain.Entities.SE
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全意识调查人员
|
||||
/// </summary>
|
||||
[Description("安全意识调查人员")]
|
||||
public class T_SE_SAFE_SURVEY_USER : MesEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 安全意识调查
|
||||
/// </summary>
|
||||
[Description("安全意识调查")]
|
||||
[FormFieldTable]
|
||||
[FormFieldEdit]
|
||||
[DataFieldForeignKey("Nav_Survey", "Nav_ListUsers")]
|
||||
public Guid SURVEY_ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全意识调查
|
||||
/// </summary>
|
||||
[Description("安全意识调查")]
|
||||
public T_SE_SAFE_SURVEY Nav_Survey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员
|
||||
/// </summary>
|
||||
[Description("人员")]
|
||||
[DataFieldForeignKey("Nav_User")]
|
||||
public Guid USER_ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员
|
||||
/// </summary>
|
||||
[Description("人员")]
|
||||
[FormFieldTable]
|
||||
[FormFieldEdit]
|
||||
public T_FM_USER Nav_User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员组织
|
||||
/// </summary>
|
||||
[Description("人员组织")]
|
||||
[DataFieldForeignKey("Nav_Department")]
|
||||
public Guid DEPARTMENT_ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人员组织
|
||||
/// </summary>
|
||||
[Description("人员组织")]
|
||||
[FormFieldTable]
|
||||
[FormFieldEdit]
|
||||
public T_FM_DEPARTMENT Nav_Department { get; set; }
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("FullUpdate")]
|
||||
public JsonActionResult<bool> FullUpdate([FromBody] T_SE_SAFE_SURVEY entity)
|
||||
@ -45,6 +45,8 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
var Nav_JoinDepartment = entity.Nav_JoinDepartment;
|
||||
var Nav_Points = entity.Nav_Points;
|
||||
var Nav_Files = entity.Nav_Files;
|
||||
var listUsers = entity.Nav_ListUsers;
|
||||
entity.Nav_ListUsers = null;
|
||||
List<T_FM_NOTIFICATION_TASK> noticeTask = null;
|
||||
T_FM_NOTIFICATION_TASK finishNotice = null;
|
||||
List<T_SE_SAFE_SURVEY_LIST_PAPER> Nav_Papers = null;
|
||||
@ -78,6 +80,10 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
throw new Exception("参与人员不可为空");
|
||||
}
|
||||
if (listUsers == null || listUsers.Count() < 1)
|
||||
{
|
||||
throw new Exception("参与人员不可为空");
|
||||
}
|
||||
entity.Nav_JoinDepartment = null;
|
||||
if (Nav_Points == null)
|
||||
{
|
||||
@ -128,18 +134,23 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
}
|
||||
var testidlist = new List<Guid>();
|
||||
var pointIDS = Nav_Points.Where(t => t.IS_DELETED == false).Select(t => (Guid)t.POINT_ID).ToList();
|
||||
var allUsersIds = GetDepartmentUsers(Nav_JoinDepartment.Select(t => t.DEPARTMENT_ID).ToList(), entity.ORG_ID);
|
||||
var currDep = GetEntity<T_FM_DEPARTMENT>(t => t.ID == entity.LAUNCH_DEPARTMENT_ID);
|
||||
if (currDep != null && (currDep.NAME == "安全环保管理部" || currDep.NAME == "安全环保科" || currDep.NAME == "安全环保部" || currDep.NAME == "安环部"))
|
||||
{
|
||||
var manageUsers = GetEntities<T_FM_USER>(t => t.Nav_Department.DEPARTMENT_TYPE == 5 && t.ENABLE_STATUS == 0, new BaseFilter(entity.ORG_ID)).Select(t => t.ID);
|
||||
allUsersIds.AddRange(manageUsers);
|
||||
}
|
||||
|
||||
|
||||
var allUsersIds = listUsers.Select(e => e.USER_ID).ToList();
|
||||
|
||||
//var allUsersIds = GetDepartmentUsers(Nav_JoinDepartment.Select(t => t.DEPARTMENT_ID).ToList(), entity.ORG_ID);
|
||||
//var currDep = GetEntity<T_FM_DEPARTMENT>(t => t.ID == entity.LAUNCH_DEPARTMENT_ID);
|
||||
//if (currDep != null && (currDep.NAME == "安全环保管理部" || currDep.NAME == "安全环保科" || currDep.NAME == "安全环保部" || currDep.NAME == "安环部"))
|
||||
//{
|
||||
// var manageUsers = GetEntities<T_FM_USER>(t => t.Nav_Department.DEPARTMENT_TYPE == 5 && t.ENABLE_STATUS == 0, new BaseFilter(entity.ORG_ID)).Select(t => t.ID);
|
||||
// allUsersIds.AddRange(manageUsers);
|
||||
//}
|
||||
var allSendUserIds = new List<Guid>();
|
||||
var allSendUserNames = new List<string>();
|
||||
var allUserDepIds = new List<Guid?>();
|
||||
var allUserPostIdS = new List<Guid?>();
|
||||
|
||||
|
||||
var filter = new BaseFilter(entity.ORG_ID);
|
||||
filter.Include = new string[] { "Nav_Person" };
|
||||
var allUsers = this.GetEntities<T_FM_USER>(t => !t.CODE.Contains("admin") && t.DEPARTMENT_ID.HasValue && !t.PROJECT_ID.HasValue && t.ENABLE_STATUS == (int)FMEnableStatusEnum.启用 && allUsersIds.Contains(t.ID), filter);
|
||||
@ -230,11 +241,13 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
if (Nav_Files != null && Nav_Files.Any())
|
||||
BantchSaveEntityNoCommit(Nav_Files);
|
||||
if (Nav_Papers != null && Nav_Papers.Any())
|
||||
BantchAddEntityNoCommit(Nav_Papers);
|
||||
BantchSaveEntityNoCommit(Nav_Papers);
|
||||
if (noticeTask != null && noticeTask.Any())
|
||||
BantchAddEntityNoCommit(noticeTask);
|
||||
BantchSaveEntityNoCommit(noticeTask);
|
||||
if (finishNotice != null)
|
||||
UpdateEntityNoCommit(finishNotice);
|
||||
if (listUsers != null && listUsers.Any())
|
||||
BantchSaveEntityNoCommit(listUsers);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
@ -745,5 +758,74 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
public string TYPE { get; set; }
|
||||
public List<List<string>> ROWS { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门和是否向下包含 获取人员信息
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("GetListDemand")]
|
||||
public JsonActionResult<List<T_SE_SAFE_SURVEY_USER>> GetListDemand([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
List<T_SE_SAFE_SURVEY_USER> result = new List<T_SE_SAFE_SURVEY_USER>();
|
||||
if (string.IsNullOrEmpty(filter.Keyword))
|
||||
return result;
|
||||
bool IS_DOWN = false;
|
||||
Guid SURVEY_ID = Guid.Empty;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1))
|
||||
{
|
||||
IS_DOWN = Convert.ToBoolean(filter.Parameter1);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
SURVEY_ID = new Guid(filter.Parameter2);
|
||||
}
|
||||
catch { }
|
||||
|
||||
List<Guid> listDetID = new List<Guid>();
|
||||
List<Guid> listDetIDT = new List<Guid>();
|
||||
try
|
||||
{
|
||||
List<string> listStrDep = filter.Keyword.Split('|', StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
foreach (var item in listStrDep)
|
||||
{
|
||||
listDetIDT.Add(new Guid(item));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (IS_DOWN)
|
||||
GetDepartmentIds(listDetIDT, filter.OrgId, ref listDetID); //包含下属组织
|
||||
else
|
||||
listDetID = listDetIDT;
|
||||
|
||||
listDetID = listDetID.Distinct().ToList();
|
||||
var listUser = GetEntities<T_FM_USER>(e => e.ENABLE_STATUS == 0 && e.Nav_Department.ENABLE_STATUS == 0 && !e.CODE.Contains("admin") && e.DEPARTMENT_ID.HasValue && !e.PROJECT_ID.HasValue && listDetID.Contains(e.DEPARTMENT_ID.Value), null, "Nav_Department").OrderBy(e => e.NUM).ThenBy(e => e.Nav_Department.NUM).ThenBy(e => e.NAME).ToList();
|
||||
if (listUser != null && listUser.Any())
|
||||
{
|
||||
foreach (var item in listUser)
|
||||
{
|
||||
result.Add(new T_SE_SAFE_SURVEY_USER()
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = item.ORG_ID,
|
||||
SURVEY_ID = SURVEY_ID,
|
||||
USER_ID = item.ID,
|
||||
DEPARTMENT_ID = item.DEPARTMENT_ID.Value,
|
||||
Nav_Department = item.Nav_Department,
|
||||
Nav_User = item,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("FullUpdate")]
|
||||
public JsonActionResult<bool> FullUpdate([FromBody] T_SE_TRAIN_SURVEY entity)
|
||||
@ -33,7 +33,8 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
var userID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||||
if (entity.TaskID != null && entity.TaskID != Guid.Empty)
|
||||
var Demands = entity.Nav_Demands;
|
||||
if (entity.TaskID != Guid.Empty)
|
||||
{
|
||||
var currTask = GetEntity<T_FM_NOTIFICATION_TASK>(t => t.ID == entity.TaskID);
|
||||
if (currTask != null)
|
||||
@ -57,6 +58,10 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
throw new Exception("截止时间至少比发起时间要大于一天");
|
||||
}
|
||||
if (Demands == null || !Demands.Any() || Demands.Count() < 1)
|
||||
{
|
||||
throw new Exception("请添加培训人员信息!");
|
||||
}
|
||||
if (entity.LAUNCH_USER_ID == Guid.Empty)
|
||||
{
|
||||
entity.LAUNCH_USER_ID = (Guid)userID;
|
||||
@ -82,40 +87,58 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
{
|
||||
Nav_Demands = new List<T_SE_TRAIN_SURVEY_LIST_DEMAND>();
|
||||
entity.STATUS = SETrainSurveyStatus.调查中;
|
||||
var allSendUserIds = GetDepartmentUsers(Nav_JoinDepartment.Where(t => t.IS_DELETED == false).Select(t => t.DEPARTMENT_ID).ToList(), entity.ORG_ID);
|
||||
var currDep = GetEntity<T_FM_DEPARTMENT>(t => t.ID == entity.LAUNCH_DEPARTMENT_ID);
|
||||
if (currDep != null && (currDep.NAME == "安全环保管理部" || currDep.NAME == "安全环保科" || currDep.NAME == "安全环保部" || currDep.NAME == "安环部"))
|
||||
{
|
||||
var manageUsers = GetEntities<T_FM_USER>(t => t.Nav_Department.DEPARTMENT_TYPE == 5 && t.ENABLE_STATUS == 0 && !t.CODE.Contains("admin"), new BaseFilter(entity.ORG_ID)).Select(t => t.ID);
|
||||
allSendUserIds.AddRange(manageUsers);
|
||||
}
|
||||
var allUsers = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == (int)FMEnableStatusEnum.启用 && allSendUserIds.Contains(t.ID) && !t.CODE.Contains("admin"), new BaseFilter(entity.ORG_ID));
|
||||
var allUserDepIds = new List<Guid?>();
|
||||
var listUserID = Demands.Where(e => e.USER_ID.HasValue).Select(e => e.USER_ID.Value);
|
||||
var listUser = GetEntities<T_FM_USER>(e => listUserID.Contains(e.ID), null, null);
|
||||
var allSendUserNames = new List<string>();
|
||||
var allSendUserIds = new List<Guid>();
|
||||
var allSendDataIds = new List<Guid>();
|
||||
var allSendTitles = new List<string>();
|
||||
|
||||
foreach (var user in allSendUserIds)
|
||||
T_FM_USER modelUs = null;
|
||||
foreach (var item in Demands)
|
||||
{
|
||||
var current = allUsers.FirstOrDefault(t => t.ID == user);
|
||||
allUserDepIds.Add(current?.DEPARTMENT_ID);
|
||||
allSendUserNames.Add(current?.NAME);
|
||||
}
|
||||
for (int i = 0; i < allSendUserIds.Count; i++)
|
||||
{
|
||||
var newId = Guid.NewGuid();
|
||||
Nav_Demands.Add(new T_SE_TRAIN_SURVEY_LIST_DEMAND
|
||||
{
|
||||
ID = newId,
|
||||
SURVEY_ID = entity.ID,
|
||||
USER_ID = allSendUserIds[i],
|
||||
DEPARTMENT_ID = allUserDepIds[i],
|
||||
OK = 0,
|
||||
ORG_ID = entity.ORG_ID,
|
||||
});
|
||||
allSendDataIds.Add(newId);
|
||||
modelUs = listUser.FirstOrDefault(e => e.ID == item.USER_ID);
|
||||
allSendUserNames.Add(modelUs != null ? modelUs.NAME : "");
|
||||
allSendUserIds.Add(item.USER_ID.Value);
|
||||
allSendDataIds.Add(item.ID);
|
||||
allSendTitles.Add("培训需求调查填报");
|
||||
}
|
||||
|
||||
#region 前端已加载
|
||||
|
||||
//var allSendUserIds = GetDepartmentUsers(Nav_JoinDepartment.Where(t => t.IS_DELETED == false).Select(t => t.DEPARTMENT_ID).ToList(), entity.ORG_ID);
|
||||
//var currDep = GetEntity<T_FM_DEPARTMENT>(t => t.ID == entity.LAUNCH_DEPARTMENT_ID);
|
||||
//if (currDep != null && (currDep.NAME == "安全环保管理部" || currDep.NAME == "安全环保科" || currDep.NAME == "安全环保部" || currDep.NAME == "安环部"))
|
||||
//{
|
||||
// var manageUsers = GetEntities<T_FM_USER>(t => t.Nav_Department.DEPARTMENT_TYPE == 5 && t.ENABLE_STATUS == 0 && !t.CODE.Contains("admin"), new BaseFilter(entity.ORG_ID)).Select(t => t.ID);
|
||||
// allSendUserIds.AddRange(manageUsers);
|
||||
//}
|
||||
//var allUsers = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == (int)FMEnableStatusEnum.启用 && allSendUserIds.Contains(t.ID) && !t.CODE.Contains("admin"), new BaseFilter(entity.ORG_ID));
|
||||
//var allUserDepIds = new List<Guid?>();
|
||||
//foreach (var user in allSendUserIds)
|
||||
//{
|
||||
// var current = allUsers.FirstOrDefault(t => t.ID == user);
|
||||
// allUserDepIds.Add(current?.DEPARTMENT_ID);
|
||||
// allSendUserNames.Add(current?.NAME);
|
||||
//}
|
||||
//for (int i = 0; i < allSendUserIds.Count; i++)
|
||||
//{
|
||||
// var newId = Guid.NewGuid();
|
||||
// Nav_Demands.Add(new T_SE_TRAIN_SURVEY_LIST_DEMAND
|
||||
// {
|
||||
// ID = newId,
|
||||
// SURVEY_ID = entity.ID,
|
||||
// USER_ID = allSendUserIds[i],
|
||||
// DEPARTMENT_ID = allUserDepIds[i],
|
||||
// OK = 0,
|
||||
// ORG_ID = entity.ORG_ID,
|
||||
// });
|
||||
// allSendDataIds.Add(newId);
|
||||
// allSendTitles.Add("培训需求调查填报");
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
noticeTask = NotificationTaskService.InsertUserNoticeTaskModels(allSendTitles, allSendDataIds, entity.ORG_ID, allSendUserIds, allSendUserNames, DateTime.Now, entity.END_TIME.Value, (int)FMNoticeTypeEnum.消息, "SE007_INPUTPAGE");
|
||||
}
|
||||
Nav_JoinDepartment.ForEach(p =>
|
||||
@ -145,6 +168,8 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
BantchAddEntityNoCommit(noticeTask);
|
||||
if (finishNotice != null)
|
||||
UpdateEntityNoCommit(finishNotice);
|
||||
if (Demands != null && Demands.Any())
|
||||
BantchAddEntityNoCommit(Demands);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
@ -264,7 +289,7 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
UpdateEntityNoCommit(finishNotice);
|
||||
if (sendNotices != null)
|
||||
UpdateEntityNoCommit(sendNotices);
|
||||
if (survry!=null&& survry.STATUS == SETrainSurveyStatus.汇总中)
|
||||
if (survry != null && survry.STATUS == SETrainSurveyStatus.汇总中)
|
||||
UpdateEntityNoCommit(survry);
|
||||
});
|
||||
return true;
|
||||
@ -339,5 +364,75 @@ namespace APT.SC.WebApi.Controllers.Api.SE
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门和是否向下包含 获取人员信息
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("GetListDemand")]
|
||||
public JsonActionResult<List<T_SE_TRAIN_SURVEY_LIST_DEMAND>> GetListDemand([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
List<T_SE_TRAIN_SURVEY_LIST_DEMAND> result = new List<T_SE_TRAIN_SURVEY_LIST_DEMAND>();
|
||||
if (string.IsNullOrEmpty(filter.Keyword))
|
||||
return result;
|
||||
bool IS_DOWN = false;
|
||||
Guid SURVEY_ID = Guid.Empty;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1))
|
||||
{
|
||||
IS_DOWN = Convert.ToBoolean(filter.Parameter1);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
SURVEY_ID = new Guid(filter.Parameter2);
|
||||
}
|
||||
catch { }
|
||||
|
||||
List<Guid> listDetID = new List<Guid>();
|
||||
List<Guid> listDetIDT = new List<Guid>();
|
||||
try
|
||||
{
|
||||
List<string> listStrDep = filter.Keyword.Split('|', StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
foreach (var item in listStrDep)
|
||||
{
|
||||
listDetIDT.Add(new Guid(item));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (IS_DOWN)
|
||||
GetDepartmentIds(listDetIDT, filter.OrgId, ref listDetID); //包含下属组织
|
||||
else
|
||||
listDetID = listDetIDT;
|
||||
|
||||
listDetID = listDetID.Distinct().ToList();
|
||||
var listUser = GetEntities<T_FM_USER>(e => e.ENABLE_STATUS == 0 && e.Nav_Department.ENABLE_STATUS == 0 && !e.CODE.Contains("admin") && e.DEPARTMENT_ID.HasValue && !e.PROJECT_ID.HasValue && listDetID.Contains(e.DEPARTMENT_ID.Value), null, "Nav_Department").OrderBy(e => e.NUM).ThenBy(e => e.Nav_Department.NUM).ThenBy(e => e.NAME).ToList();
|
||||
if (listUser != null && listUser.Any())
|
||||
{
|
||||
foreach (var item in listUser)
|
||||
{
|
||||
result.Add(new T_SE_TRAIN_SURVEY_LIST_DEMAND()
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = item.ORG_ID,
|
||||
SURVEY_ID = SURVEY_ID,
|
||||
USER_ID = item.ID,
|
||||
DEPARTMENT_ID = item.DEPARTMENT_ID,
|
||||
Nav_Department = item.Nav_Department,
|
||||
Nav_User = item,
|
||||
OK = 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55506,6 +55506,111 @@ using APT.MS.Domain.Entities.HM;
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region SafeSurveyUser-安全意识调查人员
|
||||
/// <summary>
|
||||
/// 安全意识调查人员
|
||||
/// </summary>
|
||||
[Route("api/SE/SafeSurveyUser")]
|
||||
public partial class SafeSurveyUserController : AuthorizeApiController<T_SE_SAFE_SURVEY_USER>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_SE_SAFE_SURVEY_USER>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_SE_SAFE_SURVEY_USER>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_SE_SAFE_SURVEY_USER> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_SE_SAFE_SURVEY_USER> OrderPaged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitOrderPaged(null, pageFilter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据主键删除数据
|
||||
/// </summary>
|
||||
/// <param name="id">主键ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("Delete")]
|
||||
public JsonActionResult<bool> Delete(string id)
|
||||
{
|
||||
return WitRealDelete(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新或新增数据
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Update")]
|
||||
public JsonActionResult<bool> Update([FromBody]T_SE_SAFE_SURVEY_USER entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_SE_SAFE_SURVEY_USER> entity)
|
||||
{
|
||||
return WitBantchUpdate(entity?.Data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除数据
|
||||
/// </summary>
|
||||
/// <param name="ids">id字符串(id用逗号分隔)</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("BatchDelete")]
|
||||
public JsonActionResult<bool> BatchDelete(string ids)
|
||||
{
|
||||
return WitRealBatchDelete(ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得单条实体数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Get")]
|
||||
public JsonActionResult<T_SE_SAFE_SURVEY_USER> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Test-题库
|
||||
|
||||
Loading…
Reference in New Issue
Block a user