|
@@ -1,5 +1,8 @@
|
|
|
|
|
|
|
|
|
+using NetTaste;
|
|
|
+using System.Drawing.Printing;
|
|
|
+
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
|
/// <summary>
|
|
@@ -14,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 车公司资料板块
|
|
|
|
|
@@ -31,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
|
|
|
{
|
|
@@ -206,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
|
|
|
{
|
|
@@ -246,12 +251,12 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 导游地接信息操作(增改)
|
|
|
+ /// 导游地接信息操作(Status:1.新增,2.修改)
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> LocalGuideOperation(LocalGuideOperationDto dto)
|
|
|
+ public async Task<IActionResult> OperationLocalGuide(LocalGuideOperationDto dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -277,7 +282,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
return Ok(JsonView(false, result.Msg));
|
|
|
}
|
|
|
- return Ok(JsonView(true, result.Msg, new { Id = result.Data }));
|
|
|
+ return Ok(JsonView(true, result.Msg));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -292,7 +297,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> LocalGuideDel(LocalGuideDelDto dto)
|
|
|
+ public async Task<IActionResult> DelLocalGuide(LocalGuideDelDto dto)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -319,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
|
|
|
{
|
|
@@ -335,13 +340,132 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
else if (dto.PortType == 2)
|
|
|
{
|
|
|
- var ThreeCode = _localGuideDataRep.QueryDto<Res_ThreeCode, ThreeCodeView>().ToList();
|
|
|
- if (ThreeCode.Count == 0)
|
|
|
+ //分页写法
|
|
|
+ if (dto.PageIndex==0 || dto.PageSize==0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请传入PageIndex和PageSize参数"));
|
|
|
+ }
|
|
|
+ JsonView _ThreeCode = await _ThreeCodeRep.QuerThreeCode(dto.PageIndex, dto.PageSize);
|
|
|
+ if (_ThreeCode.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, _ThreeCode.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(_ThreeCode);
|
|
|
+ }
|
|
|
+ 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> OperationThreeCode(ThreeCodeOperationDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (dto.Three == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查三字码是否填写!"));
|
|
|
+ }
|
|
|
+ if (dto.Country == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查国家是否填写!"));
|
|
|
+ }
|
|
|
+ if (dto.City == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查城市是否填写正确!"));
|
|
|
+ }
|
|
|
+ if (dto.AirPort == "")
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请检查机场是否填写正确!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ Result result = await _ThreeCodeRep.ThreeCodeOperation(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> DelThreeCode(ThreeCodeDelDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var res = await _ThreeCodeRep.SoftDeleteByIdAsync<Res_ThreeCode>(dto.Id.ToString(), dto.DeleteUserId);
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "删除失败"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "删除成功!"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #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, "暂无数据!"));
|
|
|
}
|
|
|
- ThreeCode = ThreeCode.OrderByDescending(s => s.CreateTime).ToList();
|
|
|
- return Ok(JsonView(true, "查询成功", ThreeCode));
|
|
|
+ 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
|
|
|
{
|
|
@@ -358,6 +482,71 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /// <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
|
|
|
}
|
|
|
}
|