冲突
This commit is contained in:
		
						commit
						66986befb9
					
				@ -300,5 +300,10 @@
 | 
				
			|||||||
        /// 首页 BI/BIStatiscialAnalysisController/GetJobCompletionSort Key
 | 
					        /// 首页 BI/BIStatiscialAnalysisController/GetJobCompletionSort Key
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        public const string HomeJobCompletion = "HomeJobCompletion_{0}";
 | 
					        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; }
 | 
					        public Guid? ROLE_ID { get; set; }
 | 
				
			||||||
        [Description("导航属性:审批角色")]
 | 
					        [Description("导航属性:审批角色")]
 | 
				
			||||||
        public virtual T_FM_ROLE Nav_Role { get; set; }
 | 
					        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>
 | 
					        /// </summary>
 | 
				
			||||||
        [Description("是否取消")]
 | 
					        [Description("是否取消")]
 | 
				
			||||||
        public bool ISCANCEL { get; set; }
 | 
					        public bool ISCANCEL { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 是否总部
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("是否总部")]
 | 
				
			||||||
 | 
					        [FormFieldTable]
 | 
				
			||||||
 | 
					        [FormFieldQuery]
 | 
				
			||||||
 | 
					        [FormFieldEdit]
 | 
				
			||||||
 | 
					        public bool ISHEAD { get; set; } = false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -15,5 +15,12 @@ namespace APT.BaseData.Domain.IServices.OP
 | 
				
			|||||||
        /// <param name="ORG_IDBeside"></param>
 | 
					        /// <param name="ORG_IDBeside"></param>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        Dictionary<Guid, string> GetConnDictionary(Guid? ORG_IDBeside);
 | 
					        Dictionary<Guid, string> GetConnDictionary(Guid? ORG_IDBeside);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 获取 ORG_ID的数据库链接
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="ORG_ID">过滤值</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        string GetConnByORGID(Guid ORG_ID);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -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.Entities.OP;
 | 
				
			||||||
using APT.BaseData.Domain.Enums.OP;
 | 
					using APT.BaseData.Domain.Enums.OP;
 | 
				
			||||||
using APT.BaseData.Domain.IServices.OP;
 | 
					using APT.BaseData.Domain.IServices.OP;
 | 
				
			||||||
using APT.Infrastructure.Api;
 | 
					using APT.Infrastructure.Api;
 | 
				
			||||||
 | 
					using APT.Infrastructure.Api.Redis;
 | 
				
			||||||
using APT.Infrastructure.Core;
 | 
					using APT.Infrastructure.Core;
 | 
				
			||||||
using APT.Migrations;
 | 
					using APT.Migrations;
 | 
				
			||||||
using Newtonsoft.Json;
 | 
					using Newtonsoft.Json;
 | 
				
			||||||
@ -23,21 +25,31 @@ namespace APT.BaseData.Services.Services.OP
 | 
				
			|||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 获取 除 ORG_IDBeside 之外对应的数据库链接字典  ORG_ID  DB_CONN
 | 
					        /// 获取 除 ORG_IDBeside 之外对应的数据库链接字典  ORG_ID  DB_CONN
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="ORG_IDBeside"></param>
 | 
					        /// <param name="ORG_IDBeside">过滤值 没有就不过滤</param>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        public Dictionary<Guid, string> GetConnDictionary(Guid? ORG_IDBeside)
 | 
					        public Dictionary<Guid, string> GetConnDictionary(Guid? ORG_IDBeside)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Dictionary<Guid, string> dicORGCONN = new Dictionary<Guid, string>();
 | 
					            Dictionary<Guid, string> dicORGCONN = new Dictionary<Guid, string>();
 | 
				
			||||||
 | 
					            //从Redis中获取所有数据库链接值
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            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;
 | 
					                string conn = string.Empty;
 | 
				
			||||||
                IEnumerable<T_OP_TENANT> listTent = null;
 | 
					                IEnumerable<T_OP_TENANT> listTent = null;
 | 
				
			||||||
                using (var context = new MigrationContext())
 | 
					                using (var context = new MigrationContext())
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Expression<Func<T_OP_TENANT, bool>> expression = e => e.DB_CONN_ID.HasValue;
 | 
					                    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);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    listTent = context.GetEntities(expression, null, null);
 | 
					                    listTent = context.GetEntities(expression, null, null);
 | 
				
			||||||
                    List<Guid> listConnID = listTent.Select(e => e.DB_CONN_ID.Value).ToList();
 | 
					                    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);
 | 
					                    var listDbConn = context.GetEntities<T_OP_TENANT_DB_CONN>(e => listConnID.Contains(e.ID), null, null);
 | 
				
			||||||
