Browse Source

提交代码

master
anerx 4 months ago
parent
commit
2f0a5ae0a0
  1. 1
      Admin.Bodk.Device/Entities/Dto/SupportDto.cs
  2. 4
      Admin.Bodk.Device/Services/DeviceService.cs
  3. 35
      Admin.Bodk.Device/Services/SupportService.cs
  4. 13
      Admin.NET.Bodk.Cells/Admin.NET.Bodk.Cells.csproj
  5. 117
      Admin.NET.Bodk.Cells/CellService.cs
  6. 46
      Admin.NET.Bodk.Cells/Entities/CellEntity.cs
  7. 80
      Admin.NET.Bodk.Cells/Models/Cell.cs
  8. 4
      Admin.NET.Bodk.Core/Admin.NET.Bodk.Core.csproj
  9. 19
      Admin.NET.Bodk.Core/Devices/IDevice.cs
  10. 8
      Admin.NET.Bodk.Core/Entities/OrgEntityBase.cs
  11. 69
      Admin.NET.Bodk.Core/ServiceBase.cs
  12. 1
      Admin.NET.Bodk.Customer/Admin.NET.Bodk.Customer.csproj
  13. 117
      Admin.NET.Bodk.Customer/CustomerService.cs
  14. 9
      Admin.NET.Bodk.Customer/Entities/CustomerEntity.cs
  15. 56
      Admin.NET.Bodk.Customer/Models/Customer.cs
  16. 1
      Admin.NET.Bodk.Device/Admin.NET.Bodk.Device.csproj
  17. 2
      Admin.NET.Bodk.Device/Controllers/DeviceController.cs
  18. 2
      Admin.NET.Bodk.Device/Controllers/Dto/DeviceDto.cs
  19. 79
      Admin.NET.Bodk.Device/DeviceService.cs
  20. 2
      Admin.NET.Bodk.Device/Devices/DeviceType.cs
  21. 36
      Admin.NET.Bodk.Device/Entities/DeviceEntity.cs
  22. 43
      Admin.NET.Bodk.Device/Models/Device.cs
  23. 1
      Admin.NET.Bodk.Genetic/Admin.NET.Bodk.Genetic.csproj
  24. 27
      Admin.NET.Bodk.Genetic/Entities/GeneticItemTestResultEntity.cs
  25. 35
      Admin.NET.Bodk.Genetic/Entities/GeneticTestResultEntity.cs
  26. 159
      Admin.NET.Bodk.Genetic/GeneticTestService.cs
  27. 18
      Admin.NET.Bodk.Genetic/Models/Genetic.cs
  28. 26
      Admin.NET.Bodk.Genetic/Models/GeneticItem.cs
  29. 62
      Admin.NET.Bodk.Genetic/Models/GeneticTestResult.cs
  30. 5
      Admin.NET.Bodk.Project/Admin.NET.Bodk.Project.csproj
  31. 87
      Admin.NET.Bodk.Project/Controllers/ProjectController.cs
  32. 14
      Admin.NET.Bodk.Project/Entities/AreaExtEntity.cs
  33. 11
      Admin.NET.Bodk.Project/Entities/FactoryExtEntity.cs
  34. 19
      Admin.NET.Bodk.Project/Entities/StationExtEntity.cs
  35. 16
      Admin.NET.Bodk.Project/Entities/StationServiceEntity.cs
  36. 8
      Admin.NET.Bodk.Project/Models/Area.cs
  37. 8
      Admin.NET.Bodk.Project/Models/Factory.cs
  38. 50
      Admin.NET.Bodk.Project/Models/Project.cs
  39. 12
      Admin.NET.Bodk.Project/Models/Station.cs
  40. 21
      Admin.NET.Bodk.Project/Models/StationService.cs
  41. 14
      Admin.NET.Bodk.Project/ProjectService.cs
  42. 262
      Admin.NET.Core/Enum/ErrorCodeEnum.cs
  43. 19
      Admin.NET.Core/SeedData/SysOrgSeedData.cs
  44. 5
      Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs
  45. 7
      Admin.NET.Core/SeedData/SysUserSeedData.cs
  46. 4
      Admin.NET.Core/Service/Dict/SysDictDataService.cs
  47. 18
      Admin.NET.Core/Service/Role/SysRoleService.cs
  48. 11
      Admin.NET.Core/Service/User/SysUserService.cs
  49. 2
      Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
  50. 5
      Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj
  51. BIN
      Admin.NET.Web.Entry/Admin.NET.db
  52. 18
      Admin.NET.sln

1
Admin.Bodk.Device/Entities/Dto/SupportDto.cs

