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
88e33b83
Commit
88e33b83
authored
Oct 26, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!342
parents
f7d1696f
29706a0b
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
233 additions
and
106 deletions
+233
-106
CommonMQDTO.java
.../main/java/com/gic/haoban/manage/api/dto/CommonMQDTO.java
+1
-1
ExternalClerkRelatedApiService.java
...an/manage/api/service/ExternalClerkRelatedApiService.java
+2
-0
HaobanCommonMQApiService.java
...c/haoban/manage/api/service/HaobanCommonMQApiService.java
+2
-0
TabHaobanExternalClerkRelatedMapper.java
...rvice/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
+5
-2
StaffDepartmentRelatedService.java
...manage/service/service/StaffDepartmentRelatedService.java
+1
-1
StaffDepartmentRelatedServiceImpl.java
...rvice/service/impl/StaffDepartmentRelatedServiceImpl.java
+78
-64
ExternalClerkRelatedApiServiceImpl.java
.../service/out/impl/ExternalClerkRelatedApiServiceImpl.java
+45
-13
HaobanCommonMQApiServiceImpl.java
...ervice/service/out/impl/HaobanCommonMQApiServiceImpl.java
+26
-2
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+56
-15
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+1
-1
QywxStaffSyncOperation.java
...ic/haoban/manage/service/task/QywxStaffSyncOperation.java
+0
-7
TabHaobanExternalClerkRelatedMapper.xml
.../resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
+16
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/CommonMQDTO.java
View file @
88e33b83
...
...
@@ -8,7 +8,7 @@ public class CommonMQDTO implements Serializable {
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private
static
final
long
serialVersionUID
=
-
5681421708810402425L
;
// 1删除日报定时 2无部门成员修复
private
int
type
;
private
Object
params
;
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/ExternalClerkRelatedApiService.java
View file @
88e33b83
...
...
@@ -178,6 +178,8 @@ public interface ExternalClerkRelatedApiService {
* @date 2021-09-13 16:52:31
*/
void
delByMemberIdAndEnterpriseId
(
String
memberId
,
String
enterpriseId
,
String
mergeMemberId
);
// 0 删除会员 1合并会员 2会员换绑
void
delByMemberIdAndEnterpriseId
(
String
memberId
,
String
enterpriseId
,
String
mergeMemberId
,
int
type
);
/**
* 导购和会员是否好友关系,true是好友
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/HaobanCommonMQApiService.java
View file @
88e33b83
...
...
@@ -13,6 +13,8 @@ import com.gic.haoban.manage.api.dto.CommonMQDTO;
public
interface
HaobanCommonMQApiService
{
public
void
putCommonMessage
(
CommonMQDTO
dto
);
public
void
putCommonDelayMessage
(
CommonMQDTO
dto
,
int
delay
);
public
void
commonHandler
(
String
message
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
View file @
88e33b83
...
...
@@ -353,8 +353,11 @@ public interface TabHaobanExternalClerkRelatedMapper {
* @author mozhu
* @date 2022-04-21 10:06:21
*/
int
countByMemberId
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
int
countByMemberId
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
List
<
String
>
getIdList
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
)
;
void
updateMemberByIdList
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"list"
)
List
<
String
>
idList
)
;
List
<
TabHaobanExternalClerkRelated
>
listPageByWxenterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"startItem"
)
int
startItem
,
@Param
(
"pageSize"
)
int
pageSize
,
@Param
(
"type"
)
int
type
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffDepartmentRelatedService.java
View file @
88e33b83
...
...
@@ -44,6 +44,6 @@ public interface StaffDepartmentRelatedService {
*/
public
void
repairAllStaffDepart
(
String
params
)
;
public
void
repairStaffDepart
(
String
staffId
)
;
public
void
staffDepartChange
(
TabHaobanStaff
staff
,
String
wxEnterpriseId
,
Integer
[]
departmentIds
)
;
public
void
staffDepartChange
(
TabHaobanStaff
staff
,
String
wxEnterpriseId
,
Integer
[]
departmentIds
,
boolean
retryFlag
)
;
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffDepartmentRelatedServiceImpl.java
View file @
88e33b83
...
...
@@ -21,11 +21,13 @@ import com.gic.commons.util.DateUtil;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.HaobanCommonMQApiService
;
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.TabHaobanStaff
;
...
...
@@ -54,6 +56,8 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
DepartmentService
departmentService
;
@Autowired
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
@Override
public
List
<
TabHaobanStaffDepartmentRelated
>
listByDepartmentId
(
String
departmentId
)
{
...
...
@@ -141,6 +145,7 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
@Override
public
void
repairStaffDepart
(
String
staffId
)
{
logger
.
info
(
"修复无部门成员,staffId={}"
,
staffId
);
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
...
...
@@ -156,75 +161,84 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
qwDTO
.
getDkCorpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
logger
.
info
(
"成员详情(代开)={}"
,
JSON
.
toJSONString
(
user
))
;
if
(
null
!=
user
.
getDepartment
())
{
this
.
staffDepartChange
(
staff
,
wxEnterpriseId
,
user
.
getDepartment
());
;
this
.
staffDepartChange
(
staff
,
wxEnterpriseId
,
user
.
getDepartment
()
,
false
);
;
}
}
}
public
void
staffDepartChange
(
TabHaobanStaff
staff
,
String
wxEnterpriseId
,
Integer
[]
departmentIds
)
{
//更新部门
List
<
String
>
wxDepartIds
=
new
ArrayList
<>();
for
(
Integer
wDId
:
departmentIds
)
{
wxDepartIds
.
add
(
wDId
.
toString
());
}
//关联部门
List
<
DepartmentDTO
>
departmentDTOList
=
departmentService
.
listDepartmentByWxDepartIds
(
wxEnterpriseId
,
wxDepartIds
);
if
(
CollectionUtils
.
isEmpty
(
departmentDTOList
))
{
logger
.
info
(
"部门没有更新或同步:{}"
,
wxEnterpriseId
);
return
;
}
//已存在部门
List
<
TabHaobanStaffDepartmentRelated
>
hasRelation
=
this
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
Map
<
String
,
TabHaobanStaffDepartmentRelated
>
hasRelationMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
hasRelation
))
{
hasRelationMap
=
hasRelation
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaffDepartmentRelated:
:
getDepartmentId
,
tab
->
tab
));
}
public
void
staffDepartChange
(
TabHaobanStaff
staff
,
String
wxEnterpriseId
,
Integer
[]
departmentIds
,
boolean
retryFlag
)
{
//更新部门
List
<
String
>
wxDepartIds
=
new
ArrayList
<>();
for
(
Integer
wDId
:
departmentIds
)
{
wxDepartIds
.
add
(
wDId
.
toString
());
}
if
(
CollectionUtils
.
isEmpty
(
wxDepartIds
))
{
return
;
}
//关联部门
List
<
DepartmentDTO
>
departmentDTOList
=
departmentService
.
listDepartmentByWxDepartIds
(
wxEnterpriseId
,
wxDepartIds
);
if
(
CollectionUtils
.
isEmpty
(
departmentDTOList
))
{
logger
.
info
(
"部门没有更新或同步:{}"
,
wxEnterpriseId
);
if
(
retryFlag
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>()
;
map
.
put
(
"staffId"
,
staff
.
getStaffId
())
;
CommonMQDTO
dto
=
new
CommonMQDTO
();
dto
.
setType
(
2
);
dto
.
setParams
(
map
);
this
.
haobanCommonMQApiService
.
putCommonDelayMessage
(
dto
,
60
);
}
return
;
}
//新增操作
for
(
DepartmentDTO
departmentDTO
:
departmentDTOList
)
{
if
(!
hasRelationMap
.
containsKey
(
departmentDTO
.
getDepartmentId
()))
{
StaffDepartmentRelatedDTO
dto
=
new
StaffDepartmentRelatedDTO
();
dto
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
dto
.
setStaffId
(
staff
.
getStaffId
());
dto
.
setStaffName
(
staff
.
getStaffName
());
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setStatusFlag
(
1
);
dto
.
setDepartmentId
(
departmentDTO
.
getDepartmentId
());
dto
.
setNationCode
(
staff
.
getNationCode
());
this
.
add
(
dto
);
}
}
//删除操作
Set
<
String
>
newDepartIds
=
departmentDTOList
.
stream
().
map
(
DepartmentDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
hasDepartIds
=
hasRelationMap
.
keySet
();
Sets
.
SetView
<
String
>
delDepartIds
=
Sets
.
difference
(
hasDepartIds
,
newDepartIds
);
Sets
.
SetView
<
String
>
updateDepartIds
=
Sets
.
intersection
(
newDepartIds
,
hasDepartIds
);
//交集
logger
.
info
(
"删除部门:{}"
,
JSONObject
.
toJSONString
(
delDepartIds
));
if
(
CollectionUtils
.
isNotEmpty
(
delDepartIds
))
{
for
(
String
delDepartId
:
delDepartIds
)
{
TabHaobanStaffDepartmentRelated
departmentRelated
=
hasRelationMap
.
get
(
delDepartId
);
if
(
null
!=
departmentRelated
)
{
StaffDepartmentRelatedDTO
relatedDTO
=
new
StaffDepartmentRelatedDTO
();
relatedDTO
.
setStaffDepartmentRelatedId
(
departmentRelated
.
getStaffDepartmentRelatedId
());
this
.
del
(
relatedDTO
);
}
}
}
//已存在部门
List
<
TabHaobanStaffDepartmentRelated
>
hasRelation
=
this
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
Map
<
String
,
TabHaobanStaffDepartmentRelated
>
hasRelationMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
hasRelation
))
{
hasRelationMap
=
hasRelation
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaffDepartmentRelated:
:
getDepartmentId
,
tab
->
tab
));
}
if
(
CollectionUtils
.
isNotEmpty
(
updateDepartIds
))
{
for
(
String
updateDeId
:
updateDepartIds
)
{
TabHaobanStaffDepartmentRelated
departmentRelated
=
hasRelationMap
.
get
(
updateDeId
);
if
(
null
!=
departmentRelated
)
{
departmentRelated
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
departmentRelated
.
setStaffName
(
staff
.
getStaffName
());
departmentRelated
.
setNationCode
(
staff
.
getNationCode
());
departmentRelated
.
setUpdateTime
(
new
Date
());
this
.
update
(
departmentRelated
);
}
}
}
}
//新增操作
for
(
DepartmentDTO
departmentDTO
:
departmentDTOList
)
{
if
(!
hasRelationMap
.
containsKey
(
departmentDTO
.
getDepartmentId
()))
{
StaffDepartmentRelatedDTO
dto
=
new
StaffDepartmentRelatedDTO
();
dto
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
dto
.
setStaffId
(
staff
.
getStaffId
());
dto
.
setStaffName
(
staff
.
getStaffName
());
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setStatusFlag
(
1
);
dto
.
setDepartmentId
(
departmentDTO
.
getDepartmentId
());
dto
.
setNationCode
(
staff
.
getNationCode
());
this
.
add
(
dto
);
}
}
//删除操作
Set
<
String
>
newDepartIds
=
departmentDTOList
.
stream
().
map
(
DepartmentDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
hasDepartIds
=
hasRelationMap
.
keySet
();
Sets
.
SetView
<
String
>
delDepartIds
=
Sets
.
difference
(
hasDepartIds
,
newDepartIds
);
Sets
.
SetView
<
String
>
updateDepartIds
=
Sets
.
intersection
(
newDepartIds
,
hasDepartIds
);
//交集
logger
.
info
(
"删除部门:{}"
,
JSONObject
.
toJSONString
(
delDepartIds
));
if
(
CollectionUtils
.
isNotEmpty
(
delDepartIds
))
{
for
(
String
delDepartId
:
delDepartIds
)
{
TabHaobanStaffDepartmentRelated
departmentRelated
=
hasRelationMap
.
get
(
delDepartId
);
if
(
null
!=
departmentRelated
)
{
StaffDepartmentRelatedDTO
relatedDTO
=
new
StaffDepartmentRelatedDTO
();
relatedDTO
.
setStaffDepartmentRelatedId
(
departmentRelated
.
getStaffDepartmentRelatedId
());
this
.
del
(
relatedDTO
);
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
updateDepartIds
))
{
for
(
String
updateDeId
:
updateDepartIds
)
{
TabHaobanStaffDepartmentRelated
departmentRelated
=
hasRelationMap
.
get
(
updateDeId
);
if
(
null
!=
departmentRelated
)
{
departmentRelated
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
departmentRelated
.
setStaffName
(
staff
.
getStaffName
());
departmentRelated
.
setNationCode
(
staff
.
getNationCode
());
departmentRelated
.
setUpdateTime
(
new
Date
());
this
.
update
(
departmentRelated
);
}
}
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/ExternalClerkRelatedApiServiceImpl.java
View file @
88e33b83
...
...
@@ -387,24 +387,56 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
return
tabHaobanExternalClerkRelatedMapper
.
listStoreIdByMemberId
(
memberId
);
}
@Override
public
void
delByMemberIdAndEnterpriseId
(
String
memberId
,
String
enterpriseId
,
String
mergeMemberId
,
int
type
)
{
// 0 删除会员 1合并会员 2会员换绑
if
(
type
==
0
)
{
log
.
info
(
"删除会员,memberId:{}"
,
memberId
);
this
.
tabHaobanExternalClerkRelatedMapper
.
updateStatusByMemberId
(
memberId
,
enterpriseId
);
}
else
if
(
type
==
1
)
{
//合并会员
log
.
info
(
"合并会员,memberId:{},新memberId={}"
,
memberId
,
mergeMemberId
);
int
i
=
this
.
tabHaobanExternalClerkRelatedMapper
.
countByMemberId
(
memberId
,
enterpriseId
);
if
(
i
>
0
)
{
this
.
tabHaobanExternalClerkRelatedMapper
.
updateMemberIdByMemberId
(
mergeMemberId
,
memberId
,
enterpriseId
);
log
.
info
(
"会员合并 ,更新为企微好友,新memberId:{}"
,
mergeMemberId
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
mergeMemberId
,
1
);
}
}
else
if
(
type
==
2
)
{
int
m1
=
this
.
tabHaobanExternalClerkRelatedMapper
.
countByMemberId
(
memberId
,
enterpriseId
)
;
int
m2
=
this
.
tabHaobanExternalClerkRelatedMapper
.
countByMemberId
(
mergeMemberId
,
enterpriseId
)
;
log
.
info
(
"合并换绑,m1={},好友数={}, m2={},好友数={}"
,
memberId
,
m1
,
mergeMemberId
,
m2
);
if
(
m1
==
0
&&
m2
==
0
)
{
log
.
info
(
"都是非企微好友"
);
}
else
if
(
m1
==
0
&&
m2
>
0
)
{
this
.
tabHaobanExternalClerkRelatedMapper
.
updateMemberIdByMemberId
(
memberId
,
mergeMemberId
,
enterpriseId
);
log
.
info
(
"会员换绑 ,更新为企微好友,新memberId:{}"
,
memberId
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
memberId
,
1
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
mergeMemberId
,
0
);
}
else
if
(
m1
>
0
&&
m2
==
0
)
{
this
.
tabHaobanExternalClerkRelatedMapper
.
updateMemberIdByMemberId
(
mergeMemberId
,
memberId
,
enterpriseId
);
log
.
info
(
"会员换绑 ,更新为企微好友,新memberId:{}"
,
mergeMemberId
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
mergeMemberId
,
1
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
memberId
,
0
);
}
else
if
(
m1
>
0
&&
m2
>
0
)
{
List
<
String
>
m1IdList
=
this
.
tabHaobanExternalClerkRelatedMapper
.
getIdList
(
memberId
,
enterpriseId
)
;
List
<
String
>
m2IdList
=
this
.
tabHaobanExternalClerkRelatedMapper
.
getIdList
(
mergeMemberId
,
enterpriseId
)
;
this
.
tabHaobanExternalClerkRelatedMapper
.
updateMemberByIdList
(
mergeMemberId
,
m1IdList
);
this
.
tabHaobanExternalClerkRelatedMapper
.
updateMemberByIdList
(
memberId
,
m2IdList
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
memberId
,
1
);
this
.
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
mergeMemberId
,
1
);
}
}
}
@Override
public
void
delByMemberIdAndEnterpriseId
(
String
memberId
,
String
enterpriseId
,
String
mergeMemberId
)
{
log
.
info
(
"删除会员或者合并会员,memberId:{},enterpriseId:{},mergeMemberId:{}"
,
memberId
,
enterpriseId
,
mergeMemberId
);
if
(
StringUtils
.
isBlank
(
mergeMemberId
))
{
log
.
info
(
"删除会员,memberId:{}"
,
memberId
);
//删除会员
tabHaobanExternalClerkRelatedMapper
.
updateStatusByMemberId
(
memberId
,
enterpriseId
);
this
.
delByMemberIdAndEnterpriseId
(
memberId
,
enterpriseId
,
mergeMemberId
,
0
);
}
else
{
//合并会员
log
.
info
(
"合并会员,memberId:{}"
,
memberId
);
tabHaobanExternalClerkRelatedMapper
.
updateMemberIdByMemberId
(
mergeMemberId
,
memberId
,
enterpriseId
);
int
i
=
tabHaobanExternalClerkRelatedMapper
.
countByMemberId
(
mergeMemberId
,
enterpriseId
);
if
(
i
>
0
)
{
//回调给会员,更新是否为企微好友
log
.
info
(
"会员合并,有企微好友,通知会员,合并会员后更新为企微好友,memberId:{},mergeMemberId:{}"
,
memberId
,
mergeMemberId
);
memberApiService
.
updateMemberQywxFlag
(
enterpriseId
,
mergeMemberId
,
1
);
}
this
.
delByMemberIdAndEnterpriseId
(
memberId
,
enterpriseId
,
mergeMemberId
,
1
);
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/HaobanCommonMQApiServiceImpl.java
View file @
88e33b83
...
...
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
import
com.gic.haoban.manage.api.service.HaobanCommonMQApiService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.quartz.api.dto.QuartzTaskDTO
;
import
com.gic.quartz.api.service.QuartzService
;
...
...
@@ -26,6 +27,8 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
@Autowired
private
QuartzService
quartzService
;
@Autowired
private
StaffDepartmentRelatedService
staffDepartmentRelatedService
;
@Override
public
void
putCommonMessage
(
CommonMQDTO
dto
)
{
...
...
@@ -39,16 +42,37 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
e
.
printStackTrace
();
}
}
@Override
public
void
putCommonDelayMessage
(
CommonMQDTO
dto
,
int
delay
)
{
String
message
=
JSONObject
.
toJSONString
(
dto
);
log
.
info
(
"加入好办延时通用队列params={}"
,
message
);
try
{
mqClient
.
sendMessage
(
"haobanDelayMQ"
,
message
,
delay
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送MQ异常"
);
e
.
printStackTrace
();
}
}
@Override
public
void
commonHandler
(
String
message
)
{
log
.
info
(
"接收好办通用队列params={}"
,
message
);
CommonMQDTO
dto
=
JSON
.
parseObject
(
message
,
CommonMQDTO
.
class
);
// 好办停用,删除定时
if
(
dto
.
getType
()==
1
)
{
Map
<
String
,
String
>
map
=
(
Map
<
String
,
String
>)
dto
.
getParams
()
;
Map
<
String
,
String
>
map
=
(
Map
<
String
,
String
>)
dto
.
getParams
()
;
switch
(
dto
.
getType
())
{
case
1
:
String
enterpriseId
=
map
.
get
(
"enterpriseId"
)
;
this
.
deleteQuartz
(
enterpriseId
);
break
;
case
2
:
String
staffId
=
map
.
get
(
"staffId"
)
;
if
(
StringUtils
.
isNotBlank
(
staffId
))
{
this
.
staffDepartmentRelatedService
.
repairStaffDepart
(
staffId
);
}
default
:
break
;
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
88e33b83
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
cn.hutool.core.convert.Convert
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
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
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkQwDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.*
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.commons.util.ImageUtil
;
import
com.gic.haoban.app.customer.service.api.service.InnerApiService
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.*
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.QywxCallBackDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.enums.WxEditType
;
import
com.gic.haoban.manage.api.service.HaobanCommonMQApiService
;
import
com.gic.haoban.manage.api.service.MessageApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.WxApplicationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
...
...
@@ -30,16 +71,8 @@ import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.google.common.collect.Sets
;
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.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.convert.Convert
;
/**
* 接收企业微信或者gic推送消息进行处理
...
...
@@ -86,6 +119,8 @@ public class MessageApiServiceImpl implements MessageApiService {
private
WxApplicationService
wxApplicationService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
HaobanCommonMQApiService
haobanCommonMQApiService
;
@Override
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
...
...
@@ -244,6 +279,12 @@ public class MessageApiServiceImpl implements MessageApiService {
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
wxEnterpriseId
);
if
(
department
==
null
)
{
log
.
info
(
"成员同步,部门不存在"
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>()
;
map
.
put
(
"staffId"
,
staff
.
getStaffId
())
;
CommonMQDTO
dto
=
new
CommonMQDTO
();
dto
.
setType
(
2
);
dto
.
setParams
(
map
);
this
.
haobanCommonMQApiService
.
putCommonDelayMessage
(
dto
,
60
);
continue
;
}
departmentIds
.
append
(
department
.
getDepartmentId
()).
append
(
","
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
88e33b83
...
...
@@ -266,7 +266,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staffService
.
updateByPrimaryKey
(
staff
);
}
logger
.
info
(
"staff变更保存:{}"
,
JSONObject
.
toJSONString
(
user
));
this
.
staffDepartmentRelatedService
.
staffDepartChange
(
staff
,
wxEnterpriseId
,
user
.
getDepartment
());
this
.
staffDepartmentRelatedService
.
staffDepartChange
(
staff
,
wxEnterpriseId
,
user
.
getDepartment
()
,
true
);
// 返回结果带上员工姓名
res
.
setResult
(
staff
.
getStaffName
());
return
res
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxStaffSyncOperation.java
View file @
88e33b83
...
...
@@ -52,13 +52,6 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
private
StaffApiService
staffApiService
;
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
Config
config
;
@Override
public
void
dealSingleByMq
(
DealParamMqDTO
dealParamMqDTO
,
TabHaobanPreDealLog
dataPre
)
{
logger
.
info
(
"企微通讯录成员同步处理:{}"
,
JSONObject
.
toJSONString
(
dealParamMqDTO
));
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
View file @
88e33b83
...
...
@@ -668,6 +668,22 @@
and status_flag = 1
</select>
<select
id=
"getIdList"
resultType=
"string"
>
select external_clerk_related_id from tab_haoban_external_clerk_related
where enterprise_id = #{enterpriseId} and member_id = #{memberId} and status_flag = 1
</select>
<update
id=
"updateMemberByIdList"
>
UPDATE
tab_haoban_external_clerk_related
SET member_id=#{memberId},
update_time = now()
where external_clerk_related_id in
<foreach
collection=
"list"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
and enterprise_id = #{enterpriseId} and status_flag = 1
</update>
<select
id=
"listPageByWxenterpriseId"
resultMap=
"BaseResultMap"
>
select DISTINCT(external_user_id) external_user_id , create_time from tab_haoban_external_clerk_related where wx_enterprise_id = #{wxEnterpriseId} and
...
...
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