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
5deb0c6d
Commit
5deb0c6d
authored
Mar 22, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户修改密码/account/password;;/sheet/sheetlist接口增加一个条件source。
parent
7173b51f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
3 deletions
+74
-3
performance/Performance.Api/Controllers/AccountController.cs
+14
-0
performance/Performance.Api/Controllers/SheetController.cs
+1
-1
performance/Performance.DtoModels/Request/PasswordRequest.cs
+30
-0
performance/Performance.DtoModels/Request/SheetRequest.cs
+2
-0
performance/Performance.Services/SheetSevice.cs
+5
-2
performance/Performance.Services/UserService.cs
+22
-0
No files found.
performance/Performance.Api/Controllers/AccountController.cs
View file @
5deb0c6d
...
@@ -135,5 +135,19 @@ public ApiResponse SetHospital([FromBody]SetHospitalRequest request)
...
@@ -135,5 +135,19 @@ public ApiResponse SetHospital([FromBody]SetHospitalRequest request)
return
new
ApiResponse
(
ResponseType
.
Fail
);
return
new
ApiResponse
(
ResponseType
.
Fail
);
return
new
ApiResponse
(
ResponseType
.
OK
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
/// <summary>
/// 修改用户密码
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"password"
)]
[
HttpPost
]
public
ApiResponse
<
UserResponse
>
Password
([
FromBody
]
PasswordRequest
request
)
{
var
userid
=
_claim
.
At
(
request
.
Token
).
UserID
;
var
user
=
_userService
.
UpdatePwd
(
request
,
userid
);
return
new
ApiResponse
<
UserResponse
>(
ResponseType
.
OK
,
user
);
}
}
}
}
}
performance/Performance.Api/Controllers/SheetController.cs
View file @
5deb0c6d
...
@@ -35,7 +35,7 @@ public class SheetController : Controller
...
@@ -35,7 +35,7 @@ public class SheetController : Controller
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
SheetList
([
FromBody
]
SheetRequest
request
)
public
ApiResponse
SheetList
([
FromBody
]
SheetRequest
request
)
{
{
var
sheetList
=
_sheetSevice
.
SheetList
(
request
.
AllotID
);
var
sheetList
=
_sheetSevice
.
SheetList
(
request
.
AllotID
,
request
.
Source
);
return
new
ApiResponse
(
ResponseType
.
OK
,
sheetList
);
return
new
ApiResponse
(
ResponseType
.
OK
,
sheetList
);
}
}
...
...
performance/Performance.DtoModels/Request/PasswordRequest.cs
0 → 100644
View file @
5deb0c6d
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Performance.DtoModels
{
public
class
PasswordRequest
:
ApiRequest
{
/// <summary>
/// 原始密码
/// </summary>
public
string
OldPwd
{
get
;
set
;
}
/// <summary>
/// 新设密码
/// </summary>
public
string
NewPwd
{
get
;
set
;
}
public
class
PasswordRequestValidator
:
AbstractValidator
<
PasswordRequest
>
{
public
PasswordRequestValidator
()
{
RuleFor
(
x
=>
x
.
OldPwd
).
NotNull
().
NotEmpty
();
RuleFor
(
x
=>
x
.
NewPwd
).
NotNull
().
NotEmpty
();
}
}
}
}
performance/Performance.DtoModels/Request/SheetRequest.cs
View file @
5deb0c6d
...
@@ -12,6 +12,8 @@ public class SheetRequest : ApiRequest
...
@@ -12,6 +12,8 @@ public class SheetRequest : ApiRequest
{
{
public
int
AllotID
{
get
;
set
;
}
public
int
AllotID
{
get
;
set
;
}
public
int
Source
{
get
;
set
;
}
}
}
public
class
SheetRequestValidator
:
AbstractValidator
<
SheetRequest
>
public
class
SheetRequestValidator
:
AbstractValidator
<
SheetRequest
>
{
{
...
...
performance/Performance.Services/SheetSevice.cs
View file @
5deb0c6d
...
@@ -47,13 +47,16 @@ public class SheetSevice : IAutoInjection
...
@@ -47,13 +47,16 @@ public class SheetSevice : IAutoInjection
/// </summary>
/// </summary>
/// <param name="allotID"></param>
/// <param name="allotID"></param>
/// <returns></returns>
/// <returns></returns>
public
List
<
SheetResponse
>
SheetList
(
int
allotID
)
public
List
<
SheetResponse
>
SheetList
(
int
allotID
,
int
source
)
{
{
var
allot
=
_perforAllotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotID
);
var
allot
=
_perforAllotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotID
);
if
(
allot
==
null
)
if
(
allot
==
null
)
throw
new
PerformanceException
(
"参数allotid无效"
);
throw
new
PerformanceException
(
"参数allotid无效"
);
int
[]
arr
=
new
int
[]
{
1
,
2
};
if
(!
arr
.
Contains
(
source
))
throw
new
PerformanceException
(
"参数source无效"
);
var
sheetList
=
_perforImSheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotID
);
var
sheetList
=
_perforImSheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotID
&&
t
.
Source
==
source
);
return
Mapper
.
Map
<
List
<
SheetResponse
>>(
sheetList
);
return
Mapper
.
Map
<
List
<
SheetResponse
>>(
sheetList
);
}
}
...
...
performance/Performance.Services/UserService.cs
View file @
5deb0c6d
...
@@ -200,5 +200,27 @@ public UserResponse UpdateSelf(UserRequest request)
...
@@ -200,5 +200,27 @@ public UserResponse UpdateSelf(UserRequest request)
throw
new
PerformanceException
(
"保存失败"
);
throw
new
PerformanceException
(
"保存失败"
);
return
Mapper
.
Map
<
UserResponse
>(
user
);
return
Mapper
.
Map
<
UserResponse
>(
user
);
}
}
/// <summary>
/// 修改用户
/// </summary>
/// <param name="request"></param>
/// <param name="userId"></param>
/// <returns></returns>
public
UserResponse
UpdatePwd
(
PasswordRequest
request
,
int
userId
)
{
var
user
=
_userRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
);
if
(
null
==
user
)
throw
new
PerformanceException
(
$"用户不存在 UserId:
{
userId
}
"
);
if
(
request
.
OldPwd
!=
user
.
Password
)
throw
new
PerformanceException
(
"原密码错误"
);
user
.
Password
=
string
.
IsNullOrEmpty
(
request
.
NewPwd
)
?
user
.
Password
:
request
.
NewPwd
;
if
(!
_userRepository
.
Update
(
user
))
throw
new
PerformanceException
(
"保存失败"
);
return
Mapper
.
Map
<
UserResponse
>(
user
);
}
}
}
}
}
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