|
@@ -17,14 +17,16 @@ namespace OASystem.API.Controllers
|
|
|
private readonly CarDataRepository _carDataRep;
|
|
|
private readonly LocalGuideDataRepository _localGuideDataRep;
|
|
|
private readonly ThreeCodeRepository _ThreeCodeRep;
|
|
|
+ private readonly HotelDataRepository _hotelDataRep;
|
|
|
|
|
|
- public ResourceController(IMapper mapper, IConfiguration config, CarDataRepository carDataRep, LocalGuideDataRepository localGuideDataRep, ThreeCodeRepository threeCodeRep)
|
|
|
+ public ResourceController(IMapper mapper, IConfiguration config, CarDataRepository carDataRep, LocalGuideDataRepository localGuideDataRep, ThreeCodeRepository threeCodeRep, HotelDataRepository hotelDataRep)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_config = config;
|
|
|
_carDataRep = carDataRep;
|
|
|
_localGuideDataRep = localGuideDataRep;
|
|
|
_ThreeCodeRep = threeCodeRep;
|
|
|
+ _hotelDataRep = hotelDataRep;
|
|
|
}
|
|
|
#region 车公司资料板块
|
|
|
|
|
@@ -34,7 +36,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> QuerCarData(DtoBase dto)
|
|
|
+ public async Task<IActionResult> QuertCarData(DtoBase dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -209,7 +211,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> QuerLocalGuide(DtoBase dto)
|
|
|
+ public async Task<IActionResult> QueryLocalGuide(DtoBase dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -249,7 +251,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 导游地接信息操作(增改)
|
|
|
+ /// 导游地接信息操作(Status:1.新增,2.修改)
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
@@ -322,7 +324,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> QuerThreeCode(DtoBase dto)
|
|
|
+ public async Task<IActionResult> QueryThreeCode(DtoBase dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -367,7 +369,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 机场编辑,添加操作
|
|
|
+ /// 机场三字码资料操作(Status:1.新增,2.修改)
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -432,5 +434,119 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
+
|
|
|
+ #region 酒店资料数据
|
|
|
+ /// <summary>
|
|
|
+ /// 酒店信息查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> QueryHotelData(DtoBase dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (dto.PortType == 1)
|
|
|
+ {
|
|
|
+ var HotelData = _localGuideDataRep.QueryDto<Res_HotelData, HotelDataView>().ToList();
|
|
|
+ if (HotelData.Count == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ }
|
|
|
+ HotelData = HotelData.OrderByDescending(s => s.CreateTime).ToList();
|
|
|
+ return Ok(JsonView(true, "查询成功", HotelData));
|
|
|
+ }
|
|
|
+ else if (dto.PortType == 2)
|
|
|
+ {
|
|
|
+ var HotelData = _localGuideDataRep.QueryDto<Res_HotelData, HotelDataView>().ToList();
|
|
|
+ if (HotelData.Count == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ }
|
|
|
+ HotelData = HotelData.OrderByDescending(s => s.CreateTime).ToList();
|
|
|
+ return Ok(JsonView(true, "查询成功", HotelData));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入PortType参数!1:Web,2:Android,3:IOS"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 酒店资料操作(Status:1.新增,2.修改)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> OperationHotelData(OperationHotelData dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (dto.City == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查酒店所在城市是否填写!"));
|
|
|
+ }
|
|
|
+ if (dto.Name == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查酒店名称是否填写!"));
|
|
|
+ }
|
|
|
+ if (dto.Address == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查酒店地址是否填写正确!"));
|
|
|
+ }
|
|
|
+ if (dto.Tel == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查酒店联系方式是否填写正确!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ Result result = await _hotelDataRep.OperationHotelData(dto);
|
|
|
+ if (result.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, result.Msg));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, result.Msg));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 酒店资料操作(删除)
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> DelHotelData(DelHotelDataDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var res = await _ThreeCodeRep.SoftDeleteByIdAsync<Res_HotelData>(dto.Id.ToString(), dto.DeleteUserId);
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "删除失败"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "删除成功!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|