Browse Source

修正接口

master
anerx 4 months ago
parent
commit
284ad0bb08
  1. 8
      Admin.Bodk.Device/Entities/Dto/Base.cs
  2. 4
      Admin.Bodk.Device/Entities/Dto/SupportDto.cs
  3. 2
      Admin.Bodk.Device/Services/BaseService.cs
  4. 5
      Admin.Bodk.Device/Services/SupportService.cs
  5. 27
      Admin.NET.Bodk.Genetic/Entities/GeneticItemTestResultEntity.cs
  6. 48
      Admin.NET.Bodk.Genetic/Entities/GeneticTestResultEntity.cs
  7. 42
      Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingReportEntity.cs
  8. 22
      Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingTumorLocusReportEntity.cs
  9. 25
      Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingTumorReportEntity.cs
  10. 17
      Admin.NET.Bodk.Genetic/Entities/Tumors/GeneLocusEntity.cs
  11. 15
      Admin.NET.Bodk.Genetic/Entities/Tumors/GeneLocusRiskEntity.cs
  12. 18
      Admin.NET.Bodk.Genetic/Entities/Tumors/GeneTypeEntity.cs
  13. 18
      Admin.NET.Bodk.Genetic/Entities/Tumors/TumorEntity.cs
  14. 15
      Admin.NET.Bodk.Genetic/Entities/Tumors/TumorGeneLocusEntity.cs
  15. 255
      Admin.NET.Bodk.Genetic/GeneReportService.cs
  16. 176
      Admin.NET.Bodk.Genetic/GeneticTestService.cs
  17. 26
      Admin.NET.Bodk.Genetic/Models/GeneticItem.cs
  18. 62
      Admin.NET.Bodk.Genetic/Models/GeneticTestResult.cs
  19. 65
      Admin.NET.Bodk.Genetic/Models/Reports/AddReportInput.cs
  20. 4
      Admin.NET.Bodk.Genetic/Models/Reports/BindInput.cs
  21. 85
      Admin.NET.Bodk.Genetic/Models/Reports/ReportOutput.cs
  22. 93
      Admin.NET.Bodk.Genetic/TumorService.cs
  23. 2
      Admin.NET.Bodk.Project/Entities/StationExtEntity.cs
  24. 16
      Admin.NET.Core/Entity/SysOrg.cs
  25. 3
      Admin.NET.Core/SeedData/SysOrgSeedData.cs
  26. 49
      Admin.NET.Core/Service/File/SysFileService.cs
  27. 13
      Admin.NET.Core/Service/Org/Dto/Area.cs
  28. 49
      Admin.NET.Core/Service/Org/SysOrgService.cs
  29. 10
      Admin.NET.Core/Service/Org/SysStationServiceService.cs

8
Admin.Bodk.Device/Entities/Dto/Base.cs

@ -4,17 +4,21 @@ namespace Admin.Bodk.Device.Entities.Dto;
public class Base
{
}
public class BaseInput : BasePageInput
{
}
public class BaseOutput
{
public long Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public string Remark { get; set; }
public int Phone { get; set; }
public DateTime CreateTime { get; set; }

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

@ -48,6 +48,10 @@ public class DeviceInfo
public string Humidity { get; set; }
public string Address { get; set; }
public string Name { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public CellBaseInfo CellBaseInfo { get; set; }
}

2
Admin.Bodk.Device/Services/BaseService.cs

@ -44,6 +44,8 @@ public class BaseService : IDynamicApiController, ITransient
Id = u.Id,
Name = u.Name,
Address = u.Address,
Longitude =113.88596284379673 ,
Latitude = 22.961465648223214,
Remark = u.Remark,
Phone = u.Phone,
SupportList =SqlFunc.Subqueryable<Support>().Where(tc => tc.BaseId == u.Id).ToList()

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

@ -73,9 +73,10 @@ public class SupportService : IDynamicApiController, ITransient
{
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栋",
Longitude =113.88596284379673 ,
Latitude = 22.961465648223214,
Humidity = cache is null ? "0.1%" : $"{cache?.CavityHumidity.ToString("0.0")}%",
Name = "M9_01", CellBaseInfo = new CellBaseInfo() { BaseName = "松山湖", BaseId = 13545 }
}
});

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

@ -1,27 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话: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; }
}

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

