Bläddra i källkod

市场客户资料修改,商邀费用修改

yuanrf 3 månader sedan
förälder
incheckning
5fbeb35716

+ 42 - 1
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -14,12 +14,14 @@ namespace OASystem.API.Controllers
     public class MarketCustomerResourcesController : ControllerBase
     {
         private readonly NewClientDataRepository _clientDataRepository;
+        private readonly SqlSugarClient _sqlSugar;
         /// <summary>
         /// 初始化
         /// </summary>
-        public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository)
+        public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository, SqlSugarClient sqlSugar)
         {
             this._clientDataRepository = clientDataRepository;
+            _sqlSugar = sqlSugar;
         }
 
         /// <summary>
@@ -314,5 +316,44 @@ namespace OASystem.API.Controllers
             }
             return Ok(JsonView(true, "操作成功!"));
         }
+
+        [HttpPost]
+        
+        public IActionResult QueryClientType(QueryClientTypeDto Dto)
+        {
+            var jw = JsonView(true,"获取成功!");
+            Dictionary<int,List<int>> keyValuePairs = new Dictionary<int,List<int>>();
+            keyValuePairs.Add(419, new List<int>() //四川
+            {
+                376,377,378,381,382,387,388,389,390,753,754
+            });
+            keyValuePairs.Add(420, new List<int>() //云南
+            {
+                407,408,409,410,449,451,452,453,567,754
+            });
+            keyValuePairs.Add(421, new List<int>() { 424, 425, 426, 427, 428, 429, 754 }); // 贵州
+            keyValuePairs.Add(422, new List<int>() { 415, 416, 754 }); // 西藏
+            keyValuePairs.Add(423, new List<int>() { 417, 418, 454, 456, 754 }); // 重庆
+            keyValuePairs.Add(578, new List<int>() { 581, 582, 583, 754 }); // 青海
+            keyValuePairs.Add(605, new List<int>() { 588, 589, 590, 591, 592, 593, 754 }); // 陕西
+            keyValuePairs.Add(606, new List<int>() { 597, 598, 599, 600, 601, 602, 603, 604, 754 }); // 宁夏
+            keyValuePairs.Add(625, new List<int>() { 617, 618, 619, 620, 621, 622, 622, 623, 624, 754 }); // 甘肃
+            keyValuePairs.Add(634, new List<int>() { 455, 630, 631, 632, 633, 754 }); // 新疆
+
+
+            if (keyValuePairs.Keys.Contains(Dto.SetDataId))
+            {
+                jw.Data = _sqlSugar.Queryable<Sys_SetData>()
+                    .Where(u => keyValuePairs[Dto.SetDataId].Contains(u.Id) && u.IsDel == 0 )
+                    .Select(x => new { x.Id, x.Name }).ToList();
+            }
+            else
+            {
+                jw.Data = _sqlSugar.Queryable<Sys_SetData>()
+                    .Where(u => u.STid == 37 && u.IsDel == 0)
+                    .Select(x => new { x.Id, x.Name }).ToList(); 
+            }
+            return Ok(jw);
+        }
     }
 }

+ 5 - 0
OASystem/OASystem.Domain/Dtos/CRM/NewClientDataQueryDto.cs

@@ -222,4 +222,9 @@ namespace OASystem.Domain.Dtos.CRM
     {
        public int UserId { get; set;}
     }
+
+    public class QueryClientTypeDto
+    {
+        public int SetDataId { get; set; }
+    }
 }

+ 5 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_InvitationOfficialActivities.cs

@@ -95,5 +95,10 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int IsGoOfficaiaBussiness { get; set; }
+
+        /// <summary>
+        /// 资料关联id
+        /// </summary>
+        public int DataId { get; set; }
     }
 }

+ 93 - 113
OASystem/OASystem.Infrastructure/Repositories/Groups/InvitationOfficialActivitiesRepository.cs

@@ -309,129 +309,94 @@ Order By i.id  Desc ", sqlWhere);
             grp_Invitation.Attachment = filePath;
             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 = "该数据已存在,请勿重复添加!" };
