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
30cb2495
Commit
30cb2495
authored
Jan 25, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
7e775f46
9699537c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
30 deletions
+121
-30
QywxCallBackDTO.java
...n/java/com/gic/haoban/manage/api/dto/QywxCallBackDTO.java
+29
-2
MessageApiService.java
.../com/gic/haoban/manage/api/service/MessageApiService.java
+0
-2
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+92
-26
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/QywxCallBackDTO.java
View file @
30cb2495
...
...
@@ -17,8 +17,14 @@ public class QywxCallBackDTO implements Serializable{
/**1男 2女***/
private
Integer
gender
;
private
String
alias
;
private
String
mainDepartment
;
/**
* 是否是所在部门负责人 1 是 0 否 例 1,0,0
*/
private
Integer
[]
isLeaderInDept
;
private
String
[]
department
;
private
String
newUserid
;
private
String
telephone
;
private
String
mobile
;
private
String
position
;
private
Integer
status
;
//激活状态:1=激活或关注, 2=禁用, 4=未激活
...
...
@@ -200,6 +206,27 @@ public class QywxCallBackDTO implements Serializable{
this
.
status
=
status
;
}
public
String
getMainDepartment
()
{
return
mainDepartment
;
}
public
void
setMainDepartment
(
String
mainDepartment
)
{
this
.
mainDepartment
=
mainDepartment
;
}
public
Integer
[]
getIsLeaderInDept
()
{
return
isLeaderInDept
;
}
public
void
setIsLeaderInDept
(
Integer
[]
isLeaderInDept
)
{
this
.
isLeaderInDept
=
isLeaderInDept
;
}
public
String
getTelephone
()
{
return
telephone
;
}
public
void
setTelephone
(
String
telephone
)
{
this
.
telephone
=
telephone
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MessageApiService.java
View file @
30cb2495
...
...
@@ -20,14 +20,12 @@ public interface MessageApiService {
*
* @param qywxCallBackDTO
*/
@Deprecated
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
/**
* 队列消费企业微信推送数据
* @param param
*/
@Deprecated
void
dealWxMessage
(
String
param
);
/**
* 发送消费消息
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
30cb2495
...
...
@@ -2,12 +2,15 @@ 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.clerk.api.service.ClerkService
;
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 +19,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 +28,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 +38,9 @@ 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.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 接收企业微信或者gic推送消息进行处理
...
...
@@ -88,6 +85,11 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
WxEnterpriseRelatedService
wxEnterpriseRelatedService
;
@Autowired
private
ClerkService
clerkService
;
@Override
public
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
)
{
if
(
true
)
{
...
...
@@ -118,23 +120,87 @@ 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);
// }
// }
// }
}
/**
* desc: 鸿星尔克定制需求校验-后期可扩展为配置形式
*
* @param dto dto
* @return : {@link boolean}
* @author : YongEn
* @date : 2022/1/25
*/
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
);
String
mainDeptId
=
dto
.
getMainDepartment
();
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
departments
=
qywxDepartmentApiService
.
listDepartment
(
dto
.
getAuthCorpId
(),
dto
.
getSuiteId
(),
Integer
.
valueOf
(
mainDeptId
));
if
(
CollectionUtils
.
isEmpty
(
departments
))
{
log
.
info
(
"通过主部门查询部门列表为空 mainDeptId:{}"
,
mainDeptId
);
return
;
}
Map
<
Integer
,
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
departmentIdMap
=
departments
.
stream
()
.
collect
(
Collectors
.
toMap
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
::
getId
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
mainDept
=
departmentIdMap
.
get
(
Integer
.
valueOf
(
mainDeptId
));
clerkQwDTO
.
setStoreName
(
mainDept
.
getName
());
clerkQwDTO
.
setClerkCode
(
dto
.
getUserid
());
clerkQwDTO
.
setClerkName
(
dto
.
getUserName
());
clerkQwDTO
.
setClerkType
(
dto
.
getIsLeaderInDept
()[
0
]);
clerkQwDTO
.
setClerkGener
(
dto
.
getGender
());
clerkQwDTO
.
setPhoneNumber
(
dto
.
getMobile
());
clerkQwDTO
.
setNationcode
(
dto
.
getTelephone
());
// 调用换导购接口逻辑
clerkService
.
syncClerkForQw
(
clerkQwDTO
);
}
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