Browse Source

出入境其他费用增加子项备注

LEIYI 3 months ago
parent
commit
c11f071c16

+ 218 - 12
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -8,6 +8,7 @@ using EyeSoft.IO;
 using Microsoft.AspNetCore.SignalR;
 using MySqlX.XDevAPI.Relational;
 using NPOI.HSSF.UserModel;
+using NPOI.POIFS.Crypt.Dsig;
 using NPOI.SS.Format;
 using NPOI.SS.Formula.Functions;
 using NPOI.SS.UserModel;
@@ -110,6 +111,8 @@ namespace OASystem.API.Controllers
         private readonly VisaCommissionRepository _visaCommissionRep;
         private readonly ForeignReceivablesRepository _ffrRep;  //对外收款账单仓库
         private readonly OpinionaireRepository _opinionaireRep;  //对外收款账单仓库
+        private readonly List<CurrencyInfo> _currencyInit;
+        private readonly List<int> _portTypeData;
 
         public GroupsController(
             ILogger<GroupsController> logger,
@@ -191,6 +194,16 @@ namespace OASystem.API.Controllers
             _visaCommissionRep = visaCommissionRep;
             _ffrRep = ffrRep;
             _opinionaireRep = opinionaireRep;
+            _currencyInit = new List<CurrencyInfo>()
+                {
+                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 7.5000M },
+                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 8.0000M },
+                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 9.5000M },
+                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0500M },
+                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.9500M },
+                };
+            _portTypeData = new List<int>() { 2, 3 };
+
         }
 
         #region 流程管控
@@ -5120,11 +5133,11 @@ FROM
             }
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用 
         /// 实时汇率 tips
         /// 签证费用 tips
+        /// 机票费用 tips
         /// </summary>
         /// <returns></returns>
         [HttpPost]
@@ -5134,14 +5147,7 @@ FROM
             var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(it => it.Id == dto.DiId && it.IsDel == 0);
 
             //默认币种显示
-            List<CurrencyInfo> _currencyInfos = new List<CurrencyInfo>()
-                {
-                    new CurrencyInfo (){ CurrencyCode="USD",CurrencyName = "美元",Rate = 7.5000M },
-                    new CurrencyInfo (){ CurrencyCode="EUR",CurrencyName = "欧元",Rate = 8.0000M },
-                    new CurrencyInfo (){ CurrencyCode="GBP",CurrencyName = "英镑",Rate = 9.5000M },
-                    new CurrencyInfo (){ CurrencyCode="JPY",CurrencyName = "日元",Rate = 0.0500M },
-                    new CurrencyInfo (){ CurrencyCode="HKD",CurrencyName = "港币",Rate = 0.9500M },
-                };
+            var _currencyInfos = _currencyInit;
 
             var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
             List<dynamic> reteInfos = new List<dynamic>();
@@ -5181,7 +5187,6 @@ FROM
             }));
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用 - Info
         /// </summary>
@@ -5321,7 +5326,6 @@ FROM
             return Ok(_view);
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用 - File downlaod
         /// </summary>
@@ -6814,7 +6818,6 @@ FROM
             return _city;
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用 - 明细表导出
         /// </summary>
@@ -7175,6 +7178,209 @@ FROM
         }
 
 
