Browse Source

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

wangh 1 year ago
parent
commit
55c8ad687b

+ 166 - 1
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -9,6 +9,7 @@ using OASystem.Domain.Entities.Business;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels.Business;
+using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Business;
 using OASystem.Infrastructure.Repositories.Groups;
@@ -27,12 +28,15 @@ namespace OASystem.API.Controllers
         private readonly CommonBusRepository _busRep;
         private readonly SetDataRepository _setDataRep;
         private readonly DelegationInfoRepository _groupRep;
-        public BusinessController(IMapper mapper, CommonBusRepository busRep, SetDataRepository setDataRep, DelegationInfoRepository groupRep)
+        private readonly TeamRateRepository _teamRateRep;
+
+        public BusinessController( IMapper mapper, CommonBusRepository busRep, SetDataRepository setDataRep, DelegationInfoRepository groupRep, TeamRateRepository teamRateRep)
         {
             _mapper = mapper;
             _busRep = busRep;
             _setDataRep = setDataRep;
             _groupRep = groupRep;
+            _teamRateRep = teamRateRep;
         }
 
         #region 团组信息 团组详情
@@ -103,6 +107,129 @@ namespace OASystem.API.Controllers
             }
         }
 
+
+        /// <summary>
+        /// 团组汇率 币种 Item (来源:团组汇率)
+        /// 根据 团组Id And 业务类型(CTable)Id
+        /// </summary>
+        /// <param name="portType"> 1 Web 2 Android 3 Ios; </param>
+        /// <param name="diId"> 团组Id </param>
+        /// <param name="CTbale"> CTableType Id  </param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostGroupTeamRateByDiIdAndCTableId(int portType, int diId,int CTbale)
+        {
+            try
+            {
+                if (diId == 0)
+                {
+                    return Ok(JsonView(false, "请输入正确的团组Id!"));
+                }
+                if (CTbale == 0)
+                {
+                    return Ok(JsonView(false, "请输入正确的业务类型(CTable)Id!"));
+                }
+
+
+                if (portType == 1 || portType == 2 || portType == 3 )
+                {
+                    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.IsDel = 0 And tr.DiId = {0} And tr.CTable = {1}", diId,CTbale);
+
+                    var teamRateInfo = await _teamRateRep._sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
+
+                    #region 团组汇率
+
+                    TeamRateModelGeneralView teamRateModels = new TeamRateModelGeneralView();
+
+
+                    List<SetDataInfoView> currencyDatas = new List<SetDataInfoView>();    
+                    #region 获取所有币种
+
+                    string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0", 66);
+                    var DBdata = await _setDataRep.GetListBySqlWithNolockAsync(sql);
+
+                    if (DBdata == null || DBdata.Count == 0)
+                    {
+                        return Ok(JsonView(false, "所有币种获取失败!"));
+                    }
+
+                    currencyDatas = DBdata.Select(x => new SetDataInfoView
+                    {
+                        Name = x.Name,
+                        Id = x.Id,
+                        Remark = x.Remark,
+                    }).ToList();
+
+                    #endregion
+
+                    foreach (TeamRateInfoView item in teamRateInfo)
+                    {
+                        TeamRateModelGeneralView teamRateModelInfo = new TeamRateModelGeneralView();
+
+                        teamRateModelInfo.Id = item.Id;
+                        teamRateModelInfo.CTableId = item.CTable;
+                        teamRateModelInfo.CTableName = item.Name;
+                        List<TeamRateDescAddCurrencyIdView> teamRateDescViews = new List<TeamRateDescAddCurrencyIdView>();
+
+                        #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("(");
+
+                                string currencyCode = currency2[1].Replace(")", "").TrimEnd();
+                                SetDataInfoView dataInfoView = new SetDataInfoView();
+                                dataInfoView = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault();
+                                int currencyId = currencyDatas.Where(it => it.Name == currencyCode).FirstOrDefault().Id;
+                                TeamRateDescAddCurrencyIdView rateDescView = new TeamRateDescAddCurrencyIdView()
+                                {
+                                    CurrencyId = dataInfoView.Id,
+                                    CurrencyCode = currencyCode,
+                                    CurrencyName = currency2[0],
+                                    Rate = decimal.Parse(currency1[1]),
+                                };
+                                teamRateDescViews.Add(rateDescView);
+                            }
+                        }
+
+                        #endregion
+
+                        if (teamRateDescViews.Count > 0)
+                        {
+                            teamRateDescViews = teamRateDescViews.OrderBy(it => it.CurrencyId).ToList();
+                        }
+                        
+                        teamRateModelInfo.TeamRates = teamRateDescViews;
+                        teamRateModels = teamRateModelInfo;
+                    }
+
+                    #endregion
+
+                    return Ok(JsonView(true, "操作成功!", teamRateModels));
+
+                }
+                else
+                {
+                    return Ok(JsonView(false, "请输入正确的端口号! 1 Web 2 Android 3 Ios;"));
+                }
+
+
+
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
+
         /// <summary>
         /// 根据团组Id币种Id及类型Id查询团组汇率
         /// </summary>
