Browse Source

团组汇率

leiy 1 year ago
parent
commit
64cd53fe75
21 changed files with 993 additions and 70 deletions
  1. 87 6
      OASystem/OASystem.Api/Controllers/FinancialController.cs
  2. 2 0
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  3. 160 9
      OASystem/OASystem.Api/OAMethodLib/GroupCommission.cs
  4. 23 8
      OASystem/OASystem.Domain/Dtos/Financial/GroupCommissionDto.cs
  5. 27 0
      OASystem/OASystem.Domain/Dtos/Financial/TeamRateDto.cs
  6. 12 0
      OASystem/OASystem.Domain/Entities/Financial/FinancialCommission.cs
  7. 20 20
      OASystem/OASystem.Domain/Entities/Groups/Grp_TeamRate.cs
  8. 56 0
      OASystem/OASystem.Domain/ViewModels/Financial/Fin_GroupCommissionView.cs
  9. 69 0
      OASystem/OASystem.Domain/ViewModels/Financial/TeamRateView.cs
  10. 18 15
      OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs
  11. 4 0
      OASystem/OASystem.Domain/ViewModels/Groups/Grp_CreditCardPaymentView.cs
  12. 72 1
      OASystem/OASystem.Infrastructure/Repositories/Financial/CreditCardPaymentRepository.cs
  13. 25 3
      OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs
  14. 23 2
      OASystem/OASystem.Infrastructure/Repositories/Financial/ProceedsReceivedRepository.cs
  15. 1 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs
  16. 1 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs
  17. 19 6
      OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs
  18. 1 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs
  19. 21 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/TaskAssignmentRepository.cs
  20. 351 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/TeamRateRepository.cs
  21. 1 0
      OASystem/OASystem.Infrastructure/Repositories/System/SetDataRepository.cs

+ 87 - 6
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -8,6 +8,7 @@ using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Financial;
+using OASystem.Infrastructure.Repositories.Groups;
 using System.Data;
 
 namespace OASystem.API.Controllers
@@ -24,17 +25,19 @@ namespace OASystem.API.Controllers
         private readonly SqlSugarClient _sqlSugar;
         private readonly SetDataTypeRepository _setDataTypeRep;
         private readonly DailyFeePaymentRepository _daiRep;    //日付申请仓库
+        private readonly TeamRateRepository _teamRateRep;    //团组汇率仓库
 
         /// <summary>
         /// 初始化
         /// </summary>
-        public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep) 
+        public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep, TeamRateRepository teamRateRep) 
         {
-            this._mapper = mapper;
-            this._config = configuration;
-            this._daiRep = daiRep;
-            this._sqlSugar = sqlSugar;
-            this._setDataTypeRep = setDataTypeRep;
+            _mapper = mapper;
+            _config = configuration;
+            _daiRep = daiRep;
+            _sqlSugar = sqlSugar;
+            _setDataTypeRep = setDataTypeRep;
+            _teamRateRep = teamRateRep;
         }
 
         #region 日付申请
@@ -263,5 +266,83 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(data.Data));
         }
         #endregion