-                //}
+                #region 添加资料
+                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_InvitationData.Remark = dto.OtherInformation;
+                EncryptionProcessor.EncryptProperties(res_InvitationData);
+                int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
+                grp_Invitation.DataId = DataID;
+                #endregion
 
                 id = await AddAsyncReturnId(grp_Invitation);
-                if (id != 0)//修改或添加商邀资料
+
+                #region C表数据添加
+                Grp_CreditCardPayment C = new Grp_CreditCardPayment();
+                C.PayDId = dto.PayDId;
+                if (C.PayDId == 72) C.IsPay = 1;
+                else C.IsPay = 0;
+
+                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.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;
+
+                //获取新汇率  int diId,int CId, int currencyId
+                var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
+
+                if (rate.Code == 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();
-                    EncryptionProcessor.EncryptProperties(res_InvitationData);
-                    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)///添加或修改商邀资料
+                    var rateInfo = (rate.Data as CurrencyInfo);
+                    if (rateInfo is not null)
                     {
-                        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 = "添加失败!" };
-                        }
 
+                        C.DayRate = rateInfo.Rate;
+                        C.RMBPrice = rateInfo.Rate * C.PayMoney;
                     }
                     else
                     {
-                        int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
-                                                    .Where(a => a.Id == ifNullUp.Id)
-                                                    .SetColumns(a => new Res_InvitationOfficialActivityData
-                                                    {
-                                                        Address = res_InvitationData.Address,
-                                                        Contact = res_InvitationData.Contact,
-                                                        Job = res_InvitationData.Job,
-                                                        Tel = res_InvitationData.Tel,
-                                                        Email = res_InvitationData.Email,
-                                                        Fax = res_InvitationData.Fax,
-                                                        //OtherInfo = res_InvitationData.OtherInformation,
-                                                        //Remark = res_InvitationData.Remark,
-                                                    })
-                                                    .ExecuteCommandAsync();
+                        C.DayRate = 1;
+                        C.RMBPrice = C.PayMoney;
                     }
+                }
 
-                    Grp_CreditCardPayment C = new Grp_CreditCardPayment();
-                    C.PayDId = dto.PayDId;
-                    if (C.PayDId == 72) C.IsPay = 1;
-                    else C.IsPay = 0;
-
-                    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.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;
-
-                    //获取新汇率  int diId,int CId, int currencyId
-                    var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
-
-                    if (rate.Code == 0)
-                    {
-                        var rateInfo = (rate.Data as CurrencyInfo);
-                        if (rateInfo is not null)
-                        {
+                int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
+                #endregion
 
-                            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)
-                    {
-                        result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
-                    }
-                    else
-                    {
-                        RollbackTran();
-                        result = new Result() { Code = -1, Msg = "添加失败!" };
-                    }
+                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//修改
             {
@@ -461,9 +426,24 @@ Order By i.id  Desc ", sqlWhere);
                     res_InvitationData.Country = dto.InviterArea;
                     res_InvitationData.UnitName = dto.Inviter;
                     res_InvitationData.Delegation = dto.DiId.ToString();
+                    res_InvitationData.Remark = dto.OtherInformation;
                     EncryptionProcessor.EncryptProperties(res_InvitationData);
-                    Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
+
+                    Res_InvitationOfficialActivityData ifNullUp = null;
+                    var InvitationOfficialActivities_DB = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>()
+                                                                    .First(x => x.Id == grp_Invitation.Id && x.IsDel == 0);
+
+                    if (InvitationOfficialActivities_DB.DataId > 0)
+                    {
+                        ifNullUp = _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
+                                            .First(x => x.Id == InvitationOfficialActivities_DB.DataId && x.IsDel == 0);
+                    }
+                    else
+                    {
+                        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)///添加或修改商邀资料
                     {
                         int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
@@ -489,7 +469,7 @@ Order By i.id  Desc ", sqlWhere);
                                                         Email = res_InvitationData.Email,
                                                         Fax = res_InvitationData.Fax,
                                                         Address = res_InvitationData.Address,
-                                                        //Remark = res_InvitationData.OtherInformation,
+                                                        Remark = res_InvitationData.Remark,
                                                     })
                                                     .ExecuteCommandAsync();
                     }