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
2f4550d9
Commit
2f4550d9
authored
Aug 15, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通讯录
parent
c37b3f5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
91 deletions
+22
-91
StaffService.java
...a/com/gic/haoban/manage/service/service/StaffService.java
+1
-19
StaffServiceImpl.java
.../haoban/manage/service/service/impl/StaffServiceImpl.java
+13
-46
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+8
-26
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffService.java
View file @
2f4550d9
...
...
@@ -34,28 +34,10 @@ public interface StaffService {
*/
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
String
userId
,
String
wxEnterpriseId
);
/**
* 选择电话号码和企业标识
*
* @param phoneNumber 电话号码
* @param wxEnterpriseId wx企业标识
* @return {@link TabHaobanStaff }
* @author mozhu
* @date 2022-01-12 17:19:28
*/
TabHaobanStaff
selectByPhoneNumberAndEnterpriseId
(
String
phoneNumber
,
String
wxEnterpriseId
);
/**
* 选择userId跟手机号查询数据 userid优先级高
*
* @param phoneNumber 电话号码
* @param wxEnterpriseId wx企业标识
* @return {@link TabHaobanStaff }
* @author mozhu
* @date 2022-01-12 17:19:28
*/
TabHaobanStaff
selectBy
PhoneNumberOrUserIdAndEnterpriseId
(
String
phoneNumber
,
String
userId
,
String
wxEnterpriseId
);
TabHaobanStaff
selectBy
UserIdAndEnterpriseId
(
String
wxuserId
,
String
wxOpenUserId
,
String
wxEnterpriseId
);
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffServiceImpl.java
View file @
2f4550d9
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
...
...
@@ -9,23 +16,10 @@ import com.gic.haoban.manage.api.dto.StaffDTO;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
public
class
StaffServiceImpl
implements
StaffService
{
...
...
@@ -35,10 +29,6 @@ public class StaffServiceImpl implements StaffService {
private
StaffMapper
mapper
;
@Autowired
private
MemberUnionRelatedService
memberUnionRelatedService
;
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
@Override
public
TabHaobanStaff
selectById
(
String
id
)
{
if
(
StringUtils
.
isBlank
(
id
))
{
...
...
@@ -80,39 +70,16 @@ public class StaffServiceImpl implements StaffService {
}
@Override
public
TabHaobanStaff
selectByPhoneNumberAndEnterpriseId
(
String
phoneNumber
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isBlank
(
phoneNumber
))
{
public
TabHaobanStaff
selectByUserIdAndEnterpriseId
(
String
wxUserId
,
String
wxOpenUserId
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isBlank
(
wxUserId
))
{
log
.
info
(
"wxUserId is null"
);
return
null
;
}
return
mapper
.
selectByPhoneNumberAndEnterpriseId
(
phoneNumber
,
wxEnterpriseId
);
}
@Override
public
TabHaobanStaff
selectByPhoneNumberOrUserIdAndEnterpriseId
(
String
phoneNumber
,
String
userId
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
return
null
;
}
//存在多条
List
<
String
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
List
<
TabHaobanStaff
>
staffs
=
mapper
.
listByUserIdsAndWxEnterpriseId
(
userIds
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffs
))
{
return
this
.
selectByPhoneNumberAndEnterpriseId
(
phoneNumber
,
wxEnterpriseId
);
}
if
(
staffs
.
size
()==
1
)
{
return
staffs
.
get
(
0
);
//需要去除多余的
}
else
if
(
staffs
.
size
()>
1
)
{
Map
<
String
,
TabHaobanStaff
>
staffMap
=
staffs
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getStaffId
(),
dto
->
dto
,(
o
,
n
)->
n
));
List
<
String
>
relationStaffIds
=
staffClerkRelationService
.
listRelationsStaffId
(
staffMap
.
keySet
());
if
(
CollectionUtils
.
isNotEmpty
(
relationStaffIds
))
{
return
staffMap
.
get
(
relationStaffIds
.
get
(
0
));
}
else
{
return
staffs
.
get
(
0
);
}
TabHaobanStaff
staff
=
this
.
mapper
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
)
;
if
(
null
==
staff
&&
null
!=
wxOpenUserId
&&
!
wxUserId
.
equals
(
wxOpenUserId
))
{
return
this
.
mapper
.
selectByUserIdAndEnterpriseId
(
wxOpenUserId
,
wxEnterpriseId
)
;
}
return
null
;
}
@Override
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
2f4550d9
...
...
@@ -55,7 +55,6 @@ import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
...
...
@@ -190,11 +189,11 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public
ServiceResponse
getWxSaveNew
(
String
u
serId
,
String
wxEnterpriseId
)
{
public
ServiceResponse
getWxSaveNew
(
String
wxU
serId
,
String
wxEnterpriseId
)
{
ServiceResponse
res
=
new
ServiceResponse
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
if
(
null
==
qwDTO
)
{
logger
.
info
(
"企业不存在:{}:{}"
,
wxEnterpriseId
,
u
serId
);
logger
.
info
(
"企业不存在:{}:{}"
,
wxEnterpriseId
,
wxU
serId
);
res
.
setMessage
(
"企业不存在"
);
res
.
setCode
(
2
);
return
res
;
...
...
@@ -209,7 +208,7 @@ public class StaffApiServiceImpl implements StaffApiService {
}
UserDTO
user
=
null
;
if
(
qwDTO
.
getWxSecurityType
()==
4
)
{
user
=
qywxUserApiService
.
getWorkWxUser
(
corpid
,
config
.
getWxSuiteid
(),
u
serId
);
user
=
qywxUserApiService
.
getWorkWxUser
(
corpid
,
config
.
getWxSuiteid
(),
wxU
serId
);
logger
.
info
(
"成员详情(第三方)={}"
,
JSON
.
toJSONString
(
user
))
;
UserDTO
userSelf
=
qywxUserApiService
.
getSelfWorkWxUser
(
qwDTO
.
getDkCorpid
(),
secretSetting
.
getSecretVal
(),
user
.
getOpen_userid
());
logger
.
info
(
"成员详情(代开)={}"
,
JSON
.
toJSONString
(
user
))
;
...
...
@@ -218,11 +217,11 @@ public class StaffApiServiceImpl implements StaffApiService {
user
.
setPosition
(
userSelf
.
getPosition
());
}
}
else
{
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
corpid
,
secretSetting
.
getSecretVal
(),
u
serId
);
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
corpid
,
secretSetting
.
getSecretVal
(),
wxU
serId
);
logger
.
info
(
"成员详情(代开)={}"
,
JSON
.
toJSONString
(
user
))
;
}
if
(
null
==
user
)
{
logger
.
info
(
"企业微信用户不存在:{}:{}"
,
wxEnterpriseId
,
u
serId
);
logger
.
info
(
"企业微信用户不存在:{}:{}"
,
wxEnterpriseId
,
wxU
serId
);
res
.
setMessage
(
"企业微信用户不存在"
);
res
.
setCode
(
3
);
return
res
;
...
...
@@ -236,13 +235,13 @@ public class StaffApiServiceImpl implements StaffApiService {
nationCode
=
arr
[
0
];
phoneNumber
=
arr
[
1
];
}
TabHaobanStaff
staff
=
staffService
.
selectByPhoneNumberOrUserIdAndEnterpriseId
(
phoneNumber
,
userId
,
wxEnterpriseId
);
String
openUserid
=
getOpenUserid
(
wxUserId
,
corpid
,
qwDTO
);
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
openUserid
,
wxEnterpriseId
);
if
(
staff
!=
null
)
{
staffService
.
delOtherStaffByWxUserId
(
staff
.
getWxUserId
(),
staff
.
getStaffId
(),
wxEnterpriseId
);
}
staff
=
(
staff
==
null
?
new
TabHaobanStaff
()
:
staff
);
staff
.
setWxUserId
(
userId
);
String
openUserid
=
getOpenUserid
(
userId
,
corpid
,
qwDTO
);
staff
.
setWxUserId
(
wxUserId
);
if
(
StringUtils
.
isNotBlank
(
openUserid
))
{
staff
.
setWxOpenUseId
(
openUserid
);
}
...
...
@@ -559,23 +558,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public
StaffDTO
getByUserIdAndReflushWhenNoPhone
(
String
userId
,
String
wxEnterpriseId
)
{
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
));
if
(
staffDTO
==
null
)
{
return
null
;
}
//存在多条
List
<
String
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
List
<
TabHaobanStaff
>
staffs
=
staffMapper
.
listByUserIdsAndWxEnterpriseId
(
userIds
,
wxEnterpriseId
);
//需要去除多余的
if
(
CollectionUtils
.
isNotEmpty
(
staffs
)
&&
staffs
.
size
()
>
1
)
{
Map
<
String
,
TabHaobanStaff
>
staffMap
=
staffs
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getStaffId
(),
dto
->
dto
,
(
o
,
n
)
->
n
));
List
<
String
>
relationStaffIds
=
staffClerkRelationService
.
listRelationsStaffId
(
staffMap
.
keySet
());
if
(
CollectionUtils
.
isNotEmpty
(
relationStaffIds
))
{
TabHaobanStaff
staff
=
staffMap
.
get
(
relationStaffIds
.
get
(
0
));
staffService
.
delOtherStaffByWxUserId
(
staff
.
getWxUserId
(),
staff
.
getStaffId
(),
wxEnterpriseId
);
}
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
));
}
return
staffDTO
;
}
...
...
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