+
+        #region 团组汇率
+
+        /// <summary>
+        /// 团组汇率 Select数据源(团组列,汇率列)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GetGroupRateDataSources(TeamRateDto dto)
+        {
+            try
+            {
+                Result teamRateData = await _teamRateRep.GetGroupRateDataSource(dto);
+                if (teamRateData.Code != 0)
+                {
+                    return Ok(JsonView(false, teamRateData.Msg));
+                }
+                return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 团组汇率 changge
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> ChangeGroupRateInfo()
+        {
+            try
+            {
+                Result teamRateData = await _teamRateRep.GetGroupRateChangeData();
+                if (teamRateData.Code != 0)
+                {
+                    return Ok(JsonView(false, teamRateData.Msg));
+                }
+                return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 团组汇率 Select汇率详情
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GetGroupRateInfo(TeamRateInfoDto dto)
+        {
+            try
+            {
+                Result teamRateData = await _teamRateRep.GetGroupRateInfoByDiid(dto);
+                if (teamRateData.Code != 0)
+                {
+                    return Ok(JsonView(false, teamRateData.Msg));
+                }
+                return Ok(JsonView(true, teamRateData.Msg, teamRateData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        #endregion
     }
 }

+ 2 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -462,6 +462,8 @@ namespace OASystem.API.Controllers
         }
         #endregion
 
+        
+
         #region 团组费用审核
 
         /// <summary>

+ 160 - 9
OASystem/OASystem.Api/OAMethodLib/GroupCommission.cs

@@ -1,6 +1,9 @@
 using Microsoft.AspNetCore.Components.Web;
+using MySqlX.XDevAPI.Relational;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Financial;
@@ -32,8 +35,7 @@ namespace OASystem.API.OAMethodLib
         {
             Result result = new Result() { Code = -1 };
 
-            GroupListPageDto groupPageDto = new GroupListPageDto() { PortType = dto.PortType, PageIndex = dto.PageIndex, PageSize = dto.PageSize };
-            var groupResult = await _dirRep.GetGroupPageList(groupPageDto);
+            var groupResult = await _dirRep.GetGroupPageList(dto);
             if (groupResult.Code != 0)
             {
                 result.Code = groupResult.Code;
@@ -41,26 +43,33 @@ namespace OASystem.API.OAMethodLib
                 return result;
             }
             if (groupResult.Data == null) { }
-            //List<DelegationListView> groupData = groupResult.Data;
-            result.Data = groupResult.Data;
 
+           // ListViewBase<DelegationPageListView> groupData = JsonConvert.DeserializeObject<ListViewBase<DelegationPageListView>>(groupResult.Data);
+            result.Data = groupResult.Data;
+            List<int> diids = new List<int>();
+            foreach (var item in result.Data.DataList)
+            {
+                diids.Add(item.Id);
+            }
+            await GetCommissionByDiids(diids.ToArray());
             return result;
 
         }
 
-
-
         /// <summary>
         /// 根据团组Id计算 团组利润
         /// </summary>
         /// <param name="DiId">团组Id</param>
-        public static async void GetCommission(int DiId)
+        public static async Task<Fin_GroupProfitInfoView> GetCommissionByDiid(int DiId)
         {
+
+            int[] ints = new int[DiId];
+
             decimal sumFr = 0.00M,  //团组 应收款项
                     sumPr = 0.00M,  //团组 已收款项
                     refund = 0.00M, //团组 退款和其他费用
-                    cost = 0.00M;   //团组成本费用
-            if (DiId == 0) return;
+                    cost = 0.00M;   //团组 成本费用
+            if (DiId == 0) return new Fin_GroupProfitInfoView();
 
             #region 计算各项费用
 
@@ -105,10 +114,152 @@ namespace OASystem.API.OAMethodLib
                 {
                     if (item.PayThenMoney != 0M)
                         cost += item.PayThenMoney * item.DayRate;
+                    else
+                        cost += item.PayMoney * (item.PayPercentage * 0.01M) * item.DayRate;
 
                 }
+
+                //实际的团组成本需除去退款 
+                cost -= refund;
             }
             #endregion
+
+            //团组净利润=已收金额-成本
+            decimal groupProfit = sumPr - cost;
+
+            //团组尾款=应收款项-已收款项
+            decimal groupRatainage = sumPr - sumPr;
+
+            return new Fin_GroupProfitInfoView() { ReceivableFund = sumFr, ReceivedFund = sumPr,Refund = refund,Cost=cost,RetainedProfits=groupProfit,FinalPayment = groupRatainage };
+        }
+
+        /// <summary>
+        /// 根据团组 Ids 计算 团组利润
+        /// </summary>
+        /// <param name="DiIds"></param>
+        /// <returns></returns>
+        public static async Task<List<Fin_GroupProfitInfoView>> GetCommissionByDiids(int[] DiIds)
+        {
+           
+            if (DiIds.Length <= 0) return new  List<Fin_GroupProfitInfoView>();
+
+            List<Fin_GroupProfitInfoView> fin_GroupProfitInfoViews = new List<Fin_GroupProfitInfoView>();
+
+            #region string
+            //string _diidsStr = string.Empty;
+            //#region 处理Diid
+            //StringBuilder diidSb = new StringBuilder();
+            //for (int i = 0; i < DiIds.Length; i++)
+            //{
+            //    if (i == DiIds.Length - 1)
+            //    {
+            //        diidSb.Append(DiIds[i]);
+            //    }
+            //    else
+            //    {
+            //        diidSb.Append(DiIds[i]).Append(",");
+            //    }
+            //}
+            //_diidsStr = diidSb.ToString().Trim();
+            //#endregion
+            #endregion
+
+
+
+            #region 计算各项费用
+
+            //应收款项
+            Result frData = await _frRep.GetGroupReceivablesByDiids(DiIds);
+
+            //已收款项
+            Result prData = await _prRep.GetGroupReceivedByDiids(DiIds);
+
+            //收款退还费用
+            Result ccpData = await _ccpRep.GetGroupRefundByDiids(DiIds, true);
+
+            //团组与非团组产生的成本费用数据
+            Result ccpData1 = await _ccpRep.GetGroupPaymentInfoByDiids(DiIds, true);
+
+
+            foreach (int item in DiIds)
+            {
+                decimal sumFr = 0.00M,  //团组 应收款项
+                   sumPr = 0.00M,        //团组 已收款项
+                   refund = 0.00M,       //团组 退款和其他费用
+                   cost = 0.00M;         //团组 成本费用
+
+                //团组 应收款项
+                if (frData.Code == 0 && frData.Data != null)
+                {
+                    List<Fin_ForeignReceivables> _frData = JsonConvert.DeserializeObject<List<Fin_ForeignReceivables>>
+                        (JsonConvert.SerializeObject(frData.Data));
+                    _frData = _frData.Where(fr => item == fr.Diid).ToList();
+                    foreach (Fin_ForeignReceivables itemFr in _frData)
+                    {
+                        sumPr += itemFr.Price;
+                    }
+                }
+
+                //团组 已收款项
+                if (prData.Code == 0 && prData.Data != null)
+                {
+                    List<Fin_ProceedsReceived> _prData = JsonConvert.DeserializeObject<List<Fin_ProceedsReceived>>
+                        (JsonConvert.SerializeObject(prData.Data));
+                    _prData = _prData.Where(pr => item == pr.Diid).ToList();
+                    foreach (var itemPr in _prData)
+                    {
+                        sumFr += itemPr.Price;
+                    }
+                }
+
+                //团组 退款和其他费用
+                if (ccpData.Code == 0 && ccpData.Data != null)
+                {
+                    List<GroupRefundView> _ccpData = JsonConvert.DeserializeObject<List<GroupRefundView>>
+                        (JsonConvert.SerializeObject(ccpData.Data));
+                    _ccpData = _ccpData.Where(ccp => item == ccp.DIId).ToList();
+                    foreach (var itemCcp in _ccpData)
+                    {
+                        refund += itemCcp.Price;
+                    }
+                }
+
+                //实际的团组类型已收金额需除去退款 
+                sumPr = sumPr - refund;
+
+
+                if (ccpData1.Code == 0 && ccpData1.Data != null)
+                {
+                    List<Grp_CreditCardPayment> _ccpData1 = JsonConvert.DeserializeObject<List<Grp_CreditCardPayment>>
+                        (JsonConvert.SerializeObject(ccpData1.Data));
+                    _ccpData1 = _ccpData1.Where(ccp => item == ccp.DIId).ToList();
+                    foreach (Grp_CreditCardPayment itemCcp in _ccpData1)
+                    {
+                        if (itemCcp.PayThenMoney != 0M)
+                            cost += itemCcp.PayThenMoney * itemCcp.DayRate;
+                        else
+                            cost += itemCcp.PayMoney * (itemCcp.PayPercentage * 0.01M) * itemCcp.DayRate;
+
+                    }
+
+                    //实际的团组成本需除去退款 
+                    cost -= refund;
+                }
+                #endregion
+
+                decimal groupProfit = 0.00M,    //团组净利润=已收金额-成本
+                    groupRatainage = 0.00M;     //团组尾款=应收款项-已收款项
+
+
+                groupProfit = sumPr - cost;
+                groupRatainage = sumPr - sumPr;
+
+                fin_GroupProfitInfoViews.Add(new Fin_GroupProfitInfoView() { Diid = item, ReceivableFund = sumFr, ReceivedFund = sumPr, Refund = refund, Cost = cost, RetainedProfits = groupProfit, FinalPayment = groupRatainage });
+            }
+
+
+            
+            return fin_GroupProfitInfoViews;
         }
     }
 }

+ 23 - 8
OASystem/OASystem.Domain/Dtos/Financial/GroupCommissionDto.cs

@@ -7,17 +7,32 @@ using System.Threading.Tasks;
 namespace OASystem.Domain.Dtos.Financial
 {
     /// <summary>
-    /// 团组提成Dto
+    /// 团组提成 分页 Dto
     /// </summary>
     public class GroupCommissionDto : DtoBase
     {
-    }
+        /// <summary>
+        /// 出访开始时间
+        /// eg:2023-01-01
+        /// </summary>
+        public string? VisitStartTime  { get; set; }
 
-    /// <summary>
-    /// 团组提成 分页 Dto
-    /// </summary>
-    public class CommissionPageDto
-    {
-        
+        /// <summary>
+        /// 出访结束时间
+        /// eg:2023-12-31
+        /// </summary>
+        public string? VisitEndTime { get; set; }
+
+        /// <summary>
+        /// 员工Id
+        /// eg:-1 所有人 or UserId
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// 团组名称
+        /// </summary>
+        public string? GroupName { get; set; }
     }
+
 }

+ 27 - 0
OASystem/OASystem.Domain/Dtos/Financial/TeamRateDto.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Financial
+{
+
+    /// <summary>
+    /// 团组汇率 Dto
+    /// </summary>
+    public class TeamRateDto : DtoBase
+    {
+    }
+
+    /// <summary>
+    /// 团组汇率信息 Dto
+    /// </summary>
+    public class TeamRateInfoDto : DtoBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int Diid { get; set; }
+    }
+}

+ 12 - 0
OASystem/OASystem.Domain/Entities/Financial/FinancialCommission.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.Financial
+{
+    internal class FinancialCommission
+    {
+    }
+}

+ 20 - 20
OASystem/OASystem.Domain/Entities/Groups/Grp_TeamRate.cs

@@ -4,18 +4,18 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace OASystem.Domain.Entities.Groups
+namespace OASystem.Domain.Entities.Financial
 {
     /// <summary>
     /// 团组汇率表
     /// </summary>
     [SugarTable("Grp_TeamRate")]
-    public class Grp_TeamRate: EntityBase
+    public class Grp_TeamRate : EntityBase
     {
         /// <summary>
         /// 团组id
         /// </summary>
-        [SugarColumn(IsNullable =true,ColumnDataType ="int")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int DiId { get; set; }
 
         /// <summary>
@@ -32,7 +32,7 @@ namespace OASystem.Domain.Entities.Groups
         /// <summary>
         /// 其他汇率金额
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
         public decimal OtherPrice { get; set; }
 
         /// <summary>
@@ -65,82 +65,82 @@ namespace OASystem.Domain.Entities.Groups
         /// 新加坡币汇率
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateS { get; set; }                
+        public decimal RateS { get; set; }
         /// <summary>                                    
         /// 澳大利亚元汇率                               
         /// </summary>                                   
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateA { get; set; }                 
+        public decimal RateA { get; set; }
         /// <summary>                                     
         /// 加拿大元汇率                                  
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateC { get; set; }                 
+        public decimal RateC { get; set; }
         /// <summary>                                     
         /// 泰铢汇率                                      
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateT { get; set; }                
+        public decimal RateT { get; set; }
         /// <summary>                                    
         /// 波兰汇率                                     
         /// </summary>                                   
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateBL { get; set; }                
+        public decimal RateBL { get; set; }
         /// <summary>                                     
         /// 韩币                                          
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateHB { get; set; }                
+        public decimal RateHB { get; set; }
         /// <summary>                                     
         /// 斐济币汇率                                    
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateFJD { get; set; }               
+        public decimal RateFJD { get; set; }
         /// <summary>                                     
         /// 土耳其币汇率                                  
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateTL { get; set; }                
+        public decimal RateTL { get; set; }
         /// <summary>                                     
         /// 卢比汇率                                      
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateRP { get; set; }               
+        public decimal RateRP { get; set; }
         /// <summary>                                    
         /// 菲律宾汇率                                   
         /// </summary>                                   
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RatePeso { get; set; }              
+        public decimal RatePeso { get; set; }
         /// <summary>                                     
         /// 马来西亚汇率                                  
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateMYR { get; set; }               
+        public decimal RateMYR { get; set; }
         /// <summary>                                     
         /// 捷克币汇率                                    
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateCZK { get; set; }               
+        public decimal RateCZK { get; set; }
         /// <summary>                                     
         /// 墨西哥币汇率                                  
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateMXN { get; set; }              
+        public decimal RateMXN { get; set; }
         /// <summary>                                    
         /// 澳门元                                       
         /// </summary>                                   
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateMOP { get; set; }               
+        public decimal RateMOP { get; set; }
         /// <summary>                                     
         /// 阿根廷比索                                    
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateARS { get; set; }               
+        public decimal RateARS { get; set; }
         /// <summary>                                     
         /// 匈牙利货币                                    
         /// </summary>                                    
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,4)")]
-        public decimal RateHUF { get; set; }               
+        public decimal RateHUF { get; set; }
         /// <summary>                                     
         /// 俄罗斯卢布                                    
         /// </summary>                                    

+ 56 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_GroupCommissionView.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Financial
+{
+    /// <summary>
+    /// 财务 - 团组提成 View
+    /// </summary>
+    public class Fin_GroupCommissionView
+    {
+    }
+
+    /// <summary>
+    /// 财务 - 团组利润 View
+    /// </summary>
+    public class Fin_GroupProfitInfoView
+    {
+        /// <summary>
+        /// 团组Diid
+        /// </summary>
+        public int Diid { get; set; }
+
+        /// <summary>
+        /// 团组应收款项
+        /// </summary>
+        public decimal ReceivableFund { get; set; }
+
+        /// <summary>
+        /// 团组已收款项
+        /// </summary>
+        public decimal ReceivedFund { get; set; }
+
+        /// <summary>
+        /// 团组退款
+        /// </summary>
+        public decimal Refund { get; set; }
+
+        /// <summary>
+        /// 团组成本费用
+        /// </summary>
+        public decimal Cost { get; set; }
+
+        /// <summary>
+        /// 团组净利润
+        /// </summary>
+        public decimal RetainedProfits { get; set; }
+
+        /// <summary>
+        /// 团组尾款
+        /// </summary>
+        public decimal FinalPayment { get; set; }
+    }
+}

+ 69 - 0
OASystem/OASystem.Domain/ViewModels/Financial/TeamRateView.cs

@@ -0,0 +1,69 @@
+using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.Entities.Groups;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Financial
+{
+    /// <summary>
+    /// 团组汇率 View 
+    /// </summary>
+    public class TeamRateView : Grp_TeamRate
+    {
+    }
+
+    /// <summary>
+    /// 团组汇率info
+    /// </summary>
+    public class TeamRateInfoView : Grp_TeamRate
+    {
+        /// <summary>
+        /// 权限模块名称
+        /// </summary>
+        public string? Name { get; set; }
+    }
+
+    #region 团组汇率 信息
+    public class TeamRateModelView
+    {
+        /// <summary>
+        /// 汇率模块 Id
+        /// </summary>
+        public int CTableId { get; set; }
+
+        /// <summary>
+        /// 汇率模块
+        /// </summary>
+        public string? CTableName { get; set; }
+
+        /// <summary>
+        /// 汇率 List
+        /// </summary>
+        public List<TeamRateDescView>? TeamRates { get; set; }
+    }
+
+    public class TeamRateDescView
+    {
+        /// <summary>
+        /// 币种名称
+        /// </summary>
+        public string? CurrencyName { get; set; }
+
+        /// <summary>
+        /// 币种Code
+        /// </summary>
+        public string? CurrencyCode { get; set; }
+
+        /// <summary>
+        /// 汇率 
+        /// 保存四位小数
+        /// </summary>
+        public decimal Rate { get; set; }
+
+    }
+    #endregion
+
+}

+ 18 - 15
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -30,9 +30,12 @@ namespace OASystem.Domain.ViewModels.Groups
         /// <summary>
         /// 销售报价号
         /// </summary>
-        public string SalesQuoteNo { get; set; }
-
+        public string? SalesQuoteNo { get; set; }
 
+        /// <summary>
+        /// 团号
+        /// </summary>
+        public string? TourCode { get; set; }
         /// <summary>
         /// 接团人ID
         /// </summary>
@@ -51,22 +54,22 @@ namespace OASystem.Domain.ViewModels.Groups
         /// <summary>
         /// 团组名称
         /// </summary>
-        public string TeamName { get; set; }
+        public string? TeamName { get; set; }
 
         /// <summary>
         /// 客户名称
         /// </summary>
-        public string ClientName { get; set; }
+        public string? ClientName { get; set; }
 
         /// <summary>
         /// 客户所属公司
         /// </summary>
-        public string ClientUnit { get; set; }
+        public string? ClientUnit { get; set; }
 
         /// <summary>
         /// 出访国家
         /// </summary>
-        public string VisitCountry { get; set; }
+        public string? VisitCountry { get; set; }
 
         /// <summary>
         /// 出团日期
@@ -100,44 +103,44 @@ namespace OASystem.Domain.ViewModels.Groups
         /// <summary>
         /// 出访目的
         /// </summary>
-        public string VisitPurpose { get; set; }
+        public string? VisitPurpose { get; set; }
 
         /// <summary>
         /// 特俗需求
         /// </summary>
-        public string SpecialNeeds { get; set; }
+        public string? SpecialNeeds { get; set; }
 
         /// <summary>
         /// 其他需求
         /// </summary>
-        public string OtherNeeds { get; set; }
+        public string? OtherNeeds { get; set; }
 
         /// <summary>
         /// 出国任务审批部门名称
         /// </summary>
-        public string CGRWSPBMMC { get; set; }
+        public string? CGRWSPBMMC { get; set; }
         /// <summary>
         /// 出国任务审批文号
         /// </summary>
-        public string CGRWSPWH { get; set; }
+        public string? CGRWSPWH { get; set; }
         /// <summary>
         /// 政治审查部门名称
         /// </summary>
-        public string ZZSCBMMC { get; set; }
+        public string? ZZSCBMMC { get; set; }
         /// <summary>
         /// 政治审查部门审批文号
         /// </summary>
-        public string ZZSCSPWH { get; set; }
+        public string? ZZSCSPWH { get; set; }
 
         /// <summary>
         /// 备注
         /// </summary>
-        public string Remark { get; set; }
+        public string? Remark { get; set; }
 
         /// <summary>
         /// 手机号
         /// </summary>
-        public string TellPhone { get; set; }
+        public string? TellPhone { get; set; }
     }
 
     /// <summary>

+ 4 - 0
OASystem/OASystem.Domain/ViewModels/Groups/Grp_CreditCardPaymentView.cs

@@ -15,6 +15,10 @@ namespace OASystem.Domain.ViewModels.Groups
     /// </summary>
     public class GroupRefundView
     {
+        /// <summary>
+        /// 团组Diid
+        /// </summary>
+        public int DIId { get; set; }
         /// <summary>
         /// 创建用户Id 
         /// </summary>

+ 72 - 1
OASystem/OASystem.Infrastructure/Repositories/Financial/CreditCardPaymentRepository.cs

@@ -50,6 +50,30 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
         }
 
+        /// <summary>
+        /// 根据diid 数组 查询团组付款信息
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <param name="isPay">false 未支付 true 已支付</param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupPaymentInfoByDiids(int[] diids, bool isPay)
+        {
+            Result result = new() { Code = -2 };
+
+            int _isPay = 0;
+            if (isPay) { _isPay = 1; }
+
+            var groupReceivablesList = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
+                .Where(ccp => ccp.IsDel == 0 && diids.Contains(ccp.DIId) && ccp.IsPay == _isPay) .ToListAsync();
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = groupReceivablesList;
+
+            return result;
+
+        }
+
         /// <summary>
         /// 团组 其他款项/退款
         /// </summary>
@@ -63,7 +87,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
             int _isPay = 0;
             if (isPay) { _isPay = 1; }
 
-            string sql = string.Format(@"Select ccp.CreateUserId,ccp.AuditGMDate,sd1.name As PayType,ccp.OrbitalPrivateTransfer,ccp.PayDid,
+            string sql = string.Format(@"Select ccp.DIId,ccp.CreateUserId,ccp.AuditGMDate,sd1.name As PayType,ccp.OrbitalPrivateTransfer,ccp.PayDid,
                                                             ccp.payee,ccp.IsPay,gdp.CreateTime,gdp.PriceName,gdp.Price,sd.[Name] Currency,
                                                             ccp.PayMoney As Spread,ccp.DayRate,gdp.Remark From Fin_OtherPrice gdp 
                                         join Grp_CreditCardPayment ccp On ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id 
@@ -79,5 +103,52 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
             return result;
         }
+
+        /// <summary>
+        /// 团组 根据diid 数组 查询 其他款项/退款
+        /// </summary>
+        /// <param name="diid">团组Id</param>
+        /// <param name="isPay"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupRefundByDiids(int[] diids, bool isPay)
+        {
+            Result result = new() { Code = -2 };
+
+            int _isPay = 0;
+            if (isPay) { _isPay = 1; }
+
+            string _diidsStr = string.Empty;
+            #region 处理Diid
+            StringBuilder diidSb = new StringBuilder();
+            for (int i = 0; i < diids.Length; i++)
+            {
+                if (i == diids.Length - 1)
+                {
+                    diidSb.Append(diids[i]);
+                }
+                else
+                {
+                    diidSb.Append(diids[i]).Append(",");
+                }
+            }
+            _diidsStr = diidSb.ToString().Trim();
+            #endregion
+
+            string sql = string.Format(@"Select ccp.DIId,ccp.CreateUserId,ccp.AuditGMDate,sd1.name As PayType,ccp.OrbitalPrivateTransfer,ccp.PayDid,
+                                                            ccp.payee,ccp.IsPay,gdp.CreateTime,gdp.PriceName,gdp.Price,sd.[Name] Currency,
+                                                            ccp.PayMoney As Spread,ccp.DayRate,gdp.Remark From Fin_OtherPrice gdp 
+                                        join Grp_CreditCardPayment ccp On ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id 
+                                        join Sys_SetData sd On sd.Id =gdp.CurrencyId 
+                                        join Sys_SetData sd1 On sd1.id=ccp.PayDid 
+                                        Where ccp.isDel=0 And gdp.IsDel = 0 And ccp.DIId In ({0}) And ccp.CTable=285 and ccp.IsPay = {1} ", _diidsStr, _isPay);
+
+            var groupRefundList = await _sqlSugar.SqlQueryable<GroupRefundView>(sql).ToListAsync();
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = groupRefundList;
+
+            return result;
+        }
     }
 }

+ 25 - 3
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -26,7 +26,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 根据diid查询团组已收收款项
+        /// 根据diid查询团组收款项
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
@@ -34,9 +34,31 @@ namespace OASystem.Infrastructure.Repositories.Financial
         {
             Result result = new() { Code = -2 };
 
-            string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diid);
+            string sql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", diid);
 
-            var groupReceivedList = await _sqlSugar.SqlQueryable<Fin_ProceedsReceivedView>(sql).ToListAsync();
+            var groupReceivedList = await _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql).ToListAsync();
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = groupReceivedList;
+
+            return result;
+
+        }
+
+        /// <summary>
+        /// 根据diid 数组 查询团组应收款项
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupReceivablesByDiids(int[] diids)
+        {
+            Result result = new() { Code = -2 };
+
+            //string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diids);
+
+            var groupReceivedList = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
+                .Where(pr =>  pr.IsDel == 0 && diids.Contains(pr.Diid)).ToListAsync();
 
             result.Code = 0;
             result.Msg = "查询成功!";

+ 23 - 2
OASystem/OASystem.Infrastructure/Repositories/Financial/ProceedsReceivedRepository.cs

@@ -30,7 +30,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 根据diid查询团组收款项
+        /// 根据diid查询团组收款项
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
@@ -38,7 +38,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         {
             Result result = new() { Code = -2 };
 
-            string sql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", diid);
+            string sql = string.Format(@"Select * From ProceedsReceived Where IsDel=0 And Diid={0}", diid);
 
             var groupReceivablesList = await _sqlSugar.SqlQueryable<Fin_ProceedsReceivedView>(sql).ToListAsync();
 
@@ -49,5 +49,26 @@ namespace OASystem.Infrastructure.Repositories.Financial
             return result;
 
         }
+
+        /// <summary>
+        /// 根据diid 数组 查询团组已收款项
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupReceivedByDiids(int[] diids)
+        {
+            Result result = new() { Code = -2 };
+
+
+            var groupReceivablesList = await _sqlSugar.Queryable<Fin_ProceedsReceived>()
+                .Where(fr => fr.IsDel == 0 && diids.Contains(fr.Diid)) .ToListAsync();
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = groupReceivablesList;
+
+            return result;
+
+        }
     }
 }

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