@ -27,6 +27,7 @@ public class SupportOutput
public class CellOutput public class CellOutput
{ {
public string Code { get; set; }
public string Activity { get; set; } public string Activity { get; set; }
public double Temperature { get; set; } public double Temperature { get; set; }
public string Humidity { get; set; } public string Humidity { get; set; }

4
Admin.Bodk.Device/Services/DeviceService.cs

@ -7,6 +7,8 @@ using Furion.DependencyInjection;
using Furion.DynamicApiController; using Furion.DynamicApiController;
using Furion.FriendlyException; using Furion.FriendlyException;
using Mapster; using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NewLife.Caching; using NewLife.Caching;
using SqlSugar; using SqlSugar;
@ -40,6 +42,8 @@ public class DeviceService : IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[DisplayName("获取设备列表")] [DisplayName("获取设备列表")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<EquipmentDto>> PostList(DeviceInpt input) public async Task<SqlSugarPagedList<EquipmentDto>> PostList(DeviceInpt input)
{ {
return await _repository.AsQueryable() return await _repository.AsQueryable()

35
Admin.Bodk.Device/Services/SupportService.cs

@ -1,4 +1,3 @@
using System.ComponentModel; using System.ComponentModel;
using Admin.Bodk.Device.Entities.Dto; using Admin.Bodk.Device.Entities.Dto;
using Admin.Bodk.Device.Entities.equipment; using Admin.Bodk.Device.Entities.equipment;
@ -11,9 +10,11 @@ using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NewLife.Caching;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace Admin.Bodk.Device.Services; namespace Admin.Bodk.Device.Services;
/// <summary> /// <summary>
/// 服务管理 /// 服务管理
/// </summary> /// </summary>
@ -22,10 +23,14 @@ public class SupportService: IDynamicApiController, ITransient
{ {
private readonly SqlSugarRepository<Entities.Base> _baseRep; private readonly SqlSugarRepository<Entities.Base> _baseRep;
private readonly SqlSugarRepository<Entities.Support> _supportRep; private readonly SqlSugarRepository<Entities.Support> _supportRep;
public SupportService(SqlSugarRepository<Entities.Base> baseRep, SqlSugarRepository<Entities.Support> supportRep) private readonly ICache _cache;
public SupportService(SqlSugarRepository<Entities.Base> baseRep, SqlSugarRepository<Entities.Support> supportRep,
ICache cache)
{ {
_baseRep = baseRep; _baseRep = baseRep;
_supportRep = supportRep; _supportRep = supportRep;
_cache = cache;
} }
/// <summary> /// <summary>
@ -34,13 +39,17 @@ public class SupportService: IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[DisplayName("获取检测信息列表")] [DisplayName("获取检测信息列表")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] [Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<SupportOutput>> PostGetDetectionList(BaseInput input) public async Task<SqlSugarPagedList<SupportOutput>> PostGetDetectionList(BaseInput input)
{ {
List<SupportOutput> items = new List<SupportOutput>(); List<SupportOutput> items = new List<SupportOutput>();
items.Add( new SupportOutput() {State="检测中",Name = "检测1",DetectionServiceId = "dd123323",DetectionServiceType=0}); items.Add(new SupportOutput()
items.Add( new SupportOutput() {State="已完成",Name = "检测2",DetectionServiceId = "dd1233213",DetectionServiceType=1}); { State = "检测中", Name = "检测1", DetectionServiceId = "dd123323", DetectionServiceType = 0 });
items.Add( new SupportOutput() {State="已完成",Name = "检测3",DetectionServiceId = "dd1233213",DetectionServiceType=1}); items.Add(new SupportOutput()
{ State = "已完成", Name = "检测2", DetectionServiceId = "dd1233213", DetectionServiceType = 1 });
items.Add(new SupportOutput()
{ State = "已完成", Name = "检测3", DetectionServiceId = "dd1233213", DetectionServiceType = 1 });
return new SqlSugarPagedList<SupportOutput>() { Page = 1, PageSize = 20, Items = items, Total = 3 }; return new SqlSugarPagedList<SupportOutput>() { Page = 1, PageSize = 20, Items = items, Total = 3 };
} }
@ -50,16 +59,20 @@ public class SupportService: IDynamicApiController, ITransient
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[DisplayName("获取细胞服务列表")] [DisplayName("获取细胞服务列表")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] [Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<CellOutput>> PostGetCellList(BaseInput input) public async Task<SqlSugarPagedList<CellOutput>> PostGetCellList(BaseInput input)
{ {
List<CellOutput> items = new List<CellOutput>(); List<CellOutput> items = new List<CellOutput>();
items.Add( new CellOutput() {Activity="51%",Temperature = -192.5, Humidity = "12.1%", var cache = _cache.Get<dynamic>("bodk:device:M9hjashdfkj863478236478:summary");
Density="20个/ml", Capacity="200ml", Type= 1, Location="松山湖",LastOperationTime=null, items.Add(new CellOutput()
{
Code = "BT00D0015314A", Activity = "98%", Temperature = -192.5, Humidity = "0.5%",
Density = "1*10^7个/ml", Capacity = "1.8ml", Type = 1, Location = "松山湖", LastOperationTime = null,
DeviceInfo = new DeviceInfo() DeviceInfo = new DeviceInfo()
{ {
DeviceId=23223232,PicUrl="",LiquidNitrogenHeight=302,Temperature=-195.2, DeviceId = 23223232, PicUrl = "", LiquidNitrogenHeight = cache?.LiquidHeight, Temperature = cache?.TankTopTemperature,
Humidity="10%",Address="广东省东莞市科技二路与科技一路交叉口西北角宏远·新智汇1栋", Humidity = $"{cache?.CavityHumidity.ToString("0.0")}%", Address = "广东省东莞市松山湖园区科技二路宏远新智汇1栋",
Name = "M9_01", CellBaseInfo = new CellBaseInfo() { BaseName = "松山湖", BaseId = 13545 } Name = "M9_01", CellBaseInfo = new CellBaseInfo() { BaseName = "松山湖", BaseId = 13545 }
} }
}); });

13
Admin.NET.Bodk.Cells/Admin.NET.Bodk.Cells.csproj

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup>
</Project>

117
Admin.NET.Bodk.Cells/CellService.cs

@ -0,0 +1,117 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Cells.Entities;
using Admin.NET.Bodk.Cells.Models;
using Admin.NET.Core;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Cells;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Cell", Description = "细胞服务")]
public class CellService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<CellEntity> _repository;
private readonly UserManager _userManager;
public CellService(SqlSugarRepository<CellEntity> repository, UserManager userManager)
{
_repository = repository;
_userManager = userManager;
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "GetList"), HttpPost]
[DisplayName("GetList")]
public async Task<SqlSugarPagedList<Cell>> GetList(CellQueryInput queryInput)
{
return await _repository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.BoxBarCode),
m => queryInput.BoxBarCode != null && m.BoxBarCode.Contains(queryInput.BoxBarCode))
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.TubeBarcode),
m => queryInput.TubeBarcode != null && m.BoxBarCode.Contains(queryInput.TubeBarcode))
.WhereIF(queryInput.CustomerId is not null, m => m.CustomerId == queryInput.CustomerId)
.WhereIF(queryInput.DeviceId is not null, m => m.DeviceId == queryInput.DeviceId)
.WhereIF(queryInput.CellType is not null, m => m.CellType == queryInput.CellType)
.Where(m => _userManager.OrgId == m.OrgId)
.Select<Models.Cell>((u) => new Models.Cell()
{
Id = u.Id,
TubeBarcode = u.TubeBarcode,
BoxBarCode = u.BoxBarCode,
CellType = u.CellType,
CustomerId = u.CustomerId,
DeviceId = u.DeviceId,
Circle = u.Circle,
Column = u.Column,
Layer = u.Layer,
DepositTime = u.DepositTime,
ExpirationTime = u.ExpirationTime,
Activity = u.Activity,
Density = u.Density,
Capacity = u.Capacity
})
.ToPagedListAsync(queryInput.Page, queryInput.PageSize);
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("Add")]
public async Task<long?> AddCell(CellInput input)
{
return await _repository.InsertReturnBigIdentityAsync(new CellEntity()
{
TubeBarcode = input.TubeBarcode,
BoxBarCode = input.BoxBarCode,
CellType = input.CellType,
CustomerId = input.CustomerId,
DeviceId = input.DeviceId,
Circle = input.Circle,
Column = input.Column,
Layer = input.Layer,
DepositTime = input.DepositTime,
ExpirationTime = input.ExpirationTime,
Activity = input.Activity,
Density = input.Density,
Capacity = input.Capacity
});
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("Update")]
public async Task UpdateCell(CellInput input)
{
await _repository.UpdateAsync(new CellEntity()
{
Id = input.Id,
TubeBarcode = input.TubeBarcode,
BoxBarCode = input.BoxBarCode,
CellType = input.CellType,
CustomerId = input.CustomerId,
DeviceId = input.DeviceId,
Circle = input.Circle,
Column = input.Column,
Layer = input.Layer,
DepositTime = input.DepositTime,
ExpirationTime = input.ExpirationTime,
Activity = input.Activity,
Density = input.Density,
Capacity = input.Capacity
});
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("Delete")]
public async Task DeleteCell(long? id)
{
await _repository.DeleteByIdAsync(id);
}
}

46
Admin.NET.Bodk.Cells/Entities/CellEntity.cs

@ -0,0 +1,46 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Cells.Entities;
[SugarTable("bodk_cell")]
public class CellEntity : EntityBase
{
public long CustomerId { get; set; }
public CellType CellType { get; set; }
public long DeviceId { get; set; }
public int Circle { get; set; }
public int Column { get; set; }
public int Layer { get; set; }
public string BoxBarCode { get; set; }
public string TubeBarcode { get; set; }
public DateTime DepositTime { get; set; }
public DateTime ExpirationTime { get; set; }
public float Activity { get; set; }
public string Density { get; set; }
public float Capacity { get; set; }
public long OrgId { get; set; }
}
public enum CellType
{
Immune,
Stem
}

80
Admin.NET.Bodk.Cells/Models/Cell.cs

@ -0,0 +1,80 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Cells.Entities;
using Admin.NET.Core;
namespace Admin.NET.Bodk.Cells.Models;
public class CellQueryInput : BasePageInput
{
public long? CustomerId { get; set; }
public CellType? CellType { get; set; }
public long? DeviceId { get; set; }
public string? BoxBarCode { get; set; }
public string? TubeBarcode { get; set; }
}
public class CellInput : BaseIdInput
{
public long CustomerId { get; set; }
public CellType CellType { get; set; }
public long DeviceId { get; set; }
public int Circle { get; set; }
public int Column { get; set; }
public int Layer { get; set; }
public string BoxBarCode { get; set; }
public string TubeBarcode { get; set; }
public DateTime DepositTime { get; set; }
public DateTime ExpirationTime { get; set; }
public float Activity { get; set; }
public string Density { get; set; }
public float Capacity { get; set; }
}
public class Cell
{
public long Id { get; set; }
public long CustomerId { get; set; }
public CellType CellType { get; set; }
public long DeviceId { get; set; }
public int Circle { get; set; }
public int Column { get; set; }
public int Layer { get; set; }
public string BoxBarCode { get; set; }
public string TubeBarcode { get; set; }
public DateTime DepositTime { get; set; }
public DateTime ExpirationTime { get; set; }
public float Activity { get; set; }
public string Density { get; set; }
public float Capacity { get; set; }
}

4
Admin.NET.Bodk.Core/Admin.NET.Bodk.Core.csproj

@ -10,4 +10,8 @@
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.DynamicProxy" Version="2.2.0" />
</ItemGroup>
</Project> </Project>

19
Admin.NET.Bodk.Core/Devices/IDevice.cs

@ -1,19 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Core.Devices;
public interface IDevice
{
long? Id { get; }
DeviceType Type { get; }
string SerialNumber { get; }
object Summary { get; }
public long? ProjectId { get; }
string Name { get; }
}

8
Admin.NET.Bodk.Core/Devices/DeviceType.cs → Admin.NET.Bodk.Core/Entities/OrgEntityBase.cs

@ -2,9 +2,11 @@
// //
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Core.Devices; using Admin.NET.Core;
public enum DeviceType namespace Admin.NET.Bodk.Core.Entities;
public abstract class OrgEntityBase : EntityBase
{ {
M9 = 1, public long OrgId { get; set; }
} }

69
Admin.NET.Bodk.Core/ServiceBase.cs

@ -0,0 +1,69 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Core.Entities;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.DynamicApiController;
using SqlSugar;
namespace Admin.NET.Bodk.Core;
public abstract class ServiceBase(UserManager userManager, SysOrgService sysOrgService, SysUserService sysUserService)
: IDynamicApiController
{
protected readonly UserManager UserManager = userManager;
protected readonly SysOrgService SysOrgService = sysOrgService;
protected async Task<ISugarQueryable<T>> GetDataOutOfOrg<T>(ISugarQueryable<T> queryable, long orgId = 0)
where T : OrgEntityBase
{
var userOrgIdList = await SysOrgService.GetUserOrgIdList();
List<long>? orgList;
if (orgId > 0) // 指定机构查询时
{
orgList = await SysOrgService.GetChildIdListWithSelfById(orgId);
orgList = UserManager.SuperAdmin ? orgList : orgList.Where(u => userOrgIdList.Contains(u)).ToList();
}
else // 各管理员只能看到自己机构下的用户列表
{
orgList = UserManager.SuperAdmin ? null : userOrgIdList;
}
return queryable.WhereIF(orgList != null, u => orgList != null && orgList.Contains(u.OrgId));
}
//新增前置步骤
protected async Task<T> AddBefore<T>(T entity) where T : EntityBase
{
var user = await sysUserService.GetBaseInfo();
entity.CreateUser = user;
entity.CreateTime = DateTime.Now;
entity.CreateUserName = user.NickName;
entity.CreateUserId = user.Id;
return entity;
}
protected async Task<T> AddOrgBefore<T>(T entity) where T : OrgEntityBase
{
var user = await sysUserService.GetBaseInfo();
entity.CreateUser = user;
entity.CreateTime = DateTime.Now;
entity.CreateUserName = user.NickName;
entity.CreateUserId = user.Id;
entity.OrgId = UserManager.OrgId;
return entity;
}
protected async Task<T> UpdateBefore<T>(T entity) where T : EntityBase
{
var user = await sysUserService.GetBaseInfo();
entity.UpdateUser = user;
entity.UpdateTime = DateTime.Now;
entity.UpdateUserName = user.NickName;
entity.UpdateUserId = user.Id;
return entity;
}
}

1
Admin.NET.Bodk.Customer/Admin.NET.Bodk.Customer.csproj

@ -7,6 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj" />
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup> </ItemGroup>

117
Admin.NET.Bodk.Customer/CustomerService.cs

@ -2,14 +2,125 @@
// //
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Core;
using Admin.NET.Bodk.Customer.Entities;
using Admin.NET.Bodk.Customer.Models;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection; using Furion.DependencyInjection;
using Furion.DynamicApiController; using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Customer; namespace Admin.NET.Bodk.Customer;
[ApiDescriptionSettings(GroupName = "Bodk Groups",Description = "客户接口服务")] [ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Customer", Description = "客户接口服务")]
public class CustomerService: IDynamicApiController, ITransient public class CustomerService(
UserManager userManager,
SysOrgService sysOrgService,
SysUserService sysUserService,
SqlSugarRepository<CustomerEntity> repository) : ServiceBase(userManager, sysOrgService, sysUserService)
{ {
/// <summary>
/// 获取客户信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[UnitOfWork]
[ApiDescriptionSettings(Name = "GetList"), HttpPost]
[DisplayName("GetList")]
[Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<Models.Customer>> GetList(QueryCustomerInput input)
{
var queryable = repository.AsQueryable();
var userOrgIdList = await SysOrgService.GetUserOrgIdList();
List<long>? orgList;
orgList = UserManager.SuperAdmin ? null : userOrgIdList;
// queryable = queryable
// .Includes(u => u.OrgIds)
// .WhereIF(orgList != null,
// u => orgList != null && u.OrgIds != null && u.OrgIds.Intersect(orgList).Any());
return await queryable
.WhereIF(!string.IsNullOrWhiteSpace(input.Name),
m => input.Name != null && m.Name.Contains(input.Name))
.WhereIF(input.Id is not null, u => u.Id == input.Id)
.WhereIF(input.Phone is not null, m => m.Phone == input.Phone)
.WhereIF(!string.IsNullOrWhiteSpace(input.IdCard),
m => input.IdCard != null && m.IdCard.Contains(input.IdCard))
.Mapper(u =>
{
Console.WriteLine(u.IsMale);
})
.Select<Models.Customer>(u => new Models.Customer()
{
Id = u.Id,
Name = u.Name,
Phone = u.Phone,
IdCard = u.IdCard,
CreateTime = u.CreateTime,
UpdateTime = u.UpdateTime,
CreateUserName = u.CreateUserName,
OrgIds = u.OrgIds,
IsMale = u.IsMale,
IsDelete = u.IsDelete,
CreateUserId = u.CreateUserId,
UpdateUserId = u.UpdateUserId,
UpdateUserName = u.UpdateUserName
})
.ToPagedListAsync(input.Page, input.PageSize);
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("Add")]
[Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<long?> AddCustomer(AddCustomerInput input)
{
var entity = new CustomerEntity()
{
IdCard = input.IdCard,
Name = input.Name,
Phone = input.Phone,
IsMale = input.IsMale,
ImageUrl = input.ImageUrl,
VoiceUrl = input.VoiceUrl,
};
entity = await AddBefore(entity);
return await repository.InsertReturnSnowflakeIdAsync(entity);
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("Update")]
[Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task UpdateCustomer(UpdateCustomerInput input)
{
var entity = new CustomerEntity()
{
Id = input.Id,
IdCard = input.IdCard,
Name = input.Name,
Phone = input.Phone,
IsMale = input.IsMale,
ImageUrl = input.ImageUrl,
VoiceUrl = input.VoiceUrl
};
entity = await UpdateBefore(entity);
var result= await repository.UpdateAsync(entity);
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("Delete")]
public async Task DeleteCustomer(long? id)
{
await repository.DeleteByIdAsync(id);
}
} }

9
Admin.NET.Bodk.Customer/Entities/CustomerEntity.cs

@ -4,9 +4,11 @@
using Admin.NET.Core; using Admin.NET.Core;
using Nest; using Nest;
using SqlSugar;
namespace Admin.NET.Bodk.Customer.Entities; namespace Admin.NET.Bodk.Customer.Entities;
[SugarTable("bodk_base_customer")]
public class CustomerEntity : EntityBase, IRepositorySettings public class CustomerEntity : EntityBase, IRepositorySettings
{ {
public string Name { get; set; } public string Name { get; set; }
@ -16,4 +18,11 @@ public class CustomerEntity : EntityBase, IRepositorySettings
public string Phone { get; set; } public string Phone { get; set; }
public bool IsMale { get; set; } public bool IsMale { get; set; }
[SugarColumn(IsJson = true, ColumnDataType = "TEXT", IsNullable = true)]
public List<long>? OrgIds { get; set; }
[SugarColumn(IsNullable = true)] public string? ImageUrl { get; set; }
[SugarColumn(IsNullable = true)] public string? VoiceUrl { get; set; }
} }

56
Admin.NET.Bodk.Customer/Models/Customer.cs

@ -0,0 +1,56 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel.DataAnnotations;
using Admin.NET.Bodk.Customer.Entities;
using Admin.NET.Core;
namespace Admin.NET.Bodk.Customer.Models;
public class QueryCustomerInput : BasePageInput
{
public long? Id { get; set; }
public string? Name { get; set; }
public string? IdCard { get; set; }
public string? Phone { get; set; }
}
public class AddCustomerInput
{
[Required(ErrorMessage = "客户姓名不能为空")] public string Name { get; set; }
[Required(ErrorMessage = "客户身份证号不能为空")]
public string IdCard { get; set; }
[Required(ErrorMessage = "客户手机号码不能为空")]
public string Phone { get; set; }
[Required(ErrorMessage = "客户性别不能为空")] public bool IsMale { get; set; }
public string? ImageUrl { get; set; }
public string? VoiceUrl { get; set; }
}
public class UpdateCustomerInput : BaseIdInput
{
public string Name { get; set; }
public string IdCard { get; set; }
public string Phone { get; set; }
public bool IsMale { get; set; }
public string? ImageUrl { get; set; }
public string? VoiceUrl { get; set; }
}
public class Customer : CustomerEntity
{
public new List<long>? OrgIds = null;
}

1
Admin.NET.Bodk.Device/Admin.NET.Bodk.Device.csproj

@ -7,6 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj" />
<ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" />
</ItemGroup> </ItemGroup>

2
Admin.NET.Bodk.Device/Controllers/DeviceController.cs

@ -14,7 +14,7 @@ using NewLife.Caching;
namespace Admin.NET.Bodk.Device.Controllers; namespace Admin.NET.Bodk.Device.Controllers;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" },Name = "DeviceController",Description = "设备接口服务")] [ApiDescriptionSettings(Groups = new[] { "Bodk Groups" },Name = "DeviceOld",Description = "设备接口服务")]
public class DeviceController : IDynamicApiController, ITransient public class DeviceController : IDynamicApiController, ITransient
{ {
private readonly ICache _cache; private readonly ICache _cache;

2
Admin.NET.Bodk.Device/Controllers/Dto/DeviceDto.cs

@ -13,6 +13,6 @@ public class DeviceInput
public string Name { get; set; } public string Name { get; set; }
public DeviceType DeviceType { get; set; } public DeviceTypes DeviceType { get; set; }
public object? Summary { get; set; } public object? Summary { get; set; }
} }

79
Admin.NET.Bodk.Device/DeviceService.cs

@ -0,0 +1,79 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Core;
using Admin.NET.Bodk.Device.Entities;
using Admin.NET.Bodk.Device.Models;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.DependencyInjection;
using Furion.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using NewLife.Caching;
namespace Admin.NET.Bodk.Device;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Device", Description = "设备服务")]
public class DeviceService(
UserManager userManager,
SysOrgService sysOrgService,
SysUserService sysUserService,
SqlSugarRepository<DeviceEntity> repository,
ICache cache)
: ServiceBase(userManager, sysOrgService, sysUserService), ITransient
{
[ApiDescriptionSettings(Name = "Page"), HttpPost]
[DisplayName("获取设备分页列表")]
public async Task<SqlSugarPagedList<DeviceOutput>> Page(DeviceQueryInput queryInput)
{
var queryable = await GetDataOutOfOrg(repository.AsQueryable());
return await queryable.WhereIF(!string.IsNullOrWhiteSpace(queryInput.SerialNumber),
u => queryInput.SerialNumber != null && u.SerialNumber.Contains(queryInput.SerialNumber))
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.Name),
u => queryInput.Name != null && u.Name.Contains(queryInput.Name))
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.Name),
u => queryInput.Name != null && u.Name.Contains(queryInput.Name))
.WhereIF(queryInput.Id is not null, u => u.Id == queryInput.Id)
.WhereIF(queryInput.DeviceType is not null, u => u.DeviceType == queryInput.DeviceType)
.Select(u => u.Adapt<DeviceOutput>())
.Mapper(u => u.Online = cache.Get<bool>($"bodk:device:{u.SerialNumber}:summary:online"))
.WhereIF(queryInput.Online is not null, u => u.Online == queryInput.Online)
.ToPagedListAsync(queryInput.Page, queryInput.PageSize);
}
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("新增设备")]
public async Task<long> AddDevice(AddDeviceInput input)
{
var isExist = await repository.AsQueryable().AnyAsync(u => u.SerialNumber == input.SerialNumber);
if (isExist) throw Oops.Oh(ErrorCodeEnum.Device1000);
var entity = input.Adapt<DeviceEntity>();
entity.OrgId = UserManager.OrgId;
return await repository.InsertReturnBigIdentityAsync(entity);
}
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("更新设备")]
public async Task UpdateDevice(UpdateDeviceInput input)
{
var isExist = await repository.AsQueryable().AnyAsync(u => u.Id == input.Id);
if (!isExist) throw Oops.Oh("要更新的设备不存在");
var entity = await repository.GetByIdAsync(input.Id);
entity.DeviceType = input.DeviceType ?? entity.DeviceType;
entity.Name = input.Name ?? entity.Name;
entity.OrgId = input.OrgId ?? entity.OrgId;
await repository.UpdateAsync(entity);
}
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("删除设备")]
public async Task DeleteDevice(long id)
{
var isExist = await repository.AsQueryable().AnyAsync(u => u.Id == id);
if (!isExist) throw Oops.Oh("要删除的设备不存在");
await repository.DeleteByIdAsync(id);
}
}

2
Admin.NET.Bodk.Device/Devices/DeviceType.cs

@ -4,7 +4,7 @@
namespace Admin.NET.Bodk.Device.Devices; namespace Admin.NET.Bodk.Device.Devices;
public enum DeviceType public enum DeviceTypes
{ {
M9 = 1 M9 = 1
} }

36
Admin.NET.Bodk.Device/Entities/DeviceEntity.cs

@ -0,0 +1,36 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Core.Entities;
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Device.Entities;
[SugarTable("bodk_device")]
public class DeviceEntity : OrgEntityBase
{
public DeviceType DeviceType { get; set; }
public string SerialNumber { get; set; }
public string Name { get; set; }
}
public enum DeviceType
{
M9 = 1,
Agv = 2,
//离心机
Lidar = 3,
//培养箱
Plate = 4,
//工业机器人
Robot = 5,
}

43
Admin.NET.Bodk.Device/Models/Device.cs

@ -0,0 +1,43 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel.DataAnnotations;
using Admin.NET.Bodk.Device.Entities;
using Admin.NET.Core;
namespace Admin.NET.Bodk.Device.Models;
public class DeviceQueryInput : BasePageInput
{
public long? Id { get; set; }
public string? SerialNumber { get; set; }
public DeviceType? DeviceType { get; set; }
public string? Name { get; set; }
public bool? Online { get; set; }
}
public class AddDeviceInput : DeviceEntity
{
}
public class UpdateDeviceInput
{
[Required(ErrorMessage = "更新时,设备Id不能为空")]
public long Id { get; set; }
public long? OrgId { get; set; }
public string? Name { get; set; }
public DeviceType? DeviceType { get; set; }
}
public class DeviceOutput : DeviceEntity
{
public bool Online { get; set; }
}

1
Admin.NET.Bodk.Genetic/Admin.NET.Bodk.Genetic.csproj

@ -7,6 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Customer\Admin.NET.Bodk.Customer.csproj" />
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup> </ItemGroup>

27
Admin.NET.Bodk.Genetic/Entities/GeneticItemTestResultEntity.cs

@ -0,0 +1,27 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities;
[SugarTable("bodk_genetic_item_test_result")]
public class GeneticItemTestResultEntity : EntityBase
{
public long GeneticTestResultId { get; set; }
public string Name { get; set; }
public float Growth { get; set; }
public float AverageRiskScore { get; set; }
public float RiskScore { get; set; }
public int RiskLevel { get; set; }
[SugarColumn(IsJson = true, IsNullable = true, ColumnDataType = "TEXT")]
public List<Genetic.Models.Genetic>? Genetics { get; set; }
}

35
Admin.NET.Bodk.Genetic/Entities/GeneticTestResultEntity.cs

@ -2,9 +2,42 @@
// //
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities; namespace Admin.NET.Bodk.Genetic.Entities;
public class GeneticTestResultEntity [SugarTable("bodk_genetic_test_result")]
public class GeneticTestResultEntity : EntityBase
{ {
public long CustomerId { get; set; }
public string Code { get; set; }
public string TestType { get; set; }
public string Barcode { get; set; }
public GeneticTestStatus Status { get; set; }
public DateTime GenerationTime { get; set; }
public DateTime CollectionTime { get; set; }
}
public enum GeneticTestStatus
{
Sampled = 1,
Sent,
Resampling,
Received,
Analyzing,
ReAnalyzing,
UnderReview,
UnderReviewComplete,
NotPassed,
Completed,
Terminated,
Paused,
Failed
} }

159
Admin.NET.Bodk.Genetic/GeneticTestService.cs

@ -0,0 +1,159 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Genetic.Entities;
using Admin.NET.Bodk.Genetic.Models;
using Admin.NET.Core;
using Furion.DatabaseAccessor;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using Nest;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Genetic", Description = "基因检测服务")]
public class GeneticTestService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<GeneticTestResultEntity> _resultRepository;
private readonly SqlSugarRepository<GeneticItemTestResultEntity> _itemRepository;
public GeneticTestService(SqlSugarRepository<GeneticTestResultEntity> resultRepository,
SqlSugarRepository<GeneticItemTestResultEntity> itemRepository)
{
_resultRepository = resultRepository;
_itemRepository = itemRepository;
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "GetList"), HttpPost]
[DisplayName("GetList")]
public async Task<SqlSugarPagedList<GeneticTestResultOutput>> GetList(GeneticTestResultQueryInput queryInput)
{
return await _resultRepository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.Code),
m => queryInput.Code != null && m.Code.Contains(queryInput.Code))
.WhereIF(!string.IsNullOrWhiteSpace(queryInput.Barcode),
m => queryInput.Barcode != null && m.Code.Contains(queryInput.Barcode))
.WhereIF(queryInput.CustomerId is not null, m => m.CustomerId == queryInput.CustomerId)
.WhereIF(queryInput.Status is not null,
m => m.Status == queryInput.Status)
.Select<GeneticTestResultOutput>((u) => new Models.GeneticTestResultOutput()
{
Id = u.Id,
CustomerId = u.CustomerId,
Code = u.Code,
Status = u.Status,
Barcode = u.Barcode,
GenerationTime = u.GenerationTime,
CollectionTime = u.CollectionTime,
CreateTime = u.CreateTime,
CreateUserId = u.CreateUserId,
CreateUserName = u.CreateUserName,
UpdateTime = u.UpdateTime,
UpdateUserId = u.UpdateUserId,
UpdateUserName = u.UpdateUserName,
TestType = u.TestType,
IsDelete = u.IsDelete
})
.Mapper(r =>
{
r.Items = _itemRepository.AsQueryable().Where(i => i.GeneticTestResultId == r.Id)
.Select(i => new GeneticItemOutput()
{
RiskLevel = i.RiskLevel,
CreateUserId = i.CreateUserId,
CreateUserName = i.CreateUserName,
CreateTime = i.CreateTime,
UpdateUserId = i.UpdateUserId,
UpdateUserName = i.UpdateUserName,
UpdateTime = i.UpdateTime,
GeneticTestResultId = i.GeneticTestResultId,
IsDelete = i.IsDelete,
RiskScore = i.RiskScore,
Growth = i.Growth,
AverageRiskScore = i.AverageRiskScore,
Genetics = i.Genetics,
Name = i.Name
}).ToList();
})
.ToPagedListAsync(queryInput.Page, queryInput.PageSize);
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("Add")]
public async Task<long?> AddGeneticTestResult(GeneticTestResultInput input)
{
var id = await _resultRepository.InsertReturnSnowflakeIdAsync(new GeneticTestResultEntity()
{
CustomerId = input.CustomerId,
Code = input.Code,
Status = input.Status,
Barcode = input.Barcode,
GenerationTime = input.GenerationTime,
CollectionTime = input.CollectionTime,
TestType = input.TestType
});
if (input.Items is not null)
{
await _itemRepository.InsertRangeAsync(input.Items.Select(i => new GeneticItemTestResultEntity()
{
Name = i.Name,
RiskScore = i.RiskScore,
RiskLevel = i.RiskLevel,
AverageRiskScore = i.AverageRiskScore,
Genetics = i.Genetics,
Growth = i.Growth,
GeneticTestResultId = id
}).ToArray());
}
return id;
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("Update")]
public async Task UpdateGeneticTestResult(GeneticTestResultUpdateInput input)
{
await _resultRepository.UpdateAsync(new GeneticTestResultEntity()
{
Id = input.Id,
CustomerId = input.CustomerId,
Code = input.Code,
Status = input.Status,
Barcode = input.Barcode,
GenerationTime = input.GenerationTime,
TestType = input.TestType,
CollectionTime = input.CollectionTime
});
if (input.Items is not null)
{
await _itemRepository.DeleteAsync(i => i.GeneticTestResultId == input.Id);
await _itemRepository.InsertRangeAsync(input.Items.Select(i => new GeneticItemTestResultEntity()
{
Name = i.Name,
RiskScore = i.RiskScore,
RiskLevel = i.RiskLevel,
AverageRiskScore = i.AverageRiskScore,
Genetics = i.Genetics,
Growth = i.Growth,
GeneticTestResultId =input.Id
}).ToArray());
}
}
[UnitOfWork]
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("Delete")]
public async Task DeleteGeneticTestResult(long? id)
{
await _resultRepository.DeleteByIdAsync(id);
await _itemRepository.DeleteAsync(i => i.GeneticTestResultId == id);
}
}

