Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
6bbfe859
Commit
6bbfe859
authored
Mar 06, 2020
by
huangZW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
111
parent
89b6cad8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
24 deletions
+26
-24
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+26
-24
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
6bbfe859
...
...
@@ -17,8 +17,10 @@ import com.gic.clerk.api.service.ClerkService;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.ClerkVo
;
...
...
@@ -31,6 +33,9 @@ public class ClerkController extends WebBaseController{
private
DepartmentApiService
departmentApiService
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
StaffApiService
staffApiService
;
//未绑定的clerkCode列表
@RequestMapping
(
"/clerk-code-list"
)
public
HaobanResponse
clerkCodeList
(
String
departmentId
)
{
...
...
@@ -79,8 +84,8 @@ public class ClerkController extends WebBaseController{
}
//成员绑定
@RequestMapping
(
"/staff-bind"
)
public
HaobanResponse
staffBind
(
String
toClerkCode
,
String
fromStaffDepartmentRelatedId
)
{
if
(
StringUtils
.
isAnyBlank
(
toClerkCode
,
fromStaffDepartmentRelatedId
)){
public
HaobanResponse
staffBind
(
String
oldClerkCode
,
String
toClerkCode
,
String
fromStaffDepartmentRelatedId
)
{
if
(
StringUtils
.
isAnyBlank
(
oldClerkCode
,
toClerkCode
,
fromStaffDepartmentRelatedId
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
//将指定人绑定clerkCode
...
...
@@ -89,29 +94,26 @@ public class ClerkController extends WebBaseController{
dto
.
setClerkCode
(
toClerkCode
);
dto
.
setUpdateTime
(
new
Date
());
staffDepartmentRelatedApiService
.
updateById
(
dto
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
//成员换绑定
@RequestMapping
(
"/clerk-unbind"
)
public
HaobanResponse
clerkUnbind
(
String
departmentId
,
String
fromClerkCode
,
String
toClerkCode
)
{
if
(
StringUtils
.
isAnyBlank
(
fromClerkCode
,
toClerkCode
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
//将别人clerkCode置空
StaffDepartmentRelatedDTO
one
=
staffDepartmentRelatedApiService
.
getOneByClerkCodeAndDepartmentId
(
toClerkCode
,
departmentId
);
if
(
one
!=
null
){
//存在,则先置空
one
.
setClerkCode
(
null
);
one
.
setUpdateTime
(
new
Date
());
staffDepartmentRelatedApiService
.
deleteCode
(
one
);
//更新gic数据
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
=
staffDepartmentRelatedApiService
.
getByStaffDepartmentRelatedId
(
fromStaffDepartmentRelatedId
);
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectById
(
staffDepartmentRelatedDTO
.
getDepartmentId
());
String
storeId
=
departmentDTO
.
getRelatedId
();
List
<
String
>
clerkCodes
=
new
ArrayList
<>();
clerkCodes
.
add
(
toClerkCode
);
List
<
ClerkDTO
>
list
=
clerkService
.
listClerk
(
storeId
,
clerkCodes
,
true
);
StaffDTO
staffDTO
=
staffApiService
.
selectById
(
staffDepartmentRelatedDTO
.
getStaffId
());
for
(
ClerkDTO
clerkDTO
:
list
){
clerkDTO
.
setPhoneNumber
(
staffDTO
.
getPhoneNumber
());
clerkDTO
.
setClerkName
(
staffDTO
.
getStaffName
());
clerkService
.
updateClerk
(
clerkDTO
);
}
//
将别人的clerkCode换到自己上面
StaffDepartmentRelatedDTO
two
=
staffDepartmentRelatedApiService
.
getOneByClerkCodeAndDepartmentId
(
fromClerkCode
,
departmentId
);
if
(
two
!=
null
){
//存在,则先置空
two
.
setClerkCode
(
toClerkCode
);
two
.
setUpdateTime
(
new
Date
()
);
staffDepartmentRelatedApiService
.
updateById
(
two
);
//
清空gic原来的手机号
List
<
String
>
oldClerkCodes
=
new
ArrayList
<>(
);
oldClerkCodes
.
add
(
oldClerkCode
);
List
<
ClerkDTO
>
oldList
=
clerkService
.
listClerk
(
storeId
,
oldClerkCodes
,
true
);
for
(
ClerkDTO
clerkDTO
:
oldList
){
clerkDTO
.
setPhoneNumber
(
""
);
clerkService
.
updateClerk
(
clerkDTO
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
...
...
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