Jelajahi Sumber

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

yuanrf 2 tahun lalu
induk
melakukan
bbb16f80c5

+ 135 - 70
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -147,7 +147,7 @@ namespace OASystem.API.Controllers
             CheckBoxsRepository checkBoxs, GroupCostRepository GroupCostRepository, CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
             CheckBoxsRepository checkBoxs, GroupCostRepository GroupCostRepository, CostTypeHotelNumberRepository CostTypeHotelNumberRepository,
             GroupCostParameterRepository GroupCostParameterRepository, HotelPriceRepository hotelPriceRep, CustomersRepository customersRep, SetDataRepository setDataRep,
             GroupCostParameterRepository GroupCostParameterRepository, HotelPriceRepository hotelPriceRep, CustomersRepository customersRep, SetDataRepository setDataRep,
             TourClientListRepository tourClientListRep, TeamRateRepository teamRateRep, IHubContext<ChatHub, IChatClient> hubContext, UsersRepository usersRep, IJuHeApiService juHeApi,
             TourClientListRepository tourClientListRep, TeamRateRepository teamRateRep, IHubContext<ChatHub, IChatClient> hubContext, UsersRepository usersRep, IJuHeApiService juHeApi,
-            InvertedListRepository invertedListRep, VisaFeeInfoRepository visaFeeInfoRep, TicketBlackCodeRepository ticketBlackCodeRep, HotelInquiryRepository hotelInquiryRep, 
+            InvertedListRepository invertedListRep, VisaFeeInfoRepository visaFeeInfoRep, TicketBlackCodeRepository ticketBlackCodeRep, HotelInquiryRepository hotelInquiryRep,
             ThreeCodeRepository threeCodeRepository, FeeAuditRepository feeAuditRep)
             ThreeCodeRepository threeCodeRepository, FeeAuditRepository feeAuditRep)
         {
         {
             _mapper = mapper;
             _mapper = mapper;
@@ -1452,7 +1452,7 @@ namespace OASystem.API.Controllers
                 /*
                 /*
                  * 成本信息
                  * 成本信息
                  */
                  */
-                var groupCost = _groupRepository.Query<Grp_GroupCostParameter >(s => s.DiId == _dto.DiId && s.IsDel == 0).First();
+                var groupCost = _groupRepository.Query<Grp_GroupCostParameter>(s => s.DiId == _dto.DiId && s.IsDel == 0).First();
                 decimal _groupRate = 0.0000M;
                 decimal _groupRate = 0.0000M;
                 string _groupCurrencyCode = "-";
                 string _groupCurrencyCode = "-";
                 if (groupCost != null)
                 if (groupCost != null)
@@ -1462,6 +1462,7 @@ namespace OASystem.API.Controllers
                     {
                     {
                         _groupCurrencyCode = currencyItems.Find(it => it.Id == _currency)?.Name ?? "-";
                         _groupCurrencyCode = currencyItems.Find(it => it.Id == _currency)?.Name ?? "-";
                     }
                     }
+                    else _groupCurrencyCode = groupCost.Currency;
                 }
                 }
                 string costContentSql = $"Select * From Grp_GroupCost";
                 string costContentSql = $"Select * From Grp_GroupCost";
                 var groupCostDetails = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == _dto.DiId).ToList();
                 var groupCostDetails = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == _dto.DiId).ToList();
@@ -1557,15 +1558,25 @@ namespace OASystem.API.Controllers
                                          checkOut = Convert.ToDateTime(hotelReservations.CheckOutDate);
                                          checkOut = Convert.ToDateTime(hotelReservations.CheckOutDate);
                                 int hotel_days = (int)(checkOut - checkIn).TotalDays;
                                 int hotel_days = (int)(checkOut - checkIn).TotalDays;
 
 
-                                string roomFeeStr = "";
-                                if (hotelReservations.SingleRoomPrice>0) 
-                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>单间:{hotelReservations.SingleRoomPrice.ToString("#0.00")} * {hotelReservations.SingleRoomCount}";
-                                if (hotelReservations.DoubleRoomPrice > 0) 
-                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>双人间:{hotelReservations.DoubleRoomPrice.ToString("#0.00")} * {hotelReservations.DoubleRoomCount}";
-                                if (hotelReservations.SuiteRoomPrice > 0) 
-                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>套房:{hotelReservations.SuiteRoomPrice.ToString("#0.00")} * {hotelReservations.SuiteRoomCount}";
-                                if (hotelReservations.OtherRoomPrice > 0) 
-                                    roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>其他:{hotelReservations.OtherRoomPrice.ToString("#0.00")} * {hotelReservations.OtherRoomCount}";
+                                string roomFeeStr = "", roomFeestr1 = "";
+
+                                //是否比较房型价格
+                                bool __isSingle = false, __isDouble = false, __isSuite = false, __isOther = false;
+
+                                roomFeeStr += $"<br/><span style='width:70px;display: inline-block;'></span>";
+
+                                if (hotelReservations.SingleRoomPrice > 0)
+                                { roomFeestr1 += $"单间:{hotelReservations.SingleRoomPrice.ToString("#0.00")} * {hotelReservations.SingleRoomCount}"; __isSingle = true; }
+                                if (hotelReservations.DoubleRoomPrice > 0)
+                                { roomFeestr1 += $"双人间:{hotelReservations.DoubleRoomPrice.ToString("#0.00")} * {hotelReservations.DoubleRoomCount}"; __isDouble = true; }
+                                if (hotelReservations.SuiteRoomPrice > 0)
+                                { roomFeestr1 += $"套房:{hotelReservations.SuiteRoomPrice.ToString("#0.00")} * {hotelReservations.SuiteRoomCount}"; __isSuite = true; }
+                                if (hotelReservations.OtherRoomPrice > 0)
+                                { roomFeestr1 += $"其他:{hotelReservations.OtherRoomPrice.ToString("#0.00")} * {hotelReservations.OtherRoomCount}"; __isOther = true; }
+
+                                if (roomFeestr1.Length > 0) roomFeeStr += roomFeestr1;
+                                else roomFeeStr += "  0.00 * 0";
+
 
 
                                 decimal governmentRentFee = 0.00M, cityTaxFee = 0.00M, breakfastFee = 0.00M, roomFee = 0.00M;
                                 decimal governmentRentFee = 0.00M, cityTaxFee = 0.00M, breakfastFee = 0.00M, roomFee = 0.00M;
                                 string governmentRentBool = "否", cityTaxBool = "否", breakfastBool = "否", roomBool = "否";
                                 string governmentRentBool = "否", cityTaxBool = "否", breakfastBool = "否", roomBool = "否";
@@ -1639,7 +1650,7 @@ namespace OASystem.API.Controllers
                                     }
                                     }
                                 }
                                 }
 
 
-                                string hotelCostTitalStr = "<span style='font-weight:800;'>成本信息</span><br/>"; 
+                                string hotelCostTitalStr = "<span style='font-weight:800;'>成本信息</span><br/>";
                                 string hotelCostStr = "";
                                 string hotelCostStr = "";
                                 decimal hotelCsotTotal = 0.00M;
                                 decimal hotelCsotTotal = 0.00M;
                                 if (groupCost != null)
                                 if (groupCost != null)
@@ -1649,7 +1660,7 @@ namespace OASystem.API.Controllers
                                     hotelCostStr += $"{groupCost.Currency}(汇率:{groupCost.Rate.ToString("#0.0000")})<br/>";
                                     hotelCostStr += $"{groupCost.Currency}(汇率:{groupCost.Rate.ToString("#0.0000")})<br/>";
                                 }
                                 }
 
 
-                                
+
                                 if (checkOut > checkIn) checkOut = checkOut.AddDays(-1);
                                 if (checkOut > checkIn) checkOut = checkOut.AddDays(-1);
 
 
 
 
@@ -1660,26 +1671,30 @@ namespace OASystem.API.Controllers
                                 {
                                 {
                                     hotelCsotTotal += item.Sum(x => x.HotelSingleRoomFee) + item.Sum(x => x.HotelDoubleRoomFee) + item.Sum(x => x.HotelSuiteRoomFee) + item.Sum(x => x.HotelSuiteFee);
                                     hotelCsotTotal += item.Sum(x => x.HotelSingleRoomFee) + item.Sum(x => x.HotelDoubleRoomFee) + item.Sum(x => x.HotelSuiteRoomFee) + item.Sum(x => x.HotelSuiteFee);
                                     hotelCost_day += @$"{item.First()?.Date ?? "-"}";
                                     hotelCost_day += @$"{item.First()?.Date ?? "-"}";
-                                    if (item.Sum(x => x.HotelSingleRoomFee) != 0) hotelCost_day += @$"   单间:{item.Sum(x => x.HotelSingleRoomFee).ToString("#0.00")}"; 
+                                    if (item.Sum(x => x.HotelSingleRoomFee) != 0) hotelCost_day += @$"   单间:{item.Sum(x => x.HotelSingleRoomFee).ToString("#0.00")}";
+                                    else { if (__isSingle) hotelCost_day += @$"   单间:0.00"; }
                                     if (item.Sum(x => x.HotelDoubleRoomFee) != 0) hotelCost_day += @$"   双人间:{item.Sum(x => x.HotelDoubleRoomFee).ToString("#0.00")}";
                                     if (item.Sum(x => x.HotelDoubleRoomFee) != 0) hotelCost_day += @$"   双人间:{item.Sum(x => x.HotelDoubleRoomFee).ToString("#0.00")}";
+                                    else { if (__isDouble) hotelCost_day += @$"   双人间:0.00"; }
                                     if (item.Sum(x => x.HotelSuiteRoomFee) != 0) hotelCost_day += @$"   小套房/豪华套房:{item.Sum(x => x.HotelSuiteRoomFee).ToString("#0.00")}";
                                     if (item.Sum(x => x.HotelSuiteRoomFee) != 0) hotelCost_day += @$"   小套房/豪华套房:{item.Sum(x => x.HotelSuiteRoomFee).ToString("#0.00")}";
-                                    if (item.Sum(x => x.HotelSuiteFee) != 0)  hotelCost_day += @$"   套房:{item.Sum(x => x.HotelSuiteFee).ToString("#0.00")}";
+                                    else { if (__isSuite) hotelCost_day += @$"   小套房/豪华套房:0.00"; }
+                                    if (item.Sum(x => x.HotelSuiteFee) != 0) hotelCost_day += @$"   套房:{item.Sum(x => x.HotelSuiteFee).ToString("#0.00")}";
+                                    else { if (__isOther) hotelCost_day += @$"   套房:0.00"; }
                                     hotelCost_day += @$"</br>";
                                     hotelCost_day += @$"</br>";
                                 }
                                 }
 
 
-                                string hotelBreakfastStr = "",hotelGovernmentRentStr = "",hotelCityTaxStr="" ;
+                                string hotelBreakfastStr = "", hotelGovernmentRentStr = "", hotelCityTaxStr = "";
                                 if (breakfastFee > 0) hotelBreakfastStr = $"酒店早餐: {breakfastFee.ToString("#0.00")} {breakfastCode} {breakfastName} 当时汇率 {breakfastData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{breakfastBool}<br/><br/>";
                                 if (breakfastFee > 0) hotelBreakfastStr = $"酒店早餐: {breakfastFee.ToString("#0.00")} {breakfastCode} {breakfastName} 当时汇率 {breakfastData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{breakfastBool}<br/><br/>";
                                 if (governmentRentFee > 0) hotelGovernmentRentStr = $"地税: {governmentRentFee.ToString("#0.00")} {governmentRentCode} {governmentRentName} 当时汇率 {governmentRentData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{governmentRentBool}<br/><br/>";
                                 if (governmentRentFee > 0) hotelGovernmentRentStr = $"地税: {governmentRentFee.ToString("#0.00")} {governmentRentCode} {governmentRentName} 当时汇率 {governmentRentData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{governmentRentBool}<br/><br/>";
                                 if (cityTaxFee > 0) hotelCityTaxStr = $"城市税: {cityTaxFee.ToString("#0.00")} {cityTaxCode} {cityTaxName} 当时汇率 {cityTaxData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{cityTaxBool}<br/>";
                                 if (cityTaxFee > 0) hotelCityTaxStr = $"城市税: {cityTaxFee.ToString("#0.00")} {cityTaxCode} {cityTaxName} 当时汇率 {cityTaxData?.Rate.ToString("#0.0000")} <br/>是否由地接代付:{cityTaxBool}<br/>";
 
 
                                 string hotelCostTotalStr = "";// $"&nbsp;&nbsp;成本合计:{hotelCsotTotal.ToString("#0.00")}<br/>";
                                 string hotelCostTotalStr = "";// $"&nbsp;&nbsp;成本合计:{hotelCsotTotal.ToString("#0.00")}<br/>";
-                                _detail.PriceMsgContent = $"{hotelCostTitalStr}{hotelCostStr}{hotelCostTotalStr}{hotelCost_day}<br/>"+
+                                _detail.PriceMsgContent = $"{hotelCostTitalStr}{hotelCostStr}{hotelCostTotalStr}{hotelCost_day}<br/>" +
                                                           $"<span style='font-weight:800;'>{hotelReservations.HotelName} [{hotelReservations.CheckInDate} - {hotelReservations.CheckOutDate}]</span><br/>" +
                                                           $"<span style='font-weight:800;'>{hotelReservations.HotelName} [{hotelReservations.CheckInDate} - {hotelReservations.CheckOutDate}]</span><br/>" +
                                                           $"信用卡金额:{_detail.WaitPay} ({hotelCurrncyName})<br/>" +
                                                           $"信用卡金额:{_detail.WaitPay} ({hotelCurrncyName})<br/>" +
                                                           $"房间说明: {hotelReservations.Remark} <br/>" +
                                                           $"房间说明: {hotelReservations.Remark} <br/>" +
                                                           $"房间费用: {roomCode} {roomName} 当时汇率 {roomData?.Rate.ToString("#0.0000")}{roomFeeStr}  <br/>是否由地接代付:{roomBool}<br/><br/>" +
                                                           $"房间费用: {roomCode} {roomName} 当时汇率 {roomData?.Rate.ToString("#0.0000")}{roomFeeStr}  <br/>是否由地接代付:{roomBool}<br/><br/>" +
-                                                          $"{hotelBreakfastStr}"+
-                                                          $"{hotelGovernmentRentStr}"+
+                                                          $"{hotelBreakfastStr}" +
+                                                          $"{hotelGovernmentRentStr}" +
                                                           $"{hotelCityTaxStr}";
                                                           $"{hotelCityTaxStr}";
                                 _detail.PriceNameContent = hotelReservations.HotelName;
                                 _detail.PriceNameContent = hotelReservations.HotelName;
                             }
                             }
@@ -1719,7 +1734,7 @@ namespace OASystem.API.Controllers
                                 //    _detail.PriceNameContent = touristGuideGroundReservations.Area;
                                 //    _detail.PriceNameContent = touristGuideGroundReservations.Area;
                                 //}
                                 //}
 
 