18
Admin.NET.Bodk.Genetic/Models/Genetic.cs

@ -0,0 +1,18 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Genetic.Models;
public class Genetic
{
public string Name { get; set; }
public string Postion { get; set; }
public bool Risk { get; set; }
public string Type { get; set; }
public string Description { get; set; }
}

26
Admin.NET.Bodk.Genetic/Models/GeneticItem.cs

@ -0,0 +1,26 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Genetic.Entities;
namespace Admin.NET.Bodk.Genetic.Models;
public class GeneticItemOutput : GeneticItemTestResultEntity
{
}
public class GeneticItemInput
{
public string Name { get; set; }
public float Growth { get; set; }
public float AverageRiskScore { get; set; }
public float RiskScore { get; set; }
public int RiskLevel { get; set; }
public List<Genetic>? Genetics { get; set; }
}

62
Admin.NET.Bodk.Genetic/Models/GeneticTestResult.cs

@ -0,0 +1,62 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Genetic.Entities;
using Admin.NET.Core;
namespace Admin.NET.Bodk.Genetic.Models;
public class GeneticTestResultQueryInput : BasePageInput
{
public long? CustomerId { get; set; }
public string? Code { get; set; }
public string? Barcode { get; set; }
public GeneticTestStatus? Status { get; set; }
}
public class GeneticTestResultInput
{
public long CustomerId { get; set; }
public string Code { get; set; }
public string Barcode { get; set; }
public string TestType { get; set; }
public GeneticTestStatus Status { get; set; }
public DateTime GenerationTime { get; set; }
public DateTime CollectionTime { get; set; }
public List<GeneticItemInput>? Items { get; set; }
}
public class GeneticTestResultUpdateInput : BaseIdInput
{
public long CustomerId { get; set; }
public string Code { get; set; }
public string Barcode { get; set; }
public string TestType { get; set; }
public GeneticTestStatus Status { get; set; }
public DateTime GenerationTime { get; set; }
public DateTime CollectionTime { get; set; }
public List<GeneticItemInput>? Items { get; set; }
}
public class GeneticTestResultOutput : GeneticTestResultEntity
{
public List<GeneticItemOutput>? Items { get; set; }
}