@ -1,48 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities;
[SugarTable("bodk_genetic_test_result")]
public class GeneticTestResultEntity : EntityBase
{
public long CustomerId { get; set; }
[SugarColumn(IsNullable = true)]
public string? Code { get; set; }
[SugarColumn(IsNullable = true)]
public string? TestType { get; set; }
public string Barcode { get; set; }
[SugarColumn(IsNullable = true)]
public GeneticTestStatus? Status { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? GenerationTime { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? CollectionTime { get; set; }
}
public enum GeneticTestStatus
{
Sampled = 1,
Sent,
Resampling,
Received,
Analyzing,
ReAnalyzing,
UnderReview,
UnderReviewComplete,
NotPassed,
Completed,
Terminated,
Paused,
Failed
}

42
Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingReportEntity.cs

@ -0,0 +1,42 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities.Reports;
[SugarTable("bodk_gene_testing_report")]
public class GeneTestingReportEntity : EntityBase
{
public long CustomerId { get; set; }
public string? Barcode { get; set; }
public string? SampleType { get; set; }
public string? TestingType { get; set; }
public string? TestingMethod { get; set; }
public DateTime? SubmissionTime { get; set; }
public DateTime? ReportTime { get; set; }
public bool? SampleQuality { get; set; }
public bool? DnaExtraction { get; set; }
public bool? Pcr { get; set; }
public bool? TofMs { get; set; }
public bool? GenotypingAnalysis { get; set; }
public bool? GeneticRiskAssessment { get; set; }
public bool? Report { get; set; }
[SugarColumn(IsIgnore = true)] public List<GeneTestingTumorReportEntity>? Tumors { get; set; }
}

22
Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingTumorLocusReportEntity.cs

@ -0,0 +1,22 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Genetic.Entities.Tumors;
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities.Reports;
[SugarTable("bodk_gene_testing_tumor_locus_report")]
public class GeneTestingTumorLocusReportEntity : EntityBase
{
public long TumorId { get; set; }
public long LocusId { get; set; }
public long RiskId { get; set; }
[SugarColumn(IsIgnore = true)] public GeneLocusEntity? Locus { get; set; }
[SugarColumn(IsIgnore = true)] public GeneTypeEntity? Risk { get; set; }
}

25
Admin.NET.Bodk.Genetic/Entities/Reports/GeneTestingTumorReportEntity.cs

@ -0,0 +1,25 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Bodk.Genetic.Entities.Tumors;
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities.Reports;
[SugarTable("bodk_gene_testing_tumor_report")]
public class GeneTestingTumorReportEntity : EntityBase
{
public long ReportId { get; set; }
public long TumorId { get; set; }
public float RiskScore { get; set; }
public int RiskLevel { get; set; }
[SugarColumn(IsIgnore = true)] public TumorEntity? TumorDescription { get; set; }
[SugarColumn(IsIgnore = true)] public List<GeneTestingTumorLocusReportEntity>? Loci { get; set; }
}

17
Admin.NET.Bodk.Genetic/Entities/Tumors/GeneLocusEntity.cs

@ -0,0 +1,17 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities.Tumors;
[SugarTable("bodk_gene_locus")]
public class GeneLocusEntity:EntityBase
{
public string Name { get; set; }
public string Position { get; set; }
[SugarColumn(IsIgnore = true)]
public List<GeneTypeEntity> Types { get; set; }
}

15
Admin.NET.Bodk.Genetic/Entities/Tumors/GeneLocusRiskEntity.cs

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

18
Admin.NET.Bodk.Genetic/Models/Genetic.cs → Admin.NET.Bodk.Genetic/Entities/Tumors/GeneTypeEntity.cs

@ -2,17 +2,15 @@
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Genetic.Models;
using Admin.NET.Core;
using SqlSugar;
public class Genetic
{
public string Name { get; set; }
public string Postion { get; set; }
public bool Risk { get; set; }
public string Type { get; set; }
namespace Admin.NET.Bodk.Genetic.Entities.Tumors;
[SugarTable("bodk_gene_locus_type")]
public class GeneTypeEntity : EntityBase
{
public string Description { get; set; }
public string GenekType { get; set; }
public bool Risk { get; set; }
}

18
Admin.NET.Bodk.Genetic/Entities/Tumors/TumorEntity.cs

@ -0,0 +1,18 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic.Entities.Tumors;
[SugarTable("bodk_tumor")]
public class TumorEntity : EntityBase
{
public string Code { get; set; }
public string TumorName { get; set; }
public string Description { get; set; }
public double AvaRiskScore { get; set; }
[SugarColumn(IsIgnore = true)] public List<GeneLocusEntity> GeneLoci { get; set; }
}

15
Admin.NET.Bodk.Genetic/Entities/Tumors/TumorGeneLocusEntity.cs

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

255
Admin.NET.Bodk.Genetic/GeneReportService.cs

@ -0,0 +1,255 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Admin.NET.Bodk.Core;
using Admin.NET.Bodk.Genetic.Entities.Reports;
using Admin.NET.Bodk.Genetic.Entities.Tumors;
using Admin.NET.Bodk.Genetic.Models.Reports;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Admin.NET.Bodk.Genetic;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "GeneReport", Description = "基因检测服务")]
public class GeneReportService(
UserManager userManager,
SysOrgService sysOrgService,
SysUserService sysUserService,
SqlSugarRepository<GeneTestingTumorLocusReportEntity> geneTestingTumorLocusReportRepository,
SqlSugarRepository<GeneTestingReportEntity> reportRepository,
SqlSugarRepository<GeneTestingTumorReportEntity> geneTestingTumorReportRepository)
: ServiceBase(userManager, sysOrgService, sysUserService)
{
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("Add")]
public async Task AddReport(AddReportInput input)
{
var db = geneTestingTumorLocusReportRepository.Context;
try
{
await db.Ado.BeginTranAsync();
var entity = new GeneTestingReportEntity()
{
SampleType = input.SampleType,
TestingType = input.TestingType,
TestingMethod = input.TestingMethod,
TofMs = input.TofMs,
GenotypingAnalysis = input.GenotypingAnalysis,
SampleQuality = input.SampleQuality,
GeneticRiskAssessment = input.GeneticRiskAssessment,
Barcode = input.Barcode,
DnaExtraction = input.DnaExtraction,
CustomerId = input.CustomerId,
ReportTime = input.ReportTime,
Report = input.Report,
Pcr = input.Pcr,
SubmissionTime = input.SubmissionTime,
};
entity = await AddBefore(entity);
var reportId = await db.Insertable(entity).ExecuteReturnSnowflakeIdAsync();
foreach (var tumor in input.Tumors)
{
var tumorEntity = new GeneTestingTumorReportEntity()
{
TumorId = tumor.TumorId,
RiskScore = tumor.RiskScore,
RiskLevel = tumor.RiskLevel,
ReportId = reportId
};
tumorEntity = await AddBefore(tumorEntity);
var tumorId = await db.Insertable(tumorEntity).ExecuteReturnSnowflakeIdAsync();
foreach (var locus in tumor.Loci)
{
var locusEntity = new GeneTestingTumorLocusReportEntity()
{
LocusId = locus.LocusId,
RiskId = locus.RiskId,
TumorId = tumorId
};
locusEntity = await AddBefore(locusEntity);
await db.Insertable(locusEntity).ExecuteReturnSnowflakeIdAsync();
}
}
await db.Ado.CommitTranAsync();
}
catch
{
await db.Ado.RollbackTranAsync();
throw;
}
}
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("GetList")]
public async Task<List<ReportOutput>> GetList([Required] long customerId)
{
var db = reportRepository.Context;
var reports = await db.Queryable<GeneTestingReportEntity>()
.Where(r => r.CustomerId == customerId)
.Select(r => new ReportOutput()
{
SampleType = r.SampleType,
TestingType = r.TestingType,
TestingMethod = r.TestingMethod,
TofMs = r.TofMs,
GenotypingAnalysis = r.GenotypingAnalysis,
SampleQuality = r.SampleQuality,
GeneticRiskAssessment = r.GeneticRiskAssessment,
Barcode = r.Barcode,
DnaExtraction = r.DnaExtraction,
CustomerId = r.CustomerId,
Id = r.Id,
ReportTime = r.ReportTime,
Report = r.Report,
Pcr = r.Pcr,
SubmissionTime = r.SubmissionTime
}).ToListAsync();
foreach (var report in reports)
{
var tumors = await db.Queryable<GeneTestingTumorReportEntity>()
.LeftJoin<TumorEntity>((r, t) => r.TumorId == t.Id)
.Where(r => r.ReportId == report.Id)
.Select((r, t) => new TumorOutput()
{
AvaRiskScore = t.AvaRiskScore,
TumorName = t.TumorName,
Description = t.Description,
Code = t.Code,
RiskScore = r.RiskScore,
RiskLevel = r.RiskLevel,
ReportId = report.Id,
TumorId = r.TumorId,
Id = r.Id,
}).ToListAsync();
foreach (var tumor in tumors)
{
var loci = await db.Queryable<GeneTestingTumorLocusReportEntity>()
.LeftJoin<GeneLocusEntity>((l, gl) => l.LocusId == gl.Id)
.LeftJoin<GeneTypeEntity>((l, gl, gt) => l.RiskId == gt.Id)
.Where(l => l.TumorId == tumor.Id)
.Select((l, gl, gt) => new LocusOutput()
{
Description = gt.Description,
Risk = gt.Risk,
GenekType = gt.GenekType,
Position = gl.Position,
LocusName = gl.Name,
Id = l.Id,
}).ToListAsync();
tumor.Loci = loci;
}
report.Tumors = tumors;
}
return reports;
}
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("Bind")]
public async Task<long> Bind(BindInput input)
{
GeneTestingReportEntity entity = new GeneTestingReportEntity()
{
CustomerId = input.CustomerId,
Barcode = input.Barcode
};
entity = await AddBefore(entity);
return await reportRepository.InsertReturnSnowflakeIdAsync(entity);
}
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("Update")]
public async Task UpdateReport(UpdateReportInput input)
{
var db = geneTestingTumorLocusReportRepository.Context;
try
{
await db.Ado.BeginTranAsync();
var entity = new GeneTestingReportEntity()
{
Id = input.Id,
SampleType = input.SampleType,
TestingType = input.TestingType,
TestingMethod = input.TestingMethod,
TofMs = input.TofMs,
GenotypingAnalysis = input.GenotypingAnalysis,
SampleQuality = input.SampleQuality,
GeneticRiskAssessment = input.GeneticRiskAssessment,
Barcode = input.Barcode,
DnaExtraction = input.DnaExtraction,
CustomerId = input.CustomerId,
ReportTime = input.ReportTime,
Report = input.Report,
Pcr = input.Pcr,
SubmissionTime = input.SubmissionTime,
};
entity = await UpdateBefore(entity);
await db.Updateable(entity).ExecuteCommandAsync();
foreach (var tumor in input.Tumors)
{
var tumorEntity = new GeneTestingTumorReportEntity()
{
TumorId = tumor.TumorId,
RiskScore = tumor.RiskScore,
RiskLevel = tumor.RiskLevel,
ReportId = input.Id
};
long tumorId = 0;
if (tumor.Id is null)
{
tumorEntity = await AddBefore(tumorEntity);
tumorId = await db.Insertable(tumorEntity).ExecuteReturnSnowflakeIdAsync();
}
else
{
tumorEntity.Id=tumor.Id.Value;
tumorEntity = await UpdateBefore(tumorEntity);
await db.Updateable<TumorEntity>(tumorEntity).ExecuteCommandAsync();
tumorId = tumor.Id.Value;
}
foreach (var locus in tumor.Loci)
{
var locusEntity = new GeneTestingTumorLocusReportEntity()
{
LocusId = locus.LocusId,
RiskId = locus.RiskId,
TumorId = tumorId
};
if (locus.Id is null)
{
locusEntity = await AddBefore(locusEntity);
await db.Insertable(locusEntity).ExecuteReturnSnowflakeIdAsync();
}
else
{
locusEntity.Id=locus.Id.Value;
locusEntity = await UpdateBefore(locusEntity);
await db.Updateable(locusEntity).ExecuteCommandAsync();
}
}
}
await db.Ado.CommitTranAsync();
}
catch
{
await db.Ado.RollbackTranAsync();
throw;
}
}
// public async Task<ReportOutput> GetSingle([Required] string barcode)
// {
// }
}

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

