|
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
using Admin.Bodk.Device.Entities.Dto;
|
|
|
|
using Admin.Bodk.Device.Entities.equipment;
|
|
|
|
using Admin.NET.Core;
|
|
|
|
using Furion.DatabaseAccessor;
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Mapster;
|
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
|
|
|
|
|
|
|
namespace Admin.Bodk.Device.Services;
|
|
|
|
/// <summary>
|
|
|
|
/// 服务管理
|
|
|
|
/// </summary>
|
|
|
|
[ApiDescriptionSettings(Order = 2)]
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
_baseRep = baseRep;
|
|
|
|
_supportRep = supportRep;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取检测信息列表
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[DisplayName("获取检测信息列表")]
|
|
|
|
[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});
|
|
|
|
return new SqlSugarPagedList<SupportOutput>() { Page = 1, PageSize = 20, Items = items, Total = 3 };
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取细胞服务列表
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[DisplayName("获取细胞服务列表")]
|
|
|
|
[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()
|
|
|
|
{
|
|
|
|
DeviceId=23223232,PicUrl="",LiquidNitrogenHeight=180,Temperature=-195.2,
|
|
|
|
Humidity="0.5%",Address="广东省东莞市松山湖园区科技二路宏远新智汇1栋",
|
|
|
|
Name="M9_01",CellBaseInfo=new CellBaseInfo(){BaseName="松山湖",BaseId=13545}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return new SqlSugarPagedList<CellOutput>() { Page = 1, PageSize = 20, Items = items, Total = 3 };
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 增加服务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[UnitOfWork]
|
|
|
|
[ApiDescriptionSettings(Name = "Add"), HttpPost]
|
|
|
|
[DisplayName("增加服务")]
|
|
|
|
public async Task<long> AddSupport(SupportAddInput input)
|
|
|
|
{
|
|
|
|
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 })
|
|
|
|
// {
|
|
|
|
// foreach (var taskChain in input.TaskChainList)
|
|
|
|
// {
|
|
|
|
// taskChain.EquipmentId = newEquipment.Id;
|
|
|
|
// await _taskChainRepository.AsInsertable(taskChain).ExecuteReturnEntityAsync();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return newEquipment.Id;
|
|
|
|
}
|
|
|
|
}
|