5
Admin.NET.Bodk.Project/Admin.NET.Bodk.Project.csproj

@ -7,11 +7,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj" />
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>
</Project> </Project>

87
Admin.NET.Bodk.Project/Controllers/ProjectController.cs

@ -1,87 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Project.Entities;
using Admin.NET.Bodk.Project.Models;
using Admin.NET.Core;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Project.Controllers;
[ApiDescriptionSettings(GroupName = "Bodk Groups", Description = "项目接口服务")]
public class ProjectController : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<ProjectEntity> _repository;
public ProjectController(SqlSugarRepository<ProjectEntity> repository)
{
_repository = repository;
}
[ApiDescriptionSettings(Name = "GetList"), HttpPost]
[DisplayName("获取项目列表")]
public async Task<SqlSugarPagedList<Project.Models.Project>> GetList(ProjectQueryInput input)
{
return await _repository.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.Name),
m => input.Name != null && m.Name.Contains(input.Name))
.WhereIF(input.Id is not null, m => m.Id == input.Id)
.WhereIF(!string.IsNullOrWhiteSpace(input.Manager),
m => input.Manager != null && m.Manager.Contains(input.Manager))
.WhereIF(!string.IsNullOrWhiteSpace(input.Phone),
m => input.Phone != null && m.Phone.Contains(input.Phone))
.WhereIF(!string.IsNullOrWhiteSpace(input.Position),
m => input.Position != null && m.Position.Contains(input.Position))
.WhereIF(input.IsDeleted is not null,
m => m.IsDelete == input.IsDeleted)
.Select<Models.Project>((u) => new Models.Project()
{
Id = u.Id,
Name = u.Name,
Manager = u.Manager,
Position = u.Position,
Phone = u.Phone,
IsDeleted = u.IsDelete,
CreateTime = u.CreateTime,
})
.ToPagedListAsync(input.Page, input.PageSize);
}
[ApiDescriptionSettings(Name = "Add"), HttpPost]
[DisplayName("新增项目")]
public async Task AddProject(ProjectInput project)
{
await _repository.InsertAsync(new ProjectEntity()
{
Name = project.Name,
Position = project.Position,
Manager = project.Manager,
Phone = project.Phone
});
}
[ApiDescriptionSettings(Name = "Delete"), HttpPost]
[DisplayName("删除项目")]
public async Task DeleteProject(long id)
{
var project = await _repository.GetSingleAsync(d => d.Id == id);
project.IsDelete = true;
await _repository.UpdateAsync(project);
}
[ApiDescriptionSettings(Name = "Update"), HttpPost]
[DisplayName("修改项目")]
public async Task UpdateProject(ProjectInput projectInput)
{
var project = await _repository.GetSingleAsync(d => d.Id == projectInput.Id);
project.Manager = projectInput.Manager;
project.Name = projectInput.Name;
project.Phone = projectInput.Phone;
project.Position = projectInput.Position;
await _repository.UpdateAsync(project);
}
}

14
Admin.NET.Bodk.Project/Entities/AreaExtEntity.cs

@ -0,0 +1,14 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Project.Entities;
[SugarTable("bodk_org_area_ext")]
public class AreaExtEntity : EntityBase
{
public long OrgId { get; set; }
}

11
Admin.NET.Bodk.Project/Entities/ProjectEntity.cs → Admin.NET.Bodk.Project/Entities/FactoryExtEntity.cs

@ -3,19 +3,16 @@
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core; using Admin.NET.Core;
using Nest;
using SqlSugar; using SqlSugar;
namespace Admin.NET.Bodk.Project.Entities; namespace Admin.NET.Bodk.Project.Entities;
[SugarTable("bodk_project", "项目表")] [SugarTable("bodk_org_factory_ext")]
public class ProjectEntity : EntityTenant, IRepositorySettings public class FactoryExtEntity : EntityBase
{ {
public string Name { get; set; }
public string Position { get; set; } public string Position { get; set; }
public string Manager { get; set; } public long AreaId { get; set; }
public string Phone { get; set; } public long OrgId { get; set; }
} }

19
Admin.NET.Bodk.Project/Entities/StationExtEntity.cs

@ -0,0 +1,19 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Project.Entities;
[SugarTable("bodk_org_station_ext")]
public class StationExtEntity : EntityBase
{
public long FactoryId { get; set; }
public long OrgId { get; set; }
[SugarColumn(IsArray = true, ColumnDataType = "long", Length = 1000, IsNullable = true)]
public long[]? ServiceIds { get; set; }
}

16
Admin.NET.Bodk.Project/Entities/StationServiceEntity.cs

@ -0,0 +1,16 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
namespace Admin.NET.Bodk.Project.Entities;
public class StationServiceEntity : EntityBase
{
public string Name { get; set; }
public string Icon { get; set; }
public string Description { get; set; }
}

8
Admin.NET.Bodk.Core/IRuntime.cs → Admin.NET.Bodk.Project/Models/Area.cs

@ -2,9 +2,11 @@
// //
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Core; using Admin.NET.Core;
public interface IRuntime namespace Admin.NET.Bodk.Project.Models;
{
public class AreaOutput : SysOrg
{
public List<FactoryOutput>? Factories { get; set; }
} }

8
Admin.NET.Bodk.Genetic/Entities/GeneticTestAgencyEntity.cs → Admin.NET.Bodk.Project/Models/Factory.cs

@ -2,9 +2,11 @@
// //
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证 // 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Genetic.Entities; using Admin.NET.Core;
public class GeneticTestAgencyEntity namespace Admin.NET.Bodk.Project.Models;
{
public class FactoryOutput : SysOrg
{
public List<StationOutput>? Stations { get; set; }
} }

50
Admin.NET.Bodk.Project/Models/Project.cs

@ -1,50 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
namespace Admin.NET.Bodk.Project.Models;
public class Project
{
public long? Id { get; set; }
public string Name { get; set; }
public string Position { get; set; }
public string Manager { get; set; }
public string Phone { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreateTime { get; set; }
}
public class ProjectQueryInput : BasePageInput
{
public long? Id { get; set; }
public string? Name { get; set; }
public string? Position { get; set; }
public string? Manager { get; set; }
public string? Phone { get; set; }
public bool? IsDeleted { get; set; }
}
public class ProjectInput : BaseIdInput
{
public string Name { get; set; }
public string Position { get; set; }
public string Manager { get; set; }
public string Phone { get; set; }
}

12
Admin.NET.Bodk.Project/Models/Station.cs

@ -0,0 +1,12 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
namespace Admin.NET.Bodk.Project.Models;
public class StationOutput : SysOrg
{
public List<StationServiceOutput>? Services { get; set; }
}

21
Admin.NET.Bodk.Project/Models/StationService.cs

@ -0,0 +1,21 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Project.Models;
public class StationServiceOutput
{
public long Id { get; set; }
public string Name { get; set; }
public string Icon { get; set; }
public string Description { get; set; }
}
public class AddStationServiceInput
{
}

14
Admin.NET.Bodk.Project/ProjectService.cs

@ -0,0 +1,14 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Core;
using Admin.NET.Core;
using Admin.NET.Core.Service;
namespace Admin.NET.Bodk.Project;
public class ProjectService(UserManager userManager, SysOrgService sysOrgService, SysUserService sysUserService)
: ServiceBase(userManager, sysOrgService, sysUserService)
{
}

262
Admin.NET.Core/Enum/ErrorCodeEnum.cs

@ -14,44 +14,37 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 验证码错误 /// 验证码错误
/// </summary> /// </summary>
[ErrorCodeItemMetadata("验证码错误")] [ErrorCodeItemMetadata("验证码错误")] D0008,
D0008,
/// <summary> /// <summary>
/// 账号不存在 /// 账号不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("账号不存在")] [ErrorCodeItemMetadata("账号不存在")] D0009,
D0009,
/// <summary> /// <summary>
/// 密码不正确 /// 密码不正确
/// </summary> /// </summary>
[ErrorCodeItemMetadata("密码不正确")] [ErrorCodeItemMetadata("密码不正确")] D1000,
D1000,
/// <summary> /// <summary>
/// 非法操作!禁止删除自己 /// 非法操作!禁止删除自己
/// </summary> /// </summary>
[ErrorCodeItemMetadata("非法操作,禁止删除自己")] [ErrorCodeItemMetadata("非法操作,禁止删除自己")] D1001,
D1001,
/// <summary> /// <summary>
/// 记录不存在 /// 记录不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("记录不存在")] [ErrorCodeItemMetadata("记录不存在")] D1002,
D1002,
/// <summary> /// <summary>
/// 账号已存在 /// 账号已存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("账号已存在")] [ErrorCodeItemMetadata("账号已存在")] D1003,
D1003,
/// <summary> /// <summary>
/// 旧密码不匹配 /// 旧密码不匹配
/// </summary> /// </summary>
[ErrorCodeItemMetadata("旧密码输入错误")] [ErrorCodeItemMetadata("旧密码输入错误")] D1004,
D1004,
/// <summary> /// <summary>
/// 测试数据禁止更改admin密码 /// 测试数据禁止更改admin密码
@ -62,8 +55,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 数据已存在 /// 数据已存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("数据已存在")] [ErrorCodeItemMetadata("数据已存在")] D1006,
D1006,
/// <summary> /// <summary>
/// 数据不存在或含有关联引用,禁止删除 /// 数据不存在或含有关联引用,禁止删除
@ -74,8 +66,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 禁止为管理员分配角色 /// 禁止为管理员分配角色
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止为管理员分配角色")] [ErrorCodeItemMetadata("禁止为管理员分配角色")] D1008,
D1008,
/// <summary> /// <summary>
/// 重复数据或记录含有不存在数据 /// 重复数据或记录含有不存在数据
@ -92,62 +83,52 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 非法操作,未登录 /// 非法操作,未登录
/// </summary> /// </summary>
[ErrorCodeItemMetadata("非法操作,未登录")] [ErrorCodeItemMetadata("非法操作,未登录")] D1011,
D1011,
/// <summary> /// <summary>
/// Id不能为空 /// Id不能为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("Id不能为空")] [ErrorCodeItemMetadata("Id不能为空")] D1012,
D1012,
/// <summary> /// <summary>
/// 所属机构不在自己的数据范围内 /// 所属机构不在自己的数据范围内
/// </summary> /// </summary>
[ErrorCodeItemMetadata("没有权限操作该数据")] [ErrorCodeItemMetadata("没有权限操作该数据")] D1013,
D1013,
/// <summary> /// <summary>
/// 禁止删除超级管理员 /// 禁止删除超级管理员
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止删除超级管理员")] [ErrorCodeItemMetadata("禁止删除超级管理员")] D1014,
D1014,
/// <summary> /// <summary>
/// 禁止修改超级管理员状态 /// 禁止修改超级管理员状态
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止修改超级管理员状态")] [ErrorCodeItemMetadata("禁止修改超级管理员状态")] D1015,
D1015,
/// <summary> /// <summary>
/// 没有权限 /// 没有权限
/// </summary> /// </summary>
[ErrorCodeItemMetadata("没有权限")] [ErrorCodeItemMetadata("没有权限")] D1016,
D1016,
/// <summary> /// <summary>
/// 账号已冻结 /// 账号已冻结
/// </summary> /// </summary>
[ErrorCodeItemMetadata("账号已冻结")] [ErrorCodeItemMetadata("账号已冻结")] D1017,
D1017,
/// <summary> /// <summary>
/// 禁止删除管理员 /// 禁止删除管理员
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止删除管理员")] [ErrorCodeItemMetadata("禁止删除管理员")] D1018,
D1018,
/// <summary> /// <summary>
/// 禁止删除系统管理员角色 /// 禁止删除系统管理员角色
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止删除系统管理员角色")] [ErrorCodeItemMetadata("禁止删除系统管理员角色")] D1019,
D1019,
/// <summary> /// <summary>
/// 禁止修改系统管理员角色 /// 禁止修改系统管理员角色
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止修改系统管理员角色")] [ErrorCodeItemMetadata("禁止修改系统管理员角色")] D1020,
D1020,
/// <summary> /// <summary>
/// 禁止为系统管理员角色分配权限 /// 禁止为系统管理员角色分配权限
@ -164,8 +145,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 禁止删除默认租户 /// 禁止删除默认租户
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止删除默认租户")] [ErrorCodeItemMetadata("禁止删除默认租户")] D1023,
D1023,
/// <summary> /// <summary>
/// 已将其他地方登录账号下线 /// 已将其他地方登录账号下线
@ -182,8 +162,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 禁止修改本人账号状态 /// 禁止修改本人账号状态
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止修改本人账号状态")] [ErrorCodeItemMetadata("禁止修改本人账号状态")] D1026,
D1026,
/// <summary> /// <summary>
/// 密码错误次数过多,账号已锁定,请半小时后重试! /// 密码错误次数过多,账号已锁定,请半小时后重试!
@ -194,14 +173,12 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 新密码不能与旧密码相同 /// 新密码不能与旧密码相同
/// </summary> /// </summary>
[ErrorCodeItemMetadata("新密码不能与旧密码相同")] [ErrorCodeItemMetadata("新密码不能与旧密码相同")] D1028,
D1028,
/// <summary> /// <summary>
/// 父机构不存在 /// 父机构不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("父机构不存在")] [ErrorCodeItemMetadata("父机构不存在")] D2000,
D2000,
/// <summary> /// <summary>
/// 当前机构Id不能与父机构Id相同 /// 当前机构Id不能与父机构Id相同
@ -218,14 +195,12 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 没有权限操作机构 /// 没有权限操作机构
/// </summary> /// </summary>
[ErrorCodeItemMetadata("没有权限操作机构")] [ErrorCodeItemMetadata("没有权限操作机构")] D2003,
D2003,
/// <summary> /// <summary>
/// 该机构下有用户禁止删除 /// 该机构下有用户禁止删除
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该机构下有用户禁止删除")] [ErrorCodeItemMetadata("该机构下有用户禁止删除")] D2004,
D2004,
/// <summary> /// <summary>
/// 附属机构下有用户禁止删除 /// 附属机构下有用户禁止删除
@ -236,8 +211,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 只能增加下级机构 /// 只能增加下级机构
/// </summary> /// </summary>
[ErrorCodeItemMetadata("只能增加下级机构")] [ErrorCodeItemMetadata("只能增加下级机构")] D2006,
D2006,
/// <summary> /// <summary>
/// 下级机构下有用户禁止删除 /// 下级机构下有用户禁止删除
@ -248,20 +222,17 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 租户默认机构禁止删除 /// 租户默认机构禁止删除
/// </summary> /// </summary>
[ErrorCodeItemMetadata("租户默认机构禁止删除")] [ErrorCodeItemMetadata("租户默认机构禁止删除")] D2008,
D2008,
/// <summary> /// <summary>
/// 禁止增加根节点机构 /// 禁止增加根节点机构
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止增加根节点机构")] [ErrorCodeItemMetadata("禁止增加根节点机构")] D2009,
D2009,
/// <summary> /// <summary>
/// 字典类型不存在 /// 字典类型不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("字典类型不存在")] [ErrorCodeItemMetadata("字典类型不存在")] D3000,
D3000,
/// <summary> /// <summary>
/// 字典类型已存在 /// 字典类型已存在
@ -284,38 +255,32 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 字典值不存在 /// 字典值不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("字典值不存在")] [ErrorCodeItemMetadata("字典值不存在")] D3004,
D3004,
/// <summary> /// <summary>
/// 字典状态错误 /// 字典状态错误
/// </summary> /// </summary>
[ErrorCodeItemMetadata("字典状态错误")] [ErrorCodeItemMetadata("字典状态错误")] D3005,
D3005,
/// <summary> /// <summary>
/// 菜单已存在 /// 菜单已存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("菜单已存在")] [ErrorCodeItemMetadata("菜单已存在")] D4000,
D4000,
/// <summary> /// <summary>
/// 路由地址为空 /// 路由地址为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("路由地址为空")] [ErrorCodeItemMetadata("路由地址为空")] D4001,
D4001,
/// <summary> /// <summary>
/// 打开方式为空 /// 打开方式为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("打开方式为空")] [ErrorCodeItemMetadata("打开方式为空")] D4002,
D4002,
/// <summary> /// <summary>
/// 权限标识格式为空 /// 权限标识格式为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("权限标识格式为空")] [ErrorCodeItemMetadata("权限标识格式为空")] D4003,
D4003,
/// <summary> /// <summary>
/// 权限标识格式错误 /// 权限标识格式错误
@ -326,8 +291,7 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 权限不存在 /// 权限不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("权限不存在")] [ErrorCodeItemMetadata("权限不存在")] D4005,
D4005,
/// <summary> /// <summary>
/// 父级菜单不能为当前节点,请重新选择父级菜单 /// 父级菜单不能为当前节点,请重新选择父级菜单
@ -338,86 +302,72 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 不能移动根节点 /// 不能移动根节点
/// </summary> /// </summary>
[ErrorCodeItemMetadata("不能移动根节点")] [ErrorCodeItemMetadata("不能移动根节点")] D4007,
D4007,
/// <summary> /// <summary>
/// 禁止本节点与父节点相同 /// 禁止本节点与父节点相同
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止本节点与父节点相同")] [ErrorCodeItemMetadata("禁止本节点与父节点相同")] D4008,
D4008,
/// <summary> /// <summary>
/// 路由名称重复 /// 路由名称重复
/// </summary> /// </summary>
[ErrorCodeItemMetadata("路由名称重复")] [ErrorCodeItemMetadata("路由名称重复")] D4009,
D4009,
/// <summary> /// <summary>
/// 父节点不能为按钮类型 /// 父节点不能为按钮类型
/// </summary> /// </summary>
[ErrorCodeItemMetadata("父节点不能为按钮类型")] [ErrorCodeItemMetadata("父节点不能为按钮类型")] D4010,
D4010,
/// <summary> /// <summary>
/// 已存在同名或同编码应用 /// 已存在同名或同编码应用
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码应用")] [ErrorCodeItemMetadata("已存在同名或同编码应用")] D5000,
D5000,
/// <summary> /// <summary>
/// 默认激活系统只能有一个 /// 默认激活系统只能有一个
/// </summary> /// </summary>
[ErrorCodeItemMetadata("默认激活系统只能有一个")] [ErrorCodeItemMetadata("默认激活系统只能有一个")] D5001,
D5001,
/// <summary> /// <summary>
/// 该应用下有菜单禁止删除 /// 该应用下有菜单禁止删除
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该应用下有菜单禁止删除")] [ErrorCodeItemMetadata("该应用下有菜单禁止删除")] D5002,
D5002,
/// <summary> /// <summary>
/// 已存在同名或同编码应用 /// 已存在同名或同编码应用
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码应用")] [ErrorCodeItemMetadata("已存在同名或同编码应用")] D5003,
D5003,
/// <summary> /// <summary>
/// 已存在同名或同编码职位 /// 已存在同名或同编码职位
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码职位")] [ErrorCodeItemMetadata("已存在同名或同编码职位")] D6000,
D6000,
/// <summary> /// <summary>
/// 该职位下有用户禁止删除 /// 该职位下有用户禁止删除
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该职位下有用户禁止删除")] [ErrorCodeItemMetadata("该职位下有用户禁止删除")] D6001,
D6001,
/// <summary> /// <summary>
/// 无权修改本职位 /// 无权修改本职位
/// </summary> /// </summary>
[ErrorCodeItemMetadata("无权修改本职位")] [ErrorCodeItemMetadata("无权修改本职位")] D6002,
D6002,
/// <summary> /// <summary>
/// 职位不存在 /// 职位不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("职位不存在")] [ErrorCodeItemMetadata("职位不存在")] D6003,
D6003,
/// <summary> /// <summary>
/// 通知公告状态错误 /// 通知公告状态错误
/// </summary> /// </summary>
[ErrorCodeItemMetadata("通知公告状态错误")] [ErrorCodeItemMetadata("通知公告状态错误")] D7000,
D7000,
/// <summary> /// <summary>
/// 通知公告删除失败 /// 通知公告删除失败
/// </summary> /// </summary>
[ErrorCodeItemMetadata("通知公告删除失败")] [ErrorCodeItemMetadata("通知公告删除失败")] D7001,
D7001,
/// <summary> /// <summary>
/// 通知公告编辑失败 /// 通知公告编辑失败
@ -434,32 +384,27 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 文件不存在 /// 文件不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("文件不存在")] [ErrorCodeItemMetadata("文件不存在")] D8000,
D8000,
/// <summary> /// <summary>
/// 不允许的文件类型 /// 不允许的文件类型
/// </summary> /// </summary>
[ErrorCodeItemMetadata("不允许的文件类型")] [ErrorCodeItemMetadata("不允许的文件类型")] D8001,
D8001,
/// <summary> /// <summary>
/// 文件超过允许大小 /// 文件超过允许大小
/// </summary> /// </summary>
[ErrorCodeItemMetadata("文件超过允许大小")] [ErrorCodeItemMetadata("文件超过允许大小")] D8002,
D8002,
/// <summary> /// <summary>
/// 文件后缀错误 /// 文件后缀错误
/// </summary> /// </summary>
[ErrorCodeItemMetadata("文件后缀错误")] [ErrorCodeItemMetadata("文件后缀错误")] D8003,
D8003,
/// <summary> /// <summary>
/// 文件已存在 /// 文件已存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("文件已存在")] [ErrorCodeItemMetadata("文件已存在")] D8004,
D8004,
/// <summary> /// <summary>
/// 已存在同名或同编码参数配置 /// 已存在同名或同编码参数配置
@ -470,86 +415,72 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 禁止删除系统参数 /// 禁止删除系统参数
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止删除系统参数")] [ErrorCodeItemMetadata("禁止删除系统参数")] D9001,
D9001,
/// <summary> /// <summary>
/// 已存在同名任务调度 /// 已存在同名任务调度
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名任务调度")] [ErrorCodeItemMetadata("已存在同名任务调度")] D1100,
D1100,
/// <summary> /// <summary>
/// 任务调度不存在 /// 任务调度不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("任务调度不存在")] [ErrorCodeItemMetadata("任务调度不存在")] D1101,
D1101,
/// <summary> /// <summary>
/// 演示环境禁止修改数据 /// 演示环境禁止修改数据
/// </summary> /// </summary>
[ErrorCodeItemMetadata("演示环境禁止修改数据")] [ErrorCodeItemMetadata("演示环境禁止修改数据")] D1200,
D1200,
/// <summary> /// <summary>
/// 已存在同名的租户 /// 已存在同名的租户
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名的租户")] [ErrorCodeItemMetadata("已存在同名的租户")] D1300,
D1300,
/// <summary> /// <summary>
/// 已存在同名的租户管理员 /// 已存在同名的租户管理员
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名的租户管理员")] [ErrorCodeItemMetadata("已存在同名的租户管理员")] D1301,
D1301,
/// <summary> /// <summary>
/// 租户从库配置错误 /// 租户从库配置错误
/// </summary> /// </summary>
[ErrorCodeItemMetadata("租户从库配置错误")] [ErrorCodeItemMetadata("租户从库配置错误")] D1302,
D1302,
/// <summary> /// <summary>
/// 该表代码模板已经生成过 /// 该表代码模板已经生成过
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该表代码模板已经生成过")] [ErrorCodeItemMetadata("该表代码模板已经生成过")] D1400,
D1400,
/// <summary> /// <summary>
/// 该类型不存在 /// 该类型不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该类型不存在")] [ErrorCodeItemMetadata("该类型不存在")] D1501,
D1501,
/// <summary> /// <summary>
/// 该字段不存在 /// 该字段不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该字段不存在")] [ErrorCodeItemMetadata("该字段不存在")] D1502,
D1502,
/// <summary> /// <summary>
/// 该类型不是枚举类型 /// 该类型不是枚举类型
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该类型不是枚举类型")] [ErrorCodeItemMetadata("该类型不是枚举类型")] D1503,
D1503,
/// <summary> /// <summary>
/// 该实体不存在 /// 该实体不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("该实体不存在")] [ErrorCodeItemMetadata("该实体不存在")] D1504,
D1504,
/// <summary> /// <summary>
/// 父菜单不存在 /// 父菜单不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("父菜单不存在")] [ErrorCodeItemMetadata("父菜单不存在")] D1505,
D1505,
/// <summary> /// <summary>
/// 父资源不存在 /// 父资源不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("父资源不存在")] [ErrorCodeItemMetadata("父资源不存在")] D1600,
D1600,
/// <summary> /// <summary>
/// 当前资源Id不能与父资源Id相同 /// 当前资源Id不能与父资源Id相同
@ -560,14 +491,12 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 已有相同编码或名称 /// 已有相同编码或名称
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已有相同编码或名称")] [ErrorCodeItemMetadata("已有相同编码或名称")] D1602,
D1602,
/// <summary> /// <summary>
/// 脚本代码不能为空 /// 脚本代码不能为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("脚本代码不能为空")] [ErrorCodeItemMetadata("脚本代码不能为空")] D1701,
D1701,
/// <summary> /// <summary>
/// 脚本代码中的作业类,需要定义 [JobDetail] 特性 /// 脚本代码中的作业类,需要定义 [JobDetail] 特性
@ -584,20 +513,17 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 禁止修改作业编号 /// 禁止修改作业编号
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止修改作业编号")] [ErrorCodeItemMetadata("禁止修改作业编号")] D1704,
D1704,
/// <summary> /// <summary>
/// 执行作业失败 /// 执行作业失败
/// </summary> /// </summary>
[ErrorCodeItemMetadata("执行作业失败")] [ErrorCodeItemMetadata("执行作业失败")] D1705,
D1705,
/// <summary> /// <summary>
/// 已存在同名打印模板 /// 已存在同名打印模板
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名打印模板")] [ErrorCodeItemMetadata("已存在同名打印模板")] D1800,
D1800,
/// <summary> /// <summary>
/// 已存在同名功能或同名程序及插件 /// 已存在同名功能或同名程序及插件
@ -608,44 +534,37 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 已存在同名或同编码项目 /// 已存在同名或同编码项目
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码项目")] [ErrorCodeItemMetadata("已存在同名或同编码项目")] xg1000,
xg1000,
/// <summary> /// <summary>
/// 已存在相同证件号码人员 /// 已存在相同证件号码人员
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已存在相同证件号码人员")] [ErrorCodeItemMetadata("已存在相同证件号码人员")] xg1001,
xg1001,
/// <summary> /// <summary>
/// 检测数据不存在 /// 检测数据不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("检测数据不存在")] [ErrorCodeItemMetadata("检测数据不存在")] xg1002,
xg1002,
/// <summary> /// <summary>
/// 请添加数据列 /// 请添加数据列
/// </summary> /// </summary>
[ErrorCodeItemMetadata("请添加数据列")] [ErrorCodeItemMetadata("请添加数据列")] db1000,
db1000,
/// <summary> /// <summary>
/// 数据表不存在 /// 数据表不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("数据表不存在")] [ErrorCodeItemMetadata("数据表不存在")] db1001,
db1001,
/// <summary> /// <summary>
/// 数据表不存在 /// 数据表不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("不允许添加相同字段名")] [ErrorCodeItemMetadata("不允许添加相同字段名")] db1002,
db1002,
/// <summary> /// <summary>
/// 父节点不存在 /// 父节点不存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("父节点不存在")] [ErrorCodeItemMetadata("父节点不存在")] R2000,
R2000,
/// <summary> /// <summary>
/// 当前节点Id不能与父节点Id相同 /// 当前节点Id不能与父节点Id相同
@ -656,36 +575,31 @@ public enum ErrorCodeEnum
/// <summary> /// <summary>
/// 已有相同编码或名称 /// 已有相同编码或名称
/// </summary> /// </summary>
[ErrorCodeItemMetadata("已有相同编码或名称")] [ErrorCodeItemMetadata("已有相同编码或名称")] R2002,
R2002,
/// <summary> /// <summary>
/// 默认租户状态禁止修改 /// 默认租户状态禁止修改
/// </summary> /// </summary>
[ErrorCodeItemMetadata("默认租户状态禁止修改")] [ErrorCodeItemMetadata("默认租户状态禁止修改")] Z1001,
Z1001,
/// <summary> /// <summary>
/// 禁止创建此类型的数据库 /// 禁止创建此类型的数据库
/// </summary> /// </summary>
[ErrorCodeItemMetadata("禁止创建此类型的数据库")] [ErrorCodeItemMetadata("禁止创建此类型的数据库")] Z1002,
Z1002,
/// <summary> /// <summary>
/// 租户已禁用 /// 租户已禁用
/// </summary> /// </summary>
[ErrorCodeItemMetadata("租户已禁用")] [ErrorCodeItemMetadata("租户已禁用")] Z1003,
Z1003,
/// <summary> /// <summary>
/// 租户库连接不能为空 /// 租户库连接不能为空
/// </summary> /// </summary>
[ErrorCodeItemMetadata("租户库连接不能为空")] [ErrorCodeItemMetadata("租户库连接不能为空")] Z1004,
Z1004,
/// <summary> /// <summary>
/// 身份标识已存在 /// 身份标识已存在
/// </summary> /// </summary>
[ErrorCodeItemMetadata("身份标识已存在")] [ErrorCodeItemMetadata("身份标识已存在")] O1000,
O1000, [ErrorCodeItemMetadata("设备已存在")] Device1000,
} }

