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
6a0c704c
Commit
6a0c704c
authored
Feb 22, 2022
by
xugaojun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-20220222' of
http://git.gicdev.com/haoban3.0/haoban-manage3.0
parents
b752fd0f
a50001c0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
6 deletions
+88
-6
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+8
-0
StaffService.java
...a/com/gic/haoban/manage/service/service/StaffService.java
+11
-0
StaffServiceImpl.java
.../haoban/manage/service/service/impl/StaffServiceImpl.java
+35
-3
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+31
-1
WxEnterpriseInfoController.java
...ban/manage/web/controller/WxEnterpriseInfoController.java
+2
-1
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+1
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
6a0c704c
...
...
@@ -56,6 +56,14 @@ public interface StaffApiService {
*/
StaffDTO
selectByUserIdAndEnterpriseId
(
String
userId
,
String
wxEnterpriseId
);
/**
* 没手机号的时候需要重新刷
* @param userId
* @param wxEnterpriseId
* @return
*/
StaffDTO
getByUserIdAndReflushWhenNoPhone
(
String
userId
,
String
wxEnterpriseId
);
StaffDepartmentRelatedDTO
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
);
int
countByDepartmentId
(
String
departmentId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffService.java
View file @
6a0c704c
...
...
@@ -44,6 +44,17 @@ public interface StaffService {
*/
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
selectByPhoneNumberOrUserIdAndEnterpriseId
(
String
phoneNumber
,
String
userId
,
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 @
6a0c704c
...
...
@@ -6,17 +6,18 @@ 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
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.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
StaffServiceImpl
implements
StaffService
{
...
...
@@ -27,6 +28,9 @@ public class StaffServiceImpl implements StaffService {
@Autowired
private
MemberUnionRelatedService
memberUnionRelatedService
;
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
@Override
public
TabHaobanStaff
selectById
(
String
id
)
{
return
mapper
.
selectByPrimaryKey
(
id
);
...
...
@@ -72,6 +76,34 @@ public class StaffServiceImpl implements StaffService {
}
@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
);
}
}
return
null
;
}
@Override
public
void
updateByPrimaryKey
(
TabHaobanStaff
tab
)
{
tab
.
setUpdateTime
(
new
Date
());
mapper
.
updateByPrimaryKeySelective
(
tab
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
6a0c704c
...
...
@@ -389,7 +389,7 @@ public class StaffApiServiceImpl implements StaffApiService {
String
[]
arr
=
getNationCodeAndPhoneNumber
(
mobile
);
String
nationCode
=
arr
[
0
];
String
phoneNumber
=
arr
[
1
];
TabHaobanStaff
staff
=
staffService
.
selectByPhoneNumber
AndEnterpriseId
(
phoneNumber
,
wxEnterpriseId
);
TabHaobanStaff
staff
=
staffService
.
selectByPhoneNumber
OrUserIdAndEnterpriseId
(
phoneNumber
,
userId
,
wxEnterpriseId
);
if
(
staff
!=
null
)
{
staffService
.
delOtherStaffByWxUserId
(
staff
.
getWxUserId
(),
staff
.
getStaffId
(),
wxEnterpriseId
);
}
...
...
@@ -893,6 +893,36 @@ 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
;
}
if
(
StringUtils
.
isBlank
(
staffDTO
.
getPhoneNumber
()))
{
this
.
wxGetAdd
(
userId
,
wxEnterpriseId
);
return
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
));
}
//todo 历史数据 相同的id需要删除 后续这个逻辑可以删除
//存在多条
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
;
}
@Override
public
StaffDepartmentRelatedDTO
getDepartmentIdAndStaffId
(
String
departmentId
,
String
staffId
)
{
TabHaobanStaffDepartmentRelated
tab
=
staffDepartmentRelatedService
.
getDepartmentIdAndStaffId
(
departmentId
,
staffId
);
return
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
tab
);
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseInfoController.java
View file @
6a0c704c
...
...
@@ -110,8 +110,9 @@ public class WxEnterpriseInfoController extends WebBaseController {
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
corpId
);
StaffDTO
loginStaff
=
null
;
if
(
enterprise
!=
null
)
{
loginStaff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
userId
,
enterprise
.
getWxEnterpriseId
());
loginStaff
=
staffApiService
.
getByUserIdAndReflushWhenNoPhone
(
userId
,
enterprise
.
getWxEnterpriseId
());
}
//手机号不存在
if
(
loginStaff
==
null
)
{
if
(
enterprise
!=
null
)
{
staffApiService
.
wxGetAdd
(
userId
,
enterprise
.
getWxEnterpriseId
());
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
6a0c704c
...
...
@@ -190,7 +190,7 @@ public enum HaoBanErrCode {
ERR_500001
(
500001
,
"该企业没关联好办"
),
ERR_500003
(
500003
,
"企业corpid不对应,需要重新登录传code"
),
ERR_600001
(
600001
,
"成员不存在,请联系管理员后台授权通讯录权限"
),
ERR_600002
(
600002
,
"成员
无手机号,请在企业微信绑定手机号
"
),
ERR_600002
(
600002
,
"成员
验证失败,请先确认成员企微后台是否绑定手机号,如已绑定,请退出重新授权登录
"
),
ERR_600003
(
600003
,
"未获取成员openid"
),
ERR_10004
(
10004
,
"成员名称不能为空"
),
...
...
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