1
This commit is contained in:
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_dimController.cs
Normal file
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_dimController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*接口编写处...
|
||||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||
*如: [ApiActionPermission("Bi_db_dim",Enums.ActionPermissionOptions.Search)]
|
||||
*/
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using iMES.Entity.DomainModels;
|
||||
using iMES.Bi.IServices;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
public partial class Bi_db_dimController
|
||||
{
|
||||
private readonly IBi_db_dimService _service;//访问业务代码
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public Bi_db_dimController(
|
||||
IBi_db_dimService service,
|
||||
IHttpContextAccessor httpContextAccessor
|
||||
)
|
||||
: base(service)
|
||||
{
|
||||
_service = service;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_setController.cs
Normal file
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_setController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*接口编写处...
|
||||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||
*如: [ApiActionPermission("Bi_db_set",Enums.ActionPermissionOptions.Search)]
|
||||
*/
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using iMES.Entity.DomainModels;
|
||||
using iMES.Bi.IServices;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
public partial class Bi_db_setController
|
||||
{
|
||||
private readonly IBi_db_setService _service;//访问业务代码
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public Bi_db_setController(
|
||||
IBi_db_setService service,
|
||||
IHttpContextAccessor httpContextAccessor
|
||||
)
|
||||
: base(service)
|
||||
{
|
||||
_service = service;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
}
|
||||
}
|
||||
79
iMES.WebApi/Controllers/Bi/Partial/Bi_db_sourceController.cs
Normal file
79
iMES.WebApi/Controllers/Bi/Partial/Bi_db_sourceController.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
*接口编写处...
|
||||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||
*如: [ApiActionPermission("Bi_db_source",Enums.ActionPermissionOptions.Search)]
|
||||
*/
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using iMES.Entity.DomainModels;
|
||||
using iMES.Bi.IServices;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
public partial class Bi_db_sourceController
|
||||
{
|
||||
private readonly IBi_db_sourceService _service;//访问业务代码
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public Bi_db_sourceController(
|
||||
IBi_db_sourceService service,
|
||||
IHttpContextAccessor httpContextAccessor
|
||||
)
|
||||
: base(service)
|
||||
{
|
||||
_service = service;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
///// <summary>
|
||||
///// 执行业务接口
|
||||
///// </summary>
|
||||
///// <param name="Action"></param>
|
||||
///// <param name="PostData"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost]
|
||||
//public ActionResult<string> ExeAction([FromBody] JObject JsonData)
|
||||
//{
|
||||
// string P1 = JsonData["P1"] == null ? "" : JsonData["P1"].ToString();
|
||||
// string Action = JsonData["Action"] == null ? "" : JsonData["Action"].ToString();
|
||||
// string P2 = JsonData["P2"] == null ? "" : JsonData["P2"].ToString();
|
||||
// try
|
||||
// {
|
||||
// // 1.Load(命名空间名称),GetType(命名空间.类名)
|
||||
// Type type = Assembly.Load("iMES.Bi.API").GetType("iMES.Bi.API." + Action.Split('_')[0].ToUpper() + "Manage");
|
||||
// //2.GetMethod(需要调用的方法名称)
|
||||
// MethodInfo method = type.GetMethod(Action.Split('_')[1].ToUpper());
|
||||
// // 3.调用的实例化方法(非静态方法)需要创建类型的一个实例
|
||||
// object obj = Activator.CreateInstance(type);
|
||||
// //4.方法需要传入的参数
|
||||
// object[] parameters = new object[] { JsonData, Model, P1, P2 };
|
||||
// method.Invoke(obj, parameters);
|
||||
|
||||
|
||||
// var tt = JsonConvert.DeserializeObject<Bi_db_source>(P1);
|
||||
// var db = new DBFactory(tt.DBType, tt.DBIP, tt.Port, tt.DBName, tt.DBUser, tt.DBPwd);
|
||||
// if (db.TestConn())
|
||||
// {
|
||||
// msg.Result = "1"; //1:代表连接成功
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// msg.ErrorMsg = "连接失败";
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Model.ErrorMsg = "接口调用失败,请检查日志" + ex.StackTrace.ToString();
|
||||
// Model.Result = ex.ToString();
|
||||
// }
|
||||
// return JsonNormal(Model);
|
||||
//}
|
||||
}
|
||||
}
|
||||
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_ybpController.cs
Normal file
33
iMES.WebApi/Controllers/Bi/Partial/Bi_db_ybpController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
*接口编写处...
|
||||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||
*如: [ApiActionPermission("Bi_db_ybp",Enums.ActionPermissionOptions.Search)]
|
||||
*/
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using iMES.Entity.DomainModels;
|
||||
using iMES.Bi.IServices;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
public partial class Bi_db_ybpController
|
||||
{
|
||||
private readonly IBi_db_ybpService _service;//访问业务代码
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public Bi_db_ybpController(
|
||||
IBi_db_ybpService service,
|
||||
IHttpContextAccessor httpContextAccessor
|
||||
)
|
||||
: base(service)
|
||||
{
|
||||
_service = service;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
}
|
||||
}
|
||||
64
iMES.WebApi/Controllers/Bi/Partial/Bi_desktopController.cs
Normal file
64
iMES.WebApi/Controllers/Bi/Partial/Bi_desktopController.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
*接口编写处...
|
||||
*如果接口需要做Action的权限验证,请在Action上使用属性
|
||||
*如: [ApiActionPermission("Bi_desktop",Enums.ActionPermissionOptions.Search)]
|
||||
*/
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using iMES.Entity.DomainModels;
|
||||
using iMES.Bi.IServices;
|
||||
using iMES.Bi.IRepositories;
|
||||
using System.Linq;
|
||||
using iMES.Core.ManageUser;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
public partial class Bi_desktopController
|
||||
{
|
||||
private readonly IBi_desktopService _service;//访问业务代码
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IBi_desktopRepository _desktopRepository;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public Bi_desktopController(
|
||||
IBi_desktopService service,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IBi_desktopRepository desktopRepository
|
||||
)
|
||||
: base(service)
|
||||
{
|
||||
_service = service;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_desktopRepository = desktopRepository;
|
||||
}
|
||||
|
||||
[Route("updateStatus"), HttpGet]
|
||||
public IActionResult UpdateStatus(int desktopId, int statusFlag)
|
||||
{
|
||||
Bi_desktop desktop = new Bi_desktop()
|
||||
{
|
||||
DesktopId = desktopId,
|
||||
IsDefault = statusFlag
|
||||
};
|
||||
_desktopRepository.Update(desktop, x => new { x.IsDefault }, true);
|
||||
return Content("修改成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取主页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Route("getDesktop"), HttpGet]
|
||||
public async Task<IActionResult> GetDesktop()
|
||||
{
|
||||
var rows = await _desktopRepository.FindAsIQueryable(x => x.IsDefault == 1 && x.CreateID == UserContext.Current.UserId)
|
||||
.ToListAsync();
|
||||
return JsonNormal(rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
iMES.WebApi/Controllers/Bi/Partial/BllController.cs
Normal file
78
iMES.WebApi/Controllers/Bi/Partial/BllController.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using iMES.Bi.API;
|
||||
using iMES.Bi.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using iMES.Bi;
|
||||
using iMES.Core.Controllers.Basic;
|
||||
using iMES.Bi.IServices;
|
||||
|
||||
namespace iMES.Bi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 业务功能模块接口
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class BllController : ApiBaseController<IBi_db_ybpService>
|
||||
{
|
||||
private IHttpContextAccessor _accessor;
|
||||
|
||||
[Obsolete]
|
||||
private IHostingEnvironment hostingEnv { get; set; }
|
||||
private IContentTypeProvider contentTypeProvider { get; set; }
|
||||
|
||||
|
||||
Msg_Result Model = new Msg_Result() { Action = "", ErrorMsg = "" };
|
||||
|
||||
[Obsolete]
|
||||
public BllController(IHttpContextAccessor accessor, IHostingEnvironment env)
|
||||
{
|
||||
_accessor = accessor;
|
||||
this.hostingEnv = env;
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行业务接口
|
||||
/// </summary>
|
||||
/// <param name="Action"></param>
|
||||
/// <param name="PostData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public ActionResult<string> ExeAction([FromBody] JObject JsonData)
|
||||
{
|
||||
var context = _accessor.HttpContext;
|
||||
string P1 = JsonData["P1"] == null ? "" : JsonData["P1"].ToString();
|
||||
string Action = Model.Action = JsonData["Action"] == null ? "" : JsonData["Action"].ToString();
|
||||
string P2 = JsonData["P2"] == null ? "" : JsonData["P2"].ToString();
|
||||
JsonData.Add("zid", context.Request.Cookies["zid"] ?? "");
|
||||
|
||||
try
|
||||
{
|
||||
// 1.Load(命名空间名称),GetType(命名空间.类名)
|
||||
Type type = Assembly.Load("iMES.Bi.API").GetType("iMES.Bi.API." + Action.Split('_')[0].ToUpper() + "Manage");
|
||||
//2.GetMethod(需要调用的方法名称)
|
||||
MethodInfo method = type.GetMethod(Action.Split('_')[1].ToUpper());
|
||||
// 3.调用的实例化方法(非静态方法)需要创建类型的一个实例
|
||||
object obj = Activator.CreateInstance(type);
|
||||
//4.方法需要传入的参数
|
||||
object[] parameters = new object[] { JsonData, Model, P1, P2 };
|
||||
method.Invoke(obj, parameters);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Model.ErrorMsg = "接口调用失败,请检查日志" + ex.StackTrace.ToString();
|
||||
Model.Result = ex.ToString();
|
||||
}
|
||||
return JsonNormal(Model);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user