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
QianQiXiang
haoban-manage3.0
Commits
24e87b5e
Commit
24e87b5e
authored
Feb 20, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信和gic消息推送处理
parent
32080dba
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
717 additions
and
7 deletions
+717
-7
GicMessageDTO.java
...ain/java/com/gic/haoban/manage/api/dto/GicMessageDTO.java
+74
-0
QywxCallBackDTO.java
...n/java/com/gic/haoban/manage/api/dto/QywxCallBackDTO.java
+175
-0
GicDataType.java
...ain/java/com/gic/haoban/manage/api/enums/GicDataType.java
+34
-0
GicEditType.java
...ain/java/com/gic/haoban/manage/api/enums/GicEditType.java
+34
-0
WxEditType.java
...main/java/com/gic/haoban/manage/api/enums/WxEditType.java
+37
-0
MessageApiService.java
.../com/gic/haoban/manage/api/service/MessageApiService.java
+27
-0
DepartmentMapper.java
...ic/haoban/manage/service/dao/mapper/DepartmentMapper.java
+2
-0
StaffDepartmentRelatedMapper.java
...nage/service/dao/mapper/StaffDepartmentRelatedMapper.java
+4
-0
WxEnterpriseMapper.java
.../haoban/manage/service/dao/mapper/WxEnterpriseMapper.java
+4
-0
WxEnterpriseRelatedMapper.java
.../manage/service/dao/mapper/WxEnterpriseRelatedMapper.java
+3
-1
DepartmentService.java
.../gic/haoban/manage/service/service/DepartmentService.java
+2
-0
StaffDepartmentRelatedService.java
...manage/service/service/StaffDepartmentRelatedService.java
+1
-1
StaffService.java
...a/com/gic/haoban/manage/service/service/StaffService.java
+2
-0
WxEnterpriseRelatedService.java
...an/manage/service/service/WxEnterpriseRelatedService.java
+3
-0
WxEnterpriseService.java
...ic/haoban/manage/service/service/WxEnterpriseService.java
+8
-0
DepartmentServiceImpl.java
...an/manage/service/service/impl/DepartmentServiceImpl.java
+5
-0
StaffDepartmentRelatedServiceImpl.java
...rvice/service/impl/StaffDepartmentRelatedServiceImpl.java
+4
-0
StaffServiceImpl.java
.../haoban/manage/service/service/impl/StaffServiceImpl.java
+8
-0
WxEnterpriseRelatedServiceImpl.java
.../service/service/impl/WxEnterpriseRelatedServiceImpl.java
+12
-0
WxEnterpriseServiceImpl.java
.../manage/service/service/impl/WxEnterpriseServiceImpl.java
+11
-0
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+243
-0
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+1
-0
DepartmentMapper.xml
...e3-service/src/main/resources/mapper/DepartmentMapper.xml
+7
-0
StaffDepartmentRelatedMapper.xml
...rc/main/resources/mapper/StaffDepartmentRelatedMapper.xml
+7
-1
StaffMapper.xml
...manage3-service/src/main/resources/mapper/StaffMapper.xml
+2
-1
WxEnterpriseMapper.xml
...-service/src/main/resources/mapper/WxEnterpriseMapper.xml
+7
-1
WxEnterpriseRelatedMapper.xml
...e/src/main/resources/mapper/WxEnterpriseRelatedMapper.xml
+0
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/GicMessageDTO.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
/**
* Created by tgs on 2020/2/20.
*/
public
class
GicMessageDTO
implements
Serializable
{
private
String
enterpriseId
;
private
String
parentId
;
private
String
parentChain
;
private
String
id
;
//1gic企业部门,2分组,3门店
private
Integer
type
;
private
String
name
;
//1新增,2修改,3删除
private
Integer
changeType
;
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
Integer
getType
()
{
return
type
;
}
public
void
setType
(
Integer
type
)
{
this
.
type
=
type
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Integer
getChangeType
()
{
return
changeType
;
}
public
void
setChangeType
(
Integer
changeType
)
{
this
.
changeType
=
changeType
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getParentChain
()
{
return
parentChain
;
}
public
void
setParentChain
(
String
parentChain
)
{
this
.
parentChain
=
parentChain
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/QywxCallBackDTO.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
java.io.Serializable
;
/**
* Created by tgs on 2020/2/15.
*/
public
class
QywxCallBackDTO
implements
Serializable
{
private
String
suiteId
;
private
String
infoType
;
private
String
timeStamp
;
private
String
authCode
;
private
String
suiteTicket
;
private
String
authCorpId
;
private
String
userid
;
private
String
userName
;
/**1男 2女***/
private
Integer
gender
;
private
String
alias
;
private
String
[]
department
;
private
String
newUserid
;
private
String
mobile
;
private
Integer
id
;
private
String
departmentName
;
private
Integer
parentId
;
private
Integer
order
;
/**部门创建:create_party;部门修改:update_party;部门删除:delete_party*
* 成员创建:create_user;成员修改:update_user;成员删除:delete_user*/
private
String
changeType
;
public
String
getSuiteId
()
{
return
suiteId
;
}
public
void
setSuiteId
(
String
suiteId
)
{
this
.
suiteId
=
suiteId
;
}
public
String
getInfoType
()
{
return
infoType
;
}
public
void
setInfoType
(
String
infoType
)
{
this
.
infoType
=
infoType
;
}
public
String
getTimeStamp
()
{
return
timeStamp
;
}
public
void
setTimeStamp
(
String
timeStamp
)
{
this
.
timeStamp
=
timeStamp
;
}
public
String
getAuthCode
()
{
return
authCode
;
}
public
void
setAuthCode
(
String
authCode
)
{
this
.
authCode
=
authCode
;
}
public
String
getSuiteTicket
()
{
return
suiteTicket
;
}
public
void
setSuiteTicket
(
String
suiteTicket
)
{
this
.
suiteTicket
=
suiteTicket
;
}
public
String
getUserid
()
{
return
userid
;
}
public
void
setUserid
(
String
userid
)
{
this
.
userid
=
userid
;
}
public
Integer
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Integer
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Integer
getOrder
()
{
return
order
;
}
public
void
setOrder
(
Integer
order
)
{
this
.
order
=
order
;
}
public
String
getNewUserid
()
{
return
newUserid
;
}
public
void
setNewUserid
(
String
newUserid
)
{
this
.
newUserid
=
newUserid
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
String
getAuthCorpId
()
{
return
authCorpId
;
}
public
void
setAuthCorpId
(
String
authCorpId
)
{
this
.
authCorpId
=
authCorpId
;
}
public
String
getChangeType
()
{
return
changeType
;
}
public
void
setChangeType
(
String
changeType
)
{
this
.
changeType
=
changeType
;
}
public
String
[]
getDepartment
()
{
return
department
;
}
public
void
setDepartment
(
String
[]
department
)
{
this
.
department
=
department
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
public
Integer
getGender
()
{
return
gender
;
}
public
void
setGender
(
Integer
gender
)
{
this
.
gender
=
gender
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/GicDataType.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
;
/**
* Created by tgs on 2020/2/20.
*/
public
enum
GicDataType
{
DEPARTMENT
(
1
,
"企业部门"
),
GROUP
(
2
,
"门店分组"
),
STORE
(
3
,
"门店"
);
GicDataType
(
Integer
type
,
String
desc
){
this
.
code
=
type
;
this
.
desc
=
desc
;
}
private
int
code
;
private
String
desc
;
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/GicEditType.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
;
/**
* Created by tgs on 2020/2/20.
*/
public
enum
GicEditType
{
ADD
(
1
,
"新增"
),
UPDATE
(
2
,
"修改"
),
DELETE
(
3
,
"删除"
);
GicEditType
(
Integer
type
,
String
desc
){
this
.
code
=
type
;
this
.
desc
=
desc
;
}
private
int
code
;
private
String
desc
;
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/WxEditType.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
;
/**
* Created by tgs on 2020/2/20.
*/
public
enum
WxEditType
{
ADDDEPART
(
"create_party"
,
"创建部门"
),
UPDATEDEPART
(
"update_party"
,
"更新部门"
),
DELETEDEPART
(
"delete_party"
,
"删除部门"
),
ADDUSER
(
"create_user"
,
"新增用户"
),
UPDATEUSER
(
"update_user"
,
"更新用户"
),
DELETEUSER
(
"delete_user"
,
"删除用户"
);
WxEditType
(
String
type
,
String
desc
){
this
.
code
=
type
;
this
.
desc
=
desc
;
}
private
String
code
;
private
String
desc
;
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MessageApiService.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
com.gic.haoban.manage.api.dto.GicMessageDTO
;
import
com.gic.haoban.manage.api.dto.QywxCallBackDTO
;
/**
* Created by tgs on 2020/2/20.
*/
public
interface
MessageApiService
{
/**接收企业微信的推送消息*/
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
);
/**接收企业微信的推送消息*/
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
/**
* 队列消费gic推送数据
* @param param
*/
void
dealGicMessage
(
String
param
);
/**
* 队列消费企业微信推送数据
* @param param
*/
void
dealWxMessage
(
String
param
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/DepartmentMapper.java
View file @
24e87b5e
...
...
@@ -27,6 +27,8 @@ public interface DepartmentMapper {
TabHaobanDepartment
selectByRelatedId
(
@Param
(
"relatedId"
)
String
relatedId
);
TabHaobanDepartment
getByWxId
(
@Param
(
"wxDepartmentId"
)
String
wxDepartmentId
);
List
<
TabHaobanDepartment
>
listByDepartmentIds
(
@Param
(
"departmentIds"
)
List
<
String
>
departmentIds
,
@Param
(
"storeFlag"
)
int
storeFlag
);
Page
<
TabHaobanDepartment
>
pageDepartmentByParams
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"keyword"
)
String
keyword
,
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/StaffDepartmentRelatedMapper.java
View file @
24e87b5e
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
org.apache.ibatis.annotations.Param
;
public
interface
StaffDepartmentRelatedMapper
{
int
deleteByPrimaryKey
(
String
staffDepartmentRelatedId
);
...
...
@@ -31,4 +32,6 @@ public interface StaffDepartmentRelatedMapper {
TabHaobanStaffDepartmentRelated
getById
(
String
staffDepartmentRelatedId
);
int
delByUserid
(
@Param
(
"userid"
)
String
userId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/WxEnterpriseMapper.java
View file @
24e87b5e
...
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.dao.mapper;
import
java.util.List
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
org.apache.ibatis.annotations.Param
;
public
interface
WxEnterpriseMapper
{
int
deleteByPrimaryKey
(
String
wxEnterpriseId
);
...
...
@@ -18,4 +19,6 @@ public interface WxEnterpriseMapper {
int
updateByPrimaryKey
(
TabHaobanWxEnterprise
record
);
List
<
TabHaobanWxEnterprise
>
list
();
List
<
TabHaobanWxEnterprise
>
listBycorpId
(
@Param
(
"corpId"
)
String
corpId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/WxEnterpriseRelatedMapper.java
View file @
24e87b5e
...
...
@@ -19,5 +19,6 @@ public interface WxEnterpriseRelatedMapper {
List
<
TabHaobanWxEnterpriseRelated
>
listByWxenterpriseId
(
String
wxEnterpriseId
);
TabHaobanWxEnterpriseRelated
findOneByEnterpriseId
(
String
enterpriseId
);
List
<
TabHaobanWxEnterpriseRelated
>
findOneByEnterpriseId
(
String
enterpriseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/DepartmentService.java
View file @
24e87b5e
...
...
@@ -20,6 +20,8 @@ public interface DepartmentService {
TabHaobanDepartment
selectByRelatedId
(
String
relatedId
);
TabHaobanDepartment
getByWxId
(
String
wxDepartmentId
);
void
recycle
(
String
departmentId
);
Page
<
TabHaobanDepartment
>
pageDepartmentByParams
(
String
wxEnterpriseId
,
String
keyword
,
Integer
storeFlag
,
Integer
recycleFlag
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffDepartmentRelatedService.java
View file @
24e87b5e
...
...
@@ -18,5 +18,5 @@ public interface StaffDepartmentRelatedService {
void
del
(
StaffDepartmentRelatedDTO
related
);
void
delByUserid
(
String
userid
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffService.java
View file @
24e87b5e
...
...
@@ -18,4 +18,6 @@ public interface StaffService {
TabHaobanStaff
selectByUserId
(
String
userId
);
void
updateByPrimaryKey
(
TabHaobanStaff
tab
);
int
delByuserid
(
String
staffId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseRelatedService.java
View file @
24e87b5e
...
...
@@ -2,8 +2,11 @@ package com.gic.haoban.manage.service.service;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
java.util.List
;
public
interface
WxEnterpriseRelatedService
{
TabHaobanWxEnterpriseRelated
getByGicEnterpriseIdByEnterpriseRelatedId
(
String
wxEnterpriseRelatedId
);
TabHaobanWxEnterpriseRelated
getEnterpriseByGicEnterpriseId
(
String
gicEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseService.java
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
public
interface
WxEnterpriseService
{
...
...
@@ -8,4 +9,11 @@ public interface WxEnterpriseService {
WxEnterpriseDTO
selectById
(
String
wxEnterpriseId
);
/**
* 通过微信企业ID查询好办企业ID
* @param corpId
* @return
*/
TabHaobanWxEnterprise
getEnterpriseBycorpId
(
String
corpId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/DepartmentServiceImpl.java
View file @
24e87b5e
...
...
@@ -78,6 +78,11 @@ public class DepartmentServiceImpl implements DepartmentService {
}
@Override
public
TabHaobanDepartment
getByWxId
(
String
wxDepartmentId
)
{
return
null
;
}
@Override
public
void
recycle
(
String
departmentId
)
{
TabHaobanDepartment
tab
=
mapper
.
selectByPrimaryKey
(
departmentId
);
if
(
tab
!=
null
)
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffDepartmentRelatedServiceImpl.java
View file @
24e87b5e
...
...
@@ -59,6 +59,10 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
}
@Override
public
void
delByUserid
(
String
userid
)
{
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffServiceImpl.java
View file @
24e87b5e
...
...
@@ -56,4 +56,12 @@ public class StaffServiceImpl implements StaffService {
mapper
.
updateByPrimaryKey
(
tab
);
}
@Override
public
int
delByuserid
(
String
staffId
)
{
TabHaobanStaff
staff
=
new
TabHaobanStaff
();
staff
.
setStaffId
(
staffId
);
staff
.
setStatusFlag
(
0
);
return
this
.
mapper
.
updateByPrimaryKey
(
staff
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseRelatedServiceImpl.java
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -7,6 +8,8 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
java.util.List
;
@Service
public
class
WxEnterpriseRelatedServiceImpl
implements
WxEnterpriseRelatedService
{
@Autowired
...
...
@@ -18,4 +21,13 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
return
mapper
.
selectByPrimaryKey
(
wxEnterpriseRelatedId
);
}
@Override
public
TabHaobanWxEnterpriseRelated
getEnterpriseByGicEnterpriseId
(
String
gicEnterpriseId
)
{
List
<
TabHaobanWxEnterpriseRelated
>
list
=
mapper
.
findOneByEnterpriseId
(
gicEnterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
return
list
.
get
(
0
);
}
return
null
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseServiceImpl.java
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -34,4 +36,13 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
return
null
;
}
@Override
public
TabHaobanWxEnterprise
getEnterpriseBycorpId
(
String
corpId
)
{
List
<
TabHaobanWxEnterprise
>
list
=
this
.
mapper
.
listBycorpId
(
corpId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
return
list
.
get
(
0
);
}
return
null
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
0 → 100644
View file @
24e87b5e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.GicMessageDTO
;
import
com.gic.haoban.manage.api.dto.QywxCallBackDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
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.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.MessageApiService
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.mq.sdk.GicMQClient
;
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推送消息进行处理
* Created by tgs on 2020/2/20.
*/
@Service
(
"messageApiService"
)
public
class
MessageApiServiceImpl
implements
MessageApiService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
MessageApiServiceImpl
.
class
);
@Autowired
private
DepartmentService
departmentService
;
@Autowired
private
WxEnterpriseRelatedService
wxEnterpriseRelatedService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
WxEnterpriseService
enterpriseService
;
@Autowired
private
StaffService
staffService
;
@Autowired
private
StaffDepartmentRelatedService
staffDepartmentRelatedService
;
@Override
public
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
)
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
log
.
info
(
"发送消息到dealGicMessageMq,{}"
,
JSON
.
toJSONString
(
gicMessageDTO
));
clientInstance
.
sendMessage
(
"dealGicMessageMq"
,
JSON
.
toJSONString
(
gicMessageDTO
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
log
.
info
(
"发送消息到dealWxMessageMq,{}"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
dealGicMessage
(
String
param
)
{
GicMessageDTO
dto
=
JSON
.
parseObject
(
param
,
GicMessageDTO
.
class
);
TabHaobanWxEnterpriseRelated
enterprise
=
this
.
wxEnterpriseRelatedService
.
getEnterpriseByGicEnterpriseId
(
dto
.
getEnterpriseId
());
if
(
enterprise
!=
null
){
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
dto
.
getName
());
departmentDTO
.
setIsStore
(
dto
.
getType
()
!=
GicDataType
.
STORE
.
getCode
()
?
0
:
1
);
departmentDTO
.
setRelatedId
(
dto
.
getId
());
DepartmentDTO
parentDepartment
=
this
.
getParentDepartment
(
dto
.
getParentChain
(),
dto
.
getType
(),
enterprise
.
getWxEnterpriseId
());
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
());
if
(
dto
.
getType
()
==
GicEditType
.
ADD
.
getCode
()){
HaobanResponse
response
=
this
.
departmentApiService
.
add
(
departmentDTO
);
log
.
info
(
"添加结果:{}"
,
JSON
.
toJSONString
(
response
));
}
else
if
(
dto
.
getType
()
==
GicEditType
.
UPDATE
.
getCode
()){
TabHaobanDepartment
department
=
this
.
departmentService
.
selectByRelatedId
(
dto
.
getId
());
if
(
department
==
null
){
HaobanResponse
response
=
this
.
departmentApiService
.
add
(
departmentDTO
);
log
.
info
(
"添加结果:{}"
,
JSON
.
toJSONString
(
response
));
}
else
{
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
this
.
departmentApiService
.
edit
(
departmentDTO
);
log
.
info
(
"gic同步更新完成"
);
}
}
else
{
TabHaobanDepartment
department
=
this
.
departmentService
.
selectByRelatedId
(
dto
.
getId
());
if
(
department
!=
null
){
this
.
departmentApiService
.
del
(
department
.
getDepartmentId
());
log
.
info
(
"gic同步删除完成"
);
}
else
{
log
.
info
(
"gic同步删除不存在"
);
}
}
}
}
@Override
public
void
dealWxMessage
(
String
param
)
{
QywxCallBackDTO
dto
=
JSON
.
parseObject
(
param
,
QywxCallBackDTO
.
class
);
if
(
dto
.
getInfoType
().
endsWith
(
"party"
)){
this
.
dealDepartment
(
dto
);
}
else
{
this
.
dealUser
(
dto
);
}
}
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
){
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setIsStore
(
0
);
departmentDTO
.
setRelatedId
(
qywxCallBackDTO
.
getId
()+
""
);
TabHaobanDepartment
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
);
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
);
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()+
""
);
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
()
+
""
);
if
(
department
==
null
){
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
{
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
this
.
departmentService
.
edit
(
departmentDTO
);
log
.
info
(
"企业微信更新同步完成"
);
}
}
else
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
);
if
(
department
==
null
){
log
.
info
(
"微信同步删除部门不存在"
);
}
else
{
this
.
departmentService
.
del
(
departmentDTO
.
getDepartmentId
());
log
.
info
(
"企业微信删除同步完成"
);
}
}
}
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
){
TabHaobanStaff
staff
=
new
TabHaobanStaff
();
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
if
(
enterprise
==
null
){
staff
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
staff
.
setActiveFlag
(
0
);
staff
.
setPhoneNumber
(
qywxCallBackDTO
.
getMobile
());
staff
.
setNickName
(
qywxCallBackDTO
.
getAlias
());
staff
.
setSex
(
qywxCallBackDTO
.
getGender
());
staff
.
setStaffName
(
qywxCallBackDTO
.
getUserName
());
staff
.
setWxUserId
(
qywxCallBackDTO
.
getUserid
());
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDUSER
.
getCode
())){
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEUSER
.
getCode
())){
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserId
(
qywxCallBackDTO
.
getUserid
());
if
(
oldStaff
!=
null
){
staff
.
setWxUserId
(
qywxCallBackDTO
.
getNewUserid
());
staff
.
setStaffId
(
oldStaff
.
getStaffId
());
this
.
staffService
.
updateByPrimaryKey
(
staff
);
this
.
staffDepartmentRelatedService
.
delByUserid
(
qywxCallBackDTO
.
getUserid
());
this
.
addUserDepart
(
qywxCallBackDTO
,
oldStaff
.
getStaffId
());
}
else
{
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
}
else
{
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserId
(
qywxCallBackDTO
.
getUserid
());
if
(
oldStaff
!=
null
){
this
.
staffService
.
delByuserid
(
oldStaff
.
getStaffId
());
}
else
{
log
.
info
(
"微信同步删除的门店不存在,{}"
,
qywxCallBackDTO
.
getUserid
());
}
}
}
else
{
log
.
info
(
"授权企业不存在,{}"
,
qywxCallBackDTO
.
getAuthCorpId
());
}
}
private
void
addUser
(
QywxCallBackDTO
qywxCallBackDTO
,
TabHaobanStaff
staff
){
String
add
=
this
.
staffService
.
add
(
staff
);
log
.
info
(
"新增用户返回结果:{}"
,
add
);
this
.
addUserDepart
(
qywxCallBackDTO
,
add
);
}
private
void
addUserDepart
(
QywxCallBackDTO
qywxCallBackDTO
,
String
staffId
){
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
for
(
String
s
:
departArr
){
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
);
if
(
department
==
null
){
log
.
info
(
"部门不存在"
);
continue
;
}
StaffDepartmentRelatedDTO
related
=
new
StaffDepartmentRelatedDTO
();
related
.
setWxUserId
(
qywxCallBackDTO
.
getUserid
());
related
.
setClerkCode
(
qywxCallBackDTO
.
getUserid
());
related
.
setDepartmentId
(
department
.
getDepartmentId
());
related
.
setPhoneNumber
(
qywxCallBackDTO
.
getMobile
());
related
.
setStaffDepartmentRelatedId
(
staffId
);
related
.
setStatusFlag
(
1
);
String
add1
=
this
.
staffDepartmentRelatedService
.
add
(
related
);
log
.
info
(
"新增用户部门关联关系:{}"
,
add1
);
}
}
/**
* 通过关联的父级ID链查询父级部门
* @param parentChain
* @return
*/
private
DepartmentDTO
getParentDepartment
(
String
parentChain
,
int
dataType
,
String
wxEnterpriseId
){
if
(
StringUtils
.
isNotBlank
(
parentChain
)){
String
[]
arr
=
parentChain
.
split
(
"_"
);
int
len
=
arr
.
length
;
int
startIndex
=
len
-
2
;
if
(
dataType
==
GicDataType
.
STORE
.
getCode
()){
startIndex
=
len
-
1
;
}
for
(
int
i
=
startIndex
;
i
<
len
;
i
--){
DepartmentDTO
department
=
this
.
departmentService
.
getByRelatedId
(
arr
[
i
]);
if
(
department
!=
null
){
return
department
;
}
}
}
DepartmentDTO
departmentDTO
=
this
.
departmentService
.
getRootByEnterpriseId
(
wxEnterpriseId
);
return
departmentDTO
;
}
}
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
24e87b5e
...
...
@@ -28,6 +28,7 @@
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
ref=
"wxEnterpriseRelatedApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService"
ref=
"staffDepartmentRelatedApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseApiService"
ref=
"wxEnterpriseApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.MessageApiService"
ref=
"messageApiService"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.DepartmentService"
id=
"gicDepartmentService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
id=
"qywxDepartmentApiService"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/DepartmentMapper.xml
View file @
24e87b5e
...
...
@@ -225,6 +225,13 @@
and status_flag = 1
</select>
<select
id=
"getByWxId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_department
where wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"pageDepartmentByParams"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
...
...
haoban-manage3-service/src/main/resources/mapper/StaffDepartmentRelatedMapper.xml
View file @
24e87b5e
...
...
@@ -192,5 +192,10 @@
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<update
id=
"delByUserid"
>
update tab_haoban_staff_department_related
set
status_flag = 0
where wx_user_id = #{userid,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/StaffMapper.xml
View file @
24e87b5e
...
...
@@ -265,7 +265,7 @@
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff
where user_id = #{userId,jdbcType=VARCHAR}
where
wx_
user_id = #{userId,jdbcType=VARCHAR}
and staus_flag = 1
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/WxEnterpriseMapper.xml
View file @
24e87b5e
...
...
@@ -358,7 +358,12 @@
from tab_haoban_wx_enterprise
where status_flag = 1
</select>
<select
id=
"listBycorpId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_wx_enterprise
where status_flag = 1 and corpid= #{corpId}
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/WxEnterpriseRelatedMapper.xml
View file @
24e87b5e
...
...
@@ -129,5 +129,4 @@
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
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