19
Admin.NET.Core/SeedData/SysOrgSeedData.cs

@ -17,20 +17,11 @@ public class SysOrgSeedData : ISqlSugarEntitySeedData<SysOrg>
{ {
return new[] return new[]
{ {
new SysOrg{ Id=1300000000101, Pid=0, Name="松山湖基地", Code="1001", Type="101", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="松山湖基地", TenantId=1300000000001 }, new SysOrg
new SysOrg{ Id=1300000000102, Pid=1300000000101, Name="市场部", Code="100101", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=1300000000001 }, {
new SysOrg{ Id=1300000000103, Pid=1300000000101, Name="研发部", Code="100102", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="研发部", TenantId=1300000000001 }, Id = 1300000000101, Pid = 0, Name = "博工科技", Code = "1", Type = "101", Level = 1,
new SysOrg{ Id=1300000000104, Pid=1300000000101, Name="财务部", Code="100103", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部", TenantId=1300000000001 }, CreateTime = DateTime.Parse("2022-02-10 00:00:00"), Remark = "松山湖基地", TenantId = 1300000000001
}
new SysOrg{ Id=1300000000201, Pid=0, Name="佛山基地", Code="1002", Type="201", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="佛山基地", TenantId=1300000000001 },
new SysOrg{ Id=1300000000202, Pid=1300000000201, Name="市场部", Code="100201", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=1300000000001 },
new SysOrg{ Id=1300000000203, Pid=1300000000201, Name="研发部", Code="100202", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="研发部", TenantId=1300000000001 },
new SysOrg{ Id=1300000000204, Pid=1300000000201, Name="财务部", Code="100203", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="财务部", TenantId=1300000000001 },
new SysOrg{ Id=1300000000301, Pid=0, Name="广州基地", Code="1003", Type="201", Level=1, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="广州基地", TenantId=1300000000001 },
new SysOrg{ Id=1300000000302, Pid=1300000000301, Name="市场部", Code="100301", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=1300000000001 },
new SysOrg{ Id=1300000000303, Pid=1300000000301, Name="研发部", Code="100302", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=1300000000001 },
new SysOrg{ Id=1300000000304, Pid=1300000000301, Name="财务部", Code="100303", Level=2, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), Remark="市场部", TenantId=1300000000001 },
}; };
} }
} }

5
Admin.NET.Core/SeedData/SysRoleMenuSeedData.cs

@ -15,9 +15,10 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData<SysRoleMenu>
return new[] return new[]
{ {
// 数据面板【admin/1300000000101】 // 数据面板【admin/1300000000101】
new SysRoleMenu{ Id=1300000000101, RoleId=1300000000101, MenuId=1300000000101 }, new SysRoleMenu{ Id=1300000000101, RoleId=1300000000101, MenuId=35482331532101 },
new SysRoleMenu{ Id=1300000000102, RoleId=1300000000101, MenuId=1300000000111 }, new SysRoleMenu{ Id=1300000000102, RoleId=1300000000101, MenuId=1300000000111 },
new SysRoleMenu{ Id=1300000000103, RoleId=1300000000101, MenuId=1300000000121 }, new SysRoleMenu{ Id=1300000000103, RoleId=1300000000101, MenuId=35397279041861 },
new SysRoleMenu{ Id=1300000000104, RoleId=1300000000101, MenuId=35571166242117 },
// 系统管理 // 系统管理
new SysRoleMenu{ Id=1300000000111, RoleId=1300000000101, MenuId=1310000000101 }, new SysRoleMenu{ Id=1300000000111, RoleId=1300000000101, MenuId=1310000000101 },

7
Admin.NET.Core/SeedData/SysUserSeedData.cs

@ -1,13 +1,10 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Core; namespace Admin.NET.Core;
/// <summary> /// <summary>
/// 系统用户表种子数据 /// 系统用户表种子数据
/// </summary> /// </summary>
public class SysUserSeedData : ISqlSugarEntitySeedData<SysUser> public class SysUserSeedData
{ {
/// <summary> /// <summary>
/// 种子数据 /// 种子数据
@ -16,6 +13,7 @@ public class SysUserSeedData : ISqlSugarEntitySeedData<SysUser>
public IEnumerable<SysUser> HasData() public IEnumerable<SysUser> HasData()
{ {
var encryptPassword = CryptogramUtil.Encrypt("123456"); var encryptPassword = CryptogramUtil.Encrypt("123456");
var encryptPassword2 = CryptogramUtil.Encrypt("liuzhaoqiang");
return new[] return new[]
{ {
@ -25,6 +23,7 @@ public class SysUserSeedData : ISqlSugarEntitySeedData<SysUser>
new SysUser{ Id=1300000000113, Account="zhangzhuo", Password=encryptPassword, NickName="张卓", RealName="部门职员", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.NormalUser, Remark="部门职员", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000103, PosId=1300000000110, TenantId=1300000000001 }, new SysUser{ Id=1300000000113, Account="zhangzhuo", Password=encryptPassword, NickName="张卓", RealName="部门职员", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.NormalUser, Remark="部门职员", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000103, PosId=1300000000110, TenantId=1300000000001 },
new SysUser{ Id=1300000000114, Account="huangzhifeng", Password=encryptPassword, NickName="黄志风", RealName="普通用户", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.NormalUser, Remark="普通用户", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000104, PosId=1300000000115, TenantId=1300000000001 }, new SysUser{ Id=1300000000114, Account="huangzhifeng", Password=encryptPassword, NickName="黄志风", RealName="普通用户", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.NormalUser, Remark="普通用户", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000104, PosId=1300000000115, TenantId=1300000000001 },
new SysUser{ Id=1300000000115, Account="shikunpeng", Password=encryptPassword, NickName="史鲲鹏", RealName="其他", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.Member, Remark="会员", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000105, PosId=1300000000116, TenantId=1300000000001 }, new SysUser{ Id=1300000000115, Account="shikunpeng", Password=encryptPassword, NickName="史鲲鹏", RealName="其他", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.Member, Remark="会员", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000105, PosId=1300000000116, TenantId=1300000000001 },
new SysUser{ Id=1300000000116, Account="liuzhaoqiang", Password=encryptPassword2, NickName="刘总", RealName="刘照强", Phone="18020030720", Birthday=DateTime.Parse("2000-01-01"), Sex=GenderEnum.Female, AccountType=AccountTypeEnum.Member, Remark="超级管理员", CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrgId=1300000000106, PosId=1300000000117, TenantId=1300000000001 },
}; };
} }
} }

4
Admin.NET.Core/Service/Dict/SysDictDataService.cs

@ -56,8 +56,8 @@ public class SysDictDataService : IDynamicApiController, ITransient
var isExist = await _sysDictDataRep.IsAnyAsync(u => u.Code == input.Code && u.DictTypeId == input.DictTypeId); var isExist = await _sysDictDataRep.IsAnyAsync(u => u.Code == input.Code && u.DictTypeId == input.DictTypeId);
if (isExist) if (isExist)
throw Oops.Oh(ErrorCodeEnum.D3003); throw Oops.Oh(ErrorCodeEnum.D3003);
var obj = input.Adapt<SysDictData>();
await _sysDictDataRep.InsertAsync(input.Adapt<SysDictData>()); await _sysDictDataRep.InsertAsync(obj);
} }
/// <summary> /// <summary>

