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

241 lines
6.6 KiB
C#

using Common.Utilities;
using djy.IService.Afr;
using djy.Model.AmsDto;
using djy_AfrApi.Attributes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
namespace djy_AfrApi.Controllers.Common
{
[Route("api/[controller]")]
[ApiController]
[Authorize]
public class CommonController
{
private readonly IAfrService ser;
public CommonController(IAfrService service)
{
this.ser = service;
}
#region 下拉接口
/// <summary>
/// 下拉获取国家
/// </summary>
/// <returns></returns>
[HttpGet("GetCountry")]
[RedisCaching]
public Response<List<CommonCNEN>> GetCountry()
{
var result = new Response<List<CommonCNEN>>();
try
{
result.Result = ser.GetCountry("", 0, 0);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取船公司
/// </summary>
/// <returns></returns>
[HttpGet("GetCARRIER")]
[RedisCaching]
public Response<List<CommonMappiCode>> GetCARRIER()
{
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetCARRIER();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取箱型
/// </summary>
/// <returns></returns>
[HttpGet("GetCTNALL")]
[RedisCaching]
public Response<List<CommonMappiCode>> GetCTNALL()
{
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetCTNALL();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取包装单位
/// </summary>
/// <returns></returns>
[HttpGet("GetPackage")]
[RedisCaching]
public Response<List<CommonMappiCode>> GetPackage()
{
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetPackage();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取危品等级及 CODE
/// </summary>
/// <returns></returns>
[HttpGet("GetDangerousGoods")]
[RedisCaching]
public Response<List<CodeDangerGradeDto>> GetDangerousGoods()
{
var result = new Response<List<CodeDangerGradeDto>>();
try
{
result.Result = ser.GetDangerousGoods("");
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///// <summary>
///// 下拉获取起运港口
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodePortLoad")]
//public Response<List<CommonCodeValue>> GetCodePortLoad()
//{
// var result = new Response<List<CommonCodeValue>>();
// try
// {
// result.Result = ser.GetCodePortLoad();
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
/// <summary>
/// 下拉获取港口
/// </summary>
/// <returns></returns>
[HttpGet("GetPort")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetPort()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetPort("", 0, 0);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取船名
/// </summary>
/// <returns></returns>
[HttpGet("GetVessel")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetVessel()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetVessel("", 0, 0);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
///// <summary>
///// 下拉获取省份
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodeProvince")]
//public Response<List<CommonCodeValue>> GetCodeProvince(string code)
//{
// var result = new Response<List<CommonCodeValue>>();
// try
// {
// result.Result = ser.GetCodeProvince(code);
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
///// <summary>
///// 下拉获取城市 邮编
///// </summary>
///// <returns></returns>
//[HttpGet("GetCodeCity")]
//public Response<List<CodeCityDto>> GetCodeCity(string provinceCode)
//{
// var result = new Response<List<CodeCityDto>>();
// try
// {
// result.Result = ser.GetCodeCity(provinceCode);
// }
// catch (Exception ex)
// {
// result.Code = 500;
// result.Message = ex.InnerException?.Message ?? ex.Message;
// }
// return result;
//}
#endregion
}
}