@ -56,9 +68,101 @@ namespace APT.BaseData.Services.Services.OP
 | 
				
			|||||||
                                dicORGCONN.Add(listTent.First(e => e.DB_CONN_ID == item.ID).ID, conn);
 | 
					                                dicORGCONN.Add(listTent.First(e => e.DB_CONN_ID == item.ID).ID, conn);
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					                        if (isRedisConfig && dicORGCONN.Count > 0)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            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;
 | 
					            return dicORGCONN;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 获取 ORG_ID的数据库链接
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="ORG_ID">过滤值</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        public string GetConnByORGID(Guid ORG_ID)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Dictionary<Guid, string> dicORGCONN = new Dictionary<Guid, string>();
 | 
				
			||||||
 | 
					            //从Redis中获取所有数据库链接值
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            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())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    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)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        var env = ConfigurationManager.AppSettings["Env"];
 | 
				
			||||||
 | 
					                        foreach (var item in listDbConn)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            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 (isRedisConfig && dicORGCONN.Count > 0)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            try
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                CsRedisManager.StringSet<Dictionary<Guid, string>>(RedisCacheKey.ConnAll, dicORGCONN);//所有数据库链接 存入 Redis
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            catch { }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (dicORGCONN != null && dicORGCONN.Count > 0 && dicORGCONN.ContainsKey(ORG_ID))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                return dicORGCONN[ORG_ID];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return "";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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")
 | 
					                    b.Property<bool>("ISCANCEL")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<bool>("ISHEAD")
 | 
				
			||||||
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<bool>("IS_ALLOW_UPDATE")
 | 
					                    b.Property<bool>("IS_ALLOW_UPDATE")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -53823,6 +53826,9 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                    b.Property<Guid?>("FORM_ID")
 | 
					                    b.Property<Guid?>("FORM_ID")
 | 
				
			||||||
                        .HasColumnType("uniqueidentifier");
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<bool>("ISHEAD")
 | 
				
			||||||
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<bool>("IS_DELETED")
 | 
					                    b.Property<bool>("IS_DELETED")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,10 +2,12 @@
 | 
				
			|||||||
using APT.BaseData.Domain.IServices.BS;
 | 
					using APT.BaseData.Domain.IServices.BS;
 | 
				
			||||||
using APT.BaseData.Domain.IServices.EX;
 | 
					using APT.BaseData.Domain.IServices.EX;
 | 
				
			||||||
using APT.BaseData.Domain.IServices.FM;
 | 
					using APT.BaseData.Domain.IServices.FM;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.IServices.OP;
 | 
				
			||||||
using APT.BaseData.Domain.IServices.Platform;
 | 
					using APT.BaseData.Domain.IServices.Platform;
 | 
				
			||||||
using APT.BaseData.Services.DomainServices;
 | 
					using APT.BaseData.Services.DomainServices;
 | 
				
			||||||
using APT.BaseData.Services.Services.EX;
 | 
					using APT.BaseData.Services.Services.EX;
 | 
				
			||||||
using APT.BaseData.Services.Services.FM;
 | 
					using APT.BaseData.Services.Services.FM;
 | 
				
			||||||
 | 
					using APT.BaseData.Services.Services.OP;
 | 
				
			||||||
using APT.BaseData.Services.Services.Platform;
 | 
					using APT.BaseData.Services.Services.Platform;
 | 
				
			||||||
using APT.BaseData.Services.Sys;
 | 
					using APT.BaseData.Services.Sys;
 | 
				
			||||||
using Autofac;
 | 
					using Autofac;
 | 
				
			||||||
