Просмотр исходного кода

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

jiangjc месяцев назад: 5
Родитель
Сommit
14db710c73
20 измененных файлов с 2239 добавлено и 495 удалено
  1. 3 0
      OASystem/OASystem.Api/Controllers/BusinessController.cs
  2. 47 68
      OASystem/OASystem.Api/Controllers/FinancialController.cs
  3. 546 236
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  4. 20 10
      OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs
  5. 948 60
      OASystem/OASystem.Api/Controllers/ResourceController.cs
  6. 9 1
      OASystem/OASystem.Api/Controllers/StatisticsController.cs
  7. 512 16
      OASystem/OASystem.Api/Controllers/SystemController.cs
  8. 3 1
      OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs
  9. 1 0
      OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs
  10. 6 0
      OASystem/OASystem.Domain/Dtos/DtoBase.cs
  11. 12 0
      OASystem/OASystem.Domain/Dtos/Groups/VisaPriceDto.cs
  12. 2 2
      OASystem/OASystem.Domain/Dtos/PersonnelModule/TreeNode.cs
  13. 13 0
      OASystem/OASystem.Domain/Entities/Groups/Grp_VisaInfo.cs
  14. 2 0
      OASystem/OASystem.Domain/ViewModels/QiYeWeChat/CheckInView.cs
  15. 25 20
      OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs
  16. 8 10
      OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs
  17. 9 8
      OASystem/OASystem.Infrastructure/Repositories/Financial/PaymentRefundAndOtherMoneyRepository.cs
  18. 0 2
      OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs
  19. 48 25
      OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs
  20. 25 36
      OASystem/OASystem.Infrastructure/Repositories/Resource/AskDataRepository.cs

+ 3 - 0
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -218,6 +218,9 @@ namespace OASystem.API.Controllers
                 {
                     sql = string.Format($"{sql} And di.TeamName Like '%{dto.TeamName}%'");
                 }
+                //去重
+                sql = $"{sql} GROUP BY di.Id,di.TeamName,di.TourCode,di.ClientName,di.VisitCountry,di.VisitStartDate,di.VisitEndDate,di.VisitDays,di.VisitPNumber,di.CreateTime";
+
 
                 RefAsync<int> total = 0;//REF和OUT不支持异步,想要真的异步这是最优解
                 var data = await _groupRep._sqlSugar.SqlQueryable<GroupListByCTableAndUserIdView>(sql).ToPageListAsync(dto.PageIndex, dto.PageSize, total); //ToPageAsync

+ 47 - 68
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -807,7 +807,6 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostReceivablesSave(ForeignReceivablesSaveDto dto)
         {
-
             return Ok(await _ForForeignReceivablesRep.PostReceivablesSave(dto));
 
         }
@@ -1656,50 +1655,44 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyItemByDiId(PaymentRefundAndOtherMoneyItemByDiIdDto dto)
         {
-            try
-            {
-                if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
 
-                if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
-
-                if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
+            if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
 
-                #region 页面功能权限处理
-                PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
-                pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+            if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
 
-                if (pageFunAuth.CheckAuth == 0)
-                {
-                    return Ok(JsonView(false, "您没有当前页面查询权限!"));
-                }
+            if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
 
-                #endregion
+            #region 页面功能权限处理
+            PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
+            pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
 
-                Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
+            if (pageFunAuth.CheckAuth == 0)
+            {
+                return Ok(JsonView(false, "您没有当前页面查询权限!"));
+            }
 
-                if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
-                {
-                    if (_result.Code != 0)
-                    {
-                        return Ok(JsonView(false, _result.Msg));
-                    }
+            #endregion
 
-                    var data = new
-                    {
-                        PageFuncAuth = pageFunAuth,
-                        Data = _result.Data
-                    };
+            Result _result = await _paymentRefundAndOtherMoneyRep._ItemByDiId(dto.DiId);
 
-                    return Ok(JsonView(true, "操作成功!", data));
-                }
-                else
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
+            {
+                if (_result.Code != 0)
                 {
-                    return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
+                    return Ok(JsonView(false, _result.Msg));
                 }
+
+                var data = new
+                {
+                    PageFuncAuth = pageFunAuth,
+                    Data = _result.Data
+                };
+
+                return Ok(JsonView(true, "操作成功!", data));
             }
-            catch (Exception ex)
+            else
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
             }
         }
 
@@ -1713,39 +1706,32 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyDel(PaymentRefundAndOtherMoneyDelDto dto)
         {
-            try
-            {
-                if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
-                if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
-                if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
-
-                PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
+            if (dto == null) return Ok(JsonView(false, "参数不能为空!"));
+            if (dto.PageId <= 0) return Ok(JsonView(false, "请传入正确的的页面Id!"));
+            if (dto.UserId <= 0) return Ok(JsonView(false, "请传入正确的的员工Id!"));
 
-                #region 页面功能权限处理
+            PageFunAuthViewBase pageFunAuth = new PageFunAuthViewBase();
 
-                pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
+            #region 页面功能权限处理
 
-                #endregion
+            pageFunAuth = await GeneralMethod.PostUserPageFuncDatas(dto.UserId, dto.PageId);
 
-                if (pageFunAuth.DeleteAuth == 0)
-                {
-                    return Ok(JsonView(false, "您没有当前页面删除权限!"));
-                }
+            #endregion
 
+            if (pageFunAuth.DeleteAuth == 0)
+            {
+                return Ok(JsonView(false, "您没有当前页面删除权限!"));
+            }
 
-                Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
 
-                if (_result.Code != 0)
-                {
-                    return Ok(JsonView(false, _result.Msg));
-                }
+            Result _result = await _paymentRefundAndOtherMoneyRep._Del(dto);
 
-                return Ok(JsonView(true, "操作成功!"));
-            }
-            catch (Exception ex)
+            if (_result.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, _result.Msg));
             }
+
+            return Ok(JsonView(true, "操作成功!"));
         }
 
         /// <summary>
@@ -1758,21 +1744,14 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfoDataSource(PortDtoBase dto)
         {
-            try
-            {
-                Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
+            Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
 
-                if (_result.Code != 0)
-                {
-                    return Ok(JsonView(false, _result.Msg));
-                }
-
-                return Ok(JsonView(true, "查询成功!", _result.Data));
-            }
-            catch (Exception ex)
+            if (_result.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, _result.Msg));
             }
+
+            return Ok(JsonView(true, "查询成功!", _result.Data));
         }
 
         /// <summary>

+ 546 - 236
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -42,6 +42,7 @@ using System.IO;
 using System.IO.Compression;
 using System.Net.Http;
 using System.Reflection.PortableExecutable;
+using System.Security.Cryptography;
 using Ubiety.Dns.Core;
 using static NPOI.POIFS.Crypt.CryptoFunctions;
 using static OASystem.API.OAMethodLib.JWTHelper;
@@ -106,42 +107,43 @@ namespace OASystem.API.Controllers
         private readonly ForeignReceivablesRepository _ffrRep;  //对外收款账单仓库
         private readonly OpinionaireRepository _opinionaireRep;  //对外收款账单仓库
 
