Browse Source

修正代码

master
anerx 2 months ago
parent
commit
3b21f6d0fb
  1. 7
      Admin.Bodk.Device/Services/SupportService.cs
  2. 1
      Admin.NET.Bodk.Cells/CellService.cs
  3. 4
      Admin.NET.Bodk.Customer/CustomerService.cs
  4. 2
      Admin.NET.Bodk.Device/Controllers/DeviceController.cs
  5. 102
      Admin.NET.Bodk.Device/DeviceService.cs
  6. 15
      Admin.NET.Bodk.Genetic/Entities/GeneticTestResultEntity.cs
  7. 14
      Admin.NET.Bodk.Genetic/GeneticTestService.cs
  8. 12
      Admin.NET.Bodk.Genetic/Models/BindGeneticTestBarcode.cs
  9. 2
      Admin.NET.Bodk.Project/ProjectService.cs
  10. 7
      Admin.NET.Core/Entity/SysOrg.cs
  11. 15
      Admin.NET.Core/Entity/SysStationService.cs
  12. 25
      Admin.NET.Core/Service/Org/Dto/Area.cs
  13. 15
      Admin.NET.Core/Service/Org/Dto/Factory.cs
  14. 14
      Admin.NET.Core/Service/Org/Dto/Station.cs
  15. 10
      Admin.NET.Core/Service/Org/Dto/StationService.cs
  16. 166
      Admin.NET.Core/Service/Org/SysOrgService.cs
  17. 1
      Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj

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

@ -71,8 +71,11 @@ public class SupportService : IDynamicApiController, ITransient
Density = "1*10^7个/ml", Capacity = "1.8ml", Type = 1, Location = "松山湖", LastOperationTime = null,
DeviceInfo = new DeviceInfo()
{
DeviceId = 23223232, PicUrl = "", LiquidNitrogenHeight = cache?.LiquidHeight, Temperature = cache?.TankTopTemperature,
Humidity = $"{cache?.CavityHumidity.ToString("0.0")}%", Address = "广东省东莞市松山湖园区科技二路宏远新智汇1栋",
DeviceId = 23223232, PicUrl = "", LiquidNitrogenHeight = cache is null ? 180 : cache.LiquidHeight,
Temperature = cache is null ? -195.2 : cache.TankTopTemperature,
Humidity =
cache is null ? "0.01%" : $"{cache.TankTopTemperaturecache?.CavityHumidity.ToString("0.0")}%",
Address = "广东省东莞市松山湖园区科技二路宏远新智汇1栋",
Name = "M9_01", CellBaseInfo = new CellBaseInfo() { BaseName = "松山湖", BaseId = 13545 }
}
});

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

@ -114,4 +114,5 @@ public class CellService : IDynamicApiController, ITransient
{
await _repository.DeleteByIdAsync(id);
}
}

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

@ -70,7 +70,9 @@ public class CustomerService(
IsDelete = u.IsDelete,
CreateUserId = u.CreateUserId,
UpdateUserId = u.UpdateUserId,
UpdateUserName = u.UpdateUserName
UpdateUserName = u.UpdateUserName,
VoiceUrl = u.VoiceUrl,
ImageUrl = u.ImageUrl
})
.ToPagedListAsync(input.Page, input.PageSize);
}

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 = "DeviceOld",Description = "设备接口服务")]
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" },Name = "Device",Description = "设备接口服务")]
public class DeviceController : IDynamicApiController, ITransient
{
private readonly ICache _cache;

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

@ -25,55 +25,55 @@ public class DeviceService(
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);
}
// [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);
// }
}

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

