唐召明
authored
|
1
|
using Hh.Mes.Common.Request;
|
赖素文
authored
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using Hh.Mes.Pojo.System;
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service;
using Hh.Mes.Service.SystemAuth;
using Hh.Mes.Service.WebService.Base;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using WebMvc.Aop;
namespace WebMvc
{
[Area("base")]
public class SysUserController : BaseController
{
private readonly SysUserService service;
private readonly AuthStrategyContext _authStrategyContext;
private readonly FaceLoginService faceLoginService;
|
赖素文
authored
|
23
|
private readonly IWebHostEnvironment environment;
|
赖素文
authored
|
24
|
|
赖素文
authored
|
25
|
public SysUserController(IAuth authUtil, SysUserService service, FaceLoginService faceLogin, IWebHostEnvironment hostingEnvironment) : base(authUtil)
|
赖素文
authored
|
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
|
{
_authStrategyContext = authUtil.GetCurrentUser();
environment = hostingEnvironment;
this.service = service;
this.service.sysWebUser = authUtil.GetCurrentUser().User;
this.faceLoginService = faceLogin;
this.faceLoginService.sysWebUser = authUtil.GetCurrentUser().User;
}
//
// GET: /SysUser/
public ActionResult Index()
{
return View();
}
/// <summary>
/// 用户列表没有组织 树形形状的
/// </summary>
/// <returns></returns>
public ActionResult UserList()
{
return View();
}
/// <summary>
/// 加载组织下面的所有用户
/// </summary>
[HttpPost]
public string LoadUserListByTeamCode(string teamCode)
{
return Serialize(service.LoadUserListByTeamCode(teamCode));
}
/// <summary>
/// 加载组织下面的所有用户
/// </summary>
[HttpPost]
|
|
64
|
public string Load(PageReq request, int? orgId, string Name, string Account)
|
赖素文
authored
|
65
|
{
|
|
66
|
return Serialize(service.Load(request, orgId, Name, Account));
|
赖素文
authored
|
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
}
//添加用户
[HttpPost]
[XSSFilter]
public string Add(SysUserView view)
{
return Serialize(service.Ins(view));
}
//修改用户
[HttpPost]
[XSSFilter]
public string Update(SysUserView view)
{
return Serialize(service.Upd(view));
}
[HttpPost]
public string Delete(int[] ids)
{
return Serialize(service.DeleteById(ids));
}
#region 获取权限数据
/// <summary>
/// 获取用户可访问的账号
/// </summary>
public string GetAccessedUsers()
{
IEnumerable<SysUserView> users = service.Load(new PageReq(), null, null, null).Result;
var result = new Dictionary<int, object>();
foreach (var user in users)
{
var item = new
{
Account = user.Account,
RealName = user.Name,
id = user.Id,
text = user.Name,
value = user.Account,
parentId = "0",
showcheck = true,
img = "fa fa-user",
};
result.Add(user.Id, item);
}
return Serialize(result);
}
#endregion
public ActionResult ChangePassword()
{
return View();
}
//修改个人密码
[HttpPost]
[XSSFilter]
public string ChangeUserPassword(string OldPassword, string Password)
{
return Serialize(service.ChangeUserPassword(OldPassword, Password, _authStrategyContext.User));
}
//重设用户密码
[HttpPost]
[XSSFilter]
public string ResetPassword(SysUser user)
{
return Serialize(service.ResetPassword(user));
}
[Authenticate]
public ActionResult Binding()
{
return View();
}
//绑定登录方式 string account, string userImage,string jobCard ,bool edit
[HttpPost]
public string BindingAdd(IFormFileCollection excelfile)
{
var account = Request.Form["account"];
var userImage = Request.Form["userImage"];
var jobCard = Request.Form["jobCard"];
|
唐召明
authored
|
155
|
var edit = bool.Parse(Request.Form["edit"]);
|
赖素文
authored
|
156
|
byte[] imageBytes = { };
|
唐召明
authored
|
157
|
if (excelfile.Count > 0)
|
赖素文
authored
|
158
159
|
{
string[] str = userImage[0].Split(',');
|
唐召明
authored
|
160
161
162
|
imageBytes = Convert.FromBase64String(str[1]);
}
Result = faceLoginService.FaceSearchAdd(account, userImage, jobCard, edit, imageBytes, environment.ContentRootPath);
|
赖素文
authored
|
163
164
165
|
//_app.CreateBinding(account, userImage,jobCard);
return Serialize(Result);
}
|
HuXiYu
authored
|
166
167
|
|
赖素文
authored
|
168
|
/// <summary>
|
唐召明
authored
|
169
|
/// 用户绑定项目
|
赖素文
authored
|
170
|
/// </summary>
|
唐召明
authored
|
171
172
173
174
|
/// <param name="projectRoleKey">项目角色Key</param>
/// <param name="checkeds">启用或取消</param>
/// <param name="projectKeys">项目Key集合</param>
/// <returns></returns>
|
HuXiYu
authored
|
175
|
[HttpPost]
|
唐召明
authored
|
176
|
public string RoleBindProjectRel(Guid projectRoleKey, bool checkeds, List<Guid> projectKeys)
|
HuXiYu
authored
|
177
|
{
|
唐召明
authored
|
178
|
return Serialize(service.RoleBindProjectRel(projectRoleKey, checkeds, projectKeys));
|
HuXiYu
authored
|
179
180
|
}
|
赖素文
authored
|
181
|
/// <summary>
|
唐召明
authored
|
182
|
/// 项目角色关联绑定的 项目信息 获取列表
|
赖素文
authored
|
183
|
/// </summary>
|
唐召明
authored
|
184
|
public string GetUserBindClient(Guid projectRoleKey)
|
HuXiYu
authored
|
185
|
{
|
唐召明
authored
|
186
|
return Serialize(service.GetUserBindClient(projectRoleKey));
|
HuXiYu
authored
|
187
|
}
|
赖素文
authored
|
188
189
|
}
}
|