18
Admin.NET.Core/Service/Role/SysRoleService.cs

@ -56,10 +56,13 @@ public class SysRoleService : IDynamicApiController, ITransient
public async Task<List<RoleOutput>> GetList() public async Task<List<RoleOutput>> GetList()
{ {
// 当前用户已拥有的角色集合 // 当前用户已拥有的角色集合
var roleIdList = _userManager.SuperAdmin ? null : await _sysUserRoleService.GetUserRoleIdList(_userManager.UserId); var roleIdList = _userManager.SuperAdmin
? null
: await _sysUserRoleService.GetUserRoleIdList(_userManager.UserId);
return await _sysRoleRep.AsQueryable() return await _sysRoleRep.AsQueryable()
.WhereIF(roleIdList != null, u => u.CreateUserId == _userManager.UserId || roleIdList.Contains(u.Id)) // 若非超管,则只显示自己创建和已拥有的角色 .WhereIF(roleIdList != null,
u => u.CreateUserId == _userManager.UserId || roleIdList.Contains(u.Id)) // 若非超管,则只显示自己创建和已拥有的角色
.OrderBy(u => u.OrderNo).Select<RoleOutput>().ToListAsync(); .OrderBy(u => u.OrderNo).Select<RoleOutput>().ToListAsync();
} }
@ -91,12 +94,16 @@ public class SysRoleService : IDynamicApiController, ITransient
return; return;
// 将父节点为0的菜单排除,防止前端全选异常 // 将父节点为0的菜单排除,防止前端全选异常
var pMenuIds = await _sysRoleRep.ChangeRepository<SqlSugarRepository<SysMenu>>().AsQueryable().Where(u => input.MenuIdList.Contains(u.Id) && u.Pid == 0).ToListAsync(u => u.Id); //var pMenuIds = await _sysRoleRep.ChangeRepository<SqlSugarRepository<SysMenu>>().AsQueryable().Where(u => input.MenuIdList.Contains(u.Id) && u.Pid == 0).ToListAsync(u => u.Id);
var menuIds = input.MenuIdList.Except(pMenuIds); // 差集 var pMenuIds = await _sysRoleRep.ChangeRepository<SqlSugarRepository<SysMenu>>()
.AsQueryable()
.Where(u => input.MenuIdList.Contains(u.Id) && u.Pid == 0 && u.Type == MenuTypeEnum.Dir)
.ToListAsync(u => u.Id);
var menuIds = input.MenuIdList.Except(pMenuIds).ToList(); // 差集
await GrantMenu(new RoleMenuInput() await GrantMenu(new RoleMenuInput()
{ {
Id = input.Id, Id = input.Id,
MenuIdList = menuIds.ToList() MenuIdList = menuIds
}); });
} }
@ -232,6 +239,7 @@ public class SysRoleService : IDynamicApiController, ITransient
} }
} }
} }
role.DataScope = (DataScopeEnum)dataScope; role.DataScope = (DataScopeEnum)dataScope;
await _sysRoleRep.AsUpdateable(role).UpdateColumns(u => new { u.DataScope }).ExecuteCommandAsync(); await _sysRoleRep.AsUpdateable(role).UpdateColumns(u => new { u.DataScope }).ExecuteCommandAsync();
await _sysRoleOrgService.GrantRoleOrg(input); await _sysRoleOrgService.GrantRoleOrg(input);

11
Admin.NET.Core/Service/User/SysUserService.cs

@ -73,13 +73,12 @@ public class SysUserService : IDynamicApiController, ITransient
DateTime startOfMonth = today.StartOfMonth(); DateTime startOfMonth = today.StartOfMonth();
DateTime endOfMonth = today.EndOfMonth(); DateTime endOfMonth = today.EndOfMonth();
var dailyNewUsers = users var dailyNewUsers = users
.Where(u => u.CreateTime >= today && u.CreateTime < today.AddDays(1)) .Count(u => u.CreateTime >= today && u.CreateTime < today.AddDays(1));
.Count();
// 获取本周新增用户数 // 获取本周新增用户数
int newUsersThisWeek = users.Where(u => u.CreateTime >= startOfWeek && u.CreateTime < endOfWeek) int newUsersThisWeek = users
.Count(); .Count(u => u.CreateTime >= startOfWeek && u.CreateTime < endOfWeek);
int newUsersThisMonth = users.Where(u => u.CreateTime >= startOfMonth && u.CreateTime < endOfMonth) int newUsersThisMonth = users
.Count(); .Count(u => u.CreateTime >= startOfMonth && u.CreateTime < endOfMonth);
return new UserAddInfo{ total = total, dailyNewUsers=dailyNewUsers, return new UserAddInfo{ total = total, dailyNewUsers=dailyNewUsers,
newUsersThisWeek=newUsersThisWeek, newUsersThisMonth=newUsersThisMonth newUsersThisWeek=newUsersThisWeek, newUsersThisMonth=newUsersThisMonth

2
Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@ -1,4 +1,6 @@
using System.Text.Json;
namespace Admin.NET.Core; namespace Admin.NET.Core;
public static class SqlSugarSetup public static class SqlSugarSetup

5
Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj

@ -40,9 +40,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Admin.Bodk.Customer\Admin.Bodk.Customer.csproj" />
<ProjectReference Include="..\Admin.Bodk.Device\Admin.Bodk.Device.csproj" /> <ProjectReference Include="..\Admin.Bodk.Device\Admin.Bodk.Device.csproj" />
<ProjectReference Include="..\Admin.NET.Bodk.Device\Admin.NET.Bodk.Device.csproj" /> <ProjectReference Include="..\Admin.NET.Bodk.Cells\Admin.NET.Bodk.Cells.csproj" />
<ProjectReference Include="..\Admin.NET.Bodk.Customer\Admin.NET.Bodk.Customer.csproj" />
<ProjectReference Include="..\Admin.NET.Bodk.Genetic\Admin.NET.Bodk.Genetic.csproj" />
<ProjectReference Include="..\Admin.NET.Bodk.Project\Admin.NET.Bodk.Project.csproj" /> <ProjectReference Include="..\Admin.NET.Bodk.Project\Admin.NET.Bodk.Project.csproj" />
<ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" /> <ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" />
</ItemGroup> </ItemGroup>

BIN
Admin.NET.Web.Entry/Admin.NET.db

Binary file not shown.

18
Admin.NET.sln

@ -30,8 +30,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bodk.Extensions.Modbus", "B
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.Bodk.Customer", "Admin.Bodk.Customer\Admin.Bodk.Customer.csproj", "{6A073364-6552-4CDB-861A-4BD8B51E0FF6}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.Bodk.Customer", "Admin.Bodk.Customer\Admin.Bodk.Customer.csproj", "{6A073364-6552-4CDB-861A-4BD8B51E0FF6}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Core", "Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj", "{C7CEFE53-6599-4249-B107-2912415660BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Genetic", "Admin.NET.Bodk.Genetic\Admin.NET.Bodk.Genetic.csproj", "{BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Genetic", "Admin.NET.Bodk.Genetic\Admin.NET.Bodk.Genetic.csproj", "{BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Device", "Admin.NET.Bodk.Device\Admin.NET.Bodk.Device.csproj", "{35FB5A4D-4C35-4AF4-9719-1392707F9FF5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Device", "Admin.NET.Bodk.Device\Admin.NET.Bodk.Device.csproj", "{35FB5A4D-4C35-4AF4-9719-1392707F9FF5}"
@ -40,6 +38,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Customer", "
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Project", "Admin.NET.Bodk.Project\Admin.NET.Bodk.Project.csproj", "{51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Project", "Admin.NET.Bodk.Project\Admin.NET.Bodk.Project.csproj", "{51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Cells", "Admin.NET.Bodk.Cells\Admin.NET.Bodk.Cells.csproj", "{8E9C2CA3-E6F7-4798-AF8C-C1E538DC6B12}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Core", "Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj", "{0273F0C6-A22B-494D-AA0B-30628C537FEA}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -86,10 +88,6 @@ Global
{6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Debug|Any CPU.Build.0 = Debug|Any CPU {6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Release|Any CPU.Build.0 = Release|Any CPU {6A073364-6552-4CDB-861A-4BD8B51E0FF6}.Release|Any CPU.Build.0 = Release|Any CPU
{C7CEFE53-6599-4249-B107-2912415660BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C7CEFE53-6599-4249-B107-2912415660BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C7CEFE53-6599-4249-B107-2912415660BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C7CEFE53-6599-4249-B107-2912415660BD}.Release|Any CPU.Build.0 = Release|Any CPU
{BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Debug|Any CPU.Build.0 = Debug|Any CPU {BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {BA340773-EEAA-430C-A0FC-AB6C3B35BA6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -106,6 +104,14 @@ Global
{51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Debug|Any CPU.Build.0 = Debug|Any CPU {51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Release|Any CPU.ActiveCfg = Release|Any CPU {51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Release|Any CPU.Build.0 = Release|Any CPU {51EDA0FA-0D80-4631-9A2E-9315E99BA3CC}.Release|Any CPU.Build.0 = Release|Any CPU
{8E9C2CA3-E6F7-4798-AF8C-C1E538DC6B12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E9C2CA3-E6F7-4798-AF8C-C1E538DC6B12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E9C2CA3-E6F7-4798-AF8C-C1E538DC6B12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E9C2CA3-E6F7-4798-AF8C-C1E538DC6B12}.Release|Any CPU.Build.0 = Release|Any CPU
{0273F0C6-A22B-494D-AA0B-30628C537FEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0273F0C6-A22B-494D-AA0B-30628C537FEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0273F0C6-A22B-494D-AA0B-30628C537FEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0273F0C6-A22B-494D-AA0B-30628C537FEA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

Loading…
Cancel
Save