-                                var touristGuideGroundReservationsContents = 
+                                var touristGuideGroundReservationsContents =
                                     _CarTouristGuideGroundReservationsContent.Where(s => s.CTGGRId == touristGuideGroundReservations.Id && s.IsDel == 0 && s.Price != 0).ToList();
                                     _CarTouristGuideGroundReservationsContent.Where(s => s.CTGGRId == touristGuideGroundReservations.Id && s.IsDel == 0 && s.Price != 0).ToList();
 
 
                                 string priceMsg = $"<span style='font-weight:800;'>{touristGuideGroundReservations.PriceName}({touristGuideGroundReservations.ServiceStartTime} - {touristGuideGroundReservations.ServiceEndTime})</span><br/>";
                                 string priceMsg = $"<span style='font-weight:800;'>{touristGuideGroundReservations.PriceName}({touristGuideGroundReservations.ServiceStartTime} - {touristGuideGroundReservations.ServiceEndTime})</span><br/>";
@@ -1741,13 +1756,13 @@ namespace OASystem.API.Controllers
                                         carCurrencyName = currencyData.Remark;
                                         carCurrencyName = currencyData.Remark;
                                     }
                                     }
 
 
-                                    string opCostStr =string.Empty;
+                                    string opCostStr = string.Empty;
                                     decimal opCostTypePrice = 0.00M;
                                     decimal opCostTypePrice = 0.00M;
                                     #region 处理成本各项费用
                                     #region 处理成本各项费用
 
 
                                     var opDate = item.DatePrice?.ToString("yyyy-MM-dd");
                                     var opDate = item.DatePrice?.ToString("yyyy-MM-dd");
 
 
-                                    
+
                                     var opCost = groupCostDetails.Where(x => x.Date.Equals(opDate)).ToList();
                                     var opCost = groupCostDetails.Where(x => x.Date.Equals(opDate)).ToList();
 
 
                                     if (opCost.Count > 0)
                                     if (opCost.Count > 0)
@@ -1775,12 +1790,12 @@ namespace OASystem.API.Controllers
                                             //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //992 住补费用 -- 暂无
                                             //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //992 住补费用 -- 暂无
                                             case 994: opCostTypePrice = opCost.Sum(x => x.TranslatorFee); break; //994 翻译费
                                             case 994: opCostTypePrice = opCost.Sum(x => x.TranslatorFee); break; //994 翻译费
                                             case 1059: opCostTypePrice = opCost.Sum(x => x.GuideOverTimeFee); break; //1059    导游超时费用
                                             case 1059: opCostTypePrice = opCost.Sum(x => x.GuideOverTimeFee); break; //1059    导游超时费用
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1070    尾款金额
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1071    其他额外费用
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1073    翻译超时费
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1074    早餐超支费用
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1075    午餐超支费用
-                                            //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1076    晚餐超支费用
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1070    尾款金额
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1071    其他额外费用
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1073    翻译超时费
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1074    早餐超支费用
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1075    午餐超支费用
+                                                                                                                     //case 91: opCostTypePrice = opCost.Sum(x => x.CarFee); break; //1076    晚餐超支费用
                                         }
                                         }
                                         opCostStr = $"&nbsp;&nbsp;/&nbsp;&nbsp;成本:{opCostTypePrice.ToString("#0.00")} {_groupCurrencyCode}(汇率:{_groupRate.ToString("#0.0000")})";
                                         opCostStr = $"&nbsp;&nbsp;/&nbsp;&nbsp;成本:{opCostTypePrice.ToString("#0.00")} {_groupCurrencyCode}(汇率:{_groupRate.ToString("#0.0000")})";
                                     }
                                     }
@@ -4058,6 +4073,22 @@ namespace OASystem.API.Controllers
                     return Ok(JsonView(false, data.Msg));
                     return Ok(JsonView(false, data.Msg));
                 }
                 }
 
 
+                //生成默认文件pdf并且通知人员
+                var fileView = await GeneralMethod.EnterExitCostDownload(new EnterExitCostDownloadDto()
+                {
+                    DiId = dto.DiId,
+                    ExportType = 1,
+                    SubTypeId = 1005
+                }, "pdf");
+
+                //发送通知
+                string fileUrl = (string)fileView.Data.GetType().GetProperty("Url").GetValue(fileView.Data, null);
+                int sign = (int)data.Data.GetType().GetProperty("sign").GetValue(data.Data, null);
+                string md5Sign = GeneralMethod.Encrypt($"{sign}&fileName={fileUrl}");
+                string url = string.Format("http://oa.pan-american-intl.com:4399/?sign={0}&fileName={1}", sign,fileUrl);
+                await AppNoticeLibrary.SendUserMsg_GroupShare_ToGM(dto.DiId, new List<string>() { "208","5" }, dto.UserId, url);
+
+
                 return Ok(JsonView(true, data.Msg, data.Data));
                 return Ok(JsonView(true, data.Msg, data.Data));
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -4066,6 +4097,31 @@ namespace OASystem.API.Controllers
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 团组模块 - 出入境费用 - Confirm 费用
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostIsConfirm(ConfirmCostDto dto)
+        {
+            //TODO:测试完毕需把对应的用户ID更改
+            //1、数据表添加字段
+            //2、更改字段接口()
+            var _view = await _enterExitCostRep.ConfirmCost(dto);
+
+            //3、确认成功 给财务发送消息
+            if (_view.Code == 200)
+            {
+                if (dto.Type == 1)
+                {
+                    int diId = _enterExitCostRep._sqlSugar.Queryable<Grp_EnterExitCost>().Where(x => x.IsDel == 0 && x.Id == dto.Id).First()?.DiId ?? 0;
+                    await AppNoticeLibrary.SendUserMsg_GroupShare_ToFinance(diId);
+                }
+            }
+            return Ok(_view);
+        }
+
 
 
         /// <summary>
         /// <summary>
         /// 团组模块 - 出入境费用 - File downlaod
         /// 团组模块 - 出入境费用 - File downlaod
@@ -4816,7 +4872,7 @@ namespace OASystem.API.Controllers
                         wb.CalculateFormula(true);
                         wb.CalculateFormula(true);
 
 
                         //模板文件名
                         //模板文件名
-                        string strFileName = $"四川省商务厅出国经费财政先行审核表.xls";
+                        string strFileName = $"{_DelegationInfo.TeamName}-四川省商务厅出国经费财政先行审核表{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls"; ;//$".xls";
                         designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
                         return Ok(JsonView(true, "成功", new { Url = url }));
                         return Ok(JsonView(true, "成功", new { Url = url }));
@@ -4996,7 +5052,7 @@ namespace OASystem.API.Controllers
                         }
                         }
 
 
                         //模板文件名
                         //模板文件名
-                        string strFileName = $"{_DelegationInfo.TeamName}成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
+                        string strFileName = $"{_DelegationInfo.TeamName}-成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
                         string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
                         return Ok(JsonView(true, "成功", new { Url = url }));
                         return Ok(JsonView(true, "成功", new { Url = url }));
@@ -5356,6 +5412,9 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, data.Msg));
                 return Ok(JsonView(false, data.Msg));
             }
             }
 
 
+            
+
+
             return Ok(JsonView(true, data.Msg, data.Data));
             return Ok(JsonView(true, data.Msg, data.Data));
 
 
         }
         }
@@ -5981,8 +6040,8 @@ namespace OASystem.API.Controllers
                 }
                 }
 
 
                 //自动审核
                 //自动审核
-                await _feeAuditRep.FeeAutomaticAudit(2,dto.DiId,dto.CTGGRId);
-                
+                await _feeAuditRep.FeeAutomaticAudit(2, dto.DiId, dto.CTGGRId);
+
                 #region 应用推送
                 #region 应用推送
                 try
                 try
                 {
                 {
@@ -6378,7 +6437,8 @@ namespace OASystem.API.Controllers
                                 cell.SetCellValue(setCellValue); //写入单元格
                                 cell.SetCellValue(setCellValue); //写入单元格
                             }
                             }
 
 
-                            if (overspendSoure.ContainsKey(thisSid)) {
+                            if (overspendSoure.ContainsKey(thisSid))
+                            {
                                 var overspendId = overspendSoure[thisSid];
                                 var overspendId = overspendSoure[thisSid];
                                 whereForResult = arr.Where(x => x.SId == item.SId && DateTime.Compare(x.DatePrice.ObjToDate(), item.DatePrice.ObjToDate()) == 0).ToList();
                                 whereForResult = arr.Where(x => x.SId == item.SId && DateTime.Compare(x.DatePrice.ObjToDate(), item.DatePrice.ObjToDate()) == 0).ToList();
                             }
                             }
@@ -6812,7 +6872,7 @@ namespace OASystem.API.Controllers
                     }
                     }
                 }
                 }
 
 
-                CityStr = GeneralMethod.GetGroupCityLine(diid,"/");
+                CityStr = GeneralMethod.GetGroupCityLine(diid, "/");
                 _travelList = _sqlSugar.Queryable<Grp_TravelList>().Where(x => x.Diid == diid && x.IsDel == 0 && x.Issel == 1).ToList();
                 _travelList = _sqlSugar.Queryable<Grp_TravelList>().Where(x => x.Diid == diid && x.IsDel == 0 && x.Issel == 1).ToList();
             }
             }
 
 
@@ -8977,7 +9037,8 @@ namespace OASystem.API.Controllers
                             var groupCosts = _usersRep._sqlSugar.Queryable<Grp_GroupCost>().Where(it => it.IsDel == 0 && it.Diid == dto.DiId).ToList();
                             var groupCosts = _usersRep._sqlSugar.Queryable<Grp_GroupCost>().Where(it => it.IsDel == 0 && it.Diid == dto.DiId).ToList();
                             var initDatas = groupCosts.Select(it => new { date = it.Date, week = it.Date.GetWeek() == "" ? "-" : it.Date.GetWeek(), itinerary = it.ITIN }).ToList();
                             var initDatas = groupCosts.Select(it => new { date = it.Date, week = it.Date.GetWeek() == "" ? "-" : it.Date.GetWeek(), itinerary = it.ITIN }).ToList();
 
 
-                            modulePromptInfo.Data = new {
+                            modulePromptInfo.Data = new
+                            {
                                 airFeeData = datas,
                                 airFeeData = datas,
                                 airInitData = initDatas
                                 airInitData = initDatas
                             };
                             };
@@ -9152,7 +9213,8 @@ ORDER by  gctggrc.id DESC
                     }
                     }
                 }
                 }
 
 
-                var view = dbResult.Select(x => {
+                var view = dbResult.Select(x =>
+                {
 
 
                     decimal dp = 0.00M;
                     decimal dp = 0.00M;
                     var startB = DateTime.TryParse(x.Start.ToString(), out DateTime startD);
                     var startB = DateTime.TryParse(x.Start.ToString(), out DateTime startD);
@@ -9383,7 +9445,8 @@ ORDER by  gctggrc.id DESC
             {
             {
                 if (pageFunAuthView.EditAuth == 0) return Ok(JsonView(false, "您没有编辑权限!"));
                 if (pageFunAuthView.EditAuth == 0) return Ok(JsonView(false, "您没有编辑权限!"));
 
 
-            } else return Ok(JsonView(false, "请输入正确的数据Id!"));
+            }
+            else return Ok(JsonView(false, "请输入正确的数据Id!"));
 
 
             #endregion
             #endregion
 
 
@@ -9396,7 +9459,7 @@ ORDER by  gctggrc.id DESC
             }
             }
 
 
             #region 应用推送
             #region 应用推送
-            
+
             try
             try
             {
             {
                 int ccpId = (int)_view.Data.GetType().GetProperty("ccpId").GetValue(_view.Data, null);
                 int ccpId = (int)_view.Data.GetType().GetProperty("ccpId").GetValue(_view.Data, null);
@@ -9405,7 +9468,7 @@ ORDER by  gctggrc.id DESC
                 await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
                 await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
 
 
                 //自动审核
                 //自动审核
-                await _feeAuditRep.FeeAutomaticAudit(1,_dto.DiId,hotelId);
+                await _feeAuditRep.FeeAutomaticAudit(1, _dto.DiId, hotelId);
 
 
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -11548,12 +11611,12 @@ ORDER by  gctggrc.id DESC
 
 
             bool isDepStatus = await GeneralMethod.IsMarketingStaff(dto.CurrUserId);
             bool isDepStatus = await GeneralMethod.IsMarketingStaff(dto.CurrUserId);
             List<Grp_DelegationInfo> groupInfos = new List<Grp_DelegationInfo>();
             List<Grp_DelegationInfo> groupInfos = new List<Grp_DelegationInfo>();
-            groupInfos =  _sqlSugar.Queryable<Grp_DelegationInfo>()
+            groupInfos = _sqlSugar.Queryable<Grp_DelegationInfo>()
                                         .Where(it => it.IsDel == 0)
                                         .Where(it => it.IsDel == 0)
                                         .WhereIF(isDepStatus, it => it.JietuanOperator == dto.CurrUserId)
                                         .WhereIF(isDepStatus, it => it.JietuanOperator == dto.CurrUserId)
                                         .OrderByDescending(it => it.CreateUserId)
                                         .OrderByDescending(it => it.CreateUserId)
                                         .ToList();
                                         .ToList();
-            if (groupInfos.Count < 1) return Ok(JsonView(false,"暂无和你相关的团组信息!"));
+            if (groupInfos.Count < 1) return Ok(JsonView(false, "暂无和你相关的团组信息!"));
 
 
             var country = groupInfos.Select(it => it.VisitCountry).ToList();
             var country = groupInfos.Select(it => it.VisitCountry).ToList();
             var diids = groupInfos.Select(it => it.Id).ToList();
             var diids = groupInfos.Select(it => it.Id).ToList();
@@ -11596,11 +11659,11 @@ ORDER by  gctggrc.id DESC
                                           .ToList();
                                           .ToList();
 
 
 
 
-            var teamNames = groupInfos.Where(it => !string.IsNullOrEmpty(it.TeamName) )
+            var teamNames = groupInfos.Where(it => !string.IsNullOrEmpty(it.TeamName))
                                       .Select(it => it.TeamName).ToList();
                                       .Select(it => it.TeamName).ToList();
 
 
             stopwatch.Stop();
             stopwatch.Stop();
-            return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", new { teamNames,countriesDatas, citiesDatas = cityDatas }));
+            return Ok(JsonView(true, $"操作成功,耗时{stopwatch.ElapsedMilliseconds} ms", new { teamNames, countriesDatas, citiesDatas = cityDatas }));
 
 
         }
         }
 
 
@@ -12247,7 +12310,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                                              .Where(it => countrys.Contains(it.Name_CN))
                                              .Where(it => countrys.Contains(it.Name_CN))
                                              .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.Name_CN.Contains(dto.Search))
                                              .WhereIF(!string.IsNullOrEmpty(dto.Search), it => it.Name_CN.Contains(dto.Search))
                                              .Select(it => new { id = it.Id, name = it.Name_CN })
                                              .Select(it => new { id = it.Id, name = it.Name_CN })
-                                             .ToPageListAsync(dto.PageIndex,dto.PageSize, total);
+                                             .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
 
 
             return Ok(JsonView(true, MsgTips.Succeed, countyDatas, total));
             return Ok(JsonView(true, MsgTips.Succeed, countyDatas, total));
         }
         }
