142 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			142 lines
		
	
	
		
			6.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
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.Entities.PF;
 | 
						|
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/BSRiskSubmitNoticePerson")]
 | 
						|
    public partial class BSRiskSubmitNoticePersonController : AuthorizeApiController<T_BS_RISK_SUBMIT_NOTICE_PERSON>
 | 
						|
    {
 | 
						|
        IFMFlowPermitService MFlowPermitService { get; set; }
 | 
						|
        IFMNotificationTaskService NotificationTaskService { get; set; }
 | 
						|
        IPFCodeRuleService CodeRuleService { get; set; }
 | 
						|
        IPFApproveCallBackService ApproveCallBackService { get; set; }
 | 
						|
        IFMDepartmentService DepartmentService { get; set; }
 | 
						|
        public BSRiskSubmitNoticePersonController(IFMNotificationTaskService notificationTaskService, IFMFlowPermitService mFlowPermitService, IPFCodeRuleService codeRuleService, IPFApproveCallBackService approveCallBackService, IFMDepartmentService departmentService)
 | 
						|
        {
 | 
						|
            NotificationTaskService = notificationTaskService;
 | 
						|
            MFlowPermitService = mFlowPermitService;
 | 
						|
            CodeRuleService = codeRuleService;
 | 
						|
            ApproveCallBackService = approveCallBackService;
 | 
						|
            DepartmentService = departmentService;
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 获取整改落实人验收
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="filter">过滤实体</param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("GetDetailCheck")]
 | 
						|
        public JsonActionResult<T_BS_RISK_SUBMIT_NOTICE_PERSON> Get([FromBody] KeywordFilter filter)
 | 
						|
        {
 | 
						|
            return SafeExecute(() =>
 | 
						|
            {
 | 
						|
                Guid ID = Guid.Empty;
 | 
						|
                int RiskContentState = 0;
 | 
						|
                bool isLogin = false;
 | 
						|
                if (filter.FilterGroup.Rules.Count > 0)
 | 
						|
                {
 | 
						|
                    List<FilterRule> listR = filter.FilterGroup.Rules.ToList();
 | 
						|
                    foreach (FilterRule rule in listR)
 | 
						|
                    {
 | 
						|
                        if (rule.Field == "ID")
 | 
						|
                        {
 | 
						|
                            ID = new Guid(rule.Value.ToString());
 | 
						|
                        }
 | 
						|
                        else if (rule.Field == "ISLOGIN" && rule.Value.ToString() == "1")
 | 
						|
                        {
 | 
						|
                            isLogin = true;
 | 
						|
                        }
 | 
						|
                        else if (rule.Field == "RiskContentState")
 | 
						|
                        {
 | 
						|
                            RiskContentState = int.Parse(rule.Value.ToString());
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                Expression<Func<T_BS_RISK_SUBMIT_CONTENT, bool>> expression = e => e.RISK_SUBMIT_NOTICE_PERSON_ID == ID;
 | 
						|
 | 
						|
                if (RiskContentState == 32)
 | 
						|
                {
 | 
						|
                    //BS034Showprint 查看的时候 会报错
 | 
						|
                    expression = expression.And(e => e.RiskContentState == RiskContentState && e.ACTUAL_DEAL_USER_ID == APT.Infrastructure.Api.AppContext.CurrentSession.UserID);
 | 
						|
                }
 | 
						|
                else if (isLogin)
 | 
						|
                {
 | 
						|
                    //责任人 或者整改落实人
 | 
						|
                    expression = expression.And(e => e.DEAL_USER_ID == APT.Infrastructure.Api.AppContext.CurrentSession.UserID || e.ACTUAL_DEAL_USER_ID == APT.Infrastructure.Api.AppContext.CurrentSession.UserID || e.CHECK_USER_ID == APT.Infrastructure.Api.AppContext.CurrentSession.UserID);
 | 
						|
                }
 | 
						|
                var nitocePerson = GetEntity<T_BS_RISK_SUBMIT_NOTICE_PERSON>(e => e.ID == ID, new string[] { "Nav_Submit.Nav_Check", "Nav_User.Nav_Department" });
 | 
						|
                var listRiskSubmitContentT = GetEntities<T_BS_RISK_SUBMIT_CONTENT>(expression, null, new string[] { "Nav_Question", "Nav_ListRiskQuestionReason.Nav_RiskReason", "Nav_User", "Nav_Department", "Nav_DepartmentDeal", "Nav_UserDeal", "Nav_UserCheck", "Nav_UserActualDeal" });
 | 
						|
                nitocePerson.Nav_ListRiskSubmitContent = listRiskSubmitContentT.ToList();
 | 
						|
                if (nitocePerson.Nav_ListRiskSubmitContent != null && nitocePerson.Nav_ListRiskSubmitContent.Any() && DataHelper.GetRequestType(Request.Headers) == 2)
 | 
						|
                {
 | 
						|
                    foreach (var item in nitocePerson.Nav_ListRiskSubmitContent)
 | 
						|
                    {
 | 
						|
                        if (item.QUESTION_LEVEL > 0)
 | 
						|
                        {
 | 
						|
                            try
 | 
						|
                            {
 | 
						|
                                item.QUESTION_LEVEL_SHOW = ((BSQuestionLevelEnum)item.QUESTION_LEVEL).GetDescription();
 | 
						|
                            }
 | 
						|
                            catch { }
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
 | 
						|
                    try
 | 
						|
                    {
 | 
						|
                        nitocePerson.QUESTION_LEVEL_SHOW = ((BSQuestionLevelEnum)nitocePerson.QUESTION_LEVEL).GetDescription();
 | 
						|
                    }
 | 
						|
                    catch { }
 | 
						|
                }
 | 
						|
                return nitocePerson;
 | 
						|
            });
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 排序分页查询数据
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="pageFilter">分页过滤实体</param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("OrderPaged")]
 | 
						|
        public PagedActionResult<T_BS_RISK_SUBMIT_NOTICE_PERSON> OrderPaged([FromBody] KeywordPageFilter pageFilter)
 | 
						|
        {
 | 
						|
            return SafeGetPagedData(delegate (PagedActionResult<T_BS_RISK_SUBMIT_NOTICE_PERSON> result)
 | 
						|
            {
 | 
						|
                bool isAll = true;
 | 
						|
                List<Guid> departmentIds = new List<Guid>() { APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID.Value };
 | 
						|
                DepartmentService.GetDepartmentIds(pageFilter.OrgId.Value, new List<Guid>() { APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID.Value }, ref departmentIds, ref isAll);
 | 
						|
                Expression<Func<T_BS_RISK_SUBMIT_NOTICE_PERSON, bool>> expression = e => !e.IS_DELETED;
 | 
						|
                if (!isAll)
 | 
						|
                {
 | 
						|
                    pageFilter.Include.Add("Nav_Submit");
 | 
						|
                    expression = expression.And(e => e.Nav_Submit.DEPARTMENT_ID.HasValue && departmentIds.Contains(e.Nav_Submit.DEPARTMENT_ID.Value));
 | 
						|
                }
 | 
						|
 | 
						|
                PagedActionResult<T_BS_RISK_SUBMIT_NOTICE_PERSON> orderPageEntities = GetOrderPageEntities(expression, pageFilter, null);
 | 
						|
                result.Data = orderPageEntities.Data;
 | 
						|
                result.TotalCount = orderPageEntities.TotalCount;
 | 
						|
                if (result.TotalCount > 0 && DataHelper.GetRequestType(Request.Headers) == 2)
 | 
						|
                {
 | 
						|
                    result.Data.ForEach(e => { e.OPERATETYPE_SHOW = e.OPERATETYPE.GetDescription(); });
 | 
						|
                }
 | 
						|
            });
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |