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
4b070b44
Commit
4b070b44
authored
Mar 08, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:成员同步修改
parent
beb94ebd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
89 deletions
+14
-89
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+14
-89
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
4b070b44
...
@@ -6,7 +6,6 @@ import com.gic.clerk.api.dto.ClerkQwDTO;
...
@@ -6,7 +6,6 @@ import com.gic.clerk.api.dto.ClerkQwDTO;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.*
;
import
com.gic.commons.util.*
;
import
com.gic.haoban.app.customer.service.api.service.InnerApiService
;
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.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
...
@@ -105,21 +104,11 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -105,21 +104,11 @@ public class MessageApiServiceImpl implements MessageApiService {
@Override
@Override
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
// 处理定制-目前鸿星尔克用
boolean
checkErkeDeal
=
checkErkeDeal
(
qywxCallBackDTO
);
if
(!
checkErkeDeal
)
{
log
.
info
(
"不符合鸿星尔克需求,返回"
);
return
;
}
if
(
StringUtils
.
isEmpty
(
qywxCallBackDTO
.
getMobile
()))
{
log
.
info
(
"手机号参数为空, 不作处理"
);
return
;
}
try
{
try
{
log
.
info
(
"发送消息到dealWxMessageMq,{}"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
log
.
info
(
"发送消息到dealWxMessageMq,{}"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
log
.
error
(
"发送失败:{}"
,
e
.
getMessage
()
);
}
}
}
}
...
@@ -136,6 +125,12 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -136,6 +125,12 @@ public class MessageApiServiceImpl implements MessageApiService {
// 校验适用企业-定制
// 校验适用企业-定制
boolean
suitWxEnterpriseIid
=
checkSuitEnterpriseId
(
wxEnterpriseId
);
boolean
suitWxEnterpriseIid
=
checkSuitEnterpriseId
(
wxEnterpriseId
);
if
(
suitWxEnterpriseIid
)
{
if
(
suitWxEnterpriseIid
)
{
// 处理定制-目前鸿星尔克用
boolean
checkErkeDeal
=
checkErkeDeal
(
dto
);
if
(!
checkErkeDeal
)
{
log
.
info
(
"不符合鸿星尔克需求,返回"
);
return
;
}
log
.
info
(
"微信企业id:{}, 不适用"
,
wxEnterpriseId
);
log
.
info
(
"微信企业id:{}, 不适用"
,
wxEnterpriseId
);
List
<
TabHaobanWxEnterpriseRelated
>
relatedList
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
wxEnterpriseId
);
List
<
TabHaobanWxEnterpriseRelated
>
relatedList
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
relatedList
))
{
if
(
CollectionUtils
.
isEmpty
(
relatedList
))
{
...
@@ -186,10 +181,6 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -186,10 +181,6 @@ public class MessageApiServiceImpl implements MessageApiService {
private
boolean
checkSuitEnterpriseId
(
String
wxEnterpriseId
)
{
private
boolean
checkSuitEnterpriseId
(
String
wxEnterpriseId
)
{
Set
<
String
>
wxSet
=
Sets
.
newHashSet
(
Set
<
String
>
wxSet
=
Sets
.
newHashSet
(
// 润辰
"ca66a01b79474c40b3e7c7f93daf1a3b"
,
// 尊兴
"c0c2186a947440aa8c0afbdd869ec043"
,
"ac451a350eed4a96958dd5c7377f8bd9"
,
"ac451a350eed4a96958dd5c7377f8bd9"
,
// 鸿星尔克
// 鸿星尔克
"e034e2bd5d0b44d3bf553c9f8204094c"
);
"e034e2bd5d0b44d3bf553c9f8204094c"
);
...
@@ -219,83 +210,14 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -219,83 +210,14 @@ public class MessageApiServiceImpl implements MessageApiService {
clerkService
.
syncClerkForQw
(
clerkQwDTO
);
clerkService
.
syncClerkForQw
(
clerkQwDTO
);
}
}
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
)
{
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setIsStore
(
0
);
//departmentDTO.setRelatedId(qywxCallBackDTO.getId()+"");
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanDepartment
parentDepartment
=
new
TabHaobanDepartment
();
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
}
else
{
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
oldDepartment
!=
null
)
{
parentDepartment
=
departmentService
.
selectById
(
oldDepartment
.
getParentDepartmentId
());
}
}
if
(!
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
DELETEDEPART
.
getCode
()))
{
if
(
parentDepartment
==
null
)
{
log
.
info
(
"微信同步父部门不存在"
);
return
;
}
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
departmentDTO
.
setLevel
(
parentDepartment
.
getLevel
()
+
1
);
}
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
qywxCallBackDTO
.
getAuthCorpId
(),
qywxCallBackDTO
.
getSuiteId
(),
qywxCallBackDTO
.
getParentId
());
if
(
list
!=
null
)
{
for
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
departmentDTO2
:
list
)
{
if
(
departmentDTO2
.
getId
().
equals
(
departmentDTO
.
getDepartmentId
()))
{
departmentDTO
.
setSort
(
qywxCallBackDTO
.
getOrder
());
}
else
{
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
departmentDTO2
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
tab
!=
null
)
{
tab
.
setSort
(
departmentDTO2
.
getOrder
());
this
.
departmentService
.
edit
(
EntityUtil
.
changeEntityByJSON
(
DepartmentDTO
.
class
,
tab
));
}
}
}
}
}
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDDEPART
.
getCode
()))
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEDEPART
.
getCode
()))
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
{
departmentDTO
.
setIsStore
(
department
.
getIsStore
());
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
this
.
departmentService
.
edit
(
departmentDTO
);
log
.
info
(
"企业微信更新同步完成"
);
}
}
else
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
log
.
info
(
"微信同步删除部门不存在"
);
}
else
{
if
(
StringUtils
.
isBlank
(
department
.
getRelatedId
()))
{
this
.
departmentService
.
del
(
department
.
getDepartmentId
());
}
else
{
this
.
departmentApiService
.
wxCallBackrecycle
(
department
.
getDepartmentId
());
}
log
.
info
(
"企业微信删除同步完成"
);
}
}
}
/**
/**
* 处理企业通讯录成员
* 处理企业通讯录成员
*
* @param qywxCallBackDTO
* @param qywxCallBackDTO
*/
*/
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
)
{
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
)
{
String
userid
=
qywxCallBackDTO
.
getUserid
();
log
.
info
(
"成员同步开始:userid:{}"
,
userid
);
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
if
(
enterprise
==
null
)
{
if
(
enterprise
==
null
)
{
log
.
info
(
"授权企业不存在,{}"
,
qywxCallBackDTO
.
getAuthCorpId
());
log
.
info
(
"授权企业不存在,{}"
,
qywxCallBackDTO
.
getAuthCorpId
());
...
@@ -303,11 +225,13 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -303,11 +225,13 @@ public class MessageApiServiceImpl implements MessageApiService {
}
}
String
wxEnterpriseId
=
enterprise
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
enterprise
.
getWxEnterpriseId
();
String
changeType
=
qywxCallBackDTO
.
getChangeType
();
String
changeType
=
qywxCallBackDTO
.
getChangeType
();
String
userid
=
qywxCallBackDTO
.
getUserid
();
if
(
changeType
.
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
if
(
changeType
.
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
log
.
info
(
"成员新增,userid:{}"
,
userid
);
//新增
//新增
this
.
staffApiService
.
wxGetAdd
(
userid
,
wxEnterpriseId
);
this
.
staffApiService
.
wxGetAdd
(
userid
,
wxEnterpriseId
);
}
else
if
(
changeType
.
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
}
else
if
(
changeType
.
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
log
.
info
(
"成员修改,userid:{}"
,
userid
);
//修改
//修改
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
userid
,
wxEnterpriseId
);
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
userid
,
wxEnterpriseId
);
if
(
oldStaff
==
null
)
{
if
(
oldStaff
==
null
)
{
...
@@ -354,6 +278,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -354,6 +278,7 @@ public class MessageApiServiceImpl implements MessageApiService {
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
.
toString
());
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETEUSER
.
getCode
()))
{
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETEUSER
.
getCode
()))
{
log
.
info
(
"成员删除,userid:{}"
,
userid
);
//删除
//删除
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
userid
,
wxEnterpriseId
);
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
userid
,
wxEnterpriseId
);
if
(
oldStaff
==
null
)
{
if
(
oldStaff
==
null
)
{
...
...
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