username@email.com
2024-12-26 90858c80d9921b555119f41060c1f883f6e6ffc5
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();