-        public GroupsController(ILogger<GroupsController> logger, 
-                                IMapper mapper, 
-                                SqlSugarClient sqlSugar, 
-                                GrpScheduleRepository grpScheduleRep, 
-                                DelegationInfoRepository groupRepository,
-                                TaskAssignmentRepository taskAssignmentRep, 
-                                AirTicketResRepository airTicketResRep, 
-                                DecreasePaymentsRepository decreasePaymentsRep,
-                                InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, 
-                                DelegationEnDataRepository delegationEnDataRep, 
-                                EnterExitCostRepository enterExitCostRep, 
-                                DelegationVisaRepository delegationVisaRep,
-                                MessageRepository message, 
-                                VisaPriceRepository visaPriceRep, 
-                                CarTouristGuideGroundRepository carTouristGuideGroundRep,
-                                CheckBoxsRepository checkBoxs, 
-                                GroupCostRepository GroupCostRepository, 
-                                CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
-                                GroupCostParameterRepository GroupCostParameterRepository,
-                                HotelPriceRepository hotelPriceRep, 
-                                CustomersRepository customersRep, 
-                                SetDataRepository setDataRep,
-                                TourClientListRepository tourClientListRep, 
-                                TeamRateRepository teamRateRep,
-                                IHubContext<ChatHub, IChatClient> hubContext, 
-                                UsersRepository usersRep, IJuHeApiService juHeApi,
-                                InvertedListRepository invertedListRep, 
-                                VisaFeeInfoRepository visaFeeInfoRep, 
-                                TicketBlackCodeRepository ticketBlackCodeRep, 
-                                HotelInquiryRepository hotelInquiryRep,
-                                ThreeCodeRepository threeCodeRepository, 
-                                FeeAuditRepository feeAuditRep, 
-                                VisaCommissionRepository visaCommissionRep, 
-                                ForeignReceivablesRepository ffrRep,
-                                OpinionaireRepository opinionaireRep
-                                )
+        public GroupsController(
+            ILogger<GroupsController> logger, 
+            IMapper mapper,
+            IHubContext<ChatHub, IChatClient> hubContext,
+            SqlSugarClient sqlSugar, 
+            GrpScheduleRepository grpScheduleRep, 
+            DelegationInfoRepository groupRepository,
+            TaskAssignmentRepository taskAssignmentRep, 
+            AirTicketResRepository airTicketResRep, 
+            DecreasePaymentsRepository decreasePaymentsRep,
+            InvitationOfficialActivitiesRepository InvitationOfficialActivitiesRep, 
+            DelegationEnDataRepository delegationEnDataRep, 
+            EnterExitCostRepository enterExitCostRep, 
+            DelegationVisaRepository delegationVisaRep,
+            MessageRepository message, 
+            VisaPriceRepository visaPriceRep, 
+            CarTouristGuideGroundRepository carTouristGuideGroundRep,
+            CheckBoxsRepository checkBoxs, 
+            GroupCostRepository GroupCostRepository, 
+            CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
+            GroupCostParameterRepository GroupCostParameterRepository,
+            HotelPriceRepository hotelPriceRep, 
+            CustomersRepository customersRep, 
+            SetDataRepository setDataRep,
+            TourClientListRepository tourClientListRep, 
+            TeamRateRepository teamRateRep,
+            UsersRepository usersRep, IJuHeApiService juHeApi,
+            InvertedListRepository invertedListRep, 
+            VisaFeeInfoRepository visaFeeInfoRep, 
+            TicketBlackCodeRepository ticketBlackCodeRep, 
+            HotelInquiryRepository hotelInquiryRep,
+            ThreeCodeRepository threeCodeRepository, 
+            FeeAuditRepository feeAuditRep, 
+            VisaCommissionRepository visaCommissionRep, 
+            ForeignReceivablesRepository ffrRep,
+            OpinionaireRepository opinionaireRep
+            )
         {
             _logger = logger;
             _mapper = mapper;
@@ -5278,27 +5280,27 @@ FROM
             {
                 if (dto.DiId < 1)
                 {
-                    return Ok(JsonView(false, "请传入有效的DiId参数;"));
+                    return Ok(JsonView(400, "请传入有效的DiId参数;", ""));
                 }
 
                 if (dto.ExportType < 1)
                 {
-                    return Ok(JsonView(false, "请传入有效的ExportType参数; 1 明细表 2 表格"));
+                    return Ok(JsonView(400, "请传入有效的ExportType参数; 1 明细表 2 表格", ""));
                 }
 
                 if (dto.SubTypeId < 1)
                 {
-                    return Ok(JsonView(false, @"请传入有效的SubTypeId参数; 
+                    return Ok(JsonView(400, @"请传入有效的SubTypeId参数; 
                                                 1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)  
                                                 2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
-                                                3 团组成员名单 1 团组成员名单"));
+                                                3 团组成员名单 1 团组成员名单", ""));
                 }
 
                 var _EnterExitCosts = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
                 var _DayAndCosts = _sqlSugar.Queryable<Grp_DayAndCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).ToList();
                 if (_EnterExitCosts == null)
                 {
-                    return Ok(JsonView(false, "该团组未填写出入境费用;"));
+                    return Ok(JsonView(400, "该团组未填写出入境费用;",""));
                 }
 
                 //数据源
@@ -5425,7 +5427,6 @@ FROM
                             airPriceStr += $" {_EnterExitCosts.AirTD.ToString("#0.00")} 元/人(头等舱)";
                         }
 
-
                         dic.Add("AirTotalStr", airTotalStr);
                         dic.Add("AirPriceStr", airPriceStr);
                         dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
@@ -5670,8 +5671,9 @@ FROM
                         AsposeHelper.removewatermark_v2180();
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
 
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2 ) return Ok(JsonView(true, "成功", url));
                     }
                     else if (dto.SubTypeId == 1006)//1006(因公出国(境)经费测算明细表)
                     {
@@ -5835,7 +5837,6 @@ FROM
                             table1.Rows.RemoveAt(i - 1);
                         }
 
-
                         dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
 
                         string otherFeeStr = "";
@@ -5894,8 +5895,9 @@ FROM
                         string strFileName = $"{_DelegationInfo.TeamName}因公出国(境)经费测算明细表{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.docx";
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
 
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2 ) return Ok(JsonView(true, "成功", url));
                     }
                     else if (dto.SubTypeId == 1007) //1007(四川省商务厅出国经费财政先行审核表)
                     {
@@ -6135,7 +6137,8 @@ FROM
                         string strFileName = $"{_DelegationInfo.TeamName}-四川省商务厅出国经费财政先行审核表{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
                         designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
                     }
                     else if (dto.SubTypeId == 1066) //成都市因公临时出国任务和预算审批意见表(外专培训团专用)
                     {
@@ -6315,7 +6318,9 @@ FROM
                         string strFileName = $"{_DelegationInfo.TeamName}-成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
+
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
                     }
                 }
                 else if (dto.ExportType == 2) //表格
@@ -6397,7 +6402,9 @@ FROM
                         string strFileName = $"派员单位出(境)任务和预算审批意见表.docx";
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
+
+                        if (dto.PortType == 1) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2 || dto.PortType == 3) return Ok(JsonView(true, "成功", url));
 
                     }
                     else if (dto.SubTypeId == 1009)//1009(省级单位出(境)经费报销单)
@@ -6560,7 +6567,9 @@ FROM
                         string strFileName = $"省级单位出(境)经费报销单{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.docx";
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
+
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
                     }
                 }
                 else if (dto.ExportType == 3)
@@ -6569,7 +6578,7 @@ FROM
                     {
                         if (DeleClientList.Count < 1)
                         {
-                            return Ok(JsonView(false, "团组成员暂未录入!!!"));
+                            return Ok(JsonView(false, "团组成员暂未录入!!!",""));
                         }
 
                         //获取模板
@@ -6618,15 +6627,17 @@ FROM
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
 
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
-                        return Ok(JsonView(true, "成功", new { Url = url }));
+
+                        if (dto.PortType == 1 || dto.PortType == 3) return Ok(JsonView(true, "成功", new { Url = url }));
+                        else if (dto.PortType == 2) return Ok(JsonView(true, "成功", url));
                     }
                 }
 
-                return Ok(JsonView(false, "操作失败!"));
+                return Ok(JsonView(400, "操作失败!", ""));
             }
             catch (Exception ex)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(400, ex.Message, ""));
             }
         }
 
@@ -6988,7 +6999,6 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaByDiId(VisaPriceDto dto)
         {
-            
             Result groupData = await _visaPriceRep.PostVisaByDiId(dto);
             if (groupData.Code != 0)
             {
@@ -7006,19 +7016,12 @@ FROM
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryVisaById(PostVisaByIdDto dto)
         {
-            try
-            {
-                Result groupData = await _visaPriceRep.PostVisaById(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
+            Result groupData = await _visaPriceRep.PostVisaById(dto);
+            if (groupData.Code != 0)
             {
-                return Ok(JsonView(false, ex.Message));
+                return Ok(JsonView(false, groupData.Msg));
             }
+            return Ok(JsonView(true, groupData.Msg, groupData.Data));
         }
         /// <summary>
         /// 签证费用删除
@@ -7081,12 +7084,23 @@ FROM
             List<Sys_SetData> BankCard = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 15 && a.IsDel == 0).ToList();
             List<SetDataInfoView> _BankCard = _mapper.Map<List<SetDataInfoView>>(BankCard);
 
+            //代办费类型
+            var agencyFeeTypeData = new List<dynamic>() {
+                new { id = 0 , Text = "未选择" },
+                new { id = 1 , Text = "小公务" },
+                new { id = 2 , Text = "大公务" },
+            };
+
+            //签证费用标准国家Data
+            var visaCountryFeeData = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0).Select(x => new { x.Id, Country = x.VisaCountry }).ToList();
             var data = new
             {
                 Payment = _Payment,
                 CurrencyList = _CurrencyList,
                 PassengerType = _PassengerType,
-                BankCard = _BankCard
+                BankCard = _BankCard,
+                AgencyFeeType = agencyFeeTypeData,
+                CountryFeeData = visaCountryFeeData
             };
             return Ok(JsonView(true, "查询成功!", data));
         }
@@ -12243,219 +12257,515 @@ ORDER by  gctggrc.id DESC
 
             #endregion
             decimal _rate = 1.00M;
-            string _currency = "";
+            string _currency = string.Empty;
 
             var currDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.STid == 66).ToList();
-            List<Grp_HotelReservations> hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToListAsync();
+            var hrDtas = _sqlSugar.Queryable<Grp_HotelReservations>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
             if (hrDtas.Count < 1) return Ok(JsonView(StatusCodes.Status400BadRequest, "酒店预订费用未录入,不支持预定成本Excel导出", ""));
-
-            Grp_GroupCostParameter _GroupCostParameter = await _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).FirstAsync();
-            if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
-            if (string.IsNullOrEmpty(_GroupCostParameter.Currency))
+            var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
+            var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
+            
+            var _GroupCostParameter = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).First();
+            //if (_GroupCostParameter == null) return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用未录入,不支持预定成本Excel导出", ""));
+            if (_GroupCostParameter == null)
             {
-                return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
-            }
-            _currency = _GroupCostParameter.Currency;
+                //return Ok(JsonView(StatusCodes.Status400BadRequest, "团组成本费用“币种为录入”未录入,不支持预定成本Excel导出", ""));
+                bool isIntType = int.TryParse(_currency, out int currId);
+                if (isIntType)
+                {
+                    _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+                }
 
-            bool isIntType = int.TryParse(_currency, out int currId);
-            if (isIntType)
-            {
-                _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+                var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
 
-            }
+                var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
+                if (currInfo == null)
+                {
 
-            var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
+                    //return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
 
-            var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
-            if (currInfo == null)
-            {
-                return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
+                }
+                else _rate = currInfo.Rate;
 
-            }
+                if (!string.IsNullOrEmpty(_currency) && !_currency.ToUpper().Equals("CNY"))
+                {
+                    _rate = _GroupCostParameter.Rate;
+                }
 
-            if (!_currency.ToUpper().Equals("CNY"))
-            {
-                _rate = _GroupCostParameter.Rate;
-            }
 
-            _rate = currInfo.Rate;
-            hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
-            string strFileName = "HotelStatement/";
+                hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
+                string strFileName = "HotelStatement/";
 
-            string guestNames = ""; //格式Mr.xxx Ms.xxx
-            List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
-            var hotelSubData = _sqlSugar.Queryable<Grp_HotelReservationsContent>().Where(it => it.IsDel == 0 && it.DiId == _dto.DiId).ToList();
-            var ccpData = _sqlSugar.Queryable<Grp_CreditCardPayment>().Where(it => it.IsDel == 0 && it.DIId == _dto.DiId && it.CTable == 76).ToList();
-            #region 数据处理
+                string guestNames = ""; //格式Mr.xxx Ms.xxx
+                List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
+                var rateDatas = new List<dynamic>();
+                #region 数据处理
 