@ -1,176 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话: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.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
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);
}
[ApiDescriptionSettings(Name = "Bind"), HttpPost]
[DisplayName("Bind")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
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;
}
}

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

@ -1,26 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话: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

@ -1,62 +0,0 @@
// 大名科技(天津)有限公司版权所有 电话: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; }
}

65
Admin.NET.Bodk.Genetic/Models/Reports/AddReportInput.cs

@ -0,0 +1,65 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using Admin.NET.Core;
namespace Admin.NET.Bodk.Genetic.Models.Reports;
public class AddReportInput
{
public long CustomerId { get; set; }
public string? Barcode { get; set; }
public string? SampleType { get; set; }
public string? TestingType { get; set; }
public string? TestingMethod { get; set; }
public DateTime? SubmissionTime { get; set; }
public DateTime? ReportTime { get; set; }
public bool? SampleQuality { get; set; }
public bool? DnaExtraction { get; set; }
public bool? Pcr { get; set; }
public bool? TofMs { get; set; }
public bool? GenotypingAnalysis { get; set; }
public bool? GeneticRiskAssessment { get; set; }
public bool? Report { get; set; }
public List<AddTumorReportInput> Tumors { get; set; } = [];
}
public class AddTumorReportInput
{
public long? Id { get; set; }
public long TumorId { get; set; }
public float RiskScore { get; set; }
public int RiskLevel { get; set; }
public List<AddTumorLocusReportInput> Loci { get; set; } = [];
}
public class AddTumorLocusReportInput
{
public long? Id { get; set; }
public long LocusId { get; set; }
public long RiskId { get; set; }
}
public class UpdateReportInput : AddReportInput
{
public long Id { get; set; }
}

