Browse Source

公务提成添加++

yuanrf 2 months ago
parent
commit
643237e182

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

@@ -5615,6 +5615,9 @@ Group by PriceType ", dto.diId);
                 const int payingOfficial = 50;      // 付费单公务   50
                 const int notPayingOfficial = 200;  // 不付费单场公务 200
 
+                const int payInvitation = 100;    // 付费单邀请函  100元 / 份  一个国家只发放一份邀请函费用
+                const int notpayInvitation = 400; // 不付费邀请函  400 / 份   一个国家只发放一份邀请函费用,多拿的邀请函不进行叠加
+
                 //不付费邀请函  400 / 份   一个国家只发放一份邀请函费用,多拿的邀请函不进行叠加
                 //不付费单场公务 200 / 场 / 团 按照标准公务完成要求,确认实际场数
                 //付费单邀请函  100元 / 份  一个国家只发放一份邀请函费用
@@ -5640,6 +5643,7 @@ Group by PriceType ", dto.diId);
                                                 a.IsSure,
                                                 x.IsPay, // 是否付费
                                                 a.VisitPNumber,
+                                                x.OfficialForm,
                                             })
                                             .ToList();
 
@@ -5653,17 +5657,47 @@ Group by PriceType ", dto.diId);
 
                     var infos = new List<string>();
 
+                    var existsCountry = new List<string>(); //邀请函国家判断 
+
                     foreach (var item in group)
                     {
-                        if (item.IsPay == 1) //付费公务
+                        if (item.OfficialForm == 1338 || item.OfficialForm == 384) // 调研 / 参观性质点位  50 / 场 / 团
                         {
-                            infos.Add($"{item.Client} 为付费公务提成金额为 {payingOfficial}");
-                            money += payingOfficial;
+                            infos.Add($"{item.Client}为调研 / 参观性质点位,提成金额为50");
+                            money += 50;
+                            continue;
                         }
-                        else
+
+                        //0带公务 1不带公务 2纯公务
+                        if (item.Type == 0)
+                        {
+                            if (!existsCountry.Contains(item.Country))
+                            {
+                                if (item.IsPay == 1) //付费邀请函
+                                {
+                                    infos.Add($"{item.Client} 为付费邀请函,提成金额为 {payInvitation}");
+                                    money += payingOfficial;
+                                }
+                                else
+                                {
+                                    infos.Add($"{item.Client} 为非付费邀请函,提成金额为 {notpayInvitation}");
+                                    money += notPayingOfficial;
+                                }
+                            }
+
+                        }
+                        else if(item.Type == 2)
                         {
-                            infos.Add($"{item.Client} 为非付费公务提成金额为 {notPayingOfficial}");
-                            money += notPayingOfficial;
+                            if (item.IsPay == 1) //付费公务
+                            {
+                                infos.Add($"{item.Client} 为付费公务,提成金额为 {payingOfficial}");
+                                money += payingOfficial;
+                            }
+                            else
+                            {
+                                infos.Add($"{item.Client} 为非付费公务,提成金额为 {notPayingOfficial}");
+                                money += notPayingOfficial;
+                            }
                         }
                     }
 

+ 54 - 0
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -804,6 +804,60 @@ namespace OASystem.API.Controllers
             return Ok(count);
         }
 
+        [HttpPost]
+        public IActionResult ReassignCustomers()
+        {
+            var user_Client = _sqlSugar.Queryable<Crm_ClientDataAndUser>()
+                      .Where(x => x.usersId == 302 && x.IsDel == 0)
+                      .Select(x=>new
+                      {
+                          x.Id,
+                          x.NewClientDataId
+                      })
+                      .ToList();
+            var ids = user_Client.Select(x=>x.NewClientDataId).ToList();
+
+            string setDataSql = $"select * from Sys_SetData where STid = 33 and isdel = 0 and (Name like '%重庆%')  ";
+
+            var setDataids =  _sqlSugar.SqlQueryable<Sys_SetData>(setDataSql).Select(x => x.Id).ToList();
+
+            var clients = _sqlSugar.Queryable<Crm_NewClientData>().Where(x => ids.Contains(x.Id) && setDataids.Contains(x.Lvlid) && x.IsDel == 0).ToList();
+
+            var clients_ids = clients.Select(x=>x.Id).ToList();
+
+            int updateCount = 0;
+
+            _sqlSugar.BeginTran();
+
+            if (clients.Count == 223)
+            {
+
+               updateCount =  _sqlSugar.Updateable<Crm_ClientDataAndUser>()
+                         .Where(x => x.usersId == 302 && clients_ids.Contains(x.NewClientDataId) && x.IsDel == 0)
+                         .SetColumns( x => new Crm_ClientDataAndUser
+                         {
+                             usersId = 21
+                         })
+                         .ExecuteCommand();
+            }
+
+            if (updateCount == clients.Count)
+            {
+                _sqlSugar.CommitTran();
+            }
+            else
+            {
+                _sqlSugar.RollbackTran();
+            }
+
+
+            return Ok( new
+            {
+                count = clients.Count,
+                updateCount,
+            });
+        }
+
         [HttpPost]
         public IActionResult InsertDataJiang()
         {