@ -12,17 +12,22 @@ public class GeneticTestResultEntity : EntityBase
{
public long CustomerId { get; set; }
public string Code { get; set; }
[SugarColumn(IsNullable = true)]
public string? Code { get; set; }
public string TestType { get; set; }
[SugarColumn(IsNullable = true)]
public string? TestType { get; set; }
public string Barcode { get; set; }
public GeneticTestStatus Status { get; set; }
[SugarColumn(IsNullable = true)]
public GeneticTestStatus? Status { get; set; }
public DateTime GenerationTime { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? GenerationTime { get; set; }
public DateTime CollectionTime { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? CollectionTime { get; set; }
}
public enum GeneticTestStatus

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

@ -156,4 +156,18 @@ public class GeneticTestService : IDynamicApiController, ITransient
await _resultRepository.DeleteByIdAsync(id);
await _itemRepository.DeleteAsync(i => i.GeneticTestResultId == id);
}
[ApiDescriptionSettings(Name = "Bind"), HttpPost]
[DisplayName("Bind")]
public async Task<long> BindGeneticTestBarcode(BindGeneticTestBarcodeInput input)
{
var entity = new GeneticTestResultEntity()
{
CustomerId = input.CustomerId,
Barcode = input.Barcode,
Status = GeneticTestStatus.Sampled
};
var id = await _resultRepository.InsertReturnSnowflakeIdAsync(entity);
return id;
}
}

12
Admin.NET.Bodk.Genetic/Models/BindGeneticTestBarcode.cs

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

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

@ -5,9 +5,11 @@
using Admin.NET.Bodk.Core;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Project;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Project", Description = "项目服务列表")]
public class ProjectService(UserManager userManager, SysOrgService sysOrgService, SysUserService sysUserService)
: ServiceBase(userManager, sysOrgService, sysUserService)
{

7
Admin.NET.Core/Entity/SysOrg.cs

@ -91,4 +91,11 @@ public class SysOrg : EntityTenant
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool Disabled { get; set; }
[SugarColumn(IsNullable = true, ColumnDataType = "TEXT")]
public string? Position { get; set; }
[SugarColumn(IsArray = true)] public long[]? ServiceIds { get; set; }
[SugarColumn(IsIgnore = true)] public List<SysStationService>? Services { get; set; }
}

15
Admin.NET.Core/Entity/SysStationService.cs

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

25
Admin.NET.Core/Service/Org/Dto/Area.cs

@ -0,0 +1,25 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Core.Service;
public class AreaOutput:SysOrg
{
public List<FactoryOutput>? Factories { get; set; }
}
public class AddAreaInput
{
public long Pid { get; set; }
public string Name { get; set; }
public string Code { get; set; }
public long DirectorId { get; set; }
public string? Remark { get; set; }
}

15
Admin.NET.Core/Service/Org/Dto/Factory.cs

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

14
Admin.NET.Core/Service/Org/Dto/Station.cs

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

10
Admin.NET.Core/Service/Org/Dto/StationService.cs

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

166
Admin.NET.Core/Service/Org/SysOrgService.cs