@ -53,6 +55,7 @@ namespace APT.FM.WebApi.App_Start
 | 
				
			|||||||
            builder.RegisterType<PFApproveCallBackSEService>().As<IPFApproveCallBackSEService>().InstancePerLifetimeScope();
 | 
					            builder.RegisterType<PFApproveCallBackSEService>().As<IPFApproveCallBackSEService>().InstancePerLifetimeScope();
 | 
				
			||||||
            builder.RegisterType<FMNotificationTaskService>().As<IFMNotificationTaskService>().InstancePerLifetimeScope();
 | 
					            builder.RegisterType<FMNotificationTaskService>().As<IFMNotificationTaskService>().InstancePerLifetimeScope();
 | 
				
			||||||
            builder.RegisterType<PFApproveCallBackService>().As<IPFApproveCallBackService>().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.Field = "TASK_STARTDT";
 | 
				
			||||||
                order2.Order = DbOrder.DESC;
 | 
					                order2.Order = DbOrder.DESC;
 | 
				
			||||||
                pageFilter.Orders.Add(order2);
 | 
					                pageFilter.Orders.Add(order2);
 | 
				
			||||||
 | 
					                pageFilter.OrgId = null;
 | 
				
			||||||
 | 
					                pageFilter.IgnoreOrgRule = true;
 | 
				
			||||||
                var bear = new BaseFilter();
 | 
					                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 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 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);
 | 
					                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);
 | 
				
			||||||
 | 
				
			|||||||
@ -34,6 +34,7 @@ using System.Security.Cryptography;
 | 
				
			|||||||
using APT.MS.Domain.Entities.SC.PT;
 | 
					using APT.MS.Domain.Entities.SC.PT;
 | 
				
			||||||
using Microsoft.Extensions.DependencyModel;
 | 
					using Microsoft.Extensions.DependencyModel;
 | 
				
			||||||
