using Hotline.Orders;
using Hotline.Repository.SqlSugar.Extensions;
using Hotline.Share.Dtos;
using Hotline.Share.Dtos.Order;
using Hotline.Share.Dtos.ProvinceStatistics;
using Hotline.Share.Enums.Order;
using MapsterMapper;
using Microsoft.AspNetCore.Mvc;
using XF.Domain.Authentications;
using XF.Domain.Exceptions;
using XF.Domain.Repository;
using XF.Utility.EnumExtensions;

namespace Hotline.Api.Controllers
{
    public class ProvinceStatisticsController : BaseController
    {
        private readonly IMapper _mapper;
        private readonly ISessionContext _sessionContext;
        private readonly IRepository<OrderSendBack> _orderSendBackRepository;
        private readonly IRepository<OrderDelay> _orderDelayRepository;
        private readonly IRepository<OrderScreen> _orderScreenRepository;
        private readonly IRepository<OrderRevoke> _orderRevokeRepository;
        private readonly IRepository<OrderWarning> _orderWarningRepository;
        private readonly IRepository<OrderUrge> _orderUrgeRepository;
        private readonly IRepository<OrderComplement> _orderComplementRepository;
        private readonly IRepository<OrderSupervise> _orderSuperviseRepository;
        private readonly IOrderRepository _orderRepository;
        private readonly IRepository<OrderExtension> _orderExtensionRepository;


        public ProvinceStatisticsController(IMapper mapper,
           ISessionContext sessionContext,
            IRepository<OrderSendBack> orderSendBackRepository,
            IRepository<OrderDelay> orderDelayRepository,
            IRepository<OrderScreen> orderScreenRepository,
            IRepository<OrderRevoke> orderRevokeRepository,
            IRepository<OrderWarning> orderWarningRepository,
            IRepository<OrderUrge> orderUrgeRepository,
            IRepository<OrderComplement> orderComplementRepository,
            IRepository<OrderSupervise> orderSuperviseRepository,
            IOrderRepository orderRepository,
            IRepository<OrderExtension> orderExtensionRepository)
        {
            _mapper = mapper;
            _sessionContext = sessionContext;
            _orderSendBackRepository = orderSendBackRepository;
            _orderDelayRepository = orderDelayRepository;
            _orderScreenRepository = orderScreenRepository;
            _orderRevokeRepository = orderRevokeRepository;
            _orderWarningRepository = orderWarningRepository;
            _orderUrgeRepository = orderUrgeRepository;
            _orderComplementRepository = orderComplementRepository;
            _orderSuperviseRepository = orderSuperviseRepository;
            _orderRepository = orderRepository;
            _orderExtensionRepository = orderExtensionRepository;
        }