@@ -133,6 +260,44 @@ namespace OASystem.API.Controllers
         }
         #endregion
 
+        #region 查询页面操作权限
+
+        /// <summary>
+        /// 查询页面操作权限 根据 用户Id 及 页面ID
+        /// </summary>
+        /// <param name="userId">用户Id</param>
+        /// <param name="pageId">页面Id</param>
+        /// <param name="portType">端口类型</param>
+        /// <returns></returns>
+        [HttpGet, HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPageOperationPermission(int userId,int pageId,int portType)
+        {
+            try
+            {
+
+
+
+                Result setData = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); //币种类型
+                if (setData.Code == 0)
+                {
+                    return Ok(JsonView(true, "查询成功", setData.Data));
+                }
+                else
+                {
+                    return Ok(JsonView(false, setData.Msg));
+                }
+            }
+            catch (Exception)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
+
+        #endregion
+
+
         #region 会务物料单
 
         /// <summary>

+ 89 - 1
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -923,7 +923,7 @@ namespace OASystem.API.Controllers
 
         /// <summary>
         /// 收款退还与其他款项
-        /// 查询 根据团组Id
+        /// 删除 
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -953,8 +953,96 @@ namespace OASystem.API.Controllers
             }
         }
 
+        /// <summary>
+        /// 收款退还与其他款项
+        /// Info Data Source
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfoDataSource(PortDtoBase dto)
+        {
+            try
+            {
+                Result _result = await _paymentRefundAndOtherMoneyRep._InfoDataSource(dto);
+
+                if (_result.Code != 0)
+                {
+                    return Ok(JsonView(false, _result.Msg));
+                }
+
+                return Ok(JsonView(true, "查询成功!", _result.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
+        /// <summary>
+        /// 收款退还与其他款项
+        /// Info
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPaymentRefundAndOtherMoneyInfo(PaymentRefundAndOtherMoneyInfoDto dto)
+        {
+            try
+            {
+                if (dto == null)
+                {
+                    return Ok(JsonView(false, "参数不能为空!"));
+                }
+
+                Result _result = await _paymentRefundAndOtherMoneyRep._Info(dto);
+
+                if (_result.Code != 0)
+                {
+                    return Ok(JsonView(false, _result.Msg));
+                }
+
+                return Ok(JsonView(true, "查询成功!", _result.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
+        /// <summary>
+        /// 收款退还与其他款项
+        /// 操作(Add Or Edit)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostPaymentRefundAndOtherMoneyAddOrEdit(PaymentRefundAndOtherMoneyAddOrEditDto dto)
+        {
+            try
+            {
+                if (dto == null)
+                {
+                    return Ok(JsonView(false, "参数不能为空!"));
+                }
 
+                Result _result = await _paymentRefundAndOtherMoneyRep._AddOrEdit(dto);
 
+                if (_result.Code != 0)
+                {
+                    return Ok(JsonView(false, _result.Msg));
+                }
+
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
         #endregion
     }
 }

+ 5 - 4
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3355,10 +3355,11 @@ namespace OASystem.API.Controllers
             try
             {
                 _sqlSugar.BeginTran();
-                isTrue = await _GroupCostRepository.SaveGroupCostList(Grp_groups, dto.Diid); //列表
-                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs, dto.Diid); //选中项
-                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber, dto.Diid); //酒店房间数量
-                isTrue = await _GroupCostParameterRepository.SaveAsync(Grp_CostParameters, dto.Diid); //系数
+                isTrue = await _GroupCostRepository.
+                    SaveGroupCostList(Grp_groups,dto.Diid); //列表
+                isTrue = await _checkBoxs.SaveCheckBoxs(Grp_CheckBoxs,dto.Diid); //选中项
+                isTrue = await _CostTypeHotelNumberRepository.SaveHotelNumber(Grp_HotelNumber,dto.Userid,dto.Diid); //酒店房间数量
+                isTrue = await _GroupCostParameterRepository.SaveAsync(Grp_CostParameters , dto.Userid ,dto.Diid); //系数
 
                 _sqlSugar.CommitTran();
                 jw = JsonView(true, "保存成功!", isTrue);

+ 100 - 1
OASystem/OASystem.Domain/Dtos/Financial/PaymentRefundAndOtherMoneyDto.cs

@@ -8,8 +8,9 @@ namespace OASystem.Domain.Dtos.Financial
 {
     /// <summary>
     /// 收款退还与其他款项
+    /// Item Dto
     /// </summary>
-    public class PaymentRefundAndOtherMoneyItemByDiIdDto:PortDtoBase
+    public class PaymentRefundAndOtherMoneyItemByDiIdDto : PortDtoBase
     {
         /// <summary>
         /// 团组Id 
@@ -19,6 +20,7 @@ namespace OASystem.Domain.Dtos.Financial
 
     /// <summary>
     /// 收款退还与其他款项
+    /// Del Dto
     /// </summary>
     public class PaymentRefundAndOtherMoneyDelDto
     {
@@ -32,4 +34,101 @@ namespace OASystem.Domain.Dtos.Financial
         /// </summary>
         public int UserId { get; set; }
     }
+
+    /// <summary>
+    /// 收款退还与其他款项
+    /// 详情 Dto
+    /// </summary>
+    public class PaymentRefundAndOtherMoneyInfoDto : PortDtoBase
+    {
+        /// <summary>
+        /// Id 
+        /// </summary>
+        public int Id { get; set; }
+    }
+
+    /// <summary>
+    /// 收款退还与其他款项
+    /// 操作(Add Or Update) Dto
+    /// </summary>
+    public class PaymentRefundAndOtherMoneyAddOrEditDto : PortDtoBase
+    {
+        /// <summary>
+        /// 操作状态
+        /// 1 添加 
+        /// 2 修改 
+        /// </summary>
+        public int Status { get; set; }
+
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// C表Id
+        /// </summary>
+        public int CcpId { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string? PriceName { get; set; }
+
+        /// <summary>
+        /// 费用
+        /// </summary>
+        public decimal Price { get; set; }
+
+        /// <summary>
+        /// 币种Id
+        /// </summary>
+        public int CurrencyId { get; set; }
+
+        /// <summary>
+        /// 币种Code
+        /// </summary>
+        public string? CurrencyCode { get; set; }
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 支付方式Id
+        /// </summary>
+        public int PayDId { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+
+        /// <summary>
+        /// 消费方式
+        /// </summary>
+        public string? ConsumptionPatterns { get; set; }
+
+        /// <summary>
+        /// 费用类型
+        /// 0 其他 1 退多付款
+        /// </summary>
+        public int PayType { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+    }
 }

+ 3 - 3
OASystem/OASystem.Domain/Entities/Financial/Fin_PaymentRefundAndOtherMoney.cs

@@ -38,10 +38,10 @@ namespace OASystem.Domain.Entities.Financial
 
         /// <summary>
         /// 付款类型??? 
-        /// 0 1
+        /// 0 其他  1 退多付款
         /// </summary>
-        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(10)")]
-        public string PayType { get; set; }
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int PayType { get; set; }
 
         /// <summary>
         /// 退款表识 

+ 2 - 2
OASystem/OASystem.Domain/Entities/Groups/Grp_CreditCardPayment.cs

@@ -26,7 +26,7 @@ namespace OASystem.Domain.Entities.Groups
         /// 消费日期
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
-        public String ConsumptionDate { get; set; }
+        public string ConsumptionDate { get; set; }
         /// <summary>
         /// 卡类型
         /// </summary>
@@ -81,7 +81,7 @@ namespace OASystem.Domain.Entities.Groups
         /// 财务操作人 用户Id
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
-        public string MFOperator { get; set; }
+        public int MFOperator { get; set; }
         /// <summary>
         /// 财务操作时间
         /// </summary>

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

@@ -55,4 +55,73 @@ namespace OASystem.Domain.ViewModels.Financial
         /// </summary>
         public DateTime CreateTime { get; set; }
     }
+
+    /// <summary>
+    /// 收款退还与其他款项
+    /// InfoView
+    /// </summary>
+    public class Fin_PaymentRefundAndOtherMoneyInfoView
+    {
+        /// <summary>
+        /// Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// C表Id
+        /// </summary>
+        public int CcpId { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string? PriceName { get; set; }
+
+        /// <summary>
+        /// 费用
+        /// </summary>
+        public decimal Price { get; set; }
+
+        /// <summary>
+        /// 币种Id
+        /// </summary>
+        public int CurrencyId { get; set; }
+
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string? Payee { get; set; }
+
+        /// <summary>
+        /// 支付方式Id
+        /// </summary>
+        public int PayDId { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+
+        /// <summary>
+        /// 消费方式
+        /// </summary>
+        public string? ConsumptionPatterns { get; set; }
+
+        /// <summary>
+        /// 费用类型
+        /// 0 其他 1 退多付款
+        /// </summary>
+        public int PayType { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+
+    }
 }

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

@@ -70,6 +70,42 @@ namespace OASystem.Domain.ViewModels.Financial
         public decimal Rate { get; set; }
 
     }
+
+    /// <summary>
+    /// 
+    /// </summary>
+    public class TeamRateDescAddCurrencyIdView: TeamRateDescView
+    {
+        /// <summary>
+        /// 币种Id
+        /// </summary>
+        public int CurrencyId { get; set; }
+
+    }
+
+    public class TeamRateModelGeneralView
+    {
+        /// <summary>
+        /// 汇率Id
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 汇率模块 Id
+        /// </summary>
+        public int CTableId { get; set; }
+
+        /// <summary>
+        /// 汇率模块
+        /// </summary>
+        public string? CTableName { get; set; }
+
+        /// <summary>
+        /// 汇率 List
+        /// </summary>
+        public List<TeamRateDescAddCurrencyIdView>? TeamRates { get; set; }
+    }
+
     #endregion
 
 }

+ 330 - 14
OASystem/OASystem.Infrastructure/Repositories/Financial/PaymentRefundAndOtherMoneyRepository.cs

@@ -1,11 +1,18 @@
 using AutoMapper;
+using Newtonsoft.Json;
 using OASystem.Domain;
+using OASystem.Domain.Dtos;
 using OASystem.Domain.Dtos.Financial;
+using OASystem.Domain.Dtos.UserDto;
 using OASystem.Domain.Entities.Financial;
+using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
+using OASystem.Infrastructure.Repositories.Groups;
+using OASystem.Infrastructure.Repositories.System;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Security.Cryptography;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -18,17 +25,21 @@ namespace OASystem.Infrastructure.Repositories.Financial
     {
         private readonly IMapper _mapper;
         private readonly Result _result;
+        private readonly SetDataRepository _setDataRep;
+        private readonly TeamRateRepository _teamRateRep;
 
         /// <summary>
         /// 初始化
         /// </summary>
         /// <param name="sqlSugar"></param>
         /// <param name="mapper"></param>
-        public PaymentRefundAndOtherMoneyRepository(SqlSugarClient sqlSugar, IMapper mapper)
+        public PaymentRefundAndOtherMoneyRepository(SqlSugarClient sqlSugar, IMapper mapper, SetDataRepository setDataRep, TeamRateRepository teamRateRep)
             : base(sqlSugar)
         {
             _mapper = mapper;
             _result = new Result() { Code = -2 };
+            _setDataRep = setDataRep;
+            _teamRateRep = teamRateRep;
         }
 
         /// <summary>
@@ -38,23 +49,17 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// <returns></returns>
         public async Task<Result> PostItemByDiId(int diId)
         {
-            
-            
-                string sql = string.Format(@"Select prom.Id,prom.PriceName,prom.Price,sd.Name As CurrencyName,prom.Remark,u.CnName As CreateUserName,prom.CreateTime 
+            string sql = string.Format(@"Select prom.Id,prom.PriceName,prom.Price,sd.Name As CurrencyName,prom.Remark,u.CnName As CreateUserName,prom.CreateTime 
 				                         From Fin_PaymentRefundAndOtherMoney prom
 				                         Left Join Sys_Users u On u.Id = prom.CreateUserId 
 				                         Left Join Sys_SetData sd On prom.CurrencyId = sd.Id
 				                         Where prom.IsDel = 0  And prom.DiId={0}", diId);
 
-                var groupReceivablesList = await _sqlSugar.SqlQueryable<Fin_PaymentRefundAndOtherMoneyItemView>(sql).ToListAsync();
+            var data = await _sqlSugar.SqlQueryable<Fin_PaymentRefundAndOtherMoneyItemView>(sql).ToListAsync();
 
-                _result.Data = groupReceivablesList;
-                _result.Code = 0;
-                _result.Msg = "查询成功!";
-           
-            
-
-           
+            _result.Data = data;
+            _result.Code = 0;
+            _result.Msg = "查询成功!";
 
             return _result;
 
@@ -74,11 +79,33 @@ namespace OASystem.Infrastructure.Repositories.Financial
                 IsDel = 1
             };
 
-            var del = await _sqlSugar.Updateable( _PaymentRefundAndOtherMoney )
+            _sqlSugar.BeginTran();
+            var prom_del = await _sqlSugar.Updateable( _PaymentRefundAndOtherMoney )
                                      .UpdateColumns(it => new { it.DeleteUserId,it.DeleteTime,it.IsDel })
                                      .WhereColumns(it => new { it.Id})
                                      .ExecuteCommandAsync();
-            if (del > 0 )
+
+
+            Fin_PaymentRefundAndOtherMoney _PaymentRefundAndOtherMoneyInfo = new Fin_PaymentRefundAndOtherMoney();
+            _PaymentRefundAndOtherMoneyInfo = await _sqlSugar.Queryable<Fin_PaymentRefundAndOtherMoney>().Where(it => it.Id == dto.Id).FirstAsync();
+
+            if (_PaymentRefundAndOtherMoneyInfo != null)
+            {
+                Grp_CreditCardPayment _CreditCardPayment = new Grp_CreditCardPayment() {
+                    Id = _PaymentRefundAndOtherMoneyInfo.Id,
+                    DeleteUserId = dto.UserId,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                    IsDel = 1
+                };
+
+
+                var ccp_del = await _sqlSugar.Updateable(_CreditCardPayment)
+                                     .UpdateColumns(it => new { it.DeleteUserId, it.DeleteTime, it.IsDel })
+                                     .WhereColumns(it => new { it.Id })
+                                     .ExecuteCommandAsync();
+            }
+
+            if (prom_del > 0 )
             {
                 _result.Code = 0;
                 _result.Msg = "操作成功!";
@@ -86,8 +113,297 @@ namespace OASystem.Infrastructure.Repositories.Financial
             else
             {
                 _result.Msg = "操作失败!";
+            }
+
+            _sqlSugar.CommitTran();
+            return _result;
+        }
+        
+        /// <summary>
+        /// 详情 数据源
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <returns></returns>
+        public async Task<Result> _InfoDataSource(PortDtoBase dto)
+        {
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
+            {
+                dynamic _currencyData = null, _payTypeData = null;
+                Result currencyData = await _setDataRep.GetSetDataBySTId(_setDataRep, 66); //币种类型
+                if (currencyData != null)
+                {
+                    if (currencyData.Code == 0)
+                    {
+                        _currencyData = currencyData.Data;
+                    }
+                }
+
+                Result payTypeData = await _setDataRep.GetSetDataBySTId(_setDataRep, 14); //支付类型
+                if (payTypeData != null)
+                {
+                    if (payTypeData.Code == 0)
+                    {
+                        _payTypeData = payTypeData.Data;
+                    }
+                }
+
+                List<dynamic> _priceTypeDatas = new List<dynamic>();
+                _priceTypeDatas.Add(new { Id = 0, Name = "其他", Remark = "" });
+                _priceTypeDatas.Add(new { Id = 1, Name = "退多付款", Remark = "" });
+
+                List<dynamic> _orbitalPrivateTransferDatas = new List<dynamic>();
+                _orbitalPrivateTransferDatas.Add(new { Id = 0, Name = "公转", Remark = "" });
+                _orbitalPrivateTransferDatas.Add(new { Id = 1, Name = "私转", Remark = "" });
+
+                dynamic _InfoDataSource = new
+                {
+                    CurrencyDatas = _currencyData,
+                    PayTypeDatas = _payTypeData,
+                    OrbitalPrivateTransferDatas = _orbitalPrivateTransferDatas,
+                    PriceTypeDatas = _priceTypeDatas
+                };
+
+                _result.Data = _InfoDataSource;
+                _result.Code = 0;
+                _result.Msg = "查询成功!";
+            }
+            else
+            {
+                _result.Msg = "请输入正确的端口号! 1 Web 2 Android 3 Ios;";
+            }
+
+            return _result;
+        }
+
+        /// <summary>
+        /// 详情
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <returns></returns>
+        public async Task<Result> _Info(PaymentRefundAndOtherMoneyInfoDto dto)
+        {
+           
+
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
+            {
+                string sql = string.Format(@"Select prom.Id,ccp.Id CcpId,prom.DiId,prom.PriceName,prom.Price,prom.CurrencyId,ccp.Payee,ccp.PayDId,
+										 ccp.OrbitalPrivateTransfer,ccp.ConsumptionPatterns,prom.PayType,prom.Remark
+										 From Fin_PaymentRefundAndOtherMoney prom 
+										 Left Join Grp_CreditCardPayment ccp On ccp.CId = prom.id And ccp.CTable = 79 And ccp.IsDel = 0
+										 Where prom.IsDel = 0 And prom.Id = {0}", dto.Id);
+                var data = await _sqlSugar.SqlQueryable<Fin_PaymentRefundAndOtherMoneyInfoView>(sql).ToListAsync();
+
+                if (data != null)
+                {
+                    _result.Data = data;
+                    _result.Code = 0;
+                    _result.Msg = "查询成功!";
+                }
+                else
+                {
+                    _result.Msg = "查询失败!";
+                }
+
+            }
+            else
+            {
+                _result.Msg = "请输入正确的端口号! 1 Web 2 Android 3 Ios;";
+            }
+           
+            return _result;
+        }
+
+        /// <summary>
+        /// 操作(Add Or Edit)
+        /// </summary>
+        /// <param name="diId"></param>
+        /// <returns></returns>
+        public async Task<Result> _AddOrEdit(PaymentRefundAndOtherMoneyAddOrEditDto dto)
+        {
+
+
+            if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)  //1 Web 2 Android 3 Ios
+            {
+                #region 参数处理
+                Fin_PaymentRefundAndOtherMoney _PaymentRefundAndOtherMoney = new Fin_PaymentRefundAndOtherMoney() { 
+                    //Id = dto.Id,
+                    DiId = dto.DiId,
+                    PriceName = dto.PriceName,
+                    Price = dto.Price,
+                    CurrencyId = dto.CurrencyId,
+                    PayType = dto.PayType,
+                    //PriceType = dto.PriceType,
+                    CreateUserId = dto.UserId,
+                    Remark = dto.Remark 
+                };
+
+                //处理团组汇率
+                decimal dayRate = 0.00M;
+                decimal CNY_Price = 0.00M;
+                decimal payThenMoney = 0.00M;
+                #region 其他款项 团组汇率 验证
+                if (dto.CurrencyId == 836) //人民币币种Id
+                {
+                    dayRate = 1.0000M;
+                    CNY_Price = dto.Price;
+                    payThenMoney = dto.Price;
+                }
+                else //其他币种Id
+                {
+                    List<TeamRateModelView> teamReteDatas = await _teamRateRep.PostGroupRateInfoByDiId(dto.DiId);
+                    if (teamReteDatas.Count <= 0)
+                    {
+                        _result.Msg = "该团未设置团组汇率,请先设置!";
+                        return _result;
+                    }
+
+                    var teamReteData1 = teamReteDatas.Where(it => it.CTableId == 285).FirstOrDefault();
+                    if (teamReteData1 == null)
+                    {
+                        _result.Msg = "该团下的“其他款项”未设置团组汇率,请先设置!";
+                        return _result;
+                    }
+
+                    var teamReteData2 = teamReteData1.TeamRates.Where(it => it.CurrencyCode == dto.CurrencyCode).FirstOrDefault();
+                    if (teamReteData2 == null)
+                    {
+                        _result.Msg = @"该团下的“其他款项”币种 “"+ dto.CurrencyCode + "”未设置团组汇率,请先设置!";
+                        return _result;
+                    }
+                    dayRate = teamReteData2.Rate;
+                    CNY_Price = dayRate * dayRate;
+                    payThenMoney = dayRate * dayRate;
+                }
+
+                #endregion
+
+                Grp_CreditCardPayment _CreditCardPayment = new Grp_CreditCardPayment() {
+                    //Id = dto.CcpId,
+                    //CId = dto.CcpId,
+                    DIId = dto.DiId,
+                    CTable = 285,
+                    PayDId = dto.PayDId,
+                    ConsumptionPatterns = dto.ConsumptionPatterns,
+                    ConsumptionDate = string.Empty,
+                    CTDId = 0,
+                    BankNo = string.Empty,
+                    CardholderName = string.Empty,
+                    PayMoney = dto.Price,
+                    PaymentCurrency = dto.CurrencyId,
+                    DayRate = dayRate,
+                    CompanyBankNo = string.Empty,
+                    OtherBankName = string.Empty,
+                    OtherSideNo = string.Empty,
+                    OtherSideName = string.Empty,
+                    MFOperator = 0,
+                    MFOperatorDate = string.Empty,
+                    IsAuditDM = 0,
+                    AuditDMOperate = 0,
+                    AuditDMDate = string.Empty,
+                    IsAuditMF = 0,
+                    AuditMFOperate = 0,
+                    AuditMFDate = string.Empty,
+                    IsAuditGM = 0,
+                    AuditGMOperate = 0,
+                    AuditGMDate = string.Empty,
+                    IsPay = 0,
+                    PayPercentage = 100.00M,
+                    PayThenMoney = payThenMoney,
+                    PayPercentageOld = 0.00M,
+                    PayThenMoneyOld = 0.00M,
+                    UpdateDate = string.Empty,
+                    Payee = dto.Payee,
+                    RMBPrice = CNY_Price,
+                    OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
+                    ExceedBudget = 0.00M,
+                    CreateUserId = dto.UserId,
+                    DeleteUserId = null,
+                    DeleteTime = string.Empty,
+                    Remark = string.Empty,
+                    IsDel = 0
+                };
+
+                #endregion
+
+                if (dto.Status == 1) //添加
+                {
+                    _sqlSugar.BeginTran();
+
+                    var addReturnId = await _sqlSugar.Insertable(_PaymentRefundAndOtherMoney).ExecuteReturnIdentityAsync();
+
+                    if (addReturnId <= 0)
+                    {
+                        _result.Msg = "操作失败!收款退还与其他款项添加失败!";
+                        _sqlSugar.RollbackTran();
+                        return _result;
+                    }
+                    _CreditCardPayment.CId = addReturnId;
+                    var addStatus = await _sqlSugar.Insertable(_CreditCardPayment).ExecuteReturnIdentityAsync();
+                    if (addStatus <= 0)
+                    {
+                        _result.Msg = "操作失败!付款类型添加失败!";
+                        _sqlSugar.RollbackTran();
+                        return _result;
+                    }
+
+                    _sqlSugar.CommitTran();
+                    _result.Msg = "操作成功!";
+                    _result.Code = 0;
+                }
+                else if (dto.Status == 2) //修改
+                {
+                    _PaymentRefundAndOtherMoney.Id = dto.Id;
+                    _CreditCardPayment.Id = dto.CcpId;
+                    _CreditCardPayment.CId = dto.Id;
+
+                    _sqlSugar.BeginTran();
+
+                    var prom_update = await _sqlSugar.Updateable(_PaymentRefundAndOtherMoney)
+                                                     .IgnoreColumns(it => new { it.CreateUserId, it.CreateTime, it.DeleteUserId, it.DeleteTime, it.IsDel })
+                                                     .WhereColumns(it => new { it.Id })
+                                                     .ExecuteCommandAsync();
+
+                    if (prom_update <= 0)
+                    {
+                        _result.Msg = "操作失败!收款退还与其他款项修改失败!";
+                        _sqlSugar.RollbackTran();
+                        return _result;
+                    }
+
+                    var ccp_update = await _sqlSugar.Updateable(_CreditCardPayment)
+                                                   .UpdateColumns(it => new
+                                                   {
+                                                       it.ConsumptionPatterns,
+                                                       it.PayMoney,
+                                                       it.PaymentCurrency,
+                                                       it.DayRate,
+                                                       it.PayThenMoney,
+                                                       it.OrbitalPrivateTransfer
+                                                   })
+                                                   .WhereColumns(it => new { it.Id })
+                                                   .ExecuteCommandAsync();
+                    if (ccp_update <= 0)
+                    {
+                        _result.Msg = "操作失败!付款信息修改失败!";
+                        _sqlSugar.RollbackTran();
+                        return _result;
+                    }
+
+                    _sqlSugar.CommitTran();
+                    _result.Msg = "操作成功!";
+                    _result.Code = 0;
+                }
+                else
+                {
+                    _result.Msg = "请输入正确的状态! 1 添加 2 修改;";
+                }
 
             }
+            else
+            {
+                _result.Msg = "请输入正确的端口号! 1 Web 2 Android 3 Ios;";
+            }
+
             return _result;
         }
     }

+ 20 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/CostTypeHotelNumberRepository.cs

@@ -17,20 +17,31 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return Query(x=>x.Diid == diid).ToList();
         }
 
-        public async Task<bool> SaveHotelNumber(List<Grp_CostTypeHotelNumber> List,int Userid)
+        public async Task<bool> DeleteCostTypeHotelNumberByDiid(int diid)
+        {
+            return await SoftDeleteAsync(x => x.Diid == diid);
+        }
+
+
+        public async Task<bool> SaveHotelNumber(List<Grp_CostTypeHotelNumber> List,int Userid,int diid)
         {
-            var AddList = List.Where(x=>x.Id == 0).ToList();
-            var UpdateList = List.Where(x=>x.Id != 0).ToList();
-            BeginTran();
             bool isTrue = false;
-            if (AddList.Count > 0)
+            try
             {
-                AddList.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });
-                isTrue = Adds(AddList) > 0;
+                BeginTran();
+                isTrue = await DeleteCostTypeHotelNumberByDiid(diid);
+                if (List.Count > 0)
+                {
+                    List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });
+                    isTrue = Adds(List) > 0;
+                }
+
+                CommitTran();
             }
-            if(UpdateList.Count > 0)
+            catch (Exception)
             {
-                isTrue = await _sqlSugar.Updateable<Grp_CostTypeHotelNumber>(UpdateList).ExecuteCommandHasChangeAsync();
+                RollbackTran();
+                isTrue = false;
             }
             return isTrue;
         }

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

@@ -167,7 +167,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             C.OtherSideName = "";
                             C.Remark = "";
                             C.CreateUserId = grp_Decrease.CreateUserId;
-                            C.MFOperator = "";
+                            C.MFOperator = 0;
                             C.MFOperatorDate = "";
                             C.IsAuditDM = 0;
                             C.AuditDMOperate = 0;

+ 17 - 9
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupCostParameterRepository.cs

@@ -20,21 +20,29 @@ namespace OASystem.Infrastructure.Repositories.Groups
            return Query(x=>x.DiId == diid).ToList();
         }
 
+        public async Task<bool> DeleteGroupCostParameterListByDiid(int diid) 
+        {
+            return await SoftDeleteAsync(x=>x.DiId == diid);
+        }
 
-        public async Task<bool> SaveAsync(List<Grp_GroupCostParameter> List,int UserId)
+        public async Task<bool> SaveAsync(List<Grp_GroupCostParameter> List,int Userid, int diid)
         {
-            var AddList = List.Where(x => x.Id == 0).ToList();
-            var UpdateList = List.Where(x => x.Id != 0).ToList();
-            BeginTran();
             bool isTrue = false;
-            if (AddList.Count > 0)
+            try
             {
-                AddList.ForEach(x => { x.CreateUserId = UserId; x.CreateTime = DateTime.Now; });
-                isTrue = Adds(AddList) > 0;
+                BeginTran();
+                isTrue = await DeleteGroupCostParameterListByDiid(diid);
+                if (List.Count > 0)
+                {
+                    List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });
+                    isTrue = Adds(List) > 0;
+                }
+                CommitTran();
             }
-            if (UpdateList.Count > 0)
+            catch (Exception ex)
             {
-                isTrue = await _sqlSugar.Updateable<Grp_GroupCostParameter>(UpdateList).ExecuteCommandHasChangeAsync();
+                RollbackTran();
+                isTrue = false;
             }
             return isTrue;
         }

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

@@ -279,7 +279,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             C.OtherSideName = "";
                             C.Remark = "";
                             C.CreateUserId = dto.CreateUserId;
-                            C.MFOperator = "";
+                            C.MFOperator = 0;
                             C.MFOperatorDate = "";
                             C.IsAuditDM = 0;
                             C.AuditDMOperate = 0;

+ 61 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/TeamRateRepository.cs

@@ -351,8 +351,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
             }
 
-
-
             result.Code = 0;
             result.Msg = "查询成功!";
             result.Data = _data;
@@ -429,5 +427,66 @@ namespace OASystem.Infrastructure.Repositories.Groups
             return result;
 
         }
+
+        /// <summary>
+        /// 团组汇率 Rep
+        /// 根据团组Id 查询汇率
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<List<TeamRateModelView>> PostGroupRateInfoByDiId(int diId)
+        {
+
+            List<TeamRateModelView> teamRateModels = new List<TeamRateModelView>();
+            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", diId);
+
+            var teamRateInfo = await _sqlSugar.SqlQueryable<TeamRateInfoView>(teamRateInfoSql).ToListAsync();
+
+            #region 团组汇率
+
+
+            foreach (TeamRateInfoView item in teamRateInfo)
+            {
+                TeamRateModelView teamRateModelInfo = new TeamRateModelView();
+
+                teamRateModelInfo.Id = item.Id;
+                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
+
+
+            return teamRateModels;
+
+        }
     }
 }