同步
This commit is contained in:
		
							parent
							
								
									722f55910a
								
							
						
					
					
						commit
						3c2294619a
					
				
							
								
								
									
										61764
									
								
								APT.Data.Migrations/Migrations/20240305055742_wyw2024030501.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										61764
									
								
								APT.Data.Migrations/Migrations/20240305055742_wyw2024030501.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -0,0 +1,74 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using Microsoft.EntityFrameworkCore.Migrations;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace APT.Data.Migrations.Migrations
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public partial class wyw2024030501 : Migration
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        protected override void Up(MigrationBuilder migrationBuilder)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<bool>(
 | 
				
			||||||
 | 
					                name: "ISNEEDTOUP",
 | 
				
			||||||
 | 
					                table: "T_BS_SAFE_CHECK",
 | 
				
			||||||
 | 
					                type: "bit",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<Guid>(
 | 
				
			||||||
 | 
					                name: "CHECK_TYPE_ID",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT",
 | 
				
			||||||
 | 
					                type: "uniqueidentifier",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<Guid>(
 | 
				
			||||||
 | 
					                name: "CHECK_TYPE_LEVEL_ID",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT",
 | 
				
			||||||
 | 
					                type: "uniqueidentifier",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<string>(
 | 
				
			||||||
 | 
					                name: "DESCRIBE",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT",
 | 
				
			||||||
 | 
					                type: "nvarchar(max)",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<int>(
 | 
				
			||||||
 | 
					                name: "SUBMIT_STATUS",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT",
 | 
				
			||||||
 | 
					                type: "int",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.AddColumn<DateTime>(
 | 
				
			||||||
 | 
					                name: "LastDateSystem",
 | 
				
			||||||
 | 
					                table: "T_BS_CHECK_QUESTION",
 | 
				
			||||||
 | 
					                type: "datetime2",
 | 
				
			||||||
 | 
					                nullable: true);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected override void Down(MigrationBuilder migrationBuilder)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "ISNEEDTOUP",
 | 
				
			||||||
 | 
					                table: "T_BS_SAFE_CHECK");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "CHECK_TYPE_ID",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "CHECK_TYPE_LEVEL_ID",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "DESCRIBE",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "SUBMIT_STATUS",
 | 
				
			||||||
 | 
					                table: "T_BS_RISK_SUBMIT_CONTENT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropColumn(
 | 
				
			||||||
 | 
					                name: "LastDateSystem",
 | 
				
			||||||
 | 
					                table: "T_BS_CHECK_QUESTION");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -18695,6 +18695,9 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                    b.Property<bool>("IS_DELETED")
 | 
					                    b.Property<bool>("IS_DELETED")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<DateTime?>("LastDateSystem")
 | 
				
			||||||
 | 
					                        .HasColumnType("datetime2");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<Guid?>("MODIFIER_ID")
 | 
					                    b.Property<Guid?>("MODIFIER_ID")
 | 
				
			||||||
                        .HasColumnType("uniqueidentifier");
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -19500,6 +19503,12 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                    b.Property<Guid?>("CHECK_QUESTION_ID")
 | 
					                    b.Property<Guid?>("CHECK_QUESTION_ID")
 | 
				
			||||||
                        .HasColumnType("uniqueidentifier");
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<Guid?>("CHECK_TYPE_ID")
 | 
				
			||||||
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<Guid?>("CHECK_TYPE_LEVEL_ID")
 | 
				
			||||||
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<Guid?>("CHECK_USER_ID")
 | 
					                    b.Property<Guid?>("CHECK_USER_ID")
 | 
				
			||||||
                        .HasColumnType("uniqueidentifier");
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -19541,6 +19550,9 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                        .HasMaxLength(500)
 | 
					                        .HasMaxLength(500)
 | 
				
			||||||
                        .HasColumnType("nvarchar(500)");
 | 
					                        .HasColumnType("nvarchar(500)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("DESCRIBE")
 | 
				
			||||||
 | 
					                        .HasColumnType("nvarchar(max)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<int>("ENTITY_ORG_TPYE")
 | 
					                    b.Property<int>("ENTITY_ORG_TPYE")
 | 
				
			||||||
                        .HasColumnType("int");
 | 
					                        .HasColumnType("int");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -19643,6 +19655,9 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                    b.Property<DateTime?>("SUBMITFINISHTIME")
 | 
					                    b.Property<DateTime?>("SUBMITFINISHTIME")
 | 
				
			||||||
                        .HasColumnType("datetime2");
 | 
					                        .HasColumnType("datetime2");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<int?>("SUBMIT_STATUS")
 | 
				
			||||||
 | 
					                        .HasColumnType("int");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<Guid?>("USER_ID")
 | 
					                    b.Property<Guid?>("USER_ID")
 | 
				
			||||||
                        .HasColumnType("uniqueidentifier");
 | 
					                        .HasColumnType("uniqueidentifier");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20979,6 +20994,9 @@ namespace APT.Data.Migrations.Migrations
 | 
				
			|||||||
                    b.Property<bool>("ISFINISHINTTIME")
 | 
					                    b.Property<bool>("ISFINISHINTTIME")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<bool?>("ISNEEDTOUP")
 | 
				
			||||||
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<bool>("IS_DELETED")
 | 
					                    b.Property<bool>("IS_DELETED")
 | 
				
			||||||
                        .HasColumnType("bit");
 | 
					                        .HasColumnType("bit");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -89,5 +89,13 @@ namespace APT.MS.Domain.Entities.BS
 | 
				
			|||||||
        [Description("是否重大隐患")]
 | 
					        [Description("是否重大隐患")]
 | 
				
			||||||
        [DataFieldIngore]
 | 
					        [DataFieldIngore]
 | 
				
			||||||
        public int SERIOUS_RISK { get; set; }
 | 
					        public int SERIOUS_RISK { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 系统整改期限(手动隐患上报 选择问题后 默认加载 系统整改期限)
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("系统整改期限")]
 | 
				
			||||||
 | 
					        [DataFieldIngore]
 | 
				
			||||||
 | 
					        public DateTime? LastDateSystem { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -520,5 +520,37 @@ namespace APT.MS.Domain.Entities.BS
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Description("是否按时完成")]
 | 
					        [Description("是否按时完成")]
 | 
				
			||||||
        public bool? ISFINISHINTTIME { get; set; }
 | 
					        public bool? ISFINISHINTTIME { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 上报描述(手动隐患上报输入文本)
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("上报描述")]
 | 
				
			||||||
 | 
					        [DataFieldLength(500)]
 | 
				
			||||||
 | 
					        [FormFieldTable]
 | 
				
			||||||
 | 
					        [FormFieldEdit]
 | 
				
			||||||
 | 
					        [FormFieldQuery]
 | 
				
			||||||
 | 
					        public string DESCRIBE { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 检查类型 BS073
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("检查类型")]
 | 
				
			||||||
 | 
					        [DataFieldIngore]
 | 
				
			||||||
 | 
					        public Guid? CHECK_TYPE_ID { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 检查层级 BS073
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("检查层级")]
 | 
				
			||||||
 | 
					        [DataFieldIngore]
 | 
				
			||||||
 | 
					        public Guid? CHECK_TYPE_LEVEL_ID { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 状态 BS073
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("状态")]
 | 
				
			||||||
 | 
					        [DataFieldIngore]
 | 
				
			||||||
 | 
					        public int? SUBMIT_STATUS { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -327,5 +327,11 @@ namespace APT.MS.Domain.Entities.BS
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Description("时间限制")]
 | 
					        [Description("时间限制")]
 | 
				
			||||||
        public DateTime? LIMITDATETIME { get; set; }
 | 
					        public DateTime? LIMITDATETIME { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 是否需要上报 报表用
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("是否需要上报")]
 | 
				
			||||||
 | 
					        public bool? ISNEEDTOUP { get; set; }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1022,6 +1022,12 @@ namespace APT.MS.Domain.Enums
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Description("用户自定义上报")]
 | 
					        [Description("用户自定义上报")]
 | 
				
			||||||
        User = 20,
 | 
					        User = 20,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// TPM 对接
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        [Description("TPM对接")]
 | 
				
			||||||
 | 
					        TPM = 30,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -93,7 +93,11 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        if (item.Field == "Nav_ListCategoryType.CHECK_TYPE_ID")
 | 
					                        if (item.Field == "Nav_ListCategoryType.CHECK_TYPE_ID")
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            CHECK_TYPE_ID = new Guid(item.Value.ToString());
 | 
					                            try
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                CHECK_TYPE_ID = new Guid(item.Value.ToString());
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            catch { }
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else if (item.Field == "RISK_SUBMIT_ID")
 | 
					                        else if (item.Field == "RISK_SUBMIT_ID")
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					using APT.BaseData.Domain.Entities;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.Entities.FM;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.Enums;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.IServices;
 | 
				
			||||||
 | 
					using APT.BaseData.Domain.IServices.FM;
 | 
				
			||||||
 | 
					using APT.Infrastructure.Core;
 | 
				
			||||||
 | 
					using APT.MS.Domain.Entities.BS;
 | 
				
			||||||
 | 
					using APT.MS.Domain.Entities.HM;
 | 
				
			||||||
 | 
					using APT.MS.Domain.Enums;
 | 
				
			||||||
 | 
					using APT.Utility;
 | 
				
			||||||
 | 
					using APT.WebApi.Models;
 | 
				
			||||||
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using System.Linq.Expressions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace APT.BS.WebApi.Controllers.Api
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    [Route("api/BS/BSRiskSubmitContent")]
 | 
				
			||||||
 | 
					    public partial class BSRiskSubmitContentController : AuthorizeApiController<T_BS_RISK_SUBMIT_CONTENT>
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        IFMFlowPermitService MFlowPermitService { get; set; }
 | 
				
			||||||
 | 
					        IFMNotificationTaskService NotificationTaskService { get; set; }
 | 
				
			||||||
 | 
					        IPFCodeRuleService CodeRuleService { get; set; }
 | 
				
			||||||
 | 
					        IPFApproveCallBackService ApproveCallBackService { get; set; }
 | 
				
			||||||
 | 
					        public BSRiskSubmitContentController(IFMNotificationTaskService notificationTaskService, IFMFlowPermitService mFlowPermitService, IPFCodeRuleService codeRuleService, IPFApproveCallBackService approveCallBackService)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            NotificationTaskService = notificationTaskService;
 | 
				
			||||||
 | 
					            MFlowPermitService = mFlowPermitService;
 | 
				
			||||||
 | 
					            CodeRuleService = codeRuleService;
 | 
				
			||||||
 | 
					            ApproveCallBackService = approveCallBackService;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 排序分页查询数据
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="pageFilter">分页过滤实体</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("OrderPaged")]
 | 
				
			||||||
 | 
					        public PagedActionResult<T_BS_RISK_SUBMIT_CONTENT> OrderPaged([FromBody] KeywordPageFilter pageFilter)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return WitOrderPaged(e => e.Nav_Submit.SUBMIT_TYPE != 10, pageFilter);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -598,6 +598,36 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                            list.Add(model);
 | 
					                            list.Add(model);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    #region   验收人 默认为 责任组织 上一级的安全员
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var listDepID = list.Where(e => e.DEPARTMENT_ID.HasValue).Select(e => e.DEPARTMENT_ID.Value).Distinct();
 | 
				
			||||||
 | 
					                    if (listDepID != null && listDepID.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        var listDeps = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null);
 | 
				
			||||||
 | 
					                        listDepID = listDeps.Where(e => e.PARENT_ID.HasValue).Select(e => e.PARENT_ID.Value).Distinct();
 | 
				
			||||||
 | 
					                        var listRole = GetEntities<T_PF_APPROVAL_ROLE>(e => e.NAME.Contains("安全员"), null, null);
 | 
				
			||||||
 | 
					                        if (listRole != null && listRole.Any())
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            var listRoleID = listRole.Select(e => e.ID);
 | 
				
			||||||
 | 
					                            var listHeader = GetEntities<T_FM_USER>(e => listDepID.Contains(e.DEPARTMENT_ID.Value) && e.APPROVE_ROLE_ID.HasValue && listRoleID.Contains(e.APPROVE_ROLE_ID.Value), null, null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            foreach (var item in list)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                if (item.DEPARTMENT_ID.HasValue)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    var depThis = listDeps.FirstOrDefault(e => e.ID == item.DEPARTMENT_ID.Value);
 | 
				
			||||||
 | 
					                                    if (depThis != null && depThis.PARENT_ID.HasValue)
 | 
				
			||||||
 | 
					                                    {
 | 
				
			||||||
 | 
					                                        T_FM_USER userTemp = listHeader.FirstOrDefault(x => x.DEPARTMENT_ID == depThis.PARENT_ID.Value);
 | 
				
			||||||
 | 
					                                        item.CHECK_USER_ID = userTemp.ID;
 | 
				
			||||||
 | 
					                                        item.Nav_UserCheck = userTemp;
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    #endregion
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                result.Data = list;
 | 
					                result.Data = list;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@ -2599,27 +2629,68 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                Guid LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
 | 
					                Guid LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value;
 | 
				
			||||||
                var DataID = new Guid(filter.Keyword);
 | 
					                var DataID = new Guid(filter.Keyword);
 | 
				
			||||||
                var TaskID = new Guid(filter.Parameter1);
 | 
					                var TaskID = new Guid(filter.Parameter1);
 | 
				
			||||||
                //var entityDeal = GetEntity<T_BS_RISK_SUBMIT_CONTENT_DEAL>(DataID, new string[] { "Nav_SubmitContent.Nav_UserActualDeal" });
 | 
					 | 
				
			||||||
                int riskContentState = (int)RiskContentState.ActualDealChange;
 | 
					 | 
				
			||||||
                var entityDeal = GetEntity<T_BS_RISK_SUBMIT_CONTENT_DEAL>(e => e.RISK_SUBMIT_NOTICE_PERSON_ID == DataID && e.Nav_SubmitContent.ACTUAL_DEAL_USER_ID == LoginID && e.Nav_SubmitContent.RiskContentState == riskContentState, new string[] { "Nav_SubmitContent.Nav_UserActualDeal" });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //指定后 给整改落实人 发送通知
 | 
					                //指定后 给整改落实人 发送通知
 | 
				
			||||||
                T_FM_NOTIFICATION_TASK task = null;
 | 
					                T_FM_NOTIFICATION_TASK task = null;
 | 
				
			||||||
                GetEntityTask(TaskID, ref task);
 | 
					                GetEntityTask(TaskID, ref task);
 | 
				
			||||||
                var entity = entityDeal.Nav_SubmitContent;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                entity.RiskContentState = (int)RiskContentState.ActualDealCheck;//落实整改人已经查阅整改通知
 | 
					                int riskContentState = (int)RiskContentState.ActualDealChange;
 | 
				
			||||||
                                                                                //DateTime dtTaskEndTime = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_DealRisk, entity.ORG_ID.Value, DateTime.Now, null, entity.LastDateUser.Value);
 | 
					                var entityDeal = GetEntities<T_BS_RISK_SUBMIT_CONTENT_DEAL>(e => e.RISK_SUBMIT_NOTICE_PERSON_ID == DataID && e.Nav_SubmitContent.ACTUAL_DEAL_USER_ID == LoginID && e.Nav_SubmitContent.RiskContentState == riskContentState, null, "Nav_SubmitContent");
 | 
				
			||||||
                DateTime dtTaskEndTime = entity.LastDateUser.Value;//隐患整改 按 整改结束时间
 | 
					                List<T_FM_NOTIFICATION_TASK> listTask = new List<T_FM_NOTIFICATION_TASK>();
 | 
				
			||||||
                var notice = NotificationTaskService.InsertUserNoticeTaskModel("隐患整改单:" + entity.NAME.Replace("隐患整改通知:", ""), entityDeal.ID, entity.ORG_ID, entity.ACTUAL_DEAL_USER_ID.Value, entity.Nav_UserActualDeal.NAME, DateTime.Now, dtTaskEndTime, (int)FMNoticeTypeEnum.消息, "BS044");
 | 
					                List<T_BS_RISK_SUBMIT_CONTENT> listContents = new List<T_BS_RISK_SUBMIT_CONTENT>();
 | 
				
			||||||
 | 
					                IEnumerable<T_FM_USER> listUser = null;
 | 
				
			||||||
 | 
					                if (entityDeal != null && entityDeal.Any())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var listUserID = entityDeal.Where(e => e.ACTUAL_DEAL_USER_ID.HasValue).Select(e => e.ACTUAL_DEAL_USER_ID.Value).Distinct();
 | 
				
			||||||
 | 
					                    if (listUserID != null && listUserID.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        listUser = GetEntities<T_FM_USER>(e => listUserID.Contains(e.ID), null);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                foreach (var item in entityDeal)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var entity = item.Nav_SubmitContent;
 | 
				
			||||||
 | 
					                    listContents.Add(entity);
 | 
				
			||||||
 | 
					                    entity.RiskContentState = (int)RiskContentState.ActualDealCheck;
 | 
				
			||||||
 | 
					                    listTask.Add(NotificationTaskService.InsertUserNoticeTaskModel("隐患整改单:" + entity.NAME.Replace("隐患整改通知:", ""), item.ID, entity.ORG_ID, entity.ACTUAL_DEAL_USER_ID.Value, listUser.FirstOrDefault(e => e.ID == entity.ACTUAL_DEAL_USER_ID.Value)?.NAME, DateTime.Now, item.Nav_SubmitContent.LastDateUser.Value, (int)FMNoticeTypeEnum.消息, "BS044"));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                this.UnifiedCommit(() =>
 | 
					                this.UnifiedCommit(() =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    UpdateEntityNoCommit(entity);//保存信息 整改落实人
 | 
					                    //UpdateEntityNoCommit(entity);//保存信息 整改落实人
 | 
				
			||||||
                    UpdateEntityNoCommit(notice);
 | 
					                    if (listContents != null && listContents.Any())
 | 
				
			||||||
 | 
					                        BantchSaveEntityNoCommit(listContents);
 | 
				
			||||||
 | 
					                    if (listTask != null && listTask.Any())
 | 
				
			||||||
 | 
					                        BantchSaveEntityNoCommit(listTask);
 | 
				
			||||||
                    if (task != null)//代办消息 清除
 | 
					                    if (task != null)//代办消息 清除
 | 
				
			||||||
                        UpdateEntityNoCommit(task, "NOTICE_STATUS", "TASK_DT", "MODIFIER_ID");
 | 
					                        UpdateEntityNoCommit(task, "NOTICE_STATUS", "TASK_DT", "MODIFIER_ID");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #region   旧版有问题 通知有多条记录 就发一个整改
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //int riskContentState = (int)RiskContentState.ActualDealChange;
 | 
				
			||||||
 | 
					                //var entityDeal = GetEntity<T_BS_RISK_SUBMIT_CONTENT_DEAL>(e => e.RISK_SUBMIT_NOTICE_PERSON_ID == DataID && e.Nav_SubmitContent.ACTUAL_DEAL_USER_ID == LoginID && e.Nav_SubmitContent.RiskContentState == riskContentState, new string[] { "Nav_SubmitContent.Nav_UserActualDeal" });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                ////指定后 给整改落实人 发送通知
 | 
				
			||||||
 | 
					                //T_FM_NOTIFICATION_TASK task = null;
 | 
				
			||||||
 | 
					                //GetEntityTask(TaskID, ref task);
 | 
				
			||||||
 | 
					                //var entity = entityDeal.Nav_SubmitContent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //entity.RiskContentState = (int)RiskContentState.ActualDealCheck;//落实整改人已经查阅整改通知
 | 
				
			||||||
 | 
					                //                                                                //DateTime dtTaskEndTime = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_DealRisk, entity.ORG_ID.Value, DateTime.Now, null, entity.LastDateUser.Value);
 | 
				
			||||||
 | 
					                //DateTime dtTaskEndTime = entity.LastDateUser.Value;//隐患整改 按 整改结束时间
 | 
				
			||||||
 | 
					                //var notice = NotificationTaskService.InsertUserNoticeTaskModel("隐患整改单:" + entity.NAME.Replace("隐患整改通知:", ""), entityDeal.ID, entity.ORG_ID, entity.ACTUAL_DEAL_USER_ID.Value, entity.Nav_UserActualDeal.NAME, DateTime.Now, dtTaskEndTime, (int)FMNoticeTypeEnum.消息, "BS044");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //this.UnifiedCommit(() =>
 | 
				
			||||||
 | 
					                //{
 | 
				
			||||||
 | 
					                //    UpdateEntityNoCommit(entity);//保存信息 整改落实人
 | 
				
			||||||
 | 
					                //    UpdateEntityNoCommit(notice);
 | 
				
			||||||
 | 
					                //    if (task != null)//代办消息 清除
 | 
				
			||||||
 | 
					                //        UpdateEntityNoCommit(task, "NOTICE_STATUS", "TASK_DT", "MODIFIER_ID");
 | 
				
			||||||
 | 
					                //});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #endregion
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -2780,7 +2851,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        DateTime dtEndTime = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_Deal_Check, entity.ORG_ID.Value, DateTime.Now, null, content.LastDateUser);
 | 
					                        DateTime dtEndTime = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_Deal_Check, entity.ORG_ID.Value, DateTime.Now, null, content.LastDateUser);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        notice = NotificationTaskService.InsertUserNoticeTaskModel("责任人确认整改:" + entity.NAME, entity.ID, entity.ORG_ID, entity.DEAL_USER_ID.Value, userDealName, DateTime.Now, dtEndTime, (int)FMNoticeTypeEnum.消息, "BS044_CHECK");
 | 
					                        notice = NotificationTaskService.InsertUserNoticeTaskModel("责任人确认整改:" + entity.NAME, entity.ID, entity.ORG_ID, entity.DEAL_USER_ID.Value, userDealName, DateTime.Now, dtEndTime, (int)FMNoticeTypeEnum.消息, "BS044_CHECK");//隐患整改记录:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        T_FM_NOTIFICATION_TASK task = null;
 | 
					                        T_FM_NOTIFICATION_TASK task = null;
 | 
				
			||||||
                        GetEntityTask(entity.TaskID, ref task, "BS044_SHOWPRINT");
 | 
					                        GetEntityTask(entity.TaskID, ref task, "BS044_SHOWPRINT");
 | 
				
			||||||
@ -3363,7 +3434,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
            //sysFilter.CodeType = (int)PFCodeRuleType.审批流编码;
 | 
					            //sysFilter.CodeType = (int)PFCodeRuleType.审批流编码;
 | 
				
			||||||
            //sysFilter.Count = 2;
 | 
					            //sysFilter.Count = 2;
 | 
				
			||||||
            //sysFilter.OrgId = filter.OrgId;
 | 
					            //sysFilter.OrgId = filter.OrgId;
 | 
				
			||||||
            //var serialCode = CodeRuleService.NewGenSerial(sysFilter);
 | 
					            ////var serialCode = CodeRuleService.NewGenSerial(sysFilter);
 | 
				
			||||||
            //List<string> listCode = CodeRuleService.NewGenSerial(sysFilter).Split(',').ToList();
 | 
					            //List<string> listCode = CodeRuleService.NewGenSerial(sysFilter).Split(',').ToList();
 | 
				
			||||||
            return SafeExecute<bool>(() =>
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@ -3444,7 +3515,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                        entity.ISDEALSIGN = true;
 | 
					                        entity.ISDEALSIGN = true;
 | 
				
			||||||
                        entity.DATETIME_DEALSIGN = DateTime.Now;
 | 
					                        entity.DATETIME_DEALSIGN = DateTime.Now;
 | 
				
			||||||
                        DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_Checker_Check, entity.ORG_ID.Value, DateTime.Now, null, content.LastDateUser);
 | 
					                        DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_Checker_Check, entity.ORG_ID.Value, DateTime.Now, null, content.LastDateUser);
 | 
				
			||||||
                        var notice = NotificationTaskService.InsertUserNoticeTaskModel("验收人确认整改:" + entity.NAME, entity.ID, entity.ORG_ID, entity.CHECK_USER_ID.Value, entity.Nav_UserCheck.NAME, DateTime.Now, dtEnd, (int)FMNoticeTypeEnum.消息, "BS044_CHECK");
 | 
					                        var notice = NotificationTaskService.InsertUserNoticeTaskModel("验收人确认整改:" + entity.NAME, entity.ID, entity.ORG_ID, entity.CHECK_USER_ID.Value, entity.Nav_UserCheck.NAME, DateTime.Now, dtEnd, (int)FMNoticeTypeEnum.消息, "BS044_CHECK");//隐患整改验收单
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        this.UnifiedCommit(() =>
 | 
					                        this.UnifiedCommit(() =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
@ -3493,18 +3564,22 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            entity.Nav_Submit = this.GetEntity<T_BS_RISK_SUBMIT>(entity.RISK_SUBMIT_ID.Value);
 | 
					                            entity.Nav_Submit = this.GetEntity<T_BS_RISK_SUBMIT>(entity.RISK_SUBMIT_ID.Value);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
                        var code = DateTime.Now.ToString("yyyyMMddHHmm");
 | 
					                        var code = DateTime.Now.ToString("yyyyMMddHHmm");
 | 
				
			||||||
                        List<string> listCode = new List<string>() { code + "1", code + "2" };
 | 
					                        List<string> listCode = new List<string>() { code + "1", code + "2" };
 | 
				
			||||||
 | 
					                        Guid approveUserId = entity.Nav_Submit.CREATER_ID.Value;
 | 
				
			||||||
                        //审批流
 | 
					                        //审批流
 | 
				
			||||||
 | 
					                        if (entity.Nav_Submit.SUBMIT_TYPE != 10)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            //如果非检查上报 按责任人 找审批流
 | 
				
			||||||
 | 
					                            approveUserId = entity.DEAL_USER_ID.Value;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        MFlowPermitService.InsertApprove(listCode[0], "BS043", parms, entity.ID, "BS044_SHOWPRINT", TaskID, true, () =>
 | 
					                        MFlowPermitService.InsertApprove(listCode[0], "BS043", parms, entity.ID, "BS044_SHOWPRINT", TaskID, true, () =>
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            if (entity != null)
 | 
					                            if (entity != null)
 | 
				
			||||||
                                UpdateEntityNoCommit(entity);   //保存主表 NoCommit
 | 
					                                UpdateEntityNoCommit(entity);   //保存主表 NoCommit
 | 
				
			||||||
                                                                //BantchSaveEntityNoCommit(sign);    //验收人签名
 | 
					                                                                //BantchSaveEntityNoCommit(sign);    //验收人签名
 | 
				
			||||||
                            UpdateEntityNoCommit(content);//上报明细 修改状态
 | 
					                            UpdateEntityNoCommit(content);//上报明细 修改状态
 | 
				
			||||||
                        }, entity.APPROVE_ID, entity.Nav_Submit.CREATER_ID.Value, null, null, listCode[1], "", null, "", FMTASKTYPE.BS_RiskUp_DealAudit);
 | 
					                        }, entity.APPROVE_ID, approveUserId, null, null, listCode[1], "", null, "", FMTASKTYPE.BS_RiskUp_DealAudit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        #endregion
 | 
					                        #endregion
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -5256,7 +5331,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                                modelNotice.ID = Guid.NewGuid();
 | 
					                                modelNotice.ID = Guid.NewGuid();
 | 
				
			||||||
                                modelNotice.CODE = entity.CODE + "_" + (listParam.Count() + 1).ToString();
 | 
					                                modelNotice.CODE = entity.CODE + "_" + (listParam.Count() + 1).ToString();
 | 
				
			||||||
                                modelNotice.NAME = entity.NAME + ((BSQuestionLevelEnum)item.QUESTION_LEVEL).GetDescription();
 | 
					                                modelNotice.NAME = entity.NAME + ((BSQuestionLevelEnum)item.QUESTION_LEVEL).GetDescription() + "级隐患"; 
 | 
				
			||||||
                                modelNotice.RISK_SUBMIT_ID = item.RISK_SUBMIT_ID.Value;
 | 
					                                modelNotice.RISK_SUBMIT_ID = item.RISK_SUBMIT_ID.Value;
 | 
				
			||||||
                                modelNotice.QUESTION_LEVEL = item.QUESTION_LEVEL;
 | 
					                                modelNotice.QUESTION_LEVEL = item.QUESTION_LEVEL;
 | 
				
			||||||
                                modelNotice.NOTICETIME = DateTime.Now;
 | 
					                                modelNotice.NOTICETIME = DateTime.Now;
 | 
				
			||||||
@ -5496,6 +5571,812 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #region     隐患上报 新版 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 隐患上报  手动  转给领导
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="entity"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("FullUpdateUserNew")]
 | 
				
			||||||
 | 
					        public JsonActionResult<bool> FullUpdateUserNew([FromBody] T_BS_RISK_SUBMIT_CONTENT entity)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                var files = entity.Nav_Files;
 | 
				
			||||||
 | 
					                entity.Nav_Files = null;
 | 
				
			||||||
 | 
					                //entity.RiskContentState  5 10   需要处理
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #region    必填判断
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entity.RiskContentState == 10)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (!entity.RISK_AREA_ID.HasValue)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("检查区域不能为空!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(entity.ADDRESS))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("隐患地点不能为空!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (string.IsNullOrEmpty(entity.DESCRIBE))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("请填写上报描述!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (entity.DESCRIBE.Length > 500)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("上报描述不能超过500字!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (files.Count < 1)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("请上传附件!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                T_BS_RISK_SUBMIT risk = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entity.RISK_SUBMIT_ID == null || entity.RISK_SUBMIT_ID == Guid.Empty)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    risk = new T_BS_RISK_SUBMIT();
 | 
				
			||||||
 | 
					                    risk.ID = Guid.NewGuid();
 | 
				
			||||||
 | 
					                    risk.ORG_ID = entity.ORG_ID;
 | 
				
			||||||
 | 
					                    risk.SUBMIT_STATUS = entity.RiskContentState;
 | 
				
			||||||
 | 
					                    risk.NAME = "手动隐患上报";
 | 
				
			||||||
 | 
					                    if (!risk.CHECKTIME.HasValue)
 | 
				
			||||||
 | 
					                        risk.CHECKTIME = DateTime.Now;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(entity.CODE))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (entity.TaskID != Guid.Empty)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            entity.CODE = "TPM" + DateTime.Now.ToString("yyyyMMddHHmm");
 | 
				
			||||||
 | 
					                            risk.SUBMIT_TYPE = (int)SUBMIT_TYPE.TPM;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            entity.CODE = "SDSB" + DateTime.Now.ToString("yyyyMMddHHmm");
 | 
				
			||||||
 | 
					                            risk.SUBMIT_TYPE = (int)SUBMIT_TYPE.User;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    risk.CODE = entity.CODE;
 | 
				
			||||||
 | 
					                    risk.USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
				
			||||||
 | 
					                    risk.DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    entity.RISK_SUBMIT_ID = risk.ID;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //risk = entity.Nav_Submit;
 | 
				
			||||||
 | 
					                    risk = GetEntity<T_BS_RISK_SUBMIT>(entity.RISK_SUBMIT_ID.Value);
 | 
				
			||||||
 | 
					                    risk.SUBMIT_STATUS = entity.RiskContentState;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                foreach (var item in files)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    item.RISK_SUBMIT_ID = risk.ID;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                T_FM_NOTIFICATION_TASK taskMaster = null;
 | 
				
			||||||
 | 
					                T_FM_NOTIFICATION_TASK taskEnd = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //手动上报 保存并发送 通知安全员
 | 
				
			||||||
 | 
					                if (risk.SUBMIT_STATUS == (int)BSSubmitStatusEnum.Temp)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Guid UserId = Guid.Empty;
 | 
				
			||||||
 | 
					                    string userName = String.Empty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    #region     版本 2  本层级找 安全员 找不到就找负责人 (如果是负责人 就是自己)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var master = GetEntity<T_FM_USER>(risk.USER_ID.Value, "Nav_Department");
 | 
				
			||||||
 | 
					                    if (master.Nav_Department == null)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("未获取到您的组织信息,操作失败!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (master.Nav_Department.USER_ID.HasValue && master.Nav_Department.USER_ID.Value == risk.USER_ID.Value)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        //如果自己是负责人 就是自己
 | 
				
			||||||
 | 
					                        UserId = risk.USER_ID.Value;
 | 
				
			||||||
 | 
					                        userName = master.NAME;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        //找安全员 如果没有 找负责人
 | 
				
			||||||
 | 
					                        // 班组 班长 否则 安全员  FMDepartmentType 部门=0,  车间=1,   班组=2,  公司=3
 | 
				
			||||||
 | 
					                        if (master.Nav_Department.DEPARTMENT_TYPE == 2)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            if (master.Nav_Department.USER_ID.HasValue)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                UserId = master.Nav_Department.USER_ID.Value;
 | 
				
			||||||
 | 
					                                userName = GetEntity<T_FM_USER>(UserId)?.NAME;
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            else
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                var userSafe = GetEntity<T_FM_USER>(e => !e.IS_DELETED && e.DEPARTMENT_ID == master.DEPARTMENT_ID && e.Nav_ApproveRole.NAME.Contains("负责人"));
 | 
				
			||||||
 | 
					                                if (userSafe != null)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    UserId = userSafe.ID;
 | 
				
			||||||
 | 
					                                    userName = userSafe.NAME;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            var userSafe = GetEntity<T_FM_USER>(e => !e.IS_DELETED && e.DEPARTMENT_ID == master.DEPARTMENT_ID && e.Nav_ApproveRole.NAME.Contains("安全员"));
 | 
				
			||||||
 | 
					                            if (userSafe != null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                UserId = userSafe.ID;
 | 
				
			||||||
 | 
					                                userName = userSafe.NAME;
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            else
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                userSafe = GetEntity<T_FM_USER>(e => !e.IS_DELETED && e.DEPARTMENT_ID == master.DEPARTMENT_ID && e.Nav_ApproveRole.NAME.Contains("负责人"));
 | 
				
			||||||
 | 
					                                if (userSafe != null)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    UserId = userSafe.ID;
 | 
				
			||||||
 | 
					                                    userName = userSafe.NAME;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (UserId == Guid.Empty)//没找到给自己
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        UserId = risk.USER_ID.Value;
 | 
				
			||||||
 | 
					                        userName = master.NAME;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_PersonAdd, entity.ORG_ID.Value, DateTime.Now, null, null);
 | 
				
			||||||
 | 
					                    taskMaster = NotificationTaskService.InsertUserNoticeTaskModel("手动隐患上报-指定责任单位", entity.ID, risk.ORG_ID, UserId, userName, DateTime.Now, dtEnd, 0, "BS073");//原 BS061 
 | 
				
			||||||
 | 
					                    if (entity.TaskID != Guid.Empty)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        taskEnd = NotificationTaskService.GetEntityTask(entity.TaskID, "BS072_SHOWPRINT");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                entity.RiskContentState = null;
 | 
				
			||||||
 | 
					                this.UnifiedCommit(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (risk != null)
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(risk);
 | 
				
			||||||
 | 
					                    if (entity != null)
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(entity);
 | 
				
			||||||
 | 
					                    if (files != null && files.Any())
 | 
				
			||||||
 | 
					                        BantchSaveEntityNoCommit(files);
 | 
				
			||||||
 | 
					                    if (taskMaster != null)
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(taskMaster);
 | 
				
			||||||
 | 
					                    if (taskEnd != null)
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(taskEnd);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 选择整改实施单位 加载 责任人 验收人 
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="pageFilter"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("GetDpartMentMasterInfo")]
 | 
				
			||||||
 | 
					        public PagedActionResult<T_FM_DEPARTMENT> GetDpartMentMasterInfo([FromBody] KeywordPageFilter pageFilter)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeGetPagedData<T_FM_DEPARTMENT>((result) =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Expression<Func<T_FM_DEPARTMENT, bool>> expression = e => !e.IS_DELETED && e.ENABLE_STATUS == 0 && e.ORG_ID == pageFilter.OrgId;
 | 
				
			||||||
 | 
					                //var listDepartmentPage = this.GetPageEntities(expression, pageFilter, "Nav_User", "Nav_Parent.Nav_User");//框架报错
 | 
				
			||||||
 | 
					                //var c = this.GetPageEntities(expression, pageFilter);
 | 
				
			||||||
 | 
					                //result = this.GetPageEntities(expression, pageFilter, "Nav_User");//框架报错
 | 
				
			||||||
 | 
					                var sad = GetOrderPageEntities(expression, pageFilter, "Nav_User");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                var listDepartmentAll = this.GetEntities(expression, pageFilter, "Nav_User");//, "Nav_Parent"
 | 
				
			||||||
 | 
					                result.TotalCount = listDepartmentAll.Count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //result.Data = listDepartment;
 | 
				
			||||||
 | 
					                //result.TotalCount = listDepartment.Count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (result.TotalCount > 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var listDepartment = listDepartmentAll.OrderBy(e => e.NAME).Skip((pageFilter.PageIndex - 1) * pageFilter.Limit).Take(pageFilter.Limit);
 | 
				
			||||||
 | 
					                    List<Guid> listDepID = new List<Guid>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //责任人
 | 
				
			||||||
 | 
					                    listDepID = listDepartment.Where(e => !e.USER_ID.HasValue).Select(x => x.ID).ToList();
 | 
				
			||||||
 | 
					                    if (listDepID != null && listDepID.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        listDepID = listDepID.Distinct().ToList();
 | 
				
			||||||
 | 
					                        var listRole = GetEntities<T_PF_APPROVAL_ROLE>(e => e.NAME.Contains("负责人"), null, null);
 | 
				
			||||||
 | 
					                        var listRoleID = listRole.Select(e => e.ID);
 | 
				
			||||||
 | 
					                        if (listRoleID != null && listRoleID.Any())
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            var listHeader = GetEntities<T_FM_USER>(e => listDepID.Contains(e.DEPARTMENT_ID.Value) && e.APPROVE_ROLE_ID.HasValue && listRoleID.Contains(e.APPROVE_ROLE_ID.Value), null, null);
 | 
				
			||||||
 | 
					                            foreach (var item in listDepartment)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                if (!item.USER_ID.HasValue)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    T_FM_USER userTemp = null;
 | 
				
			||||||
 | 
					                                    userTemp = listHeader.FirstOrDefault(x => x.DEPARTMENT_ID == item.ID);
 | 
				
			||||||
 | 
					                                    if (userTemp != null)
 | 
				
			||||||
 | 
					                                        item.Nav_User = userTemp;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //验收人
 | 
				
			||||||
 | 
					                    listDepID = listDepartment.Where(e => e.PARENT_ID.HasValue).Select(e => e.PARENT_ID.Value).ToList();
 | 
				
			||||||
 | 
					                    if (listDepID != null && listDepID.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        listDepID = listDepID.Distinct().ToList();
 | 
				
			||||||
 | 
					                        var listP = GetEntities<T_FM_DEPARTMENT>(e => listDepID.Contains(e.ID), null);
 | 
				
			||||||
 | 
					                        var listRole = GetEntities<T_PF_APPROVAL_ROLE>(e => e.NAME.Contains("安全员"), null, null);
 | 
				
			||||||
 | 
					                        if (listRole != null && listRole.Any())
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            var listRoleID = listRole.Select(e => e.ID);
 | 
				
			||||||
 | 
					                            var listHeader = GetEntities<T_FM_USER>(e => listDepID.Contains(e.DEPARTMENT_ID.Value) && e.APPROVE_ROLE_ID.HasValue && listRoleID.Contains(e.APPROVE_ROLE_ID.Value), null, null);
 | 
				
			||||||
 | 
					                            foreach (var item in listP)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                T_FM_USER userTemp = null;
 | 
				
			||||||
 | 
					                                userTemp = listHeader.FirstOrDefault(x => x.DEPARTMENT_ID == item.ID);
 | 
				
			||||||
 | 
					                                if (userTemp != null)
 | 
				
			||||||
 | 
					                                    item.Nav_User = userTemp;//安全员临时装入此字段
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        //数据(父级部门及验收人)组装
 | 
				
			||||||
 | 
					                        foreach (var item in listDepartment)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            if (item.PARENT_ID.HasValue)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                item.Nav_Parent = listP.FirstOrDefault(e => e.ID == item.PARENT_ID.Value);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    result.Data = listDepartment;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 手动上报 指定责任单位  选择检查问题  按 问题等级 同时带出 系统整改期限
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="pageFilter">分页过滤实体</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("OrderPagedQuestion")]
 | 
				
			||||||
 | 
					        public PagedActionResult<T_BS_CHECK_QUESTION> OrderPagedQuestion([FromBody] KeywordPageFilter pageFilter)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeGetPagedData(delegate (PagedActionResult<T_BS_CHECK_QUESTION> result)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var resultT = GetOrderPageEntities<T_BS_CHECK_QUESTION>(null, pageFilter, null);
 | 
				
			||||||
 | 
					                if (resultT.TotalCount > 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    int RequestType = DataHelper.GetRequestType(HttpContext.Request.Headers);
 | 
				
			||||||
 | 
					                    foreach (var item in resultT.Data)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        int delayDays = GetDealyDays((int)item.QUESTION_LEVEL) + 1;
 | 
				
			||||||
 | 
					                        item.LastDateSystem = DateTime.Now.Date.AddDays(delayDays).AddSeconds(-1);//  Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")).AddDays(delayDays);
 | 
				
			||||||
 | 
					                        if (RequestType == 2)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            if (item.QUESTION_LEVEL > 0)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                item.QUESTION_LEVEL_SHOW = item.QUESTION_LEVEL.GetDescription();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                result.Data = resultT.Data;
 | 
				
			||||||
 | 
					                result.TotalCount = resultT.TotalCount;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //隐患上报和通知调整,取消整改通知责任人
 | 
				
			||||||
 | 
					        //1、明确需求 哪个步骤需要取消
 | 
				
			||||||
 | 
					        //2、BS061 去除 变成 BS042  审批流(审批流按 BS061 ) 责任单位 责任通知人  获取数据 整改实施单位 整改责任人(手动) (多添加 检查项目、项目分类 判断显示隐藏)
 | 
				
			||||||
 | 
					        //     BS006 加(整改期限 系统整改期限(查看) 整改实施单位 整改责任人 验收人)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 隐患上报表 (BS073)
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="entityContent"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        /// <exception cref="Exception"></exception>
 | 
				
			||||||
 | 
					        [HttpPost, Route("FullUpdateNew")]
 | 
				
			||||||
 | 
					        public JsonActionResult<bool> FullUpdateNew([FromBody] T_BS_RISK_SUBMIT_CONTENT entityContent)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var entity = entityContent.Nav_Submit;
 | 
				
			||||||
 | 
					                if (entity == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    entity = GetEntity<T_BS_RISK_SUBMIT>(entityContent.RISK_SUBMIT_ID.Value);
 | 
				
			||||||
 | 
					                    entity.SUBMIT_STATUS = entityContent.SUBMIT_STATUS;
 | 
				
			||||||
 | 
					                    if (entityContent.CHECK_TYPE_ID.HasValue)
 | 
				
			||||||
 | 
					                        entity.CHECK_TYPE_ID = entityContent.CHECK_TYPE_ID;
 | 
				
			||||||
 | 
					                    if (entityContent.CHECK_TYPE_LEVEL_ID.HasValue)
 | 
				
			||||||
 | 
					                        entity.CHECK_TYPE_LEVEL_ID = entityContent.CHECK_TYPE_LEVEL_ID;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                var files = entityContent.Nav_Files;
 | 
				
			||||||
 | 
					                entityContent.Nav_Files = null;
 | 
				
			||||||
 | 
					                var listRiskQuestionReason = entityContent.Nav_ListRiskQuestionReason;
 | 
				
			||||||
 | 
					                entityContent.Nav_ListRiskQuestionReason = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #region    数据完整性判断
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entity.SUBMIT_STATUS != (int)BSSubmitStatusEnum.Temp)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //手动上报
 | 
				
			||||||
 | 
					                    if (!entity.CHECK_TYPE_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("请选择检查类型!");
 | 
				
			||||||
 | 
					                    if (!entity.CHECK_TYPE_LEVEL_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("请选择检查层级!");
 | 
				
			||||||
 | 
					                    if (files == null)
 | 
				
			||||||
 | 
					                        throw new Exception("请上传附件,手动上报必须上传附件!");
 | 
				
			||||||
 | 
					                    if (DataHelper.GetRequestType(HttpContext.Request.Headers) != 2 || (DataHelper.GetRequestType(HttpContext.Request.Headers) == 2 && DateTime.Now.Month > 2))
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        //移动端 修改 版本兼容
 | 
				
			||||||
 | 
					                        if (!entityContent.CHECK_PROJECT_ID.HasValue)
 | 
				
			||||||
 | 
					                            throw new Exception("请选择的检查项目!");
 | 
				
			||||||
 | 
					                        if (!entityContent.CHECK_PROJECT_CATEGORY_ID.HasValue)
 | 
				
			||||||
 | 
					                            throw new Exception("请选择的检查项目分类!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (!entityContent.RISK_AREA_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("检查区域不能为空!");
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(entityContent.ADDRESS))
 | 
				
			||||||
 | 
					                        throw new Exception("隐患地点不能为空!");
 | 
				
			||||||
 | 
					                    if (!entityContent.CHECK_CONTENTS_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("检查内容不能为空!");
 | 
				
			||||||
 | 
					                    if (!entityContent.CHECK_QUESTION_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("检查问题不能为空!");
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(entityContent.DESCREPTION))
 | 
				
			||||||
 | 
					                        throw new Exception("检查问题不能为空!");
 | 
				
			||||||
 | 
					                    if (entityContent.QUESTION_LEVEL == 0)
 | 
				
			||||||
 | 
					                        throw new Exception("问题等级不能为空!");
 | 
				
			||||||
 | 
					                    if (string.IsNullOrEmpty(entityContent.DEMAND))
 | 
				
			||||||
 | 
					                        throw new Exception("整改建议与措施不能为空!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (!entityContent.LastDateUser.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("整改期限不能为空!");
 | 
				
			||||||
 | 
					                    else if (!entityContent.LastDateSystem.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("系统整改期限不能为空!");
 | 
				
			||||||
 | 
					                    else if (entityContent.LastDateUser.Value > entityContent.LastDateSystem.Value)
 | 
				
			||||||
 | 
					                        throw new Exception("整改期限不能大于系统整改期限!");
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                        entityContent.LastDateUser = entityContent.LastDateUser.Value.Date.AddDays(1).AddSeconds(-1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (listRiskQuestionReason == null || !listRiskQuestionReason.Any())
 | 
				
			||||||
 | 
					                        throw new Exception("隐患原因不能为空!");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (!entityContent.DEAL_DEPARTMENT_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("整改实施单位不能为空!");
 | 
				
			||||||
 | 
					                    if (!entityContent.DEAL_USER_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("整改责任人不能为空!");
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        entityContent.USER_ID = entityContent.DEAL_USER_ID;
 | 
				
			||||||
 | 
					                        entityContent.DEPARTMENT_ID = entityContent.DEAL_DEPARTMENT_ID;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (!entityContent.CHECK_USER_ID.HasValue)
 | 
				
			||||||
 | 
					                        throw new Exception("验收人不能为空!");
 | 
				
			||||||
 | 
					                    if (entityContent.DEAL_USER_ID.Value == entityContent.CHECK_USER_ID)
 | 
				
			||||||
 | 
					                        throw new Exception("整改责任人和验收人不能同一个人!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //entity.SUBMIT_TYPE = (int)SUBMIT_TYPE.User;
 | 
				
			||||||
 | 
					                if (!entity.CHECKTIME.HasValue)
 | 
				
			||||||
 | 
					                    entity.CHECKTIME = DateTime.Now;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (string.IsNullOrEmpty(entity.CODE))
 | 
				
			||||||
 | 
					                    entity.CODE = "YHSB" + DateTime.Now.ToString("yyyyMMddHHmm");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //安全检查修改为隐患已上报
 | 
				
			||||||
 | 
					                T_BS_SAFE_CHECK modelCheck = null;
 | 
				
			||||||
 | 
					                if (entity.CHECK_ID.HasValue)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    modelCheck = this.GetEntity<T_BS_SAFE_CHECK>(entity.CHECK_ID.Value, new string[] { "Nav_ListSafeCheckDetail" });
 | 
				
			||||||
 | 
					                    if (modelCheck != null)
 | 
				
			||||||
 | 
					                        modelCheck.RISKSTATE = (int)RISKSTATE.Reported;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                List<Guid> listApproveId = new List<Guid>();
 | 
				
			||||||
 | 
					                List<Guid> listId = new List<Guid>();
 | 
				
			||||||
 | 
					                List<string> listParam = new List<string>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                List<Guid> ListDepIDNone = new List<Guid>(); //责任部门ID
 | 
				
			||||||
 | 
					                                                             //通知表单
 | 
				
			||||||
 | 
					                List<T_BS_RISK_SUBMIT_NOTICE> listSubmitNotice = new List<T_BS_RISK_SUBMIT_NOTICE>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //foreach (var item in listRiskSubminContentl)
 | 
				
			||||||
 | 
					                //{
 | 
				
			||||||
 | 
					                //rowIndex++;
 | 
				
			||||||
 | 
					                if (entityContent.DEPARTMENT_ID.HasValue)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ListDepIDNone.Add(entityContent.DEPARTMENT_ID.Value);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ListDepIDNone.Add(Guid.Empty);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entity.SUBMIT_STATUS != (int)BSSubmitStatusEnum.Temp && string.IsNullOrEmpty(entityContent.NAME) && entityContent.QUESTION_LEVEL > 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        entityContent.NAME = ((BSQuestionLevelEnum)entityContent.QUESTION_LEVEL).GetDescription() + "级隐患";
 | 
				
			||||||
 | 
					                        //手动上报车间级巡回检查A
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch { }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (entity.SUBMIT_STATUS != (int)BSSubmitStatusEnum.Temp)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var subTemp = listSubmitNotice.FirstOrDefault(e => e.QUESTION_LEVEL == entityContent.QUESTION_LEVEL);
 | 
				
			||||||
 | 
					                    if (subTemp == null)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        #region      不包含此等级 添加通知
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        T_BS_RISK_SUBMIT_NOTICE modelNotice = new T_BS_RISK_SUBMIT_NOTICE();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        modelNotice.ID = Guid.NewGuid();
 | 
				
			||||||
 | 
					                        modelNotice.CODE = entityContent.CODE + "_" + (listParam.Count() + 1).ToString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        modelNotice.NAME = ((BSQuestionLevelEnum)entityContent.QUESTION_LEVEL).GetDescription();
 | 
				
			||||||
 | 
					                        if (entityContent.NAME.Contains(entityContent.NAME))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            modelNotice.NAME = entityContent.NAME;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            modelNotice.NAME = entityContent.NAME + modelNotice.NAME;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        modelNotice.RISK_SUBMIT_ID = entityContent.RISK_SUBMIT_ID.Value;
 | 
				
			||||||
 | 
					                        modelNotice.QUESTION_LEVEL = entityContent.QUESTION_LEVEL;
 | 
				
			||||||
 | 
					                        modelNotice.NOTICETIME = DateTime.Now;
 | 
				
			||||||
 | 
					                        modelNotice.RiskContentState = (int)RiskContentState.Notice;
 | 
				
			||||||
 | 
					                        modelNotice.APPROVE_ID = Guid.NewGuid();
 | 
				
			||||||
 | 
					                        modelNotice.ORG_ID = entityContent.ORG_ID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        listSubmitNotice.Add(modelNotice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        entityContent.APPROVE_ID = modelNotice.APPROVE_ID;
 | 
				
			||||||
 | 
					                        entityContent.RISK_SUBMIT_NOTICE_ID = modelNotice.ID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        listId.Add(modelNotice.ID);
 | 
				
			||||||
 | 
					                        listParam.Add(modelNotice.QUESTION_LEVEL.ToString());
 | 
				
			||||||
 | 
					                        listApproveId.Add(modelNotice.APPROVE_ID.Value);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        entityContent.APPROVE_ID = subTemp.APPROVE_ID;
 | 
				
			||||||
 | 
					                        entityContent.RISK_SUBMIT_NOTICE_ID = subTemp.ID;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (listRiskQuestionReason != null && listRiskQuestionReason.Any())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    foreach (var item in listRiskQuestionReason)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        item.ORG_ID = entity.ORG_ID;
 | 
				
			||||||
 | 
					                        item.Nav_RiskReason = null;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (files.Count > 0)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    foreach (var item in files)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        item.Nav_ImgFile = null;
 | 
				
			||||||
 | 
					                        item.RISK_SUBMIT_ID = entity.ID;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //如果 有问题ID 
 | 
				
			||||||
 | 
					                //问题等级 和 整改建议与措施 不能修改
 | 
				
			||||||
 | 
					                if (entityContent.Nav_SafeCheckDetail == null && entityContent.SAFE_CHECK_DETAIL_ID != null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    entityContent.Nav_SafeCheckDetail = GetEntity<T_BS_SAFE_CHECK_DETAIL>(e => e.ID == entityContent.SAFE_CHECK_DETAIL_ID);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entityContent.Nav_SafeCheckDetail != null && entityContent.Nav_SafeCheckDetail.CHECKRESULT == (int)CHECKRESULTEnum.Same)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (entityContent.Nav_CheckMain == null && entityContent.CHECK_MAIN_ID.HasValue)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        entityContent.Nav_CheckMain = GetEntity<T_BS_CHECK_MAIN>(e => e.ID == entityContent.CHECK_MAIN_ID, new string[] { "Nav_CheckQuestion" });
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (entityContent.Nav_CheckMain != null && entityContent.Nav_CheckMain.Nav_CheckQuestion != null)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (entityContent.CHECK_QUESTION_ID != entityContent.Nav_CheckMain.Nav_CheckQuestion.ID)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            var checkMain = GetEntity<T_BS_CHECK_MAIN>(e => e.CHECK_QUESTION_ID == entityContent.CHECK_QUESTION_ID && e.CHECK_PROJECT_ID == entityContent.Nav_CheckMain.CHECK_PROJECT_ID && e.CHECK_PROJECT_CATEGORY_ID == entityContent.Nav_CheckMain.CHECK_PROJECT_CATEGORY_ID && e.CHECK_PROJECT_CATEGORY_ID == entityContent.Nav_CheckMain.CHECK_PROJECT_CATEGORY_ID && e.CHECKCONTENT == entityContent.Nav_CheckMain.CHECKCONTENT);
 | 
				
			||||||
 | 
					                            if (checkMain == null)
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                //检查问题与描述一致 检查问题不能修改
 | 
				
			||||||
 | 
					                                throw new Exception("整改建议与措施【" + entityContent.Nav_CheckMain.Nav_CheckQuestion.DEMAND + "】不能修改,操作失败!");
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (!entity.USER_ID.HasValue)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    entity.USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (entity.DEPARTMENT_ID == null)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    entity.DEPARTMENT_ID = GetEntity<T_FM_USER>(entity.USER_ID.Value).DEPARTMENT_ID;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (entityContent.TaskID != Guid.Empty && !entity.STARTTIME.HasValue)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    var task = GetEntity<T_FM_NOTIFICATION_TASK>(entityContent.TaskID);
 | 
				
			||||||
 | 
					                    entity.STARTTIME = task.CREATE_TIME;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (entity.SUBMIT_STATUS == (int)BSSubmitStatusEnum.Temp)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    this.UnifiedCommit(() =>
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (entityContent != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(entityContent);
 | 
				
			||||||
 | 
					                        if (entity != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(entity);
 | 
				
			||||||
 | 
					                        if (modelCheck != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(modelCheck);
 | 
				
			||||||
 | 
					                        if (files != null && files.Any())
 | 
				
			||||||
 | 
					                            BantchSaveEntityNoCommit(files);
 | 
				
			||||||
 | 
					                        if (listRiskQuestionReason != null && listRiskQuestionReason.Any())
 | 
				
			||||||
 | 
					                            BantchSaveEntityNoCommit(listRiskQuestionReason);
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //手动隐患上报 为了让整改通知 数据权限正常 修改部门信息为 责任部门信息
 | 
				
			||||||
 | 
					                    if (entityContent.DEPARTMENT_ID.HasValue && entity.DEPARTMENT_ID != entityContent.DEPARTMENT_ID)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        entity.DEPARTMENT_ID = entityContent.DEPARTMENT_ID;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    List<string> listSerialCode = new List<string>();
 | 
				
			||||||
 | 
					                    var index = entity.CODE.IndexOf(DateTime.Now.Year.ToString());
 | 
				
			||||||
 | 
					                    if (index == -1)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        index = entity.CODE.IndexOf((DateTime.Now.Year - 1).ToString());
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    string yearMonth = string.Empty;
 | 
				
			||||||
 | 
					                    if (index > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yearMonth = entity.CODE.Substring(index);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        yearMonth = DateTime.Now.ToString("yyyyMMddHHmmss");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    string code = "YHSB" + yearMonth;
 | 
				
			||||||
 | 
					                    if (code.Length > 20)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        code = code.Substring(0, 15);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    listSerialCode.Add(code);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (listParam.Count > 1)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        for (int i = 1; i < listParam.Count; i++)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            listSerialCode.Add(code + i.ToString());
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //如果是手动隐患上报 根据明细的 整改责任人  来走审批流 20240118
 | 
				
			||||||
 | 
					                    Guid? ApproveIDDependUserID = entityContent.DEAL_USER_ID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //??????
 | 
				
			||||||
 | 
					                    ////给通知责任人 发送通知
 | 
				
			||||||
 | 
					                    ////通知责任人 确定 后  走审批流
 | 
				
			||||||
 | 
					                    MFlowPermitService.InsertApproveRisk(listSerialCode, "BS006", listId, "BS006_SHOWPRINT", entityContent.TaskID, true, () =>
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (entityContent != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(entityContent);
 | 
				
			||||||
 | 
					                        if (entity != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(entity);
 | 
				
			||||||
 | 
					                        if (listSubmitNotice.Any())
 | 
				
			||||||
 | 
					                            BantchSaveEntityNoCommit(listSubmitNotice);
 | 
				
			||||||
 | 
					                        if (modelCheck != null)
 | 
				
			||||||
 | 
					                            UpdateEntityNoCommit(modelCheck);
 | 
				
			||||||
 | 
					                        if (files != null && files.Any())
 | 
				
			||||||
 | 
					                            BantchSaveEntityNoCommit(files);
 | 
				
			||||||
 | 
					                        if (listRiskQuestionReason != null && listRiskQuestionReason.Any())
 | 
				
			||||||
 | 
					                            BantchSaveEntityNoCommit(listRiskQuestionReason);
 | 
				
			||||||
 | 
					                    }, listParam, listApproveId, ApproveIDDependUserID, "BS073_SHOWPRINT", null, ListDepIDNone, FMTASKTYPE.BS_RiskUp_Audit);//  null =>ApproveIDDependUserID
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 验收人 确认 
 | 
				
			||||||
 | 
					        /// 按整改明细给 整改落实人发送 整改通知
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="filter"></param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("CheckerCheckToActual")]
 | 
				
			||||||
 | 
					        public JsonActionResult<bool> CheckerCheckToActual([FromBody] KeywordFilter filter)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //确定 / 驳回  确定(给责任人 BS042_SHOWPRINT 发送通知 ) 驳回 (隐患通知责任人)发送通知 (BS042)
 | 
				
			||||||
 | 
					                Guid id = new Guid(filter.Keyword);
 | 
				
			||||||
 | 
					                DateTime dtNow = DateTime.Now;
 | 
				
			||||||
 | 
					                var LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
				
			||||||
 | 
					                var TaskID = new Guid(filter.Parameter1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                var entity = GetEntity<T_BS_RISK_SUBMIT_NOTICE_PERSON>(id, new string[] { "Nav_ListRiskSubmitContent.Nav_UserActualDeal", "Nav_ListRiskSubmitContent.Nav_Files" });
 | 
				
			||||||
 | 
					                var listRiskSubminContentl = entity.Nav_ListRiskSubmitContent;
 | 
				
			||||||
 | 
					                if (listRiskSubminContentl != null && listRiskSubminContentl.Count() > 1)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    listRiskSubminContentl = listRiskSubminContentl.FindAll(e => e.CHECK_USER_ID == LoginID);//DEAL_USER_ID
 | 
				
			||||||
 | 
					                    if (listRiskSubminContentl == null || !listRiskSubminContentl.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("只有验收人才能验收!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else if (listRiskSubminContentl[0].CHECK_USER_ID != LoginID)//DEAL_USER_ID
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("只有验收人才能验收!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                int CodeTemp = 0;
 | 
				
			||||||
 | 
					                //同意
 | 
				
			||||||
 | 
					                List<T_BS_RISK_SUBMIT_CONTENT_DEAL> listContentDeal = new List<T_BS_RISK_SUBMIT_CONTENT_DEAL>();
 | 
				
			||||||
 | 
					                List<T_BS_RISK_SUBMIT_CONTENT_DEAL_FILE> listDealF = new List<T_BS_RISK_SUBMIT_CONTENT_DEAL_FILE>();
 | 
				
			||||||
 | 
					                List<T_FM_NOTIFICATION_TASK> listNoticeDeal = new List<T_FM_NOTIFICATION_TASK>();
 | 
				
			||||||
 | 
					                T_BS_RISK_SUBMIT_CONTENT_DEAL dealTemp = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                listRiskSubminContentl.ForEach(item =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (item.CHECK_USER_ID == LoginID)
 | 
				
			||||||
 | 
					                        item.ISCHECKERCHECK = true;
 | 
				
			||||||
 | 
					                    if (item.DEAL_USER_ID == LoginID)
 | 
				
			||||||
 | 
					                        item.ISDEALUSERCHECK = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (item.ISDEALUSERCHECK && item.ISCHECKERCHECK)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        item.RiskContentState = (int)RiskContentState.ActualDealChange;//item.RiskContentState = (int)RiskContentState.ArrangeDeal;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //给验收人 发送通知
 | 
				
			||||||
 | 
					                DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_ActualDealNotice, entity.ORG_ID.Value, DateTime.Now, null, null);
 | 
				
			||||||
 | 
					                foreach (var item in listRiskSubminContentl)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //数据处理
 | 
				
			||||||
 | 
					                    CodeTemp++;
 | 
				
			||||||
 | 
					                    #region     隐患整改记录
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    dealTemp = new T_BS_RISK_SUBMIT_CONTENT_DEAL();
 | 
				
			||||||
 | 
					                    dealTemp.ID = Guid.NewGuid();
 | 
				
			||||||
 | 
					                    dealTemp.ORG_ID = item.ORG_ID;
 | 
				
			||||||
 | 
					                    dealTemp.RISK_SUBMIT_ID = item.RISK_SUBMIT_ID;
 | 
				
			||||||
 | 
					                    dealTemp.RISK_SUBMIT_NOTICE_ID = item.RISK_SUBMIT_NOTICE_ID;
 | 
				
			||||||
 | 
					                    dealTemp.RISK_SUBMIT_NOTICE_PERSON_ID = item.RISK_SUBMIT_NOTICE_PERSON_ID;
 | 
				
			||||||
 | 
					                    dealTemp.RISK_SUBMIT_CONTENT_ID = item.ID;
 | 
				
			||||||
 | 
					                    dealTemp.CODE = item.CODE + "_" + CodeTemp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    dealTemp.NAME = item.NAME.Replace("隐患整改通知:", "");
 | 
				
			||||||
 | 
					                    //dealTemp.ENDDATE = item.LastDateUser;//整改结束时间   
 | 
				
			||||||
 | 
					                    dealTemp.QUESTION_LEVEL = item.QUESTION_LEVEL;
 | 
				
			||||||
 | 
					                    dealTemp.DEALSITUATION = (int)DealSituation.Temp;
 | 
				
			||||||
 | 
					                    dealTemp.DEAL_USER_ID = item.DEAL_USER_ID;
 | 
				
			||||||
 | 
					                    dealTemp.ACTUAL_DEAL_USER_ID = item.ACTUAL_DEAL_USER_ID;
 | 
				
			||||||
 | 
					                    dealTemp.CHECK_USER_ID = item.CHECK_USER_ID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    listContentDeal.Add(dealTemp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //附件
 | 
				
			||||||
 | 
					                    if (item.Nav_Files != null && item.Nav_Files.Any())
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        foreach (var itemF in item.Nav_Files)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            listDealF.Add(new T_BS_RISK_SUBMIT_CONTENT_DEAL_FILE()
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                ID = Guid.NewGuid(),
 | 
				
			||||||
 | 
					                                RISK_SUBMIT_CONTENT_DEAL_ID = dealTemp.ID,
 | 
				
			||||||
 | 
					                                IMG_FILE_ID = itemF.IMG_FILE_ID,
 | 
				
			||||||
 | 
					                                IS_DELETED = false,
 | 
				
			||||||
 | 
					                                ORG_ID = item.ORG_ID,
 | 
				
			||||||
 | 
					                                ENTITY_ORG_TPYE = item.ENTITY_ORG_TPYE,
 | 
				
			||||||
 | 
					                                FLOW_STATUS = item.FLOW_STATUS,
 | 
				
			||||||
 | 
					                                FLOW_SEND_STATUS = item.FLOW_SEND_STATUS,
 | 
				
			||||||
 | 
					                                //FORM_ID
 | 
				
			||||||
 | 
					                                //FLOW_ID
 | 
				
			||||||
 | 
					                                //CREATE_TIME
 | 
				
			||||||
 | 
					                                //MODIFY_TIME
 | 
				
			||||||
 | 
					                                //CREATER_ID
 | 
				
			||||||
 | 
					                                //MODIFIER_ID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                            });
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //每个整改责任人 收到待办
 | 
				
			||||||
 | 
					                    //var notice = NotificationTaskService.InsertUserNoticeTaskModel("指定整改落实人:" + dealTemp.NAME, item.ID, entity.ORG_ID, item.DEAL_USER_ID.Value, item.Nav_UserDeal.NAME, dtNow, (dtTsakEnd > item.LastDateUser.Value ? item.LastDateUser.Value : dtTsakEnd), (int)FMNoticeTypeEnum.消息, "BS049");
 | 
				
			||||||
 | 
					                    var check = listNoticeDeal.FirstOrDefault(e => e.USER_ID == dealTemp.ACTUAL_DEAL_USER_ID.Value);
 | 
				
			||||||
 | 
					                    if (check == null)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        string title = "整改落实人确认:" + entity.NAME.Replace("隐患整改通知:", "");
 | 
				
			||||||
 | 
					                        var notice = NotificationTaskService.InsertUserNoticeTaskModel(title, dealTemp.RISK_SUBMIT_NOTICE_PERSON_ID.Value, entity.ORG_ID, dealTemp.ACTUAL_DEAL_USER_ID.Value, item.Nav_UserActualDeal.NAME, DateTime.Now, dtEnd, (int)FMNoticeTypeEnum.消息, "BS042_ACTUALCHECK");//BS042_SHOWPRINT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        notice.CREATE_TIME = dtNow;
 | 
				
			||||||
 | 
					                        listNoticeDeal.Add(notice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                T_FM_NOTIFICATION_TASK task = null;
 | 
				
			||||||
 | 
					                GetEntityTask(TaskID, ref task);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                /// 整改落实人 确认整改通知单 系统发送整改单给整改落实人
 | 
				
			||||||
 | 
					                //UpdateActualDealRecord
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (listRiskSubminContentl[0].ACTUAL_DEAL_USER_ID.HasValue && listRiskSubminContentl[0].DEAL_USER_ID.HasValue && listRiskSubminContentl[0].ACTUAL_DEAL_USER_ID.Value == listRiskSubminContentl[0].DEAL_USER_ID.Value)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //整改责任人 与落实人 同一个
 | 
				
			||||||
 | 
					                    //整改落实人确认 待办默认处理
 | 
				
			||||||
 | 
					                    listNoticeDeal[0].TASK_DT = DateTime.Now;
 | 
				
			||||||
 | 
					                    if (listNoticeDeal[0].TASK_ENDDT >= listNoticeDeal[0].TASK_DT)
 | 
				
			||||||
 | 
					                        listNoticeDeal[0].NOTICE_STATUS = FMNoticeStatusEnum.正常已办.GetInt();
 | 
				
			||||||
 | 
					                    else
 | 
				
			||||||
 | 
					                        listNoticeDeal[0].NOTICE_STATUS = FMNoticeStatusEnum.超期办理.GetInt();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //状态修改
 | 
				
			||||||
 | 
					                    listRiskSubminContentl[0].RiskContentState = (int)RiskContentState.ActualDealCheck;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    //发送待办(隐患整改单)
 | 
				
			||||||
 | 
					                    listNoticeDeal.Add(NotificationTaskService.InsertUserNoticeTaskModel("隐患整改单:" + listRiskSubminContentl[0].NAME.Replace("隐患整改通知:", ""), listContentDeal[0].ID, listRiskSubminContentl[0].ORG_ID, listRiskSubminContentl[0].ACTUAL_DEAL_USER_ID.Value, listRiskSubminContentl[0].Nav_UserActualDeal.NAME, DateTime.Now, listRiskSubminContentl[0].LastDateUser.Value, (int)FMNoticeTypeEnum.消息, "BS044"));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                this.UnifiedCommit(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    UpdateEntityNoCommit(entity);//保存状态
 | 
				
			||||||
 | 
					                    if (listContentDeal.Count > 0)
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listContentDeal);//保存待整改明细
 | 
				
			||||||
 | 
					                    if (listDealF != null && listDealF.Any())//附件
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listDealF);    //附件
 | 
				
			||||||
 | 
					                    if (listRiskSubminContentl != null && listRiskSubminContentl.Any())//隐患上报明细表
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listRiskSubminContentl);    //保存子表
 | 
				
			||||||
 | 
					                    if (listNoticeDeal != null && listNoticeDeal.Any())//整改责任人 按条数 收到整改单
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listNoticeDeal);
 | 
				
			||||||
 | 
					                    if (task != null)//代办消息 清除
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(task, "NOTICE_STATUS", "TASK_DT", "MODIFIER_ID");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -138,5 +138,120 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #region    需要额外同步
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 整改责任人指定 整改落实人 (BS074) 
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="entity">对象实体</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("FullUpdate")]
 | 
				
			||||||
 | 
					        public JsonActionResult<bool> FullUpdate([FromBody] T_BS_RISK_SUBMIT_NOTICE_PERSON entity)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeExecute<bool>(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var listRiskSubminContentl = entity.Nav_ListRiskSubmitContent;
 | 
				
			||||||
 | 
					                if (listRiskSubminContentl == null || !listRiskSubminContentl.Any())
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    throw new Exception("上报明细不能为空!");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                //if (!APT.Infrastructure.Api.AppContext.CurrentSession.UserID.HasValue || !listContent[0].DEAL_USER_ID.HasValue || APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value != listContent[0].DEAL_USER_ID.Value)
 | 
				
			||||||
 | 
					                //{
 | 
				
			||||||
 | 
					                //    throw new Exception("您不是此单的整改责任人,不能处理此单据!");
 | 
				
			||||||
 | 
					                //}
 | 
				
			||||||
 | 
					                T_FM_NOTIFICATION_TASK task = null;
 | 
				
			||||||
 | 
					                if (entity.OPERATETYPE == OperateType.Save)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    List<int> listIndex = new List<int>();
 | 
				
			||||||
 | 
					                    List<int> listIndexSame = new List<int>();
 | 
				
			||||||
 | 
					                    for (int i = 0; i < listRiskSubminContentl.Count; i++)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (!listRiskSubminContentl[i].ACTUAL_DEAL_USER_ID.HasValue)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            listIndex.Add(i + 1);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else if (listRiskSubminContentl[i].CHECK_USER_ID.HasValue && listRiskSubminContentl[i].ACTUAL_DEAL_USER_ID.Value == listRiskSubminContentl[i].CHECK_USER_ID.Value)
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            listIndexSame.Add(i + 1);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (listIndex.Count > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("请选择行【" + String.Join(",", listIndex) + "】的整改落实人!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    if (listIndexSame.Count > 0)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        throw new Exception("行【" + String.Join(",", listIndex) + "】的整改落实人与验收人不能相同!");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    task = NotificationTaskService.GetEntityTask(entity.TaskID, "BS074_SHOWPRINT");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //审核人 同意
 | 
				
			||||||
 | 
					                List<T_FM_NOTIFICATION_TASK> listNoticeDeal = new List<T_FM_NOTIFICATION_TASK>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //entity.Nav_ListRiskSubmitContent = null;//不能有 不然 对应外键 会被清空
 | 
				
			||||||
 | 
					                List<Guid> ListNoticeAll = new List<Guid>();
 | 
				
			||||||
 | 
					                List<string> ListNoticeAllNAME = new List<string>();
 | 
				
			||||||
 | 
					                DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.BS_RiskUp_Deal, entity.ORG_ID.Value, DateTime.Now, null, null);
 | 
				
			||||||
 | 
					                listRiskSubminContentl.ForEach(item =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //item.ACTUAL_DEAL_USER_ID = item.DEAL_USER_ID;//整改落实人默认  整改责任人
 | 
				
			||||||
 | 
					                    item.RiskContentState = (int)RiskContentState.CheckerCheck;//CheckerCheck CheckerCheck
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    item.ISDEALUSERCHECK = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if (!ListNoticeAll.Contains(item.CHECK_USER_ID.Value))//DEAL_USER_ID
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        //整改责任人
 | 
				
			||||||
 | 
					                        ListNoticeAll.Add(item.CHECK_USER_ID.Value);//DEAL_USER_ID
 | 
				
			||||||
 | 
					                                                                    //数量少 每次获取 页面能选 这边就不会报错
 | 
				
			||||||
 | 
					                        ListNoticeAllNAME.Add(GetEntity<T_FM_USER>(item.CHECK_USER_ID.Value).NAME);//Nav_UserDeal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        //给责任人 发送通知
 | 
				
			||||||
 | 
					                        listNoticeDeal.AddRange(NotificationTaskService.InsertUserNoticeTaskModels("验收人确认:" + entity.NAME.Replace("隐患整改通知:", ""), entity.ID, entity.ORG_ID, ListNoticeAll, ListNoticeAllNAME, DateTime.Now, ((item.LastDateUser.HasValue && item.LastDateUser.Value < dtEnd) ? item.LastDateUser.Value : dtEnd), (int)FMNoticeTypeEnum.消息, "BS042_SHOWPRINT"));//HM001_SHOWPRINT  "整改责任人确认:" + entity.NAME.Replace("隐患整改通知:", "")
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                this.UnifiedCommit(() =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    UpdateEntityNoCommit(entity);//保存状态
 | 
				
			||||||
 | 
					                    if (listRiskSubminContentl != null && listRiskSubminContentl.Any())//隐患上报明细表
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listRiskSubminContentl);    //保存子表
 | 
				
			||||||
 | 
					                    if (listNoticeDeal != null && listNoticeDeal.Any())//整改责任人 按条数 收到整改单
 | 
				
			||||||
 | 
					                        BantchSaveEntity(listNoticeDeal);
 | 
				
			||||||
 | 
					                    if (task != null)//代办消息 清除
 | 
				
			||||||
 | 
					                        UpdateEntityNoCommit(task, "NOTICE_STATUS", "TASK_DT", "MODIFIER_ID");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return true;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// 获得单条实体数据
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        /// <param name="filter">过滤实体</param>
 | 
				
			||||||
 | 
					        /// <returns></returns>
 | 
				
			||||||
 | 
					        [HttpPost, Route("GetNoticePeson")]
 | 
				
			||||||
 | 
					        public JsonActionResult<T_BS_RISK_SUBMIT_NOTICE_PERSON> GetNoticePeson([FromBody] KeywordFilter filter)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return SafeExecute(() =>
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                var result = GetEntity<T_BS_RISK_SUBMIT_NOTICE_PERSON>(null, filter, null);
 | 
				
			||||||
 | 
					                if (result != null && result.QUESTION_LEVEL > 0 && DataHelper.GetRequestType(HttpContext.Request.Headers) == 2)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    result.QUESTION_LEVEL_SHOW = ((BSQuestionLevelEnum)result.QUESTION_LEVEL).GetDescription();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return result;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        #endregion
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -6992,7 +6992,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                int? stateMake = null;    //任务制定状态
 | 
					                int? stateMake = null;    //任务制定状态
 | 
				
			||||||
                int? stateCheck = null;   //检查记录状态
 | 
					                int? stateCheck = null;   //检查记录状态
 | 
				
			||||||
                int? stateSubmit = null;  //隐患整改状态
 | 
					                int? stateSubmit = null;  //隐患整改状态   1 无需整改     5 草稿   10 处理中   30 已归档
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (pageFilter.FilterGroup != null)
 | 
					                if (pageFilter.FilterGroup != null)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -7103,6 +7103,11 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                //}
 | 
					                //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Expression<Func<T_BS_SAFE_CHECK, bool>> expressionCheck = e => !e.IS_DELETED && e.STATUSPLAN > 0 && e.ENABLE_STATUS == 0;
 | 
					                Expression<Func<T_BS_SAFE_CHECK, bool>> expressionCheck = e => !e.IS_DELETED && e.STATUSPLAN > 0 && e.ENABLE_STATUS == 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #region     expressionCheck 完善
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (CODE != string.Empty)
 | 
					                if (CODE != string.Empty)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    expressionCheck = expressionCheck.And(e => e.CODE.Contains(CODE));
 | 
					                    expressionCheck = expressionCheck.And(e => e.CODE.Contains(CODE));
 | 
				
			||||||
@ -7167,9 +7172,12 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                        catch { }
 | 
					                        catch { }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Expression<Func<T_BS_RISK_SUBMIT, bool>> expressionSubmit = e => !e.IS_DELETED && e.SUBMIT_STATUS.HasValue && (e.SUBMIT_TYPE == 10 || (e.SUBMIT_TYPE == 20 && e.SUBMIT_STATUS.Value > 5)); // && e.SUBMIT_TYPE == 20  SUBMIT_STATUS
 | 
					                Expression<Func<T_BS_RISK_SUBMIT, bool>> expressionSubmit = e => !e.IS_DELETED && e.SUBMIT_STATUS.HasValue && (e.SUBMIT_TYPE == 10 || (e.SUBMIT_TYPE == 20 && e.SUBMIT_STATUS.Value > 5)); // && e.SUBMIT_TYPE == 20  SUBMIT_STATUS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #region    expressionSubmit 完善
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (CODE != string.Empty)
 | 
					                if (CODE != string.Empty)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    expressionSubmit = expressionSubmit.And(e => e.CODE.Contains(CODE));
 | 
					                    expressionSubmit = expressionSubmit.And(e => e.CODE.Contains(CODE));
 | 
				
			||||||
@ -7244,6 +7252,33 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //隐患整改状态   1 无需整改     5 草稿   10 处理中   30 已归档
 | 
				
			||||||
 | 
					                switch (stateSubmit)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    case null:
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case 1:
 | 
				
			||||||
 | 
					                        expressionCheck = expressionCheck.And(e => e.ISNEEDTOUP.HasValue && !e.ISNEEDTOUP.Value);
 | 
				
			||||||
 | 
					                        expressionSubmit = expressionSubmit.And(e => false);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case 5:
 | 
				
			||||||
 | 
					                        expressionCheck = expressionCheck.And(e => e.ISNEEDTOUP.HasValue && e.ISNEEDTOUP.Value);
 | 
				
			||||||
 | 
					                        expressionSubmit = expressionSubmit.And(e => !e.ISORDEREND && (!e.SUBMIT_STATUS.HasValue || e.SUBMIT_STATUS < 20));
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case 10:
 | 
				
			||||||
 | 
					                        expressionCheck = expressionCheck.And(e => e.ISNEEDTOUP.HasValue && e.ISNEEDTOUP.Value);
 | 
				
			||||||
 | 
					                        expressionSubmit = expressionSubmit.And(e => !e.ISORDEREND && e.SUBMIT_STATUS.HasValue && e.SUBMIT_STATUS.Value >= 20);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case 30:
 | 
				
			||||||
 | 
					                        expressionCheck = expressionCheck.And(e => e.ISNEEDTOUP.HasValue && e.ISNEEDTOUP.Value);
 | 
				
			||||||
 | 
					                        expressionSubmit = expressionSubmit.And(e => e.ISORDEREND && e.SUBMIT_STATUS.HasValue && e.SUBMIT_STATUS.Value >= 40);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    default:
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //var iListCheck = GetEntities(expressionCheck, null, "Nav_Department", "Nav_CheckType", "Nav_CheckTypeLevel.Nav_Enums").Select(e => new T_BS_SAFE_CHECK_SUM()
 | 
					                //var iListCheck = GetEntities(expressionCheck, null, "Nav_Department", "Nav_CheckType", "Nav_CheckTypeLevel.Nav_Enums").Select(e => new T_BS_SAFE_CHECK_SUM()
 | 
				
			||||||
                //{
 | 
					                //{
 | 
				
			||||||
                //    ID = e.ID.ToString() + "_",
 | 
					                //    ID = e.ID.ToString() + "_",
 | 
				
			||||||
@ -7382,7 +7417,7 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                //            join sub1 in iListSub2 on check.ID equals sub1.CHECK_ID into temp
 | 
					                //            join sub1 in iListSub2 on check.ID equals sub1.CHECK_ID into temp
 | 
				
			||||||
                //            from sub in temp.DefaultIfEmpty()
 | 
					                //            from sub in temp.DefaultIfEmpty()
 | 
				
			||||||
                //外加 手动上报
 | 
					                //外加 手动上报
 | 
				
			||||||
 | 
					                //stateSubmit  安全检查 是否需要整改 ISNEEDTOUP
 | 
				
			||||||
                var query = (from check in iListCheck2
 | 
					                var query = (from check in iListCheck2
 | 
				
			||||||
                             join sub1 in iListSub2 on check.ID equals sub1.CHECK_ID into temp
 | 
					                             join sub1 in iListSub2 on check.ID equals sub1.CHECK_ID into temp
 | 
				
			||||||
                             from sub in temp.DefaultIfEmpty()
 | 
					                             from sub in temp.DefaultIfEmpty()
 | 
				
			||||||
@ -7400,7 +7435,8 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                                 CheckUsers = (check != null) ? check.CheckUsers : (sub != null ? sub.Nav_User?.NAME : null),
 | 
					                                 CheckUsers = (check != null) ? check.CheckUsers : (sub != null ? sub.Nav_User?.NAME : null),
 | 
				
			||||||
                                 stateMake = (check != null) ? (check.STATUSPLAN == 0 ? "草稿" : (check.STATUSPLAN == 20 ? "已归档" : "处理中")) : "手动上报",//HMAuditStatusEnmu
 | 
					                                 stateMake = (check != null) ? (check.STATUSPLAN == 0 ? "草稿" : (check.STATUSPLAN == 20 ? "已归档" : "处理中")) : "手动上报",//HMAuditStatusEnmu
 | 
				
			||||||
                                 stateCheck = (check != null) ? check.STATECHECK.GetDescription() : "手动上报",// e.STATECHECK.GetDescription(),//STATECHECK
 | 
					                                 stateCheck = (check != null) ? check.STATECHECK.GetDescription() : "手动上报",// e.STATECHECK.GetDescription(),//STATECHECK
 | 
				
			||||||
                                 stateSubmit = (sub != null) ? (sub.ISORDEREND ? "已归档" : ((sub.SUBMIT_STATUS.HasValue && sub.SUBMIT_STATUS.Value < 20) ? "草稿" : "处理中")) : "",
 | 
					                                 stateSubmit = check.ISNEEDTOUP == null ? "" : (!check.ISNEEDTOUP.Value ? "无需整改" : ((sub != null) ? (sub.ISORDEREND ? "已归档" : ((sub.SUBMIT_STATUS.HasValue && sub.SUBMIT_STATUS.Value < 20) ? "草稿" : "处理中")) : "草稿")),
 | 
				
			||||||
 | 
					                                 //stateSubmit = (sub != null) ? (sub.ISORDEREND ? "已归档" : ((sub.SUBMIT_STATUS.HasValue && sub.SUBMIT_STATUS.Value < 20) ? "草稿" : "处理中")) : "",
 | 
				
			||||||
                                 SUBMIT_TYPE = (check != null) ? SUBMIT_TYPE.Check : SUBMIT_TYPE.User,
 | 
					                                 SUBMIT_TYPE = (check != null) ? SUBMIT_TYPE.Check : SUBMIT_TYPE.User,
 | 
				
			||||||
                                 CREATE_TIME = (check != null) ? check.CREATE_TIME : (sub != null ? sub.CREATE_TIME : null),
 | 
					                                 CREATE_TIME = (check != null) ? check.CREATE_TIME : (sub != null ? sub.CREATE_TIME : null),
 | 
				
			||||||
                                 Nav_Submit = sub
 | 
					                                 Nav_Submit = sub
 | 
				
			||||||
@ -7452,6 +7488,11 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
				
			|||||||
                //                Nav_Submit = sub
 | 
					                //                Nav_Submit = sub
 | 
				
			||||||
                //            };
 | 
					                //            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (stateSubmit == 30)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    query = query.Where(e => e.stateSubmit == "已归档");//得再次检索 因为前面的处理方式是 left join
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var iListResult = query.OrderByDescending(e => e.CREATE_TIME).ThenBy(e => e.CHECKOBJECT).ThenBy(e => e.stateMake);
 | 
					                var iListResult = query.OrderByDescending(e => e.CREATE_TIME).ThenBy(e => e.CHECKOBJECT).ThenBy(e => e.stateMake);
 | 
				
			||||||
                var listResult = iListResult.Skip((pageFilter.PageIndex - 1) * pageFilter.Limit).Take(pageFilter.Limit).ToList();
 | 
					                var listResult = iListResult.Skip((pageFilter.PageIndex - 1) * pageFilter.Limit).Take(pageFilter.Limit).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user