SysAppController.cs
2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using Hh.Mes.Common.Json;
using Hh.Mes.Service.Base;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Hosting;
using Hh.Mes.Common.config;
using Hh.Mes.Common.Redis;
using WebMvc.Aop;
using Hh.Mes.Common.Request;
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service.SystemAuth;
using Hh.Mes.Service.WebService.Base;
using Org.BouncyCastle.Crypto;
using Hh.Mes.Service.Configure;
using NPOI.POIFS.FileSystem;
namespace WebMvc
{
/// <summary>
/// APP管理
/// </summary>
[Area("base")]
public class SysAppController : BaseController
{
private readonly SysAppService sysAppService;
private readonly IHostingEnvironment environment;
public SysAppController(IAuth authUtil, SysAppService service, IHostingEnvironment hostingEnvironment) : base(authUtil)
{
environment = hostingEnvironment;
sysAppService = service;
sysAppService.sysWebUser = authUtil.GetCurrentUser().User;
}
#region 视图功能
/// <summary>
/// 默认视图Action
/// </summary>
/// <returns></returns>
[Authenticate]
[ServiceFilter(typeof(OperLogFilter))]
public ActionResult Index()
{
return View();
}
#endregion
/// <summary>
/// 加载及分页查询
/// </summary>
[HttpPost]
public string Load(PageReq pageRequest, sys_app entity)
{
return Serialize(sysAppService.Load(pageRequest, entity));
}
/// <summary>
/// 修改数据
/// </summary>
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(OperLogFilter))]
[XSSFilter]
public string Upd(sys_app entity)
{
var response = sysAppService.Upd(entity);
return Serialize(response);
}
/// <summary>
/// 删除
/// </summary>
[HttpPost]
[ServiceFilter(typeof(OperLogFilter))]
public string DelByIds(int[] ids)
{
return Serialize(sysAppService.DelByIds(ids));
}
/// <summary>
/// 导入数据
/// </summary>
/// <param name="excelfile">表单提交的文件信息</param>
/// <returns></returns>
[HttpPost]
public string Import(IFormFileCollection excelfile)
{
var http = ConfigRead.GetInstance.GetAppsetConnection().HttpOrHttps;
var port = Request.Host.Port.Value;
return JsonHelper.Instance.Serialize(sysAppService.Import(http, port, excelfile, environment));
}
}
}