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
QianQiXiang
haoban-manage3.0
Commits
c0e8f8bd
Commit
c0e8f8bd
authored
Apr 15, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步通讯录 新增成员
parent
1a16783d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
2 deletions
+133
-2
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+8
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+125
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
c0e8f8bd
...
@@ -60,4 +60,12 @@ public interface StaffApiService {
...
@@ -60,4 +60,12 @@ public interface StaffApiService {
public
List
<
StaffDTO
>
listByPhoneNumber
(
String
phoneNumber
);
public
List
<
StaffDTO
>
listByPhoneNumber
(
String
phoneNumber
);
public
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
public
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
/**
* 保存gic成员
*
* @param clerkDTO
* @return
*/
public
ServiceResponse
saveSyncStaffByGic
(
GicClerkDTO
clerkDTO
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
c0e8f8bd
...
@@ -828,8 +828,131 @@ public class StaffApiServiceImpl implements StaffApiService {
...
@@ -828,8 +828,131 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
return
list
;
return
list
;
}
}
// private String getMobile(String phoneNumber,String nationcode){
@Override
public
ServiceResponse
saveSyncStaffByGic
(
GicClerkDTO
clerkDTO
)
{
ServiceResponse
response
=
new
ServiceResponse
();
if
(
clerkDTO
==
null
)
{
response
.
setCode
(
0
);
response
.
setMessage
(
"参数错误"
);
return
response
;
}
if
(
StringUtils
.
isBlank
(
clerkDTO
.
getStoreId
()))
{
logger
.
info
(
"【店员同步】gicStoreId为空"
);
response
.
setCode
(
0
);
response
.
setMessage
(
"【店员同步】gicStoreId为空"
);
return
response
;
}
TabHaobanDepartment
department
=
departmentService
.
selectByRelatedId
(
clerkDTO
.
getStoreId
());
if
(
department
==
null
)
{
logger
.
info
(
"【店员同步】失败====department为空:{}"
,
clerkDTO
.
getStoreId
());
response
.
setCode
(
0
);
response
.
setMessage
(
"部门门店不存在"
);
return
response
;
}
String
departmentId
=
department
.
getDepartmentId
();
String
wxEnterpriseId
=
department
.
getWxEnterpriseId
();
// StaffDTO staff = this.selectByNationcodeAndPhoneNumber(wxEnterpriseId, nationcode, phoneNumber);
StaffDTO
staff
=
geCcheckAndInitUser
(
wxEnterpriseId
,
clerkDTO
.
getNationcode
(),
clerkDTO
.
getPhoneNumber
());
if
(
staff
==
null
)
{
if
(
clerkDTO
.
getStatus
()
!=
1
)
{
response
.
setCode
(
0
);
response
.
setMessage
(
"成员当前状态非正常"
+
clerkDTO
.
getStatus
());
return
response
;
}
staff
=
new
StaffDTO
();
staff
.
setWxEnterpriseId
(
wxEnterpriseId
);
staff
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staff
.
setActiveFlag
(
1
);
staff
.
setDepartmentIds
(
departmentId
);
staff
.
setHeadImg
(
clerkDTO
.
getHeadImgUrl
());
staff
.
setNationCode
(
clerkDTO
.
getNationcode
());
staff
.
setPhoneNumber
(
clerkDTO
.
getPhoneNumber
());
staff
.
setPostion
(
clerkDTO
.
getPostionName
());
staff
.
setSex
(
clerkDTO
.
getClerkGender
());
staff
.
setStaffName
(
clerkDTO
.
getClerkName
());
staff
.
setNickName
(
clerkDTO
.
getClerkName
());
staff
.
setSyncPostionFlag
(
1
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
clerkDTO
.
getClerkCode
());
logger
.
info
(
"【gic导购新增】isCodeExist={}"
,
JSON
.
toJSONString
(
isCodeExist
));
//如果这个code已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
ServiceResponse
hr
=
this
.
add
(
staff
,
department
.
getDepartmentId
());
if
(
hr
.
getCode
()
==
1
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
hr
.
getResult
().
toString
());
logger
.
info
(
"【gic导购新增】staffRelated={}"
,
JSON
.
toJSONString
(
staffRelated
));
//绑定
if
(
staffRelated
!=
null
)
{
staffRelated
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
}
else
{
response
.
setCode
(
0
);
response
.
setMessage
(
hr
.
getMessage
());
return
response
;
}
}
else
{
String
staffId
=
staff
.
getStaffId
();
logger
.
info
(
"【员工修改】staff={},status={}"
,
JSON
.
toJSONString
(
staff
),
clerkDTO
.
getStatus
());
//删除
if
(
clerkDTO
.
getStatus
()
==
0
)
{
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
//修改
}
else
{
staff
.
setHeadImg
(
clerkDTO
.
getHeadImgUrl
());
staff
.
setSex
(
clerkDTO
.
getClerkGender
());
//staff.setPostion(postion);
// staff.setStaffName(staffName);
if
(
staff
.
getActiveFlag
()
!=
null
&&
staff
.
getActiveFlag
()
!=
1
)
{
staff
.
setStaffName
(
clerkDTO
.
getClerkName
());
}
List
<
StaffDepartmentRelatedDTO
>
relatedList
=
this
.
listStaffDepartmentByStaffId
(
staffId
);
Map
<
String
,
StaffDepartmentRelatedDTO
>
map
=
com
.
gic
.
commons
.
util
.
CollectionUtil
.
toMap
(
relatedList
,
"departmentId"
);
String
departmentIds
=
""
;
if
(
map
.
get
(
departmentId
)
==
null
)
{
departmentIds
=
departmentId
;
}
for
(
StaffDepartmentRelatedDTO
staffDepartmentRelatedDTO
:
relatedList
)
{
departmentIds
+=
","
+
staffDepartmentRelatedDTO
.
getDepartmentId
();
}
if
(
departmentIds
.
startsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
1
,
departmentIds
.
length
());
}
if
(
map
.
get
(
departmentId
)
==
null
)
{
this
.
staffEdit
(
staff
,
departmentIds
);
}
StaffDepartmentRelatedDTO
staffRelated
=
this
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
StaffDepartmentRelatedDTO
isCodeExist
=
this
.
getDepartmentIdAndCode
(
departmentId
,
clerkDTO
.
getClerkCode
());
//如果这个人已经绑定了 先解绑
if
(
isCodeExist
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
isCodeExist
.
setClerkCode
(
null
);
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
isCodeExist
));
}
//如果这个人是未绑定的 则绑定clerk
if
(
staffRelated
!=
null
)
{
staffRelated
.
setUpdateTime
(
new
Date
());
staffRelated
.
setClerkCode
(
clerkDTO
.
getClerkCode
());
staffDepartmentRelatedMapper
.
updateByPrimaryKey
(
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaffDepartmentRelated
.
class
,
staffRelated
));
}
this
.
staffEdit
(
staff
,
departmentIds
);
}
}
return
response
;
}
// private String getMobile(String phoneNumber,String nationcode){
// String mobile = nationcode + phoneNumber;
// String mobile = nationcode + phoneNumber;
// return mobile;
// return mobile;
// }
// }
...
...
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