|
using System.Dynamic;
|
using System.Net;
|
using MES.Service.Dto.service;
|
using MES.Service.Modes;
|
using MES.Service.service;
|
using MES.Service.util;
|
using Microsoft.AspNetCore.Mvc;
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace MESApplication.Controllers.BasicData;
|
|
|
[Route("api/[controller]")]
|
[ApiController]
|
public class ModulesController : ControllerBase
|
{
|
private readonly SysUserService _sysUserService = new SysUserService();
|
|
/// <summary>
|
/// 查询权限
|
/// </summary>
|
/// <param name="userno">用户Id</param>
|
/// <returns>权限信息</returns>
|
[HttpPost("queryPurview")]
|
public ResponseResult QueryPurview([FromBody] JObject data)
|
{
|
var userno = data["userno"]?.ToString();
|
try
|
{
|
List<UserPermission> userForBase = _sysUserService.QueryPurview(userno);
|
|
if (userForBase.Count == 0)
|
{
|
return new ResponseResult
|
{
|
status = 1,
|
message = "权限不存在!"
|
};
|
}
|
else
|
{
|
dynamic resultInfos = new ExpandoObject();
|
resultInfos.tbBillList = userForBase;
|
|
return new ResponseResult
|
{
|
status = 0,
|
message = "查询权限成功!",
|
data = resultInfos
|
};
|
}
|
}
|
catch (Exception ex)
|
{
|
Console.WriteLine(ex.ToString());
|
return new ResponseResult
|
{
|
status = 1,
|
message = "查询权限失败!"
|
};
|
}
|
}
|
|
|
/// <summary>
|
/// 功能界面
|
/// </summary>
|
/// <param name="functionName">方法名称</param>
|
/// <returns>功能界面信息</returns>
|
[HttpPost("getRfSetup")]
|
public ResponseResult GetRfSetup([FromBody] JObject data)
|
{
|
|
var functionName = data["functionName"]?.ToString();
|
try
|
{
|
Console.WriteLine(functionName);
|
string decodedFunctionName = WebUtility.UrlDecode(functionName);
|
return _sysUserService.GetRfSetup(functionName);
|
}
|
catch (Exception ex)
|
{
|
Console.WriteLine(ex.ToString());
|
return new ResponseResult
|
{
|
status = 1,
|
message = "查询功能界面失败!"
|
};
|
}
|
}
|
|
|
|
|
/// <summary>
|
/// 功能执行存储过程
|
/// </summary>
|
/// <param name="data">请求参数</param>
|
/// <returns>API响应结果</returns>
|
[HttpPost("getExcProc")]
|
public ResponseResult GetExcProc([FromBody] JObject data)
|
{
|
var functionName = data["functionName"]?.ToString();
|
var fileName = data["fileName"]?.ToString();
|
var pmachtype = data["pmachtype"]?.ToString();
|
var fileValue = data["fileValue"]?.ToString();
|
var outFiles = data["outFiles"]?.ToString();
|
|
try
|
{
|
Console.WriteLine(functionName);
|
string decodedFunctionName = WebUtility.UrlDecode(functionName);
|
return _sysUserService.GetExcProc(decodedFunctionName, fileName, pmachtype, fileValue, outFiles);
|
}
|
catch (Exception ex)
|
{
|
Console.WriteLine(ex.ToString());
|
return new ResponseResult
|
{
|
status = 1,
|
message = "查询功能界面失败!"
|
};
|
}
|
}
|
|
}
|
|
|
|