+        #endregion
+
+        #region 团组经理模块 出入境费用 移动端(Android/IOS)
+
+        /// <summary>
+        /// 团组模块 - 出入境费用-移动端 - 基础数据源(Word明细类型、Excel明细类型、默认币种显示)
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostMobileDataSource(PortDtoBase dto)
+        {
+            string sql = string.Format("Select * From Sys_SetData Where IsDel = 0");
+            //SetDataInfoView
+            var dataSource = await _sqlSugar.SqlQueryable<Sys_SetData>(sql).ToListAsync();
+
+            var wordTypeData = dataSource.Where(it => it.STid == 72).ToList();  //三公费用-Word明细类型
+            List<SetDataInfoView> _WordTypeData = _mapper.Map<List<SetDataInfoView>>(wordTypeData);
+
+            var excelTypeData = dataSource.Where(it => it.STid == 73).ToList(); //三公费用-Excel明细类型
+            List<SetDataInfoView> _ExcelTypeData = _mapper.Map<List<SetDataInfoView>>(excelTypeData);
+
+            //默认币种显示
+           var _currencyInfos = _currencyInit;
+
+            var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
+            if (_currencyRate.Count > 0)
+            {
+                foreach (var item in _currencyInfos)
+                {
+                    var rateInfo = _currencyRate.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
+                    if (rateInfo != null)
+                    {
+                        decimal rate1 = Convert.ToDecimal(rateInfo.FSellPri) / 100.00M;
+                        rate1 *= 1.035M;
+
+                        item.Rate = Convert.ToDecimal(rate1.ToString("#0.00")) + 0.01M;
+                    }
+                }
+            }
+
+            return Ok(JsonView(true, "查询成功!", new
+            {
+                WordTypeData = _WordTypeData,
+                ExcelTypeData = _ExcelTypeData,
+                CurrencyInit = _currencyInfos
+            }));
+        }
+
+        /// <summary>
+        /// 团组模块 - 出入境费用-移动端 - 团组基础数据Data
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostMobileGroupData(PostEnterExitCostMobileGroupDataDto dto)
+        {
+            if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+
+            RefAsync<int> total = 0;
+
+            var data = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                .Where(x => x.IsDel == 0 && !string.IsNullOrEmpty(x.TeamName))
+                .WhereIF(!string.IsNullOrEmpty(dto.GroupName), x => x.TeamName.Contains(dto.GroupName))
+                .Select(x => new
+                {
+                    Id = x.Id,
+                    GroupName = x.TeamName
+                })
+                .OrderByDescending(x => x.Id)
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+            return Ok(JsonView(true, "查询成功!", data, total));
+        }
+
+        /// <summary>
+        /// 团组模块 - 出入境费用-移动端 - 币种基础数据Data
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostMobileCurrencyData(PostEnterExitCostMobileCurrencyDataDto dto)
+        {
+            if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+
+            RefAsync<int> total = 0;
+            var data = await _sqlSugar.Queryable<Sys_SetData>()
+                .Where(x => x.IsDel == 0 && x.STid == 66)
+                .WhereIF(!string.IsNullOrEmpty(dto.CurrencyName), x => x.Name.ToLower().Contains(dto.CurrencyName)  || x.Remark.Contains(dto.CurrencyName))
+                .Select(x => new
+                {
+                    id = x.Id,
+                    name = x.Name,
+                    remark = x.Remark,
+
+                })
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+            return Ok(JsonView(true, "查询成功!", data, total));
+        }
+
+        /// <summary>
+        /// 团组模块 - 出入境费用-移动端 - 实时汇率、签证费用、机票费用 Tips
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEnterExitCostMobileFeeTips(GetEnterExitCostMobileFeeTipsDto dto)
+        {
+            if (!_portTypeData.Contains(dto.PortType)) return Ok(JsonView(false, MsgTips.Port));
+            if (dto.GroupId < 1) return Ok(JsonView(false, MsgTips.DiId));
+            var tipsData = new List<int>() {1,2,3 };
+            if (!tipsData.Contains(dto.TipsType)) return Ok(JsonView(false, $"请传入有效的TipsType参数;1 实时汇率;2 签证费用;3 机票费用;"));
+
+            if (dto.TipsType == 1)
+            {
+                //默认币种显示
+                var _currencyInfos = _currencyInit;
+                var _currencyRate = await _juHeApi.PostItemRateAsync(_currencyInfos.Select(it => it.CurrencyCode).ToArray());
+                List<dynamic> reteInfos = new List<dynamic>();
+                if (_currencyRate.Count > 0)
+                {
+                    foreach (var item in _currencyInfos)
+                    {
+                        var rateInfo = _currencyRate.Where(it => it.Name.Equals(item.CurrencyName)).FirstOrDefault();
+                        if (rateInfo != null)
+                        {
+                            item.Rate = Convert.ToDecimal((Convert.ToDecimal(rateInfo.FSellPri == null ? 0.00M : rateInfo.FSellPri) / 100.00M).ToString("#0.0000"));
+
+                            decimal rate1 = item.Rate;
+                            rate1 *= 1.03M;
+
+                            decimal rate2 = Convert.ToDecimal(rate1.ToString("#0.00")) + 0.01M;
+
+                            reteInfos.Add(new
+                            {
+                                currCode = item.CurrencyCode,
+                                currName = item.CurrencyName,
+                                rate = rate2,
+                                lastUpdateDt = rateInfo.Date + " " + rateInfo.Time
+                            });
+                        }
+                    }
+                }
+
+                return Ok(JsonView(true, "查询成功!", reteInfos));
+            }
+            else if (dto.TipsType == 2)
+            {
+                var visaData = await _visaFeeInfoRep.EntryAndExitTips(dto.GroupId);
+                return Ok(JsonView(true, "查询成功!", visaData.Data));
+
+            }
+            else if (dto.TipsType == 3)
+            {
+                var airData = await _ticketBlackCodeRep.EntryAndExitTips(dto.GroupId);
+                return Ok(JsonView(true, "查询成功!", airData.Data));
+            }
+            return Ok(JsonView(false));
+        }
+
+
+        /// <summary>
+        /// 团组模块 - 出入境国家费用标准 List
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostNationalTravelFeeMobileData(PostNationalTravelFeeMobileDataDto dto)
+        {
+            Stopwatch sw = new Stopwatch();
+            sw.Start();
+
+            RefAsync<int> total = 0;
+
+            var data = await _sqlSugar.Queryable<Grp_NationalTravelFee>()
+                .LeftJoin<Sys_SetData>((ntf, sd) => ntf.Currency == sd.Id)
+                .LeftJoin<Sys_Users>((ntf, sd, u) => ntf.CreateUserId == u.Id)
+                .Where((ntf, sd, u) => ntf.IsDel == 0)
+                .WhereIF(!string.IsNullOrEmpty(dto.Search), (ntf, sd, u) => dto.Search.Contains(ntf.Country) || dto.Search.Contains(ntf.City))
+                .Select((ntf, sd, u) => new
+                {
+                    Id = ntf.Id,
+                    Area = $"{ntf.Country}-{ntf.City}",
+                    Currency = ntf.Currency,
+                    CurrencyCode = sd.Name,
+                    CurrencyName = sd.Remark,
+                    RoomCost = ntf.RoomCost,
+                    FoodCost = ntf.FoodCost,
+                    PublicCost = ntf.PublicCost,
+                    LastUpdateUserId = ntf.LastUpdateUserId,
+                    LastUpdateUserName = u.CnName,
+                    LastUpdateTime = ntf.LastUpdateTime,
+
+                })
+                .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+
+            sw.Stop();
+            return Ok(JsonView(true, "查询成功!耗时:" + sw.ElapsedMilliseconds + "ms", data,total));
+           
+        }
+
+
         #endregion
 
         #region 签证费用录入

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

