From 90858c80d9921b555119f41060c1f883f6e6ffc5 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 26 十二月 2024 12:49:35 +0800
Subject: [PATCH] 提交

---
 DocumentServiceAPI.Application/ProjectInfo/Services/SheZhiService.cs |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/DocumentServiceAPI.Application/ProjectInfo/Services/SheZhiService.cs b/DocumentServiceAPI.Application/ProjectInfo/Services/SheZhiService.cs
index 97564cf..ab053ae 100644
--- a/DocumentServiceAPI.Application/ProjectInfo/Services/SheZhiService.cs
+++ b/DocumentServiceAPI.Application/ProjectInfo/Services/SheZhiService.cs
@@ -2,6 +2,7 @@
 using DocumentServiceAPI.Application.ProjectInfo.ViewMode;
 using DocumentServiceAPI.Application.Repository;
 using DocumentServiceAPI.Model.cyDocumentModel;
+using DocumentServiceAPI.Model.Permissions;
 using DocumentServiceAPI.Model.UserInfoModel;
 using DocumentServiceAPI.Utility;
 using MapsterMapper;
@@ -137,6 +138,18 @@
             }
             else
             {
+                var aaa = GetJwtInfo();
+                var tenantPermissions = _db.Queryable<TenantPermissions>().Where(x => x.IsDel == false && x.IsEn == true && x.TenantId == aaa.TEID.Value && x.PermissionsType == TenantPermissionsType.Manage).First();
+                if (tenantPermissions != null)
+                {
+                    var times = _db.Queryable<Document_TenderUnit>().Count(x => x.IsDeled == false && x.IsEn == true && x.TenantId == aaa.TEID.Value);
+                    if (tenantPermissions.UnitMaxCount > 0 && tenantPermissions.UnitMaxCount <= times)
+                    {
+                        throw new Exception("鎶曟爣鍗曚綅鏁伴噺瓒呭嚭鏈�澶у�硷紒鏃犳硶鏂板");
+                    }
+                }
+                dp.IsEn = true;
+                dp.IsDeled = false;
                 _db.Insertable<Document_TenderUnit>(dp).ExecuteCommand();
             }
 
@@ -281,7 +294,15 @@
             {
                 var aaa = GetJwtInfo();
 
-
+              var tenantPermissions =  _db.Queryable<TenantPermissions>().Where(x => x.IsDel == false && x.IsEn == true && x.TenantId == aaa.TEID.Value && x.PermissionsType == TenantPermissionsType.Manage).First();
+                if (tenantPermissions != null)
+                {
+                  var times  =  _db.Queryable<EmployeeAtTenant>().Count(x => x.IsDel == false && x.IsEn == true && x.TenantID == aaa.TEID.Value );
+                    if(tenantPermissions.EmployeeMaxCount>0 && tenantPermissions.EmployeeMaxCount<= times)
+                    {
+                        throw new Exception("鍛樺伐鏁伴噺瓒呭嚭鏈�澶у�硷紒鏃犳硶鏂板");
+                    }
+                }
 
                 dp.EmployeeId =  _db.Insertable<Document_EmployeeInfo>(document_EmployeeInfo).ExecuteReturnIdentity();
 

--
Gitblit v1.9.1