-            foreach (var item in hrDtas)
-            {
-                var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
+                foreach (var item in hrDtas)
+                {
+                    var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
 
-                var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
-                var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
-                var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
-                var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
+                    var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
+                    var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
+                    var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
+                    var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
 
 
-                string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
+                    if (ccpInfo == null || roomInfo == null || breakfastInfo == null || governmentRentInfo == null || cityTaxInfo == null)
+                    {
+                        continue;
+                    }
 
-                string singleRoomFeeStr = string.Empty,
-                       doubleRoomFeeStr = string.Empty,
-                       suiteRoomFeeStr = string.Empty,
-                       otherRoomFeeStr = string.Empty,
-                       payMoneyStr = string.Empty,
-                       cardPriceStr = string.Empty;
-                if (roomCurr.Equals(_currency))
-                {
-                    singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
-                    doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
-                    suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
-                    otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
-                    payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
-                    cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
+                    string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
+                    if (string.IsNullOrEmpty(_currency)) _currency = $"CNY";
+
+                    string singleRoomFeeStr = string.Empty,
+                           doubleRoomFeeStr = string.Empty,
+                           suiteRoomFeeStr = string.Empty,
+                           otherRoomFeeStr = string.Empty,
+                           payMoneyStr = string.Empty,
+                           cardPriceStr = string.Empty;
+                    if (roomCurr.Equals("CNY"))
+                    {
+                        rateDatas.Add(new { code = "CNY", rate = 1.0000 });
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? ""}";
+                        cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {currDatas.Find(it => it.Id == item.CardPriceCurrency)?.Name ?? ""}";
+                    }
+                    else
+                    {
+                        //singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        //payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
+                        //cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}\r\n{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}";
+                        rateDatas.Add(new { code = roomCurr, rate = roomInfo.Rate });
+                        var ccpPaymentCurrency = currDatas.Find(it => it.Id == ccpInfo?.PaymentCurrency)?.Name ?? "";
+                        if (ccpPaymentCurrency.Equals("CNY"))
+                        {
+                            payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} CNY";
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
+                        }
+                        else
+                        {
+
+                            rateDatas.Add(new { code = ccpPaymentCurrency, rate = ccpInfo.DayRate });
+                            payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {ccpPaymentCurrency}\r\n{((ccpInfo.PayMoney * ccpInfo.DayRate) / _rate).ToString("#0.00")} CNY";
+                        }
+
+                        var hotelcardPriceCurrency = currDatas.Find(it => it.Id == item?.CardPriceCurrency)?.Name ?? "";
+                        if (hotelcardPriceCurrency.Equals("CNY"))
+                        {
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} CNY";
+                        }
+                        else
+                        {
+                            cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {hotelcardPriceCurrency}\r\n{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} CNY";
+                        }
+
+
+
+                    }
+                    string breakfastPriceStr = string.Empty,
+                           breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
+                           governmentRentStr = string.Empty,
+                           governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
+                           cityTaxStr = string.Empty,
+                           cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
+
+                    var breakfastCurrency1 = currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(breakfastCurrency1))
+                    {
+                        if (breakfastCurrency1.Equals("CNY"))
+                        {
+                            breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = breakfastCurrency1, rate = breakfastInfo.Rate });
+                            var breakfastPriceCny = breakfastInfo.Price * breakfastInfo.Rate;
+                            breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}\r\n{breakfastPriceCny.ToString("#0.00")} CNY";
+                        }
+
+                    }
+                    else breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {breakfastCurrency1}";
+
+                    var governmentRentCurrency1 = currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(governmentRentCurrency1))
+                    {
+                        if (governmentRentCurrency.Equals("CNY"))
+                        {
+                            governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = governmentRentCurrency1, rate = governmentRentInfo.Rate });
+                            var governmentRentCny = governmentRentInfo.Price * governmentRentInfo.Rate;
+                            governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}\r\n{governmentRentCny.ToString("#0.00")} CNY";
+                        }
+                    }
+                    else governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {governmentRentCurrency1}";
+
+                    var cityTaxStrCurrency1 = currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name;
+                    if (!string.IsNullOrEmpty(cityTaxStrCurrency1))
+                    {
+                        if (cityTaxStrCurrency1.Equals("CNY"))
+                        {
+                            cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
+                        }
+                        else
+                        {
+                            rateDatas.Add(new { code = cityTaxStrCurrency1, rate = cityTaxInfo.Rate });
+                            var cityTaxCny = cityTaxInfo.Price * cityTaxInfo.Rate;
+                            cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}\r\n{cityTaxCny.ToString("#0.00")} CNY";
+                        }
+                    }
+                    else cityTaxStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {cityTaxStrCurrency1}";
+
+
+
+                    int payDId = roomInfo?.PayDId ?? 0;
+                    pcfds.Add(new HotelReservations_PCFD_View()
+                    {
+                        City = item.City,
+                        HotelName = item.HotelName,
+                        Date = $"{item.CheckInDate} - {item.CheckOutDate}",
+                        // SingleRoomCount = item.SingleRoomCount,
+                        SingleRoomPrice = singleRoomFeeStr,
+                        // DoubleRoomCount = item.DoubleRoomCount,
+                        DoubleRoomPrice = doubleRoomFeeStr,
+                        //SuiteRoomCount = item.SuiteRoomCount,
+                        SuiteRoomPrice = suiteRoomFeeStr,
+                        OtherRoomPrice = otherRoomFeeStr,
+                        //OtherRoomCount = item.OtherRoomCount,
+
+                        BreakfastPrice = breakfastPriceStr,
+                        GovernmentRent = governmentRentStr,
+                        CityTax = cityTaxStr,
+
+                        RoomExplanation = item.RoomExplanation,
+                        PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
+                        PayTime = roomInfo?.ConsumptionDate,
+                        BankNo = roomInfo?.BankNo,
+                        PayMoney = payMoneyStr,
+                        //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
+                        ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
+                        CardPrice = cardPriceStr,
+                        Remark = ccpInfo.Remark
+
+                    });
                 }
-                else
+
+                #endregion
+
+                //载入模板
+                WorkbookDesigner designer = new WorkbookDesigner();
+                designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+
+                var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
+                var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
+                designer.SetDataSource("TourNo", groupInfo.TourCode);
+
+               var rateDatas1 = rateDatas.Distinct();
+                var rateStr = string.Empty;
+                foreach (var item in rateDatas1)
                 {
-                    singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
-                    doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
-                    suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
-                    otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
-                    payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
-                    cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                    rateStr += $"{item.code} {item.rate.ToString("#0.0000")} \t\t";
                 }
-                string breakfastPriceStr = string.Empty,
-                       breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
-                       governmentRentStr = string.Empty,
-                       governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
-                       cityTaxStrStr = string.Empty,
-                       cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
 
-                breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
-                governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
-                cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
+                designer.SetDataSource("TeamName", $"酒店模块汇率:{rateStr}");
+                designer.SetDataSource("Opertor", userInfo.CnName);
+
+                DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
+                dt.TableName = "ViewMyHotelReservations";
+                designer.SetDataSource(dt);
+                designer.Process();
+
+                string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+                string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
 
-                int payDId = roomInfo?.PayDId ?? 0;
-                pcfds.Add(new HotelReservations_PCFD_View()
+                designer.Workbook.Save(serverPath);
+                string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
+
+                #region 删除指定行
+
+                bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
+                int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
+                    doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
+                    suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
+                    otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
+                    zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
+                    dsIndex = dt.Columns["GovernmentRent"].Ordinal,
+                    cssIndex = dt.Columns["CityTax"].Ordinal,
+                    cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
+                    remarkIndex = dt.Columns["Remark"].Ordinal;
+                //删除指定列
+                foreach (DataRow item in dt.Rows)
                 {
-                    City = item.City,
-                    HotelName = item.HotelName,
-                    Date = $"{item.CheckInDate} - {item.CheckOutDate}",
-                    // SingleRoomCount = item.SingleRoomCount,
-                    SingleRoomPrice = singleRoomFeeStr,
-                    // DoubleRoomCount = item.DoubleRoomCount,
-                    DoubleRoomPrice = doubleRoomFeeStr,
-                    //SuiteRoomCount = item.SuiteRoomCount,
-                    SuiteRoomPrice = suiteRoomFeeStr,
-                    OtherRoomPrice = otherRoomFeeStr,
-                    //OtherRoomCount = item.OtherRoomCount,
-
-                    BreakfastPrice = breakfastPriceStr,
-                    GovernmentRent = governmentRentStr,
-                    CityTax = cityTaxStrStr,
-
-                    RoomExplanation = item.RoomExplanation,
-                    PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
-                    PayTime = roomInfo?.ConsumptionDate,
-                    BankNo = roomInfo?.BankNo,
-                    PayMoney = payMoneyStr,
-                    //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
-                    ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
-                    CardPrice = cardPriceStr,
-                    Remark = ccpInfo.Remark
+                    string singleStr = item["SingleRoomPrice"].ToString();
+                    bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
+                    if (containsDigitButNotZero1) singleDel = false;
+                    singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
 
-                });
-            }
+                    string doubleStr = item["DoubleRoomPrice"].ToString();
+                    bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero2) doubleDel = false;
 
-            #endregion
+                    string suiteStr = item["SuiteRoomPrice"].ToString();
+                    bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero3) suiteDel = false;
 
-            //载入模板
-            WorkbookDesigner designer = new WorkbookDesigner();
-            designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+                    string otherStr = item["OtherRoomPrice"].ToString();
+                    bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
+                    if (containsDigitButNotZero4) otherDel = false;
 