@@ -404,4 +404,47 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public string? Remark { get; set; }
     }
+
+
+
+    #region Mobile Request Dto
+
+    public class PostEnterExitCostMobileGroupDataDto : DtoBase
+    {
+
+        public string GroupName { get; set; }
+    }
+
+    public class PostEnterExitCostMobileCurrencyDataDto : DtoBase
+    {
+        public string CurrencyName { get; set; }
+    }
+
+    public class GetEnterExitCostMobileFeeTipsDto : PortDtoBase {
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 提示数据类型
+        /// 1 实时汇率
+        /// 2 签证费用
+        /// 3 机票费用
+        /// </summary>
+        public int TipsType { get; set; }
+    }
+
+
+    public class PostNationalTravelFeeMobileDataDto :DtoBase
+    {
+        /// <summary>
+        /// 搜索条件
+        /// </summary>
+        public string Search { get; set; }
+
+    }
+
+    #endregion
 }

+ 1 - 0
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostView.cs

@@ -628,6 +628,7 @@ namespace OASystem.Domain.ViewModels.Groups
         public int Currency { get; set; }
 
         public decimal SubTotal { get; set; }
+        public string Remark { get; set; }
     }
 
     /// <summary>

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -107,6 +107,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                                                     Index = x.Index,
                                                                     SetDataId = x.SetDataId,
                                                                     SubTotal = x.SubTotal,
+                                                                    Remark = x.Remark,
                                                                 })
                                                                 .ToList();
 

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaFeeInfoRepository.cs

@@ -323,6 +323,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
                 }
+                if (remark1.Length > 0) remark1 = remark1.Substring(0, remark1.Length - 1);
 
                 if (_otherFee > 0) remark1 += $@"其他费用:{_otherFee.ToString("#0.00")}元";