        /// <summary>
        /// 省退单查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_send_back_list")]
        public async Task<PagedDto<ProvinceSendBackListDto>> GetProvinceSendBackList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderSendBackRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.Destination == ESendBackDestination.Province && p.State == dto.State)
                           .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ApplyUserName), p => p.CreatorName == dto.ApplyUserName)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.CreationTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.CreationTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.CreationTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceSendBackListDto>(total, _mapper.Map<IReadOnlyList<ProvinceSendBackListDto>>(items));
        }

        /// <summary>
        /// 获取退回详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_send_back_detail")]
        public async Task<ApplyDetailDto> GetOrderSendBackDetail(string id)
        {
            var data = await _orderSendBackRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("退回查询失败");
            ApplyDetailDto applyDetailDto = new ApplyDetailDto
            {
                ApplyOrgName = data.CreatorOrgName,
                ApplyUserName = data.CreatorName,
                ApplyTime = data.CreationTime,
                ApplyReason = data.Content,
                AuditName = data.AuditName,
                AuditOrgName = data.AuditOrgName,
                AuditTime = data.AuditTime,
                AuditContent = data.Reason
            };
            if (data.State == 0)
                applyDetailDto.AuditState = "申请中";
            else if (data.State == 1)
                applyDetailDto.AuditState = "同意";
            else if (data.State == 2)
                applyDetailDto.AuditState = "不同意";
            else
                applyDetailDto.AuditState = "申请中";

            return applyDetailDto;
        }

        /// <summary>
        /// 省延期查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_delay_list")]
        public async Task<PagedDto<ProvinceOrderDelayListDto>> GetProvinceOrderDelayList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderDelayRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProDelay == true && (int)p.DelayState == dto.State)
                           .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ApplyUserName), p => p.EmployeeName == dto.ApplyUserName)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.ApplyDelayTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.ApplyDelayTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.ApplyDelayTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderDelayListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderDelayListDto>>(items));
        }

        /// <summary>
        /// 获取延期详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_delay_detail")]
        public async Task<ApplyDetailDto> GetOrderDelayDetail(string id)
        {
            var data = await _orderDelayRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("延期查询失败");

            ApplyDetailDto applyDetailDto = new ApplyDetailDto
            {
                ApplyOrgName = data.ApplyOrgName,
                ApplyUserName = data.EmployeeName,
                ApplyTime = data.ApplyDelayTime,
                ApplyReason = data.DelayReason,
                AuditName = data.AuditName,
                AuditOrgName = data.AuditOrgName,
                AuditTime = data.AuditTime,
                AuditContent = data.AuditOpinion,
                ApplyDelayNum = data.DelayNum + data.DelayUnit.GetDescription()
            };
            if (data.DelayState == EDelayState.Examining)
                applyDetailDto.AuditState = "申请中";
            else if (data.DelayState == EDelayState.Pass)
                applyDetailDto.AuditState = "同意";
            else if (data.DelayState == EDelayState.NoPass)
                applyDetailDto.AuditState = "不同意";
            else
                applyDetailDto.AuditState = "申请中";
            return applyDetailDto;
        }

        /// <summary>
        /// 省甄别查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_screen_list")]
        public async Task<PagedDto<ProvinceOrderScreenListDto>> GetProvinceOrderScreenList([FromQuery] QueryProvinceSendBackDto dto)
        {
            dto.State = dto.State switch
            {
                0 => 1,
                1 => 2,
                2 => 3,
                _ => 1,
            };
            var (total, items) = await _orderScreenRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProScreen == true && (int)p.Status == dto.State)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ApplyUserName), p => p.CreatorName == dto.ApplyUserName)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.CreationTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.CreationTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.CreationTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderScreenListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderScreenListDto>>(items));
        }

        /// <summary>
        /// 获取甄别详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_screen_detail")]
        public async Task<ApplyDetailDto> GetOrderScreenDetail(string id)
        {
            var data = await _orderScreenRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("甄别查询失败");
            ApplyDetailDto applyDetailDto = new ApplyDetailDto
            {
                ApplyOrgName = data.CreatorOrgName,
                ApplyUserName = data.CreatorName,
                ApplyTime = data.CreationTime,
                ApplyReason = data.Content,
                AuditName = data.AuditName,
                AuditOrgName = data.AuditOrgName,
                AuditTime = data.AuditTime,
                AuditContent = data.ReplyContent
            };
            if (data.Status == EScreenStatus.Approval)
                applyDetailDto.AuditState = "申请中";
            else if (data.Status == EScreenStatus.End)
                applyDetailDto.AuditState = "同意";
            else if (data.Status == EScreenStatus.Refuse)
                applyDetailDto.AuditState = "不同意";
            else
                applyDetailDto.AuditState = "申请中";
            return applyDetailDto;
        }

        /// <summary>
        /// 省撤单查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_revoke_list")]
        public async Task<PagedDto<ProvinceOrderRevokeListDto>> GetProvinceOrderRevokeList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderRevokeRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProRevoke == true)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.RevokeTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.RevokeTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.RevokeTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderRevokeListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderRevokeListDto>>(items));
        }

        /// <summary>
        /// 获取撤单详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_revoke_detail")]
        public async Task<OrderRevoke> GetOrderRevokeDetail(string id)
        {
            var data = await _orderRevokeRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("撤单查询失败");
            return data;
        }

        /// <summary>
        /// 省预警查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_warning_list")]
        public async Task<PagedDto<ProvinceOrderWarningListDto>> GetProvinceOrderWarningList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderWarningRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProWarn == true)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.WarnDate >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.WarnDate <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.WarnDate)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderWarningListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderWarningListDto>>(items));
        }

        /// <summary>
        /// 获取预警详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_warning_detail")]
        public async Task<OrderWarningDto> GetOrderWarningDetail(string id)
        {
            var data = await _orderWarningRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("预警查询失败");
            return _mapper.Map<OrderWarningDto>(data);
        }

        /// <summary>
        /// 省催办查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_urge_list")]
        public async Task<PagedDto<ProvinceOrderUrgeListDto>> GetProvinceOrderUrgeList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderUrgeRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProRemind == true)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.RemindTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.RemindTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.RemindTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderUrgeListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderUrgeListDto>>(items));
        }

        /// <summary>
        /// 获催办详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_urge_detail")]
        public async Task<ProvinceOrderUrgeDto> GetOrderUrgeDetail(string id)
        {
            var data = await _orderUrgeRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("预警查询失败");
            return _mapper.Map<ProvinceOrderUrgeDto>(data);
        }

        /// <summary>
        /// 省补充查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_complement_list")]
        public async Task<PagedDto<ProvinceOrderComplementListDto>> GetProvinceOrderComplementList([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderComplementRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.IsProComplement == true)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.SupplyTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.SupplyTime <= dto.ApplyEndTime.Value)
                           .OrderByDescending(x => x.SupplyTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderComplementListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderComplementListDto>>(items));
        }

        /// <summary>
        /// 获补充详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_complement_detail")]
        public async Task<OrderComplement> GetOrderComplementDetail(string id)
        {
            var data = await _orderComplementRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("补充查询失败");
            return data;
        }

        /// <summary>
        /// 省督办查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_supervise_list")]
        public async Task<PagedDto<ProvinceOrderSuperviseListDto>> GetProvinceOrderSuperviseList([FromQuery] QueryProvinceSuperviseDto dto)
        {
            var (total, items) = await _orderSuperviseRepository.Queryable()
                           .Includes(p => p.Order)
                           .Where(p => p.Province == true)
                          .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.Order.No == dto.No)
                           .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Order.Title == dto.Title)
                           .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.Order.ProvinceNo == dto.ProvinceNo)
                           .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.Order.ReceiveProvinceNo == dto.ReceiveProvinceNo)
                           .WhereIF(dto.ApplyStartTime.HasValue, p => p.SuperviseTime >= dto.ApplyStartTime.Value)
                           .WhereIF(dto.ApplyEndTime.HasValue, p => p.SuperviseTime <= dto.ApplyEndTime.Value)
                           .WhereIF(!string.IsNullOrEmpty(dto.OrgName), p => p.OrgName.Contains(dto.OrgName))
                           .WhereIF(dto.State.HasValue, p => p.State == dto.State)
                            .WhereIF(dto.ReplyStartTime.HasValue, p => p.ReplyTime >= dto.ReplyStartTime.Value)
                           .WhereIF(dto.ReplyEndTime.HasValue, p => p.ReplyTime <= dto.ReplyEndTime.Value)
                           .OrderByDescending(x => x.SuperviseTime)
                           .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);

            return new PagedDto<ProvinceOrderSuperviseListDto>(total, _mapper.Map<IReadOnlyList<ProvinceOrderSuperviseListDto>>(items));
        }

        /// <summary>
        /// 获督办详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_supervise_detail")]
        public async Task<OrderSupervise> GetOrderSuperviseDetail(string id)
        {
            var data = await _orderSuperviseRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("督办查询失败");
            return data;
        }

        /// <summary>
        /// 查询省拓展信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet("get_province_order_extension")]
        public async Task<PagedDto<OrderDto>> GetProvinceOrderExtension([FromQuery] QueryProvinceSendBackDto dto)
        {
            var (total, items) = await _orderRepository.Queryable()
               .Includes(p => p.OrderExtension)
               .Where(p => p.OrderExtension.Id != null && p.Source != ESource.ProvinceStraight)
               .WhereIF(!string.IsNullOrEmpty(dto.No), p => p.No == dto.No)
               .WhereIF(!string.IsNullOrEmpty(dto.Title), p => p.Title == dto.Title)
               .WhereIF(!string.IsNullOrEmpty(dto.ProvinceNo), p => p.ProvinceNo == dto.ProvinceNo)
               .WhereIF(!string.IsNullOrEmpty(dto.ReceiveProvinceNo), p => p.ReceiveProvinceNo == dto.ReceiveProvinceNo)
               .WhereIF(dto.ApplyStartTime.HasValue, p => p.CreationTime >= dto.ApplyStartTime.Value)
               .WhereIF(dto.ApplyEndTime.HasValue, p => p.CreationTime <= dto.ApplyEndTime.Value)
               .OrderByDescending(p => p.CreationTime)
               .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
            return new PagedDto<OrderDto>(total, _mapper.Map<IReadOnlyList<OrderDto>>(items));
        }

        /// <summary>
        /// 查询拓展信息详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("get_order_extension_info")]
        public async Task<OrderExtension> GetOrderExtensionInfo(string id)
        {
            var data = await _orderExtensionRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
            if (data == null)
                throw UserFriendlyException.SameMessage("拓展信息查询失败");
            return data;
        }
    }
}
