Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
f6514d1a
Commit
f6514d1a
authored
Feb 15, 2023
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户密码加密&快速登录&重置密码
parent
70401943
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
233 additions
and
265 deletions
+233
-265
performance/Performance.Api/Controllers/AccountController.cs
+37
-52
performance/Performance.Api/wwwroot/Performance.Api.xml
+13
-18
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+45
-14
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.DtoModels/AppConst.cs
+10
-0
performance/Performance.DtoModels/Performance.DtoModels.csproj
+11
-16
performance/Performance.DtoModels/Request/ResetPwdRequest.cs
+10
-0
performance/Performance.DtoModels/Request/UserListRequest.cs
+10
-0
performance/Performance.DtoModels/Request/UserRequest.cs
+3
-6
performance/Performance.DtoModels/Response/UserIdentity.cs
+4
-1
performance/Performance.DtoModels/Response/UserResponse.cs
+0
-1
performance/Performance.EntityModels/Entity/Sys_User.cs
+4
-0
performance/Performance.Infrastructure/Helper/PwdHelper.cs
+32
-35
performance/Performance.Services/PersonService.cs
+6
-3
performance/Performance.Services/ReportGlobalService.cs
+5
-3
performance/Performance.Services/UserService.cs
+38
-116
No files found.
performance/Performance.Api/Controllers/AccountController.cs
View file @
f6514d1a
...
@@ -82,6 +82,37 @@ public ApiResponse<JwtToken> Login([FromBody] LoginRequest request)
...
@@ -82,6 +82,37 @@ public ApiResponse<JwtToken> Login([FromBody] LoginRequest request)
}
}
/// <summary>
/// <summary>
/// 快速登录
/// </summary>
/// <param name="userId">登录目标用户id</param>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"quick/login/{userId}"
)]
[
HttpPost
]
public
ApiResponse
<
JwtToken
>
QuickLogin
(
int
userId
,
[
FromBody
]
ResetPwdRequest
request
)
{
var
loginUserId
=
_claim
.
GetUserId
();
var
user
=
_userService
.
QuickLogin
(
userId
,
loginUserId
,
request
.
Password
);
if
(
user
==
null
)
return
new
ApiResponse
<
JwtToken
>(
ResponseType
.
Fail
,
"用户不存在"
);
var
userClaim
=
_claim
.
GetUserClaim
();
var
claims
=
new
Claim
[]
{
new
Claim
(
JwtClaimTypes
.
Id
,
user
.
UserID
.
ToString
()),
new
Claim
(
JwtClaimTypes
.
Login
,
user
.
Login
),
new
Claim
(
JwtClaimTypes
.
RealName
,
user
.
RealName
),
new
Claim
(
JwtClaimTypes
.
Mail
,
user
.
Mail
??
""
),
new
Claim
(
JwtClaimTypes
.
AppName
,
userClaim
.
FirstOrDefault
(
t
=>
t
.
Type
==
JwtClaimTypes
.
AppName
)?.
Value
??
""
),
new
Claim
(
JwtClaimTypes
.
Device
,
userClaim
.
FirstOrDefault
(
t
=>
t
.
Type
==
JwtClaimTypes
.
Device
)?.
Value
??
""
),
new
Claim
(
JwtClaimTypes
.
Department
,
user
.
Department
??
""
),
};
var
jwtToken
=
JwtTokenHelper
.
GenerateToken
(
claims
,
_options
.
ExpirationMinutes
);
return
new
ApiResponse
<
JwtToken
>(
ResponseType
.
OK
,
jwtToken
);
}
/// <summary>
/// 刷新登录JWT TOKEN
/// 刷新登录JWT TOKEN
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
...
@@ -147,59 +178,12 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
...
@@ -147,59 +178,12 @@ public ApiResponse<UserResponse> UpdateSelf([CustomizeValidator(RuleSet = "Self"
/// <returns></returns>
/// <returns></returns>
[
Route
(
"list"
)]
[
Route
(
"list"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
<
List
<
UserResponse
>>
List
([
FromBody
]
UserRequest
request
)
public
ApiResponse
<
List
<
UserResponse
>>
List
([
FromBody
]
User
List
Request
request
)
{
{
var
userList
=
_userService
.
GetUserList
(
_claim
.
GetUserId
(),
request
.
Role
);
var
userList
=
_userService
.
GetUserList
(
_claim
.
GetUserId
(),
request
.
Role
);
return
new
ApiResponse
<
List
<
UserResponse
>>(
ResponseType
.
OK
,
"ok"
,
userList
);
return
new
ApiResponse
<
List
<
UserResponse
>>(
ResponseType
.
OK
,
"ok"
,
userList
);
}
}
///// <summary>
///// 新增用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("insert")]
//[HttpPost]
//public ApiResponse<UserResponse> Insert([CustomizeValidator(RuleSet = "Insert"), FromBody] UserRequest request)
//{
// var userId = _claim.GetUserId();
// var user = _userService.Insert(request, userId);
// user.Role = request.Role;
// return new ApiResponse<UserResponse>(ResponseType.OK, user);
//}
///// <summary>
///// 新增用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("delete")]
//[HttpPost]
//public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody] UserRequest request)
//{
// return _userService.Delete(request.ID);
//}
///// <summary>
///// 删除用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//[Route("update")]
//[HttpPost]
//public ApiResponse<UserResponse> Update([CustomizeValidator(RuleSet = "Update"), FromBody] UserRequest request)
//{
// var userId = _claim.GetUserId();
// int[] roleArray = new int[] { _options.NurseRole, _options.DirectorRole, _options.SpecialRole, _options.OfficeRole };
// var roles = _roleService.GetUserRole(userId);
// var isAgainAdmin = roles != null ? roleArray.Contains(roles.First().Type ?? 0) : false;
// var user = _userService.Update(request, isAgainAdmin);
// user.Role = request.Role;
// return new ApiResponse<UserResponse>(ResponseType.OK, user);
//}
/// <summary>
/// <summary>
/// 修改用户密码
/// 修改用户密码
/// </summary>
/// </summary>
...
@@ -282,16 +266,17 @@ public ApiResponse<JwtToken> DemoUsers(int userId)
...
@@ -282,16 +266,17 @@ public ApiResponse<JwtToken> DemoUsers(int userId)
}
}
/// <summary>
/// <summary>
///
修改用户
密码
///
重置
密码
/// </summary>
/// </summary>
/// <param name="userId">用户id</param>
/// <param name="userId">重置目标用户id</param>
/// <param name="request"></param>
/// <returns></returns>
/// <returns></returns>
[
Route
(
"reset/{userId}"
)]
[
Route
(
"reset/{userId}"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
<
UserResponse
>
Password
(
int
userId
)
public
ApiResponse
<
UserResponse
>
Password
(
int
userId
,
[
FromBody
]
ResetPwdRequest
request
)
{
{
var
loginUserId
=
_claim
.
GetUserId
();
var
loginUserId
=
_claim
.
GetUserId
();
var
user
=
_userService
.
ResetPwd
(
userId
,
loginUserId
);
var
user
=
_userService
.
ResetPwd
(
userId
,
loginUserId
,
request
.
Password
);
return
new
ApiResponse
<
UserResponse
>(
ResponseType
.
OK
,
user
);
return
new
ApiResponse
<
UserResponse
>(
ResponseType
.
OK
,
user
);
}
}
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
f6514d1a
...
@@ -24,6 +24,14 @@
...
@@ -24,6 +24,14 @@
<param
name=
"request"
></param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.QuickLogin(System.Int32,Performance.DtoModels.ResetPwdRequest)"
>
<summary>
快速登录
</summary>
<param
name=
"userId"
>
登录目标用户id
</param>
<param
name=
"request"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.Refresh"
>
<member
name=
"M:Performance.Api.Controllers.AccountController.Refresh"
>
<summary>
<summary>
刷新登录JWT TOKEN
刷新登录JWT TOKEN
...
@@ -43,7 +51,7 @@
...
@@ -43,7 +51,7 @@
<param
name=
"request"
></param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.List(Performance.DtoModels.UserRequest)"
>
<member
name=
"M:Performance.Api.Controllers.AccountController.List(Performance.DtoModels.User
List
Request)"
>
<summary>
<summary>
用户列表
用户列表
</summary>
</summary>
...
@@ -82,11 +90,12 @@
...
@@ -82,11 +90,12 @@
<param
name=
"userId"
></param>
<param
name=
"userId"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.Password(System.Int32)"
>
<member
name=
"M:Performance.Api.Controllers.AccountController.Password(System.Int32
,Performance.DtoModels.ResetPwdRequest
)"
>
<summary>
<summary>
修改用户
密码
重置
密码
</summary>
</summary>
<param
name=
"userId"
>
用户id
</param>
<param
name=
"userId"
>
重置目标用户id
</param>
<param
name=
"request"
></param>
<returns></returns>
<returns></returns>
</member>
</member>
<member
name=
"M:Performance.Api.Controllers.AccountController.SelfInfos(Performance.DtoModels.UserRequest)"
>
<member
name=
"M:Performance.Api.Controllers.AccountController.SelfInfos(Performance.DtoModels.UserRequest)"
>
...
@@ -2697,19 +2706,5 @@
...
@@ -2697,19 +2706,5 @@
过期时间
过期时间
</summary>
</summary>
</member>
</member>
<member
name=
"M:Performance.Api.MD5Helper.MD5EncryptSmall32(System.String)"
>
<summary>
32位MD5加密
</summary>
<param
name=
"password"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.MD5Helper.MD5EncryptCaps32(System.String)"
>
<summary>
32位MD5加密
</summary>
<param
name=
"password"
></param>
<returns></returns>
</member>
</members>
</members>
</doc>
</doc>
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
f6514d1a
...
@@ -14,6 +14,11 @@
...
@@ -14,6 +14,11 @@
返回数据。
返回数据。
</summary>
</summary>
</member>
</member>
<member
name=
"F:Performance.DtoModels.AppConst.InitPwd"
>
<summary>
初始密码
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AppSettings.AppConnection"
>
<member
name=
"T:Performance.DtoModels.AppSettings.AppConnection"
>
<summary>
<summary>
数据库连接字符串
数据库连接字符串
...
@@ -816,6 +821,31 @@
...
@@ -816,6 +821,31 @@
保底绩效
保底绩效
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.PerComputeData.SheetType"
>
<summary>
sheet模板类型
</summary>
</member>
<member
name=
"P:Performance.DtoModels.PerComputeData.UnitType"
>
<summary>
核算单元类别 (医生组/护理组)
</summary>
</member>
<member
name=
"P:Performance.DtoModels.PerComputeData.AccountingUnit"
>
<summary>
核算单元名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.PerComputeData.TypeName"
>
<summary>
列头类型名称
</summary>
</member>
<member
name=
"P:Performance.DtoModels.PerComputeData.CellValue"
>
<summary>
单元格value
</summary>
</member>
<member
name=
"P:Performance.DtoModels.PerData.UnitType"
>
<member
name=
"P:Performance.DtoModels.PerData.UnitType"
>
<summary>
<summary>
核算单元类别 (医生组/护理组)
核算单元类别 (医生组/护理组)
...
@@ -2471,6 +2501,16 @@
...
@@ -2471,6 +2501,16 @@
提交类型 1 模板提交 2 其他提交
提交类型 1 模板提交 2 其他提交
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.ResetPwdRequest.Password"
>
<summary>
操作人密码
</summary>
</member>
<member
name=
"P:Performance.DtoModels.UserListRequest.Role"
>
<summary>
角色
</summary>
</member>
<member
name=
"P:Performance.DtoModels.UserRequest.RealName"
>
<member
name=
"P:Performance.DtoModels.UserRequest.RealName"
>
<summary>
<summary>
真实名称
真实名称
...
@@ -4193,6 +4233,11 @@
...
@@ -4193,6 +4233,11 @@
用户科室
用户科室
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.DtoModels.UserIdentity.IsInitialPassword"
>
<summary>
初始密码 1 初始 2 改过
</summary>
</member>
<member
name=
"P:Performance.DtoModels.WorkyearResponse.MaxRange"
>
<member
name=
"P:Performance.DtoModels.WorkyearResponse.MaxRange"
>
<summary>
<summary>
最大工龄范围(小于)
最大工龄范围(小于)
...
@@ -4378,19 +4423,5 @@
...
@@ -4378,19 +4423,5 @@
title value
title value
</summary>
</summary>
</member>
</member>
<member
name=
"M:Performance.DtoModels.MD5Helper.MD5EncryptSmall32(System.String)"
>
<summary>
32位MD5加密
</summary>
<param
name=
"password"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.DtoModels.MD5Helper.MD5EncryptCaps32(System.String)"
>
<summary>
32位MD5加密
</summary>
<param
name=
"password"
></param>
<returns></returns>
</member>
</members>
</members>
</doc>
</doc>
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
f6514d1a
...
@@ -9118,6 +9118,11 @@
...
@@ -9118,6 +9118,11 @@
核算序号
核算序号
</summary>
</summary>
</member>
</member>
<member
name=
"P:Performance.EntityModels.sys_user.IsInitialPassword"
>
<summary>
初始密码 1 初始 2 改过
</summary>
</member>
<member
name=
"T:Performance.EntityModels.sys_user_hospital"
>
<member
name=
"T:Performance.EntityModels.sys_user_hospital"
>
<summary>
<summary>
...
...
performance/Performance.DtoModels/AppConst.cs
0 → 100644
View file @
f6514d1a
namespace
Performance.DtoModels
{
public
class
AppConst
{
/// <summary>
/// 初始密码
/// </summary>
public
const
string
InitPwd
=
"123456"
;
}
}
performance/Performance.DtoModels/Performance.DtoModels.csproj
View file @
f6514d1a
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>..\Performance.Api\wwwroot\Performance.DtoModels.xml</DocumentationFile>
<DocumentationFile>..\Performance.Api\wwwroot\Performance.DtoModels.xml</DocumentationFile>
<NoWarn>1701;1702;1591</NoWarn>
<NoWarn>1701;1702;1591</NoWarn>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Compile Remove="PerExcel\PerComputeData.cs" />
<ProjectReference Include="..\Performance.EntityModels\Performance.EntityModels.csproj" />
</ItemGroup>
<ProjectReference Include="..\Performance.Infrastructure\Performance.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Performance.EntityModels\Performance.EntityModels.csproj" />
<ProjectReference Include="..\Performance.Infrastructure\Performance.Infrastructure.csproj" />
</ItemGroup>
</Project>
</Project>
performance/Performance.DtoModels/Request/ResetPwdRequest.cs
0 → 100644
View file @
f6514d1a
namespace
Performance.DtoModels
{
public
class
ResetPwdRequest
{
/// <summary>
/// 操作人密码
/// </summary>
public
string
Password
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Request/UserListRequest.cs
0 → 100644
View file @
f6514d1a
namespace
Performance.DtoModels
{
public
class
UserListRequest
{
/// <summary>
/// 角色
/// </summary>
public
int
Role
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Request/UserRequest.cs
View file @
f6514d1a
using
FluentValidation
;
using
System
;
using
System
;
using
FluentValidation
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.DtoModels
namespace
Performance.DtoModels
{
{
...
@@ -46,7 +43,7 @@ public class UserRequest
...
@@ -46,7 +43,7 @@ public class UserRequest
/// 角色Arr
/// 角色Arr
/// </summary>
/// </summary>
public
int
[]
RoleArr
{
get
;
set
;
}
public
int
[]
RoleArr
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 用户医院ID
/// 用户医院ID
/// </summary>
/// </summary>
...
...
performance/Performance.DtoModels/Response/UserIdentity.cs
View file @
f6514d1a
...
@@ -25,7 +25,10 @@ public class UserIdentity
...
@@ -25,7 +25,10 @@ public class UserIdentity
public
string
Department
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
List
<
HospitalResponse
>
Hospital
{
get
;
set
;
}
public
List
<
HospitalResponse
>
Hospital
{
get
;
set
;
}
public
List
<
RoleResponse
>
Role
{
get
;
set
;
}
public
List
<
RoleResponse
>
Role
{
get
;
set
;
}
/// <summary>
/// 初始密码 1 初始 2 改过
/// </summary>
public
int
IsInitialPassword
{
get
;
set
;
}
public
UserIdentity
()
public
UserIdentity
()
{
{
Hospital
=
new
List
<
HospitalResponse
>();
Hospital
=
new
List
<
HospitalResponse
>();
...
...
performance/Performance.DtoModels/Response/UserResponse.cs
View file @
f6514d1a
...
@@ -11,7 +11,6 @@ public class UserResponse
...
@@ -11,7 +11,6 @@ public class UserResponse
public
int
CreateUser
{
get
;
set
;
}
public
int
CreateUser
{
get
;
set
;
}
public
string
RealName
{
get
;
set
;
}
public
string
RealName
{
get
;
set
;
}
public
string
Login
{
get
;
set
;
}
public
string
Login
{
get
;
set
;
}
public
string
Password
{
get
;
set
;
}
public
string
Mail
{
get
;
set
;
}
public
string
Mail
{
get
;
set
;
}
public
string
Mobile
{
get
;
set
;
}
public
string
Mobile
{
get
;
set
;
}
public
int
States
{
get
;
set
;
}
public
int
States
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/Sys_User.cs
View file @
f6514d1a
...
@@ -83,5 +83,9 @@ public class sys_user
...
@@ -83,5 +83,9 @@ public class sys_user
/// 核算序号
/// 核算序号
/// </summary>
/// </summary>
public
string
UnitCode
{
get
;
set
;
}
public
string
UnitCode
{
get
;
set
;
}
/// <summary>
/// 初始密码 1 初始 2 改过
/// </summary>
public
int
IsInitialPassword
{
get
;
set
;
}
}
}
}
}
performance/Performance.
DtoModels/Util/MD5
Helper.cs
→
performance/Performance.
Infrastructure/Helper/Pwd
Helper.cs
View file @
f6514d1a
using
System
;
using
System.Security.Cryptography
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Performance.
DtoModels
namespace
Performance.
Infrastructure
{
{
public
class
MD5
Helper
public
class
Pwd
Helper
{
{
/// <summary>
/// <summary>
///
32位MD5加密
///
一次加密不加盐
/// </summary>
/// </summary>
/// <param name="password"></param>
/// <param name="password"></param>
/// <returns></returns>
/// <returns></returns>
public
static
string
MD5
EncryptSmall32
(
string
password
)
public
static
string
MD5
(
string
password
)
{
{
MD5CryptoServiceProvider
md5Hasher
=
new
MD5CryptoServiceProvider
();
return
MD5Encrypt
(
password
);
byte
[]
data
=
md5Hasher
.
ComputeHash
(
Encoding
.
Default
.
GetBytes
(
password
));
}
StringBuilder
sBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
/// <summary>
{
/// 一次加密加盐
sBuilder
.
Append
(
data
[
i
].
ToString
(
"x2"
));
//转化为小写的32进制
/// </summary>
}
/// <param name="password"></param>
return
sBuilder
.
ToString
();
/// <param name="salt"></param>
/// <returns></returns>
public
static
string
MD5AndSalt
(
string
password
,
string
salt
=
"Suvalue"
)
{
return
MD5Encrypt
(
password
+
salt
);
}
/// <summary>
/// 两次加密加盐
/// </summary>
/// <param name="password"></param>
/// <param name="salt"></param>
/// <returns></returns>
public
static
string
MD5AndSalt2
(
string
password
,
string
salt
=
"Suvalue"
)
{
return
MD5Encrypt
(
MD5Encrypt
(
password
)
+
salt
);
}
}
/// <summary>
/// <summary>
...
@@ -31,31 +42,16 @@ public static string MD5EncryptSmall32(string password)
...
@@ -31,31 +42,16 @@ public static string MD5EncryptSmall32(string password)
/// </summary>
/// </summary>
/// <param name="password"></param>
/// <param name="password"></param>
/// <returns></returns>
/// <returns></returns>
p
ublic
static
string
MD5EncryptCaps32
(
string
password
)
p
rivate
static
string
MD5Encrypt
(
string
password
)
{
{
MD5CryptoServiceProvider
md5Hasher
=
new
MD5CryptoServiceProvider
();
MD5CryptoServiceProvider
md5Hasher
=
new
MD5CryptoServiceProvider
();
byte
[]
data
=
md5Hasher
.
ComputeHash
(
Encoding
.
Default
.
GetBytes
(
password
));
byte
[]
data
=
md5Hasher
.
ComputeHash
(
Encoding
.
Default
.
GetBytes
(
password
));
StringBuilder
sBuilder
=
new
StringBuilder
();
StringBuilder
sBuilder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
{
sBuilder
.
Append
(
data
[
i
].
ToString
(
"
X"
));
//转化为大
写的32进制
sBuilder
.
Append
(
data
[
i
].
ToString
(
"
x2"
));
//转化为小
写的32进制
}
}
return
sBuilder
.
ToString
();
return
sBuilder
.
ToString
();
}
}
///// <summary>
///// 64位MD5加密
///// </summary>
///// <param name="password"></param>
///// <returns></returns>
//public static string MD5Encrypt64(string password)
//{
// string cl = password;
// //string pwd = "";
// MD5 md5 = MD5.Create(); //实例化一个md5对像
// // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
// byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
// return Convert.ToBase64String(s);
//}
}
}
}
}
\ No newline at end of file
performance/Performance.Services/PersonService.cs
View file @
f6514d1a
...
@@ -381,7 +381,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
...
@@ -381,7 +381,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
}
}
if
(
error
.
Count
>
0
)
if
(
error
.
Count
>
0
)
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"修改成功,但存在其他问题请及时处理"
,
error
);
return
new
ApiResponse
(
ResponseType
.
WarningTable
,
"修改成功,但存在其他问题请及时处理"
,
error
);
#
endregion
#
endregion
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功"
);
...
@@ -1353,13 +1353,16 @@ public void SaveQueryRole(int hospitalId, int userId, List<Dictionary<string, st
...
@@ -1353,13 +1353,16 @@ public void SaveQueryRole(int hospitalId, int userId, List<Dictionary<string, st
{
{
var
json
=
JsonHelper
.
Serialize
(
item
);
var
json
=
JsonHelper
.
Serialize
(
item
);
var
data
=
JsonHelper
.
Deserialize
<
per_employee
>(
json
);
var
data
=
JsonHelper
.
Deserialize
<
per_employee
>(
json
);
string
pwd
=
item
.
ContainsKey
(
"Password"
)
?
item
[
"Password"
]
:
""
;
if
(
hospital
.
IsOwnerQuery
==
1
)
if
(
hospital
.
IsOwnerQuery
==
1
)
{
{
var
isNewRole
=
!
string
.
IsNullOrEmpty
(
data
.
PersonnelNumber
?.
Trim
())
&&
!
string
.
IsNullOrEmpty
(
item
[
"Password"
]
);
var
isNewRole
=
!
string
.
IsNullOrEmpty
(
data
.
PersonnelNumber
?.
Trim
())
&&
!
string
.
IsNullOrEmpty
(
pwd
);
var
isRepeat
=
users
.
FirstOrDefault
(
t
=>
t
.
Login
==
data
.
PersonnelNumber
?.
Trim
());
var
isRepeat
=
users
.
FirstOrDefault
(
t
=>
t
.
Login
==
data
.
PersonnelNumber
?.
Trim
());
if
(
isRepeat
!=
null
)
if
(
isRepeat
!=
null
)
{
{
isRepeat
.
Password
=
item
[
"Password"
]
;
isRepeat
.
Password
=
PwdHelper
.
MD5AndSalt2
(
pwd
)
;
updateUsers
.
Add
(
isRepeat
);
updateUsers
.
Add
(
isRepeat
);
}
}
if
(
isNewRole
&&
isRepeat
==
null
)
if
(
isNewRole
&&
isRepeat
==
null
)
...
...
performance/Performance.Services/ReportGlobalService.cs
View file @
f6514d1a
...
@@ -559,7 +559,8 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key)
...
@@ -559,7 +559,8 @@ private T GetCellValue<T>(IRow row, List<string> columns, string key)
var
data
=
(
from
t1
in
pdata
var
data
=
(
from
t1
in
pdata
join
t2
in
tdata
join
t2
in
tdata
on
t1
.
PersonnelNumber
equals
t2
.
PersonnelNumber
into
temp
on
t1
.
PersonnelNumber
equals
t2
.
PersonnelNumber
into
temp
from
t
in
temp
.
DefaultIfEmpty
()
orderby
t1
.
Id
descending
from
t
in
temp
.
DefaultIfEmpty
()
orderby
t1
.
Id
descending
select
new
select
new
{
{
PersonnelNumber
=
t1
.
PersonnelNumber
,
PersonnelNumber
=
t1
.
PersonnelNumber
,
...
@@ -590,7 +591,7 @@ select new
...
@@ -590,7 +591,7 @@ select new
Tag5
=
t
?.
Tag5
,
Tag5
=
t
?.
Tag5
,
}).
Distinct
()?.
ToList
();
}).
Distinct
()?.
ToList
();
if
(
data
==
null
||
!
data
.
Any
())
return
(
result
,
null
);
if
(
data
==
null
||
!
data
.
Any
())
return
(
result
,
null
);
var
users
=
new
List
<
sys_user
>();
var
users
=
new
List
<
sys_user
>();
if
(
hos
?.
IsOwnerQuery
==
1
)
if
(
hos
?.
IsOwnerQuery
==
1
)
...
@@ -613,7 +614,8 @@ select new
...
@@ -613,7 +614,8 @@ select new
select
new
HandsonCellData
(
conf
.
Alias
,
fst
.
Value
)).
ToList
();
select
new
HandsonCellData
(
conf
.
Alias
,
fst
.
Value
)).
ToList
();
if
(
hos
?.
IsOwnerQuery
==
1
)
if
(
hos
?.
IsOwnerQuery
==
1
)
{
{
var
password
=
users
.
FirstOrDefault
(
w
=>
w
.
Login
==
item
.
PersonnelNumber
&&
w
.
Department
==
item
.
AccountingUnit
)?.
Password
??
""
;
//var password = users.FirstOrDefault(w => w.Login == item.PersonnelNumber && w.Department == item.AccountingUnit)?.Password ?? "";
var
password
=
""
;
cells
.
Add
(
new
HandsonCellData
(
"密码"
,
password
));
cells
.
Add
(
new
HandsonCellData
(
"密码"
,
password
));
}
}
...
...
performance/Performance.Services/UserService.cs
View file @
f6514d1a
...
@@ -71,7 +71,7 @@ public UserIdentity Login(LoginRequest request)
...
@@ -71,7 +71,7 @@ public UserIdentity Login(LoginRequest request)
if
(
user
==
null
)
if
(
user
==
null
)
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
request
.
Account
}
"
);
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
request
.
Account
}
"
);
//MD5小写加密
//MD5小写加密
request
.
Password
=
MD5Helper
.
MD5EncryptSmall32
(
request
.
Password
+
"Suvalue"
);
request
.
Password
=
PwdHelper
.
MD5AndSalt
(
request
.
Password
);
if
(!
user
.
Password
.
Equals
(
request
.
Password
,
StringComparison
.
OrdinalIgnoreCase
))
if
(!
user
.
Password
.
Equals
(
request
.
Password
,
StringComparison
.
OrdinalIgnoreCase
))
throw
new
PerformanceException
(
$"密码错误"
);
throw
new
PerformanceException
(
$"密码错误"
);
...
@@ -92,6 +92,24 @@ public UserIdentity GetUser(int userId)
...
@@ -92,6 +92,24 @@ public UserIdentity GetUser(int userId)
return
_mapper
.
Map
<
UserIdentity
>(
user
);
return
_mapper
.
Map
<
UserIdentity
>(
user
);
}
}
public
UserIdentity
QuickLogin
(
int
targetUserId
,
int
loginUserId
,
string
password
)
{
var
loginUser
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
loginUserId
&&
t
.
IsDelete
==
1
);
if
(
loginUser
==
null
)
throw
new
PerformanceException
(
$"您的登录信息有误,请退出后重新登录重试!"
);
if
(
loginUser
.
Password
!=
PwdHelper
.
MD5AndSalt
(
password
))
throw
new
PerformanceException
(
$"您的密码错误,请重新输入后重试"
);
var
targetUser
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
targetUserId
&&
t
.
IsDelete
==
1
);
if
(
targetUser
==
null
)
throw
new
PerformanceException
(
$"您要登录的用户信息有误,请检查后重试"
);
var
data
=
_mapper
.
Map
<
UserIdentity
>(
targetUser
);
data
.
Token
=
Guid
.
NewGuid
().
ToString
(
"N"
);
return
data
;
}
/// <summary>
/// <summary>
/// 获取用户第一个角色
/// 获取用户第一个角色
/// </summary>
/// </summary>
...
@@ -214,57 +232,6 @@ public List<UserResponse> GetUserList(int userID, int roleType = 1)
...
@@ -214,57 +232,6 @@ public List<UserResponse> GetUserList(int userID, int roleType = 1)
return
result
;
return
result
;
}
}
///// <summary>
///// 删除
///// </summary>
///// <param name="iD"></param>
///// <returns></returns>
//public ApiResponse Delete(int iD)
//{
// var user = _userRepository.GetEntity(t => t.ID == iD && t.IsDelete == 1);
// if (null == user)
// throw new PerformanceException($"用户不存在 UserId:{iD}");
// user.IsDelete = 2;
// var result = _userRepository.Remove(user);
// return result ? new ApiResponse(ResponseType.OK) : new ApiResponse(ResponseType.Fail);
//}
///// <summary>
///// 新增用户
///// </summary>
///// <param name="request"></param>
//public UserResponse Insert(UserRequest request, int userid)
//{
// if (null != _userRepository.GetEntity(t => t.Login == request.Login && t.IsDelete == 1))
// throw new PerformanceException("登录名重复");
// //if (null != _userRepository.GetEntity(t => t.Mobile == request.Mobile && t.IsDelete == 1))
// // throw new PerformanceException("手机号重复");
// //if (request.Role == 3 && string.IsNullOrEmpty(request.Department))
// // throw new PerformanceException("请选择科室");
// if (request.HosIDArray.Length > 1)
// throw new PerformanceException("二次绩效管理员只支持单家医院");
// int[] roleArray = new int[] { application.NurseRole, application.DirectorRole, application.SpecialRole, application.OfficeRole };
// if (roleArray.Contains(request.Role) && string.IsNullOrEmpty(request.Department))
// throw new PerformanceException("二次绩效管理员科室不能为空");
// var user = _mapper.Map<sys_user>(request);
// user.CreateDate = DateTime.Now;
// user.CreateUser = userid;
// user.States = (int)States.Enabled;
// user.Department = request.Department;
// user.IsDelete = 1;
// if (!_userRepository.Add(user))
// throw new PerformanceException("保存失败");
// //添加用户角色关联关系
// _userroleRepository.Add(new sys_user_role { UserID = user.ID, RoleID = request.Role });
// //添加用户医院
// SetHospital(user.ID, request.HosIDArray);
// return _mapper.Map<UserResponse>(user);
//}
/// <summary>
/// <summary>
/// 设置用户医院
/// 设置用户医院
/// </summary>
/// </summary>
...
@@ -297,59 +264,6 @@ public bool SetHospital(int userId, int[] hosIDArray)
...
@@ -297,59 +264,6 @@ public bool SetHospital(int userId, int[] hosIDArray)
return
rmResult
&&
addResult
;
return
rmResult
&&
addResult
;
}
}
///// <summary>
///// 修改用户
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public UserResponse Update(UserRequest request, bool isAgainAdmin)
//{
// var user = _userRepository.GetEntity(t => t.ID == request.ID && t.IsDelete == 1);
// if (null == user)
// throw new PerformanceException($"用户不存在 UserId:{request.ID}");
// var vlist = _userRepository.GetEntities(t => t.ID != user.ID && t.Login == request.Login && t.IsDelete == 1);
// if (null != vlist && vlist.Count() > 0)
// throw new PerformanceException("登录名重复");
// var userRole = _userroleRepository.GetEntity(t => t.UserID == request.ID);
// //vlist = _userRepository.GetEntities(t => t.ID != user.ID && t.Mobile == request.Mobile && t.IsDelete == 1);
// //if (null != vlist && vlist.Count() > 0)
// // throw new PerformanceException("手机号重复");
// if (isAgainAdmin && string.IsNullOrEmpty(request.Department))
// throw new PerformanceException("二次绩效管理员科室不能为空");
// if (isAgainAdmin && request.HosIDArray.Length > 1)
// throw new PerformanceException("二次绩效管理员只支持单家医院");
// SaveHistoryDepartment(user.ID, newRoleId: request.Role, newDepartment: request.Department);
// user.Login = request.Login;
// user.Mobile = request.Mobile;
// user.RealName = request.RealName;
// user.Mail = request.Mail;
// user.States = request.States;
// user.Password = string.IsNullOrEmpty(request.Password) ? user.Password : request.Password;
// user.Department = request.Department;
// if (!_userRepository.Update(user))
// throw new PerformanceException("保存失败");
// //删除用户角色关联关系
// if (null != userRole)
// _userroleRepository.Remove(userRole);
// //添加用户角色关联关系
// _userroleRepository.Add(new sys_user_role { UserID = request.ID, RoleID = request.Role });
// //添加用户医院
// SetHospital(user.ID, request.HosIDArray);
// return _mapper.Map<UserResponse>(user);
//}
/// <summary>
/// <summary>
/// 修改个人信息
/// 修改个人信息
...
@@ -374,9 +288,6 @@ public UserResponse UpdateSelf(UserRequest request)
...
@@ -374,9 +288,6 @@ public UserResponse UpdateSelf(UserRequest request)
user
.
RealName
=
string
.
IsNullOrEmpty
(
request
.
RealName
)
?
user
.
RealName
:
request
.
RealName
;
user
.
RealName
=
string
.
IsNullOrEmpty
(
request
.
RealName
)
?
user
.
RealName
:
request
.
RealName
;
user
.
Mail
=
string
.
IsNullOrEmpty
(
request
.
Mail
)
?
user
.
Mail
:
request
.
Mail
;
user
.
Mail
=
string
.
IsNullOrEmpty
(
request
.
Mail
)
?
user
.
Mail
:
request
.
Mail
;
//Md5小写加密
user
.
Password
=
string
.
IsNullOrEmpty
(
request
.
Password
)
?
user
.
Password
:
MD5Helper
.
MD5EncryptSmall32
(
request
.
Password
+
"Suvalue"
);
if
(!
_userRepository
.
Update
(
user
))
if
(!
_userRepository
.
Update
(
user
))
throw
new
PerformanceException
(
"保存失败"
);
throw
new
PerformanceException
(
"保存失败"
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
...
@@ -393,11 +304,17 @@ public UserResponse UpdatePwd(PasswordRequest request, int userId)
...
@@ -393,11 +304,17 @@ public UserResponse UpdatePwd(PasswordRequest request, int userId)
var
user
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
&&
t
.
IsDelete
==
1
);
var
user
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
&&
t
.
IsDelete
==
1
);
if
(
null
==
user
)
if
(
null
==
user
)
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
userId
}
"
);
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
userId
}
"
);
if
(
string
.
IsNullOrEmpty
(
request
.
NewPwd
))
throw
new
PerformanceException
(
$"新密码错误"
);
//MD5小写加密
request
.
OldPwd
=
PwdHelper
.
MD5AndSalt
(
request
.
OldPwd
);
if
(
request
.
OldPwd
!=
user
.
Password
)
if
(
request
.
OldPwd
!=
user
.
Password
)
throw
new
PerformanceException
(
"原密码错误"
);
throw
new
PerformanceException
(
"原密码错误"
);
//Md5小写加密
//Md5小写加密
user
.
Password
=
string
.
IsNullOrEmpty
(
request
.
NewPwd
)
?
user
.
Password
:
MD5Helper
.
MD5EncryptSmall32
(
request
.
NewPwd
+
"Suvalue"
)
;
user
.
Password
=
PwdHelper
.
MD5AndSalt
(
request
.
NewPwd
);
if
(!
_userRepository
.
Update
(
user
))
if
(!
_userRepository
.
Update
(
user
))
throw
new
PerformanceException
(
"保存失败"
);
throw
new
PerformanceException
(
"保存失败"
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
...
@@ -491,17 +408,22 @@ public UserIdentity GetDemoUserIdentity(int userId)
...
@@ -491,17 +408,22 @@ public UserIdentity GetDemoUserIdentity(int userId)
/// <param name="userId"></param>
/// <param name="userId"></param>
/// <param name="loginUserId"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
/// <returns></returns>
public
UserResponse
ResetPwd
(
int
userId
,
int
loginUserId
)
public
UserResponse
ResetPwd
(
int
userId
,
int
loginUserId
,
string
password
)
{
{
var
user
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
&&
t
.
IsDelete
==
1
);
var
user
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
&&
t
.
IsDelete
==
1
);
if
(
user
==
null
)
if
(
user
==
null
)
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
userId
}
"
);
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
userId
}
"
);
//if (user.CreateUser != loginUserId)
var
loginUser
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
loginUserId
);
// throw new PerformanceException($"当前用户无权限重置用户密码");
if
(
loginUser
==
null
)
throw
new
PerformanceException
(
$"用户不存在!"
);
if
(
loginUser
.
Password
!=
PwdHelper
.
MD5AndSalt
(
password
))
throw
new
PerformanceException
(
$"您的密码错误,请重新输入后重试"
);
//MD5小写加密
//MD5小写加密
user
.
Password
=
MD5Helper
.
MD5EncryptSmall32
(
"123456"
+
"Suvalue"
);
user
.
Password
=
PwdHelper
.
MD5AndSalt2
(
AppConst
.
InitPwd
);
user
.
IsInitialPassword
=
1
;
// 初始密码强制修改
if
(!
_userRepository
.
Update
(
user
))
if
(!
_userRepository
.
Update
(
user
))
throw
new
PerformanceException
(
"重置失败"
);
throw
new
PerformanceException
(
"重置失败"
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
return
_mapper
.
Map
<
UserResponse
>(
user
);
...
@@ -597,7 +519,7 @@ public UserResponse UpdateUser(UserRequest request, int userId)
...
@@ -597,7 +519,7 @@ public UserResponse UpdateUser(UserRequest request, int userId)
user
.
Mail
=
request
.
Mail
;
user
.
Mail
=
request
.
Mail
;
user
.
States
=
request
.
States
;
user
.
States
=
request
.
States
;
//Md5小写加密
//Md5小写加密
user
.
Password
=
string
.
IsNullOrEmpty
(
request
.
Password
)
?
user
.
Password
:
MD5Helper
.
MD5EncryptSmall32
(
request
.
Password
+
"Suvalue"
);
user
.
Password
=
string
.
IsNullOrEmpty
(
request
.
Password
)
?
user
.
Password
:
PwdHelper
.
MD5AndSalt
(
request
.
Password
);
user
.
Department
=
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
0
])
?
request
.
Department
:
""
;
user
.
Department
=
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
0
])
?
request
.
Department
:
""
;
if
(
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
0
]))
if
(
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
0
]))
{
{
...
@@ -649,7 +571,7 @@ public UserResponse UpdateUser(UserRequest request, int userId)
...
@@ -649,7 +571,7 @@ public UserResponse UpdateUser(UserRequest request, int userId)
diffUser
.
Mail
=
request
.
Mail
;
diffUser
.
Mail
=
request
.
Mail
;
diffUser
.
States
=
request
.
States
;
diffUser
.
States
=
request
.
States
;
//Md5小写加密
//Md5小写加密
diffUser
.
Password
=
string
.
IsNullOrEmpty
(
request
.
Password
)
?
user
.
Password
:
MD5Helper
.
MD5EncryptSmall32
(
request
.
Password
+
"Suvalue"
);
diffUser
.
Password
=
string
.
IsNullOrEmpty
(
request
.
Password
)
?
user
.
Password
:
PwdHelper
.
MD5AndSalt
(
request
.
Password
);
diffUser
.
Department
=
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
i
])
?
request
.
Department
:
""
;
diffUser
.
Department
=
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
i
])
?
request
.
Department
:
""
;
if
(
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
i
]))
if
(
UnitTypeUtil
.
Maps
.
ContainsKey
(
request
.
RoleArr
[
i
]))
{
{
...
@@ -851,7 +773,7 @@ public ApiResponse SaveUserHandsFlat(UserCollectData request)
...
@@ -851,7 +773,7 @@ public ApiResponse SaveUserHandsFlat(UserCollectData request)
UnitCode
=
cts
?.
Code
??
""
,
UnitCode
=
cts
?.
Code
??
""
,
IsDelete
=
1
,
IsDelete
=
1
,
Login
=
data
.
Login
,
Login
=
data
.
Login
,
Password
=
data
?.
Password
??
MD5Helper
.
MD5EncryptSmall32
(
"123456"
+
"Suvalue"
),
Password
=
data
?.
Password
??
PwdHelper
.
MD5AndSalt2
(
AppConst
.
InitPwd
),
States
=
1
,
States
=
1
,
Mobile
=
data
?.
Mobile
??
""
,
Mobile
=
data
?.
Mobile
??
""
,
Mail
=
data
?.
Mail
??
""
Mail
=
data
?.
Mail
??
""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment