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
d177f468
Commit
d177f468
authored
Mar 03, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
37c5bb6a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
151 additions
and
2 deletions
+151
-2
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+151
-2
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
d177f468
...
...
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
...
...
@@ -26,10 +27,12 @@ import com.gic.enterprise.api.service.StoreService;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.common.utils.UuidUtil
;
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.dto.SyncJsonColumnDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
...
...
@@ -414,8 +417,154 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public
void
syncGicClerk
(
String
fieldListString
)
{
// TODO Auto-generated method stub
logger
.
info
(
"【同步店员】fieldList={}"
,
fieldListString
);
List
<
SyncJsonColumnDTO
>
fieldList
=
JSONArray
.
parseArray
(
fieldListString
,
SyncJsonColumnDTO
.
class
);
if
(
fieldList
.
isEmpty
()){
return
;
}
String
gicEnterpriseId
=
""
;
String
gicStoreId
=
""
;
String
gicClerkId
=
""
;
String
code
=
""
;
String
staffName
=
""
;
String
phoneNumber
=
""
;
String
nationcode
=
""
;
Integer
sex
=
null
;
String
headPic
=
""
;
Integer
status
=
null
;
String
postion
=
""
;
for
(
SyncJsonColumnDTO
syncJsonColumnDTO:
fieldList
){
String
name
=
StringUtil
.
camelName
(
syncJsonColumnDTO
.
getName
());
String
value
=
syncJsonColumnDTO
.
getValue
();
if
(
"clerkId"
.
equals
(
name
)){
gicClerkId
=
value
;
continue
;
}
if
(
"enterpriseId"
.
equals
(
name
)){
gicEnterpriseId
=
value
;
continue
;
}
if
(
"storeId"
.
equals
(
name
)){
gicStoreId
=
value
;
if
(
StringUtils
.
isBlank
(
gicStoreId
)){
return
;
}
continue
;
}
if
(
"clerkName"
.
equals
(
name
)){
staffName
=
value
;
continue
;
}
if
(
"clerkCode"
.
equals
(
name
)){
code
=
value
;
continue
;
}
if
(
"clerkGender"
.
equals
(
name
)){
sex
=
value
==
null
?
null
:
Integer
.
parseInt
(
value
);
continue
;
}
if
(
"status"
.
equals
(
name
)){
status
=
value
==
null
?
null
:
Integer
.
parseInt
(
value
);
continue
;
}
if
(
"headImgUrl"
.
equals
(
name
)){
headPic
=
value
;
continue
;
}
if
(
"postionName"
.
equals
(
postion
)){
postion
=
value
;
continue
;
}
if
(
"nationcode"
.
equals
(
name
)){
if
(
StringUtils
.
isBlank
(
value
)){
nationcode
=
"86"
;
}
else
{
nationcode
=
value
;
}
continue
;
}
}
if
(
StringUtils
.
isBlank
(
gicStoreId
)){
logger
.
info
(
"【店员同步】gicStoreId为空"
);
return
;
}
TabHaobanDepartment
department
=
departmentService
.
selectByRelatedId
(
gicStoreId
);
if
(
department
==
null
){
logger
.
info
(
"【店员同步】gicStoreId为空"
);
return
;
}
String
departmentId
=
department
.
getDepartmentId
();
String
wxEnterpriseId
=
department
.
getWxEnterpriseId
();
StaffDTO
staff
=
this
.
selectByNationcodeAndPhoneNumber
(
wxEnterpriseId
,
nationcode
,
phoneNumber
);
if
(
staff
==
null
){
if
(
status
!=
1
){
return
;
}
else
{
staff
=
new
StaffDTO
();
staff
.
setWxEnterpriseId
(
wxEnterpriseId
);
staff
.
setClerkCode
(
code
);
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setHeadImg
(
headPic
);
staff
.
setNationCode
(
nationcode
);
staff
.
setPhoneNumber
(
phoneNumber
);
staff
.
setNickName
(
staffName
);
staff
.
setPostion
(
postion
);
staff
.
setSex
(
sex
);
staff
.
setStaffName
(
staffName
);
staff
.
setSyncPostionFlag
(
1
);
HaobanResponse
hr
=
this
.
add
(
staff
,
department
.
getDepartmentId
());
if
(
hr
.
getErrorCode
()
==
1
){
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
hr
.
getResult
().
toString
());
if
(
staffRelated
!=
null
){
staffRelated
.
setClerkCode
(
code
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
}
}
}
else
{
String
staffId
=
staff
.
getStaffId
();
//删除
if
(
status
==
0
){
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
if
(
staffRelated
!=
null
){
staffRelated
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
//修改
}
else
{
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
this
.
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
){
this
.
staffEdit
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
//如果这个人是未绑定的 则绑定clerk
if
(
StringUtils
.
isBlank
(
staffRelated
.
getClerkCode
())){
staffRelated
.
setClerkCode
(
code
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
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