using APT.MS.Domain.Entities.SK;
 | 
					using APT.MS.Domain.Entities.SK;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.IServices.OP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace APT.FM.WebApi.Controllers.Api.FM
 | 
					namespace APT.FM.WebApi.Controllers.Api.FM
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -47,15 +48,18 @@ namespace APT.FM.WebApi.Controllers.Api.FM
 | 
				
			|||||||
        IFMUserService UserService { get; set; }
 | 
					        IFMUserService UserService { get; set; }
 | 
				
			||||||
        IFMDepartmentService DepartmentService { get; set; }
 | 
					        IFMDepartmentService DepartmentService { get; set; }
 | 
				
			||||||
        IFMNotificationTaskService NotificationTaskService { get; set; }
 | 
					        IFMNotificationTaskService NotificationTaskService { get; set; }
 | 
				
			||||||
 | 
					        IOPTenantDBConnService OPTenantDBConnService { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 
 | 
					        /// 
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="personnelService"></param>
 | 
					        /// <param name="personnelService"></param>
 | 
				
			||||||
        public UserController(IFMUserService personnelService, IFMDepartmentService departmentService, IFMNotificationTaskService notificationTaskService)
 | 
					        public UserController(IFMUserService personnelService, IFMDepartmentService departmentService, IFMNotificationTaskService notificationTaskService, IOPTenantDBConnService opTenantDBConnService)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            UserService = personnelService;
 | 
					            UserService = personnelService;
 | 
				
			||||||
            DepartmentService = departmentService;
 | 
					            DepartmentService = departmentService;
 | 
				
			||||||
            NotificationTaskService = notificationTaskService;
 | 
					            NotificationTaskService = notificationTaskService;
 | 
				
			||||||
 | 
					            OPTenantDBConnService = opTenantDBConnService;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
@ -483,110 +487,125 @@ namespace APT.FM.WebApi.Controllers.Api.FM
 | 
				
			|||||||
                T_OG_SAFE_PDT_SIGNED_POST signPost = null;
 | 
					                T_OG_SAFE_PDT_SIGNED_POST signPost = null;
 | 
				
			||||||
                T_PT_ASSESSMENT_PLAN_AUDIT_TEMP_DETAIL library = null;
 | 
					                T_PT_ASSESSMENT_PLAN_AUDIT_TEMP_DETAIL library = null;
 | 
				
			||||||
                T_FM_NOTIFICATION_TASK noticeToday = null;
 | 
					                T_FM_NOTIFICATION_TASK noticeToday = null;
 | 
				
			||||||
                if (!isAdd.Any())
 | 
					                if (string.IsNullOrEmpty(entity.CODE))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("工号不允许为空!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                if (entity.CODE.Length <= 3)
 | 
					                if (entity.CODE.Length <= 3)
 | 
				
			||||||
                    this.ThrowError("050003");
 | 
					                    this.ThrowError("050003");
 | 
				
			||||||
 | 
					                if (string.IsNullOrEmpty(entity.NAME))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("姓名不允许为空!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (entity.Nav_Person.POST_ID == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("岗位不允许为空!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (!isAdd.Any())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                    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();
 | 
					                    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);
 | 
					                    var isRepeat = userList.FirstOrDefault(t => t.CODE == entity.CODE);
 | 
				
			||||||
                    if (isRepeat != null)
 | 
					                    if (isRepeat != null)
 | 
				
			||||||
                        this.ThrowError("050001");
 | 
					                        this.ThrowError("050001");
 | 
				
			||||||
                    if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa"))
 | 
					                    if (entity.ORG_ID != Guid.Parse("b043b28b-bbc3-c452-6052-4fba1457abfa"))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        #region 新增人员增加三级安全教育
 | 
					                        #region    //
 | 
				
			||||||
                        eduCard = new T_SE_THREE_LEVEL_SAFE_EDU_CARD();
 | 
					                        #region //新增人员增加三级安全教育
 | 
				
			||||||
                        eduCard.ID = Guid.NewGuid();
 | 
					                        //eduCard = new T_SE_THREE_LEVEL_SAFE_EDU_CARD();
 | 
				
			||||||
                        eduCard.ID_CARD_NUMBER = entity.ID_CARD;
 | 
					                        //eduCard.ID = Guid.NewGuid();
 | 
				
			||||||
                        eduCard.IN_TIME = entity.ENTRYTIME;
 | 
					                        //eduCard.ID_CARD_NUMBER = entity.ID_CARD;
 | 
				
			||||||
                        eduCard.USER_ID = entity.ID;
 | 
					                        //eduCard.IN_TIME = entity.ENTRYTIME;
 | 
				
			||||||
                        eduCard.DEPARTMENT_ID = entity.DEPARTMENT_ID;
 | 
					                        //eduCard.USER_ID = entity.ID;
 | 
				
			||||||
                        eduCard.LAUNCH_TIME = DateTime.Now;
 | 
					                        //eduCard.DEPARTMENT_ID = entity.DEPARTMENT_ID;
 | 
				
			||||||
                        eduCard.ORG_ID = entity.ORG_ID;
 | 
					                        //eduCard.LAUNCH_TIME = DateTime.Now;
 | 
				
			||||||
                        eduCard.POST_ID = entity.Nav_Person.POST_ID;
 | 
					                        //eduCard.ORG_ID = entity.ORG_ID;
 | 
				
			||||||
                        eduCard.STATUS = SEThreeLevelSafeTrainStatus.公司培训;
 | 
					                        //eduCard.POST_ID = entity.Nav_Person.POST_ID;
 | 
				
			||||||
                        eduCard.LAUNCH_USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
					                        //eduCard.STATUS = SEThreeLevelSafeTrainStatus.公司培训;
 | 
				
			||||||
                        eduCard.LAUNCH_DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
 | 
					                        //eduCard.LAUNCH_USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
				
			||||||
                        next_train_record = new T_SE_THREE_LEVEL_SAFE_TRAIN_RECORD
 | 
					                        //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,
 | 
					                        //    ID = Guid.NewGuid(),
 | 
				
			||||||
                            ORG_ID = eduCard.ORG_ID,
 | 
					                        //    EDU_CARD_ID = eduCard.ID,
 | 
				
			||||||
                            THREE_LEVEL_SAFE_TRAIN_TYPE = SEThreeLevelSafeTrainType.公司级
 | 
					                        //    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 train_contents = GetEntity<T_SE_THREE_LEVEL_SAFE_CONTENT>(t => t.THREE_LEVEL_SAFE_TRAIN_TYPE == (SEThreeLevelSafeTrainType)eduCard.STATUS.GetInt());
 | 
				
			||||||
                        var postName = GetEntity<T_FM_USER_POST>(eduCard.POST_ID ?? Guid.Empty)?.NAME;
 | 
					                        //next_train_record.CONTENT_ID = train_contents.ID;
 | 
				
			||||||
                        var sendUser = GetEntity<T_FM_USER>(t => t.Nav_ApproveRole != null && t.Nav_ApproveRole.NAME == "安环部安全员" && t.IS_DELETED == false && t.ENABLE_STATUS == 0);
 | 
					                        //var postName = GetEntity<T_FM_USER_POST>(eduCard.POST_ID ?? Guid.Empty)?.NAME;
 | 
				
			||||||
                        if (sendUser != null)
 | 
					                        //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);
 | 
					                        //    var endTime = entity.ENTRYTIME.AddMonths(1);
 | 
				
			||||||
                            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"));
 | 
					                        //    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"));
 | 
				
			||||||
 | 
					                        //    }
 | 
				
			||||||
 | 
					                        //}
 | 
				
			||||||
                        #endregion 
 | 
					                        #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"));
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        #endregion
 | 
					                        #endregion
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    #region 增加新增人员到ops表
 | 
					                    //#region 增加新增人员到ops表
 | 
				
			||||||
                    using (var context = new MigrationContext(ConfigurationManager.ConnectionStrings["default"]))
 | 
					                    //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;
 | 
					                    //    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();
 | 
					                    //    T_OP_ALLUSER alluser = new T_OP_ALLUSER();
 | 
				
			||||||
                        alluser.ID = entity.ID;
 | 
					                    //    alluser.ID = entity.ID;
 | 
				
			||||||
                        alluser.CODE = entity.CODE;
 | 
					                    //    alluser.CODE = entity.CODE;
 | 
				
			||||||
                        alluser.TENANT = tennant;
 | 
					                    //    alluser.TENANT = tennant;
 | 
				
			||||||
                        alluser.ORG_ID = entity.ORG_ID;
 | 
					                    //    alluser.ORG_ID = entity.ORG_ID;
 | 
				
			||||||
                        alluser.PHONE = entity.PHONE;
 | 
					                    //    alluser.PHONE = entity.PHONE;
 | 
				
			||||||
                        context.AddEntity(alluser);
 | 
					                    //    context.AddEntity(alluser);
 | 
				
			||||||
                        context.SaveChanges();
 | 
					                    //    context.SaveChanges();
 | 
				
			||||||
                    }
 | 
					                    //}
 | 
				
			||||||
                    #endregion
 | 
					                    //#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    #region   //wyw 密码初始化  Xyy+code(姓名拼音首字母(第一个大写)  +  工号(取数字)
 | 
					                    #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)
 | 
					                            if (roleInfo.DEPARTMENT_TYPE != 3 && roleInfo.DEPARTMENT_TYPE != departmentInfo.DEPARTMENT_TYPE)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                var param = Enum.GetName(typeof(FMDepartmentType), departmentInfo.DEPARTMENT_TYPE);
 | 
					                                var param = ((FMDepartmentType)departmentInfo.DEPARTMENT_TYPE).GetDescription();
 | 
				
			||||||
                                var param2 = Enum.GetName(typeof(FMDepartmentType), roleInfo.DEPARTMENT_TYPE);
 | 
					                                var param2 = ((FMDepartmentType)roleInfo.DEPARTMENT_TYPE).GetDescription();
 | 
				
			||||||
                                throw new Exception(departmentInfo.NAME + "是" + param + "," + roleInfo.NAME + "是" + param2 + ",组织层级不一致");
 | 
					                                throw new Exception(departmentInfo.NAME + "是" + param + "," + roleInfo.NAME + "是" + param2 + ",组织层级不一致");
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@ -737,10 +756,6 @@ namespace APT.FM.WebApi.Controllers.Api.FM
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                    this.ThrowError("060001");
 | 
					                    this.ThrowError("060001");
 | 
				
			||||||
                if (entity.Nav_Person.POST_ID == null)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    throw new Exception("岗位不允许为空!");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                //else
 | 
					                //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(() =>
 | 
					                UnifiedCommit(() =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (person != null)
 | 
					                    if (person != null)
 | 
				
			||||||
@ -985,6 +1032,68 @@ namespace APT.FM.WebApi.Controllers.Api.FM
 | 
				
			|||||||
                    if (noticeToday != null)
 | 
					                    if (noticeToday != null)
 | 
				
			||||||
                        this.UpdateEntityNoCommit(noticeToday);
 | 
					                        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;
 | 
					                return true;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,9 @@
 | 
				
			|||||||
using APT.BaseData.Domain.Entities.FM;
 | 
					using APT.BaseData.Domain.Entities.FM;
 | 
				
			||||||
using APT.BaseData.Domain.Entities.PF;
 | 
					using APT.BaseData.Domain.Entities.PF;
 | 
				
			||||||
using APT.BaseData.Domain.Enums;
 | 
					using APT.BaseData.Domain.Enums;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.IServices.OP;
 | 
				
			||||||
using APT.Infrastructure.Core;
 | 
					using APT.Infrastructure.Core;
 | 
				
			||||||
 | 
					using APT.Migrations;
 | 
				
			||||||
using APT.MS.Domain.Entities.BS;
 | 
					using APT.MS.Domain.Entities.BS;
 | 
				
			||||||
using APT.MS.Domain.Entities.HM;
 | 
					using APT.MS.Domain.Entities.HM;
 | 
				
			||||||
using APT.MS.Domain.Entities.PF;
 | 
					using APT.MS.Domain.Entities.PF;
 | 
				
			||||||
@ -13,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Transactions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace APT.PF.WebApi.Controllers.Api
 | 
					namespace APT.PF.WebApi.Controllers.Api
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -22,6 +25,13 @@ namespace APT.PF.WebApi.Controllers.Api
 | 
				
			|||||||
    [Route("api/PF/PFApprovalRole")]
 | 
					    [Route("api/PF/PFApprovalRole")]
 | 
				
			||||||
    public partial class ApprovalRoleController : AuthorizeApiController<T_PF_APPROVAL_ROLE>
 | 
					    public partial class ApprovalRoleController : AuthorizeApiController<T_PF_APPROVAL_ROLE>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        IOPTenantDBConnService OPTenantDBConnService { get; set; }
 | 
				
			||||||
 | 
					        public ApprovalRoleController(IOPTenantDBConnService opTenantDBConnService)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            OPTenantDBConnService = opTenantDBConnService;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 更新或新增数据
 | 
					        /// 更新或新增数据
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
@ -32,6 +42,12 @@ namespace APT.PF.WebApi.Controllers.Api
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
            return SafeExecute<bool>(() =>
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
 | 
					              var isHead = HeadHelper.GetIsHead(this.Request.Headers);
 | 
				
			||||||
 | 
					              if (entity.ISHEAD && !isHead)
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                  throw new Exception("子公司不能修改总公司角色信息!");
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              var orgId = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
 | 
					              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();
 | 
					              //var roleCodes = this.GetEntities<T_PF_APPROVAL_ROLE>(t => true, new BaseFilter(orgId)).Select(x => x.NAME).ToList();
 | 
				
			||||||
              //if (roleCodes.Contains(entity.NAME))
 | 
					              //if (roleCodes.Contains(entity.NAME))
 | 
				
			||||||
@ -85,6 +101,15 @@ namespace APT.PF.WebApi.Controllers.Api
 | 
				
			|||||||
              {
 | 
					              {
 | 
				
			||||||
                  listRoles = listRoles.Distinct(t => t.ROLE_ID).ToList();
 | 
					                  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(() =>
 | 
					              UnifiedCommit(() =>
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                  if (entity != null)
 | 
					                  if (entity != null)
 | 
				
			||||||
@ -96,6 +121,57 @@ namespace APT.PF.WebApi.Controllers.Api
 | 
				
			|||||||
                  if (deleteIds != null && deleteIds.Any())
 | 
					                  if (deleteIds != null && deleteIds.Any())
 | 
				
			||||||
                      BantchDeleteEntityNoCommit<T_PF_APPROVE_OPERATION_ROLE>(deleteIds);    //保存子表
 | 
					                      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;
 | 
					              return true;
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -31,6 +31,7 @@
 | 
				
			|||||||
    using APT.BaseData.Services.Services.FM;
 | 
					    using APT.BaseData.Services.Services.FM;
 | 
				
			||||||
    using APT.BaseData.Services.Sys;
 | 
					    using APT.BaseData.Services.Sys;
 | 
				
			||||||
    using APT.MS.Domain.Entities.FO;
 | 
					    using APT.MS.Domain.Entities.FO;
 | 
				
			||||||
 | 
					    using APT.BaseData.Domain.IServices.OP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [Route("api/PF/PFApprove")]
 | 
					    [Route("api/PF/PFApprove")]
 | 
				
			||||||
    public partial class ApproveController : AuthorizeApiController<T_PF_APPROVE>
 | 
					    public partial class ApproveController : AuthorizeApiController<T_PF_APPROVE>
 | 
				
			||||||
@ -43,8 +44,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        IFMDepartmentService DepartmentService { get; set; }
 | 
					        IFMDepartmentService DepartmentService { get; set; }
 | 
				
			||||||
        IFMUserService UserService { get; set; }
 | 
					        IFMUserService UserService { get; set; }
 | 
				
			||||||
 | 
					        IOPTenantDBConnService OPTenantDBConnService { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public ApproveController(IFMNotificationTaskService notificationTaskService, IPFSysLogService sysLogService, IRepository repository, IPFCodeRuleService codeRuleService, IFMDepartmentService departmentService, IFMUserService userService)
 | 
					        public ApproveController(IFMNotificationTaskService notificationTaskService, IPFSysLogService sysLogService, IRepository repository, IPFCodeRuleService codeRuleService, IFMDepartmentService departmentService, IFMUserService userService, IOPTenantDBConnService oPTenantDBConnService)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            NotificationTaskService = notificationTaskService;
 | 
					            NotificationTaskService = notificationTaskService;
 | 
				
			||||||
            SysLogService = sysLogService;
 | 
					            SysLogService = sysLogService;
 | 
				
			||||||
@ -52,6 +54,7 @@
 | 
				
			|||||||
            CodeRuleService = codeRuleService;
 | 
					            CodeRuleService = codeRuleService;
 | 
				
			||||||
            DepartmentService = departmentService;
 | 
					            DepartmentService = departmentService;
 | 
				
			||||||
            UserService = userService;
 | 
					            UserService = userService;
 | 
				
			||||||
 | 
					            OPTenantDBConnService = oPTenantDBConnService;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 更新或新增数据
 | 
					        /// 更新或新增数据
 | 
				
			||||||
@ -645,18 +648,42 @@
 | 
				
			|||||||
        [HttpPost, Route("FullGet")]
 | 
					        [HttpPost, Route("FullGet")]
 | 
				
			||||||
        public JsonActionResult<T_PF_APPROVE> FullGet([FromBody] KeywordFilter filter)
 | 
					        public JsonActionResult<T_PF_APPROVE> FullGet([FromBody] KeywordFilter filter)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var result = WitEntity(null, filter);
 | 
					            return SafeExecute(() =>
 | 
				
			||||||
            if (result.Data != null)
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                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)
 | 
					                    //这边怎么调用 原生的   GetEntity 方法
 | 
				
			||||||
                        result.Data.REJECT_INTERFACE = approveTemp.REJECT_INTERFACE;
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    string conn = OPTenantDBConnService.GetConnByORGID(new Guid(filter.Parameter1));
 | 
				
			||||||
 | 
					                    //var service = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<IFMNotificatoinService>();
 | 
				
			||||||
 | 
					                    filter.IgnoreOrgRule = true;
 | 
				
			||||||
 | 
					                    //filter.OrgId = null;
 | 
				
			||||||
 | 
					                    filter.SpecifyDbConn = conn;
 | 
				
			||||||
 | 
					                    filter.SpecifyTenant = "0005";
 | 
				
			||||||
 | 
					                    //var ccc = service.GetEntities<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var aaa = GetEntities<T_PF_APPROVE>(e => !e.IS_DELETED, filter, null);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                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();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                result.Data.Nav_ApproveDetails = result.Data.Nav_ApproveDetails.OrderBy(t => t.NUM).ThenBy(m => m.MODIFY_TIME).ToList();
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return result;
 | 
					                return result;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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 MineType { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public string[] DataRule { get; set; }
 | 
					        public string[] DataRule { get; set; }
 | 
				
			||||||
 | 
					        public bool IsHead { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user