@@ -28,6 +28,7 @@ using System.Collections;
 using Aspose.Words.Tables;
 using Aspose.Words;
 using System.Reflection;
+using OASystem.Domain.Entities.Financial;
 
 namespace OASystem.Infrastructure.Repositories.Groups
 {

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

@@ -1,6 +1,7 @@
 using AutoMapper;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Groups;

+ 19 - 6
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -28,13 +28,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
     {
         private readonly SetDataRepository _setDataRepository;
         private readonly UsersRepository _usersRepository;
+        private readonly TaskAssignmentRepository _taskAssignmentRep;
         //public readonly Logs _logs;
 
-        public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository)
+        public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository, TaskAssignmentRepository taskAssignmentRep)
             : base(sqlSugar)
         {
-            this._setDataRepository = setDataRepository;
-            this._usersRepository = usersRepository;
+            _setDataRepository = setDataRepository;
+            _usersRepository = usersRepository;
+            _taskAssignmentRep = taskAssignmentRep;
         }
 
         #region 团组
@@ -44,7 +46,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        public async Task<Result> GetGroupPageList(GroupListPageDto dto)
+        public async Task<Result> GetGroupPageList(GroupCommissionDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
 
@@ -58,6 +60,17 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 int startIndex = (dto.PageIndex - 1) * dto.PageSize + 1;
                 int endIndex = startIndex + dto.PageSize - 1;
 
+                int taskUserId = -1;
+                string taskGroupIds = string.Empty;
+                #region 处理用户团组操作权限
+                if (dto.UserId != -1)
+                {
+
+                }
+
+
+                #endregion
+
                 string sql = string.Format(@"Select * From(Select row_number() over (order by gdi.Id Desc) as RowNumber,
 		                                        gdi.Id,SalesQuoteNo,TourCode,ssd.Id TeamTypeId, ssd.Name TeamType,ssd1.Id TeamLevId,
 		                                        ssd1.Name TeamLev,TeamName,ClientName,ClientUnit,VisitDate,VisitDays,VisitPNumber,
@@ -77,7 +90,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 List<DelegationPageListView> _DeleInfoList = await _sqlSugar.SqlQueryable<DelegationPageListView>(sql).ToListAsync();
 
-                DelegationPageCountView _DeleCount = await _sqlSugar.SqlQueryable<DelegationPageCountView>(sql).FirstAsync();
+                DelegationPageCountView _DeleCount = await _sqlSugar.SqlQueryable<DelegationPageCountView>(sqlCount).FirstAsync();
 
                 int count = _DeleCount.Count;
 
@@ -148,7 +161,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             if (dto.PortType == 1 || dto.PortType == 2) //web
             {
-                string sql = string.Format(@"Select Id,SalesQuoteNo,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName,
+                string sql = string.Format(@"Select Id,SalesQuoteNo,TourCode,JietuanOperator,TeamLevSId,TeamDid,TeamName,ClientName,
 	                                                ClientUnit,VisitCountry,VisitDate,VisitDays,VisitPNumber,TontractTime,
 	                                                PayDay,PaymentMoney,VisitPurpose,SpecialNeeds,OtherNeeds,CGRWSPBMMC,CGRWSPWH,
 	                                                ZZSCBMMC,ZZSCSPWH,Remark,TellPhone

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

@@ -3,6 +3,7 @@ using MathNet.Numerics.Statistics.Mcmc;
 using NPOI.SS.Formula.Functions;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Groups;

+ 21 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/TaskAssignmentRepository.cs

@@ -225,5 +225,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
             }
             return result;
         }
+
+        /// <summary>
+        /// 查询配置任务
+        /// 条件:根据 任务用户Id查询
+        /// </summary>
+        /// <param name="UserTaskId"></param>
+        /// <returns></returns>
+        public async Task<Result> TaskAssignmenQueryByUserTaskId(int UserTaskId)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+
+
+            var data = await _sqlSugar.Queryable<Grp_GroupsTaskAssignment>()
+                .Where(gta => gta.IsDel == 0 && gta.IsEnable == 1 && gta.CreateUserId == UserTaskId)
+                .ToListAsync();
+
+
+            result = new Result() { Code = 0, Msg = "查询成功!" };
+
+            return result;
+        }
     }
 }

