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.

489 lines
14 KiB
C#

using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 公共模块
/// </summary>
public class CommonController : ApiController
{
private readonly ICommonService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public CommonController(ICommonService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 登出
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("Logout")]
public DataResult<string> Logout()
{
return DataResult<string>.Success("");
}
/// <summary>
/// 用户登录-客户端
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("ClientUserLogin")]
public async Task<DataResult<string>> ClientUserLogin([FromBody] UserLoginModel model)
{
var res = await _invokeService.ClientUserLogin(model);
return res;
}
/// <summary>
/// 用户登录-邮箱
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("ClientUserEmailLogin")]
public async Task<DataResult<string>> ClientUserEmailLogin([FromBody] UserEmailLoginModel model)
{
var res = await _invokeService.ClientUserEmailLogin(model);
return res;
}
/// <summary>
/// 用户登录-手机号
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
[Route("ClientUserPhoneLogin")]
public async Task<DataResult<string>> ClientUserPhoneLogin([FromBody] UserPhoneLoginModel model)
{
var res = await _invokeService.ClientUserPhoneLogin(model);
return res;
}
/// <summary>
/// 客户端刷新Token
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("ClientUserRefreshToken")]
[AllowAnonymous]
public DataResult<RefreshTokenRes> ClientUserRefreshToken()
{
var res = _invokeService.ClientUserRefreshToken();
return res;
}
/// <summary>
/// 更换机构
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("ChangeOrg")]
public DataResult<RefreshTokenRes> ChangeOrg([FromQuery] string id)
{
var res = _invokeService.ChangeOrg(id);
return res;
}
/// <summary>
/// 获取用户-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientUserInfo")]
public async Task<DataResult<CurrentUserViewModel>> GetClientUserInfo()
{
var res = await _invokeService.GetClientUserInfo();
return res;
}
/// <summary>
/// 查询用户拥有的菜单权限-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientUserPermissionByToken")]
public async Task<DataResult<List<RouteItem>>> GetClientUserPermissionByToken()
{
var res = await _invokeService.GetClientUserPermissionByToken();
return res;
}
/// <summary>
/// 获取客户端按钮权限
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientUserPermissionCode")]
public async Task<DataResult<string[]>> GetClientUserPermissionCode()
{
var res = await _invokeService.GetClientUserPermissionCode();
return res;
}
/// <summary>
/// 获取角色下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetRoleList")]
public DataResult<List<ApiSelectViewModel>> GetRoleList()
{
var res = _invokeService.GetRoleList();
return res;
}
/// <summary>
/// 获取用户下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetUserList")]
public DataResult<List<ApiSelectViewModel>> GetUserList([FromQuery]string queryKey = "")
{
var res = _invokeService.GetUserList();
return res;
}
/// <summary>
/// 获取机构下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOrgList")]
public DataResult<List<ApiSelectViewModel>> GetOrgList()
{
var res = _invokeService.GetOrgList();
return res;
}
/// <summary>
/// 获取商品类型下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetGoodsTypeList")]
public DataResult<List<ApiSelectViewModel>> GetGoodsTypeList()
{
var res = _invokeService.GetGoodsTypeList();
return res;
}
/// <summary>
/// 获取商品类型下拉选项-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientGoodsTypeList")]
public DataResult<List<ApiSelectViewModel>> GetClientGoodsTypeList()
{
var res = _invokeService.GetClientGoodsTypeList();
return res;
}
/// <summary>
/// 获取国家信息下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetCountrySelectList")]
public DataResult<List<CodeCountrySelectRes>> GetCountrySelectList()
{
var res = _invokeService.GetCountrySelectList();
return res;
}
/// <summary>
/// 获取国家信息下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientCountrySelectList")]
public DataResult<List<CodeCountrySelectRes>> GetClientCountrySelectList()
{
var res = _invokeService.GetClientCountrySelectList();
return res;
}
/// <summary>
/// 获取航线信息下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetLanesSelectList")]
public DataResult<List<CodeLanesSelectRes>> GetLanesSelectList()
{
var res = _invokeService.GetLanesSelectList();
return res;
}
/// <summary>
/// 获取航线信息下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientLanesSelectList")]
public DataResult<List<CodeLanesSelectRes>> GetClientLanesSelectList()
{
var res = _invokeService.GetClientLanesSelectList();
return res;
}
/// <summary>
/// 获取港口信息下拉选项
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetPortSelectList")]
public DataResult<List<CodePortSelectRes>> GetPortSelectList()
{
var res = _invokeService.GetPortSelectList();
return res;
}
/// <summary>
/// 获取港口信息下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientPortSelectList")]
public async Task<DataResult<List<CodePortSelectRes>>> GetClientPortSelectList([FromQuery] string queryKey = "")
{
var res = await _invokeService.GetClientPortSelectList(queryKey);
return res;
}
/// <summary>
/// 获取付费方式下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientFrtSelectList")]
public DataResult<List<CodeFrtSelectRes>> GetClientFrtSelectList()
{
var res = _invokeService.GetClientFrtSelectList();
return res;
}
/// <summary>
/// 获取结算方式下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientStlModeSelectList")]
public DataResult<List<CodeStlModeSelectRes>> GetClientStlModeSelectList()
{
var res = _invokeService.GetClientStlModeSelectList();
return res;
}
/// <summary>
/// 获取业务来源下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientSourceSelectList")]
public DataResult<List<CodeSourceSelectRes>> GetClientSourceSelectList()
{
var res = _invokeService.GetClientSourceSelectList();
return res;
}
/// <summary>
/// 获取业务来源明细下拉列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientSourceDetailSelectList")]
public DataResult<List<CodeSourceDetailSelectRes>> GetClientSourceDetailSelectList([FromQuery] string id)
{
var res = _invokeService.GetClientSourceDetailSelectList(id);
return res;
}
/// <summary>
/// 修改密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("ChangePassword")]
public DataResult ChangePassword([FromBody] ChangePasswordReq model)
{
var res = _invokeService.ChangePassword(model);
return res;
}
/// <summary>
/// 企业用户注册
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
[Route("TenantRegister")]
public DataResult TenantRegister([FromBody] TenantRegisterReq model)
{
var res = _invokeService.TenantRegister(model);
return res;
}
/// <summary>
/// 获取权限树列表-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientPermissionTreeList")]
public DataResult<List<PermissionTreeList>> GetClientPermissionTreeList()
{
var res = _invokeService.GetClientPermissionTreeList();
return res;
}
/// <summary>
/// 获取数据权限字段
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
[Route("GetDataRuleEntityFields")]
public DataResult<List<EntityFieldProperty>> GetDataRuleEntityFields([FromQuery] string permissionId)
{
var res = _invokeService.GetDataRuleEntityFields(permissionId);
return res;
}
/// <summary>
/// 获取客户数据权限列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientPermissionList")]
public DataResult<List<ClientPermissionRes>> GetClientPermissionList()
{
var res = _invokeService.GetClientPermissionList();
return res;
}
/// <summary>
/// 获取数据库表及视图名
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTables")]
public DataResult<List<DbTableInfo>> GetTables()
{
var res = _invokeService.GetTables();
return res;
}
/// <summary>
/// 获取数据库表及视图名
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetColumns")]
public DataResult<List<DbColumnInfo>> GetColumns([FromQuery] string tableViewName)
{
var res = _invokeService.GetColumns(tableViewName);
return res;
}
/// <summary>
/// 获取数据库表及视图名-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetTablesByClient")]
public DataResult<List<DbTableInfo>> GetTablesByClient()
{
var res = _invokeService.GetTablesByClient();
return res;
}
/// <summary>
/// 获取数据库表及视图名-客户端
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetColumnsByClient")]
public DataResult<List<DbColumnInfo>> GetColumnsByClient([FromQuery] string tableViewName)
{
var res = _invokeService.GetColumnsByClient(tableViewName);
return res;
}
/// <summary>
/// 获取用户字段设置
/// </summary>
/// <param name="permissionId"></param>
/// <param name="tagNo">标识序号</param>
/// <returns></returns>
[HttpGet]
[Route("GetUserFieldSet")]
public DataResult<SysFieldSet> GetUserFieldSet([FromQuery] string permissionId, int tagNo = 0)
{
var res = _invokeService.GetUserFieldSet(permissionId, tagNo);
return res;
}
/// <summary>
/// 批量获取任务台用户字段设置
/// </summary>
[HttpPost]
[Route("GetUserTaskPlatFieldSet")]
public async Task<DataResult<List<SysFieldSetTaskPlatResultDto>>> GetUserTaskPlatFieldSet([FromBody] SysFieldSetTaskPlatQueryDto query)
{
var res = await _invokeService.GetUserTaskPlatFieldSet(query);
return res;
}
/// <summary>
/// 更新用户字段设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateUserFieldSet")]
public DataResult UpdateUserFieldSet([FromBody] UserFieldSetUpdateReq req)
{
var res = _invokeService.UpdateUserFieldSet(req);
return res;
}
/// <summary>
/// 更新任务台用户字段设置
/// </summary>
[HttpPost]
[Route("UpdateUserTaskPlatFieldSet")]
public async Task<DataResult> UpdateUserTaskPlatFieldSet([FromBody] UserFieldSetUpdateReq req)
{
var res = await _invokeService.UpdateUserTaskPlatFieldSet(req);
return res;
}
/// <summary>
/// 获取字典下拉明细
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("GetDictTypeDropDown")]
public DataResult GetDictTypeDropDown([FromBody] DropDownDictTypeInput model)
{
var res = _invokeService.GetDictTypeDropDown(model);
return res;
}
/// <summary>
/// 批量获取字典值
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("GetDictOptions")]
public DataResult<List<DictOptions>> GetDictOptions([FromBody] DropDownDictTypeInput model)
{
var res = _invokeService.GetDictOptions(model);
return res;
}
}