-            var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
-            var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
-            designer.SetDataSource("TourNo", groupInfo.TourCode);
-            designer.SetDataSource("TeamName", $"{groupInfo.TeamName}  团组成本币种:{_currency}  团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
-            designer.SetDataSource("Opertor", userInfo.CnName);
+                    string zcStr = item["BreakfastPrice"].ToString();
+                    bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
+                    if (containsDigitButNotZero5) zcDel = false;
 
-            DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
-            dt.TableName = "ViewMyHotelReservations";
-            designer.SetDataSource(dt);
-            designer.Process();
+                    string dsStr = item["GovernmentRent"].ToString();
+                    bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
+                    if (containsDigitButNotZero6) dsDel = false;
 
-            string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
-            string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+                    string cssStr = item["CityTax"].ToString();
+                    bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
+                    if (containsDigitButNotZero7) cssDel = false;
 
-            designer.Workbook.Save(serverPath);
-            string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
-
-            #region 删除指定行
-
-            bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
-            int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
-                doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
-                suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
-                otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
-                zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
-                dsIndex = dt.Columns["GovernmentRent"].Ordinal,
-                cssIndex = dt.Columns["CityTax"].Ordinal,
-                cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
-                remarkIndex = dt.Columns["Remark"].Ordinal;
-            //删除指定列
-            foreach (DataRow item in dt.Rows)
+                    string cpStr = item["ConsumptionPatterns"].ToString();
+                    if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+
+                    string remarkStr = item["Remark"].ToString();
+                    if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+
+                }
+
+                DeleteColumn(serverPath, remarkIndex, remarkDel);
+                DeleteColumn(serverPath, cpIndex, cpDel);
+                DeleteColumn(serverPath, dsIndex, dsDel);
+                DeleteColumn(serverPath, cssIndex, cssDel);
+                DeleteColumn(serverPath, zcIndex, zcDel);
+                DeleteColumn(serverPath, otherIndex, otherDel);
+                DeleteColumn(serverPath, suiteIndex, suiteDel);
+                DeleteColumn(serverPath, doubleIndex, doubleDel);
+                DeleteColumn(serverPath, singleIndex, singleDel);
+                #endregion
+                //只保留第一个表格
+                DeleteSheet(serverPath);
+
+                return Ok(JsonView(true, "操作成功", url = rst));
+            }
+            else
             {
-                string singleStr = item["SingleRoomPrice"].ToString();
-                bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
-                if (containsDigitButNotZero1) singleDel = false;
-                singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
+                _currency = _GroupCostParameter.Currency;
+                bool isIntType = int.TryParse(_currency, out int currId);
+                if (isIntType)
+                {
+                    _currency = currDatas.Find(it => it.Id == currId)?.Name ?? "";
+
+                }
+
+                var teamRate = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, _dto.DiId, 76);
+
+                var currInfo = teamRate.Find(it => it.CurrencyCode.Equals(_currency));
+                if (currInfo == null)
+                {
+                    return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
+
+                }
+
+                if (!_currency.ToUpper().Equals("CNY"))
+                {
+                    _rate = _GroupCostParameter.Rate;
+                }
+
+                _rate = currInfo.Rate;
+                hrDtas = hrDtas.OrderBy(it => it.CheckInDate).ToList();
+                string strFileName = "HotelStatement/";
+
+                string guestNames = ""; //格式Mr.xxx Ms.xxx
+                List<HotelReservations_PCFD_View> pcfds = new List<HotelReservations_PCFD_View>();
+                #region 数据处理
 
-                string doubleStr = item["DoubleRoomPrice"].ToString();
-                bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
-                if (containsDigitButNotZero2) doubleDel = false;
+                foreach (var item in hrDtas)
+                {
+                    var ccpInfo = ccpData.Where(it => it.DIId == _dto.DiId && it.CId == item.Id).First();
 
-                string suiteStr = item["SuiteRoomPrice"].ToString();
-                bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
-                if (containsDigitButNotZero3) suiteDel = false;
+                    var roomInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 1).FirstOrDefault(); //房费
+                    var breakfastInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 2).FirstOrDefault(); //早餐
+                    var governmentRentInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 3).FirstOrDefault(); //地税
+                    var cityTaxInfo = hotelSubData.Where(it => it.HrId == item.Id && it.PriceType == 4).FirstOrDefault(); //城市税
 
-                string otherStr = item["OtherRoomPrice"].ToString();
-                bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
-                if (containsDigitButNotZero4) otherDel = false;
 
-                string zcStr = item["BreakfastPrice"].ToString();
-                bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
-                if (containsDigitButNotZero5) zcDel = false;
+                    string roomCurr = currDatas.Find(it => it.Id == roomInfo?.Currency)?.Name ?? "";
 
-                string dsStr = item["GovernmentRent"].ToString();
-                bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
-                if (containsDigitButNotZero6) dsDel = false;
+                    string singleRoomFeeStr = string.Empty,
+                           doubleRoomFeeStr = string.Empty,
+                           suiteRoomFeeStr = string.Empty,
+                           otherRoomFeeStr = string.Empty,
+                           payMoneyStr = string.Empty,
+                           cardPriceStr = string.Empty;
+                    if (roomCurr.Equals(_currency))
+                    {
+                        singleRoomFeeStr = $"{item.SingleRoomPrice.ToString("#0.00")} {_currency}";
+                        doubleRoomFeeStr = $"{item.DoubleRoomPrice.ToString("#0.00")} {_currency}";
+                        suiteRoomFeeStr = $"{item.SuiteRoomPrice.ToString("#0.00")} {_currency}";
+                        otherRoomFeeStr = $"{item.OtherRoomPrice.ToString("#0.00")} {_currency}";
+                        payMoneyStr = $"{ccpInfo.PayMoney.ToString("#0.00")} {_currency}";
+                        cardPriceStr = $"{item.CardPrice.ToString("#0.00")} {_currency}";
+                    }
+                    else
+                    {
+                        singleRoomFeeStr = $"{((item.SingleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SingleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        doubleRoomFeeStr = $"{((item.DoubleRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.DoubleRoomPrice.ToString("#0.00")} {roomCurr}";
+                        suiteRoomFeeStr = $"{((item.SuiteRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.SuiteRoomPrice.ToString("#0.00")} {roomCurr}";
+                        otherRoomFeeStr = $"{((item.OtherRoomPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.OtherRoomPrice.ToString("#0.00")} {roomCurr}";
+                        payMoneyStr = $"{((ccpInfo.PayMoney * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{ccpInfo.PayMoney.ToString("#0.00")} {roomCurr}";
+                        cardPriceStr = $"{((item.CardPrice * roomInfo.Rate) / _rate).ToString("#0.00")} {_currency}\r\n{item.CardPrice.ToString("#0.00")} {roomCurr}";
+                    }
+                    string breakfastPriceStr = string.Empty,
+                           breakfastCurrency = currDatas.Find(it => it.Id == item.BreakfastCurrency)?.Name ?? "",
+                           governmentRentStr = string.Empty,
+                           governmentRentCurrency = currDatas.Find(it => it.Id == item.GovernmentRentCurrency)?.Name ?? "",
+                           cityTaxStrStr = string.Empty,
+                           cityTaxStrCurrency = currDatas.Find(it => it.Id == item.CityTaxCurrency)?.Name ?? "";
+
+                    breakfastPriceStr = $"{breakfastInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == breakfastInfo?.Currency)?.Name}";
+                    governmentRentStr = $"{governmentRentInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == governmentRentInfo?.Currency)?.Name}";
+                    cityTaxStrStr = $"{cityTaxInfo?.Price.ToString("#0.00")} {currDatas.Find(it => it.Id == cityTaxInfo?.Currency)?.Name}";
+
+                    int payDId = roomInfo?.PayDId ?? 0;
+                    pcfds.Add(new HotelReservations_PCFD_View()
+                    {
+                        City = item.City,
+                        HotelName = item.HotelName,
+                        Date = $"{item.CheckInDate} - {item.CheckOutDate}",
+                        // SingleRoomCount = item.SingleRoomCount,
+                        SingleRoomPrice = singleRoomFeeStr,
+                        // DoubleRoomCount = item.DoubleRoomCount,
+                        DoubleRoomPrice = doubleRoomFeeStr,
+                        //SuiteRoomCount = item.SuiteRoomCount,
+                        SuiteRoomPrice = suiteRoomFeeStr,
+                        OtherRoomPrice = otherRoomFeeStr,
+                        //OtherRoomCount = item.OtherRoomCount,
+
+                        BreakfastPrice = breakfastPriceStr,
+                        GovernmentRent = governmentRentStr,
+                        CityTax = cityTaxStrStr,
+
+                        RoomExplanation = item.RoomExplanation,
+                        PayTypeName = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == payDId).First()?.Name ?? "",
+                        PayTime = roomInfo?.ConsumptionDate,
+                        BankNo = roomInfo?.BankNo,
+                        PayMoney = payMoneyStr,
+                        //PayMoneys = ccpInfo.PayMoney.ToString("#0.00"),
+                        ConsumptionPatterns = roomInfo?.ConsumptionPatterns,
+                        CardPrice = cardPriceStr,
+                        Remark = ccpInfo.Remark
 
-                string cssStr = item["CityTax"].ToString();
-                bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
-                if (containsDigitButNotZero7) cssDel = false;
+                    });
+                }
 
-                string cpStr = item["ConsumptionPatterns"].ToString();
-                if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+                #endregion
 
