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
85df4b07
Commit
85df4b07
authored
Jul 16, 2021
by
xuwenqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:新增发送企业微信消息通用方法
parent
035edf98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
331 additions
and
307 deletions
+331
-307
MessageApiService.java
.../com/gic/haoban/manage/api/service/MessageApiService.java
+39
-14
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+290
-293
TabHaobanStaffClerkRelationMapper.xml
...in/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
+2
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MessageApiService.java
View file @
85df4b07
...
@@ -7,22 +7,34 @@ import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
...
@@ -7,22 +7,34 @@ import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
* Created by tgs on 2020/2/20.
* Created by tgs on 2020/2/20.
*/
*/
public
interface
MessageApiService
{
public
interface
MessageApiService
{
/**接收企业微信的推送消息*/
/**
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
);
* 接收企业微信的推送消息
*
* @param gicMessageDTO
*/
@Deprecated
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
);
/**接收企业微信的推送消息*/
/**
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
* 接收企业微信的推送消息
*
* @param qywxCallBackDTO
*/
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
/**
/**
* 队列消费gic推送数据
* 队列消费gic推送数据
* @param param
*
*/
* @param param
void
dealGicMessage
(
String
param
);
*/
@Deprecated
void
dealGicMessage
(
String
param
);
/**
/**
* 队列消费企业微信推送数据
* 队列消费企业微信推送数据
* @param param
* @param param
*/
*/
@Deprecated
void
dealWxMessage
(
String
param
);
void
dealWxMessage
(
String
param
);
/**
/**
* 发送消费消息
* 发送消费消息
...
@@ -33,9 +45,11 @@ public interface MessageApiService {
...
@@ -33,9 +45,11 @@ public interface MessageApiService {
* @param storeId
* @param storeId
* @return
* @return
*/
*/
Boolean
sendFaceMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
arrivalTime
,
String
storeId
);
Boolean
sendFaceMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
arrivalTime
,
String
storeId
);
/**
/**
* 发送完善标签信息
* 发送完善标签信息
*
* @param clerkId
* @param clerkId
* @param clerkId
* @param clerkId
* @param memberName
* @param memberName
...
@@ -43,5 +57,16 @@ public interface MessageApiService {
...
@@ -43,5 +57,16 @@ public interface MessageApiService {
* @param orderId
* @param orderId
* @param storeId
* @param storeId
*/
*/
Boolean
sendPerfectRemarkMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
customerTime
,
String
orderId
,
String
storeId
);
Boolean
sendPerfectRemarkMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
customerTime
,
String
orderId
,
String
storeId
);
/**
* 通用发送企业微信消息
*
* @param param 参数
* @author xuwenqian
* @date 2021-07-16 10:09:00
*/
void
sendWxMessage
(
String
param
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
85df4b07
...
@@ -6,31 +6,19 @@ import com.gic.commons.util.EntityUtil;
...
@@ -6,31 +6,19 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.commons.util.GlobalVar
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.enterprise.api.service.StoreService
;
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.Constant
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.GicClerkDTO
;
import
com.gic.haoban.manage.api.dto.GicMessageDTO
;
import
com.gic.haoban.manage.api.dto.QywxCallBackDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.enums.GicDataType
;
import
com.gic.haoban.manage.api.enums.GicDataType
;
import
com.gic.haoban.manage.api.enums.GicEditType
;
import
com.gic.haoban.manage.api.enums.WxEditType
;
import
com.gic.haoban.manage.api.enums.WxEditType
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.*
;
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.service.config.Config
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.*
;
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.*
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
...
@@ -39,22 +27,20 @@ import com.gic.wechat.api.dto.qywx.ItemDTO;
...
@@ -39,22 +27,20 @@ import com.gic.wechat.api.dto.qywx.ItemDTO;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.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.io.InputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.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
;
/**
/**
* 接收企业微信或者gic推送消息进行处理
* 接收企业微信或者gic推送消息进行处理
* Created by tgs on 2020/2/20.
* Created by tgs on 2020/2/20.
...
@@ -83,27 +69,27 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -83,27 +69,27 @@ public class MessageApiServiceImpl implements MessageApiService {
private
Config
config
;
private
Config
config
;
@Autowired
@Autowired
private
QywxDepartmentApiService
qywxDepartmentApiService
;
private
QywxDepartmentApiService
qywxDepartmentApiService
;
@Autowired
@Autowired
private
QQCloudPicService
qqCloudPicService
;
private
QQCloudPicService
qqCloudPicService
;
@Autowired
@Autowired
private
InnerApiService
innerApiService
;
private
InnerApiService
innerApiService
;
private
final
String
CONTACT_APP
=
"contactSuiteId"
;
private
final
String
CONTACT_APP
=
"contactSuiteId"
;
@Autowired
@Autowired
private
StoreService
storeService
;
private
StoreService
storeService
;
@Autowired
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
...
@@ -126,7 +112,7 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -126,7 +112,7 @@ public class MessageApiServiceImpl implements MessageApiService {
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
try
{
if
(
config
.
getSuiteId
().
equals
(
qywxCallBackDTO
.
getSuiteId
())
||
CONTACT_APP
.
equals
(
qywxCallBackDTO
.
getSuiteId
()))
{
if
(
config
.
getSuiteId
().
equals
(
qywxCallBackDTO
.
getSuiteId
())
||
CONTACT_APP
.
equals
(
qywxCallBackDTO
.
getSuiteId
()))
{
log
.
info
(
"发送消息到dealWxMessageMq,{}"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
log
.
info
(
"发送消息到dealWxMessageMq,{}"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
}
}
...
@@ -137,7 +123,6 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -137,7 +123,6 @@ public class MessageApiServiceImpl implements MessageApiService {
@Override
@Override
public
void
dealGicMessage
(
String
param
)
{
public
void
dealGicMessage
(
String
param
)
{
return
;
}
}
@Override
@Override
...
@@ -147,96 +132,96 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -147,96 +132,96 @@ public class MessageApiServiceImpl implements MessageApiService {
return
;
return
;
}
}
QywxCallBackDTO
dto
=
JSON
.
parseObject
(
param
,
QywxCallBackDTO
.
class
);
QywxCallBackDTO
dto
=
JSON
.
parseObject
(
param
,
QywxCallBackDTO
.
class
);
log
.
info
(
"【处理微信回调】dto={}"
,
JSON
.
toJSONString
(
param
));
log
.
info
(
"【处理微信回调】dto={}"
,
JSON
.
toJSONString
(
param
));
if
(
dto
!=
null
)
{
if
(
dto
!=
null
)
{
String
corpId
=
dto
.
getAuthCorpId
();
String
corpId
=
dto
.
getAuthCorpId
();
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
corpId
);
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
corpId
);
if
(
enterprise
!=
null
)
{
if
(
enterprise
!=
null
)
{
if
(
dto
.
getChangeType
().
endsWith
(
"party"
))
{
if
(
dto
.
getChangeType
().
endsWith
(
"party"
))
{
this
.
dealDepartment
(
dto
);
this
.
dealDepartment
(
dto
);
}
else
{
}
else
{
this
.
dealUser
(
dto
);
this
.
dealUser
(
dto
);
}
}
}
}
}
}
}
}
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
){
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
)
{
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setIsStore
(
0
);
departmentDTO
.
setIsStore
(
0
);
//departmentDTO.setRelatedId(qywxCallBackDTO.getId()+"");
//departmentDTO.setRelatedId(qywxCallBackDTO.getId()+"");
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanDepartment
parentDepartment
=
new
TabHaobanDepartment
();
TabHaobanDepartment
parentDepartment
=
new
TabHaobanDepartment
();
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
}
else
{
}
else
{
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
oldDepartment
!=
null
)
{
if
(
oldDepartment
!=
null
)
{
parentDepartment
=
departmentService
.
selectById
(
oldDepartment
.
getParentDepartmentId
());
parentDepartment
=
departmentService
.
selectById
(
oldDepartment
.
getParentDepartmentId
());
}
}
}
}
if
(!
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
DELETEDEPART
.
getCode
()))
{
if
(!
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
DELETEDEPART
.
getCode
()))
{
if
(
parentDepartment
==
null
)
{
if
(
parentDepartment
==
null
)
{
log
.
info
(
"微信同步父部门不存在"
);
log
.
info
(
"微信同步父部门不存在"
);
return
;
return
;
}
}
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
departmentDTO
.
setLevel
(
parentDepartment
.
getLevel
()
+
1
);
departmentDTO
.
setLevel
(
parentDepartment
.
getLevel
()
+
1
);
}
}
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
qywxCallBackDTO
.
getAuthCorpId
(),
qywxCallBackDTO
.
getSuiteId
(),
qywxCallBackDTO
.
getParentId
());
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
qywxCallBackDTO
.
getAuthCorpId
(),
qywxCallBackDTO
.
getSuiteId
(),
qywxCallBackDTO
.
getParentId
());
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
for
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
departmentDTO2
:
list
)
{
for
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
departmentDTO2
:
list
)
{
if
(
departmentDTO2
.
getId
().
equals
(
departmentDTO
.
getDepartmentId
()))
{
if
(
departmentDTO2
.
getId
().
equals
(
departmentDTO
.
getDepartmentId
()))
{
departmentDTO
.
setSort
(
qywxCallBackDTO
.
getOrder
());
departmentDTO
.
setSort
(
qywxCallBackDTO
.
getOrder
());
}
else
{
}
else
{
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
departmentDTO2
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
departmentDTO2
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
tab
!=
null
)
{
if
(
tab
!=
null
)
{
tab
.
setSort
(
departmentDTO2
.
getOrder
());
tab
.
setSort
(
departmentDTO2
.
getOrder
());
this
.
departmentService
.
edit
(
EntityUtil
.
changeEntityByJSON
(
DepartmentDTO
.
class
,
tab
));
this
.
departmentService
.
edit
(
EntityUtil
.
changeEntityByJSON
(
DepartmentDTO
.
class
,
tab
));
}
}
}
}
}
}
}
}
}
}
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDDEPART
.
getCode
()))
{
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDDEPART
.
getCode
()))
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEDEPART
.
getCode
()))
{
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEDEPART
.
getCode
()))
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
{
}
else
{
departmentDTO
.
setIsStore
(
department
.
getIsStore
());
departmentDTO
.
setIsStore
(
department
.
getIsStore
());
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
this
.
departmentService
.
edit
(
departmentDTO
);
this
.
departmentService
.
edit
(
departmentDTO
);
log
.
info
(
"企业微信更新同步完成"
);
log
.
info
(
"企业微信更新同步完成"
);
}
}
}
else
{
}
else
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"微信同步删除部门不存在"
);
log
.
info
(
"微信同步删除部门不存在"
);
}
else
{
}
else
{
if
(
StringUtils
.
isBlank
(
department
.
getRelatedId
()))
{
if
(
StringUtils
.
isBlank
(
department
.
getRelatedId
()))
{
this
.
departmentService
.
del
(
department
.
getDepartmentId
());
this
.
departmentService
.
del
(
department
.
getDepartmentId
());
}
else
{
}
else
{
this
.
departmentApiService
.
wxCallBackrecycle
(
department
.
getDepartmentId
());
this
.
departmentApiService
.
wxCallBackrecycle
(
department
.
getDepartmentId
());
}
}
log
.
info
(
"企业微信删除同步完成"
);
log
.
info
(
"企业微信删除同步完成"
);
}
}
}
}
}
}
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
){
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
)
{
TabHaobanStaff
staff
=
new
TabHaobanStaff
();
TabHaobanStaff
staff
=
new
TabHaobanStaff
();
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
if
(
enterprise
!=
null
)
{
if
(
enterprise
!=
null
)
{
staff
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
staff
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
//staff.setActiveFlag(0);
//staff.setActiveFlag(0);
staff
.
setPhoneNumber
(
qywxCallBackDTO
.
getMobile
());
staff
.
setPhoneNumber
(
qywxCallBackDTO
.
getMobile
());
...
@@ -245,45 +230,45 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -245,45 +230,45 @@ public class MessageApiServiceImpl implements MessageApiService {
staff
.
setStaffName
(
qywxCallBackDTO
.
getUserName
());
staff
.
setStaffName
(
qywxCallBackDTO
.
getUserName
());
staff
.
setWxUserId
(
qywxCallBackDTO
.
getUserid
());
staff
.
setWxUserId
(
qywxCallBackDTO
.
getUserid
());
staff
.
setPostion
(
qywxCallBackDTO
.
getPosition
());
staff
.
setPostion
(
qywxCallBackDTO
.
getPosition
());
if
(
StringUtils
.
isNotBlank
(
qywxCallBackDTO
.
getAvatar
()))
{
if
(
StringUtils
.
isNotBlank
(
qywxCallBackDTO
.
getAvatar
()))
{
staff
.
setHeadImg
(
changeHeaderImageUrl
(
qywxCallBackDTO
.
getAvatar
()));
staff
.
setHeadImg
(
changeHeaderImageUrl
(
qywxCallBackDTO
.
getAvatar
()));
}
}
staff
.
setNationCode
(
"86"
);
staff
.
setNationCode
(
"86"
);
//激活状态
//激活状态
if
(
qywxCallBackDTO
.
getStatus
()
!=
null
&&
qywxCallBackDTO
.
getStatus
()
==
1
)
{
if
(
qywxCallBackDTO
.
getStatus
()
!=
null
&&
qywxCallBackDTO
.
getStatus
()
==
1
)
{
staff
.
setActiveFlag
(
1
);
staff
.
setActiveFlag
(
1
);
}
}
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
0
);
staff
.
setActiveFlag
(
0
);
}
}
this
.
addUser
(
qywxCallBackDTO
,
staff
);
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
oldStaff
!=
null
)
{
if
(
oldStaff
!=
null
)
{
staff
.
setWxUserId
(
qywxCallBackDTO
.
getNewUserid
());
staff
.
setWxUserId
(
qywxCallBackDTO
.
getNewUserid
());
staff
.
setStaffId
(
oldStaff
.
getStaffId
());
staff
.
setStaffId
(
oldStaff
.
getStaffId
());
log
.
info
(
"【微信回调更新】staff={}"
,
JSON
.
toJSONString
(
staff
));
log
.
info
(
"【微信回调更新】staff={}"
,
JSON
.
toJSONString
(
staff
));
if
(
StringUtils
.
isBlank
(
staff
.
getPhoneNumber
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getPhoneNumber
()))
{
staff
.
setPhoneNumber
(
oldStaff
.
getPhoneNumber
());
staff
.
setPhoneNumber
(
oldStaff
.
getPhoneNumber
());
}
}
if
(
StringUtils
.
isBlank
(
staff
.
getNationCode
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getNationCode
()))
{
staff
.
setNationCode
(
oldStaff
.
getNationCode
());
staff
.
setNationCode
(
oldStaff
.
getNationCode
());
}
}
if
(
StringUtils
.
isBlank
(
staff
.
getStaffName
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getStaffName
()))
{
staff
.
setStaffName
(
oldStaff
.
getStaffName
());
staff
.
setStaffName
(
oldStaff
.
getStaffName
());
}
}
if
(
StringUtils
.
isBlank
(
staff
.
getPostion
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getPostion
()))
{
staff
.
setPostion
(
oldStaff
.
getPostion
());
staff
.
setPostion
(
oldStaff
.
getPostion
());
}
}
if
(
staff
.
getSex
()
==
null
)
{
if
(
staff
.
getSex
()
==
null
)
{
staff
.
setSex
(
oldStaff
.
getSex
());
staff
.
setSex
(
oldStaff
.
getSex
());
}
}
if
(
staff
.
getActiveFlag
()
==
null
)
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
oldStaff
.
getActiveFlag
());
staff
.
setActiveFlag
(
oldStaff
.
getActiveFlag
());
}
}
if
(
StringUtils
.
isBlank
(
staff
.
getHeadImg
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getHeadImg
()))
{
staff
.
setHeadImg
(
oldStaff
.
getHeadImg
());
staff
.
setHeadImg
(
oldStaff
.
getHeadImg
());
}
}
// this.staffService.updateByPrimaryKey(staff);
// this.staffService.updateByPrimaryKey(staff);
// this.staffDepartmentRelatedService.delByUserid(qywxCallBackDTO.getUserid());
// this.staffDepartmentRelatedService.delByUserid(qywxCallBackDTO.getUserid());
...
@@ -291,97 +276,97 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -291,97 +276,97 @@ public class MessageApiServiceImpl implements MessageApiService {
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
departmentIds
=
""
;
String
departmentIds
=
""
;
//部门修改了
//部门修改了
if
(
departArr
!=
null
)
{
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
log
.
info
(
"部门不存在"
);
continue
;
continue
;
}
}
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
}
}
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
else
{
}
else
{
//部门没有修改
//部门没有修改
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
departmentIds
+=
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()
+
","
;
departmentIds
+=
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()
+
","
;
}
}
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
}
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
StaffDTO
staffDTO
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
staffDTO
.
setWeixinPush
(
true
);
staffDTO
.
setWeixinPush
(
true
);
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
);
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
);
}
else
{
}
else
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
0
);
staff
.
setActiveFlag
(
0
);
}
}
this
.
addUser
(
qywxCallBackDTO
,
staff
);
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
}
}
else
{
}
else
{
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
//List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staff.getStaffId());
//List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staff.getStaffId());
if
(
oldStaff
!=
null
)
{
if
(
oldStaff
!=
null
)
{
List
<
TabHaobanStaffDepartmentRelated
>
relatedList
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
oldStaff
.
getStaffId
());
List
<
TabHaobanStaffDepartmentRelated
>
relatedList
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
oldStaff
.
getStaffId
());
TabHaobanStaffDepartmentRelated
staffRelated
=
relatedList
.
get
(
0
);
TabHaobanStaffDepartmentRelated
staffRelated
=
relatedList
.
get
(
0
);
if
(
StringUtils
.
isNotBlank
(
staffRelated
.
getClerkCode
()))
{
if
(
StringUtils
.
isNotBlank
(
staffRelated
.
getClerkCode
()))
{
staffApiService
.
cleanGicClerk
(
staffRelated
.
getClerkCode
(),
staffRelated
.
getDepartmentId
());
staffApiService
.
cleanGicClerk
(
staffRelated
.
getClerkCode
(),
staffRelated
.
getDepartmentId
());
}
}
innerApiService
.
delCardByStaffId
(
oldStaff
.
getStaffId
());
innerApiService
.
delCardByStaffId
(
oldStaff
.
getStaffId
());
this
.
staffDepartmentRelatedService
.
del
(
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
staffRelated
));
this
.
staffDepartmentRelatedService
.
del
(
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
staffRelated
));
this
.
staffService
.
delByuserid
(
oldStaff
.
getStaffId
());
this
.
staffService
.
delByuserid
(
oldStaff
.
getStaffId
());
}
else
{
}
else
{
log
.
info
(
"微信同步删除的门店不存在,{}"
,
qywxCallBackDTO
.
getUserid
());
log
.
info
(
"微信同步删除的门店不存在,{}"
,
qywxCallBackDTO
.
getUserid
());
}
}
}
}
}
else
{
}
else
{
log
.
info
(
"授权企业不存在,{}"
,
qywxCallBackDTO
.
getAuthCorpId
());
log
.
info
(
"授权企业不存在,{}"
,
qywxCallBackDTO
.
getAuthCorpId
());
}
}
}
}
private
void
addUser
(
QywxCallBackDTO
qywxCallBackDTO
,
TabHaobanStaff
staff
){
private
void
addUser
(
QywxCallBackDTO
qywxCallBackDTO
,
TabHaobanStaff
staff
)
{
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
departmentIds
=
""
;
String
departmentIds
=
""
;
for
(
String
s
:
departArr
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
log
.
info
(
"部门不存在"
);
continue
;
continue
;
}
}
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
}
}
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
if
(
staffDTO
==
null
)
{
if
(
staffDTO
==
null
)
{
staffApiService
.
wxGetAdd
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
staffApiService
.
wxGetAdd
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
}
else
{
}
else
{
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
if
(!
departmentIds
.
contains
(
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()))
{
if
(!
departmentIds
.
contains
(
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()))
{
departmentIds
+=
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()
+
","
;
departmentIds
+=
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()
+
","
;
}
}
if
(
departmentIds
.
endsWith
(
","
))
{
if
(
departmentIds
.
endsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
}
}
}
StaffDTO
staffUpdate
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
StaffDTO
staffUpdate
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
staffUpdate
.
setWeixinPush
(
true
);
staffUpdate
.
setWeixinPush
(
true
);
staffApiService
.
staffEdit
(
staffUpdate
,
departmentIds
);
staffApiService
.
staffEdit
(
staffUpdate
,
departmentIds
);
}
}
// String add = this.staffService.add(staff);
// String add = this.staffService.add(staff);
// log.info("新增用户返回结果:{}", add);
// log.info("新增用户返回结果:{}", add);
// this.addUserDepart(qywxCallBackDTO, add, staff.getWxEnterpriseId());
// this.addUserDepart(qywxCallBackDTO, add, staff.getWxEnterpriseId());
}
}
private
void
addUserDepart
(
QywxCallBackDTO
qywxCallBackDTO
,
String
staffId
,
String
wxEnterpriseId
){
private
void
addUserDepart
(
QywxCallBackDTO
qywxCallBackDTO
,
String
staffId
,
String
wxEnterpriseId
)
{
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
if
(
departArr
!=
null
)
{
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
wxEnterpriseId
);
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
wxEnterpriseId
);
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
log
.
info
(
"部门不存在"
);
continue
;
continue
;
}
}
...
@@ -399,37 +384,38 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -399,37 +384,38 @@ public class MessageApiServiceImpl implements MessageApiService {
}
}
}
}
}
}
private
String
changeHeaderImageUrl
(
String
headImgUrl
)
{
private
String
changeHeaderImageUrl
(
String
headImgUrl
)
{
try
{
InputStream
in
=
new
URL
(
headImgUrl
).
openStream
();
byte
[]
data
=
IOUtils
.
toByteArray
(
in
);
PicUploadResDTO
uploadPic
=
qqCloudPicService
.
uploadPic
(
GlobalVar
.
ctxPropertiesMap
.
get
(
GlobalInfo
.
QQPIC_KEY_ENTERPRISE
),
data
);
log
.
info
(
"腾讯云万象优图返回"
+
JSON
.
toJSONString
(
uploadPic
));
return
uploadPic
.
downloadUrl
;
}
catch
(
Exception
e
)
{
log
.
info
(
"上传腾讯云万象优图返回失败了:"
,
e
);
return
headImgUrl
;
}
}
try
{
InputStream
in
=
new
URL
(
headImgUrl
).
openStream
();
byte
[]
data
=
IOUtils
.
toByteArray
(
in
);
PicUploadResDTO
uploadPic
=
qqCloudPicService
.
uploadPic
(
GlobalVar
.
ctxPropertiesMap
.
get
(
GlobalInfo
.
QQPIC_KEY_ENTERPRISE
),
data
);
log
.
info
(
"腾讯云万象优图返回"
+
JSON
.
toJSONString
(
uploadPic
));
return
uploadPic
.
downloadUrl
;
}
catch
(
Exception
e
){
log
.
info
(
"上传腾讯云万象优图返回失败了:"
,
e
);
return
headImgUrl
;
}
}
/**
/**
* 通过关联的父级ID链查询父级部门
* 通过关联的父级ID链查询父级部门
*
* @param parentChain
* @param parentChain
* @return
* @return
*/
*/
private
DepartmentDTO
getParentDepartment
(
String
parentChain
,
int
dataType
,
String
wxEnterpriseId
){
private
DepartmentDTO
getParentDepartment
(
String
parentChain
,
int
dataType
,
String
wxEnterpriseId
)
{
if
(
StringUtils
.
isNotBlank
(
parentChain
))
{
if
(
StringUtils
.
isNotBlank
(
parentChain
))
{
String
[]
arr
=
parentChain
.
split
(
"_"
);
String
[]
arr
=
parentChain
.
split
(
"_"
);
int
len
=
arr
.
length
;
int
len
=
arr
.
length
;
int
startIndex
=
len
-
2
;
int
startIndex
=
len
-
2
;
if
(
dataType
==
GicDataType
.
STORE
.
getCode
()
||
dataType
==
GicDataType
.
DEPARTMENT
.
getCode
())
{
if
(
dataType
==
GicDataType
.
STORE
.
getCode
()
||
dataType
==
GicDataType
.
DEPARTMENT
.
getCode
())
{
startIndex
=
len
-
1
;
startIndex
=
len
-
1
;
}
}
for
(
int
i
=
startIndex
;
i
>=
0
&&
i
<
len
;
i
--)
{
for
(
int
i
=
startIndex
;
i
>=
0
&&
i
<
len
;
i
--)
{
DepartmentDTO
department
=
this
.
departmentService
.
getByRelatedIdNotInRecycle
(
arr
[
i
]);
DepartmentDTO
department
=
this
.
departmentService
.
getByRelatedIdNotInRecycle
(
arr
[
i
]);
log
.
info
(
"当前节点id:{}, {}"
,
arr
[
i
],
JSON
.
toJSONString
(
department
));
log
.
info
(
"当前节点id:{}, {}"
,
arr
[
i
],
JSON
.
toJSONString
(
department
));
if
(
department
!=
null
)
{
if
(
department
!=
null
)
{
return
department
;
return
department
;
}
}
}
}
...
@@ -437,111 +423,122 @@ public class MessageApiServiceImpl implements MessageApiService {
...
@@ -437,111 +423,122 @@ public class MessageApiServiceImpl implements MessageApiService {
//DepartmentDTO departmentDTO = this.departmentService.getRootByEnterpriseId(wxEnterpriseId);
//DepartmentDTO departmentDTO = this.departmentService.getRootByEnterpriseId(wxEnterpriseId);
return
null
;
return
null
;
}
}
@Override
public
Boolean
sendFaceMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
arrivalTime
,
String
storeId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"memberId"
,
memberId
);
jsonObject
.
put
(
"storeId"
,
storeId
);
String
data
=
jsonObject
.
toJSONString
();
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
FACE_ARRIVAL
.
getCode
(),
data
);
StaffClerkRelationDTO
relation
=
staffClerkRelationApiService
.
getByClerkId
(
clerkId
);
if
(
relation
==
null
){
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
){
log
.
info
(
"企业为空"
);
return
false
;
}
if
(
relation
!=
null
){
String
userId
=
relation
.
getWxUserId
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"人脸匹配"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"到店时间"
,
arrivalTime
);
List
<
ItemDTO
>
items
=
getItemsList
(
map
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
userId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
@Override
return
b
;
public
Boolean
sendFaceMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
arrivalTime
,
String
storeId
)
{
}
JSONObject
jsonObject
=
new
JSONObject
();
return
false
;
jsonObject
.
put
(
"memberId"
,
memberId
);
jsonObject
.
put
(
"storeId"
,
storeId
);
}
String
data
=
jsonObject
.
toJSONString
();
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
FACE_ARRIVAL
.
getCode
(),
data
);
StaffClerkRelationDTO
relation
=
staffClerkRelationApiService
.
getByClerkId
(
clerkId
);
if
(
relation
==
null
)
{
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"企业为空"
);
return
false
;
}
String
userId
=
relation
.
getWxUserId
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"人脸匹配"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"到店时间"
,
arrivalTime
);
List
<
ItemDTO
>
items
=
getItemsList
(
map
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
userId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
return
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
}
private
List
<
ItemDTO
>
getItemsList
(
Map
<
String
,
String
>
map
)
{
private
List
<
ItemDTO
>
getItemsList
(
Map
<
String
,
String
>
map
)
{
List
<
ItemDTO
>
items
=
new
ArrayList
();
List
<
ItemDTO
>
items
=
new
ArrayList
();
Iterator
<
String
>
it
=
map
.
keySet
().
iterator
();
map
.
keySet
().
forEach
(
key
->
{
while
(
it
.
hasNext
())
{
String
value
=
map
.
get
(
key
);
String
key
=
it
.
next
();
ItemDTO
dto
=
new
ItemDTO
();
String
value
=
map
.
get
(
key
);
dto
.
setKey
(
key
);
ItemDTO
dto
=
new
ItemDTO
();
dto
.
setValue
(
value
);
dto
.
setKey
(
key
);
items
.
add
(
dto
);
dto
.
setValue
(
value
);
});
items
.
add
(
dto
);
return
items
;
}
}
return
items
;
}
public
static
void
main
(
String
[]
args
){
@Override
String
parentChain
=
"1_"
;
public
Boolean
sendPerfectRemarkMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
customerTime
,
String
orderId
,
String
storeId
)
{
String
[]
arr
=
parentChain
.
split
(
"_"
);
JSONObject
jsonObject
=
new
JSONObject
();
int
len
=
arr
.
length
;
jsonObject
.
put
(
"memberId"
,
memberId
);
int
startIndex
=
len
-
1
;
jsonObject
.
put
(
"storeId"
,
storeId
);
System
.
out
.
println
(
len
);
jsonObject
.
put
(
"currentTab"
,
1
);
for
(
int
i
=
startIndex
;
i
>=
0
&&
i
<
len
;
i
--){
String
data
=
jsonObject
.
toJSONString
();
System
.
out
.
println
(
i
);
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
PERFECT_TAG
.
getCode
(),
data
);
StaffClerkRelationDTO
relation
=
staffClerkRelationApiService
.
getByClerkId
(
clerkId
);
if
(
relation
==
null
)
{
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
}
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"企业为空"
);
return
false
;
}
String
userId
=
relation
.
getWxUserId
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"会员完善标签"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"消费订单"
,
orderId
);
map
.
put
(
"消费时间"
,
customerTime
);
List
<
ItemDTO
>
items
=
getItemsList
(
map
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
userId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
return
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
@Override
}
public
Boolean
sendPerfectRemarkMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
customerTime
,
String
orderId
,
String
storeId
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"memberId"
,
memberId
);
jsonObject
.
put
(
"storeId"
,
storeId
);
jsonObject
.
put
(
"currentTab"
,
1
);
String
data
=
jsonObject
.
toJSONString
();
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
PERFECT_TAG
.
getCode
(),
data
);
StaffClerkRelationDTO
relation
=
staffClerkRelationApiService
.
getByClerkId
(
clerkId
);
if
(
relation
==
null
){
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
){
log
.
info
(
"企业为空"
);
return
false
;
}
if
(
relation
!=
null
){
String
userId
=
relation
.
getWxUserId
();
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"会员完善标签"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"消费订单"
,
orderId
);
map
.
put
(
"消费时间"
,
customerTime
);
List
<
ItemDTO
>
items
=
getItemsList
(
map
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
userId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
@Override
return
b
;
public
void
sendWxMessage
(
String
param
)
{
}
log
.
info
(
"发送企业微信消息:{}"
,
param
);
return
false
;
if
(
StringUtils
.
isBlank
(
param
))
{
log
.
info
(
"param参数为空"
);
}
return
;
}
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
String
wxEnterpriseId
=
jsonObject
.
getString
(
"wxEnterpriseId"
);
String
wxUserId
=
jsonObject
.
getString
(
"wxUserId"
);
String
pageUrl
=
jsonObject
.
getString
(
"pageUrl"
);
String
title
=
jsonObject
.
getString
(
"title"
);
String
content
=
jsonObject
.
getString
(
"content"
);
String
memberName
=
jsonObject
.
getString
(
"memberName"
);
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"企业为空"
);
return
;
}
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
//后续map加判断可加参数
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
content
);
map
.
put
(
"会员"
,
memberName
);
List
<
ItemDTO
>
items
=
getItemsList
(
map
);
List
<
String
>
userList
=
new
ArrayList
<>();
userList
.
add
(
wxUserId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
userList
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
title
);
messageDTO
.
setItems
(
items
);
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
}
}
}
haoban-manage3-service/src/main/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
View file @
85df4b07
...
@@ -435,6 +435,8 @@
...
@@ -435,6 +435,8 @@
<select
id=
"listAll"
resultType=
"com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"
>
<select
id=
"listAll"
resultType=
"com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"
>
SELECT a.store_id,
SELECT a.store_id,
a.wx_enterprise_id,
a.wx_user_id,
a.staff_id,
a.staff_id,
a.clerk_id,
a.clerk_id,
b.staff_name,
b.staff_name,
...
...
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