Compare commits

...

2 Commits

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

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

@ -1,4 +1,3 @@
using System.ComponentModel;
using Admin.Bodk.Device.Entities.Dto;
using Admin.Bodk.Device.Entities.equipment;
@ -11,21 +10,27 @@ using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NewLife.Caching;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace Admin.Bodk.Device.Services;
/// <summary>
/// 服务管理
/// </summary>
[ApiDescriptionSettings(Order = 2)]
public class SupportService: IDynamicApiController, ITransient
public class SupportService : IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Entities.Base> _baseRep;
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;
_supportRep = supportRep;
_cache = cache;
}
/// <summary>
@ -34,13 +39,17 @@ public class SupportService: IDynamicApiController, ITransient
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("获取检测信息列表")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<SupportOutput>> PostGetDetectionList(BaseInput input)
{
List<SupportOutput> items = new List<SupportOutput>();
items.Add( new SupportOutput() {State="检测中",Name = "检测1",DetectionServiceId = "dd123323",DetectionServiceType=0});
items.Add( new SupportOutput() {State="已完成",Name = "检测2",DetectionServiceId = "dd1233213",DetectionServiceType=1});
items.Add( new SupportOutput() {State="已完成",Name = "检测3",DetectionServiceId = "dd1233213",DetectionServiceType=1});
items.Add(new SupportOutput()
{ State = "检测中", Name = "检测1", DetectionServiceId = "dd123323", DetectionServiceType = 0 });
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 };
}
@ -50,17 +59,21 @@ public class SupportService: IDynamicApiController, ITransient
/// <param name="input"></param>
/// <returns></returns>
[DisplayName("获取细胞服务列表")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[Authorize(AuthenticationSchemes =
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
public async Task<SqlSugarPagedList<CellOutput>> PostGetCellList(BaseInput input)
{
List<CellOutput> items = new List<CellOutput>();
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()
var cache = _cache.Get<dynamic>("bodk:device:M9hjashdfkj863478236478:summary");
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()
{
DeviceId=23223232,PicUrl="",LiquidNitrogenHeight=180,Temperature=-195.2,
Humidity="0.5%",Address="广东省东莞市松山湖园区科技二路宏远新智汇1栋",
Name="M9_01",CellBaseInfo=new CellBaseInfo(){BaseName="松山湖",BaseId=13545}
DeviceId = 23223232, PicUrl = "", LiquidNitrogenHeight = cache?.LiquidHeight, Temperature = cache?.TankTopTemperature,
Humidity = $"{cache?.CavityHumidity.ToString("0.0")}%", Address = "广东省东莞市松山湖园区科技二路宏远新智汇1栋",
Name = "M9_01", CellBaseInfo = new CellBaseInfo() { BaseName = "松山湖", BaseId = 13545 }
}
});
return new SqlSugarPagedList<CellOutput>() { Page = 1, PageSize = 20, Items = items, Total = 3 };
@ -76,7 +89,7 @@ public class SupportService: IDynamicApiController, ITransient
[DisplayName("增加服务")]
public async Task<long> AddSupport(SupportAddInput input)
{
if(input is null) throw Oops.Oh("参数不能为空");
if (input is null) throw Oops.Oh("参数不能为空");
var equipment = input.Adapt<Entities.Support>();
var newEquipment = await _supportRep.AsInsertable(equipment).ExecuteReturnEntityAsync();
// if (input?.TaskChainList is { Count: > 0 })

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" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.DynamicProxy" Version="2.2.0" />
</ItemGroup>
</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 文件的许可证
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>
<ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj" />
<ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
</ItemGroup>

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

@ -2,14 +2,125 @@
//
// 此源代码遵循位于源代码树根目录中的 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.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Customer;
[ApiDescriptionSettings(GroupName = "Bodk Groups",Description = "客户接口服务")]
public class CustomerService: IDynamicApiController, ITransient
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Customer", Description = "客户接口服务")]
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 Nest;
using SqlSugar;
namespace Admin.NET.Bodk.Customer.Entities;
[SugarTable("bodk_base_customer")]
public class CustomerEntity : EntityBase, IRepositorySettings
{
public string Name { get; set; }
@ -16,4 +18,11 @@ public class CustomerEntity : EntityBase, IRepositorySettings
public string Phone { 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>
<ItemGroup>
<ProjectReference Include="..\Admin.NET.Bodk.Core\Admin.NET.Bodk.Core.csproj" />
<ProjectReference Include="..\Admin.NET.Web.Core\Admin.NET.Web.Core.csproj" />
</ItemGroup>

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

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

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

@ -17,20 +17,11 @@ public class SysOrgSeedData : ISqlSugarEntitySeedData<SysOrg>
{
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{ 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 },
new SysOrg{ Id=1300000000104, Pid=1300000000101, Name="财务部", Code="100103", Level=2, 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 },
new SysOrg
{
Id = 1300000000101, Pid = 0, Name = "博工科技", Code = "1", Type = "101", Level = 1,
CreateTime = DateTime.Parse("2022-02-10 00:00:00"), Remark = "松山湖基地", 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);
if (isExist)
throw Oops.Oh(ErrorCodeEnum.D3003);
await _sysDictDataRep.InsertAsync(input.Adapt<SysDictData>());
var obj = input.Adapt<SysDictData>();
await _sysDictDataRep.InsertAsync(obj);
}
/// <summary>

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

@ -56,10 +56,13 @@ public class SysRoleService : IDynamicApiController, ITransient
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()
.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();
}
@ -92,12 +95,15 @@ public class SysRoleService : IDynamicApiController, ITransient
// 将父节点为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)).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()
{
Id = input.Id,
MenuIdList = menuIds.ToList()
MenuIdList = menuIds
});
}
@ -233,6 +239,7 @@ public class SysRoleService : IDynamicApiController, ITransient
}
}
}
role.DataScope = (DataScopeEnum)dataScope;
await _sysRoleRep.AsUpdateable(role).UpdateColumns(u => new { u.DataScope }).ExecuteCommandAsync();
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 endOfMonth = today.EndOfMonth();
var dailyNewUsers = users
.Where(u => u.CreateTime >= today && u.CreateTime < today.AddDays(1))
.Count();
.Count(u => u.CreateTime >= today && u.CreateTime < today.AddDays(1));
// 获取本周新增用户数
int newUsersThisWeek = users.Where(u => u.CreateTime >= startOfWeek && u.CreateTime < endOfWeek)
.Count();
int newUsersThisMonth = users.Where(u => u.CreateTime >= startOfMonth && u.CreateTime < endOfMonth)
.Count();
int newUsersThisWeek = users
.Count(u => u.CreateTime >= startOfWeek && u.CreateTime < endOfWeek);
int newUsersThisMonth = users
.Count(u => u.CreateTime >= startOfMonth && u.CreateTime < endOfMonth);
return new UserAddInfo{ total = total, dailyNewUsers=dailyNewUsers,
newUsersThisWeek=newUsersThisWeek, newUsersThisMonth=newUsersThisMonth

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

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

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

@ -40,9 +40,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Admin.Bodk.Customer\Admin.Bodk.Customer.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.Web.Core\Admin.NET.Web.Core.csproj" />
</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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.Bodk.Customer", "Admin.Bodk.Customer\Admin.Bodk.Customer.csproj", "{6A073364-6552-4CDB-861A-4BD8B51E0FF6}"
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}"
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}"
@ -40,6 +38,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Admin.NET.Bodk.Customer", "
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}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|Any CPU.ActiveCfg = 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.Build.0 = Debug|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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Loading…
Cancel
Save