4
Admin.NET.Bodk.Genetic/Models/BindGeneticTestBarcode.cs → Admin.NET.Bodk.Genetic/Models/Reports/BindInput.cs

@ -2,9 +2,9 @@
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
namespace Admin.NET.Bodk.Genetic.Models;
namespace Admin.NET.Bodk.Genetic.Models.Reports;
public class BindGeneticTestBarcodeInput
public class BindInput
{
public string Barcode { get; set; }

85
Admin.NET.Bodk.Genetic/Models/Reports/ReportOutput.cs

@ -0,0 +1,85 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel.DataAnnotations;
using Admin.NET.Core;
namespace Admin.NET.Bodk.Genetic.Models.Reports;
public class QueryReportInput : BasePageInput
{
[Required(ErrorMessage = "客户Id不能为空")] public long CustomerId { get; set; }
}
public class ReportOutput
{
public long Id { get; set; }
public long CustomerId { get; set; }
public string? Barcode { get; set; }
public string? SampleType { get; set; }
public string? TestingType { get; set; }
public string? TestingMethod { get; set; }
public DateTime? SubmissionTime { get; set; }
public DateTime? ReportTime { get; set; }
public bool? SampleQuality { get; set; }
public bool? DnaExtraction { get; set; }
public bool? Pcr { get; set; }
public bool? TofMs { get; set; }
public bool? GenotypingAnalysis { get; set; }
public bool? GeneticRiskAssessment { get; set; }
public bool? Report { get; set; }
public List<TumorOutput> Tumors { get; set; } = new List<TumorOutput>();
}
public class TumorOutput
{
public long Id { get; set; }
public long ReportId { get; set; }
public long TumorId { get; set; }
public string Code { get; set; }
public string TumorName { get; set; }
public string Description { get; set; }
public double RiskScore { get; set; }
public double AvaRiskScore { get; set; }
public int RiskLevel { get; set; }
public List<LocusOutput> Loci { get; set; } = [];
}
public class LocusOutput
{
public long Id { get; set; }
public string Description { get; set; }
public string GenekType { get; set; }
public bool Risk { get; set; }
public string LocusName { get; set; }
public string Position { get; set; }
}

93
Admin.NET.Bodk.Genetic/TumorService.cs

@ -0,0 +1,93 @@
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.ComponentModel;
using Admin.NET.Bodk.Core;
using Admin.NET.Bodk.Genetic.Entities.Tumors;
using Admin.NET.Core;
using Admin.NET.Core.Service;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace Admin.NET.Bodk.Genetic;
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" }, Name = "Tumor", Description = "肿瘤服务")]
public class TumorService(
UserManager userManager,
SysOrgService sysOrgService,
SysUserService sysUserService,
SqlSugarRepository<TumorEntity> tumorRepository,
SqlSugarRepository<TumorGeneLocusEntity> tumorGeneLocusRepository,
SqlSugarRepository<GeneLocusRiskEntity> geneLocusRiskRepository,
SqlSugarRepository<GeneLocusEntity> geneLocusRepository,
SqlSugarRepository<GeneTypeEntity> geneTypeRepository)
: ServiceBase(userManager, sysOrgService, sysUserService)
{
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("获取肿瘤信息")]
public async Task<TumorEntity?> GetTumor(string code)
{
var tumor = await tumorRepository.AsQueryable()
.FirstAsync(t => t.Code == code);
if (tumor is null)
throw Oops.Oh("肿瘤Code不存在");
var locusIds = await tumorGeneLocusRepository.AsQueryable()
.Where(tl => tl.TumorId == tumor.Id).Select(l => l.LocusId).ToListAsync();
var geneLoci = await geneLocusRepository.AsQueryable()
.Where(gl => locusIds.Contains(gl.Id)).ToListAsync();
foreach (var geneLocus in geneLoci)
{
var riskIds = await geneLocusRiskRepository.AsQueryable()
.Where(r => r.LocusId == geneLocus.Id).Select(r => r.RiskId).ToListAsync();
geneLocus.Types = await geneTypeRepository.AsQueryable()
.Where(t => riskIds.Contains(t.Id)).ToListAsync();
}
tumor.GeneLoci = geneLoci;
return tumor;
}
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
[DisplayName("添加一条肿瘤记录")]
public async Task AddTumor(TumorEntity tumor)
{
var db = tumorRepository.Context;
try
{
await db.Ado.BeginTranAsync();
var tumorId = await db.Insertable(tumor).ExecuteReturnSnowflakeIdAsync();
tumor.Id = tumorId;
foreach (var geneLocus in tumor.GeneLoci)
{
var locusId = await db.Insertable(geneLocus).ExecuteReturnSnowflakeIdAsync();
var tumorGeneLocusEntity = new TumorGeneLocusEntity()
{
LocusId = locusId,
TumorId = tumorId
};
await db.Insertable(tumorGeneLocusEntity).ExecuteCommandAsync();
foreach (var risk in geneLocus.Types)
{
var riskId = await db.Insertable(risk).ExecuteReturnSnowflakeIdAsync();
var geneLocusRiskEntity = new GeneLocusRiskEntity()
{
RiskId = riskId,
LocusId = locusId
};
await db.Insertable(geneLocusRiskEntity).ExecuteCommandAsync();
}
}
await db.Ado.CommitTranAsync();
}
catch
{
await db.Ado.RollbackTranAsync();
throw;
}
}
}

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

@ -14,6 +14,6 @@ public class StationExtEntity : EntityBase
public long OrgId { get; set; }
[SugarColumn(IsArray = true, ColumnDataType = "long", Length = 1000, IsNullable = true)]
[SugarColumn(IsArray = true, IsNullable = true)]
public long[]? ServiceIds { get; set; }
}

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

@ -2,6 +2,8 @@
//
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
using System.Text.Json;
namespace Admin.NET.Core;
/// <summary>
@ -95,7 +97,19 @@ public class SysOrg : EntityTenant
[SugarColumn(IsNullable = true, ColumnDataType = "TEXT")]
public string? Position { get; set; }
[SugarColumn(IsArray = true)] public long[]? ServiceIds { get; set; }
[SugarColumn(ColumnDataType = "json")] public string ServiceIdsJson { get; set; }
[SugarColumn(IsIgnore = true)] public List<SysStationService>? Services { get; set; }
[SugarColumn(IsIgnore = true)]
public List<long>? ServiceIds
{
get
{
if (string.IsNullOrWhiteSpace(ServiceIdsJson))
return null;
return JsonSerializer.Deserialize<List<long>>(ServiceIdsJson);
}
set { ServiceIdsJson = JsonSerializer.Serialize(value); }
}
}

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

@ -20,7 +20,8 @@ public class SysOrgSeedData : ISqlSugarEntitySeedData<SysOrg>
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
CreateTime = DateTime.Parse("2022-02-10 00:00:00"), Remark = "松山湖基地", TenantId = 1300000000001,
ServiceIds = new List<long>()
}
};
}

49
Admin.NET.Core/Service/File/SysFileService.cs

@ -4,6 +4,7 @@
using Aliyun.OSS.Util;
using Furion.VirtualFileServer;
using Nest;
using OnceMi.AspNetCore.OSS;
namespace Admin.NET.Core.Service;
@ -44,8 +45,10 @@ public class SysFileService : IDynamicApiController, ITransient
{
return await _sysFileRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName.Contains(input.FileName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()) && !string.IsNullOrWhiteSpace(input.EndTime.ToString()),
u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime)
.WhereIF(
!string.IsNullOrWhiteSpace(input.StartTime.ToString()) &&
!string.IsNullOrWhiteSpace(input.EndTime.ToString()),
u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime)
.OrderBy(u => u.CreateTime, OrderByType.Desc)
.ToPagedListAsync(input.Page, input.PageSize);
}
@ -70,7 +73,8 @@ public class SysFileService : IDynamicApiController, ITransient
/// <param name="contentType"></param>
/// <param name="path"></param>
/// <returns></returns>
private async Task<SysFile> UploadFileFromBase64(string strBase64, string fileName, string contentType, string? path)
private async Task<SysFile> UploadFileFromBase64(string strBase64, string fileName, string contentType,
string? path)
{
byte[] fileData = Convert.FromBase64String(strBase64);
var ms = new MemoryStream();
@ -113,9 +117,11 @@ public class SysFileService : IDynamicApiController, ITransient
{
filelist.Add(await UploadFile(file, ""));
}
return filelist;
}
/// <summary>
/// 根据文件Id或Url下载
/// </summary>
@ -129,14 +135,17 @@ public class SysFileService : IDynamicApiController, ITransient
if (_OSSProviderOptions.IsEnable)
{
var filePath = string.Concat(file.FilePath, "/", file.Id.ToString() + file.Suffix);
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
return new FileStreamResult(stream.Stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5))
.GetAsStreamAsync();
return new FileStreamResult(stream.Stream, "application/octet-stream")
{ FileDownloadName = fileName + file.Suffix };
}
else
{
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
var path = Path.Combine(App.WebHostEnvironment.WebRootPath, filePath);
return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
return new FileStreamResult(new FileStream(path, FileMode.Open), "application/octet-stream")
{ FileDownloadName = fileName + file.Suffix };
}
}
@ -194,11 +203,13 @@ public class SysFileService : IDynamicApiController, ITransient
if (_OSSProviderOptions.IsEnable)
{
await _OSSService.RemoveObjectAsync(file.BucketName.ToString(), string.Concat(file.FilePath, "/", $"{input.Id}{file.Suffix}"));
await _OSSService.RemoveObjectAsync(file.BucketName.ToString(),
string.Concat(file.FilePath, "/", $"{input.Id}{file.Suffix}"));
}
else
{
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, file.FilePath, input.Id.ToString() + file.Suffix);
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, file.FilePath,
input.Id.ToString() + file.Suffix);
if (File.Exists(filePath))
File.Delete(filePath);
}
@ -250,12 +261,15 @@ public class SysFileService : IDynamicApiController, ITransient
{
fileMd5 = OssUtils.ComputeContentMd5(fileStream, fileStream.Length);
}
/*
* Mysql8 使 utf8mb4_general_ci 使.ToString()
* Squsugar SQL语句CAST(123 AS CHAR)utf8mb4_general_ci
*/
var strSizeKb = sizeKb.ToString();
var sysFile = await _sysFileRep.GetFirstAsync(u => u.FileMd5 == fileMd5 && (u.SizeKb == null || u.SizeKb == strSizeKb));
var sysFile =
await _sysFileRep.GetFirstAsync(
u => u.FileMd5 == fileMd5 && (u.SizeKb == null || u.SizeKb == strSizeKb));
if (sysFile != null) return sysFile;
}
@ -287,6 +301,7 @@ public class SysFileService : IDynamicApiController, ITransient
if (suffix == ".jpe")
suffix = ".jpg";
}
if (string.IsNullOrWhiteSpace(suffix))
throw Oops.Oh(ErrorCodeEnum.D8003);
@ -304,25 +319,28 @@ public class SysFileService : IDynamicApiController, ITransient
FileMd5 = fileMd5,
};
var finalName = newFile.Id + suffix; // 文件最终名称
newFile.FileName = newFile.Id + suffix; // 文件最终名称
if (_OSSProviderOptions.IsEnable)
{
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
var filePath = string.Concat(path, "/", finalName);
var filePath = string.Concat(path, "/", newFile.FileName);
await _OSSService.PutObjectAsync(newFile.BucketName, filePath, file.OpenReadStream());
// http://<你的bucket名字>.oss.aliyuncs.com/<你的object名字>
// 生成外链地址 方便前端预览
switch (_OSSProviderOptions.Provider)
{
case OSSProvider.Aliyun:
newFile.Url = $"{(_OSSProviderOptions.IsEnableHttps ? "https" : "http")}://{newFile.BucketName}.{_OSSProviderOptions.Endpoint}/{filePath}";
case OSSProvider.HuaweiCloud:
newFile.Url =
$"{(_OSSProviderOptions.IsEnableHttps ? "https" : "http")}://{newFile.BucketName}.{_OSSProviderOptions.Endpoint}/{filePath}";
break;
case OSSProvider.Minio:
// 获取Minio文件的下载或者预览地址
// newFile.Url = await GetMinioPreviewFileUrl(newFile.BucketName, filePath);// 这种方法生成的Url是有7天有效期的,不能这样使用
// 需要在MinIO中的Buckets开通对 Anonymous 的readonly权限
newFile.Url = $"{(_OSSProviderOptions.IsEnableHttps ? "https" : "http")}://{_OSSProviderOptions.Endpoint}/{newFile.BucketName}/{filePath}";
newFile.Url =
$"{(_OSSProviderOptions.IsEnableHttps ? "https" : "http")}://{_OSSProviderOptions.Endpoint}/{newFile.BucketName}/{filePath}";
break;
}
}
@ -333,7 +351,7 @@ public class SysFileService : IDynamicApiController, ITransient
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
var realFile = Path.Combine(filePath, finalName);
var realFile = Path.Combine(filePath, newFile.FileName);
//IDetector detector;
using (var stream = File.Create(realFile))
{
@ -356,6 +374,7 @@ public class SysFileService : IDynamicApiController, ITransient
host += "/";
newFile.Url = $"{host}{newFile.FilePath}/{newFile.Id + newFile.Suffix}";
}
await _sysFileRep.AsInsertable(newFile).ExecuteCommandAsync();
return newFile;
}
@ -389,6 +408,7 @@ public class SysFileService : IDynamicApiController, ITransient
var fileId = Path.GetFileNameWithoutExtension(user.Avatar);
await DeleteFile(new DeleteFileInput { Id = long.Parse(fileId) });
}
await sysUserRep.UpdateAsync(u => new SysUser() { Avatar = sysFile.Url }, u => u.Id == user.Id);
return sysFile;
}
@ -411,6 +431,7 @@ public class SysFileService : IDynamicApiController, ITransient
var fileId = Path.GetFileNameWithoutExtension(user.Signature);
await DeleteFile(new DeleteFileInput { Id = long.Parse(fileId) });
}
await sysUserRep.UpdateAsync(u => new SysUser() { Signature = sysFile.Url }, u => u.Id == user.Id);
return sysFile;
}

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

@ -9,6 +9,19 @@ public class AreaOutput:SysOrg
public List<FactoryOutput>? Factories { get; set; }
}
public class QueryAreaInput
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
public string Code { get; set; }
}
public class AddAreaInput
{
public long Pid { get; set; }

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

@ -445,6 +445,53 @@ public class SysOrgService : IDynamicApiController, ITransient
return newOrg.Id;
}
// public async Task<List<AreaOutput>> GetUserAreaList(QueryAreaInput input)
// {
// var userOrgIdList = await GetUserOrgIdList();
// var iSugarQueryable = _sysOrgRep.AsQueryable().OrderBy(u => u.OrderNo)
// .Where(a => a.Type == "Area");
// var orgTree = new List<SysOrg>();
// if (_userManager.SuperAdmin)
// {
// orgTree = await iSugarQueryable.ToTreeAsync(u => u.Children, u => u.Pid, input.Id);
// }
// else
// {
// orgTree = await iSugarQueryable.ToTreeAsync(u => u.Children, u => u.Pid, input.Id,
// userOrgIdList.Select(d => (object)d).ToArray());
// // 递归禁用没权限的机构(防止用户修改或创建无权的机构和用户)
// HandlerOrgTree(orgTree, userOrgIdList);
// }
//
// var sysOrg = await _sysOrgRep.GetSingleAsync(u => u.Id == input.Id);
// if (sysOrg != null)
// {
// sysOrg.Children = orgTree;
// orgTree = new List<SysOrg> { sysOrg };
// }
//
// return orgTree;
// if (!string.IsNullOrWhiteSpace(input.Name) || !string.IsNullOrWhiteSpace(input.Code))
// {
// return await iSugarQueryable.WhereIF(userOrgIdList.Count > 0, u => userOrgIdList.Contains(u.Id))
// .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
// .WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code == input.Code)
// .Select(a => a.Adapt<AreaOutput>())
// .Mapper(a =>
// {
// a.Factories = a.Children.Where(c => c.Type == "Factory").Select(s => s.Adapt<FactoryOutput>())
// .Select(t =>
// {
// t.Stations = t.Children.Where(c => c.Type == "Station")
// .Select(s => s.Adapt<StationOutput>()).ToList();
// return t;
// })
// .ToList();
// })
// .ToListAsync();
// }
// }
/// <summary>
/// 增加基地
/// </summary>
@ -535,7 +582,7 @@ public class SysOrgService : IDynamicApiController, ITransient
Type = "Station",
Remark = input.Remark,
DirectorId = input.DirectorId,
ServiceIds = ids,
ServiceIds = ids?.ToList(),
}).ExecuteReturnEntityAsync();
return newOrg.Id;
}

10
Admin.NET.Core/Service/Org/SysStationServiceService.cs

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