-                string remarkStr = item["Remark"].ToString();
-                if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+                //载入模板
+                WorkbookDesigner designer = new WorkbookDesigner();
+                designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Template/酒店预订成本.xls");
+
+                var groupInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == _dto.DiId).First();
+                var userInfo = _sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == hrDtas[0].CreateUserId).First();
+                designer.SetDataSource("TourNo", groupInfo.TourCode);
+                designer.SetDataSource("TeamName", $"{groupInfo.TeamName}  团组成本币种:{_currency}  团组汇率-->酒店模块汇率:{_rate.ToString("#0.0000")}");
+                designer.SetDataSource("Opertor", userInfo.CnName);
+
+                DataTable dt = CommonFun.GetDataTableFromIList<HotelReservations_PCFD_View>(pcfds);
+                dt.TableName = "ViewMyHotelReservations";
+                designer.SetDataSource(dt);
+                designer.Process();
+
+                string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/", "").Replace(@"\", "").Trim()}_酒店预订成本_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
+                string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+
+                designer.Workbook.Save(serverPath);
+                string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
+
+                #region 删除指定行
+
+                bool singleDel = true, doubleDel = true, suiteDel = true, otherDel = true, zcDel = true, dsDel = true, cssDel = true, cpDel = true, remarkDel = true;
+                int singleIndex = dt.Columns["SingleRoomPrice"].Ordinal,
+                    doubleIndex = dt.Columns["DoubleRoomPrice"].Ordinal,
+                    suiteIndex = dt.Columns["SuiteRoomPrice"].Ordinal,
+                    otherIndex = dt.Columns["OtherRoomPrice"].Ordinal,
+                    zcIndex = dt.Columns["BreakfastPrice"].Ordinal,
+                    dsIndex = dt.Columns["GovernmentRent"].Ordinal,
+                    cssIndex = dt.Columns["CityTax"].Ordinal,
+                    cpIndex = dt.Columns["ConsumptionPatterns"].Ordinal,
+                    remarkIndex = dt.Columns["Remark"].Ordinal;
+                //删除指定列
+                foreach (DataRow item in dt.Rows)
+                {
+                    string singleStr = item["SingleRoomPrice"].ToString();
+                    bool containsDigitButNotZero1 = !singleStr.StartsWith("0") && Regex.IsMatch(singleStr, @"[1-9]");
+                    if (containsDigitButNotZero1) singleDel = false;
+                    singleIndex = dt.Columns["SingleRoomPrice"].Ordinal;
+
+                    string doubleStr = item["DoubleRoomPrice"].ToString();
+                    bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero2) doubleDel = false;
+
+                    string suiteStr = item["SuiteRoomPrice"].ToString();
+                    bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
+                    if (containsDigitButNotZero3) suiteDel = false;
+
+                    string otherStr = item["OtherRoomPrice"].ToString();
+                    bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
+                    if (containsDigitButNotZero4) otherDel = false;
+
+                    string zcStr = item["BreakfastPrice"].ToString();
+                    bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
+                    if (containsDigitButNotZero5) zcDel = false;
+
+                    string dsStr = item["GovernmentRent"].ToString();
+                    bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
+                    if (containsDigitButNotZero6) dsDel = false;
+
+                    string cssStr = item["CityTax"].ToString();
+                    bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
+                    if (containsDigitButNotZero7) cssDel = false;
+
+                    string cpStr = item["ConsumptionPatterns"].ToString();
+                    if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
+
+                    string remarkStr = item["Remark"].ToString();
+                    if (!string.IsNullOrEmpty(remarkStr)) remarkDel = false;
+
+                }
+
+                DeleteColumn(serverPath, remarkIndex, remarkDel);
+                DeleteColumn(serverPath, cpIndex, cpDel);
+                DeleteColumn(serverPath, dsIndex, dsDel);
+                DeleteColumn(serverPath, cssIndex, cssDel);
+                DeleteColumn(serverPath, zcIndex, zcDel);
+                DeleteColumn(serverPath, otherIndex, otherDel);
+                DeleteColumn(serverPath, suiteIndex, suiteDel);
+                DeleteColumn(serverPath, doubleIndex, doubleDel);
+                DeleteColumn(serverPath, singleIndex, singleDel);
+                #endregion
+                //只保留第一个表格
+                DeleteSheet(serverPath);
 
+                return Ok(JsonView(true, "操作成功", url = rst));
             }
 
-            DeleteColumn(serverPath, remarkIndex, remarkDel);
-            DeleteColumn(serverPath, cpIndex, cpDel);
-            DeleteColumn(serverPath, dsIndex, dsDel);
-            DeleteColumn(serverPath, cssIndex, cssDel);
-            DeleteColumn(serverPath, zcIndex, zcDel);
-            DeleteColumn(serverPath, otherIndex, otherDel);
-            DeleteColumn(serverPath, suiteIndex, suiteDel);
-            DeleteColumn(serverPath, doubleIndex, doubleDel);
-            DeleteColumn(serverPath, singleIndex, singleDel);
-            #endregion
-            //只保留第一个表格
-            DeleteSheet(serverPath);
 
-            return Ok(JsonView(true, "操作成功", url = rst));
+            return Ok(JsonView(false));
         }
 
         /// <summary>

+ 20 - 10
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -52,14 +52,15 @@ namespace OASystem.API.Controllers
         /// <param name="hubContext"></param>
         /// <param name="goodsRep"></param>
         /// <param name="sqlSugar"></param>
