|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
|
|
|
|
|
|
using ParkingLotEntity.ParkingLotModelDto.BaseModels;
|
|
|
|
|
|
using ParkingLotEntity.ParkingLotModelDto;
|
|
|
|
|
|
using ParkLotInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ParkingLotService.API.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("api/[controller]/[Action]")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
public class ParkLotInfoController : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private IParkingLotDataService _parkingLotDataService;
|
|
|
|
|
|
private readonly ILogger<ParkLotInfoController> _logger;
|
|
|
|
|
|
//private readonly CurrentContext CurrentContext;
|
|
|
|
|
|
public ParkLotInfoController(IParkingLotDataService parkingLotDataService, ILogger<ParkLotInfoController> logger)
|
|
|
|
|
|
{
|
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
_parkingLotDataService = parkingLotDataService;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 提交停车信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<ApiResult<int>> PostParkingLots(ParkingAccessRecordDto dto)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _parkingLotDataService.PostParkingLots(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取停车场信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parkId"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
public async Task<ApiResult<ParkingLotInfoDto>> GetParkingLotInfo(string parkId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _parkingLotDataService.GetParkingLotInfo(parkId);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 门禁远程控制
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="doorId"></param>
|
|
|
|
|
|
/// <param name="command"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
public async Task<ApiResult<int>> DoorLockSendCommand(int doorId, string command)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _parkingLotDataService.DoorLockSendCommand(doorId, command);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 门禁设备在线状态 推送接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<TokenDto> PostDoorEqState(DoorEqStateDto dto)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _parkingLotDataService.PostDoorEqState(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 订阅门开关记录 /api/ParkLotInfo/PostDoorControlRecord
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
public async Task<TokenDto> PostDoorControlRecord(DoorStateRecordDto dto)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await _parkingLotDataService.PostDoorControlRecord(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|