1、所有总、子公司数据库链接存入Redis,提供基础方法获取链接
2、审批角色 添加 是否总部【ISHEAD】属性 ,总部会同步到子公司,子公司不能修改总部传入的数据 3、审批明细 添加【ISHEAD】属性 ,功能暂未处理 4、首页获取待办修改 使不过滤ORGID 5、用户添加时,如果是总公司 同步到子公司,同步修改了一些bug 6、审批页面数据获取方法【FullGet】提供修改前提 后续功能待完善 7、HeadHelper.GetIsHead 判断是否总部 ["Tenant"]"0003"
This commit is contained in:
parent
6eb9727f51
commit
364c3dd77f
@ -300,5 +300,10 @@
|
||||
/// 首页 BI/BIStatiscialAnalysisController/GetJobCompletionSort Key
|
||||
/// </summary>
|
||||
public const string HomeJobCompletion = "HomeJobCompletion_{0}";
|
||||
|
||||
/// <summary>
|
||||
/// 所有数据库链接
|
||||
/// </summary>
|
||||
public const string ConnAll = "OPConn";
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,5 +51,14 @@ namespace APT.MS.Domain.Entities.PF
|
||||
public Guid? ROLE_ID { get; set; }
|
||||
[Description("导航属性:审批角色")]
|
||||
public virtual T_FM_ROLE Nav_Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否总部
|
||||
/// </summary>
|
||||
[Description("是否总部")]
|
||||
[FormFieldTable]
|
||||
[FormFieldQuery]
|
||||
[FormFieldEdit]
|
||||
public bool ISHEAD { get; set; }=false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,5 +76,14 @@ namespace APT.BaseData.Domain.Entities
|
||||
/// </summary>
|
||||
[Description("是否取消")]
|
||||
public bool ISCANCEL { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否总部
|
||||
/// </summary>
|
||||
[Description("是否总部")]
|
||||
[FormFieldTable]
|
||||
[FormFieldQuery]
|
||||
[FormFieldEdit]
|
||||
public bool ISHEAD { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
using APT.BaseData.Domain.Entities.FM;
|
||||
using APT.BaseData.Domain.ApiModel.Platform;
|
||||
using APT.BaseData.Domain.Entities.FM;
|
||||
using APT.BaseData.Domain.Entities.OP;
|
||||
using APT.BaseData.Domain.Enums.OP;
|
||||
using APT.BaseData.Domain.IServices.OP;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.Infrastructure.Api.Redis;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.Migrations;
|
||||
using Newtonsoft.Json;
|
||||
@ -23,40 +25,76 @@ namespace APT.BaseData.Services.Services.OP
|
||||
/// <summary>
|
||||
/// 获取 除 ORG_IDBeside 之外对应的数据库链接字典 ORG_ID DB_CONN
|
||||
/// </summary>
|
||||
/// <param name="ORG_IDBeside"></param>
|
||||
/// <param name="ORG_IDBeside">过滤值 没有就不过滤</param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<Guid, string> GetConnDictionary(Guid? ORG_IDBeside)
|
||||
{
|
||||
Dictionary<Guid, string> dicORGCONN = new Dictionary<Guid, string>();
|
||||
string conn = string.Empty;
|
||||
IEnumerable<T_OP_TENANT> listTent = null;
|
||||
using (var context = new MigrationContext())
|
||||
{
|
||||
Expression<Func<T_OP_TENANT, bool>> expression = e => e.DB_CONN_ID.HasValue;
|
||||
if (ORG_IDBeside.HasValue)
|
||||
{
|
||||
expression = expression.And(e => e.ID != ORG_IDBeside);
|
||||
}
|
||||
//从Redis中获取所有数据库链接值
|
||||
|
||||
listTent = context.GetEntities(expression, null, null);
|
||||
List<Guid> listConnID = listTent.Select(e => e.DB_CONN_ID.Value).ToList();
|
||||
var listDbConn = context.GetEntities<T_OP_TENANT_DB_CONN>(e => listConnID.Contains(e.ID), null, null);
|
||||
if (listDbConn != null && listDbConn.Count() > 0)
|
||||
bool isRedisConfig = true;
|
||||
var redisConfig = APT.Infrastructure.Api.ConfigurationManager.AppSettings["RedisFormConfig"];
|
||||
if (!string.IsNullOrEmpty(redisConfig))
|
||||
isRedisConfig = bool.Parse(redisConfig);
|
||||
if (isRedisConfig)
|
||||
{
|
||||
if (CsRedisManager.KeyExists(RedisCacheKey.ConnAll))
|
||||
dicORGCONN = CsRedisManager.StringGet<Dictionary<Guid, string>>(RedisCacheKey.ConnAll);
|
||||
}
|
||||
#region Redis没找到 去数据库查找
|
||||
|
||||
if (dicORGCONN == null || dicORGCONN.Count < 1)
|
||||
{
|
||||
string conn = string.Empty;
|
||||
IEnumerable<T_OP_TENANT> listTent = null;
|
||||
using (var context = new MigrationContext())
|
||||
{
|
||||
var env = ConfigurationManager.AppSettings["Env"];
|
||||
foreach (var item in listDbConn)
|
||||
Expression<Func<T_OP_TENANT, bool>> expression = e => e.DB_CONN_ID.HasValue;
|
||||
listTent = context.GetEntities(expression, null, null);
|
||||
List<Guid> listConnID = listTent.Select(e => e.DB_CONN_ID.Value).ToList();
|
||||
var listDbConn = context.GetEntities<T_OP_TENANT_DB_CONN>(e => listConnID.Contains(e.ID), null, null);
|
||||
if (listDbConn != null && listDbConn.Count() > 0)
|
||||
{
|
||||
conn = item.DB_CONN;
|
||||
if (env == ((int)EnvType.外网).ToString())
|
||||
var env = ConfigurationManager.AppSettings["Env"];
|
||||
foreach (var item in listDbConn)
|
||||
{
|
||||
conn = item.DB_CONN_WAN;
|
||||
conn = item.DB_CONN;
|
||||
if (env == ((int)EnvType.外网).ToString())
|
||||
{
|
||||
conn = item.DB_CONN_WAN;
|
||||
}
|
||||
if (!dicORGCONN.ContainsKey(item.ID))
|
||||
{
|
||||
dicORGCONN.Add(listTent.First(e => e.DB_CONN_ID == item.ID).ID, conn);
|
||||
}
|
||||
}
|
||||
if (!dicORGCONN.ContainsKey(item.ID))
|
||||
if (isRedisConfig && dicORGCONN.Count > 0)
|
||||
{
|
||||
dicORGCONN.Add(listTent.First(e => e.DB_CONN_ID == item.ID).ID, conn);
|
||||
try
|
||||
{
|
||||
CsRedisManager.StringSet<Dictionary<Guid, string>>(RedisCacheKey.ConnAll, dicORGCONN);//所有数据库链接 存入 Redis
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if (dicORGCONN != null && dicORGCONN.Count > 0)
|
||||
{
|
||||
if (ORG_IDBeside.HasValue)
|
||||
{
|
||||
Dictionary<Guid, string> dicORGCONN1 = new Dictionary<Guid, string>();
|
||||
foreach (var item in dicORGCONN)
|
||||
{
|
||||
if (item.Key == ORG_IDBeside.Value)
|
||||
continue;
|
||||
|
||||
dicORGCONN1.Add(item.Key, item.Value);
|
||||
}
|
||||
dicORGCONN = dicORGCONN1;
|
||||
}
|
||||
}
|
||||
return dicORGCONN;
|
||||
}
|
||||
|
||||
129162
APT.Data.Migrations/Migrations/20251021094627_wyw2025102101.Designer.cs
generated
Normal file
129162
APT.Data.Migrations/Migrations/20251021094627_wyw2025102101.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace APT.Data.Migrations.Migrations
|
||||
{
|
||||
public partial class wyw2025102101 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "ISHEAD",
|
||||
table: "T_PF_APPROVAL_ROLE",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ISHEAD",
|
||||
table: "T_PF_APPROVAL_ROLE");
|
||||
}
|
||||
}
|
||||
}
|
||||
129165
APT.Data.Migrations/Migrations/20251022074708_wyw2025102201.Designer.cs
generated
Normal file
129165
APT.Data.Migrations/Migrations/20251022074708_wyw2025102201.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace APT.Data.Migrations.Migrations
|
||||
{
|
||||
public partial class wyw2025102201 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "ISHEAD",
|
||||
table: "T_PF_APPROVE_DETAIL",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ISHEAD",
|
||||
table: "T_PF_APPROVE_DETAIL");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11691,6 +11691,9 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Property<bool>("ISCANCEL")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("ISHEAD")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IS_ALLOW_UPDATE")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@ -53823,6 +53826,9 @@ namespace APT.Data.Migrations.Migrations
|
||||
b.Property<Guid?>("FORM_ID")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("ISHEAD")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IS_DELETED")
|
||||
.HasColumnType("bit");
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,12 @@
|
||||
using APT.BaseData.Domain.IServices.BS;
|
||||
using APT.BaseData.Domain.IServices.EX;
|
||||
using APT.BaseData.Domain.IServices.FM;
|
||||
using APT.BaseData.Domain.IServices.OP;
|
||||
using APT.BaseData.Domain.IServices.Platform;
|
||||
using APT.BaseData.Services.DomainServices;
|
||||
using APT.BaseData.Services.Services.EX;
|
||||
using APT.BaseData.Services.Services.FM;
|
||||
using APT.BaseData.Services.Services.OP;
|
||||
using APT.BaseData.Services.Services.Platform;
|
||||
using APT.BaseData.Services.Sys;
|
||||
using Autofac;
|
||||
@ -53,6 +55,7 @@ namespace APT.FM.WebApi.App_Start
|
||||
builder.RegisterType<PFApproveCallBackSEService>().As<IPFApproveCallBackSEService>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<FMNotificationTaskService>().As<IFMNotificationTaskService>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<PFApproveCallBackService>().As<IPFApproveCallBackService>().InstancePerLifetimeScope();
|
||||
builder.RegisterType<OPTenantDBConnService>().As<IOPTenantDBConnService>().InstancePerLifetimeScope();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,10 @@ namespace APT.FM.WebApi.Controllers.Api
|
||||
order2.Field = "TASK_STARTDT";
|
||||
order2.Order = DbOrder.DESC;
|
||||
pageFilter.Orders.Add(order2);
|
||||
pageFilter.OrgId = null;
|
||||
pageFilter.IgnoreOrgRule = true;
|
||||
var bear = new BaseFilter();
|
||||
bear.IgnoreOrgRule = true;
|
||||
var todoCount = GetCount<T_FM_NOTIFICATION_TASK>(s => s.USER_ID == userId && s.NOTICE_STATUS == 0 && s.NOTICE_TYPE != 2 && s.NOTICE_TYPE != 7 && s.TASK_ENDDT >= DateTime.Now.AddMonths(-3), bear);
|
||||
var todayNewCount = GetCount<T_FM_NOTIFICATION_TASK>(s => s.USER_ID == userId && s.NOTICE_STATUS == 0 && (s.NOTICE_TYPE == 2 || s.NOTICE_TYPE == 7), bear);//&& s.TASK_STARTDT > shortToday
|
||||
var doneCount = GetCount<T_FM_NOTIFICATION_TASK>(s => s.USER_ID == userId && (s.NOTICE_STATUS == 1 || s.NOTICE_STATUS == 2) && s.NOTICE_TYPE != 2 && s.NOTICE_TYPE != 7, bear);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,7 @@ using System.Security.Cryptography;
|
||||
using APT.MS.Domain.Entities.SC.PT;
|
||||
using Microsoft.Extensions.DependencyModel;
|
||||
using APT.MS.Domain.Entities.SK;
|
||||
using APT.BaseData.Domain.IServices.OP;
|
||||
|
||||
namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
{
|
||||
@ -47,15 +48,18 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
IFMUserService UserService { get; set; }
|
||||
IFMDepartmentService DepartmentService { get; set; }
|
||||
IFMNotificationTaskService NotificationTaskService { get; set; }
|
||||
IOPTenantDBConnService OPTenantDBConnService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="personnelService"></param>
|
||||
public UserController(IFMUserService personnelService, IFMDepartmentService departmentService, IFMNotificationTaskService notificationTaskService)
|
||||
public UserController(IFMUserService personnelService, IFMDepartmentService departmentService, IFMNotificationTaskService notificationTaskService, IOPTenantDBConnService opTenantDBConnService)
|
||||
{
|
||||
UserService = personnelService;
|
||||
DepartmentService = departmentService;
|
||||
NotificationTaskService = notificationTaskService;
|
||||
OPTenantDBConnService = opTenantDBConnService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -483,110 +487,125 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
T_OG_SAFE_PDT_SIGNED_POST signPost = null;
|
||||
T_PT_ASSESSMENT_PLAN_AUDIT_TEMP_DETAIL library = null;
|
||||
T_FM_NOTIFICATION_TASK noticeToday = null;
|
||||
if (string.IsNullOrEmpty(entity.CODE))
|
||||
{
|
||||
throw new Exception("工号不允许为空!");
|
||||
}
|
||||
if (entity.CODE.Length <= 3)
|
||||
this.ThrowError("050003");
|
||||
if (string.IsNullOrEmpty(entity.NAME))
|
||||
{
|
||||
throw new Exception("姓名不允许为空!");
|
||||
}
|
||||
if (entity.Nav_Person.POST_ID == null)
|
||||
{
|
||||
throw new Exception("岗位不允许为空!");
|
||||
}
|
||||
|
||||
if (!isAdd.Any())
|
||||
{
|
||||
if (entity.CODE.Length <= 3)
|
||||
this.ThrowError("050003");
|
||||
userList = this.GetEntities<T_FM_USER>(t => (t.CODE == entity.CODE || t.APPROVE_ROLE_ID == entity.APPROVE_ROLE_ID) && t.ORG_ID == entity.ORG_ID, null, "Nav_Department").ToList();
|
||||
var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
|
||||
if (isRepeat != null)
|
||||
this.ThrowError("050001");
|
||||
if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa"))
|
||||
{
|
||||
#region 新增人员增加三级安全教育
|
||||
eduCard = new T_SE_THREE_LEVEL_SAFE_EDU_CARD();
|
||||
eduCard.ID = Guid.NewGuid();
|
||||
eduCard.ID_CARD_NUMBER = entity.ID_CARD;
|
||||
eduCard.IN_TIME = entity.ENTRYTIME;
|
||||
eduCard.USER_ID = entity.ID;
|
||||
eduCard.DEPARTMENT_ID = entity.DEPARTMENT_ID;
|
||||
eduCard.LAUNCH_TIME = DateTime.Now;
|
||||
eduCard.ORG_ID = entity.ORG_ID;
|
||||
eduCard.POST_ID = entity.Nav_Person.POST_ID;
|
||||
eduCard.STATUS = SEThreeLevelSafeTrainStatus.公司培训;
|
||||
eduCard.LAUNCH_USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||||
eduCard.LAUNCH_DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
|
||||
next_train_record = new T_SE_THREE_LEVEL_SAFE_TRAIN_RECORD
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
EDU_CARD_ID = eduCard.ID,
|
||||
ORG_ID = eduCard.ORG_ID,
|
||||
THREE_LEVEL_SAFE_TRAIN_TYPE = SEThreeLevelSafeTrainType.公司级
|
||||
};
|
||||
var train_contents = GetEntity<T_SE_THREE_LEVEL_SAFE_CONTENT>(t => t.THREE_LEVEL_SAFE_TRAIN_TYPE == (SEThreeLevelSafeTrainType)eduCard.STATUS.GetInt());
|
||||
next_train_record.CONTENT_ID = train_contents.ID;
|
||||
var postName = GetEntity<T_FM_USER_POST>(eduCard.POST_ID ?? Guid.Empty)?.NAME;
|
||||
var sendUser = GetEntity<T_FM_USER>(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME == "安环部安全员" && t.IS_DELETED == false && t.ENABLE_STATUS == 0);
|
||||
if (sendUser != null)
|
||||
{
|
||||
var endTime = entity.ENTRYTIME.AddMonths(1);
|
||||
var newEndTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59);
|
||||
sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel("三级安全培训记录-" + entity.NAME + "-" + eduCard.STATUS.GetDescription(), next_train_record.ID, entity.ORG_ID, sendUser.ID, sendUser.NAME, DateTime.Now, newEndTime, 1, "SE042"));
|
||||
}
|
||||
#region //
|
||||
#region //新增人员增加三级安全教育
|
||||
//eduCard = new T_SE_THREE_LEVEL_SAFE_EDU_CARD();
|
||||
//eduCard.ID = Guid.NewGuid();
|
||||
//eduCard.ID_CARD_NUMBER = entity.ID_CARD;
|
||||
//eduCard.IN_TIME = entity.ENTRYTIME;
|
||||
//eduCard.USER_ID = entity.ID;
|
||||
//eduCard.DEPARTMENT_ID = entity.DEPARTMENT_ID;
|
||||
//eduCard.LAUNCH_TIME = DateTime.Now;
|
||||
//eduCard.ORG_ID = entity.ORG_ID;
|
||||
//eduCard.POST_ID = entity.Nav_Person.POST_ID;
|
||||
//eduCard.STATUS = SEThreeLevelSafeTrainStatus.公司培训;
|
||||
//eduCard.LAUNCH_USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||||
//eduCard.LAUNCH_DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
|
||||
//next_train_record = new T_SE_THREE_LEVEL_SAFE_TRAIN_RECORD
|
||||
//{
|
||||
// ID = Guid.NewGuid(),
|
||||
// EDU_CARD_ID = eduCard.ID,
|
||||
// ORG_ID = eduCard.ORG_ID,
|
||||
// THREE_LEVEL_SAFE_TRAIN_TYPE = SEThreeLevelSafeTrainType.公司级
|
||||
//};
|
||||
//var train_contents = GetEntity<T_SE_THREE_LEVEL_SAFE_CONTENT>(t => t.THREE_LEVEL_SAFE_TRAIN_TYPE == (SEThreeLevelSafeTrainType)eduCard.STATUS.GetInt());
|
||||
//next_train_record.CONTENT_ID = train_contents.ID;
|
||||
//var postName = GetEntity<T_FM_USER_POST>(eduCard.POST_ID ?? Guid.Empty)?.NAME;
|
||||
//var sendUser = GetEntity<T_FM_USER>(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME == "安环部安全员" && t.IS_DELETED == false && t.ENABLE_STATUS == 0);
|
||||
//if (sendUser != null)
|
||||
//{
|
||||
// var endTime = entity.ENTRYTIME.AddMonths(1);
|
||||
// var newEndTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59);
|
||||
// sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel("三级安全培训记录-" + entity.NAME + "-" + eduCard.STATUS.GetDescription(), next_train_record.ID, entity.ORG_ID, sendUser.ID, sendUser.NAME, DateTime.Now, newEndTime, 1, "SE042"));
|
||||
//}
|
||||
#endregion
|
||||
#region 新增人员触发安全生产责任制
|
||||
var post = GetEntity<T_SC_DEPARTMENT_POST>(t => t.Nav_Dept.DEPARTMENT_ID == entity.DEPARTMENT_ID && t.DEPOST_ID == entity.Nav_Person.POST_ID, new string[] { "Nav_Dept.Nav_Post" });
|
||||
if (post != null)
|
||||
{
|
||||
var standardCreate = GetEntity<T_SC_STANDARD_CREATE>(t => t.POST_ID == post.Nav_Dept.POST_ID && t.STATUS == SCSystemEditStatus.已归档 && t.FILE_STATUS == SCSystemFileStatus.有效);
|
||||
if (standardCreate != null)
|
||||
{
|
||||
var chargeUser = GetEntity<T_FM_USER>(t => t.DEPARTMENT_ID == post.Nav_Dept.Nav_Post.DEPARTMENT_ID && t.Nav_Person.POST_ID == post.Nav_Dept.Nav_Post.DEPOST_ID && t.ENABLE_STATUS == 0);
|
||||
if (chargeUser != null)
|
||||
{
|
||||
signRecord = new T_OG_SAFE_PDT_SIGNED
|
||||
{
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = entity.ORG_ID,
|
||||
STATUS = (int)PFStandardStatus.Draft,
|
||||
TRIGGER_TYPE = OGPersonalSignedTriggerType.新员工触发,
|
||||
//TRIGGER_TYPE = OGPersonalSignedTriggerType.手动新增,
|
||||
STANDARD_ID = standardCreate.ID,
|
||||
FILE_CONTENT = standardCreate.FILE_CONTENT,
|
||||
DEPARTMENT_ID = entity.DEPARTMENT_ID,
|
||||
ANNUAL = DateTime.Now.Year
|
||||
};
|
||||
if (chargeUser != null)
|
||||
{
|
||||
signRecord.CHARGE_USER_ID = chargeUser.ID;
|
||||
}
|
||||
signPost = new T_OG_SAFE_PDT_SIGNED_POST
|
||||
{
|
||||
SAFE_PDT_SIGNED_ID = signRecord.ID,
|
||||
ID = Guid.NewGuid(),
|
||||
ORG_ID = entity.ORG_ID,
|
||||
USER_ID = entity.ID,
|
||||
POST_ID = entity.Nav_Person.POST_ID,
|
||||
CHARGE_USER_ID = signRecord.CHARGE_USER_ID
|
||||
};
|
||||
sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel(DateTime.Now.ToShortDateString() + "安全生产责任制个人签订表", signRecord.ID, entity.ORG_ID, entity.ID, entity.NAME, DateTime.Now, DateTime.Now.AddDays(7), 1, "OG001_SHOWPRINT"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sendUser != null)
|
||||
{
|
||||
sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel("请为《" + postName + "》绑定责任制岗位并上传责任状", entity.ID, entity.ORG_ID, sendUser.ID, sendUser.NAME, DateTime.Now, DateTime.Now.AddDays(7), (int)FMNoticeTypeEnum.今日提醒, "PF135"));
|
||||
}
|
||||
}
|
||||
#region //新增人员触发安全生产责任制
|
||||
//var post = GetEntity<T_SC_DEPARTMENT_POST>(t => t.Nav_Dept.DEPARTMENT_ID == entity.DEPARTMENT_ID && t.DEPOST_ID == entity.Nav_Person.POST_ID, new string[] { "Nav_Dept.Nav_Post" });
|
||||
//if (post != null)
|
||||
//{
|
||||
// var standardCreate = GetEntity<T_SC_STANDARD_CREATE>(t => t.POST_ID == post.Nav_Dept.POST_ID && t.STATUS == SCSystemEditStatus.已归档 && t.FILE_STATUS == SCSystemFileStatus.有效);
|
||||
// if (standardCreate != null)
|
||||
// {
|
||||
// var chargeUser = GetEntity<T_FM_USER>(t => t.DEPARTMENT_ID == post.Nav_Dept.Nav_Post.DEPARTMENT_ID && t.Nav_Person.POST_ID == post.Nav_Dept.Nav_Post.DEPOST_ID && t.ENABLE_STATUS == 0);
|
||||
// if (chargeUser != null)
|
||||
// {
|
||||
// signRecord = new T_OG_SAFE_PDT_SIGNED
|
||||
// {
|
||||
// ID = Guid.NewGuid(),
|
||||
// ORG_ID = entity.ORG_ID,
|
||||
// STATUS = (int)PFStandardStatus.Draft,
|
||||
// TRIGGER_TYPE = OGPersonalSignedTriggerType.新员工触发,
|
||||
// //TRIGGER_TYPE = OGPersonalSignedTriggerType.手动新增,
|
||||
// STANDARD_ID = standardCreate.ID,
|
||||
// FILE_CONTENT = standardCreate.FILE_CONTENT,
|
||||
// DEPARTMENT_ID = entity.DEPARTMENT_ID,
|
||||
// ANNUAL = DateTime.Now.Year
|
||||
// };
|
||||
// if (chargeUser != null)
|
||||
// {
|
||||
// signRecord.CHARGE_USER_ID = chargeUser.ID;
|
||||
// }
|
||||
// signPost = new T_OG_SAFE_PDT_SIGNED_POST
|
||||
// {
|
||||
// SAFE_PDT_SIGNED_ID = signRecord.ID,
|
||||
// ID = Guid.NewGuid(),
|
||||
// ORG_ID = entity.ORG_ID,
|
||||
// USER_ID = entity.ID,
|
||||
// POST_ID = entity.Nav_Person.POST_ID,
|
||||
// CHARGE_USER_ID = signRecord.CHARGE_USER_ID
|
||||
// };
|
||||
// sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel(DateTime.Now.ToShortDateString() + "安全生产责任制个人签订表", signRecord.ID, entity.ORG_ID, entity.ID, entity.NAME, DateTime.Now, DateTime.Now.AddDays(7), 1, "OG001_SHOWPRINT"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (sendUser != null)
|
||||
// {
|
||||
// sendNotice.Add(NotificationTaskService.InsertUserNoticeTaskModel("请为《" + postName + "》绑定责任制岗位并上传责任状", entity.ID, entity.ORG_ID, sendUser.ID, sendUser.NAME, DateTime.Now, DateTime.Now.AddDays(7), (int)FMNoticeTypeEnum.今日提醒, "PF135"));
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region 增加新增人员到ops表
|
||||
using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
|
||||
{
|
||||
var tennant = context.GetEntity<T_OP_TENANT>(t => t.ID == entity.ORG_ID, new string[] { "CODE" }).CODE;
|
||||
T_OP_ALLUSER alluser = new T_OP_ALLUSER();
|
||||
alluser.ID = entity.ID;
|
||||
alluser.CODE = entity.CODE;
|
||||
alluser.TENANT = tennant;
|
||||
alluser.ORG_ID = entity.ORG_ID;
|
||||
alluser.PHONE = entity.PHONE;
|
||||
context.AddEntity(alluser);
|
||||
context.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
//#region 增加新增人员到ops表
|
||||
//using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
|
||||
//{
|
||||
// var tennant = context.GetEntity<T_OP_TENANT>(t => t.ID == entity.ORG_ID, new string[] { "CODE" }).CODE;
|
||||
// T_OP_ALLUSER alluser = new T_OP_ALLUSER();
|
||||
// alluser.ID = entity.ID;
|
||||
// alluser.CODE = entity.CODE;
|
||||
// alluser.TENANT = tennant;
|
||||
// alluser.ORG_ID = entity.ORG_ID;
|
||||
// alluser.PHONE = entity.PHONE;
|
||||
// context.AddEntity(alluser);
|
||||
// context.SaveChanges();
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
#region //wyw 密码初始化 Xyy+code(姓名拼音首字母(第一个大写) + 工号(取数字)
|
||||
|
||||
@ -728,8 +747,8 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
}
|
||||
if (roleInfo.DEPARTMENT_TYPE != 3 && roleInfo.DEPARTMENT_TYPE != departmentInfo.DEPARTMENT_TYPE)
|
||||
{
|
||||
var param = Enum.GetName(typeof(FMDepartmentType), departmentInfo.DEPARTMENT_TYPE);
|
||||
var param2 = Enum.GetName(typeof(FMDepartmentType), roleInfo.DEPARTMENT_TYPE);
|
||||
var param = ((FMDepartmentType)departmentInfo.DEPARTMENT_TYPE).GetDescription();
|
||||
var param2 = ((FMDepartmentType)roleInfo.DEPARTMENT_TYPE).GetDescription();
|
||||
throw new Exception(departmentInfo.NAME + "是" + param + "," + roleInfo.NAME + "是" + param2 + ",组织层级不一致");
|
||||
}
|
||||
}
|
||||
@ -737,10 +756,6 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
}
|
||||
else
|
||||
this.ThrowError("060001");
|
||||
if (entity.Nav_Person.POST_ID == null)
|
||||
{
|
||||
throw new Exception("岗位不允许为空!");
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// //查双控库是否有该辨识岗位,没有的话触发今日提醒给安全员
|
||||
@ -928,6 +943,38 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
}
|
||||
}
|
||||
|
||||
var isHead = HeadHelper.GetIsHead(this.Request.Headers);
|
||||
Dictionary<Guid, string> dicConn = null;
|
||||
if (isHead)
|
||||
{
|
||||
dicConn = OPTenantDBConnService.GetConnDictionary(entity.ORG_ID);
|
||||
if (dicConn == null)
|
||||
{
|
||||
throw new Exception("获取子公司链接失败,请关闭页面刷新后再试");
|
||||
}
|
||||
}
|
||||
|
||||
#region 总用户库添加
|
||||
|
||||
if (!isAdd.Any())
|
||||
{
|
||||
using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
|
||||
{
|
||||
var tennant = context.GetEntity<T_OP_TENANT>(t => t.ID == entity.ORG_ID, new string[] { "CODE" }).CODE;
|
||||
T_OP_ALLUSER alluser = new T_OP_ALLUSER();
|
||||
alluser.ID = entity.ID;
|
||||
alluser.CODE = entity.CODE;
|
||||
alluser.TENANT = tennant;
|
||||
alluser.ORG_ID = entity.ORG_ID;
|
||||
alluser.PHONE = entity.PHONE;
|
||||
context.AddEntity(alluser);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (person != null)
|
||||
@ -985,6 +1032,68 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
if (noticeToday != null)
|
||||
this.UpdateEntityNoCommit(noticeToday);
|
||||
});
|
||||
|
||||
|
||||
#region wyw 如果是总部 人员信息同步到子公司
|
||||
|
||||
if (isHead)
|
||||
{
|
||||
entity.Nav_Department = null;
|
||||
entity.Nav_BelongRoles = null;
|
||||
entity.Nav_BelongRoleGroups = null;
|
||||
entity.Nav_BelongUserGroups = null;
|
||||
entity.Nav_UserPhotoFiles = null;
|
||||
entity.Nav_UserSignFiles = null;
|
||||
entity.TEAM_ID = null;
|
||||
entity.Nav_ApproveRole = null;
|
||||
entity.PROJECT_ID = null;
|
||||
entity.PRINTER_ID = null;
|
||||
|
||||
person.Nav_DepartMent = null;
|
||||
person.Nav_Post = null;
|
||||
person.POST_ID = null;
|
||||
person.Nav_TeamPersons = null;
|
||||
person.Nav_PersonWorks = null;
|
||||
person.Nav_PersonSkills = null;
|
||||
person.Nav_PersonIDCardFiles = null;
|
||||
person.Nav_PersonEducationFiles = null;
|
||||
person.Nav_PersonCertificateFiles = null;
|
||||
|
||||
int EditC = 0;
|
||||
foreach (var item in dicConn)
|
||||
{
|
||||
try
|
||||
{
|
||||
entity.ORG_ID = item.Key;
|
||||
person.ORG_ID = item.Key;
|
||||
using (var context = new MigrationContext(item.Value))
|
||||
{
|
||||
EditC = context.GetCount<T_FM_USER>(e => e.ID == entity.ID);
|
||||
entity.DEPARTMENT_ID = context.GetEntity<T_FM_DEPARTMENT>(e => e.PARENT_ID == null && !e.IS_DELETED && e.DEPARTMENT_TYPE == 5, null).ID;
|
||||
person.DEPARTMENT_ID = entity.DEPARTMENT_ID;
|
||||
|
||||
if (EditC > 0)
|
||||
{
|
||||
context.UpdateEntity(entity);
|
||||
context.UpdateEntity(person);
|
||||
context.SaveChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.AddEntity(person);
|
||||
context.AddEntity(entity);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,137 +1,128 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// T4模板文件:基础接口类
|
||||
// 此代码由T4模板自动生成
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//------------------------------------------------------------------------------
|
||||
using APT.Infrastructure.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using APT.Utility;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.BaseData.Domain.ApiModel.PF;
|
||||
namespace APT.LG.WebApi.Controllers.Api
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// T4模板文件:基础接口类
|
||||
// 此代码由T4模板自动生成
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//------------------------------------------------------------------------------
|
||||
using APT.Infrastructure.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using APT.Utility;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.BaseData.Domain.ApiModel.PF;
|
||||
namespace APT.LG.WebApi.Controllers.Api
|
||||
{
|
||||
using APT.BaseData.Domain.Entities.LG;
|
||||
|
||||
#region Oprate-表单操作日志表
|
||||
/// <summary>
|
||||
/// 表单操作日志表
|
||||
/// </summary>
|
||||
[Route("api/LG/Oprate")]
|
||||
public partial class OprateController : AuthorizeApiController<T_LG_OPRATE>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_LG_OPRATE>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_LG_OPRATE>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_LG_OPRATE> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_LG_OPRATE> 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_LG_OPRATE entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_LG_OPRATE> 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_LG_OPRATE> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Oprate-表单操作日志表
|
||||
/// <summary>
|
||||
/// 表单操作日志表
|
||||
/// </summary>
|
||||
[Route("api/LG/Oprate")]
|
||||
public partial class OprateController : AuthorizeApiController<T_LG_OPRATE>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_LG_OPRATE>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_LG_OPRATE>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_LG_OPRATE> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_LG_OPRATE> 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_LG_OPRATE entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_LG_OPRATE> 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_LG_OPRATE> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -1,370 +1,356 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// T4模板文件:基础接口类
|
||||
// 此代码由T4模板自动生成
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//------------------------------------------------------------------------------
|
||||
using APT.Infrastructure.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using APT.Utility;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.BaseData.Domain.ApiModel.PF;
|
||||
namespace APT.NW.WebApi.Controllers.Api
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// T4模板文件:基础接口类
|
||||
// 此代码由T4模板自动生成
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//------------------------------------------------------------------------------
|
||||
using APT.Infrastructure.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using APT.Utility;
|
||||
using APT.Infrastructure.Api;
|
||||
using APT.BaseData.Domain.ApiModel.PF;
|
||||
namespace APT.NW.WebApi.Controllers.Api
|
||||
{
|
||||
using APT.BaseData.Domain.Entities.NW;
|
||||
|
||||
#region Enterprise-子企业表
|
||||
/// <summary>
|
||||
/// 子企业表
|
||||
/// </summary>
|
||||
[Route("api/NW/Enterprise")]
|
||||
public partial class EnterpriseController : AuthorizeTreeApiController<T_NW_ENTERPRISE>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ENTERPRISE>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ENTERPRISE>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ENTERPRISE> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ENTERPRISE> 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_NW_ENTERPRISE entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ENTERPRISE> 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_NW_ENTERPRISE> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得树形实体数据
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("TreeData")]
|
||||
public JsonActionResult<IEnumerable<TreeNode<T_NW_ENTERPRISE>>> TreeData([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitTreeOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RoleDataPerm-子企业数据权限表
|
||||
/// <summary>
|
||||
/// 子企业数据权限表
|
||||
/// </summary>
|
||||
[Route("api/NW/RoleDataPerm")]
|
||||
public partial class RoleDataPermController : AuthorizeApiController<T_NW_ROLE_DATA_PERM>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_DATA_PERM>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_DATA_PERM>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ROLE_DATA_PERM> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ROLE_DATA_PERM> 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_NW_ROLE_DATA_PERM entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ROLE_DATA_PERM> 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_NW_ROLE_DATA_PERM> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region RoleMenu-子企业权限表
|
||||
/// <summary>
|
||||
/// 子企业权限表
|
||||
/// </summary>
|
||||
[Route("api/NW/RoleMenu")]
|
||||
public partial class RoleMenuController : AuthorizeApiController<T_NW_ROLE_MENU>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_MENU>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_MENU>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ROLE_MENU> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ROLE_MENU> 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_NW_ROLE_MENU entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ROLE_MENU> 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_NW_ROLE_MENU> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region Enterprise-子企业表
|
||||
/// <summary>
|
||||
/// 子企业表
|
||||
/// </summary>
|
||||
[Route("api/NW/Enterprise")]
|
||||
public partial class EnterpriseController : AuthorizeTreeApiController<T_NW_ENTERPRISE>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ENTERPRISE>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ENTERPRISE>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ENTERPRISE> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ENTERPRISE> 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_NW_ENTERPRISE entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ENTERPRISE> 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_NW_ENTERPRISE> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获得树形实体数据
|
||||
/// </summary>
|
||||
/// <param name="filter"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("TreeData")]
|
||||
public JsonActionResult<IEnumerable<TreeNode<T_NW_ENTERPRISE>>> TreeData([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitTreeOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region RoleDataPerm-子企业数据权限表
|
||||
/// <summary>
|
||||
/// 子企业数据权限表
|
||||
/// </summary>
|
||||
[Route("api/NW/RoleDataPerm")]
|
||||
public partial class RoleDataPermController : AuthorizeApiController<T_NW_ROLE_DATA_PERM>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_DATA_PERM>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_DATA_PERM>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ROLE_DATA_PERM> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ROLE_DATA_PERM> 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_NW_ROLE_DATA_PERM entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ROLE_DATA_PERM> 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_NW_ROLE_DATA_PERM> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region RoleMenu-子企业权限表
|
||||
/// <summary>
|
||||
/// 子企业权限表
|
||||
/// </summary>
|
||||
[Route("api/NW/RoleMenu")]
|
||||
public partial class RoleMenuController : AuthorizeApiController<T_NW_ROLE_MENU>
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Entities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_MENU>> Entities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序查询所有数据
|
||||
/// </summary>
|
||||
/// <param name="filter">过滤实体</param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpPost, Route("OrderEntities")]
|
||||
public JsonActionResult<IEnumerable<T_NW_ROLE_MENU>> OrderEntities([FromBody]KeywordFilter filter)
|
||||
{
|
||||
return WitOrderEntities(null, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Paged")]
|
||||
public PagedActionResult<T_NW_ROLE_MENU> Paged([FromBody]KeywordPageFilter pageFilter)
|
||||
{
|
||||
return WitPaged(null, pageFilter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPaged")]
|
||||
public PagedActionResult<T_NW_ROLE_MENU> 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_NW_ROLE_MENU entity)
|
||||
{
|
||||
return WitUpdate(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新
|
||||
/// </summary>
|
||||
/// <param name="entity">对象实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BatchUpdate")]
|
||||
public JsonActionResult<bool> BatchUpdate([FromBody] BatchUpdateModel<T_NW_ROLE_MENU> 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_NW_ROLE_MENU> Get([FromBody] KeywordFilter filter)
|
||||
{
|
||||
return WitEntity(null, filter);
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,9 @@
|
||||
using APT.BaseData.Domain.Entities.FM;
|
||||
using APT.BaseData.Domain.Entities.PF;
|
||||
using APT.BaseData.Domain.Enums;
|
||||
using APT.BaseData.Domain.IServices.OP;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.Migrations;
|
||||
using APT.MS.Domain.Entities.BS;
|
||||
using APT.MS.Domain.Entities.HM;
|
||||
using APT.MS.Domain.Entities.PF;
|
||||
@ -13,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
|
||||
namespace APT.PF.WebApi.Controllers.Api
|
||||
{
|
||||
@ -22,6 +25,13 @@ namespace APT.PF.WebApi.Controllers.Api
|
||||
[Route("api/PF/PFApprovalRole")]
|
||||
public partial class ApprovalRoleController : AuthorizeApiController<T_PF_APPROVAL_ROLE>
|
||||
{
|
||||
IOPTenantDBConnService OPTenantDBConnService { get; set; }
|
||||
public ApprovalRoleController(IOPTenantDBConnService opTenantDBConnService)
|
||||
{
|
||||
OPTenantDBConnService = opTenantDBConnService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新或新增数据
|
||||
/// </summary>
|
||||
@ -31,73 +41,139 @@ namespace APT.PF.WebApi.Controllers.Api
|
||||
public JsonActionResult<bool> FullUpdate([FromBody] T_PF_APPROVAL_ROLE entity)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
//var roleCodes = this.GetEntities<T_PF_APPROVAL_ROLE>(t => true, new BaseFilter(orgId)).Select(x => x.NAME).ToList();
|
||||
//if (roleCodes.Contains(entity.NAME))
|
||||
// throw new Exception("系统已存在审批角色编码为" + entity.NAME + "的数据,请勿重复!");
|
||||
var departs = entity.Nav_ApproveDeparts;
|
||||
entity.Nav_ApproveDeparts = null;
|
||||
if (departs != null && departs.Any())
|
||||
{
|
||||
departs = departs.Where(t => !t.IS_DELETED).ToList();
|
||||
}
|
||||
if (departs != null && departs.Any())
|
||||
{
|
||||
departs.ForEach(t =>
|
||||
{
|
||||
t.ORG_ID = orgId;
|
||||
t.APPROVAL_ROLE_ID = entity.ID;
|
||||
t.Nav_Department = null;
|
||||
});
|
||||
}
|
||||
List<T_PF_APPROVE_OPERATION_ROLE> listRoles = new List<T_PF_APPROVE_OPERATION_ROLE>();
|
||||
var roles = entity.Nav_ApproveRoles;
|
||||
entity.Nav_ApproveRoles = null;
|
||||
if (roles == null)
|
||||
{
|
||||
var approveRole = this.GetEntity<T_FM_ROLE>(t => t.ENABLE_STATUS == 0 && t.NAME.Contains("负责人"));
|
||||
if (approveRole != null)
|
||||
{
|
||||
var role = new T_PF_APPROVE_OPERATION_ROLE();
|
||||
role.ORG_ID = orgId;
|
||||
role.APPROVAL_ROLE_ID = entity.ID;
|
||||
role.ROLE_ID = approveRole.ID;
|
||||
listRoles.Add(role);
|
||||
}
|
||||
}
|
||||
List <Guid> deleteIds = new List<Guid>();
|
||||
if (entity.ROLE_ID != null)
|
||||
{
|
||||
var datas = this.GetEntities<T_PF_APPROVE_OPERATION_ROLE>(t => t.APPROVAL_ROLE_ID == entity.ID, new BaseFilter(orgId));
|
||||
if (datas.Any())
|
||||
{
|
||||
var ids=datas.Select(t => t.ID).ToList();
|
||||
deleteIds.AddRange(ids);
|
||||
}
|
||||
var role = new T_PF_APPROVE_OPERATION_ROLE();
|
||||
role.ORG_ID = orgId;
|
||||
role.APPROVAL_ROLE_ID = entity.ID;
|
||||
role.ROLE_ID = entity.ROLE_ID;
|
||||
listRoles.Add(role);
|
||||
}
|
||||
if (listRoles.Any())
|
||||
{
|
||||
listRoles = listRoles.Distinct(t => t.ROLE_ID).ToList();
|
||||
}
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (entity != null)
|
||||
UpdateEntityNoCommit(entity); //保存主表
|
||||
if (departs != null && departs.Any())
|
||||
BantchSaveEntityNoCommit(departs); //保存子表
|
||||
if (listRoles != null && listRoles.Any())
|
||||
BantchSaveEntityNoCommit(listRoles); //保存子表
|
||||
if (deleteIds != null && deleteIds.Any())
|
||||
BantchDeleteEntityNoCommit<T_PF_APPROVE_OPERATION_ROLE>(deleteIds); //保存子表
|
||||
});
|
||||
return true;
|
||||
});
|
||||
{
|
||||
var isHead = HeadHelper.GetIsHead(this.Request.Headers);
|
||||
if (entity.ISHEAD && !isHead)
|
||||
{
|
||||
throw new Exception("子公司不能修改总公司角色信息!");
|
||||
}
|
||||
|
||||
var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
//var roleCodes = this.GetEntities<T_PF_APPROVAL_ROLE>(t => true, new BaseFilter(orgId)).Select(x => x.NAME).ToList();
|
||||
//if (roleCodes.Contains(entity.NAME))
|
||||
// throw new Exception("系统已存在审批角色编码为" + entity.NAME + "的数据,请勿重复!");
|
||||
var departs = entity.Nav_ApproveDeparts;
|
||||
entity.Nav_ApproveDeparts = null;
|
||||
if (departs != null && departs.Any())
|
||||
{
|
||||
departs = departs.Where(t => !t.IS_DELETED).ToList();
|
||||
}
|
||||
if (departs != null && departs.Any())
|
||||
{
|
||||
departs.ForEach(t =>
|
||||
{
|
||||
t.ORG_ID = orgId;
|
||||
t.APPROVAL_ROLE_ID = entity.ID;
|
||||
t.Nav_Department = null;
|
||||
});
|
||||
}
|
||||
List<T_PF_APPROVE_OPERATION_ROLE> listRoles = new List<T_PF_APPROVE_OPERATION_ROLE>();
|
||||
var roles = entity.Nav_ApproveRoles;
|
||||
entity.Nav_ApproveRoles = null;
|
||||
if (roles == null)
|
||||
{
|
||||
var approveRole = this.GetEntity<T_FM_ROLE>(t => t.ENABLE_STATUS == 0 && t.NAME.Contains("负责人"));
|
||||
if (approveRole != null)
|
||||
{
|
||||
var role = new T_PF_APPROVE_OPERATION_ROLE();
|
||||
role.ORG_ID = orgId;
|
||||
role.APPROVAL_ROLE_ID = entity.ID;
|
||||
role.ROLE_ID = approveRole.ID;
|
||||
listRoles.Add(role);
|
||||
}
|
||||
}
|
||||
List<Guid> deleteIds = new List<Guid>();
|
||||
if (entity.ROLE_ID != null)
|
||||
{
|
||||
var datas = this.GetEntities<T_PF_APPROVE_OPERATION_ROLE>(t => t.APPROVAL_ROLE_ID == entity.ID, new BaseFilter(orgId));
|
||||
if (datas.Any())
|
||||
{
|
||||
var ids = datas.Select(t => t.ID).ToList();
|
||||
deleteIds.AddRange(ids);
|
||||
}
|
||||
var role = new T_PF_APPROVE_OPERATION_ROLE();
|
||||
role.ORG_ID = orgId;
|
||||
role.APPROVAL_ROLE_ID = entity.ID;
|
||||
role.ROLE_ID = entity.ROLE_ID;
|
||||
listRoles.Add(role);
|
||||
}
|
||||
if (listRoles.Any())
|
||||
{
|
||||
listRoles = listRoles.Distinct(t => t.ROLE_ID).ToList();
|
||||
}
|
||||
Dictionary<Guid, string> dicConn = null;
|
||||
if (isHead)
|
||||
{
|
||||
dicConn = OPTenantDBConnService.GetConnDictionary(entity.ORG_ID);
|
||||
if (dicConn == null)
|
||||
{
|
||||
throw new Exception("获取子公司链接失败,请关闭页面刷新后再试");
|
||||
}
|
||||
}
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (entity != null)
|
||||
UpdateEntityNoCommit(entity); //保存主表
|
||||
if (departs != null && departs.Any())
|
||||
BantchSaveEntityNoCommit(departs); //保存子表
|
||||
if (listRoles != null && listRoles.Any())
|
||||
BantchSaveEntityNoCommit(listRoles); //保存子表
|
||||
if (deleteIds != null && deleteIds.Any())
|
||||
BantchDeleteEntityNoCommit<T_PF_APPROVE_OPERATION_ROLE>(deleteIds); //保存子表
|
||||
});
|
||||
|
||||
//如果是总部 同时同步到各个子公司
|
||||
if (isHead)
|
||||
{
|
||||
entity.ISHEAD = true;
|
||||
entity.ROLE_ID = null;
|
||||
entity.Nav_Role = null;
|
||||
entity.Nav_ApproveRoles = null;
|
||||
int EditC = 0;
|
||||
//using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
foreach (var item in dicConn)
|
||||
{
|
||||
try
|
||||
{
|
||||
entity.ORG_ID = item.Key;
|
||||
using (var context = new MigrationContext(item.Value))
|
||||
{
|
||||
EditC = context.GetCount<T_PF_APPROVAL_ROLE>(e => e.ID == entity.ID);
|
||||
if (EditC > 0)
|
||||
{
|
||||
context.UpdateEntity(entity);
|
||||
context.SaveChanges();
|
||||
//context.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
context.AddEntity(entity);
|
||||
context.SaveChanges();
|
||||
//context.AddAsync(entity);
|
||||
//context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
// //// 所有操作成功,提交事务
|
||||
// scope.Complete();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// // 发生异常,自动回滚(无需手动调用,scope 释放时未 Complete 则回滚)
|
||||
// throw;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量添加节点
|
||||
|
||||
@ -173,7 +173,7 @@
|
||||
// //MethodInfo callbackMethd1 = callBackInterface1.GetMethod("MeetingMinutesBack", BindingFlags.Public | BindingFlags.Instance); // Error lies
|
||||
// //callbackMethd1.Invoke(this, new object[] { dbApprove.DATA_ID.ToString() });
|
||||
//}
|
||||
|
||||
|
||||
//查询审批的表单数据
|
||||
var form = this.GetEntity<T_PF_FORM>(i => i.CODE == dbApprove.APPROVE_CODE, new BaseFilter(dbApprove.ORG_ID));
|
||||
var tableName = form?.TABLE_NAME;
|
||||
@ -334,8 +334,8 @@
|
||||
case "关键许可工作票(二级审批)":
|
||||
case "关键许可工作票(三级审批)":
|
||||
case "关键许可工作票(四级审批)":
|
||||
var job = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(t=>t.ID == entity.DATA_ID, "Nav_OperationStep");
|
||||
NoticeTitle = job != null && job.Nav_OperationStep != null ? entity.NAME+"-"+job.Nav_OperationStep?.NAME + "待审批" : NoticeTitle;
|
||||
var job = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(t => t.ID == entity.DATA_ID, "Nav_OperationStep");
|
||||
NoticeTitle = job != null && job.Nav_OperationStep != null ? entity.NAME + "-" + job.Nav_OperationStep?.NAME + "待审批" : NoticeTitle;
|
||||
endTime = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("D").ToString()).AddSeconds(-1);
|
||||
break;
|
||||
default: break;
|
||||
@ -437,13 +437,13 @@
|
||||
var details = dbApprove.Nav_ApproveDetails;
|
||||
dbApprove.Nav_ApproveDetails = null;
|
||||
details.ForEach(i => i.Nav_Approve = null);
|
||||
if (task != null)
|
||||
this.UpdateEntityNoCommit(task);
|
||||
this.UpdateEntityNoCommit(dbApprove);
|
||||
this.BantchUpdateEntityNoCommit(details);
|
||||
//if (methodInfoEnd != null)
|
||||
// methodInfoEnd.MakeGenericMethod(new Type[] { dbTypeEnd }).Invoke(this, new object[] { dbApprove.DATA_ID.ToString() });
|
||||
|
||||
if (task != null)
|
||||
this.UpdateEntityNoCommit(task);
|
||||
this.UpdateEntityNoCommit(dbApprove);
|
||||
this.BantchUpdateEntityNoCommit(details);
|
||||
//if (methodInfoEnd != null)
|
||||
// methodInfoEnd.MakeGenericMethod(new Type[] { dbTypeEnd }).Invoke(this, new object[] { dbApprove.DATA_ID.ToString() });
|
||||
|
||||
}
|
||||
private void ChangeApproveStatus(T_PF_APPROVE dbApprove, T_FM_NOTIFICATION_TASK task)//, Type dbTypeEnd = null, MethodInfo methodInfoEnd = null
|
||||
{
|
||||
@ -645,18 +645,33 @@
|
||||
[HttpPost, Route("FullGet")]
|
||||
public JsonActionResult<T_PF_APPROVE> FullGet([FromBody] KeywordFilter filter)
|
||||
{
|
||||
var result = WitEntity(null, filter);
|
||||
if (result.Data != null)
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
if (result.Data.APPROVE_TEMP_ID != null)
|
||||
T_PF_APPROVE result = null;
|
||||
if (!string.IsNullOrEmpty(filter.Parameter1) && filter.OrgId.HasValue && filter.Parameter1 != filter.OrgId.Value.ToString())
|
||||
{
|
||||
var approveTemp = this.GetEntity<T_PF_APPROVE_TEMP>(t => t.ID == result.Data.APPROVE_TEMP_ID);
|
||||
if (approveTemp != null)
|
||||
result.Data.REJECT_INTERFACE = approveTemp.REJECT_INTERFACE;
|
||||
//集团人员 通过 首页点击 获取对应的数据库链接 返回结果
|
||||
//这边怎么调用 原生的 GetEntity 方法
|
||||
|
||||
//ICommonService service = _serviceLocator.GetService<ICommonService>();
|
||||
|
||||
}
|
||||
result.Data.Nav_ApproveDetails = result.Data.Nav_ApproveDetails.OrderBy(t => t.NUM).ThenBy(m => m.MODIFY_TIME).ToList();
|
||||
}
|
||||
return result;
|
||||
else
|
||||
{
|
||||
result = GetEntity<T_PF_APPROVE>(null, filter, null);
|
||||
if (result != null)
|
||||
{
|
||||
if (result.APPROVE_TEMP_ID != null)
|
||||
{
|
||||
var approveTemp = this.GetEntity<T_PF_APPROVE_TEMP>(t => t.ID == result.APPROVE_TEMP_ID);
|
||||
if (approveTemp != null)
|
||||
result.REJECT_INTERFACE = approveTemp.REJECT_INTERFACE;
|
||||
}
|
||||
result.Nav_ApproveDetails = result.Nav_ApproveDetails.OrderBy(t => t.NUM).ThenBy(m => m.MODIFY_TIME).ToList();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -959,7 +974,7 @@
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
private bool BackUpdate_FOJobCrucialLicense(string id,Action action)
|
||||
private bool BackUpdate_FOJobCrucialLicense(string id, Action action)
|
||||
{
|
||||
//var entity = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(id, false, "Nav_OperationStep", "Nav_ApplyUser", "Nav_CrucialLicensePerson");
|
||||
var entity = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(id, new string[] { "Nav_OperationStep", "Nav_ApplyUser", "Nav_CrucialLicensePerson" });// wyw
|
||||
@ -1055,7 +1070,7 @@
|
||||
});
|
||||
return true;
|
||||
}
|
||||
private bool BackUpdate_FOJobEventRecord(string id,Action action)
|
||||
private bool BackUpdate_FOJobEventRecord(string id, Action action)
|
||||
{
|
||||
var entity = this.GetEntity<T_FO_JOB_EVENT_RECORD>(id, "Nav_Details");
|
||||
entity.FORM_STATUS = (int)FOTeamActivityState.已归档;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// T4模板文件:基础接口类
|
||||
// 此代码由T4模板自动生成
|
||||
@ -21,5 +15,4 @@ using APT.Infrastructure.Api;
|
||||
using APT.BaseData.Domain.ApiModel.PF;
|
||||
namespace APT.PP.WebApi.Controllers.Api
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
22
APT.Utility/HeadHelper.cs
Normal file
22
APT.Utility/HeadHelper.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using APT.Infrastructure.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace APT.Utility
|
||||
{
|
||||
public class HeadHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 地球半径
|
||||
/// </summary>
|
||||
public const string HeadtelnetCode = "0003";
|
||||
|
||||
public static bool GetIsHead(IHeaderDictionary Headers)
|
||||
{
|
||||
if (Headers != null && Headers.ContainsKey("Tenant") && Headers["Tenant"] == HeadtelnetCode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,5 +24,6 @@ namespace APT.Utility
|
||||
public string MineType { get; set; }
|
||||
|
||||
public string[] DataRule { get; set; }
|
||||
public bool IsHead { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user