-        public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService,
-                                         WageSheetRepository wageSheetRep,
-                                         UsersRepository usersRep,
-                                         IMapper mapper,
-                                         TaskAllocationRepository taskAllocationRep,
-                                         IHubContext<ChatHub, IChatClient> hubContext,
-                                         GoodsRepository goodsRep,
-                                         SqlSugarClient sqlSugar
+        public PersonnelModuleController(
+            IHubContext<ChatHub, IChatClient> hubContext,
+            IMapper mapper,
+            IQiYeWeChatApiService qiYeWeChatApiService,
+            WageSheetRepository wageSheetRep,
+            UsersRepository usersRep,
+            TaskAllocationRepository taskAllocationRep,
+            GoodsRepository goodsRep,
+            SqlSugarClient sqlSugar
             )
         {
             _mapper = mapper;
@@ -2304,16 +2305,25 @@ OPTION (MAXRECURSION 0); -- 允许无限递归      ";
 
 
         [HttpPost]
-        public IActionResult QueryAssessmentByUser(QueryAssessmentByUser Dto)
+        public async Task<IActionResult> QueryAssessmentByUser(QueryAssessmentByUser Dto)
         {
             var jw = JsonView(false);
             var user_entity = _sqlSugar.Queryable<Sys_Users>()
                               .First(e => e.Id == Dto.UserId && e.IsDel == 0);
 
+            var start_Bool = DateTime.TryParse(Dto.Start, out DateTime start);
+            var end_Bool = DateTime.TryParse(Dto.End, out DateTime end);
+
+            if (!start_Bool || !end_Bool)
+            {
+                jw.Msg = "时间格式不正确!";
+                return Ok(jw);
+            }
+
             jw.Msg = "用户企业微信Id未绑定!";
             if (user_entity != null && !string.IsNullOrEmpty(user_entity.QiyeChatUserId))
             {
-                var data = _qiYeWeChatApiService.QueryAssessmentByUser(Dto.Start, Dto.End, new List<string> { user_entity.QiyeChatUserId });
+                var data = await _qiYeWeChatApiService.QueryAssessmentByUser(start, end, new List<string> { user_entity.QiyeChatUserId });
                 jw.Data = data;
                 jw.Msg = "查询成功!";
                 jw.Code = 200;

Разница между файлами не показана из-за своего большого размера
+ 948 - 60
OASystem/OASystem.Api/Controllers/ResourceController.cs


+ 9 - 1
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -36,7 +36,15 @@ namespace OASystem.API.Controllers
         /// <param name="sqlSugar"></param>
         /// <param name="groupRep"></param>
         /// <param name="setDataRep"></param>
-        public StatisticsController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate, VisitingClientsRepository visitingClientsRep)
+        public StatisticsController(
+            IMapper mapper, 
+            IConfiguration config, 
+            SqlSugarClient sqlSugar, 
+            DelegationInfoRepository groupRep, 
+            SetDataRepository setDataRep, 
+            TeamRateRepository teamRate, 
+            VisitingClientsRepository visitingClientsRep
+            )
         {
             _mapper = mapper;
             _config = config;

+ 512 - 16
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -13,6 +13,8 @@ using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 using static QRCoder.PayloadGenerator;
 using static Quartz.Logging.OperationName;
 using static OASystem.API.OAMethodLib.JWTHelper;
+using System.Runtime.Intrinsics.Arm;
+using OASystem.Domain.Dtos.Statistics;
 
 namespace OASystem.API.Controllers
 {
@@ -43,21 +45,23 @@ namespace OASystem.API.Controllers
         private readonly List<int> _taskTypeList = new List<int>() { 6 };//任务通知 TaskNotification
 
 
-        public SystemController(CompanyRepository syscom, 
-                                DepartmentRepository sysDepRep, 
-                                UsersRepository userRep,
-                                IMapper mapper, 
-                                SqlSugarClient sqlSugar, 
-                                SetDataRepository setDataRepository, 
-                                CompanyRepository companyRepository,
-                                SystemMenuPermissionRepository systemMenuPermissionRepository,
-                                PageFunctionPermissionRepository pageFunctionPermissionRepository,
-                                SystemMenuAndFunctionRepository systemMenuAndFunctionRepository, 
-                                JobPostAuthorityRepository jobPostAuthorityRepository,
-                                JobPostRepository jobRep, 
-                                UserAuthorityRepository userAuthorityRepository, 
-                                MessageRepository messageRep, 
-                                SetDataTypeRepository setDataTypeRep )
+        public SystemController(
+            CompanyRepository syscom,
+            DepartmentRepository sysDepRep,
+            UsersRepository userRep,
+            IMapper mapper,
+            SqlSugarClient sqlSugar,
+            SetDataRepository setDataRepository,
+            CompanyRepository companyRepository,
+            SystemMenuPermissionRepository systemMenuPermissionRepository,
+            PageFunctionPermissionRepository pageFunctionPermissionRepository,
+            SystemMenuAndFunctionRepository systemMenuAndFunctionRepository,
+            JobPostAuthorityRepository jobPostAuthorityRepository,
+            JobPostRepository jobRep,
+            UserAuthorityRepository userAuthorityRepository,
+            MessageRepository messageRep,
+            SetDataTypeRepository setDataTypeRep
+            )
         {
             _syscomRep = syscom;
             _sysDepRep = sysDepRep;
@@ -2522,7 +2526,499 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
                 }
                 else if (department.Equals("国交部"))//国交部
                 {
-                    return Ok(JsonView(false, "国交部消息提示正在开发者中......"));
+                    #region 团组费用录入提示
+                    /*
+                     * 名称:团组费用录入提示
+                     * 描述:团组费用录入提醒(根据团组结束时间 - 3天 如果对应的数据表里没有这个团组的费用信息)
+                     * 条件:时间范围不限制、 根据团组结束时间 - 3天 == 当前天数
+                     */
+                    var groupModlue = new List<int>() {
+                        76,  //酒店预订
+                        79,  //车/导游地接
+                        80,  //签证
+                        81,  //邀请/公务活动
+                        //82,  //团组客户保险
+                        85,  //机票预订
+                        98,  //其他款项
+                        //285 ,//收款退还
+                        //1015,//超支费用
+                    };
+                    var crrDate = DateTime.Now.ToString("yyyy-MM-dd");
+                    var groupModlueData = await _sqlSugar.Queryable<Sys_SetData>().Where(x => groupModlue.Contains(x.Id)).ToListAsync();
+
+                    var groupFeeData = await _sqlSugar.Queryable<Sys_SetData>()
+                        .LeftJoin<Grp_CreditCardPayment>((sd, ccp) => sd.Id == ccp.CTable)
+                        .LeftJoin<Grp_DelegationInfo>((sd, ccp, di) => ccp.DIId == di.Id)
+                        .Where((sd, ccp, di) => ccp.IsDel == 0 &&
+                                                di.IsDel == 0 &&
+                                                groupModlue.Contains(ccp.CTable) &&
+                                                di.VisitEndDate.AddDays(-3).ToString("yyyy-MM-dd").Equals(crrDate)
+                         )
+                        .GroupBy((sd, ccp, di) => new { di.Id, di.TeamName, ccp.CTable, sd.Name }) //可以多字段
+                        .Select((sd, ccp, di) => new {
+                            diId = di.Id,
+                            groupName = di.TeamName,
+                            groupType = ccp.CTable,
+                            groupTypeName = sd.Name,
+                            //userId = ccp.CreateUserId,
+                            count = SqlFunc.AggregateCount(ccp.CTable),
+                        })
+                        .ToListAsync();
+                    var groupFeeData1 = groupFeeData.GroupBy(x => x.diId);
+                    var groupNotFilledFeeData = new List<dynamic>();
+                    foreach (var groupFee in groupFeeData1)
+                    {
+                        var diId = groupFee.Key;
+                        var addData = groupFeeData.Where(x => x.diId == diId).Select(x => x.groupType).ToList();
+                        if (addData.Count < 1) continue;
+                        var unAddData = groupModlue.Except(addData).ToList();
+                        if (unAddData.Count < 1) continue;
+
+                        foreach (var typeId in unAddData)
+                        {
+                            groupNotFilledFeeData.Add(new
+                            {
+                                diId = diId,
+                                groupName = groupFee.FirstOrDefault()?.groupName ?? "-",
+                                groupType = typeId,
+                                groupTypeName = groupModlueData.Find(x => x.Id == typeId)?.Name ?? "-",
+                                count = 0
+                            });
+                        }
+                    }
+                    #endregion
+
+                    #region 日付申请 -- 未审核数据
+
+                    var depUserData = await _sqlSugar.Queryable<Sys_Users>()
+                        .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
+                        .LeftJoin<Sys_JobPost>((u, d, jp) => u.JobPostId == jp.Id)
+                        .Where((u, d, jp) => u.IsDel == 0 && d.DepName.Contains("国交部"))
+                        .Select((u, d, jp) => new
+                        {
+                            u.Id,
+                            u.CnName,
+                            u.DepId,
+                            d.DepName,
+                            u.JobPostId,
+                            jp.JobName
+                        })
+                        .ToListAsync();
+                    var depUserData1 = depUserData.Select(x => x.Id).ToList();
+
+                    var unAuditDailyFeeData = await _sqlSugar.Queryable<Fin_DailyFeePayment>()
+                        .LeftJoin<Sys_Users>((dfp, u) => dfp.CreateUserId == u.Id)
+                        .Where((dfp, u) => dfp.IsDel == 0 &&
+                                           depUserData1.Contains(dfp.CreateUserId) &&
+                                           dfp.MAudit == 0 &&
+                                           dfp.CreateTime >= currStartDate &&
+                                           dfp.CreateTime <= currEntDate
+                         )
+                        .Select((dfp, u) => new
+                        {
+                            id = dfp.Id,
+                            amountName = dfp.Instructions,
+                            amount = dfp.SumPrice,
+                            fAuditStatus = dfp.FAudit == 1 ? "审核通过" :
+                                           dfp.FAudit == 2 ? "审核未通过" : "未审核",
+                            fAuditDate = dfp.FAuditDate,
+                            dfp.CreateUserId,
+                            CreateUserName = u.CnName,
+                            dfp.CreateTime
+                        })
+                        .ToArrayAsync();
+
+                    #endregion
+
+                    var jobs = new List<string>() { "经理", "主管" };
+                    if (jobs.Contains( currUserInfo.Role)) //经理、主管
+                    {
+                        #region 经理、主管
+                        //经理、主管(部门下所有人员) --> 日付(-:未审核提示)、团组费用录入提醒(根据团组结束时间-3天 如果对应的数据表里没有这个团组的费用信息)
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                userTourGuideData = unAuditDailyFeeData,
+                                Count = unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        var groupNotFilledFeeDataAll = groupNotFilledFeeData
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                hotelFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{groupNotFilledFeeDataAll.Count()}个团组费用未填写",
+                            Data = groupNotFilledFeeDataAll,
+                        };
+
+                        #endregion
+
+                        return Ok(JsonView(new { groupNotFillEdFeeData = groupNotFillEdFeeData1, dailyPaymentData = dailyPaymentData }));
+                    }
+                    else if (currUserInfo.Role.Equals("计调"))//计调
+                    {
+                        #region 计调
+                        //计调(myself) --> 暂定
+                        return Ok(JsonView(false, "国交部-->计调岗位消息提示正在开发中......"));
+                        #endregion
+                    }
+                    else if (currUserInfo.Role.Equals("机票"))//机票
+                    {
+                        #region 机票
+                        //机票(myself) --> 日付(-:未审核提示)、机票费用(-:未录入提示)
+                        var airTicket_unAuditDailyFeeData = unAuditDailyFeeData.Where(x => x.CreateUserId == currUserInfo.UserId).ToList();
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{airTicket_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{airTicket_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                userTourGuideData = airTicket_unAuditDailyFeeData,
+                                Count = airTicket_unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        var airTicket_groupNotFilledData = groupNotFilledFeeData
+                            .Where(x => x.groupType == 85)
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                airTicketFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{airTicket_groupNotFilledData.Count()}个团组费用未填写",
+                            Data = airTicket_groupNotFilledData,
+                        };
+
+                        #endregion
+
+                        return Ok(JsonView(new { groupNotFillEdFeeData = groupNotFillEdFeeData1, dailyPaymentData = dailyPaymentData }));
+                    }
+                    else if (currUserInfo.Role.Equals("酒店"))//酒店
+                    {
+                        #region 酒店
+                        //酒店(myself) --> 日付(-:未审核提示)、酒店费用(-:未录入提示)
+                        var hotle_unAuditDailyFeeData = unAuditDailyFeeData.Where(x => x.CreateUserId == currUserInfo.UserId).ToList();
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{hotle_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{hotle_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                hotelFeeData = hotle_unAuditDailyFeeData,
+                                Count = hotle_unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        var hotel_groupNotFilledData = groupNotFilledFeeData
+                            .Where(x => x.groupType == 76)
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                hotelFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{hotel_groupNotFilledData.Count()}个团组费用未填写",
+                            Data = hotel_groupNotFilledData,
+                        };
+
+                        #endregion
+
+                        return Ok(JsonView(new { groupNotFillEdFeeData = groupNotFillEdFeeData1, dailyPaymentData = dailyPaymentData }));
+                    }
+                    else if (currUserInfo.Role.Equals("签证"))//签证
+                    {
+                        #region 签证
+                        //签证(myself) --> 日付(-:未审核提示)、签证费用(-:未录入提示)
+                        var visa_unAuditDailyFeeData = unAuditDailyFeeData.Where(x => x.CreateUserId == currUserInfo.UserId).ToList();
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{visa_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{visa_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                visaFeeData = visa_unAuditDailyFeeData,
+                                Count = visa_unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        var visa_groupNotFilledData = groupNotFilledFeeData
+                            .Where(x => x.groupType == 80)
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                airTicketFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{visa_groupNotFilledData.Count()}个团组费用未填写",
+                            Data = visa_groupNotFilledData,
+                        };
+                        #endregion
+
+                        return Ok(JsonView(new { groupNotFillEdFeeData = groupNotFillEdFeeData1, dailyPaymentData = dailyPaymentData }));
+                    }
+                    else if (currUserInfo.Role.Equals("商邀"))//商邀
+                    {
+                        #region 商邀
+                        //商邀(myself) --> 日付(-:未审核提示)、商邀费用(-:未录入提示)、(公务、翻译人)(-:新增提示)
+                        //日付
+                        var in_unAuditDailyFeeData = unAuditDailyFeeData.Where(x => x.CreateUserId == currUserInfo.UserId).ToList();
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{in_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{in_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                visaFeeData = in_unAuditDailyFeeData,
+                                Count = in_unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        //团组未录入费用
+                        var in_groupNotFilledData = groupNotFilledFeeData
+                            .Where(x => x.groupType == 81)
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                airTicketFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{in_groupNotFilledData.Count()}个团组费用未填写",
+                            Data = in_groupNotFilledData,
+                        };
+
+                        //商邀 - 基础数据
+                        var invitationData = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
+                        .LeftJoin<Sys_Users>((ioa, u) => ioa.CreateUserId == u.Id)
+                        .Where((ioa, u) => ioa.IsDel == 0 && ioa.CreateTime >= startDateTime && ioa.CreateTime <= endDateTime)
+                        .Select((ioa, u) => new
+                        {
+                            //Area = string.Format("{0}{1}", ioa.Country, !string.IsNullOrEmpty(ioa.City) ? "" : "-" + ioa.City),
+                            Area = string.Format("{0}{1}", ioa.Country, ioa.City),
+                            Client = ioa.UnitName,
+                            ioa.Contact,
+                            ioa.Job,
+                            ioa.Tel,
+                            ioa.CreateUserId,
+                            CreatleUserName = u.CnName,
+                            ioa.CreateTime,
+                        })
+                        .ToListAsync();
+                        var invitationGroups = invitationData.GroupBy(x => x.CreateUserId)
+                            .Select(g => new {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                                msgTips = $"上月新增商邀资源共{g.Count()}条",
+                                userTourGuideData = g.ToList(),
+                                Count = g.Count()
+                            });
+                        var invitationData1 = new
+                        {
+                            msgTips = $"上月新增商邀资源共{invitationData.Count}条",
+                            Data = invitationGroups,
+                        };
+
+                        #endregion
+
+                        return Ok(JsonView(new { groupNotFillEdFeeData = groupNotFillEdFeeData1, dailyPaymentData = dailyPaymentData, invitationData = invitationData }));
+                    }
+                    else if (currUserInfo.Role.Equals("OP"))//OP
+                    {
+                        #region OP
+                        //OP(myself) --> 日付(-:未审核提示)、OP费用(-:未录入提示)、(导游、车)资源信息(-:新增提示)
+                        //日付
+                        var in_unAuditDailyFeeData = unAuditDailyFeeData.Where(x => x.CreateUserId == currUserInfo.UserId).ToList();
+
+                        var dailyPaymentData = new
+                        {
+                            msgTips = $"本年有{in_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                            Data = new
+                            {
+                                uId = currUserInfo.UserId,
+                                name = currUserInfo.UserName,
+                                msgTips = $"本年有{in_unAuditDailyFeeData.Count()}条未审核日常付款申请条",
+                                visaFeeData = in_unAuditDailyFeeData,
+                                Count = in_unAuditDailyFeeData.Count()
+                            }
+                        };
+
+                        //OP - 团组未录入费用
+                        var in_groupNotFilledData = groupNotFilledFeeData
+                            .Where(x => x.groupType == 79)
+                            .GroupBy(x => x.diId)
+                            .Select(g => new
+                            {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.groupName ?? "-",
+                                msgTips = $"-",
+                                airTicketFeeData = g.Select(x1 => new
+                                {
+                                    x1.groupType,
+                                    x1.groupTypeName
+                                }).ToList(),
+                                Count = g.Count()
+                            })
+                            .ToList();
+
+                        var groupNotFillEdFeeData1 = new
+                        {
+                            msgTips = $"今天有{in_groupNotFilledData.Count()}个团组费用未填写",
+                            Data = in_groupNotFilledData,
+                        };
+
+                        #region op地接导游
+                        //1.2 op地接导游 
+                        var opTourGuideData = await _sqlSugar.Queryable<Res_LocalGuideData>()
+                            .LeftJoin<Sys_Users>((lgd, u) => lgd.CreateUserId == u.Id)
+                            .Where((lgd, u) => lgd.IsDel == 0 && lgd.CreateTime >= startDateTime && lgd.CreateTime <= endDateTime)
+                            .Select((lgd, u) => new
+                            {
+                                Area = lgd.UnitArea,
+                                Client = lgd.UnitName,
+                                lgd.Contact,
+                                Job = "",
+                                Tel = lgd.ContactTel,
+                                lgd.CreateUserId,
+                                CreatleUserName = u.CnName,
+                                lgd.CreateTime,
+                            })
+                            .ToListAsync();
+                        var opTourGuideDataGroups = opTourGuideData.GroupBy(x => x.CreateUserId)
+                            .Select(g => new {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                                msgTips = $"上月新增OP地接导游资源共{g.Count()}条",
+                                userTourGuideData = g.ToList(),
+                                Count = g.Count()
+                            });
+
+                        var opTourGuideData1 = new
+                        {
+                            msgTips = $"上月新增OP地接导游资源共{opTourGuideData.Count}条",
+                            Data = opTourGuideDataGroups,
+                        };
+                        #endregion
+
+                        #region op车数据
+                        //1.3 op车数据 
+                        var opCarData = await _sqlSugar.Queryable<Res_CarData>()
+                            .LeftJoin<Sys_Users>((cd, u) => cd.CreateUserId == u.Id)
+                            .Where((cd, u) => cd.IsDel == 0 && cd.CreateTime >= startDateTime && cd.CreateTime <= endDateTime)
+                            .Select((cd, u) => new
+                            {
+                                Area = cd.UnitArea,
+                                Client = cd.UnitName,
+                                cd.Contact,
+                                Job = "",
+                                Tel = cd.ContactTel,
+                                cd.CreateUserId,
+                                CreatleUserName = u.CnName,
+                                cd.CreateTime,
+                            })
+                            .ToListAsync();
+                        var opCarDataGroups = opCarData.GroupBy(x => x.CreateUserId)
+                            .Select(g => new {
+                                uId = g.Key,
+                                name = g.ToList().FirstOrDefault()?.CreatleUserName ?? "-",
+                                msgTips = $"上月新增OP地接车资源共{g.Count()}条",
+                                userTourGuideData = g.ToList(),
+                                Count = g.Count()
+                            });
+                        var opCarData1 = new
+                        {
+                            msgTips = $"上月新增OP地接车资源共{opCarData.Count}条",
+                            Data = opCarDataGroups,
+                        };
+                        #endregion
+
+                        #endregion
+
+                        return Ok(JsonView(new
+                        {
+                            groupNotFillEdFeeData = groupNotFillEdFeeData1,
+                            dailyPaymentData = dailyPaymentData,
+                            CarData = opCarData1,
+                            TourGuideData = opTourGuideData
+                        }));
+                    }
+
+                    return Ok(JsonView(false, "国交部消息提示正在开发中......"));
                 }
                 else if (department.Equals("财务部"))//总经办
                 {

+ 3 - 1
OASystem/OASystem.Api/OAMethodLib/GeneralMethod.cs

@@ -619,6 +619,7 @@ namespace OASystem.API.OAMethodLib
              * 98  其他款项  --> 总经办部门 总经理 岗位/国交部门(ALL) 岗位/财务部门(ALL) 岗位/策划部门(ALL) 岗位/人事部门 采购 岗位
              * 1015 超支费用,69 收款退还  --> 财务部门(ALL)岗位
              * 1015 超支费用  --> 国交部(ALL)岗位
+             * 1081	文档下载  -->  国交部门 酒店,主管 岗位
              */
             var groupsTaskAssignments = new List<Grp_GroupsTaskAssignment>();
             // 76  酒店预订  --> 国交部门(7) 酒店(25)、主管(22) 岗位 
@@ -785,7 +786,8 @@ namespace OASystem.API.OAMethodLib
                   UId = it.Id,
                   CreateUserId = userId
               }).ToList()
-          );
+            );
+
 
             if (groupsTaskAssignments.Count > 0)
             {

+ 1 - 0
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/QiYeWeChatApiService.cs

@@ -739,6 +739,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI
                     Name = item.base_info.name,
                     Regular_days = item.summary_info.regular_days,
                     Exception_info_List = new List<Exception_info>(),
+                    Work_days = item.summary_info.work_days
                 });
             }
 

+ 6 - 0
OASystem/OASystem.Domain/Dtos/DtoBase.cs

@@ -74,6 +74,12 @@ namespace OASystem.Domain.Dtos
         public string Remark { get; set; }
     }
 
+    public class AskDataProvinceFileDto {
+
+        public int[] DataIdItem { get; set; }
+        public int DiId { get; set; }
+    }
+
     /// <summary>
     /// 员工页面操作功能权限
     /// </summary>

+ 12 - 0
OASystem/OASystem.Domain/Dtos/Groups/VisaPriceDto.cs

@@ -144,5 +144,17 @@ namespace OASystem.Domain.Dtos.Groups
         /// 签证描述
         /// </summary>
         public string VisaDescription { get; set; }
+
+        /// <summary>
+        /// 地区
+        /// </summary>
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        public int AgencyFeeType { get; set; }
+
     }
 }