+ 351 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/TeamRateRepository.cs

@@ -0,0 +1,351 @@
+using Newtonsoft.Json;
+using OASystem.Domain;
+using OASystem.Domain.Dtos.Financial;
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.ViewModels.Financial;
+using OASystem.Infrastructure.Repositories.System;
+using Serilog;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.Groups
+{
+    /// <summary>
+    /// 团组汇率 仓库
+    /// </summary>
+    public class TeamRateRepository : BaseRepository<Grp_TeamRate, TeamRateView>
+    {
+        private readonly SetDataRepository _setDataRep;
+        private readonly DelegationInfoRepository _deleInfoRep;
+
+        public TeamRateRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRep, DelegationInfoRepository deleInfoRep)
+            : base(sqlSugar)
+        {
+            _setDataRep = setDataRep;
+            _deleInfoRep = deleInfoRep;
+        }
+
+        /// <summary>
+        /// 团组汇率 Rep
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupRateDataSource(TeamRateDto dto)
+        {
+
+            Result result = new() { Code = -2 };
+
+            GroupNameDto groupNameDto = new GroupNameDto() { PortType = dto.PortType, PageIndex = dto.PageIndex, PageSize = dto.PageSize };
+            var groups = await _deleInfoRep.GetGroupNameList(groupNameDto);
+
+            var teamRateDatas = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); // STid=66 全球币种
+
+            dynamic _data = null;
+
+            if (dto.PortType == 1)
+            {
+                _data = new { GroupData = groups.Data, TeamRateData = teamRateDatas.Data };
+
+            }
+            else if (dto.PortType == 2)
+            {
+
+            }
+            else if (dto.PortType == 3)
+            {
+
+            }
+
+
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = _data;
+
+            return result;
+
+        }
+
+
+        /// <summary>
+        /// 团组汇率 更改数据
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupRateChangeData()
+        {
+
+            Result result = new() { Code = -2 };
+
+           
+
+            string teamRateInfoSql = string.Format(@"Select * From Grp_TeamRate tr Where tr.IsDel = 0");
+
+            var teamRateInfo = await _sqlSugar.SqlQueryable<Grp_TeamRate>(teamRateInfoSql).ToListAsync();
+
+            dynamic _data = null;
+
+           
+            #region 团组汇率 - 详细汇率信息
+
+            List<SetDataInfoView> otherCurrencyData1 = new List<SetDataInfoView>();
+            var otherCurrencyData = await _setDataRep.GetSetDataBySTId(_setDataRep, 13);
+            if (otherCurrencyData.Code == 0 && otherCurrencyData.Data != null)
+            {
+                string otherCurrencyStr = JsonConvert.SerializeObject(otherCurrencyData.Data);
+                otherCurrencyData1 = JsonConvert.DeserializeObject<List<SetDataInfoView>>(otherCurrencyStr);
+                //var otherCurrency = otherCurrencyData1
+            }
+
+            foreach (Grp_TeamRate item1 in teamRateInfo)
+            {
+
+                string rateStr = string.Empty;
+                if (item1.RateU != 0) rateStr += "美元(USD):" + item1.RateU + "|";
+                if (item1.RateE != 0) rateStr += "欧元(EUR):" + item1.RateE + "|";
+
+                if (item1.RateJ != 0)
+                    rateStr += "日元(JPY):" + item1.RateJ + "|";
+                if (item1.RateH != 0)
+                    rateStr += "港币(HKD):" + item1.RateH + "|";
+                if (item1.RateN != 0)
+                    rateStr += "新西兰元(NZD):" + item1.RateN + "|";
+                if (item1.RateS != 0)
+                    rateStr += "新加坡币(SGD):" + item1.RateS + "|";
+                if (item1.RateA != 0)
+                    rateStr += "澳大利亚元(AUD):" + item1.RateA + "|";
+                if (item1.RateC != 0)
+                    rateStr += "加拿大元(CAD):" + item1.RateC + "|";
+                if (item1.RateT != 0)
+                    rateStr += "泰国铢(THB):" + item1.RateT + "|";
+                if (item1.RateBL != 0)
+                    rateStr += "波兰兹罗提(PLN):" + item1.RateBL + "|";
+                if (item1.RateHB != 0)
+                    rateStr += "韩国元(KRW):" + item1.RateHB + "|";
+                if (item1.RateFJD != 0)
+                    rateStr += "斐济元(FJD):" + item1.RateFJD + "|";
+                if (item1.RateTL != 0)
+                    rateStr += "土耳其里拉(TRY):" + item1.RateTL + "|";
+                if (item1.RateRP != 0)
+                    rateStr += "印度尼西亚卢比(IDR):" + item1.RateRP + "|";
+                if (item1.RatePeso != 0)
+                    rateStr += "菲律宾比索(PHP):" + item1.RatePeso + "|";
+                if (item1.RateMYR != 0)
+                    rateStr += "林吉特(MYR):" + item1.RateMYR + "|";
+                if (item1.RateCZK != 0)
+                    rateStr += "捷克货币(CZK):" + item1.RateCZK + "|";
+                if (item1.RateMXN != 0)
+                    rateStr += "墨西哥比索(MXN):" + item1.RateMXN + "|";
+                if (item1.RateMOP != 0)
+                    rateStr += "澳门元(MOP):" + item1.RateMOP + "|";
+                if (item1.RateARS != 0)
+                    rateStr += "阿根廷比索(ARS):" + item1.RateARS + "|";
+                if (item1.RateHUF != 0)
+                    rateStr += "匈牙利福林(HUF):" + item1.RateHUF + "|";
+                if (item1.RateRUB != 0)
+                    rateStr += "卢布(RUB):" + item1.RateRUB + "|";
+
+
+                SetDataInfoView setData = otherCurrencyData1.Where(x => x.Id == item1.OtherRateId).FirstOrDefault();
+                if (setData != null)
+                {
+                    if (item1.OtherPrice != 0)
+                        rateStr += string.Format("{0}({1}):{2}", setData.Remark, setData.Name, item1.OtherPrice);
+                }
+                else
+                {
+                    if (rateStr.Length > 0)
+                    {
+                        rateStr = rateStr.Substring(0, rateStr.Length - 1);
+                    }
+                    
+                }
+
+                item1.Remark = rateStr;
+
+                
+            }
+
+
+
+
+            #endregion
+
+            try
+            {
+
+                var _result = _sqlSugar.Updateable(teamRateInfo)
+                    .UpdateColumns(it => new {it.Remark} ) //更新列
+                    .WhereColumns(it => new { it.DiId,it.CTable })     //更新条件
+                    .ExecuteCommand(); 
+
+                result.Code = 0;
+                result.Msg = "数据修改成功!";
+                result.Data = _data;
+            }
+            catch (Exception ex)
+            {
+
+                result.Msg = ex.Message;
+            }
+
+            return result;
+
+        }
+
+
+        /// <summary>
+        /// 团组汇率 Rep
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> GetGroupRateInfoByDiid(TeamRateInfoDto dto)
+        {
+
+            Result result = new() { Code = -2 };
+
+            GroupInfoDto groupInfoDto = new GroupInfoDto() { Id = dto.Diid,PortType = dto.PortType, PageIndex = dto.PageIndex, PageSize = dto.PageSize };
+            var groupInfo = await _deleInfoRep.GetGroupInfo(groupInfoDto);
+
+            string teamRateInfoSql = string.Format(@"Select sd.Name,tr.* From Grp_TeamRate tr 
+                                                     Left Join Sys_SetData  sd On sd.IsDel=0 And sd.STid=16  And tr.CTable = sd.Id 
+                                                     Where tr.DiId = {0} And tr.IsDel = 0",dto.Diid);
+
+            var teamRateInfo = await _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
+
+            dynamic _data = null;
+
+            if (dto.PortType == 1)
+            {
+
+                #region 团组汇率 - 详细汇率信息
+
+
+                //List<TeamRateModelView> teamRateModels = new List<TeamRateModelView>();
+
+                //List<SetDataInfoView> otherCurrencyData1 = new List<SetDataInfoView>();
+                //var otherCurrencyData = await _setDataRep.GetSetDataBySTId(_setDataRep, 13);
+                //if (otherCurrencyData.Code == 0 && otherCurrencyData.Data != null)
+                //{
+                //    string otherCurrencyStr = JsonConvert.SerializeObject(otherCurrencyData.Data);
+                //    otherCurrencyData1 = JsonConvert.DeserializeObject<List<SetDataInfoView>>(otherCurrencyStr);
+                //    //var otherCurrency = otherCurrencyData1
+                //}
+                //foreach (TeamRateInfoView item in teamRateInfo)
+                //{
+                //    TeamRateModelView teamRateModelInfo = new TeamRateModelView();
+                //    foreach (TeamRateInfoView item1 in teamRateInfo)
+                //    {
+                //        if (item.CTable == item1.CTable)
+                //        {
+                //            teamRateModelInfo.CTableId = item1.CTable;
+                //            teamRateModelInfo.CTableName = item1.Name;
+                //            List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "美元", CurrencyCode = "USD", Rate = item1.RateU });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "欧元", CurrencyCode = "EUR", Rate = item1.RateE });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "日元", CurrencyCode = "JPY", Rate = item1.RateJ });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "港币", CurrencyCode = "HKD", Rate = item1.RateH });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "新西兰元", CurrencyCode = "NZD", Rate = item1.RateN });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "新加坡币", CurrencyCode = "SGD", Rate = item1.RateS });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "澳大利亚元", CurrencyCode = "AUD", Rate = item1.RateA });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "加拿大元", CurrencyCode = "CAD", Rate = item1.RateC });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "泰国铢", CurrencyCode = "THB", Rate = item1.RateT });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "波兰兹罗提", CurrencyCode = "PLN", Rate = item1.RateBL });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "韩国元", CurrencyCode = "KRW", Rate = item1.RateHB });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "斐济元", CurrencyCode = "FJD", Rate = item1.RateFJD });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "土耳其里拉", CurrencyCode = "TRY", Rate = item1.RateTL });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "印度尼西亚卢比", CurrencyCode = "IDR", Rate = item1.RateRP });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "菲律宾比索", CurrencyCode = "PHP", Rate = item1.RatePeso });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "林吉特", CurrencyCode = "MYR", Rate = item1.RateMYR });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "捷克货币", CurrencyCode = "CZK", Rate = item1.RateCZK });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "墨西哥比索", CurrencyCode = "MXN", Rate = item1.RateMXN });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "澳门元", CurrencyCode = "MOP", Rate = item1.RateMOP });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "阿根廷比索", CurrencyCode = "ARS", Rate = item1.RateARS });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "匈牙利福林", CurrencyCode = "HUF", Rate = item1.RateHUF });
+                //            teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = "卢布", CurrencyCode = "RUB", Rate = item1.RateRUB });
+
+                //            SetDataInfoView setData = otherCurrencyData1.Where(x => x.Id == item1.OtherRateId).FirstOrDefault();
+                //            if (setData != null)
+                //            {
+                //                teamRateDescViews.Add(new TeamRateDescView() { CurrencyName = setData.Remark, CurrencyCode = setData.Name, Rate = item1.OtherPrice });
+                //            }
+
+                //            teamRateModelInfo.TeamRates = teamRateDescViews;
+
+
+
+                //        }
+                //    }
+                //    teamRateModels.Add(teamRateModelInfo);
+                //}
+
+
+
+                #endregion
+
+                #region 团组汇率
+
+                List<TeamRateModelView> teamRateModels = new List<TeamRateModelView>();
+
+                foreach (TeamRateInfoView item in teamRateInfo)
+                {
+                    TeamRateModelView teamRateModelInfo = new TeamRateModelView();
+
+                    teamRateModelInfo.CTableId = item.CTable;
+                    teamRateModelInfo.CTableName = item.Name;
+                    List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
+
+                    #region 拆分remark里的汇率
+
+                    if (item.Remark.Contains("|"))
+                    {
+                        string[] currencyArr = item.Remark.Split("|");
+                        foreach (string currency in currencyArr) 
+                        {
+                            string[] currency1 = currency.Split(":");
+                            string[] currency2 = currency1[0].Split("(");
+
+                            TeamRateDescView rateDescView = new TeamRateDescView() {
+                                CurrencyCode = currency2[1].Replace(")", "").TrimEnd(),
+                                CurrencyName = currency2[0],
+                                Rate = decimal.Parse(currency1[1]),
+                            };
+                            teamRateDescViews.Add(rateDescView);
+                        }
+                    }
+
+                    #endregion
+
+                    teamRateModelInfo.TeamRates = teamRateDescViews;
+                    teamRateModels.Add(teamRateModelInfo);
+                }
+
+                #endregion
+                _data = new { GroupInfo = groupInfo.Data, TeamRateData = teamRateModels };
+
+            }
+            else if (dto.PortType == 2)
+            {
+
+            }
+            else if (dto.PortType == 3)
+            {
+
+            }
+
+
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = _data;
+
+            return result;
+
+        }
+    }
+}

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/System/SetDataRepository.cs

@@ -66,6 +66,7 @@ namespace OASystem.Infrastructure.Repositories.System
             {
                 Name = x.Name,
                 Id = x.Id,
+                Remark = x.Remark,
             });
 
             result.Code = 0;