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
a9aaddee
Commit
a9aaddee
authored
Jan 24, 2022
by
xugaojun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[鸿星尔克定制开发]:回调新增员工
parent
927c400b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
26 deletions
+71
-26
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+71
-26
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
a9aaddee
...
...
@@ -2,12 +2,14 @@ package com.gic.haoban.manage.service.service.out.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkQwDTO
;
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.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.AppPageType
;
import
com.gic.haoban.manage.api.enums.GicDataType
;
...
...
@@ -16,14 +18,8 @@ import com.gic.haoban.manage.api.enums.WxEditType;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.api.util.notify.NoticeMessageUtil
;
import
com.gic.haoban.manage.service.config.Config
;
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.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
import
com.gic.thirdparty.api.service.QQCloudPicService
;
...
...
@@ -31,6 +27,7 @@ import com.gic.wechat.api.dto.qywx.ItemDTO;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -40,10 +37,7 @@ import org.springframework.stereotype.Service;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* 接收企业微信或者gic推送消息进行处理
...
...
@@ -88,6 +82,9 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
WxEnterpriseRelatedService
wxEnterpriseRelatedService
;
@Override
public
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
)
{
if
(
true
)
{
...
...
@@ -118,23 +115,71 @@ public class MessageApiServiceImpl implements MessageApiService {
@Override
public
void
dealWxMessage
(
String
param
)
{
if
(
true
)
{
log
.
info
(
"不出发更新企业微信变更"
);
return
;
}
QywxCallBackDTO
dto
=
JSON
.
parseObject
(
param
,
QywxCallBackDTO
.
class
);
log
.
info
(
"【处理微信回调】dto={}"
,
JSON
.
toJSONString
(
param
));
if
(
dto
!=
null
)
{
String
corpId
=
dto
.
getAuthCorpId
();
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
corpId
);
if
(
enterprise
!=
null
)
{
if
(
dto
.
getChangeType
().
endsWith
(
"party"
))
{
this
.
dealDepartment
(
dto
);
}
else
{
this
.
dealUser
(
dto
);
}
}
// 处理定制-目前鸿星尔克用
boolean
checkErkeDeal
=
checkErkeDeal
(
dto
);
if
(!
checkErkeDeal
)
{
log
.
info
(
"不符合鸿星尔克需求,返回"
);
return
;
}
TabHaobanWxEnterprise
enterprise
=
enterpriseService
.
getEnterpriseBycorpId
(
dto
.
getAuthCorpId
());
if
(
Objects
.
isNull
(
enterprise
))
{
log
.
info
(
"通过corpId:【{}】未查询到授权企业,无法处理"
,
dto
.
getAuthCorpId
());
return
;
}
List
<
TabHaobanWxEnterpriseRelated
>
relatedList
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
relatedList
))
{
log
.
info
(
"未查询到企业关联企业 wxEnt"
);
return
;
}
ServiceResponse
response
=
staffApiService
.
getWxSaveNew
(
dto
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
response
.
getCode
()
!=
1
){
log
.
info
(
"添加企业员工失败参数:{}"
,
response
.
getMessage
());
return
;
}
// 取第一个企业的id
doDealUser
(
dto
,
relatedList
.
get
(
0
).
getEnterpriseId
());
// 以下暂时不会用到
// if (dto != null) {
// String corpId = dto.getAuthCorpId();
// TabHaobanWxEnterprise enterprise = this.enterpriseService.getEnterpriseBycorpId(corpId);
// if (enterprise != null) {
// if (dto.getChangeType().endsWith("party")) {
// this.dealDepartment(dto);
// } else {
// this.dealUser(dto);
// }
// }
// }
}
private
boolean
checkErkeDeal
(
QywxCallBackDTO
dto
)
{
if
(
Objects
.
isNull
(
dto
)
||
StringUtils
.
isEmpty
(
dto
.
getUserid
()))
{
return
false
;
}
String
userid
=
dto
.
getUserid
();
// 当前规则 userId是12位并且以5开头
if
(
userid
.
length
()
!=
12
)
{
return
false
;
}
return
userid
.
startsWith
(
"5"
);
}
private
void
doDealUser
(
QywxCallBackDTO
dto
,
String
enterpriseId
)
{
ClerkQwDTO
clerkQwDTO
=
new
ClerkQwDTO
();
clerkQwDTO
.
setEnterpriseId
(
enterpriseId
);
// TODO: 2022/1/24 获取部门名称
clerkQwDTO
.
setStoreName
(
""
);
clerkQwDTO
.
setClerkCode
(
dto
.
getUserid
());
clerkQwDTO
.
setClerkName
(
dto
.
getUserName
());
// TODO: 2022/1/24 数组第一个
clerkQwDTO
.
setClerkType
(
1
);
clerkQwDTO
.
setClerkGener
(
dto
.
getGender
());
clerkQwDTO
.
setPhoneNumber
(
dto
.
getMobile
());
clerkQwDTO
.
setNationcode
(
dto
.
getTelephone
());
// TODO: 2022/1/24 调用接口
}
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
)
{
...
...
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