+ 2 - 2
OASystem/OASystem.Domain/Dtos/PersonnelModule/TreeNode.cs

@@ -174,7 +174,7 @@ namespace OASystem.Domain.Dtos.PersonnelModule
     {
         public int UserId { get; set; }
 
-        public DateTime Start { get; set; }
-        public DateTime End { get; set; }
+        public string Start { get; set; }
+        public string End { get; set; }
     }
 }

+ 13 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_VisaInfo.cs

@@ -17,7 +17,20 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable =true,ColumnDataType ="int")]
         public int DIId { get; set; }
+        
         /// <summary>
+        /// 区域
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string Area { get; set; }
+
+        /// <summary>
+        /// 代办费类型
+        /// 0 未选择 1 小公务 2 大公务
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int AgencyFeeType { get; set; }
+
         /// 签证客户
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]

+ 2 - 0
OASystem/OASystem.Domain/ViewModels/QiYeWeChat/CheckInView.cs

@@ -314,6 +314,8 @@ namespace OASystem.Domain.ViewModels.QiYeWeChat
 
         public List<Exception_info> Exception_info_List { get; set; }
 
+        public int Work_days { get; set; }
+
     }
 
     public class Exception_info

+ 25 - 20
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -57,7 +57,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
                 50, //销售费用
                 51, //其他费用
                 55, //大运会
-                //90, //各部门基础固定费用明细
+                90, //各部门基础固定费用明细
             };
             var priceTypeData = setTypeData.Where(s => typeIds.Contains(s.Id)).ToList();
             var priceSubTypeData = setData.Where(s => typeIds.Contains(s.STid)).ToList();
@@ -423,29 +423,34 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
             #region 已审核过的日付申请不可编辑
 
-            Fin_DailyFeePayment _DailyFeePayment = await _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(it => it.Id == dto.Id && it.IsDel == 0).FirstAsync();
+            var _DailyFeePayment = await _sqlSugar.Queryable<Fin_DailyFeePayment>().Where(it => it.Id == dto.Id && it.IsDel == 0).FirstAsync();
             if (_DailyFeePayment != null)
             {
-                //if (_DailyFeePayment.FAudit != 0 && _DailyFeePayment.MAudit != 0)
-                //{
-                //    result.Msg = "财务和总经理均已审核,不可修改!";
-                //    return result;
-                //}
-                //else if (_DailyFeePayment.FAudit != 0)
-                //{
-                //    result.Msg = "财务已审核,不可修改!";
-                //    return result;
-                //}
-                //else if (_DailyFeePayment.MAudit != 0)
-                //{
-                //    result.Msg = "总经理已审核,不可修改!";
-                //    return result;
-                //}
-
                 if (_DailyFeePayment.FAudit == 1 || _DailyFeePayment.MAudit == 1)
                 {
-                    result.Msg = "审核已通过,不可修改!";
-                    return result;
+                    var setData = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.Id == dto.PriceTypeId).FirstAsync();
+                    if (setData != null)
+                    {
+                        if (setData.STid == 90)
+                        {
+                            if (_DailyFeePayment.IsPay == 1)
+                            {
+                                result.Msg = "该笔费用已付款,不可修改!";
+                                return result;
+
+                            }
+                        }
+                        else
+                        {
+                            result.Msg = "审核已通过,不可修改!";
+                            return result;
+                        }
+                    }
+                    else
+                    {
+                        result.Msg = "审核已通过,不可修改!";
+                        return result;
+                    }
                 }
             }
 

+ 8 - 10
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -28,7 +28,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         private readonly IMapper _mapper;
         private readonly DelegationInfoRepository _delegationRep;
         private readonly SetDataRepository _setDataRep;
-        
+        private readonly List<int> _portTypes = new List<int>() { 1, 2, 3 };
 
         public ForeignReceivablesRepository(SqlSugarClient sqlSugar, IMapper mapper, DelegationInfoRepository delegationRep, SetDataRepository setDataRep)
             : base(sqlSugar)
