Browse Source

租户信息完善

zmq 1 year ago
parent
commit
30c47f2e92

+ 7 - 1
.gitignore

@@ -397,4 +397,10 @@ FodyWeavers.xsd
 # JetBrains Rider
 *.sln.iml
 
-**/wwwroot/upload
+**/wwwroot/upload
+/src/hosts/ZhonTai.Host/wwwroot/kuake/20230605
+/src/hosts/ZhonTai.Host/wwwroot/stat
+/src/hosts/ZhonTai.Host/wwwroot/project
+/src/platform/ZhonTai.Admin/Services/Platform/Dto/PlatformUserGetPageDto.cs
+/src/hosts/ZhonTai.Host/wwwroot/link
+*.jpg

+ 4 - 3
src/hosts/ZhonTai.Host/Configs/appconfig.json

@@ -40,9 +40,9 @@
     "url": "http://localhost:8000",
     "projects": [
       {
-        "name": "中台Admin",
+        "name": "地推管理系统",
         "code": "admin",
-        "version": "v3.6.5",
+        "version": "v0.0.1",
         "description": ""
       }
     ]
@@ -56,7 +56,8 @@
     //页脚
     "footer": {
       "enable": false,
-      "content": "Copyright<a-icon type=\"copyright\" /> 2022-<a target=\"_blank\" href=\"https://www.zhontai.net\">中台Admin</a>"
+      //"content": "Copyright<a-icon type=\"copyright\" /> 2022-<a target=\"_blank\" href=\"https://www.zhontai.net\">中台Admin</a>"
+      "content": ""
     }
   },
   //MiniProfiler性能分析器

+ 18 - 0
src/platform/ZhonTai.Admin/Services/Platform/Dto/PlatformUserListOutput.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.Platform.Dto
+{
+    public class PlatformUserListOutput
+    {
+        public string OrgName { get; set; }
+        public string Name { get; set; }
+        public DateTime CreatedTime { get; set; }
+        public decimal TotalAmount { get; set; }
+        public string Phone { get; set; }
+        public string WechatAccount { get; set; }
+    }
+}

+ 1 - 1
src/platform/ZhonTai.Admin/Services/Platform/IPlatformUserService.cs

@@ -9,6 +9,6 @@ namespace ZhonTai.Admin.Services.Platform
 {
     public interface IPlatformUserService
     {
-        Task<dynamic> LoginAsync(AuthLoginInput input);
+        //Task<dynamic> LoginAsync(AuthLoginInput input);
     }
 }

+ 63 - 4
src/platform/ZhonTai.Admin/Services/Platform/PlatformUserService.cs

@@ -1,12 +1,71 @@
-using System;
+using Microsoft.AspNetCore.Mvc;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Consts;
+using ZhonTai.Admin.Core.Dto;
+using ZhonTai.Admin.Domain.Org;
+using ZhonTai.Admin.Domain.Platform;
+using ZhonTai.Admin.Domain.Tenant;
+using ZhonTai.Admin.Repositories.Platform;
+using ZhonTai.Admin.Services.Platform.Dto;
+using ZhonTai.DynamicApi;
+using ZhonTai.DynamicApi.Attributes;
 
 namespace ZhonTai.Admin.Services.Platform
-{
-    internal class PlatformUserService
+{    
+    /// <summary>
+    /// 平台用户服务
+    /// </summary>
+    [DynamicApi(Area = AdminConsts.AreaName)]
+    public class PlatformUserService : BaseService, IPlatformUserService, IDynamicApi
     {
+        private IPlatformUserRepository _platformUserRepository => LazyGetRequiredService<PlatformUserRepository>();
+        private IUserBillsRepository _userBillsRepository => LazyGetRequiredService<UserBillsRepository>();
+
+        public PlatformUserService()
+        {
+        }        
+
+        /// <summary>
+        /// 查询分页
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<PageOutput<PlatformUserListOutput>> GetPageAsync(PageInput<PlatformUserGetPageDto> input)
+        {
+            
+            var TenantId = input.Filter?.TenantId;
+            var Keyword = input.Filter?.Keyword;
+            
+
+            var list = await _platformUserRepository.Select.From<TenantEntity,OrgEntity>()
+                .LeftJoin((u,t,o)=>u.TenantId==t.Id)
+                .LeftJoin((u, t, o) => t.OrgId == o.Id)
+            .WhereIf(TenantId.HasValue && TenantId >= 0, (u, t, o) => u.TenantId == TenantId)
+            .WhereIf(!string.IsNullOrEmpty(Keyword), (u, t, o) => u.Name == Keyword||u.Phone.Contains(Keyword))
+            .Count(out var total)            
+            .OrderByDescending((u, t, o) => u.Id)
+            .Page(input.CurrentPage, input.PageSize)
+            .ToListAsync((u, t, o)=>new PlatformUserListOutput() {
+                OrgName = o.Name,
+                Name =u.Name,                
+                Phone=u.Phone,
+                WechatAccount=u.Phone,
+                TotalAmount= _userBillsRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m=>m.UserId==u.Id).Sum(m=>m.Commission),
+                CreatedTime=u.CreatedTime.Value
+            });
+
+            var data = new PageOutput<PlatformUserListOutput>()
+            {
+                List = list,
+                Total = total
+            };
+
+            return data;
+        }        
     }
-}
+}