@@ -12288,7 +12351,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
             watch.Start();
             watch.Start();
             RefAsync<int> total = 0;
             RefAsync<int> total = 0;
             var countyDatas = await _sqlSugar.Queryable<Res_OfficialActivities>()
             var countyDatas = await _sqlSugar.Queryable<Res_OfficialActivities>()
-                                             .InnerJoin<Grp_DelegationInfo>((oa,di) => oa.DiId == di.Id)
+                                             .InnerJoin<Grp_DelegationInfo>((oa, di) => oa.DiId == di.Id)
                                              .Where((oa, di) => oa.IsDel == 0)
                                              .Where((oa, di) => oa.IsDel == 0)
                                              .WhereIF(!string.IsNullOrEmpty(dto.Search), (oa, di) => di.TeamName.Contains(dto.Search))
                                              .WhereIF(!string.IsNullOrEmpty(dto.Search), (oa, di) => di.TeamName.Contains(dto.Search))
                                              .OrderBy((oa, di) => new { id = SqlFunc.Desc(di.Id) })
                                              .OrderBy((oa, di) => new { id = SqlFunc.Desc(di.Id) })
@@ -12325,7 +12388,8 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                                              .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
                                              .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
             var userDatas = _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0).ToList();
             var userDatas = _sqlSugar.Queryable<Sys_Users>().Where(x => x.IsDel == 0).ToList();
             var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0).ToList();
             var setDatas = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0).ToList();
-            infos.ForEach(x => {
+            infos.ForEach(x =>
+            {
                 x.TeamDid = setDatas.Find(y => int.Parse(x.TeamDid) == y.Id)?.Name ?? "-";
                 x.TeamDid = setDatas.Find(y => int.Parse(x.TeamDid) == y.Id)?.Name ?? "-";
                 x.JietuanOperator = userDatas.Find(y => int.Parse(x.JietuanOperator) == y.Id)?.CnName ?? "-";
                 x.JietuanOperator = userDatas.Find(y => int.Parse(x.JietuanOperator) == y.Id)?.CnName ?? "-";
                 x.TeamLevSId = setDatas.Find(y => int.Parse(x.TeamLevSId) == y.Id)?.Name ?? "-";
                 x.TeamLevSId = setDatas.Find(y => int.Parse(x.TeamLevSId) == y.Id)?.Name ?? "-";
@@ -12448,19 +12512,20 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                                     {
                                     {
                                         threeCodeStr.Add(end);
                                         threeCodeStr.Add(end);
                                     }
                                     }
-                                    else {
+                                    else
+                                    {
                                         threeCodeStr.Add(start);
                                         threeCodeStr.Add(start);
                                         threeCodeStr.Add(end);
                                         threeCodeStr.Add(end);
                                     }
                                     }
                                 }
                                 }
                             }
                             }
                         }
                         }