@ -1,4 +1,3 @@
namespace Admin.NET.Core.Service;
/// <summary>
@ -42,7 +41,8 @@ public class SysOrgService : IDynamicApiController, ITransient
var iSugarQueryable = _sysOrgRep.AsQueryable().OrderBy(u => u.OrderNo);
// 带条件筛选时返回列表数据
if (!string.IsNullOrWhiteSpace(input.Name) || !string.IsNullOrWhiteSpace(input.Code) || !string.IsNullOrWhiteSpace(input.Type))
if (!string.IsNullOrWhiteSpace(input.Name) || !string.IsNullOrWhiteSpace(input.Code) ||
!string.IsNullOrWhiteSpace(input.Type))
{
return await iSugarQueryable.WhereIF(userOrgIdList.Count > 0, u => userOrgIdList.Contains(u.Id))
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
@ -58,7 +58,8 @@ public class SysOrgService : IDynamicApiController, ITransient
}
else
{
orgTree = await iSugarQueryable.ToTreeAsync(u => u.Children, u => u.Pid, input.Id, userOrgIdList.Select(d => (object)d).ToArray());
orgTree = await iSugarQueryable.ToTreeAsync(u => u.Children, u => u.Pid, input.Id,
userOrgIdList.Select(d => (object)d).ToArray());
// 递归禁用没权限的机构(防止用户修改或创建无权的机构和用户)
HandlerOrgTree(orgTree, userOrgIdList);
}
@ -69,6 +70,7 @@ public class SysOrgService : IDynamicApiController, ITransient
sysOrg.Children = orgTree;
orgTree = new List<SysOrg> { sysOrg };
}
return orgTree;
}
@ -148,6 +150,7 @@ public class SysOrgService : IDynamicApiController, ITransient
DeleteAllUserOrgCache(sysOrg.Id, input.Pid);
}
}
if (input.Id == input.Pid)
throw Oops.Oh(ErrorCodeEnum.D2001);
@ -246,14 +249,17 @@ public class SysOrgService : IDynamicApiController, ITransient
var userId = long.Parse(userOrgKey.Substring(CacheConst.KeyUserOrg));
if (userOrgs.Contains(orgId) || userOrgs.Contains(orgPid))
{
SqlSugarFilter.DeleteUserOrgCache(userId, _sysOrgRep.Context.CurrentConnectionConfig.ConfigId.ToString());
SqlSugarFilter.DeleteUserOrgCache(userId,
_sysOrgRep.Context.CurrentConnectionConfig.ConfigId.ToString());
}
if (orgPid == 0)
{
var dataScope = _sysCacheService.Get<int>($"{CacheConst.KeyRoleMaxDataScope}{userId}");
if (dataScope == (int)DataScopeEnum.All)
{
SqlSugarFilter.DeleteUserOrgCache(userId, _sysOrgRep.Context.CurrentConnectionConfig.ConfigId.ToString());
SqlSugarFilter.DeleteUserOrgCache(userId,
_sysOrgRep.Context.CurrentConnectionConfig.ConfigId.ToString());
}
}
}
@ -275,7 +281,8 @@ public class SysOrgService : IDynamicApiController, ITransient
if (orgIdList == null || orgIdList.Count < 1)
{
// 本人创建机构集合
var orgList0 = await _sysOrgRep.AsQueryable().Where(u => u.CreateUserId == userId).Select(u => u.Id).ToListAsync();
var orgList0 = await _sysOrgRep.AsQueryable().Where(u => u.CreateUserId == userId).Select(u => u.Id)
.ToListAsync();
// 扩展机构集合
var orgList1 = await _sysUserExtOrgService.GetUserExtOrgList(userId);
// 角色机构集合
@ -287,6 +294,7 @@ public class SysOrgService : IDynamicApiController, ITransient
orgIdList.Add(_userManager.OrgId);
_sysCacheService.Set($"{CacheConst.KeyUserOrg}{userId}", orgIdList, TimeSpan.FromDays(7)); // 存缓存
}
return orgIdList;
}
@ -340,7 +348,8 @@ public class SysOrgService : IDynamicApiController, ITransient
}
// 缓存当前用户最大角色数据范围
_sysCacheService.Set(CacheConst.KeyRoleMaxDataScope + _userManager.UserId, strongerDataScopeType, TimeSpan.FromDays(7));
_sysCacheService.Set(CacheConst.KeyRoleMaxDataScope + _userManager.UserId, strongerDataScopeType,
TimeSpan.FromDays(7));
// 根据角色集合获取机构集合
var roleOrgIdList = await _sysRoleOrgService.GetRoleOrgIdList(customDataScopeRoleIdList);
@ -373,6 +382,7 @@ public class SysOrgService : IDynamicApiController, ITransient
{
orgIdList.Add(orgId);
}
return orgIdList;
}
@ -387,4 +397,146 @@ public class SysOrgService : IDynamicApiController, ITransient
var orgTreeList = await _sysOrgRep.AsQueryable().ToChildListAsync(u => u.Pid, pid, true);
return orgTreeList.Select(u => u.Id).ToList();
}
/// <summary>
/// 增加区域
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "AddArea"), HttpPost]
[DisplayName("增加区域")]
public async Task<long> AddArea(AddAreaInput input)
{
if (!_userManager.SuperAdmin && input.Pid == 0)
throw Oops.Oh(ErrorCodeEnum.D2009);
if (await _sysOrgRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code))
throw Oops.Oh(ErrorCodeEnum.D2002);
if (!_userManager.SuperAdmin && input.Pid != 0)
{
// 新增机构父Id不是0,则进行权限校验
var orgIdList = await GetUserOrgIdList();
// 新增机构的父机构不在自己的数据范围内
if (orgIdList.Count < 1 || !orgIdList.Contains(input.Pid))
throw Oops.Oh(ErrorCodeEnum.D2003);
}
// 删除与此父机构有关的用户机构缓存
var pOrg = await _sysOrgRep.GetFirstAsync(u => u.Id == input.Pid);
if (pOrg != null)
DeleteAllUserOrgCache(pOrg.Id, pOrg.Pid);
else if (input.Pid == 0)
DeleteAllUserOrgCache(0, 0);
var newOrg = await _sysOrgRep.AsInsertable(new SysOrg()
{
Pid = input.Pid,
Status = StatusEnum.Enable,
CreateUserId = _userManager.UserId,
CreateUserName = _userManager.Account,
Name = input.Name,
Code = input.Code,
Type = "Area",
Remark = input.Remark,
DirectorId = input.DirectorId
}).ExecuteReturnEntityAsync();
return newOrg.Id;
}
/// <summary>
/// 增加基地
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "AddFactory"), HttpPost]
[DisplayName("增加基地")]
public async Task<long> AddFactory(AddFactoryInput input)
{
if (!_userManager.SuperAdmin && input.Pid == 0)
throw Oops.Oh(ErrorCodeEnum.D2009);
if (await _sysOrgRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code))
throw Oops.Oh(ErrorCodeEnum.D2002);
if (!_userManager.SuperAdmin && input.Pid != 0)
{
// 新增机构父Id不是0,则进行权限校验
var orgIdList = await GetUserOrgIdList();
// 新增机构的父机构不在自己的数据范围内
if (orgIdList.Count < 1 || !orgIdList.Contains(input.Pid))
throw Oops.Oh(ErrorCodeEnum.D2003);
}
// 删除与此父机构有关的用户机构缓存
var pOrg = await _sysOrgRep.GetFirstAsync(u => u.Id == input.Pid);
if (pOrg != null)
DeleteAllUserOrgCache(pOrg.Id, pOrg.Pid);
else if (input.Pid == 0)
DeleteAllUserOrgCache(0, 0);
var newOrg = await _sysOrgRep.AsInsertable(new SysOrg()
{
Pid = input.Pid,
Status = StatusEnum.Enable,
CreateUserId = _userManager.UserId,
CreateUserName = _userManager.Account,
Name = input.Name,
Code = input.Code,
Type = "Factory",
Remark = input.Remark,
DirectorId = input.DirectorId,
Position = input.Position
}).ExecuteReturnEntityAsync();
return newOrg.Id;
}
/// <summary>
/// 增加工作站
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[ApiDescriptionSettings(Name = "AddStation"), HttpPost]
[DisplayName("增加工作站")]
public async Task<long> AddStation(AddStationInput input)
{
if (!_userManager.SuperAdmin && input.Pid == 0)
throw Oops.Oh(ErrorCodeEnum.D2009);
if (await _sysOrgRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code))
throw Oops.Oh(ErrorCodeEnum.D2002);
if (!_userManager.SuperAdmin && input.Pid != 0)
{
// 新增机构父Id不是0,则进行权限校验
var orgIdList = await GetUserOrgIdList();
// 新增机构的父机构不在自己的数据范围内
if (orgIdList.Count < 1 || !orgIdList.Contains(input.Pid))
throw Oops.Oh(ErrorCodeEnum.D2003);
}
// 删除与此父机构有关的用户机构缓存
var pOrg = await _sysOrgRep.GetFirstAsync(u => u.Id == input.Pid);
if (pOrg != null)
DeleteAllUserOrgCache(pOrg.Id, pOrg.Pid);
else if (input.Pid == 0)
DeleteAllUserOrgCache(0, 0);
var ids = input.Services?.Select(s => s.Id).ToArray();
var newOrg = await _sysOrgRep.AsInsertable(new SysOrg()
{
Pid = input.Pid,
Status = StatusEnum.Enable,
CreateUserId = _userManager.UserId,
CreateUserName = _userManager.Account,
Name = input.Name,
Code = input.Code,
Type = "Station",
Remark = input.Remark,
DirectorId = input.DirectorId,
ServiceIds = ids,
}).ExecuteReturnEntityAsync();
return newOrg.Id;
}
}

1
Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj

@ -43,6 +43,7 @@
<ProjectReference Include="..\Admin.Bodk.Device\Admin.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.Device\Admin.NET.Bodk.Device.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" />

Loading…
Cancel
Save