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
470071d2
Commit
470071d2
authored
Mar 03, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
bb11f8ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
DepartmentContoller.java
...gic/haoban/manage/web/controller/DepartmentContoller.java
+66
-0
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/DepartmentContoller.java
View file @
470071d2
...
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkListDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.dto.GicTreeDTO
;
import
com.gic.enterprise.api.dto.GicTreeDTO
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.dto.StoreDTO
;
...
@@ -31,8 +33,11 @@ import com.gic.haoban.manage.web.auth.AuthRequestUtil;
...
@@ -31,8 +33,11 @@ import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
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.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
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.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.DepartmentAddQO
;
import
com.gic.haoban.manage.web.qo.DepartmentAddQO
;
import
com.gic.haoban.manage.web.qo.DepartmentEditQO
;
import
com.gic.haoban.manage.web.qo.DepartmentEditQO
;
...
@@ -58,6 +63,11 @@ public class DepartmentContoller extends WebBaseController{
...
@@ -58,6 +63,11 @@ public class DepartmentContoller extends WebBaseController{
@Autowired
@Autowired
private
EnterpriseService
enterpriseService
;
private
EnterpriseService
enterpriseService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@RequestMapping
(
"department-list"
)
@RequestMapping
(
"department-list"
)
public
HaobanResponse
departmentList
(
String
parentId
,
BasePageInfo
pageInfo
,
String
keyWord
)
{
public
HaobanResponse
departmentList
(
String
parentId
,
BasePageInfo
pageInfo
,
String
keyWord
)
{
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getSessionUser
();
...
@@ -270,6 +280,9 @@ public class DepartmentContoller extends WebBaseController{
...
@@ -270,6 +280,9 @@ public class DepartmentContoller extends WebBaseController{
String
sonDepartment
=
departmentAddQO
.
getChildren
();
String
sonDepartment
=
departmentAddQO
.
getChildren
();
handler
(
sonDepartment
,
departmentId
);
handler
(
sonDepartment
,
departmentId
);
if
(
isStore
==
1
){
handerStoreClerk
(
departmentId
,
departmentAddQO
.
getRelatedId
());
}
}
}
}
}
logger
.
info
(
"【部门修改】editDepartment={}"
,
editDepartment
);
logger
.
info
(
"【部门修改】editDepartment={}"
,
editDepartment
);
...
@@ -459,6 +472,10 @@ public class DepartmentContoller extends WebBaseController{
...
@@ -459,6 +472,10 @@ public class DepartmentContoller extends WebBaseController{
continue
;
continue
;
}
}
DepartmentDTO
departmentAdd
=
(
DepartmentDTO
)
hr
.
getResult
();
DepartmentDTO
departmentAdd
=
(
DepartmentDTO
)
hr
.
getResult
();
if
(
isStore
==
1
){
String
storeId
=
departmentAdd
.
getRelatedId
();
handerStoreClerk
(
departmentAdd
.
getDepartmentId
(),
storeId
);
}
sonParentId
=
departmentAdd
.
getDepartmentId
();
sonParentId
=
departmentAdd
.
getDepartmentId
();
//别的部门调整过来的
//别的部门调整过来的
}
else
{
}
else
{
...
@@ -487,5 +504,54 @@ public class DepartmentContoller extends WebBaseController{
...
@@ -487,5 +504,54 @@ public class DepartmentContoller extends WebBaseController{
}
}
}
}
private
void
handerStoreClerk
(
String
departmentId
,
String
storeId
)
{
StoreDTO
store
=
storeService
.
getStore
(
storeId
);
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectById
(
departmentId
);
if
(
departmentDTO
==
null
){
return
;
}
String
wxEnterpriseId
=
departmentDTO
.
getWxEnterpriseId
();
if
(
store
!=
null
){
List
<
ClerkListDTO
>
list
=
clerkService
.
getClerkByStoreId
(
store
.
getEnterpriseId
(),
storeId
);
for
(
ClerkListDTO
clerkListDTO
:
list
)
{
String
nationcode
=
clerkListDTO
.
getNationcode
();
String
phoneNumber
=
clerkListDTO
.
getPhoneNumber
();
String
clerkCode
=
clerkListDTO
.
getClerkCode
();
StaffDTO
staff
=
staffApiService
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
==
null
){
staff
=
new
StaffDTO
();
staff
.
setNationCode
(
nationcode
);
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setBindFlag
(
1
);
staff
.
setClerkCode
(
clerkCode
);
staff
.
setNickName
(
clerkListDTO
.
getClerkName
());
staff
.
setStaffName
(
clerkListDTO
.
getClerkName
());
staff
.
setPostion
(
clerkListDTO
.
getPositionName
());
staff
.
setSyncPostionFlag
(
1
);
staffApiService
.
add
(
staff
,
departmentId
);
}
else
{
String
staffId
=
staff
.
getStaffId
();
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
staffApiService
.
listStaffDepartmentByStaffId
(
staffId
);
String
departmentIds
=
departmentId
;
for
(
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
:
relatedList
)
{
departmentIds
+=
","
+
staffDepartmentRelatedDTO
.
getDepartmentId
();
}
Map
<
String
,
StaffDepartmentRelatedDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
relatedList
,
"departmentId"
);
if
(
map
.
get
(
departmentId
)
==
null
){
staffApiService
.
staffEdit
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
staffApiService
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
//如果这个人是未绑定的 则绑定clerk
if
(
StringUtils
.
isBlank
(
staffRelated
.
getClerkCode
())){
staffRelated
.
setClerkCode
(
clerkCode
);
staffDepartmentRelatedApiService
.
updateById
(
staffRelated
);
}
}
}
}
}
}
}
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