@@ -332,7 +332,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// <returns></returns>
         public async Task<JsonView> PostGroupReceivablesInfoByDiId(ForForeignReceivablesNewDto dto)
         {
-            JsonView result = new() { Code = 400,Msg="" };
+            JsonView result = new() { Code = 400, Msg = "" };
 
             //var groupInfoData = await _delegationRep.GetGroupInfo(new GroupInfoDto() { Id = dto.DiId });
             var groupInfoData = await _delegationRep.Query(x => x.Id == dto.DiId)
@@ -386,8 +386,9 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
             }
 
             int addCount = 0, updateCount = 0;
-            if (dto.PortType == 1)
-            {
+             
+            //if (dto.PortType == 1)
+            //{
                 //查询值是否更改
                 var selectInfos = await _sqlSugar.Queryable<Fin_ForeignReceivables>().Where(it => it.Diid == dto.DiId && it.Status == 1).ToListAsync();
 
@@ -442,7 +443,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                 }
                 result.Code = 200;
                 result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
-            }
+            //}
 
             return result;
         }
@@ -487,10 +488,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                 result.Msg = "操作成功!";
                 result.Code = 200;
             }
-            else
-            {
-                result.Msg = "操作失败!";
-            }
+            else result.Msg = "操作失败!";
             return result;
         }
 
@@ -530,7 +528,7 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
         public void OverSpSeteceivables(OverSpSeteceivablesDto dto)
         {
             var querySaveReceivables = _sqlSugar.Queryable<Fin_ForeignReceivables>()
-    .First(x => x.Diid == dto.DiId && x.AddingWay == 3 && x.IsDel == 0);
+                .First(x => x.Diid == dto.DiId && x.AddingWay == 3 && x.IsDel == 0);
 
             //获取所有超支数据
             //整理超支数据

+ 9 - 8
OASystem/OASystem.Infrastructure/Repositories/Financial/PaymentRefundAndOtherMoneyRepository.cs

@@ -355,14 +355,15 @@ WHERE
   prom.IsDel = 0
   AND ccp.IsDel = 0
   AND ccp.DIId = prom.DiId
-  AND prom.PriceName = '{0}'",_PaymentRefundAndOtherMoney.PriceName);
-                    var data = await _sqlSugar.SqlQueryable<Fin_PaymentRefundAndOtherMoneyInfoView>(sql).FirstAsync();
-
-                    if (data != null)
-                    {
-                        _view.Msg = "费用名称已存在,请勿重新添加!";
-                        return _view;
-                    }
+  AND ccp.DIId = {0}
+  AND prom.PriceName = '{1}'", _PaymentRefundAndOtherMoney.DiId,_PaymentRefundAndOtherMoney.PriceName);
+                    //var data = await _sqlSugar.SqlQueryable<Fin_PaymentRefundAndOtherMoneyInfoView>(sql).FirstAsync();
+
+                    //if (data != null)
+                    //{
+                    //    _view.Msg = "费用名称已存在,请勿重新添加!";
+                    //    return _view;
+                    //}
                    
                     #endregion
 

+ 0 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -37,8 +37,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             _mapper = mapper;
         }
 
-
-
         /// <summary>
         /// 根据团组Id客人名单List
         /// </summary>

+ 48 - 25
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -7,6 +7,7 @@ using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.System;
@@ -297,22 +298,17 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
         /// <returns></returns>
         public async Task<Result> PostVisaById(PostVisaByIdDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
-                Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
-                var data = new
-                {
-                    VisaInfo = _VisaInfo,
-                    CreditCardPayment = _CreditCardPayment
-                };
-                return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
-            }
-            catch (Exception ex)
+            var result = new Result() { Code = -2, Msg = "未知错误" };
+
+            Grp_VisaInfo _VisaInfo = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.Id == dto.Id && a.IsDel == 0);
+            Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 80);
+            var data = new
             {
-                return result = new Result() { Code = -2, Msg = "未知错误" };
-            }
+                VisaInfo = _VisaInfo,
+                CreditCardPayment = _CreditCardPayment
+            };
+            return result = new Result() { Code = 0, Msg = "暂无数据!", Data = data };
+
         }
         /// <summary>
         /// 签证费用录入操作(Status:1.新增,2.修改)
@@ -339,8 +335,32 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             c.RMBPrice = c.PayMoney;
             c.DayRate = 1.0000M;
-            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
-            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+
+            #region 自动审核处理
+            var isAutoAudit = false;
+            if (dto.IsThird == 0)
+            {
+                var visaFeeInfo = _sqlSugar.Queryable<Res_CountryFeeCost>().Where(x => x.IsDel == 0 && x.VisaCountry.Equals(dto.Area)).First();
+                if (visaFeeInfo != null) {
+
+                    var visaFeePrice = visaFeeInfo.VisaPrice;
+                    if (dto.AgencyFeeType == 1) visaFeePrice += visaFeeInfo.PettyBusinessAgencyFee;
+                    else if (dto.AgencyFeeType == 2) visaFeePrice += visaFeeInfo.GrandBusinessAgencyFee;
+                    var visaFeeTotalPrice = visaFeePrice * dto.VisaNumber;
+                    if (dto.VisaPrice <= visaFeeTotalPrice)
+                    {
+                        isAutoAudit = true;
+                        c.IsAuditGM = 3;
+                        c.AuditGMOperate = 4; //系统管理员
+                        c.AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    }
+                }
+            }
+
+            #endregion
+
+            var _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
+            var currencyInfos = new List<CurrencyInfo>();
             if (_TeamRate != null)
             {
                 Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
@@ -358,13 +378,14 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
 
             if (dto.Status == 1)//添加
             {
-                Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
-                                                 .First(a => a.IsDel == 0 &&
-                                                             a.VisaDescription.Equals(dto.VisaDescription) &&
-                                                             a.VisaCurrency == dto.VisaCurrency &&
-                                                             a.VisaPrice == dto.VisaPrice &&
-                                                             a.VisaClient == dto.VisaClient
-                                                  );
+                var grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
+                    .First(a => a.IsDel == 0 &&
+                                a.DIId == dto.DiId &&
+                                a.VisaDescription.Equals(dto.VisaDescription) &&
+                                a.VisaCurrency == dto.VisaCurrency &&
+                                a.VisaPrice == dto.VisaPrice &&
+                                a.VisaClient == dto.VisaClient
+                    );
                 if (grp_Visa != null)
                 {
                     return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };
@@ -433,8 +454,10 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
                                                     BankNo = c.BankNo,
                                                     CardholderName = c.CardholderName,
                                                     Remark = c.Remark,
-
                                                 })
+                                                .SetColumnsIF(isAutoAudit, x => x.IsAuditGM == 3)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMOperate == 4)
+                                                .SetColumnsIF(isAutoAudit, x => x.AuditGMDate == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                                                 .ExecuteCommandAsync();
 
                     var ccp = Query<Grp_CreditCardPayment>(a => a.CId == grp_Visa1.Id && a.CTable == 80).First();

+ 25 - 36
OASystem/OASystem.Infrastructure/Repositories/Resource/AskDataRepository.cs

@@ -23,46 +23,35 @@ namespace OASystem.Infrastructure.Repositories.Resource
 
         public async Task<Result> QueryAskData(QueryAskDataDto dto)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
-            {
-                string sqlWhere = string.Empty;
-                if (!string.IsNullOrWhiteSpace(dto.Country))
-                {
-                    sqlWhere += string.Format(@"And Country like '%{0}%'", dto.Country);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.Area))
-                {
-                    sqlWhere += string.Format(@"And Area like '%{0}%'", dto.Area);
-                }
-                if (!string.IsNullOrWhiteSpace(dto.Field))
-                {
-                    sqlWhere += string.Format(@"And Field like '%{0}%'", dto.Field);
-                }
-                sqlWhere += string.Format(@"And IsDel={0}", 0);
 
-                if (!string.IsNullOrEmpty(sqlWhere.Trim()))
-                {
-                    Regex r = new Regex("And");
-                    sqlWhere = r.Replace(sqlWhere, "Where", 1);
-                }
-                string sql = string.Format(@"select * from Res_AskData {0} order by CreateTime desc", sqlWhere);
-                List<Res_AskData> askDatd = await _sqlSugar.SqlQueryable<Res_AskData>(sql).ToListAsync();
-                List<Grp_DelegationInfo> delegationInfo=await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a=>a.IsDel==0).ToListAsync();
-                if (askDatd.Count != 0 && delegationInfo.Count!=0)
-                {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = new { askDatd= askDatd, delegationInfo= delegationInfo } };
-                }
-                else
-                {
-                    result = new Result() { Code = 0, Msg = "暂无数据!", Data = new { askDatd = askDatd, delegationInfo = delegationInfo } };
-                }
+            string sqlWhere = string.Empty;
+            if (!string.IsNullOrWhiteSpace(dto.Country))
+            {
+                sqlWhere += string.Format(@"And Country like '%{0}%'", dto.Country);
             }
-            catch (Exception ex)
+            if (!string.IsNullOrWhiteSpace(dto.Area))
             {
-                result = new Result() { Code = -2, Msg = "未知错误" };
+                sqlWhere += string.Format(@"And Area like '%{0}%'", dto.Area);
             }
-            return result;
+            if (!string.IsNullOrWhiteSpace(dto.Field))
+            {
+                sqlWhere += string.Format(@"And Field like '%{0}%'", dto.Field);
+            }
+            sqlWhere += string.Format(@"And IsDel={0}", 0);
+
+            if (!string.IsNullOrEmpty(sqlWhere.Trim()))
+            {
+                Regex r = new Regex("And");
+                sqlWhere = r.Replace(sqlWhere, "Where", 1);
+            }
+            string sql = string.Format(@"select * from Res_AskData {0} order by CreateTime desc", sqlWhere);
+            List<Res_AskData> askDatd = await _sqlSugar.SqlQueryable<Res_AskData>(sql).ToListAsync();
+            List<Grp_DelegationInfo> delegationInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(a => a.IsDel == 0).ToListAsync();
+            var msg = string.Empty;
+            if (askDatd.Count != 0 && delegationInfo.Count != 0) msg = "查询成功!";
+            else msg = "查询成功!";
+
+            return new Result() { Code = 0, Msg = msg, Data = new { askDatd = askDatd, delegationInfo = delegationInfo } };
         }
 
         /// <summary>