+ 8 - 0
src/platform/ZhonTai.Admin/Services/Tenant/Dto/TenantListOutput.cs

@@ -79,4 +79,12 @@ public class TenantListOutput
     /// H5域名
     /// </summary>
     public string H5WebSite { get; set; }
+    /// <summary>
+    /// 下级数量
+    /// </summary>
+    public long SubNum { get; set; }
+    /// <summary>
+    /// 累计佣金
+    /// </summary>
+    public decimal TotalAmount{ get; set; }
 }

+ 4 - 1
src/platform/ZhonTai.Admin/Services/Tenant/TenantService.cs

@@ -51,6 +51,7 @@ public class TenantService : BaseService, ITenantService, IDynamicApi
     private IPasswordHasher<UserEntity> _passwordHasher => LazyGetRequiredService<IPasswordHasher<UserEntity>>();
     private ITenantPkgRepository _tenantPkgRepository => LazyGetRequiredService<ITenantPkgRepository>();
     private IPlatformUserRepository _platformUserRepository => LazyGetRequiredService<PlatformUserRepository>();
+    private IUserBillsRepository _userBillsRepository => LazyGetRequiredService<UserBillsRepository>();
 
     public TenantService()
     {
@@ -110,7 +111,9 @@ public class TenantService : BaseService, ITenantService, IDynamicApi
             Phone = a.User.Mobile,
             Email = a.User.Email,
             Pkgs = a.Pkgs,   
-            H5WebSite=_appConfig.H5WebSite+a.Org.Code+"/"
+            H5WebSite=_appConfig.H5WebSite+a.Org.Code+"/",
+            SubNum=_platformUserRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m=>m.TenantId==a.Id&&m.Role!="2").Count(),
+            TotalAmount= _userBillsRepository.Select.DisableGlobalFilter(FilterNames.Tenant).Where(m => m.TenantId == a.Id).Sum(m=>m.Commission)            
         });
 
         var data = new PageOutput<TenantListOutput>()

+ 32 - 0
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -8720,6 +8720,28 @@
             映射配置
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Platform.Dto.PlatformUserGetPageDto.TenantId">
+            <summary>
+            平台Id
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Platform.Dto.PlatformUserGetPageDto.Keyword">
+            <summary>
+            关键字 姓名,手机号
+            </summary>
+        </member>
+        <member name="T:ZhonTai.Admin.Services.Platform.PlatformUserService">
+            <summary>
+            平台用户服务
+            </summary>
+        </member>
+        <member name="M:ZhonTai.Admin.Services.Platform.PlatformUserService.GetPageAsync(ZhonTai.Admin.Core.Dto.PageInput{ZhonTai.Admin.Services.Platform.Dto.PlatformUserGetPageDto})">
+            <summary>
+            查询分页
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="P:ZhonTai.Admin.Services.ProjectLink.Dto.ProjectLinkGetPageDto.ProjectId">
             <summary>
             项目Id
@@ -9961,6 +9983,16 @@
             H5域名
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Services.Tenant.Dto.TenantListOutput.SubNum">
+            <summary>
+            下级数量
+            </summary>
+        </member>
+        <member name="P:ZhonTai.Admin.Services.Tenant.Dto.TenantListOutput.TotalAmount">
+            <summary>
+            累计佣金
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Services.Tenant.Dto.TenantSelectListOutput.Id">
             <summary>
             主键