| 
					
				 | 
			
			
				@@ -1,9 +1,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using Microsoft.AspNetCore.Mvc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using FreeScheduler; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Authorization; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Mvc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Newtonsoft.Json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using NPOI.SS.Formula.Functions; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Linq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Threading; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Threading.Tasks; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using ZhonTai.Admin.Core.Consts; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using ZhonTai.Admin.Core.Dto; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,7 +26,7 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     [Order(10)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     [DynamicApi(Area = AdminConsts.AreaName)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public partial class ProjectPriceService : BaseService, IProjectService, IDynamicApi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public partial class ProjectPriceService : BaseService, IProjectPriceService, IDynamicApi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly IProjectRepository _projectRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly IProjectPriceRepository _projectPriceRepository; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,8 +53,9 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             await ProjectPriceInitAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var list = await _projectConfigRepository.Select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .Where(m => m.ProjectId == 0 && m.ProjectPriceId == 0 && m.Status == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .OrderByDescending(m=>m.EffectDate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where(m => m.ProjectId == 0 && m.ProjectPriceId == 0 && m.DrawType == 1 && m.Status == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .OrderByDescending(m => m.EffectDate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .ToListAsync(a => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 a.Id, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -62,14 +67,14 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DateTime dtnow = DateTime.Today; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var next = list[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var current = list[1];                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                output.CurrentRatio = current.DrawRatio; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var current = list[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                output.CurrentRatio = current.DrawRatio.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 output.NextRatio = next.DrawRatio; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 output.NextEffectDate = next.EffectDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                output.CurrentRatio = list[0].DrawRatio;                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                output.CurrentRatio = list[0].DrawRatio.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return output; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -84,8 +89,9 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CheckDrawRatioEffect(input.EffectDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //删除旧的未生效记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.DrawType == 1 && m.ProjectId == 0 && m.ProjectPriceId == 0 && m.Status == 1 && m.EffectDate > DateTime.Today) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var dtDay = DateTime.Today; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //删除旧的未生效记录             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.DrawType == 1 && m.ProjectId == 0 && m.ProjectPriceId == 0 && m.Status == 1 && m.EffectDate > dtDay) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .ToListAsync(m => m.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (listDeleteId.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -115,7 +121,7 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [HttpPost] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<PageOutput<GetProjectPricePageOutput>> GetProjectPageAsync(PageInput<GetProjectPricePageInput> input) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var list = await _projectRepository.Select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var list = await _projectRepository.Select.DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .Count(out var total) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .OrderByDescending(true, a => a.Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             .Page(input.CurrentPage, input.PageSize) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -124,7 +130,8 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = a.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Name = a.Name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Logo = a.Logo, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Prices = _projectPriceRepository.Select.Where(m => m.ProjectId == a.Id).ToList<PriceGetPageOutput_Price>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Status = a.Status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Prices = _projectPriceRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == a.Id).ToList<PriceGetPageOutput_Price>(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var data = new PageOutput<GetProjectPricePageOutput>() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -144,7 +151,14 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public async Task<long> SetProjectPriceAsync(ProjectPriceSetInput input) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //验证项目价格信息是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var price = await _projectPriceRepository.GetAsync(input.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var price = await _projectPriceRepository.Select.DisableGlobalFilter(FilterNames.Tenant).From<ProjectEntity>().LeftJoin((pp, p) => pp.ProjectId == p.Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where((pp, p) => pp.Id == input.Id).ToOneAsync((pp, p) => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.Price, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    p.Status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!(price?.Id > 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw ResultOutput.Exception("信息不存在,请刷新后重试!"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -153,12 +167,12 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw ResultOutput.Exception("无效的设价方式!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            decimal amount = input.DrawPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            decimal? amount = input.DrawPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (input.DrawPriceWay == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 CheckDrawRatio(input.DrawRatio); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                amount = GetDrawAmount(price.Price, input.DrawRatio); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                amount = GetDrawAmount(price.Price, input.DrawRatio.Value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else if (input.DrawPriceWay == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,28 +182,59 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw ResultOutput.Exception("设置有效的抽成金额"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //覆盖已经存在未生效的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == price.ProjectId && m.ProjectPriceId == price.Id && m.Status == 1 && m.EffectDate > DateTime.Today && m.DrawType == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           .ToListAsync(m => m.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (listDeleteId.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                await _projectConfigRepository.SoftDeleteAsync(m => listDeleteId.Contains(m.Id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (price.Status != 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                CheckDrawRatioEffect(input.EffectDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var effectDate = input.EffectDate.HasValue ? input.EffectDate : DateTime.Today.AddDays(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //项目没有上架可以直接启用设价信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (price.Status == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                EffectDate = effectDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawType = 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                TenantId = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectPriceRepository.UpdateDiy.SetDto(new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawPriceWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawPrice = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }).Where(m => m.Id == price.Id).DisableGlobalFilter(FilterNames.Tenant).ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //新增记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawType = 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantId = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    IsDeleted = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //覆盖已经存在未生效的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == price.ProjectId && m.ProjectPriceId == price.Id && m.Status == 1 && m.EffectDate > DateTime.Today && m.DrawType == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               .ToListAsync(m => m.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (listDeleteId.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    await _projectConfigRepository.SoftDeleteAsync(m => listDeleteId.Contains(m.Id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var effectDate = input.EffectDate.HasValue ? input.EffectDate : DateTime.Today.AddDays(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    EffectDate = effectDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawType = 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantId = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -224,7 +269,15 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Id = a.TenantId.Value, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Name = a.Name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                prices = _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == projectId && m.TenantId == a.TenantId && m.Status == 1 & m.DrawType == 3).ToList<TenantPriceGetPageOutput_Price>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                prices = _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == projectId && m.TenantId == a.TenantId && m.Status == 1 && m.DrawType == 3).ToList<TenantPriceGetPageOutput_Price>(m =>new TenantPriceGetPageOutput_Price 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectId=m.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectPriceId=m.ProjectPriceId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawPriceWay=m.DrawWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio=m.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawPrice=m.DrawAmount 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //项目信息同平台信息合并 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach (var item in list) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -282,26 +335,35 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw ResultOutput.Exception("无效的设价方式!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //验证平台是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var tenant = await _tenantRepository.GetAsync(input.TenatntId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var tenant = await _tenantRepository.Select.DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where(m => m.Id == input.TenatntId).ToOneAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!(tenant?.Id > 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw ResultOutput.Exception("平台不存在,请刷新后重试!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //验证项目价格信息是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var price = await _projectPriceRepository.GetAsync(input.ProjectPriceId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var price = await _projectPriceRepository.Select.DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .From<ProjectEntity>().LeftJoin((pp, p) => pp.ProjectId == p.Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .Where((pp, p) => pp.Id == input.ProjectPriceId).ToOneAsync((pp, p) => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.Price, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    pp.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    p.Status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!(price?.Id > 0)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw ResultOutput.Exception("项目信息不存在,请刷新后重试!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var amount = input.DrawPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (input.DrawPriceWay == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //抽成比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 CheckDrawRatio(input.DrawRatio); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                amount = GetDrawAmount(price.Price, input.DrawRatio); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                amount = GetDrawAmount(price.Price, input.DrawRatio.Value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else if (input.DrawPriceWay == 2) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -310,35 +372,173 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (input.DrawPrice > price.Price || input.DrawPrice < 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     throw ResultOutput.Exception("设置有效的抽成金额"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }                
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //覆盖已经存在未生效的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.ProjectId == price.ProjectId && m.ProjectPriceId == price.Id && m.Status == 1 && m.EffectDate > DateTime.Today && m.DrawType == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-           .ToListAsync(m => m.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (listDeleteId.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //生效时间验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (price.Status != 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                await _projectConfigRepository.SoftDeleteAsync(m => listDeleteId.Contains(m.Id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                CheckDrawRatioEffect(input.EffectDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //待上线项目直接生效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (price.Status == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectConfigRepository.UpdateDiy.DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetDto(new { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        IsDeleted = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(m => m.ProjectId == price.ProjectId && m.ProjectPriceId == price.Id && m.TenantId == input.TenatntId && m.Status == 1 && m.DrawType == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var effectDate = DateTime.Today; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    EffectDate = effectDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawType = 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantId = input.TenatntId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //覆盖已经存在未生效的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var listDeleteId = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(m => m.ProjectId == price.ProjectId && m.ProjectPriceId == price.Id && m.Status == 1 &&m.TenantId==input.TenatntId&& m.EffectDate > DateTime.Today && m.DrawType == 3) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               .ToListAsync(m => m.Id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (listDeleteId.Count > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    await _projectConfigRepository.SoftDeleteAsync(m => listDeleteId.Contains(m.Id)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var effectDate = input.EffectDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    EffectDate = effectDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawType = 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantId = input.TenatntId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var effectDate = input.EffectDate.HasValue ? input.EffectDate : DateTime.Today.AddDays(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            await _projectConfigRepository.InsertAsync(new ProjectConfigEntity() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        #region 定时任务 每天凌晨执行一次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 执行公司抽成任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpGet] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [AllowAnonymous] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task ExecuteTaskCompanyDraw() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var dtDay = DateTime.Today; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var list = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.DrawType == 1 && m.Status == 1 && m.EffectDate == dtDay).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (list != null && list.Count == 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ProjectId = price.ProjectId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ProjectPriceId = price.Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawWay = input.DrawPriceWay, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawRatio = input.DrawRatio, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawAmount = amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                EffectDate = effectDate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DrawType = 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                TenantId = input.TenatntId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //之前的数据失效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var result = await _projectConfigRepository.UpdateDiy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetDto(new { Status = 2 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(m => m.ProjectId == 0 && m.ProjectPriceId == 0 && m.TenantId == 0 && m.DrawType == 1 && m.Status == 1 && m.EffectDate < dtDay) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (result > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception($"成功执行{result}条数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception("执行失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("无需执行数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 执行抽成项目任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpGet] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [AllowAnonymous] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task ExecuteTaskProjectDraw() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var list = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.DrawType == 2 && m.Status == 1 && m.EffectDate == DateTime.Today).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (list != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //数据挪项目中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                foreach (var item in list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    await _projectPriceRepository.UpdateDiy.SetDto(new ProjectPriceEntity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }).Where(m => m.Id == item.ProjectPriceId && m.ProjectId == item.ProjectId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //之前的数据失效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var result = await _projectConfigRepository.UpdateDiy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetDto(new { Status = 2 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(m => m.DrawType == 2 && m.Status == 1 && m.EffectDate < DateTime.Today) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (result > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception($"成功执行{result}条数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception("执行失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("无需执行数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 执行抽成平台任务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpGet] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [AllowAnonymous] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task ExecuteTasDrawTenant() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var list = await _projectConfigRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.DrawType == 3 && m.Status == 1 && m.EffectDate == DateTime.Today).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (list != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            {                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //之前的数据失效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var result = await _projectConfigRepository.UpdateDiy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .DisableGlobalFilter(FilterNames.Tenant) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .SetDto(new { Status = 2 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .Where(m => m.DrawType == 3 && m.Status == 1 && m.EffectDate < DateTime.Today) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .ExecuteAffrowsAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (result > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception($"成功执行{result}条数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw ResultOutput.Exception("执行失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("无需执行数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -348,8 +548,12 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 校验抽成比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="drawRatio"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void CheckDrawRatio(decimal drawRatio) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void CheckDrawRatio(decimal? drawRatio) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!drawRatio.HasValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("抽成比例有效范围在0-100"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //抽成比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (drawRatio < 0 || drawRatio > 100) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,8 +564,11 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 校验抽成比例生效时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="effectDate"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void CheckDrawRatioEffect(DateTime effectDate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void CheckDrawRatioEffect(DateTime? effectDate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!effectDate.HasValue) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("请设置生效时间"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //生效时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (effectDate <= DateTime.Today) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -391,7 +598,9 @@ namespace ZhonTai.Admin.Services.Project 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ProjectPriceId = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DrawRatio = 5, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     EffectDate = DateTime.Today, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Status = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    TenantId = -1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Status = 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrawWay = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |