You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.4 KiB

using AutoMapper;
using Entity.DbModel.Station;
using Entity.Dto.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc;
using Service.Charger.Client;
using Service.WaterCool.Client;
using Service.WaterCool.Msg.WaterCool;
namespace WebStarter.Controllers;
[Produces("application/json")]
[ApiController]
[Route("api/[controller]")]
public class WaterCoolControlller: ControllerBase
{
/// <summary>
/// 获取水冷机列表信息
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("GetWhaterCoolList")]
public async Task<Result<List<WaterCoolStatusResp>>> GetWhaterCoolList()
{
var vv = WaterCoolClientMgr.Dictionary.Values;
List<WaterCoolStatusResp> coolStatusResps = new();
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<WaterCoolStatus, WaterCoolStatusResp>());
var mapper = configuration.CreateMapper();
foreach (var VARIABLE in vv)
{
if (VARIABLE != null && VARIABLE.WaterCoolStatus != null)
{
WaterCoolStatusResp coolStatusResp = new();
coolStatusResp=mapper.Map<WaterCoolStatusResp>(VARIABLE.WaterCoolStatus);
coolStatusResp.Sn = VARIABLE.Sn;
coolStatusResps.Add(coolStatusResp);
}
}
return Result<List<WaterCoolStatusResp>>.Success(coolStatusResps);
}
/*/// <summary>
/// 水冷机发送指令
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("SendModeMsg")]
public async Task<Result<List<WaterCoolStatusResp>>> SendModeMsg()
{
var vv = WaterCoolClientMgr.Dictionary.Values;
List<WaterCoolStatusResp> coolStatusResps = new();
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<WaterCoolStatus, WaterCoolStatusResp>());
var mapper = configuration.CreateMapper();
foreach (var VARIABLE in vv)
{
if (VARIABLE != null && VARIABLE.WaterCoolStatus != null)
{
WaterCoolStatusResp coolStatusResp = new();
coolStatusResp=mapper.Map<WaterCoolStatusResp>(VARIABLE.WaterCoolStatus);
coolStatusResp.Sn = VARIABLE.Sn;
coolStatusResps.Add(coolStatusResp);
}
}
return Result<List<WaterCoolStatusResp>>.Success(coolStatusResps);
}*/
}