-                        var threeCodeList =  _threeCodeRepository.QueryThreeCodeArray(threeCodeStr);
+                        var threeCodeList = _threeCodeRepository.QueryThreeCodeArray(threeCodeStr);
                         var last = threeCodeStr.Last();
                         var last = threeCodeStr.Last();
                         foreach (var item in threeCodeStr)
                         foreach (var item in threeCodeStr)
                         {
                         {
                             cityPath += (threeCodeList.Keys.Contains(item) ? threeCodeList[item].City : "【未知三字码】") + "-";
                             cityPath += (threeCodeList.Keys.Contains(item) ? threeCodeList[item].City : "【未知三字码】") + "-";
-                            if(item.Equals(last))
+                            if (item.Equals(last))
                             {
                             {
                                 stay = threeCodeList.Keys.Contains(item) ? threeCodeList[item].City : "【未知三字码】";
                                 stay = threeCodeList.Keys.Contains(item) ? threeCodeList[item].City : "【未知三字码】";
                             }
                             }
@@ -12498,7 +12563,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                     x.Diid,
                     x.Diid,
                     chiList = chiList.Select(x1 => new
                     chiList = chiList.Select(x1 => new
                     {
                     {
-                        timeInterval = x1.Time == null ? new string [1] : x1.Time.Split('-'),
+                        timeInterval = x1.Time == null ? new string[1] : x1.Time.Split('-'),
                         x1.Details,
                         x1.Details,
                         x1.ParentId,
                         x1.ParentId,
                         x1.Id
                         x1.Id
@@ -12508,10 +12573,10 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
 
             data = data with
             data = data with
             {
             {
-                 content = resultArr,
+                content = resultArr,
             };
             };
 
 
-            jw = JsonView(true,"获取成功!",data);
+            jw = JsonView(true, "获取成功!", data);
 
 
             return Ok(jw);
             return Ok(jw);
         }
         }
@@ -12525,7 +12590,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
         public IActionResult DeleteApprovalJourney(DeleteApprovalJourney dto)
         public IActionResult DeleteApprovalJourney(DeleteApprovalJourney dto)
         {
         {
             var jw = JsonView(false);
             var jw = JsonView(false);
-            var group = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x=>x.Id == dto.Diid && x.IsDel == 0);
+            var group = _sqlSugar.Queryable<Grp_DelegationInfo>().First(x => x.Id == dto.Diid && x.IsDel == 0);
             if (group == null)
             if (group == null)
             {
             {
                 jw.Msg = "团组参数有误!";
                 jw.Msg = "团组参数有误!";
@@ -12536,7 +12601,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
             {
             {
                 _sqlSugar.BeginTran();
                 _sqlSugar.BeginTran();
 
 
-                var arr = _sqlSugar.Queryable<Grp_ApprovalTravel>().Where(x => x.Diid == dto.Diid && x.IsDel == 0).Select(x=>x.Id).ToList();
+                var arr = _sqlSugar.Queryable<Grp_ApprovalTravel>().Where(x => x.Diid == dto.Diid && x.IsDel == 0).Select(x => x.Id).ToList();
 
 
                 _ = _sqlSugar.Updateable<Grp_ApprovalTravelDetails>().SetColumns(x => new Grp_ApprovalTravelDetails
                 _ = _sqlSugar.Updateable<Grp_ApprovalTravelDetails>().SetColumns(x => new Grp_ApprovalTravelDetails
                 {
                 {
@@ -12596,10 +12661,10 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
 
             _sqlSugar.BeginTran();
             _sqlSugar.BeginTran();
 
 
-            if (chiArr.Where(x=>x.id == 0).Count() == chiArr.Count)
+            if (chiArr.Where(x => x.id == 0).Count() == chiArr.Count)
             {
             {
                 var parentIds = dto.Arr.Select(x => x.id).ToList();
                 var parentIds = dto.Arr.Select(x => x.id).ToList();
-                _sqlSugar.Updateable<Grp_ApprovalTravelDetails>().Where(x => parentIds.Contains(x.ParentId) && x.IsDel == 0).SetColumns(x=>new Grp_ApprovalTravelDetails
+                _sqlSugar.Updateable<Grp_ApprovalTravelDetails>().Where(x => parentIds.Contains(x.ParentId) && x.IsDel == 0).SetColumns(x => new Grp_ApprovalTravelDetails
                 {
                 {
                     DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                     DeleteUserId = dto.UserId,
                     DeleteUserId = dto.UserId,
@@ -12609,13 +12674,13 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
 
             try
             try
             {
             {
-                 _ =  _sqlSugar.Insertable<Grp_ApprovalTravelDetails>(chiArr.Where(x => x.id == 0).Select(x => new Grp_ApprovalTravelDetails
+                _ = _sqlSugar.Insertable<Grp_ApprovalTravelDetails>(chiArr.Where(x => x.id == 0).Select(x => new Grp_ApprovalTravelDetails
                 {
                 {
                     CreateTime = DateTime.Now,
                     CreateTime = DateTime.Now,
                     CreateUserId = dto.UserId,
                     CreateUserId = dto.UserId,
                     Details = x.details,
                     Details = x.details,
                     ParentId = x.parentId,
                     ParentId = x.parentId,
-                    Time = x.timeInterval.Where(x=>!string.IsNullOrWhiteSpace(x)).Count() > 1 ? x.timeInterval[0] + "-" + x.timeInterval[1] : "",
+                    Time = x.timeInterval.Where(x => !string.IsNullOrWhiteSpace(x)).Count() > 1 ? x.timeInterval[0] + "-" + x.timeInterval[1] : "",
                     Remark = "",
                     Remark = "",
                     IsDel = 0
                     IsDel = 0
                 }).ToList()).ExecuteCommand();
                 }).ToList()).ExecuteCommand();
@@ -12626,7 +12691,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                     Details = x.details,
                     Details = x.details,
                     ParentId = x.parentId,
                     ParentId = x.parentId,
                     Time = x.timeInterval.Where(x => !string.IsNullOrWhiteSpace(x)).Count() > 1 ? x.timeInterval[0] + "-" + x.timeInterval[1] : "",
                     Time = x.timeInterval.Where(x => !string.IsNullOrWhiteSpace(x)).Count() > 1 ? x.timeInterval[0] + "-" + x.timeInterval[1] : "",
-                }).ToList()).UpdateColumns(x=> new Grp_ApprovalTravelDetails
+                }).ToList()).UpdateColumns(x => new Grp_ApprovalTravelDetails
                 {
                 {
                     Details = x.Details,
                     Details = x.Details,
                     ParentId = x.ParentId,
                     ParentId = x.ParentId,
@@ -12639,7 +12704,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                     Date = x.date,
                     Date = x.date,
                 }).ToList()).UpdateColumns(x => new Grp_ApprovalTravel
                 }).ToList()).UpdateColumns(x => new Grp_ApprovalTravel
                 {
                 {
-                     Date = x.Date
+                    Date = x.Date
                 }).ExecuteCommand();
                 }).ExecuteCommand();
 
 
                 _sqlSugar.CommitTran();
                 _sqlSugar.CommitTran();
@@ -12827,10 +12892,10 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                             IFormatProvider ifp = new CultureInfo("zh-CN", true);
                             IFormatProvider ifp = new CultureInfo("zh-CN", true);
                             if (DateTime.TryParseExact(flightTime, "HH小时mm分钟", ifp, DateTimeStyles.None, out DateTime flightDataTime))
                             if (DateTime.TryParseExact(flightTime, "HH小时mm分钟", ifp, DateTimeStyles.None, out DateTime flightDataTime))
                             {
                             {
-                                flightTime = flightDataTime.Hour > 0 
-                                    ? flightDataTime.Hour.ToString() + "小时" + (flightDataTime.Minute > 0  
-                                    ? flightDataTime.Minute.ToString() + "分钟": "") : flightDataTime.Minute > 0 
-                                    ? flightDataTime.Minute.ToString() + "分钟" : "" ;
+                                flightTime = flightDataTime.Hour > 0
+                                    ? flightDataTime.Hour.ToString() + "小时" + (flightDataTime.Minute > 0
+                                    ? flightDataTime.Minute.ToString() + "分钟" : "") : flightDataTime.Minute > 0
+                                    ? flightDataTime.Minute.ToString() + "分钟" : "";
                             }
                             }
 
 
 
 
@@ -12873,7 +12938,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                             CreateUserId = dto.Userid,
                             CreateUserId = dto.Userid,
                             ParentId = 0,
                             ParentId = 0,
                             Details = trip
                             Details = trip
-                        }) ;
+                        });
 
 
                         var threeCodeList = _threeCodeRepository.QueryThreeCodeArray(threeCodeStr);
                         var threeCodeList = _threeCodeRepository.QueryThreeCodeArray(threeCodeStr);
                         var last = threeCodeStr.Last();
                         var last = threeCodeStr.Last();
@@ -12944,7 +13009,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                 jw.Code = 400;
                 jw.Code = 400;
                 jw.Msg = "生成失败!" + ex.Message;
                 jw.Msg = "生成失败!" + ex.Message;
             }
             }
-            
+
             return Ok(jw);
             return Ok(jw);
         }
         }
 
 
@@ -12996,7 +13061,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                 var ChiRep = _sqlSugar.Queryable<Grp_ApprovalTravelDetails>().Where(x => x.IsDel == 0 && x.ParentId == item.Id).ToList();
                 var ChiRep = _sqlSugar.Queryable<Grp_ApprovalTravelDetails>().Where(x => x.IsDel == 0 && x.ParentId == item.Id).ToList();
 
 
                 SetCells(tableOne, doc, SetIndex, 0, textTime);
                 SetCells(tableOne, doc, SetIndex, 0, textTime);
-                
+
                 SetIndex++;
                 SetIndex++;
 
 
                 if (ChiRep.Count > 0)
                 if (ChiRep.Count > 0)
@@ -13099,7 +13164,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
 
             if (val.Contains("\r\n"))
             if (val.Contains("\r\n"))
             {
             {
-                var spArr = val.Split("\r\n").Where(x=>!string.IsNullOrWhiteSpace(x));
+                var spArr = val.Split("\r\n").Where(x => !string.IsNullOrWhiteSpace(x));
                 foreach (var item in spArr)
                 foreach (var item in spArr)
                 {
                 {
                     //新建一个段落
                     //新建一个段落
@@ -13178,7 +13243,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
 
             if (param.ContainsKey("isJson"))
             if (param.ContainsKey("isJson"))
             {
             {
-            
+
             }
             }
 
 
             if (headValues != null)
             if (headValues != null)
@@ -13228,7 +13293,7 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
                 client.Dispose();
                 client.Dispose();
             }
             }
 
 
-             return Ok(jw);
+            return Ok(jw);
         }
         }
 
 
         #endregion
         #endregion

+ 13 - 3
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -2412,10 +2412,12 @@ FROM
             List<int> userIds = new List<int>();
             List<int> userIds = new List<int>();
             userIds = await GetUserIds(_dto.CompanyId, _dto.GroupPickupUserId);
             userIds = await GetUserIds(_dto.CompanyId, _dto.GroupPickupUserId);
 
 
-            if (userIds.Count > 0)
+            if (userIds.Count <= 0)
             {
             {
-                userSql = @$" And di.JietuanOperator In ({string.Join(",",userIds)})";
+                return Ok(JsonView(true, "操作成功!", new List<object> { }, 0));
             }
             }
+            else userSql = @$" And di.JietuanOperator In ({string.Join(",", userIds)})";
+
 
 
             if (!string.IsNullOrEmpty(_dto.SearchCriteria))
             if (!string.IsNullOrEmpty(_dto.SearchCriteria))
             {
             {
@@ -2512,6 +2514,14 @@ FROM
             {
             {
                 userSql = string.Format(@$" AND JietuanOperator IN ({string.Join(",",userIds)})");
                 userSql = string.Format(@$" AND JietuanOperator IN ({string.Join(",",userIds)})");
             }
             }
+            else
+            {
+                return Ok(JsonView(true, "操作成功!", new
+                {
+                    customerTypeData = new List<object> { },
+                    clientGradeData = new List<object> { }
+                }));
+            }
 
 
             string sql = "";
             string sql = "";
 
 
@@ -2623,7 +2633,7 @@ Order By Count Desc");
             if (userIds.Count > 0)
             if (userIds.Count > 0)
             {
             {
                 userSql = string.Format(@$" AND JietuanOperator IN ({string.Join(",", userIds)})");
                 userSql = string.Format(@$" AND JietuanOperator IN ({string.Join(",", userIds)})");
-            }
+            }else return Ok(JsonView(true, "操作成功!", new List<object> { }, 0));
 
 
             string sql = string.Format(@$"Select 
             string sql = string.Format(@$"Select 
 	ROW_NUMBER() Over(Order By Count(*) Desc) As RowNumber,
 	ROW_NUMBER() Over(Order By Count(*) Desc) As RowNumber,

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

@@ -1,12 +1,18 @@
 
 
+using Aspose.Cells;
+using Aspose.Words;
+using Aspose.Words.Layout;
+using Aspose.Words.Saving;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.International.Converters.PinYinConverter;
 using Microsoft.International.Converters.PinYinConverter;
 using Microsoft.VisualBasic;
 using Microsoft.VisualBasic;
 using NPOI.HSSF.Util;
 using NPOI.HSSF.Util;
+using OASystem.API.OAMethodLib.File;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.HubClients;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.JuHeAPI;
 using OASystem.API.OAMethodLib.JuHeAPI;
 using OASystem.API.OAMethodLib.SignalR.Hubs;
 using OASystem.API.OAMethodLib.SignalR.Hubs;
+using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.District;
 using OASystem.Domain.Entities.District;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Financial;
@@ -28,6 +34,7 @@ namespace OASystem.API.OAMethodLib
     public static class GeneralMethod
     public static class GeneralMethod
     {
     {
         //团组信息
         //团组信息
+        private readonly static SqlSugarClient _sqlSugar = AutofacIocManager.Instance.GetService<SqlSugarClient>();
         private readonly static DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
         private readonly static DelegationInfoRepository _dirRep = AutofacIocManager.Instance.GetService<DelegationInfoRepository>();
         private readonly static TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
         private readonly static TeamRateRepository _teamRateRep = AutofacIocManager.Instance.GetService<TeamRateRepository>();
         private readonly static IJuHeApiService _juHeApi = AutofacIocManager.Instance.GetService<IJuHeApiService>();
         private readonly static IJuHeApiService _juHeApi = AutofacIocManager.Instance.GetService<IJuHeApiService>();
@@ -35,6 +42,7 @@ namespace OASystem.API.OAMethodLib
         private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
         private readonly static TableOperationRecordRepository _tableOperationRecordRep = AutofacIocManager.Instance.GetService<TableOperationRecordRepository>();
         private readonly static MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
         private readonly static MessageRepository _messageRep = AutofacIocManager.Instance.GetService<MessageRepository>();
         private readonly static IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
         private readonly static IHubContext<ChatHub, IChatClient> _hubContext = AutofacIocManager.Instance.GetService<IHubContext<ChatHub, IChatClient>>();
+
         private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
         private readonly static string[] weekdays = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
         #region 员工注册默认添加基础页面
         #region 员工注册默认添加基础页面
 
 
@@ -1483,7 +1491,6 @@ namespace OASystem.API.OAMethodLib
 
 
         #endregion
         #endregion
 
 
-
         #region op行程单,黑屏幕代码
         #region op行程单,黑屏幕代码
 
 
         public static string GetCountryStandingTime(int diId)
         public static string GetCountryStandingTime(int diId)
@@ -2905,7 +2912,1337 @@ namespace OASystem.API.OAMethodLib
         }
         }
         #endregion
         #endregion
 
 
+        #region 三公费用明细 文件下载
+
+        /// <summary>
+        /// 获取三公费用标准city
+        /// </summary>
+        /// <param name="placeData"></param>
+        /// <param name="nationalTravelFeeId"></param>
+        /// <returns></returns>
+        private static string GetEnterExitCostExportCity(List<Grp_NationalTravelFee> placeData, int nationalTravelFeeId)
+        {
+            string _city = string.Empty;
+
+            if (placeData.Count < 1) return _city;
+
+            var data = placeData.Find(it => it.Id == nationalTravelFeeId);
+            if (data == null) return _city;
+
+            string country = data.Country;
+            string city = data.City;
+            if (city.Contains("其他城市") || city.Contains("所有城市")) _city = $"{country}-{city}";
+            else _city = city;
+            return _city;
+        }
+
+        /// <summary>
+        /// 三公费用明细 文件下载
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <param name="userId"></param>
+        /// <param name="CTable"></param>
+        /// <returns></returns>
+        public static async Task<JsonView> EnterExitCostDownload(EnterExitCostDownloadDto dto,string fileFormat = "pdf")
+        {
+            var _view = new JsonView() { Code = StatusCodes.Status204NoContent };
+
+            if (dto.DiId < 1)
+            {
+                _view.Msg = "请传入有效的DiId参数;";
+                return _view;
+            }
+
+            if (dto.ExportType < 1)
+            {
+                _view.Msg = MsgTips.Port;
+                return _view;
+            }
+
+            if (dto.SubTypeId < 1)
+            {
+                _view.Msg = @"请传入有效的SubTypeId参数; 
+                            1 明细表 --> 1005(默认明细表) 1006(因公出国(境)经费测算明细表) 1007(四川省商务厅出国经费财政先行审核表)  
+                            2 表格 --> 1008(派员单位出(境)任务和预算审批意见表) 1009(省级单位出(境)经费报销单)
+                            3 团组成员名单 1 团组成员名单";
+                return _view;
+            }
+
+            try
+            {
+                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)
+                {
+                    _view.Msg = @"该团组未填写出入境费用;";
+                    return _view;
+                }
+
+                //数据源
+                List<Grp_DayAndCost> dac1 = _DayAndCosts.Where(it => it.Type == 1).ToList(); //住宿费
+                List<Grp_DayAndCost> dac2 = _DayAndCosts.Where(it => it.Type == 2).ToList(); //伙食费
+                List<Grp_DayAndCost> dac3 = _DayAndCosts.Where(it => it.Type == 3).ToList(); //公杂费
+                List<Grp_DayAndCost> dac4 = _DayAndCosts.Where(it => it.Type == 4).ToList(); //培训费
+
+                var _CurrDatas = _sqlSugar.Queryable<Sys_SetData>().Where(it => it.IsDel == 0 && it.STid == 66).ToList();
+                var _DelegationInfo = _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.IsDel == 0 && it.Id == dto.DiId).First();
+                var DeleClientList = _sqlSugar.Queryable<Grp_TourClientList>()
+                                                      .LeftJoin<Crm_DeleClient>((tcl, dc) => tcl.ClientId == dc.Id && dc.IsDel == 0)
+                                                      .LeftJoin<Crm_CustomerCompany>((tcl, dc, cc) => dc.CrmCompanyId == cc.Id && dc.IsDel == 0)
+                                                      .Where((tcl, dc, cc) => tcl.IsDel == 0 && tcl.DiId == dto.DiId)
+                                                      .Select((tcl, dc, cc) => new
+                                                      {
+                                                          Name = dc.LastName + dc.FirstName,
+                                                          Sex = dc.Sex,
+                                                          Birthday = dc.BirthDay,
+                                                          Company = cc.CompanyFullName,
+                                                          Job = dc.Job
+                                                      })
+                                                      .ToList();
+                var blackCode = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
+                var threeCodes = _sqlSugar.Queryable<Res_ThreeCode>().Where(it => it.IsDel == 0).ToList();
+                var placeData = _sqlSugar.Queryable<Grp_NationalTravelFee>().Where(it => it.IsDel == 0).ToList();
+                var rateDatas = await _EnterExitCosts.CurrencyRemark.SplitExchangeRate();
+
+
+                _DelegationInfo.VisitCountry = _DelegationInfo.VisitCountry.Replace("|", "、");
+
+                if (dto.ExportType == 1) //明细表
+                {
+                    if (dto.SubTypeId == 1005) //1005(默认明细表)
+                    {
+
+                        if (!fileFormat.Equals("pdf")) fileFormat = "docx";
+
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/出入境费用表模板.docx");
+
+                        //载入模板
+                        Document doc = new Document(tempPath);
+
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        //利用键值对存放数据
+                        Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                        decimal stayFeeTotal = _DayAndCosts.Where(it => it.Type == 1).Sum(it => it.SubTotal);  // 住宿费
+                        decimal mealsFeeTotal = _DayAndCosts.Where(it => it.Type == 2).Sum(it => it.SubTotal);  // 伙食费费
+                        decimal miscellaneousFeeTotal = _DayAndCosts.Where(it => it.Type == 3).Sum(it => it.SubTotal);  // 公杂费
+                        decimal tainFeeTotal = _DayAndCosts.Where(it => it.Type == 4).Sum(it => it.SubTotal);  // 培训费
+
+                        decimal insidePayTotal = _EnterExitCosts.InsidePay;
+
+                        string row1_1 = "";
+                        if (_EnterExitCosts.Visa > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.Visa;
+                            row1_1 = $"签证费: {_EnterExitCosts.Visa.ToString("#0.00")} 人民币/人";
+                            if (!string.IsNullOrEmpty(_EnterExitCosts.VisaRemark))
+                            {
+                                row1_1 += $"\t签证费用描述: {_EnterExitCosts.VisaRemark}";
+                            }
+                        }
+
+                        string row1_2 = "";
+                        if (_EnterExitCosts.YiMiao > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.YiMiao;
+                            row1_2 += $"疫苗费:{_EnterExitCosts.YiMiao.ToString("#0.00")} 人民币/人";
+                        }
+                        if (_EnterExitCosts.HeSuan > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.HeSuan;
+                            row1_2 += $"核酸检测费:{_EnterExitCosts.HeSuan.ToString("#0.00")} 人民币/人";
+                        }
+                        if (_EnterExitCosts.Service > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.Service;
+                            row1_2 += $"服务费:{_EnterExitCosts.Service.ToString("#0.00")} 人民币/人";
+                        }
+
+                        string row1_3 = "";
+                        if (_EnterExitCosts.Safe > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.Safe;
+                            row1_3 += $"保险费:{_EnterExitCosts.Safe.ToString("#0.00")} 人民币/人";
+                        }
+                        if (_EnterExitCosts.Ticket > 0)
+                        {
+                            //insidePayTotal += _EnterExitCosts.Ticket;
+                            row1_3 += $"参展门票:{_EnterExitCosts.Ticket.ToString("#0.00")} 人民币/人";
+                        }
+                        string row1 = "";
+                        if (!string.IsNullOrEmpty(row1_1)) row1 += $"{row1_1}\r\n";
+                        if (!string.IsNullOrEmpty(row1_2)) row1 += $"{row1_2}\r\n";
+                        if (!string.IsNullOrEmpty(row1_3)) row1 += $"{row1_3}";
+
+                        dic.Add("InsidePay", insidePayTotal.ToString("#0.00"));
+                        dic.Add("Row1Str", row1);
+
+                        dic.Add("OutsideJJ", _EnterExitCosts.OutsideJJPay.ToString("#0.00"));
+                        dic.Add("OutsaideGW", _EnterExitCosts.OutsaideGWPay.ToString("#0.00"));
+                        dic.Add("AirJJ", _EnterExitCosts.AirJJ.ToString("#0.00"));
+                        dic.Add("AirGW", _EnterExitCosts.AirGW.ToString("#0.00"));
+                        dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
+                        dic.Add("SubZS", stayFeeTotal.ToString("#0.00"));
+                        dic.Add("SubHS", mealsFeeTotal.ToString("#0.00"));
+
+                        string miscellaneousFeeTotalStr = miscellaneousFeeTotal.ToString("#0.00");
+                        dic.Add("SubGZF", miscellaneousFeeTotalStr);
+                        //dic.Add("SubPX", tainFeeTotal.ToString("#0.00"));
+
+                        decimal subJJC = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + _EnterExitCosts.OutsideJJPay;
+                        decimal subGWC = insidePayTotal + stayFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + tainFeeTotal + _EnterExitCosts.OutsaideGWPay;
+                        dic.Add("SubJJC", subJJC.ToString("#0.00"));
+                        dic.Add("SubGWC", subGWC.ToString("#0.00"));
+
+                        #region 填充word模板书签内容
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+
+                        #endregion
+
+                        #region 填充word表格内容
+
+                        ////获读取指定表格方法二
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+                        for (int i = 0; i < dac1.Count; i++)
+                        {
+
+                            Grp_DayAndCost dac = dac1[i];
+                            if (dac == null) continue;
+
+                            builder.MoveToCell(0, i, 0, 0);
+                            builder.Write("第" + dac.Days.ToString() + "晚:");
+
+                            builder.MoveToCell(0, i, 1, 0);
+                            //builder.Write(placeData.Find(it => it.Id == dac.NationalTravelFeeId)?.Country ?? "Unknown");
+                            //builder.Write(dac.Place == null ? "" : dac.Place);
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
+
+
+                            builder.MoveToCell(0, i, 2, 0);
+                            builder.Write("费用标准:");
+
+                            string curr = "";
+                            var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
+                            if (currData != null)
+                            {
+                                curr = currData.Name;
+                            }
+                            builder.MoveToCell(0, i, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00") + curr);
+
+                            builder.MoveToCell(0, i, 4, 0);
+                            builder.Write("费用小计:");
+
+                            builder.MoveToCell(0, i, 5, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
+                        }
+
+                        //删除多余行
+                        while (table1.Rows.Count > dac1.Count)
+                        {
+                            table1.Rows.RemoveAt(dac1.Count);
+                        }
+
+                        Aspose.Words.Tables.Table table2 = allTables[1] as Aspose.Words.Tables.Table;
+                        for (int i = 0; i < dac2.Count; i++)
+                        {
+
+                            Grp_DayAndCost dac = dac2[i];
+                            if (dac == null) continue;
+
+                            builder.MoveToCell(1, i, 0, 0);
+                            builder.Write("第" + dac.Days.ToString() + "天:");
+
+                            builder.MoveToCell(1, i, 1, 0);
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
+
+                            builder.MoveToCell(1, i, 2, 0);
+                            builder.Write("费用标准:");
+
+                            string curr = "";
+                            var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
+                            if (currData != null)
+                            {
+                                curr = currData.Name;
+                            }
+                            builder.MoveToCell(1, i, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00") + curr);
+
+                            builder.MoveToCell(1, i, 4, 0);
+                            builder.Write("费用小计:");
+
+                            builder.MoveToCell(1, i, 5, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
+
+                        }
+
+                        //删除多余行
+                        while (table2.Rows.Count > dac2.Count)
+                        {
+                            table2.Rows.RemoveAt(dac2.Count);
+                        }
+
+                        Aspose.Words.Tables.Table table3 = allTables[2] as Aspose.Words.Tables.Table;
+                        for (int i = 0; i < dac3.Count; i++)
+                        {
+
+                            Grp_DayAndCost dac = dac3[i];
+                            if (dac == null) continue;
+
+                            builder.MoveToCell(2, i, 0, 0);
+                            builder.Write("第" + dac.Days.ToString() + "天:");
 
 
+                            builder.MoveToCell(2, i, 1, 0);
+
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
+
+                            builder.MoveToCell(2, i, 2, 0);
+                            builder.Write("费用标准:");
+
+                            string curr = "";
+                            var currData = _CurrDatas.Where(it => it.Id == dac.Currency).FirstOrDefault();
+                            if (currData != null)
+                            {
+                                curr = currData.Name;
+                            }
+                            builder.MoveToCell(2, i, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00") + curr);
+
+                            builder.MoveToCell(2, i, 4, 0);
+                            builder.Write("费用小计:");
+
+                            builder.MoveToCell(2, i, 5, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00") + "CNY");
+
+                        }
+
+                        //删除多余行
+                        while (table3.Rows.Count > dac3.Count)
+                        {
+                            table3.Rows.RemoveAt(dac3.Count);
+                        }
+
+                        #endregion
+
+                        //文件名
+                        //string strFileName = $"{_DelegationInfo.TeamName}出入境费用{Guid.NewGuid().ToString()}.{fileFormat}";
+                        string strFileName = $"{_DelegationInfo.TeamName}-出入境费用{Guid.NewGuid().ToString()}.{fileFormat}";
+
+                        AsposeHelper.removewatermark_v2180();
+                        //doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        var saveFormat = Aspose.Words.SaveFormat.Docx;
+
+                        if (fileFormat.Equals("pdf")) { 
+                            //doc.LayoutOptions.IsShowComments = false;
+                            doc.LayoutOptions.IsShowHiddenText = false;
+                            doc.LayoutOptions.IsShowParagraphMarks = false;
+                            doc.LayoutOptions.RevisionOptions.DeletedTextEffect = RevisionTextEffect.None;
+                            doc.AcceptAllRevisions();
+
+                            Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
+                            options.Compliance = PdfCompliance.PdfA1a;
+                            options.CreateNoteHyperlinks = true;
+
+                            doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName, options);
+                            //_view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
+                            _view.Data = new { Url = strFileName };
+                            _view.Msg = "成功";
+                            return _view;
+
+                        }
+
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName, saveFormat);
+                        _view.Data = new { Url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName };
+                        _view.Msg = "成功";
+                        return _view;
+
+                    }
+                    else if (dto.SubTypeId == 1006)//1006(因公出国(境)经费测算明细表)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/因公出国(境)经费测算明细表.docx");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                        if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
+                        {
+                            List<string> list = new List<string>();
+                            try
+                            {
+                                var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
+                                foreach (var item in spilitArr)
+                                {
+                                    var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
+                                    var depCode = spDotandEmpty[2].Substring(0, 3);
+                                    var arrCode = spDotandEmpty[2].Substring(3, 3);
+                                    string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
+                                           arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
+
+                                    list.Add(depName);
+                                    list.Add(arrName);
+                                }
+
+                                list = list.Distinct().ToList();
+                                dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
+                            }
+                            catch (Exception)
+                            {
+                                dic.Add("ReturnCode", "行程录入不正确!");
+                            }
+                        }
+                        else
+                        {
+                            dic.Add("ReturnCode", "未录入行程!");
+                        }
+
+                        dic.Add("ReturnCodeAir", dic["ReturnCode"]);
+                        dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
+                        dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
+
+                        if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
+                        {
+                            TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
+                            dic.Add("Day", sp.Days.ToString());
+                        }
+                        dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
+                        dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
+
+                        //var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
+                        //dic.Add("Names", Names);
+
+
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+
+                        decimal dac1totalPrice = 0.00M;
+                        int accommodationStartIndex = 6, foodandotherStartIndex = 22;
+                        foreach (var dac in dac1)
+                        {
+                            if (dac.SubTotal == 0.00M)
+                            {
+                                continue;
+                            }
+
+                            //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
+                            //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name); 
+                            builder.MoveToCell(0, accommodationStartIndex, 1, 0);
+
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
+                            builder.MoveToCell(0, accommodationStartIndex, 2, 0);
+
+                            string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknown";
+                            builder.Write(currency);//币种
+                            builder.MoveToCell(0, accommodationStartIndex, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00"));//标准
+                            builder.MoveToCell(0, accommodationStartIndex, 4, 0);
+                            builder.Write("");//人数
+                            builder.MoveToCell(0, accommodationStartIndex, 5, 0);
+                            builder.Write("");//天数
+                            builder.MoveToCell(0, accommodationStartIndex, 6, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00"));//小计
+                            builder.MoveToCell(0, accommodationStartIndex, 7, 0);
+
+                            decimal rate = 0.00M;
+                            rate = rateDatas.Find(it => it.CurrencyName.Equals(currency))?.Rate ?? 0.00M;
+
+                            builder.Write(rate.ToString("#0.0000"));//汇率
+                            builder.MoveToCell(0, accommodationStartIndex, 8, 0);
+
+                            decimal rbmPrice = dac.SubTotal;
+                            builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
+                            accommodationStartIndex++;
+                            dac1totalPrice += Convert.ToDecimal(rbmPrice.ToString("#0.00"));
+                        }
+
+                        dic.Add("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
+
+                        for (int i = 21; i > (dac1.Count == 0 ? 1 : dac1.Count) + 6; i--)
+                        {
+                            table1.Rows.RemoveAt(i - 1);
+                            foodandotherStartIndex--;
+                        }
+
+                        if (dac2.Count == dac3.Count)//国家 币种 金额
+                        {
+                            for (int i = 0; i < dac2.Count; i++)
+                            {
+                                dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
+                                dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
+                            }
+                        }
+
+                        decimal dac2totalPrice = 0.00M;
+
+                        foreach (var dac in dac2)
+                        {
+                            if (dac.SubTotal == 0)
+                            {
+                                continue;
+                            }
+
+                            builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
+
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));
+                            builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
+                            string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknown";
+                            builder.Write(currency);//币种
+                            builder.MoveToCell(0, foodandotherStartIndex, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00"));//标准
+                            builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
+                            builder.Write("");//人数
+                            builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
+                            builder.Write("");//天数
+                            builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00"));//小计
+                            builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
+
+                            decimal rate = 0.00M;
+                            rate = rateDatas.Find(it => it.CurrencyName.Equals(currency))?.Rate ?? 0.00M;
+
+                            builder.Write(rate.ToString("#0.0000"));//汇率
+
+                            builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
+                            decimal rbmPrice = dac.SubTotal;
+                            builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
+                            foodandotherStartIndex++;
+                            dac2totalPrice += Convert.ToDecimal(rbmPrice.ToString("#0.00"));
+                        }
+
+                        dic.Add("dac2totalPrice", dac2totalPrice.ToString("#0.00"));
+
+                        for (int i = foodandotherStartIndex + (15 - dac2.Count); i > (dac2.Count == 0 ? 1 : 0) + foodandotherStartIndex; i--)
+                        {
+                            table1.Rows.RemoveAt(i - 1);
+                        }
+
+
+                        dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
+
+                        string otherFeeStr = "";
+                        if (_EnterExitCosts.Visa > 0) otherFeeStr += $"签证费: {_EnterExitCosts.Visa.ToString("#0.00")} 元,";
+                        if (_EnterExitCosts.Safe > 0) otherFeeStr += $"保险费: {_EnterExitCosts.Safe.ToString("#0.00")} 元,";
+                        if (_EnterExitCosts.Ticket > 0) otherFeeStr += $"参展门票费: {_EnterExitCosts.Ticket.ToString("#0.00")} 元,";
+
+                        if (otherFeeStr.Length > 0)
+                        {
+                            otherFeeStr = otherFeeStr.Substring(0, otherFeeStr.Length - 1);
+                            otherFeeStr = $"({otherFeeStr})";
+
+                            dic.Add("OtherFeeStr", otherFeeStr);
+                        }
+
+                        //总计
+                        decimal allPrice = dac1totalPrice + dac2totalPrice + _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket;
+
+                        //国际旅费
+                        string outsideJJ = "";
+                        string allPriceJJ = "";
+                        if (_EnterExitCosts.SumJJC == 1)
+                        {
+                            outsideJJ = string.Format(@"经济舱:{0} 元/人", _EnterExitCosts.AirJJ.ToString("#0.00"));
+                            allPriceJJ = string.Format(@"经济舱:{0} 元/人", (allPrice + _EnterExitCosts.OutsideJJPay).ToString("#0.00"));
+                        }
+                        string outsideGW = "";
+                        string allPriceGW = "";
+                        if (_EnterExitCosts.SumGWC == 1)
+                        {
+                            outsideGW = string.Format(@"公务舱:{0} 元/人", _EnterExitCosts.AirGW.ToString("#0.00"));
+                            allPriceGW = string.Format(@"公务舱:{0} 元/人", (allPrice + _EnterExitCosts.OutsaideGWPay).ToString("#0.00"));
+                        }
+
+                        if (_EnterExitCosts.SumJJC == 1 || _EnterExitCosts.SumGWC == 1)
+                        {
+                            string InTravelPriceStr = string.Format(@" ({0} {1})", outsideJJ, outsideGW);
+                            dic.Add("InTravelPrice", InTravelPriceStr);
+
+                            string FinalSumPriceStr = string.Format(@" ({0} {1})", allPriceJJ, allPriceGW);
+                            dic.Add("FinalSumPrice", FinalSumPriceStr);
+                        }
+
+                        //dic.Add("VisaPay", _EnterExitCosts.Visa.ToString("#0.00"));
+                        //dic.Add("SafePay", _EnterExitCosts.Safe.ToString("#0.00"));
+                        //dic.Add("YiMiao", _EnterExitCosts.YiMiao.ToString("#0.00"));
+
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+
+                        //模板文件名
+                        string strFileName = $"{_DelegationInfo.TeamName}因公出国(境)经费测算明细表.docx";
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+
+                    }
+                    else if (dto.SubTypeId == 1007) //1007(四川省商务厅出国经费财政先行审核表)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/四川省商务厅出国经费财政先行审核表.xls");
+                        //载入模板
+                        WorkbookDesigner designer = new WorkbookDesigner();
+                        designer.Workbook = new Workbook(tempPath);
+
+                        Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                        if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
+                        {
+                            List<string> list = new List<string>();
+                            try
+                            {
+                                var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
+                                foreach (var item in spilitArr)
+                                {
+                                    var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
+                                    var depCode = spDotandEmpty[2].Substring(0, 3);
+                                    var arrCode = spDotandEmpty[2].Substring(3, 3);
+                                    string depName = threeCodes.Find(it => it.Three.Equals(depCode))?.City ?? "Unknwon",
+                                           arrName = threeCodes.Find(it => it.Three.Equals(arrCode))?.City ?? "Unknown";
+
+                                    list.Add(depName);
+                                    list.Add(arrName);
+                                }
+
+                                list = list.Distinct().ToList();
+                                dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
+                            }
+                            catch (Exception)
+                            {
+                                dic.Add("ReturnCode", "行程录入不正确!");
+                            }
+                        }
+                        else
+                        {
+                            dic.Add("ReturnCode", "未录入行程!");
+                        }
+
+                        dic.Add("ReturnCodeAir", dic["ReturnCode"]);
+                        dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
+                        dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
+
+                        if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
+                        {
+                            TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
+                            dic.Add("Day", sp.Days.ToString());
+                        }
+                        dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
+                        dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
+
+                        var Names = string.Join("、", DeleClientList.Select(it => it.Name).ToList()).TrimEnd('、');
+
+                        designer.SetDataSource("ClientUnit", _DelegationInfo.ClientUnit);
+                        designer.SetDataSource("VisitCountry", _DelegationInfo.VisitCountry);
+                        designer.SetDataSource("Group", _DelegationInfo.TeamName);
+                        designer.SetDataSource("ClientUnitTitle", _DelegationInfo.TeamName);
+                        designer.SetDataSource("Name", Names);
+                        designer.SetDataSource("VisitStartDate", dic["VisitStartDate"] + "-" + dic["VisitEndDate"]);
+                        designer.SetDataSource("Day", dic["Day"] + "天");
+                        designer.SetDataSource("ReturnCode", dic["ReturnCode"]);
+                        designer.SetDataSource("ReturnCodeAir", dic["ReturnCodeAir"]);
+
+                        int startIndex = 10;
+                        const int startIndexcopy = 10;
+
+                        if (dac2.Count == dac3.Count)//国家 币种 金额
+                        {
+                            for (int i = 0; i < dac2.Count; i++)
+                            {
+                                dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
+                                dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
+                            }
+                        }
+                        DataTable dtdac1 = new DataTable();
+                        List<string> place = new List<string>();
+                        dtdac1.Columns.AddRange(new DataColumn[] {
+                            new DataColumn(){ ColumnName = "city"},
+                            new DataColumn(){ ColumnName = "curr"},
+                            new DataColumn(){ ColumnName = "criterion"},
+                            new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
+                            new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
+                            new DataColumn(){ ColumnName = "cost",  DataType = typeof(decimal)},
+                            new DataColumn(){ ColumnName = "rate",  DataType = typeof(decimal) },
+                            new DataColumn(){ ColumnName = "costRMB",  DataType = typeof(decimal) },
+                        });
+                        DataTable dtdac2 = new DataTable();
+                        dtdac2.Columns.AddRange(new DataColumn[] {
+                            new DataColumn(){ ColumnName = "city"},
+                            new DataColumn(){ ColumnName = "curr"},
+                            new DataColumn(){ ColumnName = "criterion"},
+                            new DataColumn(){ ColumnName = "number",DataType = typeof(int)},
+                            new DataColumn(){ ColumnName = "day",DataType = typeof(int)},
+                            new DataColumn(){ ColumnName = "cost",  DataType = typeof(decimal)},
+                            new DataColumn(){ ColumnName = "rate",  DataType = typeof(decimal) },
+                            new DataColumn(){ ColumnName = "costRMB",DataType = typeof(decimal)},
+                        });
+                        dtdac1.TableName = "tb1";
+                        dtdac2.TableName = "tb2";
+                        decimal dac1totalPrice = 0.00M, dac2totalPrice = 0.00M;
+                        foreach (var item in dac1)
+                        {
+                            item.Place = GetEnterExitCostExportCity(placeData, item.NationalTravelFeeId);
+                            if (place.Contains(item.Place))
+                            {
+                                continue;
+                            }
+                            DataRow row = dtdac1.NewRow();
+
+                            row["city"] = item.Place;
+
+                            string currency = _CurrDatas.Find(it => it.Id == item.Currency)?.Remark ?? "Unknwon";
+                            decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
+                            row["curr"] = currency;
+                            row["rate"] = rate.ToString("#0.0000");
+                            row["criterion"] = item.Cost.ToString("#0.00");
+                            row["number"] = 1;
+                            row["day"] = dac1.FindAll(x => x.NationalTravelFeeId == item.NationalTravelFeeId).Count;
+
+                            //row["costRMB"] = rbmPrice;
+
+                            dtdac1.Rows.Add(row);
+                            place.Add(item.Place);
+                        }
+
+                        place = new List<string>();
+                        foreach (var item in dac2)
+                        {
+                            item.Place = GetEnterExitCostExportCity(placeData, item.NationalTravelFeeId);
+                            if (place.Contains(item.Place))
+                            {
+                                continue;
+                            }
+                            DataRow row = dtdac2.NewRow();
+                            row["city"] = item.Place;
+                            string currency = _CurrDatas.Find(it => it.Id == item.Currency)?.Remark ?? "Unknwon";
+                            decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
+                            row["curr"] = currency;
+                            row["rate"] = rate.ToString("#0.0000");
+                            row["criterion"] = item.Cost.ToString("#0.00");
+                            row["number"] = 1;
+                            row["day"] = dac2.FindAll(x => x.NationalTravelFeeId == item.NationalTravelFeeId).Count;
+                            //row["cost"] = item.SubTotal;
+
+                            //row["costRMB"] = rbmPrice;
+
+                            dtdac2.Rows.Add(row);
+                            place.Add(item.Place);
+                            //dac2totalPrice += rbmPrice;
+                        }
+
+                        dac1totalPrice = dac1.Sum(it => it.SubTotal);
+                        dac2totalPrice = dac2.Sum(it => it.SubTotal);
+
+                        designer.SetDataSource("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
+                        designer.SetDataSource("dac2totalPrice", dac2totalPrice);
+                        designer.SetDataSource("cityTranffic", @$"其中:国外城市间机票费: {_EnterExitCosts.CityTranffic.ToString("#0.00")} 元");
+                        designer.SetDataSource("sumCityTranffic", @$"{_EnterExitCosts.CityTranffic.ToString("#0.00")} ");
+
+
+                        string cell4Str = $"  4.国际旅费:经济舱:{_EnterExitCosts.AirJJ.ToString("#0.00")} 元/人,公务舱:{_EnterExitCosts.AirGW.ToString("#0.00")} 元/人";
+                        string cellStr = $"  5.其他费用(";
+                        if (_EnterExitCosts.Visa > 0) cellStr += $"签证费:{_EnterExitCosts.Visa.ToString("#0.00")}元,";
+                        if (_EnterExitCosts.YiMiao > 0) cellStr += $"疫苗费:{_EnterExitCosts.YiMiao.ToString("#0.00")}元,";
+                        if (_EnterExitCosts.HeSuan > 0) cellStr += $"核酸费:{_EnterExitCosts.HeSuan.ToString("#0.00")}元,";
+                        if (_EnterExitCosts.Safe > 0) cellStr += $"保险费:{_EnterExitCosts.Safe.ToString("#0.00")}元,";
+                        if (_EnterExitCosts.Ticket > 0) cellStr += $"参展门票费:{_EnterExitCosts.Ticket.ToString("#0.00")}元,";
+                        if (_EnterExitCosts.Service > 0) cellStr += $"服务费:{_EnterExitCosts.Service.ToString("#0.00")}元,";
+                        if (cellStr.Length > 8)
+                        {
+                            cellStr = cellStr.Substring(0, cellStr.Length - 1);
+                        }
+                        cellStr += ")";
+
+
+                        decimal otherFee = _EnterExitCosts.Visa + _EnterExitCosts.YiMiao + _EnterExitCosts.HeSuan + _EnterExitCosts.Safe + _EnterExitCosts.Ticket + _EnterExitCosts.Service;
+                        decimal s = dac1totalPrice + dac2totalPrice + _EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay + otherFee;
+
+                        decimal pxFee = dac4.Sum(it => it.Cost);
+                        decimal glvFee = _EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay;
+                        string celllastStr1 = "";
+                        if (dac1totalPrice > 0) celllastStr1 += $"住宿费 {dac1totalPrice.ToString("#0.00")} 元";
+                        if (dac2totalPrice > 0) celllastStr1 += $",伙食费和公杂费 {dac2totalPrice.ToString("#0.00")} 元";
+                        if (pxFee > 0) celllastStr1 += $",培训费 {pxFee.ToString("#0.00")} 元";
+                        celllastStr1 += $",国际旅费       元";
+                        if (otherFee > 0) celllastStr1 += $",其他费用 {otherFee.ToString("#0.00")} 元";
+
+                        string celllastStr = $"    经审核,{celllastStr1},本次出国经费预算合计为         元。其中:市本级安排      。";
+
+                        designer.SetDataSource("cell4Str", cell4Str);
+                        designer.SetDataSource("cellStr", cellStr);
+                        designer.SetDataSource("cellSum", (_EnterExitCosts.Visa + _EnterExitCosts.Safe).ToString("#0.00"));
+                        designer.SetDataSource("cellSum4", (_EnterExitCosts.OutsideJJPay + _EnterExitCosts.OutsaideGWPay).ToString("#0.00"));
+                        designer.SetDataSource("celllastStr", celllastStr);
+
+                        Workbook wb = designer.Workbook;
+                        var sheet = wb.Worksheets[0];
+
+                        //绑定datatable数据集
+                        designer.SetDataSource(dtdac1);
+                        designer.SetDataSource(dtdac2);
+                        designer.Process();
+
+                        var rowStart = dtdac1.Rows.Count;
+                        while (rowStart > 0)
+                        {
+                            sheet.Cells[startIndex, 8].Formula = $"=G{startIndex + 1} * H{startIndex + 1}";
+                            sheet.Cells[startIndex, 6].Formula = $"=E{startIndex + 1} * F{startIndex + 1} * D{startIndex + 1}";
+                            startIndex++;
+                            rowStart--;
+                        }
+
+                        sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + 1}: I{startIndex})";
+                        startIndex += 1; //总计行
+
+                        rowStart = dtdac2.Rows.Count;
+                        while (rowStart > 0)
+                        {
+                            sheet.Cells[startIndex, 8].Formula = $"= G{startIndex + 1} * H{startIndex + 1}";
+                            sheet.Cells[startIndex, 6].Formula = $"= E{startIndex + 1} *  F{startIndex + 1} * D{startIndex + 1}";
+                            startIndex++;
+                            rowStart--;
+                        }
+
+                        sheet.Cells[startIndex, 8].Formula = $"=SUM(I{startIndexcopy + dtdac1.Rows.Count + 2}: I{startIndex})";
+
+                        wb.CalculateFormula(true);
+
+                        //模板文件名
+                        string strFileName = $"{_DelegationInfo.TeamName}-四川省商务厅出国经费财政先行审核表{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls"; ;//$".xls";
+                        designer.Workbook.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+                    }
+                    else if (dto.SubTypeId == 1066) //成都市因公临时出国任务和预算审批意见表(外专培训团专用)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/成都市因公临时出国任务和预算审批意见表.docx");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                        dic.Add("GroupName", _DelegationInfo.TeamName);
+                        dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
+
+                        string missionLeader = "";  //团负责人默认接团客户名单第一个人
+                        string missionLeaderJob = "";//负责人job
+                        int groupNumber = 0; //团人数
+                        if (DeleClientList.Count > 0)
+                        {
+                            missionLeader = DeleClientList[0]?.Name ?? "";
+                            missionLeaderJob = DeleClientList[0]?.Job ?? "";
+                        }
+                        dic.Add("MissionLeader", missionLeader); //团负责人
+                        dic.Add("MissionLeaderJob", missionLeaderJob); //团负责人job
+                        dic.Add("GroupNumber", _DelegationInfo.VisitPNumber.ToString()); //团人数
+
+
+                        #region MyRegion
+                        //if (blackCode != null && !string.IsNullOrWhiteSpace(blackCode.BlackCode))
+                        //{
+                        //    List<string> list = new List<string>();
+                        //    try
+                        //    {
+                        //        var spilitArr = Regex.Split(blackCode.BlackCode, "\r\n");
+                        //        foreach (var item in spilitArr)
+                        //        {
+                        //            var spDotandEmpty = item.Split('.')[1].Split(' ').Where(x => !string.IsNullOrEmpty(x)).ToList();
+                        //            var depCode = spDotandEmpty[2].Substring(0, 3);
+                        //            var arrCode = spDotandEmpty[2].Substring(3, 3);
+                        //            string depName = threeCodes.Find(it => it.Three.Equals(depCode)).City,
+                        //                   arrName = threeCodes.Find(it => it.Three.Equals(arrCode)).City;
+
+                        //            list.Add(depName);
+                        //            list.Add(arrName);
+                        //        }
+
+                        //        list = list.Distinct().ToList();
+                        //        dic.Add("ReturnCode", string.Join("-", list).TrimEnd('-'));
+                        //    }
+                        //    catch (Exception)
+                        //    {
+                        //        dic.Add("ReturnCode", "行程录入不正确!");
+                        //    }
+                        //}
+                        //else
+                        //{
+                        //    dic.Add("ReturnCode", "未录入行程!");
+                        //}
+
+                        List<string> countrys = _dirRep.GroupSplitCountry(_DelegationInfo.VisitCountry);
+                        dic.Add("ReturnCode", string.Join("、", countrys));
+                        #endregion
+
+
+                        //dic.Add("ReturnCodeAir", dic["ReturnCode"]);
+                        //dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
+                        //dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
+
+                        //if (dic.ContainsKey("VisitStartDate") && dic.ContainsKey("VisitEndDate"))
+                        //{
+                        //    TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
+                        //    dic.Add("Day", sp.Days.ToString());
+
+                        //}
+                        dic.Add("Day", _DelegationInfo.VisitDays.ToString());
+
+                        dic.Add("CultivateDay", dac4.Count.ToString()); //培训天数
+                                                                        // dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
+
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+
+                        //培训人员名单
+                        int cultivateRowIndex = 7;
+                        foreach (var item in DeleClientList)
+                        {
+                            builder.MoveToCell(0, cultivateRowIndex, 0, 0);
+                            builder.Write(item.Name);
+                            builder.MoveToCell(0, cultivateRowIndex, 1, 0);
+                            builder.Write(item.Sex == 0 ? "男" : item.Sex == 1 ? "女" : "");
+
+                            builder.MoveToCell(0, cultivateRowIndex, 2, 0);
+
+                            string birthDay = "";
+                            if (item.Birthday != null)
+                            {
+                                DateTime dt = Convert.ToDateTime(item.Birthday);
+                                birthDay = $"{dt.Year}.{dt.Month}";
+                            }
+                            builder.Write(birthDay);
+
+                            builder.MoveToCell(0, cultivateRowIndex, 3, 0);
+                            builder.Write(item.Company);
+
+                            builder.MoveToCell(0, cultivateRowIndex, 4, 0);
+                            builder.Write(item.Job);
+
+                            cultivateRowIndex++;
+                        }
+
+                        //删除多余行
+                        //cultivateRowIndex -= 2;
+                        int delRows = 10 + 7 - cultivateRowIndex;
+                        if (delRows > 0)
+                        {
+                            for (int i = 0; i < delRows; i++)
+                            {
+
+                                table1.Rows.RemoveAt(cultivateRowIndex);
+                                //cultivateRowIndex++;
+                            }
+                        }
+
+                        decimal hotelFeeTotal = dac1.Sum(it => it.SubTotal);//住宿费
+                        dic.Add("HotelFeeTotal", hotelFeeTotal.ToString("#0.00"));
+                        decimal mealsFeeTotal = dac2.Sum(it => it.SubTotal);//伙食费
+                        dic.Add("MealsFeeTotal", mealsFeeTotal.ToString("#0.00"));
+                        decimal miscellaneousFeeTotal = dac3.Sum(it => it.SubTotal);//公杂费
+                        dic.Add("MiscellaneousFeeTotal", miscellaneousFeeTotal.ToString("#0.00"));
+                        decimal trainingFeeTotal = dac4.Sum(it => it.SubTotal);//培训费
+                        dic.Add("TrainingFeeTotal", trainingFeeTotal.ToString("#0.00"));
+                        decimal cityTranfficFeeToatal = _EnterExitCosts.CityTranffic; //城市区间交通费
+                        dic.Add("CityTranfficFeeToatal", cityTranfficFeeToatal.ToString("#0.00"));//
+                                                                                                  //其他费用
+                        decimal otherFeeTotal = _EnterExitCosts.Visa + _EnterExitCosts.Safe + _EnterExitCosts.Ticket + _EnterExitCosts.YiMiao + _EnterExitCosts.HeSuan + _EnterExitCosts.Service;
+                        dic.Add("OtherFeeTotal", otherFeeTotal.ToString("#0.00"));
+
+                        //其他费用合计
+                        decimal _otherFeeTotal = hotelFeeTotal + mealsFeeTotal + miscellaneousFeeTotal + trainingFeeTotal + cityTranfficFeeToatal + otherFeeTotal;
+
+                        decimal _jjcFeeToatal = _EnterExitCosts.AirJJ + _otherFeeTotal; //经济舱
+                        decimal _gwcFeeToatal = _EnterExitCosts.AirGW + _otherFeeTotal; //公务舱
+
+                        //公务舱合计
+
+                        //国际旅费
+
+                        string outsideJJ = "";
+                        string allPriceJJ = "";
+                        if (_EnterExitCosts.SumJJC == 1 && _EnterExitCosts.SumGWC == 0)
+                        {
+                            dic.Add("AirFeeTotal", _EnterExitCosts.AirJJ.ToString("#0.00"));
+                            dic.Add("FeeTotal", _jjcFeeToatal.ToString("#0.00"));
+                        }
+                        if (_EnterExitCosts.SumGWC == 1 && _EnterExitCosts.SumJJC == 0)
+                        {
+                            dic.Add("AirFeeTotal", _EnterExitCosts.AirGW.ToString("#0.00"));
+                            dic.Add("FeeTotal", _gwcFeeToatal.ToString("#0.00"));
+                        }
+
+                        if (_EnterExitCosts.SumJJC == 1 && _EnterExitCosts.SumGWC == 1)
+                        {
+                            string airFeeTotalStr = string.Format(@$"经济舱:{_EnterExitCosts.AirJJ.ToString("#0.00")} 公务舱:{_EnterExitCosts.AirGW.ToString("#0.00")}");
+                            dic.Add("AirFeeTotal", airFeeTotalStr);
+                            string feeTotalStr = string.Format(@$"经济舱:{_jjcFeeToatal.ToString("#0.00")} 公务舱:{_gwcFeeToatal.ToString("#0.00")}");
+                            dic.Add("FeeTotal", feeTotalStr);
+                        }
+
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+
+                        //模板文件名
+                        string strFileName = $"{_DelegationInfo.TeamName}-成都市因公临时出国任务和预算审批意见表(外专培训团专用).docx";
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+                    }
+                }
+                else if (dto.ExportType == 2) //表格
+                {
+                    //利用键值对存放数据
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+
+                    dic.Add("VisitStartDate", _DelegationInfo.VisitStartDate.ToString("yyyy年MM月dd日"));
+                    dic.Add("VisitEndDate", _DelegationInfo.VisitEndDate.ToString("yyyy年MM月dd日"));
+
+                    TimeSpan sp = _DelegationInfo.VisitEndDate.Subtract(_DelegationInfo.VisitStartDate);
+                    dic.Add("Day", sp.Days.ToString());
+
+                    dic.Add("VisitCountry", _DelegationInfo.VisitCountry);
+
+                    if (dto.SubTypeId == 1008) //1008(派员单位出(境)任务和预算审批意见表)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/派员单位出(境)任务和预算审批意见表.docx");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        dic.Add("TeamName", _DelegationInfo.TeamName);
+                        dic.Add("ClientUnit", _DelegationInfo.ClientUnit);
+                        //dic.Add("TellPhone", _DelegationInfo.TellPhone);
+
+                        string missionLeaderName = "",
+                               missionLeaderJob = "";
+
+                        if (DeleClientList.Count > 0)
+                        {
+                            missionLeaderName = DeleClientList[0].Name;
+                            missionLeaderJob = DeleClientList[0].Job;
+                        }
+
+                        dic.Add("MissionLeaderName", missionLeaderName);
+                        dic.Add("MissionLeaderJob", missionLeaderJob);
+
+                        dic.Add("VisitPNumber", _DelegationInfo.VisitPNumber.ToString());
+                        dic.Add("VisitPurpose", _DelegationInfo.VisitPurpose);
+
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+                        int rowCount = 10;//总人数行
+                        int startRowIndex = 7; //起始行
+                        for (int i = 0; i < DeleClientList.Count; i++)
+                        {
+                            builder.MoveToCell(0, startRowIndex, 0, 0);
+                            builder.Write(DeleClientList[i].Name); //出国人员姓名
+                            builder.MoveToCell(0, startRowIndex, 1, 0);
+                            string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
+
+                            builder.Write(sex);//性别
+                            builder.MoveToCell(0, startRowIndex, 2, 0);
+                            builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));//出生年月
+                            builder.MoveToCell(0, startRowIndex, 3, 0);
+                            builder.Write(DeleClientList[i].Company);//工作单位
+                            builder.MoveToCell(0, startRowIndex, 4, 0);
+                            builder.Write(DeleClientList[i].Job);//职务及级别
+                            builder.MoveToCell(0, startRowIndex, 5, 0);
+                            builder.Write("");//人员属性
+                            builder.MoveToCell(0, startRowIndex, 6, 0);
+                            builder.Write("");//上次出国时间
+                            startRowIndex++;
+                        }
+                        int nullRow = rowCount - DeleClientList.Count;//空行
+                        for (int i = 0; i < nullRow; i++)
+                        {
+                            table1.Rows.Remove(table1.Rows[startRowIndex]);
+                        }
+
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+                        //模板文件名
+                        string strFileName = $"派员单位出(境)任务和预算审批意见表.docx";
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+
+                    }
+                    else if (dto.SubTypeId == 1009)//1009(省级单位出(境)经费报销单)
+                    {
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/省级单位出(境)经费报销单.docx");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        dic.Add("GroupClient", _DelegationInfo.ClientUnit);
+
+                        var Names = string.Join("、", DeleClientList.Select(x => x.Name)).TrimEnd('、');
+                        dic.Add("Names", Names);
+
+                        int accommodationRows = 12, foodandotherRows = 12;
+                        var Dac1currCn = dac1.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
+                        var Dac2currCn = dac2.GroupBy(x => x.Currency).Select(x => x.Key).ToList();
+
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+                        Aspose.Words.Tables.Table table1 = allTables[0] as Aspose.Words.Tables.Table;
+
+
+                        int accommodationStartIndex = 6;
+                        decimal dac1totalPrice = 0.00M;
+                        foreach (var dac in dac1)
+                        {
+                            if (dac.SubTotal == 0)
+                            {
+                                continue;
+                            }
+
+                            //builder.MoveToCell(0, accommodationStartIndex, 0, 0);
+                            //builder.Write(DeleClientList[i].LastName + DeleClientList[i].Name); 
+                            builder.MoveToCell(0, accommodationStartIndex, 1, 0);
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));//城市
+                            builder.MoveToCell(0, accommodationStartIndex, 2, 0);
+
+                            string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknwon";
+                            builder.Write(currency);//币种
+                            builder.MoveToCell(0, accommodationStartIndex, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00"));//标准
+                            builder.MoveToCell(0, accommodationStartIndex, 4, 0);
+                            builder.Write("");//人数
+                            builder.MoveToCell(0, accommodationStartIndex, 5, 0);
+                            builder.Write("");//天数
+                            builder.MoveToCell(0, accommodationStartIndex, 6, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00"));//小计
+                            builder.MoveToCell(0, accommodationStartIndex, 7, 0);
+
+                            decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
+                            builder.Write(rate.ToString("#0.0000"));//汇率
+                            builder.MoveToCell(0, accommodationStartIndex, 8, 0);
+
+                            decimal rbmPrice = rate * dac.SubTotal;
+                            builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
+                            accommodationStartIndex++;
+                            dac1totalPrice += rbmPrice;
+                        }
+
+
+
+
+                        dic.Add("dac1totalPrice", dac1totalPrice.ToString("#0.00"));
+
+
+                        builder.MoveToCell(0, accommodationStartIndex, 1, 0);
+                        builder.Write("小计");
+                        builder.MoveToCell(0, accommodationStartIndex, 8, 0);
+                        builder.Write(dac1totalPrice.ToString("#0.00"));
+
+                        accommodationStartIndex++;
+
+
+                        int nullRow = accommodationRows - dac1.Count;
+                        //删除空行
+                        //if (nullRow > 0)
+                        //{
+                        //    int rowIndex = accommodationStartIndex;
+                        //    for (int i = 0; i < nullRow; i++)
+                        //    {
+                        //        Row row = table1.Rows[rowIndex];
+                        //        row.Remove();        
+                        //        rowIndex++;
+                        //    }
+                        //}
+
+                        if (dac2.Count == dac3.Count)//国家 币种 金额
+                        {
+                            for (int i = 0; i < dac2.Count; i++)
+                            {
+                                dac2[i].SubTotal = dac2[i].SubTotal + dac3[i].SubTotal; //小计
+                                dac2[i].Cost = dac3[i].Cost + dac2[i].Cost; //标准
+                            }
+                        }
+
+                        int foodandotherStartIndex = 19;//
+                        decimal dac2totalPrice = 0.00M;
+                        foreach (var dac in dac2)
+                        {
+                            if (dac.SubTotal == 0)
+                            {
+                                continue;
+                            }
+                            //foodandotherStartIndex = 12;
+                            builder.MoveToCell(0, foodandotherStartIndex, 1, 0);
+                            builder.Write(GetEnterExitCostExportCity(placeData, dac.NationalTravelFeeId));//城市
+                            builder.MoveToCell(0, foodandotherStartIndex, 2, 0);
+
+                            string currency = _CurrDatas.Find(it => it.Id == dac.Currency)?.Remark ?? "Unknwon";
+                            builder.Write(currency);//币种
+                            builder.MoveToCell(0, foodandotherStartIndex, 3, 0);
+                            builder.Write(dac.Cost.ToString("#0.00"));//标准
+                            builder.MoveToCell(0, foodandotherStartIndex, 4, 0);
+                            builder.Write("");//人数
+                            builder.MoveToCell(0, foodandotherStartIndex, 5, 0);
+                            builder.Write("");//天数
+                            builder.MoveToCell(0, foodandotherStartIndex, 6, 0);
+                            builder.Write(dac.SubTotal.ToString("#0.00"));//小计
+                            builder.MoveToCell(0, foodandotherStartIndex, 7, 0);
+
+                            decimal rate = rateDatas.Find(it => it.CurrencyName == currency)?.Rate ?? 0.00M;
+                            builder.Write(rate.ToString("#0.0000"));//汇率
+                            builder.MoveToCell(0, foodandotherStartIndex, 8, 0);
+
+                            decimal rbmPrice = rate * dac.SubTotal;
+                            builder.Write(rbmPrice.ToString("#0.00"));//折合人民币
+                            foodandotherStartIndex++;
+                            dac2totalPrice += rbmPrice;
+                        }
+
+                        dic.Add("dac2totalPrice", dac2totalPrice.ToString("#0.00"));
+                        //删除空行
+                        if (dac2.Count < foodandotherRows)
+                        {
+                            //int nullRow = accommodationRows - dac2.Count;
+                            //while (table2.Rows.Count > dac2.Count)
+                            //{
+                            //    table2.Rows.RemoveAt(dac2.Count);
+                            //}
+                        }
+
+                        dic.Add("CityTranffic", _EnterExitCosts.CityTranffic.ToString("#0.00"));
+
+                        string otherFeeStr = "";
+                        if (_EnterExitCosts.Visa > 0) otherFeeStr += $"签证费: {_EnterExitCosts.Visa.ToString("#0.00")} 元,";
+                        if (_EnterExitCosts.Safe > 0) otherFeeStr += $"保险费: {_EnterExitCosts.Safe.ToString("#0.00")} 元,";
+                        if (_EnterExitCosts.Ticket > 0) otherFeeStr += $"参展门票费: {_EnterExitCosts.Ticket.ToString("#0.00")} 元,";
+
+                        if (otherFeeStr.Length > 0)
+                        {
+                            otherFeeStr = otherFeeStr.Substring(0, otherFeeStr.Length - 1);
+                            otherFeeStr = $"({otherFeeStr})";
+
+                            dic.Add("OtherFeeStr", otherFeeStr);
+                        }
+
+                        foreach (var key in dic.Keys)
+                        {
+                            builder.MoveToBookmark(key);
+                            builder.Write(dic[key]);
+                        }
+                        //模板文件名
+                        string strFileName = $"省级单位出(境)经费报销单.docx";
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+                    }
+                }
+                else if (dto.ExportType == 3)
+                {
+                    if (dto.SubTypeId == 1) //团组成员名单
+                    {
+                        if (DeleClientList.Count < 1)
+                        {
+                            _view.Msg = "团组成员暂未录入!!!";
+                            return _view;
+                        }
+
+                        //获取模板
+                        string tempPath = (AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/Temp/dwon_团组人员列表模板.doc");
+                        //载入模板
+                        Document doc = new Document(tempPath);
+                        DocumentBuilder builder = new DocumentBuilder(doc);
+
+                        //获取word里所有表格
+                        NodeCollection allTables = doc.GetChildNodes(NodeType.Table, true);
+
+                        //获取所填表格的序数
+                        Aspose.Words.Tables.Table tableOne = allTables[0] as Aspose.Words.Tables.Table;
+
+                        var rowStart = tableOne.Rows[0]; //获取第1行
+
+                        //循环赋值
+                        for (int i = 0; i < DeleClientList.Count; i++)
+                        {
+                            builder.MoveToCell(0, i + 1, 0, 0);
+                            builder.Write(DeleClientList[i].Name);
+
+                            builder.MoveToCell(0, i + 1, 1, 0);
+                            string sex = DeleClientList[i].Sex == 0 ? "男" : DeleClientList[i].Sex == 1 ? "女" : "";
+                            builder.Write(sex);
+
+                            builder.MoveToCell(0, i + 1, 2, 0);
+                            builder.Write(Convert.ToDateTime(DeleClientList[i].Birthday).ToString("yyyy年MM月dd日"));
+
+                            builder.MoveToCell(0, i + 1, 3, 0);
+                            builder.Write(DeleClientList[i].Company);
+
+                            builder.MoveToCell(0, i + 1, 4, 0);
+                            builder.Write(DeleClientList[i].Job);
+                        }
+
+                        //删除多余行
+                        while (tableOne.Rows.Count > DeleClientList.Count + 1)
+                        {
+                            tableOne.Rows.RemoveAt(DeleClientList.Count + 1);
+                        }
+
+                        string strFileName = $"{_DelegationInfo.TeamName}组团人员名单({DateTime.Now.ToString("yyyyMMddHHmmss")}).doc";
+                        //C:/Server/File/OA2023/Office/Word/EnterExitCost/File/
+                        //C:\Server\File\OA2023\Office\Word\EnterExitCost\File\
+                        doc.Save(AppSettingsHelper.Get("WordBasePath") + "EnterExitCost/File/" + strFileName);
+
+                        string url = AppSettingsHelper.Get("WordBaseUrl") + "Office/Word/EnterExitCost/File/" + strFileName;
+
+                        _view.Data = new { Url = url };
+                        _view.Msg = "成功";
+                        return _view;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                _view.Code = StatusCodes.Status500InternalServerError;
+                _view.Msg = ex.Message;
+
+                return _view;
+            }
+            return _view;
+        }
+
+
+        #endregion
 
 
     }
     }
 }
 }

+ 41 - 2
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Config.cs

@@ -232,7 +232,6 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             return result;
             return result;
         }
         }
 
 
-
         /// <summary>
         /// <summary>
         /// 日付申请审核结果推送给申请人
         /// 日付申请审核结果推送给申请人
         /// </summary>
         /// </summary>
@@ -295,7 +294,6 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             return result;
             return result;
         }
         }
 
 
-
         /// <summary>
         /// <summary>
         /// 成本通知发送给用户
         /// 成本通知发送给用户
         /// </summary>
         /// </summary>
@@ -320,11 +318,52 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
             return result;
             return result;
         }
         }
 
 
+        /// <summary>
+        /// 出入境费用明细更改通知发送给用户
+        /// </summary>
+        /// <returns></returns>
+        public static string GroupShare_ToGM(GroupShare_ToGMModel info)
+        {
+            string result = string.Format(@" `出入境费用明细操作通知`  
+
+>团组:<font color='info'>{0}</font> 
+
+>操作人员:{1}
+>操作时间:<font color='comment'>{2}</font> 
+
+[请点击进入明细进行查看或确认]({3}) ", info.TeamName, info.CreateUser, info.RefreshDate, info.Url);
+
+            return result;
+        }
+
+        /// <summary>
+        /// 出入境费用 确认 通知发送给 财务相关人员
+        /// </summary>
+        /// <returns></returns>
+        public static string GroupShare_ToFinance(GroupShare_ToUserModel info)
+        {
+            string result = string.Format(@" `出入境费用确认操作通知`  
+
+>团组:<font color='info'>{0}</font> 
+
+>操作时间:<font color='comment'>{2}</font> 
+
+[出入境费用已确认,请进行相关流程操作。] ", info.TeamName, info.RefreshDate);
+
+            return result;
+        }
     }
     }
 
 
 
 
     #region 实体类
     #region 实体类
 
 
+    public class GroupShare_ToGMModel : GroupShare_ToUserModel
+    {
+        public string CreateUser { get; set; }
+
+        public string Url { get; set; }
+    }
+
     public class GroupShare_ToUserModel
     public class GroupShare_ToUserModel
     {
     {
         public string TeamName { get; set; }
         public string TeamName { get; set; }

+ 75 - 1
OASystem/OASystem.Api/OAMethodLib/QiYeWeChatAPI/AppNotice/Library.cs

@@ -1,9 +1,11 @@
-using NPOI.SS.Formula.Functions;
+using EyeSoft.Runtime.InteropServices;
+using NPOI.SS.Formula.Functions;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Infrastructure.Repositories.Groups;
 using OASystem.Infrastructure.Repositories.Groups;
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 
 
 namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 {
 {
@@ -523,6 +525,7 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
         /// <returns></returns>
         /// <returns></returns>
         public static async Task<bool> SendUserMsg_GroupStatus_PayResult(int Grp_CreditCardPaymentId, List<string> userId)
         public static async Task<bool> SendUserMsg_GroupStatus_PayResult(int Grp_CreditCardPaymentId, List<string> userId)
         {
         {
+            //, QiyeWeChatEnum qiyeWeChat
             Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
             Grp_CreditCardPayment ccp = _grpDeleRep.Query<Grp_CreditCardPayment>(s => s.Id == Grp_CreditCardPaymentId).First();
             Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
             Grp_DelegationInfo group = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == ccp.DIId).First();
 
 
@@ -784,6 +787,77 @@ namespace OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice
 
 
         #endregion
         #endregion
 
 
+
+        #region 三公费用更改通知
+
+        /// <summary>
+        /// 三公费用更改通知发送总经理(21)
+        /// </summary>
+        /// <param name="sign"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendUserMsg_GroupShare_ToGM(int diId,List<string> receivedUserIds, int updateUserId, string url)
+        {
+
+            Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+            
+            GroupShare_ToGMModel info = new GroupShare_ToGMModel()
+            {
+                RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
+                TeamName = groupInfo.TeamName,
+                CreateUser = _grpDeleRep.Query<Sys_Users>(s => s.Id == updateUserId).First()?.CnName ?? "-",
+                Url = url
+            };
+
+            if (receivedUserIds.Count > 0)
+            {
+                List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToGM(info));
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        /// <summary>
+        /// 三公费用确认通知发送财务部人员
+        /// </summary>
+        /// <param name="sign"></param>
+        /// <returns></returns>
+        public static async Task<bool> SendUserMsg_GroupShare_ToFinance(int diId)
+        {
+
+            Grp_DelegationInfo groupInfo = _grpDeleRep.Query<Grp_DelegationInfo>(s => s.Id == diId).First();
+
+            GroupShare_ToUserModel info = new GroupShare_ToUserModel()
+            {
+                RefreshDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm"),
+                TeamName = groupInfo.TeamName
+            };
+
+            List<string> receivedUserIds = _grpDeleRep.Query<Sys_Users>(s => s.IsDel == 0 && s.DepId == 3).Select(x => x.Id.ToString()).ToList();
+            receivedUserIds = new List<string>() { "208","4", "233" };
+            if (receivedUserIds.Count > 0)
+            {
+                List<string> qwUserIdList = GetQiyeChatUserIdList(receivedUserIds);
+                ResponseBase result = await _qiYeWeChatApiService.GroupStatus_SendMessage_ToUser_Markdown(qwUserIdList, MarkdownLib.GroupShare_ToFinance(info));
+                if (result.errcode != 0)
+                {
+                    //抄送日志 
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+
+        #endregion
+
+
         #region 成本通知
         #region 成本通知
 
 
         /// <summary>
         /// <summary>

+ 14 - 0
OASystem/OASystem.Domain/Dtos/Groups/EnterExitCostDto.cs

@@ -218,6 +218,20 @@ namespace OASystem.Domain.Dtos.Groups
 
 
     }
     }
 
 
+    public class ConfirmCostDto {
+
+        /// <summary>
+        /// 类型
+        /// 1:确认 2:撤回
+        /// </summary>
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 数据Id
+        /// </summary>
+        public int Id { get; set; }
+    }
+
     /// <summary>
     /// <summary>
     /// 出入境费用 - 表格导出 Dto
     /// 出入境费用 - 表格导出 Dto
     /// </summary>
     /// </summary>

+ 7 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_EnterExitCost.cs

@@ -71,7 +71,6 @@ namespace OASystem.Domain.Entities.Groups
 
 
         #endregion
         #endregion
 
 
-
         /// <summary>
         /// <summary>
         /// 国际旅费合计(经济舱)
         /// 国际旅费合计(经济舱)
         /// </summary>
         /// </summary>
@@ -212,5 +211,12 @@ namespace OASystem.Domain.Entities.Groups
         public int AirGWC_Checked { get; set; }
         public int AirGWC_Checked { get; set; }
 
 
         #endregion
         #endregion
+
+        /// <summary>
+        /// 确认费用(确认费用后 不可更改)
+        /// 1:未确认 2:已确认
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int IsConfirm { get; set; } = 1;
     }
     }
 }
 }

+ 51 - 5
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -9,6 +9,7 @@ using OASystem.Infrastructure.Tools;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
+using System.Security.Policy;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 
 
@@ -225,8 +226,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
             trainingExpenseData = trainingExpenseData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
             trainingExpenseData = trainingExpenseData.Select(it => { it.CreateUserId = dto.UserId; return it; }).ToList();
             if (trainingExpenseData.Count > 0) subData.AddRange(trainingExpenseData);
             if (trainingExpenseData.Count > 0) subData.AddRange(trainingExpenseData);
 
 
-
-
             //处理币种string
             //处理币种string
             enterExitCost.CurrencyRemark = CommonFun.GetCurrencyChinaToString(dto.Currencys);
             enterExitCost.CurrencyRemark = CommonFun.GetCurrencyChinaToString(dto.Currencys);
             enterExitCost.CreateUserId = dto.UserId;
             enterExitCost.CreateUserId = dto.UserId;
@@ -238,9 +237,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 try
                 try
                 {
                 {
                     int enterExitId = 0;
                     int enterExitId = 0;
-
+                    
                     if (enterExitCost.Id > 0) //修改
                     if (enterExitCost.Id > 0) //修改
                     {
                     {
+                        //修改验证
+                        //IsConfirm == 2 不可修改
+
+                        var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.Id == enterExitCost.Id).First();
+                        if (info.IsConfirm == 2)
+                        {
+                            result.Msg = "该团出入境费用已确认!不可更改!!";
+                            return result;
+                        }
+
                         var updateId = _sqlSugar.Updateable<Grp_EnterExitCost>(enterExitCost)
                         var updateId = _sqlSugar.Updateable<Grp_EnterExitCost>(enterExitCost)
                                                 .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
                                                 .IgnoreColumns(it => new { it.DeleteUserId, it.DeleteTime, it.CreateUserId, it.CreateTime, it.IsDel })
                                                 .ExecuteCommand();
                                                 .ExecuteCommand();
@@ -253,14 +262,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             _sqlSugar.RollbackTran();
                             _sqlSugar.RollbackTran();
                             result.Msg = "修改操作失败!";
                             result.Msg = "修改操作失败!";
                             return result;
                             return result;
-
                         }
                         }
                     }
                     }
                     else
                     else
                     {
                     {
                         //效重 根据团组Id 
                         //效重 根据团组Id 
 
 
-                        var info  = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
+                        var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
                         if (info != null )
                         if (info != null )
                         {
                         {
                             _sqlSugar.RollbackTran();
                             _sqlSugar.RollbackTran();
@@ -299,6 +307,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     _sqlSugar.CommitTran();
                     _sqlSugar.CommitTran();
                     result.Code = 0;
                     result.Code = 0;
                     result.Msg = "操作成功!";
                     result.Msg = "操作成功!";
+                    result.Data = new { sign = enterExitId };
 
 
                 }
                 }
                 catch (Exception ex)
                 catch (Exception ex)
@@ -313,6 +322,43 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
             return result;
         }
         }
 
 
+        /// <summary>
+        /// 确认费用
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> ConfirmCost(ConfirmCostDto dto)
+        {
+            var _view = new JsonView() { Code = 20001, Msg = "操作失败!" };
+            if (dto.Id < 1)
+            {
+                _view.Msg = MsgTips.Id;
+                return _view;
+            }
+
+            int confirm = 1;
+            if (dto.Type == 1) confirm = 2; // 确认
+            else if (dto.Type == 2) { confirm = 1; } // 撤回
+            else
+            {
+                _view.Msg = "请传入正确的type;1:确认 2:撤回";
+                return _view;
+            }
+            var update = await _sqlSugar.Updateable<Grp_EnterExitCost>()
+                                        .SetColumns(x => new Grp_EnterExitCost() { IsConfirm = confirm })
+                                        .Where(x => x.Id == dto.Id)
+                                        .ExecuteCommandAsync();
+            if (update>0)
+            {
+                _view.Code = 200;
+                _view.Msg = "操作成功!";
+                return _view;
+            }
+
+            return _view;
+        }
+
+
         /// <summary>
         /// <summary>
         /// Del
         /// Del
         /// </summary>
         /// </summary>

+ 37 - 16
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -164,19 +164,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
             else if (feeType == 2)
             else if (feeType == 2)
             {
             {
                 //1.基础数据参数验证
                 //1.基础数据参数验证
-                var priceType = setData.Where(x => x.Name.Contains("尾款")).Select(x =>x.Id).ToList();
+                var priceType = new List<int>() { 1062 };
                 var opinfos = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
                 var opinfos = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
                                        .Where(x => x.IsDel == 0 && x.DiId == diId && x.Id == dataId && !priceType.Contains(x.PriceType))
                                        .Where(x => x.IsDel == 0 && x.DiId == diId && x.Id == dataId && !priceType.Contains(x.PriceType))
                                        .First();
                                        .First();
+                //var opinfos = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservations>()
+                //                       .Where(x => x.IsDel == 0 && x.DiId == diId && x.Id == dataId )
+                //                       .First();
                 if (opinfos == null)
                 if (opinfos == null)
                 {
                 {
-                    _view.Msg = $"OP费用数据未填写";
+                    _view.Msg = $"OP费用费用类型属于“尾款”或者 内容未填写";
                     return _view;
                     return _view;
                 }
                 }
                 //1.含超时费用/超支费用 手动审核
                 //1.含超时费用/超支费用 手动审核
-                if (opinfos.SelectCheck.Contains("超时") || opinfos.SelectCheck.Contains("超支"))
+                if (opinfos.SelectCheck.Contains("超时") || opinfos.SelectCheck.Contains("超支") || opinfos.SelectCheck.Contains("尾款"))
                 {
                 {
-                    _view.Msg = $"OP费用含超时费用,请手动审核";
+                    _view.Msg = @$"OP费用含尾款/超支/超时费用,请手动审核";
                     return _view;
                     return _view;
                 }
                 }
                 //1.参数验证
                 //1.参数验证
@@ -220,9 +223,32 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     return _view;
                     return _view;
                 }
                 }
 
 
+                var noAuditFeeTypeIds = new List<int> {
+                   982 ,//982 车超时费 -- 暂无
+                   96  ,//96  接送机费 -- 暂无
+                   97  ,//97  其他费用 -- 暂无
+                   992 ,//992 住补费用 -- 暂无
+                   1059,//1059    导游超时费用 -- 暂无
+                   1070,//1070    尾款金额 -- 暂无
+                   1071,//1071    其他额外费用 -- 暂无
+                   1073,//1073    翻译超时费 -- 暂无
+                   1074,//1074    早餐超支费用 -- 暂无
+                   1075,//1075    午餐超支费用 -- 暂无
+                   1076,//1076    晚餐超支费用 -- 暂无
+                };
+                //费用类型筛选 包含 feeTypeIds && 包含这些类型费用大于0
+                var noAuditFeeContents = opContents.Where(x => x.Price > 0 && noAuditFeeTypeIds.Contains(x.SId)).ToList();
+                if (noAuditFeeContents.Count > 0)
+                {
+                    _view.Msg = @$"OP费用含尾款/超支/超时费用,请手动审核";
+                    return _view;
+                }
+
+
                 //2.按天按项 检查费用是否超过预算 
                 //2.按天按项 检查费用是否超过预算 
                 var opDayContent = opContents.GroupBy(x => x.DatePrice);
                 var opDayContent = opContents.GroupBy(x => x.DatePrice);
 
 
+
                 foreach (var item in opDayContent)
                 foreach (var item in opDayContent)
                 {
                 {
                     var opCostInfo = opCostDatas.Where(x => Convert.ToDateTime(x.Date) == item.Key).ToList();
                     var opCostInfo = opCostDatas.Where(x => Convert.ToDateTime(x.Date) == item.Key).ToList();
@@ -231,9 +257,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     //车费 91
                     //车费 91
                     var opCarCost = item.FirstOrDefault(x => x.SId == 91);
                     var opCarCost = item.FirstOrDefault(x => x.SId == 91);
                     if (opCarCost != null) if (opCarCost.Price > _rate * opCostInfo.Sum(x => x.CarFee)) isAutoAudit = false;
                     if (opCarCost != null) if (opCarCost.Price > _rate * opCostInfo.Sum(x => x.CarFee)) isAutoAudit = false;
-
                     //982 车超时费 -- 暂无
                     //982 车超时费 -- 暂无
-
                     //92  导游费
                     //92  导游费
                     var opGuideCost = item.FirstOrDefault(x => x.SId == 92);
                     var opGuideCost = item.FirstOrDefault(x => x.SId == 92);
                     if (opGuideCost != null) if (opGuideCost.Price > _rate * opCostInfo.Sum(x => x.GuideFee)) isAutoAudit = false;
                     if (opGuideCost != null) if (opGuideCost.Price > _rate * opCostInfo.Sum(x => x.GuideFee)) isAutoAudit = false;
@@ -282,13 +306,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     //994 翻译费
                     //994 翻译费
                     var opTranslatorCost = item.FirstOrDefault(x => x.SId == 994);
                     var opTranslatorCost = item.FirstOrDefault(x => x.SId == 994);
                     if (opTranslatorCost != null) if (opTranslatorCost.Price > _rate * opCostInfo.Sum(x => x.TranslatorFee)) isAutoAudit = false;
                     if (opTranslatorCost != null) if (opTranslatorCost.Price > _rate * opCostInfo.Sum(x => x.TranslatorFee)) isAutoAudit = false;
-                    //1059    导游超时费用
-                    //1070    尾款金额
-                    //1071    其他额外费用
-                    //1073    翻译超时费
-                    //1074    早餐超支费用
-                    //1075    午餐超支费用
-                    //1076    晚餐超支费用
+                    //1059    导游超时费用 -- 暂无
+                    //1070    尾款金额 -- 暂无
+                    //1071    其他额外费用 -- 暂无
+                    //1073    翻译超时费 -- 暂无
+                    //1074    早餐超支费用 -- 暂无
+                    //1075    午餐超支费用 -- 暂无
+                    //1076    晚餐超支费用 -- 暂无
                 }
                 }
 
 
                 //更改审核状态
                 //更改审核状态
@@ -329,9 +353,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                         }
                     }
                     }
                 }
                 }
-
-
-
             }
             }
             else _view.Msg = $"请传入有效的feeType参数";
             else _view.Msg = $"请传入有效的feeType参数";