Browse Source

商邀费用操作 添加去掉验证

leiy 9 months ago
parent
commit
3113c76d46

+ 14 - 18
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -37,34 +37,30 @@ namespace OASystem.Infrastructure.Repositories.Groups
         public async Task<Result> DecreasePaymentsList(DecreasePaymentsListDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+
+            string sqlWhere = "";
+            if (dto.IsPaySign != -1)
             {
-                string sqlWhere = "";
-                if (dto.IsPaySign != -1) {
-                    sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
-                }
+                sqlWhere += string.Format(@" And ccp.IsPay = {0} ", dto.IsPaySign);
+            }
 
-                //雷怡 2024-5-8 15:14 新增View字段 CreateTime
-                string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
+            //雷怡 2024-5-8 15:14 新增View字段 CreateTime
+            string sql = string.Format(@" Select gdp.Id,gdp.DiId,gdp.PriceName,gdp.FeeTotal,sd1.[Name] as Currency,gdp.FilePath,su.CnName as CreateUserName,
                                               ccp.IsAuditGM as isAudit,ccp.IsPay,gdp.CreateTime
                                               From Grp_DecreasePayments as gdp With(Nolock) Left Join Grp_CreditCardPayment as ccp With(Nolock) On gdp.Id = ccp.CId
                                               Left Join Sys_SetData as sd1 On gdp.Currency = sd1.Id
                                               Left Join Sys_Users as su On gdp.CreateUserId = su.Id
                                               Where gdp.DiId = {0} And ccp.CTable = 98 {2} And ccp.IsDel = 0 And gdp.IsDel = 0 And gdp.CreateUserId in ({1}) ", dto.DiId, dto.UserId, sqlWhere);
-                List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
-                if (_DecreasePayments.Count > 0)
-                {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
-                }
-                else
-                {
-                    result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
-                }
+            List<DecreasePaymentsView> _DecreasePayments = await _sqlSugar.SqlQueryable<DecreasePaymentsView>(sql).ToListAsync();
+            if (_DecreasePayments.Count > 0)
+            {
+                result = new Result() { Code = 0, Msg = "查询成功!", Data = _DecreasePayments };
             }
-            catch (Exception ex)
+            else
             {
-                result = new Result() { Code = -2, Msg = ex.Message };
+                result = new Result() { Code = 0, Msg = "暂无数据!", Data = _DecreasePayments };
             }
+
             return result;
         }
 

+ 100 - 101
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -287,126 +287,125 @@ Order By i.id  Desc ", sqlWhere);
                 Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
                 if (dto.Status == 1)//添加
                 {
-                    string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
-                                                    , dto.InviterArea, dto.Inviter, dto.DiId, 0);
-                    var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
-                    if (_InvitationOfficialActivities != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
-                    }
-                    else
+                    //string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
+                    //                                , dto.InviterArea, dto.Inviter, dto.DiId, 0);
+                    //var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
+                    //if (_InvitationOfficialActivities != null)
+                    //{
+                    //    return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
+                    //}
+
+                    id = await AddAsyncReturnId(grp_Invitation);
+                    if (id != 0)//修改或添加商邀资料
                     {
-                        id = await AddAsyncReturnId(grp_Invitation);
-                        if (id != 0)//修改或添加商邀资料
+                        Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+                        res_InvitationData.Country = dto.InviterArea;
+                        res_InvitationData.UnitName = dto.Inviter;
+                        res_InvitationData.Delegation = dto.DiId.ToString();
+                        Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
+                            (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
+                        if (ifNullUp == null)///添加或修改商邀资料
                         {
-                            Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
-                            res_InvitationData.Country = dto.InviterArea;
-                            res_InvitationData.UnitName = dto.Inviter;
-                            res_InvitationData.Delegation = dto.DiId.ToString();
-                            Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
-                                (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName && a.IsDel == 0);
-                            if (ifNullUp == null)///添加或修改商邀资料
+                            res_InvitationData.Remark = dto.OtherInformation;
+                            int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                            if (DataID != 0)
                             {
-                                res_InvitationData.Remark = dto.OtherInformation;
-                                int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
-                                if (DataID != 0)
-                                {
-                                    result = new Result() { Code = 0, Msg = "添加成功!" };
-                                }
-                                else
-                                {
-                                    RollbackTran();
-                                    result = new Result() { Code = -1, Msg = "添加失败!" };
-                                }
-
+                                result = new Result() { Code = 0, Msg = "添加成功!" };
                             }
                             else
                             {
-                                int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
-                                {
-                                    Contact = dto.Contact,
-                                    Tel = dto.Tel,
-                                    Email = dto.Email,
-                                    Fax = dto.Fax,
-                                    Address = dto.Address,
-                                    Remark = dto.OtherInformation,
-                                }).ExecuteCommandAsync();
+                                RollbackTran();
+                                result = new Result() { Code = -1, Msg = "添加失败!" };
                             }
 
-                            Grp_CreditCardPayment C = new Grp_CreditCardPayment();
-                            C.PayDId = dto.PayDId;
-                            if (C.PayDId == 72) C.IsPay = 1;
-                            else C.IsPay = 0;
+                        }
+                        else
+                        {
+                            int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
+                            {
+                                Contact = dto.Contact,
+                                Tel = dto.Tel,
+                                Email = dto.Email,
+                                Fax = dto.Fax,
+                                Address = dto.Address,
+                                Remark = dto.OtherInformation,
+                            }).ExecuteCommandAsync();
+                        }
 
-                            C.ConsumptionPatterns = dto.ConsumptionPatterns;
-                            C.ConsumptionDate = dto.ConsumptionDate;
-                            C.CTDId = dto.CTDId;
-                            C.BankNo = dto.BankNo;
-                            C.CardholderName = dto.CardholderName;
-                            C.PayMoney = dto.PayMoney;
-                            C.PaymentCurrency = dto.PaymentCurrency;
-                            C.CompanyBankNo = dto.CompanyBankNo;
-                            C.OtherBankName = dto.OtherBankName;
-                            C.OtherSideNo = dto.OtherSideNo;
-                            C.OtherSideName = dto.OtherSideName;
-                            C.Remark = "";
-                            C.CreateUserId = dto.CreateUserId;
-                            C.MFOperator = 0;
-                            C.MFOperatorDate = "";
-                            C.IsAuditDM = 0;
-                            C.AuditDMOperate = 0;
-                            C.AuditDMDate = "";
-                            C.IsAuditMF = 0;
-                            C.AuditMFOperate = 0;
-                            C.AuditMFDate = "";
-                            C.IsAuditGM = 0;
-                            C.AuditGMOperate = 0;
-                            C.AuditGMDate = "";
-                            //C.IsPay = 0;
-                            C.DIId = dto.DiId;
-                            C.CId = id;
-                            C.CTable = 81;
-                            C.PayPercentage = 100;
-                            C.PayThenMoney = 0;
-                            C.PayPercentageOld = 0;
-                            C.PayThenMoneyOld = 0;
-                            C.UpdateDate = "";
-                            C.Payee = dto.Payee;
-                            C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
-                            C.ExceedBudget = 0;
+                        Grp_CreditCardPayment C = new Grp_CreditCardPayment();
+                        C.PayDId = dto.PayDId;
+                        if (C.PayDId == 72) C.IsPay = 1;
+                        else C.IsPay = 0;
 
-                            //获取新汇率  int diId,int CId, int currencyId
-                            var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
+                        C.ConsumptionPatterns = dto.ConsumptionPatterns;
+                        C.ConsumptionDate = dto.ConsumptionDate;
+                        C.CTDId = dto.CTDId;
+                        C.BankNo = dto.BankNo;
+                        C.CardholderName = dto.CardholderName;
+                        C.PayMoney = dto.PayMoney;
+                        C.PaymentCurrency = dto.PaymentCurrency;
+                        C.CompanyBankNo = dto.CompanyBankNo;
+                        C.OtherBankName = dto.OtherBankName;
+                        C.OtherSideNo = dto.OtherSideNo;
+                        C.OtherSideName = dto.OtherSideName;
+                        C.Remark = "";
+                        C.CreateUserId = dto.CreateUserId;
+                        C.MFOperator = 0;
+                        C.MFOperatorDate = "";
+                        C.IsAuditDM = 0;
+                        C.AuditDMOperate = 0;
+                        C.AuditDMDate = "";
+                        C.IsAuditMF = 0;
+                        C.AuditMFOperate = 0;
+                        C.AuditMFDate = "";
+                        C.IsAuditGM = 0;
+                        C.AuditGMOperate = 0;
+                        C.AuditGMDate = "";
+                        //C.IsPay = 0;
+                        C.DIId = dto.DiId;
+                        C.CId = id;
+                        C.CTable = 81;
+                        C.PayPercentage = 100;
+                        C.PayThenMoney = 0;
+                        C.PayPercentageOld = 0;
+                        C.PayThenMoneyOld = 0;
+                        C.UpdateDate = "";
+                        C.Payee = dto.Payee;
+                        C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
+                        C.ExceedBudget = 0;
 
-                            if (rate.Code == 0)
-                            {
-                                var rateInfo = (rate.Data as CurrencyInfo);
-                                if (rateInfo is not null)
-                                {
+                        //获取新汇率  int diId,int CId, int currencyId
+                        var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
 
-                                    C.DayRate = rateInfo.Rate;
-                                    C.RMBPrice = rateInfo.Rate * C.PayMoney;
-                                }
-                                else
-                                {
-                                    C.DayRate = 1;
-                                    C.RMBPrice = C.PayMoney;
-                                }
-                            }
-
-                            int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
-                            var data = new { ccpId = cId, sign = 1 };
-                            if (cId != 0)
+                        if (rate.Code == 0)
+                        {
+                            var rateInfo = (rate.Data as CurrencyInfo);
+                            if (rateInfo is not null)
                             {
-                                result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+
+                                C.DayRate = rateInfo.Rate;
+                                C.RMBPrice = rateInfo.Rate * C.PayMoney;
                             }
                             else
                             {
-                                RollbackTran();
-                                result = new Result() { Code = -1, Msg = "添加失败!" };
+                                C.DayRate = 1;
+                                C.RMBPrice = C.PayMoney;
                             }
                         }
+
+                        int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
+                        var data = new { ccpId = cId, sign = 1 };
+                        if (cId != 0)
+                        {
+                            result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
+                        }
+                        else
+                        {
+                            RollbackTran();
+                            result = new Result() { Code = -1, Msg = "添加失败!" };
+                        }
                     }
+                    
                 }
                 else//修改
                 {