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
804b58a8
Commit
804b58a8
authored
Aug 19, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!115
parents
b74ffef5
9b626c3d
Show whitespace changes
Inline
Side-by-side
Showing
60 changed files
with
2236 additions
and
517 deletions
+2236
-517
AlertMessageDTO.java
...n/java/com/gic/haoban/manage/api/dto/AlertMessageDTO.java
+81
-0
ExternalClerkRelatedShortInfoDTO.java
...oban/manage/api/dto/ExternalClerkRelatedShortInfoDTO.java
+36
-0
StaffClerkInfoDTO.java
...java/com/gic/haoban/manage/api/dto/StaffClerkInfoDTO.java
+12
-3
StaffClerkRelationDTO.java
.../com/gic/haoban/manage/api/dto/StaffClerkRelationDTO.java
+19
-2
AlertTypeEnum.java
...n/java/com/gic/haoban/manage/api/enums/AlertTypeEnum.java
+53
-0
AppPageType.java
...ain/java/com/gic/haoban/manage/api/enums/AppPageType.java
+6
-2
QuartzEnum.java
...main/java/com/gic/haoban/manage/api/enums/QuartzEnum.java
+6
-1
QywxTagRelationSyncFlagEnum.java
.../haoban/manage/api/enums/QywxTagRelationSyncFlagEnum.java
+34
-0
CheckQywxSettingApiService.java
...haoban/manage/api/service/CheckQywxSettingApiService.java
+7
-0
DealSyncOperationApiService.java
...aoban/manage/api/service/DealSyncOperationApiService.java
+32
-23
ExternalClerkRelatedApiService.java
...an/manage/api/service/ExternalClerkRelatedApiService.java
+15
-0
MemberUnionidRelatedApiService.java
...an/manage/api/service/MemberUnionidRelatedApiService.java
+14
-5
MessageApiService.java
.../com/gic/haoban/manage/api/service/MessageApiService.java
+29
-4
QywxTagApiService.java
.../com/gic/haoban/manage/api/service/QywxTagApiService.java
+92
-4
StaffClerkRelationApiService.java
...oban/manage/api/service/StaffClerkRelationApiService.java
+21
-10
StaffDepartmentRelatedApiService.java
.../manage/api/service/StaffDepartmentRelatedApiService.java
+1
-0
TestDataImportController.java
.../manage/web/controller/test/TestDataImportController.java
+3
-0
QywxTagItemMapper.java
...c/haoban/manage/service/dao/mapper/QywxTagItemMapper.java
+19
-0
QywxTagRelationMapper.java
...oban/manage/service/dao/mapper/QywxTagRelationMapper.java
+20
-0
TabHaobanExternalClerkRelatedMapper.java
...rvice/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
+21
-2
TabHaobanStaffClerkRelationMapper.java
...service/dao/mapper/TabHaobanStaffClerkRelationMapper.java
+20
-7
TabHaobanStoreRelationMapper.java
...nage/service/dao/mapper/TabHaobanStoreRelationMapper.java
+9
-0
QywxSyncTagFormatPojo.java
...gic/haoban/manage/service/pojo/QywxSyncTagFormatPojo.java
+62
-0
QywxTagSyncInfoPojo.java
...m/gic/haoban/manage/service/pojo/QywxTagSyncInfoPojo.java
+123
-0
StoreSyncPojo.java
...ava/com/gic/haoban/manage/service/pojo/StoreSyncPojo.java
+21
-0
ExternalClerkRelatedService.java
...n/manage/service/service/ExternalClerkRelatedService.java
+9
-0
QywxTagService.java
...com/gic/haoban/manage/service/service/QywxTagService.java
+64
-0
StaffClerkRelationService.java
...ban/manage/service/service/StaffClerkRelationService.java
+24
-15
StoreRangeService.java
.../gic/haoban/manage/service/service/StoreRangeService.java
+8
-0
WxEnterpriseService.java
...ic/haoban/manage/service/service/WxEnterpriseService.java
+9
-0
ExternalClerkRelatedServiceImpl.java
...service/service/impl/ExternalClerkRelatedServiceImpl.java
+5
-0
QywxTagServiceImpl.java
...aoban/manage/service/service/impl/QywxTagServiceImpl.java
+74
-0
StaffClerkRelationServiceImpl.java
...e/service/service/impl/StaffClerkRelationServiceImpl.java
+14
-22
StoreRangeServiceImpl.java
...an/manage/service/service/impl/StoreRangeServiceImpl.java
+5
-0
WxEnterpriseServiceImpl.java
.../manage/service/service/impl/WxEnterpriseServiceImpl.java
+5
-0
AuditApiServiceImpl.java
.../manage/service/service/out/impl/AuditApiServiceImpl.java
+4
-0
CheckQywxSettingApiServiceImpl.java
...vice/service/out/impl/CheckQywxSettingApiServiceImpl.java
+73
-7
ExternalClerkRelatedApiServiceImpl.java
.../service/out/impl/ExternalClerkRelatedApiServiceImpl.java
+44
-0
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+66
-24
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+139
-142
QywxTagApiServiceImpl.java
...anage/service/service/out/impl/QywxTagApiServiceImpl.java
+578
-43
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+7
-2
StaffClerkRelationApiServiceImpl.java
...ce/service/out/impl/StaffClerkRelationApiServiceImpl.java
+84
-82
StaffDepartmentRelatedApiServiceImpl.java
...ervice/out/impl/StaffDepartmentRelatedApiServiceImpl.java
+22
-27
KafkaMessageServiceImpl.java
...c/haoban/manage/service/task/KafkaMessageServiceImpl.java
+11
-0
FriendSyncNewOperation.java
...an/manage/service/task/friend/FriendSyncNewOperation.java
+4
-3
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+7
-1
QywxTagItemMapper.xml
...3-service/src/main/resources/mapper/QywxTagItemMapper.xml
+25
-0
QywxTagRelationMapper.xml
...rvice/src/main/resources/mapper/QywxTagRelationMapper.xml
+27
-7
TabHaobanExternalClerkRelatedMapper.xml
.../resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
+23
-0
TabHaobanStaffClerkRelationMapper.xml
...in/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
+19
-8
TabHaobanStoreRelationMapper.xml
...rc/main/resources/mapper/TabHaobanStoreRelationMapper.xml
+11
-0
DealSyncTest.java
haoban-manage3-service/src/test/java/DealSyncTest.java
+19
-0
QywxTagTest.java
haoban-manage3-service/src/test/java/QywxTagTest.java
+28
-0
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+2
-3
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+3
-2
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+35
-2
InfoController.java
.../com/gic/haoban/manage/web/controller/InfoController.java
+7
-17
StoreController.java
...com/gic/haoban/manage/web/controller/StoreController.java
+23
-46
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+2
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/AlertMessageDTO.java
0 → 100644
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
/**
* Created 2021/8/2.
*
* @author hua
*/
public
class
AlertMessageDTO
implements
Serializable
{
private
String
wxEnterpriseId
;
private
String
enterpriseId
;
private
Integer
alertType
;
/**
* 用来判断唯一性 同步的
*/
private
String
key
;
private
String
traceId
;
private
String
alertTitle
;
private
Map
<
String
,
Object
>
contentMap
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
Integer
getAlertType
()
{
return
alertType
;
}
public
void
setAlertType
(
Integer
alertType
)
{
this
.
alertType
=
alertType
;
}
public
String
getTraceId
()
{
return
traceId
;
}
public
void
setTraceId
(
String
traceId
)
{
this
.
traceId
=
traceId
;
}
public
String
getAlertTitle
()
{
return
alertTitle
;
}
public
void
setAlertTitle
(
String
alertTitle
)
{
this
.
alertTitle
=
alertTitle
;
}
public
Map
<
String
,
Object
>
getContentMap
()
{
return
contentMap
;
}
public
void
setContentMap
(
Map
<
String
,
Object
>
contentMap
)
{
this
.
contentMap
=
contentMap
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/ExternalClerkRelatedShortInfoDTO.java
View file @
804b58a8
...
...
@@ -7,9 +7,45 @@ public class ExternalClerkRelatedShortInfoDTO implements Serializable {
private
String
wxUserId
;
private
String
enterpriseId
;
private
String
wxEnterpriseId
;
private
String
storeId
;
private
String
clerkId
;
private
static
final
long
serialVersionUID
=
1L
;
public
String
getStoreId
()
{
return
storeId
;
}
public
void
setStoreId
(
String
storeId
)
{
this
.
storeId
=
storeId
;
}
public
String
getClerkId
()
{
return
clerkId
;
}
public
void
setClerkId
(
String
clerkId
)
{
this
.
clerkId
=
clerkId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getExternalUserId
()
{
return
externalUserId
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffClerkInfoDTO.java
View file @
804b58a8
...
...
@@ -3,8 +3,9 @@ package com.gic.haoban.manage.api.dto;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
StaffClerkInfoDTO
implements
Serializable
{
public
class
StaffClerkInfoDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
staffClerkRelationId
;
...
...
@@ -16,6 +17,8 @@ public class StaffClerkInfoDTO implements Serializable{
private
String
enterpriseId
;
private
String
BrandName
;
private
String
enterpriseName
;
private
String
storeId
;
...
...
@@ -48,8 +51,6 @@ public class StaffClerkInfoDTO implements Serializable{
this
.
mainStoreFlag
=
mainStoreFlag
;
}
private
static
final
long
serialVersionUID
=
1L
;
public
String
getEnterpriseName
()
{
return
enterpriseName
;
}
...
...
@@ -122,6 +123,14 @@ public class StaffClerkInfoDTO implements Serializable{
this
.
enterpriseId
=
enterpriseId
==
null
?
null
:
enterpriseId
.
trim
();
}
public
String
getBrandName
()
{
return
BrandName
;
}
public
void
setBrandName
(
String
brandName
)
{
BrandName
=
brandName
;
}
public
String
getStoreId
()
{
return
storeId
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffClerkRelationDTO.java
View file @
804b58a8
...
...
@@ -3,8 +3,9 @@ package com.gic.haoban.manage.api.dto;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
StaffClerkRelationDTO
implements
Serializable
{
public
class
StaffClerkRelationDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
staffClerkRelationId
;
...
...
@@ -28,7 +29,8 @@ public class StaffClerkRelationDTO implements Serializable{
private
Date
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
private
String
storeName
;
private
String
staffName
;
public
String
getStaffClerkRelationId
()
{
return
staffClerkRelationId
;
...
...
@@ -118,4 +120,19 @@ public class StaffClerkRelationDTO implements Serializable{
this
.
updateTime
=
updateTime
;
}
public
String
getStoreName
()
{
return
storeName
;
}
public
void
setStoreName
(
String
storeName
)
{
this
.
storeName
=
storeName
;
}
public
String
getStaffName
()
{
return
staffName
;
}
public
void
setStaffName
(
String
staffName
)
{
this
.
staffName
=
staffName
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/AlertTypeEnum.java
0 → 100644
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
;
/**
* Created by hua on 2021/8/2.
*/
public
enum
AlertTypeEnum
{
QYWX_TAG_SYNC
(
1
,
"企微标签同步"
,
null
),
QUNFA_MESSAGE
(
2
,
"企微群发"
,
null
),
FRIEND_ADD
(
3
,
"企微好友添加"
,
null
),;
private
Integer
type
;
private
String
name
;
private
String
dingUrl
;
AlertTypeEnum
(
Integer
type
,
String
name
,
String
dingUrl
)
{
this
.
type
=
type
;
this
.
name
=
name
;
this
.
dingUrl
=
dingUrl
;
}
public
String
getDingUrl
()
{
return
dingUrl
;
}
public
void
setDingUrl
(
String
dingUrl
)
{
this
.
dingUrl
=
dingUrl
;
}
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
static
AlertTypeEnum
getEnum
(
int
type
)
{
AlertTypeEnum
[]
values
=
AlertTypeEnum
.
values
();
for
(
AlertTypeEnum
value
:
values
)
{
if
(
value
.
getType
()
==
type
)
{
return
value
;
}
}
return
null
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/AppPageType.java
View file @
804b58a8
...
...
@@ -35,16 +35,20 @@ public enum AppPageType {
//完善标签
PERFECT_TAG
(
15
,
"hbapp_customer_edit_tag"
),
//销售线索任务列表
MARKET_CLUE_TASK
(
16
,
"hbapp_sales_lead_main"
);
MARKET_CLUE_TASK
(
16
,
"hbapp_sales_lead_main"
),
//话务任务逾期提醒
TEL_WITHIN_TIME_LIMIT
(
17
,
"hbapp_marketing_task_list"
),
;
AppPageType
(
int
type
,
String
desc
){
AppPageType
(
int
type
,
String
desc
)
{
this
.
code
=
type
;
this
.
desc
=
desc
;
}
private
int
code
;
private
String
desc
;
public
static
String
getDescByCode
(
int
type
)
{
for
(
AppPageType
c
:
AppPageType
.
values
())
{
if
(
c
.
getCode
()
==
type
)
{
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/QuartzEnum.java
View file @
804b58a8
...
...
@@ -9,7 +9,12 @@ public enum QuartzEnum {
/**
* 企业微信
*/
HANDOVER_QYWX
(
"handover"
,
"com.gic.haoban.manage.api.service.HandoverOperationApiService"
,
"batchQywxHandoverTimeTask"
,
"0 0 0 * * *"
,
"-1"
);
HANDOVER_QYWX
(
"handover"
,
"com.gic.haoban.manage.api.service.HandoverOperationApiService"
,
"batchQywxHandoverTimeTask"
,
"0 0 0 * * *"
,
"-1"
),
TAG_QYWX
(
"qywxTagCheck"
,
"com.gic.haoban.manage.api.service.QywxTagApiService"
,
"checkQywxSync"
,
"0 30 10 * * *"
,
"-1"
),
/**
* 话务任务逾期提醒
*/
TEL_TASK_LATE_REMIND
(
"telTaskLateRemind"
,
"com.gic.haoban.task.manage.api.service.ITelTaskCallApiService"
,
"telTaskLateRemind"
,
"0 0 8 * * *"
,
"-1"
);
private
String
key
;
private
String
serviceName
;
private
String
method
;
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/QywxTagRelationSyncFlagEnum.java
0 → 100644
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
api
.
enums
;
/**
* Created by hua on 2021/7/27.
*/
public
enum
QywxTagRelationSyncFlagEnum
{
DEL
(
0
,
"删除"
),
PRE
(
1
,
"预处理"
),
SUCCESS
(
2
,
"成功"
),
FAIL
(
3
,
"失败"
);
private
int
type
;
private
String
name
;
QywxTagRelationSyncFlagEnum
(
int
type
,
String
name
)
{
this
.
type
=
type
;
this
.
name
=
name
;
}
public
int
getType
()
{
return
type
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/CheckQywxSettingApiService.java
View file @
804b58a8
...
...
@@ -30,4 +30,11 @@ public interface CheckQywxSettingApiService {
* @param dto
*/
public
void
saveFriendCallback
(
String
wxEnterpriseId
,
ExternalUserDTO
externalUserDTO
,
MemberUnionidRelatedDTO
dto
);
/**
* 告警 异步回调
*
* @param params
*/
public
void
alertCallback
(
String
params
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DealSyncOperationApiService.java
View file @
804b58a8
...
...
@@ -2,7 +2,6 @@ package com.gic.haoban.manage.api.service;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.PreDealLogInfoDTO
;
import
com.gic.haoban.manage.api.dto.SyncCheckDTO
;
import
com.gic.haoban.manage.api.dto.SyncSingleDealDTO
;
...
...
@@ -19,10 +18,11 @@ public interface DealSyncOperationApiService {
/**
* 部门同步处理
* "routerName": "departmentSyncDealMq"
*
* @param params
*/
public
void
departmentDealMq
(
String
params
);
void
departmentDealMq
(
String
params
);
/**
* 处理前端数据
...
...
@@ -30,14 +30,14 @@ public interface DealSyncOperationApiService {
* @param addList
* @param editList
*/
public
void
dealDepartment
(
String
taskId
,
String
wxEnterpriseId
,
List
<
SyncSingleDealDTO
>
addList
,
List
<
SyncSingleDealDTO
>
editList
);
void
dealDepartment
(
String
taskId
,
String
wxEnterpriseId
,
List
<
SyncSingleDealDTO
>
addList
,
List
<
SyncSingleDealDTO
>
editList
);
/**
* 重新执行任务
*
* @param taskId
*/
public
void
reDealDepartment
(
String
taskId
,
int
dataType
);
void
reDealDepartment
(
String
taskId
,
int
dataType
);
/**
* 创建任务
...
...
@@ -46,7 +46,7 @@ public interface DealSyncOperationApiService {
* @param userId
* @param desc
*/
public
String
createTask
(
String
wxEnterpriseId
,
String
taskName
,
String
userId
,
String
desc
);
String
createTask
(
String
wxEnterpriseId
,
String
taskName
,
String
userId
,
String
desc
);
/**
* 创建任务
...
...
@@ -55,7 +55,7 @@ public interface DealSyncOperationApiService {
* @param userId
* @param desc
*/
public
String
createQywxTask
(
String
wxEnterpriseId
,
String
taskName
,
String
userId
,
String
desc
);
String
createQywxTask
(
String
wxEnterpriseId
,
String
taskName
,
String
userId
,
String
desc
);
/**
* 关闭任务
...
...
@@ -63,7 +63,7 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
boolean
closeTask
(
String
wxEnterpriseId
);
boolean
closeTask
(
String
wxEnterpriseId
);
/**
...
...
@@ -71,7 +71,7 @@ public interface DealSyncOperationApiService {
*
* @param taskId
*/
public
void
unlockTask
(
String
taskId
);
void
unlockTask
(
String
taskId
);
/**
* 校验是否锁
...
...
@@ -79,7 +79,7 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
String
getTaskLock
(
String
wxEnterpriseId
);
String
getTaskLock
(
String
wxEnterpriseId
);
/**
* 校验同步状态
...
...
@@ -87,7 +87,7 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
SyncCheckDTO
getTaskCheck
(
String
wxEnterpriseId
);
SyncCheckDTO
getTaskCheck
(
String
wxEnterpriseId
);
/**
* 同步日志
...
...
@@ -95,7 +95,7 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
Page
<
SyncTaskDTO
>
listSyncTask
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
Page
<
SyncTaskDTO
>
listSyncTask
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
/**
* 同步日志
...
...
@@ -103,52 +103,60 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
Page
<
PreDealLogInfoDTO
>
listSyncTaskDetail
(
String
wxEnterpriseId
,
String
taskId
,
BasePageInfo
pageInfo
);
Page
<
PreDealLogInfoDTO
>
listSyncTaskDetail
(
String
wxEnterpriseId
,
String
taskId
,
BasePageInfo
pageInfo
);
/**
* 处理同步
*/
public
String
dealQywxDepartment
(
String
taskId
,
String
wxEnterpriseId
);
String
dealQywxDepartment
(
String
taskId
,
String
wxEnterpriseId
);
/**
* 清理不存在的数据
*
* @param wxEnterpriseId
* @param taskId
*/
public
void
cleanDiffrence
(
String
wxEnterpriseId
,
String
taskId
);
void
cleanDiffrence
(
String
wxEnterpriseId
,
String
taskId
);
/**
* 创建企业微信好友刷新任务
*
* @param wxEnterpriseId
* @param taskName
* @param staffId
* @param desc
* @return
*/
public
String
createWxFriendTask
(
String
wxEnterpriseId
,
String
taskName
,
String
staffId
,
String
desc
);
String
createWxFriendTask
(
String
wxEnterpriseId
,
String
taskName
,
String
staffId
,
String
desc
);
/**
* 处理需要处理的导购
*
* @param taskId
* @param wxEnterpriseId
*/
public
void
dealWxFriendClerk
(
String
taskId
,
String
wxEnterpriseId
);
void
dealWxFriendClerk
(
String
taskId
,
String
wxEnterpriseId
);
/**
* 创建企业微信好友刷新任务
*
* @param wxEnterpriseId
* @param taskName
* @param staffId
* @return
*/
public
String
createWxFriendTaskSingle
(
String
wxEnterpriseId
,
String
taskName
,
String
staffId
,
String
staffName
,
int
syncTaskType
);
String
createWxFriendTaskSingle
(
String
wxEnterpriseId
,
String
taskName
,
String
staffId
,
String
staffName
,
int
syncTaskType
);
/**
* 单个导购刷新
*
* @param taskId
* @param wxUserId
* @param staffId
* @param wxEnterpriseId
*/
public
void
dealWxFriendClerkSingle
(
String
taskId
,
String
wxUserId
,
String
staffId
,
String
wxEnterpriseId
);
void
dealWxFriendClerkSingle
(
String
taskId
,
String
wxUserId
,
String
staffId
,
String
wxEnterpriseId
);
/**
* 单个导购刷新
...
...
@@ -156,14 +164,15 @@ public interface DealSyncOperationApiService {
* @param taskId
* @param wxEnterpriseId
*/
public
void
dealWxFriendStore
(
String
taskId
,
String
storeId
,
String
wxEnterpriseId
);
void
dealWxFriendStore
(
String
taskId
,
String
storeId
,
String
wxEnterpriseId
);
/**
* 定时
*
* @param res
*/
@Deprecated
public
void
quartWxFriendClerk
(
String
res
);
void
quartWxFriendClerk
(
String
res
);
void
test
(
String
wxEnterpriseId
,
String
taskId
);
...
...
@@ -174,7 +183,7 @@ public interface DealSyncOperationApiService {
* @param staffId
* @return true 刷新中 false 没刷新或刷新完成
*/
public
boolean
getFreshFriendSyncTask
(
String
wxEnterpriseId
,
String
staffId
);
boolean
getFreshFriendSyncTask
(
String
wxEnterpriseId
,
String
staffId
);
/**
* 创建标签任务
...
...
@@ -182,7 +191,7 @@ public interface DealSyncOperationApiService {
* @param wxEnterpriseId
* @return
*/
public
String
createTagTask
(
String
wxEnterpriseId
,
String
addUser
,
String
memberTagId
);
String
createTagTask
(
String
wxEnterpriseId
,
String
addUser
,
String
memberTagId
);
/**
* 执行任务
...
...
@@ -192,5 +201,5 @@ public interface DealSyncOperationApiService {
* @param tagIds
* @param taskId
*/
public
void
dealTagTask
(
String
wxEnterpriseId
,
String
enterpriseId
,
List
<
String
>
tagIds
,
String
taskId
);
void
dealTagTask
(
String
wxEnterpriseId
,
String
enterpriseId
,
List
<
String
>
tagIds
,
String
taskId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/ExternalClerkRelatedApiService.java
View file @
804b58a8
...
...
@@ -106,6 +106,21 @@ public interface ExternalClerkRelatedApiService {
*/
Page
<
String
>
pageExternalByEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
,
BasePageInfo
pageInfo
);
/**
* 查询导购好友关联
*
* @param wxEnterpriseId : 微信企业id
* @return : 返回好友关联
*/
Page
<
String
>
pageExternalByEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
,
int
pageNum
,
int
pageSize
);
/**
* 获取企业下的关联关系的 memberIds
*
* @return
*/
List
<
String
>
listExternalClerkMemberIdsByMemberIds
(
String
wxEnterpriseId
,
List
<
String
>
memberIds
);
/**
* 获取企业下的关联关系列表
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MemberUnionidRelatedApiService.java
View file @
804b58a8
...
...
@@ -35,6 +35,7 @@ public interface MemberUnionidRelatedApiService {
/**
* 处理外部联系人异步
* "routerName": "dealQywxExternalUserMq"
*
* @param params
*/
...
...
@@ -44,15 +45,23 @@ public interface MemberUnionidRelatedApiService {
List
<
MemberUnionidRelatedDTO
>
getByWxUserIdAndWxEnterpriseId
(
String
wxUserId
,
String
wxEnterpriseId
);
List
<
MemberUnionidRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
);
List
<
MemberUnionidRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
);
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
);
/**
* 查看是否可以跳转会员详情的会员列表
*
* @param externalUserid
* @param wxUserId
* @param storeId
* @return
*/
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
,
String
storeId
);
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId1
,
String
storeId
);
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId1
,
String
storeId
);
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
);
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
);
public
void
cleanByCid
(
String
cid
);
void
cleanByCid
(
String
cid
);
Page
<
MemberUnionidRelatedDTO
>
pageMemberUnionByParams
(
List
<
String
>
userIdList
,
List
<
String
>
sendMemberIds
,
String
enterpriseId
,
BasePageInfo
pageInfo
);
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MessageApiService.java
View file @
804b58a8
...
...
@@ -7,22 +7,34 @@ import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
* Created by tgs on 2020/2/20.
*/
public
interface
MessageApiService
{
/**接收企业微信的推送消息*/
/**
* 接收企业微信的推送消息
*
* @param gicMessageDTO
*/
@Deprecated
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
);
/**接收企业微信的推送消息*/
/**
* 接收企业微信的推送消息
*
* @param qywxCallBackDTO
*/
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
);
/**
* 队列消费gic推送数据
*
* @param param
*/
@Deprecated
void
dealGicMessage
(
String
param
);
/**
* 队列消费企业微信推送数据
* @param param
*/
@Deprecated
void
dealWxMessage
(
String
param
);
/**
* 发送消费消息
...
...
@@ -33,9 +45,11 @@ public interface MessageApiService {
* @param storeId
* @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 memberName
...
...
@@ -43,5 +57,16 @@ public interface MessageApiService {
* @param orderId
* @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-api/src/main/java/com/gic/haoban/manage/api/service/QywxTagApiService.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.QywxTagCallbackDTO
;
import
com.gic.haoban.manage.api.dto.QywxTagInfoDTO
;
import
com.gic.haoban.manage.api.dto.QywxTagItemDTO
;
...
...
@@ -26,15 +27,23 @@ public interface QywxTagApiService {
* @param infoDTO 标签
* @param items 标签项
*/
public
void
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
);
public
ServiceResponse
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
);
/**
* 关闭同步
*
* @param wxEnterpriseId
* @param
tagRelation
Id
* @param
memberTag
Id
*/
public
void
closeSync
(
String
wxEnterpriseId
,
String
tagRelationId
);
public
ServiceResponse
closeSync
(
String
wxEnterpriseId
,
String
memberTagId
);
/**
* 删除gic标签项导致 并删除企业微信的数据
*
* @param wxEnterpriseId
* @param tagItemId
*/
public
ServiceResponse
delGicTagItem
(
String
wxEnterpriseId
,
String
tagItemId
);
/**
* 查询所有同步的标签
...
...
@@ -72,6 +81,85 @@ public interface QywxTagApiService {
* @param enterpriseId
* @param externalUserId
*/
public
void
syncFriendTagToQywxByExternalUserId
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
externalUserId
,
String
tagItemId
);
public
ServiceResponse
syncFriendTagToQywxByExternalUserId
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
externalUserId
,
List
<
String
>
tagItemIds
);
/**
* 同步企业微信导入gic的会员标签
*
* @param wxEnterpriseId
* @param externalUserId
* @return
*/
public
ServiceResponse
syncQywxTagToGicByExternalUserId
(
String
wxEnterpriseId
,
String
externalUserId
,
String
wxUserId
);
/**
* 更改状态
*
* @param memberTagId
* @param wxEnterpriseId
* @param status
*/
public
void
changeQywxTagStatus
(
String
memberTagId
,
String
wxEnterpriseId
,
int
status
);
/**
* 同步标签
*
* @param wxEnterpriseId
* @param enterpriseId
* @param memberTagIds
* @return
*/
public
boolean
saveRelation
(
String
wxEnterpriseId
,
String
enterpriseId
,
List
<
String
>
memberTagIds
);
/**
* 更新qywx的标签或者标签组名称
*
* @param wxEnterpriseId
* @param id (企业微信的对应的id)
* @param name
* @param type
* @return
*/
public
ServiceResponse
renameQywxTag
(
String
wxEnterpriseId
,
String
id
,
String
name
,
Integer
type
);
/**
* 根据会员标签id 拉取列表
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
public
List
<
QywxTagRelationDTO
>
listQywxTagRelationByMemberTagId
(
String
wxEnterpriseId
,
String
memberTagId
);
/**
* 根据会员标签关联id 查询关联信息
*
* @param relationId
* @return
*/
public
QywxTagRelationDTO
getQywxTagRelationByRelationId
(
String
relationId
);
/**
* 根据会员标签关联id 查询关联信息
*
* @param qywxTagId
* @return
*/
public
QywxTagInfoDTO
getQywxTagByQywxTagId
(
String
qywxTagId
);
/**
* 更新标签项 未同步状态 为同步状态
*
* @param tagItemId
* @return
*/
public
void
updateQywxTagRelationSyncStatusByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
);
/**
* 校验企业微信标签同步
*/
public
void
checkQywxSync
(
String
params
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffClerkRelationApiService.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
java.util.List
;
import
java.util.Set
;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
...
...
@@ -10,12 +7,16 @@ import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import
com.gic.haoban.manage.api.dto.StaffClerkInfoDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
java.util.List
;
import
java.util.Set
;
public
interface
StaffClerkRelationApiService
{
/**
* 绑定日志
*
* @param params
*/
public
void
bindLogMq
(
String
params
);
void
bindLogMq
(
String
params
);
List
<
StaffClerkRelationDTO
>
listBindCode
(
String
enterpriseId
,
Set
<
String
>
clerkCodeList
);
...
...
@@ -30,9 +31,10 @@ public interface StaffClerkRelationApiService {
/**
* 绑定
*
* @return
*/
public
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
);
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
);
StaffClerkRelationDTO
getByCodeAndEnterpriseId
(
String
clerkCode
,
String
enterpriseId
);
...
...
@@ -96,40 +98,49 @@ public interface StaffClerkRelationApiService {
/**
* 搜索查询列表
*
* @param wxEnterpriseId
* @param search
* @param enterpriseId
* @param optType
* @return
*/
public
Page
<
StaffClerkBindLogDetailDTO
>
pageStaffClerkBindLog
(
String
wxEnterpriseId
,
String
search
,
String
enterpriseId
,
int
optType
,
BasePageInfo
pageInfo
);
Page
<
StaffClerkBindLogDetailDTO
>
pageStaffClerkBindLog
(
String
wxEnterpriseId
,
String
search
,
String
enterpriseId
,
int
optType
,
BasePageInfo
pageInfo
);
/**
* 追加到绑定日志
*
* @param staffId
* @param optStaffId
* @param optType
* @param channelCode
* @param relationId
*/
public
void
pushToBindLog
(
String
staffId
,
String
optStaffId
,
int
optType
,
int
channelCode
,
String
relationId
);
void
pushToBindLog
(
String
staffId
,
String
optStaffId
,
int
optType
,
int
channelCode
,
String
relationId
);
/**
* 获取config
*
* @param clerkId
* @param memberId
* @return
*/
ServiceResponse
<
String
>
getClerkMemberChatConfig
(
String
clerkId
);
/**
*
* @Description 方法描述:
* @return 返回值类型: <pre>
* @author 作者: WQ <pre>
* @date 时间: 2020年12月24日 上午11:21:38 <pre>
* @param wxEnterpriseId: <pre>
* @param pageInfo: <pre>
* @Description 方法描述:
*/
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
/**
* 查询状态正常导购
* @return
*/
public
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
List
<
StaffClerkRelationDTO
>
listAll
(
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffDepartmentRelatedApiService.java
View file @
804b58a8
...
...
@@ -5,6 +5,7 @@ import java.util.Map;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
public
interface
StaffDepartmentRelatedApiService
{
List
<
StaffDepartmentRelatedDTO
>
listByDepartmentId
(
String
departmentId
);
...
...
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/controller/test/TestDataImportController.java
View file @
804b58a8
...
...
@@ -133,6 +133,7 @@ public class TestDataImportController extends WebBaseController {
}
BasePageInfo
basePageInfo
=
new
BasePageInfo
();
basePageInfo
.
setPageSize
(
2000
);
int
num
=
1
;
Page
<
MarketClueTaskDTO
>
page
=
iMarketClueTaskApiService
.
pageMarketClueTaskDTO
(
ecmId
,
enterpriseId
,
basePageInfo
);
while
(
CollectionUtils
.
isNotEmpty
(
page
.
getResult
()))
{
page
.
getResult
().
forEach
(
dto
->
{
...
...
@@ -143,6 +144,8 @@ public class TestDataImportController extends WebBaseController {
iMarketTaskMemberApiService
.
detailsRefresh
(
enterpriseId
,
dto
.
getTaskId
(),
true
);
}
});
num
++;
basePageInfo
.
setPageNum
(
num
);
page
=
iMarketClueTaskApiService
.
pageMarketClueTaskDTO
(
ecmId
,
enterpriseId
,
basePageInfo
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/QywxTagItemMapper.java
View file @
804b58a8
...
...
@@ -67,4 +67,22 @@ public interface QywxTagItemMapper {
* @return
*/
TabQywxTagItem
getByQywxTagKey
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"qywxTagKey"
)
String
qywxTagKey
);
/**
* 根据id 获取标签项信息
*
* @param wxEnterpriseId
* @param ids
* @return
*/
List
<
TabQywxTagItem
>
listByQywxTagItemsIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"ids"
)
List
<
String
>
ids
);
/**
* 根据id 获取标签项信息
*
* @param wxEnterpriseId
* @param qywxTagKeys
* @return
*/
List
<
TabQywxTagItem
>
listByQywxTagItemsKeys
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"qywxTagKeys"
)
List
<
String
>
qywxTagKeys
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/QywxTagRelationMapper.java
View file @
804b58a8
...
...
@@ -49,6 +49,16 @@ public interface QywxTagRelationMapper {
*/
List
<
TabQywxTagRelation
>
listByMemberTagId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"memberTagId"
)
String
memberTagId
);
/**
* 查询企业下所有同步的 根据tagItemId
*
* @param wxEnterpriseId
* @param tagItemId
* @return
*/
TabQywxTagRelation
getQywxTagRelationByTagItemId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"tagItemId"
)
String
tagItemId
);
/**
* 删除同步信息
*
...
...
@@ -85,4 +95,13 @@ public interface QywxTagRelationMapper {
* @return
*/
TabQywxTagRelation
getQywxTagByQywxTagItemId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"qywxTagItemId"
)
String
qywxTagItemId
);
/**
* 更新标签同步状态
*
* @param wxEnterpriseId
* @param memberTagId
* @return
*/
int
changeRelationSyncFlag
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"memberTagId"
)
String
memberTagId
,
@Param
(
"syncFlag"
)
Integer
syncFlag
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
View file @
804b58a8
...
...
@@ -161,11 +161,21 @@ public interface TabHaobanExternalClerkRelatedMapper {
/**
* 查询会员在企业下的好友关系 根据会员ids
*
* @param memberId
* @param memberIds
* @param wxEnterpriseId
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByMemberIds
(
@Param
(
"memberIds"
)
List
<
String
>
memberIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
* 查询会员在企业下的好友关系memberIds 根据会员ids
*
* @param memberIds
* @param wxEnterpriseId
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByMemberIds
(
@Param
(
"memberIds"
)
List
<
String
>
memberId
,
List
<
String
>
listMemberIdsByMemberIds
(
@Param
(
"memberIds"
)
List
<
String
>
memberIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
...
...
@@ -175,4 +185,12 @@ public interface TabHaobanExternalClerkRelatedMapper {
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByMemberId
(
@Param
(
"memberId"
)
String
memberId
);
/**
* 查询会员在企业下的好友关系 根据会员id
*
* @param wxEnterpriseId
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByExternalUserId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"externalUserId"
)
String
externalUserId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanStaffClerkRelationMapper.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
import
java.util.List
;
import
java.util.Set
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
TabHaobanStaffClerkRelationMapper
{
int
deleteByPrimaryKey
(
String
staffClerkRelationId
);
...
...
@@ -25,14 +24,16 @@ public interface TabHaobanStaffClerkRelationMapper {
List
<
TabHaobanStaffClerkRelation
>
listBindCodeByStaffId
(
@Param
(
"enterpriseIdList"
)
List
<
String
>
enterpriseIdList
,
@Param
(
"staffId"
)
String
staffId
);
TabHaobanStaffClerkRelation
getOneByClerkId
(
@Param
(
"clerkId"
)
String
clerkId
);
TabHaobanStaffClerkRelation
getOneByClerkId
(
@Param
(
"clerkId"
)
String
clerkId
);
/**
* 改变状态 格局clerkId
*
* @param clerkId
* @param status
* @return
*/
public
int
changeStatusByClerkId
(
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"status"
)
Integer
status
);
int
changeStatusByClerkId
(
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"status"
)
Integer
status
);
/**
* 更新信息
...
...
@@ -117,7 +118,18 @@ public interface TabHaobanStaffClerkRelationMapper {
/**
* 已使用的门店id列表
*
* @param enterpriseId
*/
List
<
TabHaobanStaffClerkRelation
>
listBindStoreIdByEnterpriseId
(
String
enterpriseId
);
/**
* 列出所有
*
* @return {@link List<TabHaobanStaffClerkRelation> }
* @author xuwenqian
* @date 2021-07-15 16:24:27
*/
List
<
StaffClerkRelationDTO
>
listAll
();
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanStoreRelationMapper.java
View file @
804b58a8
...
...
@@ -80,4 +80,12 @@ public interface TabHaobanStoreRelationMapper {
* @return
*/
List
<
String
>
listStoreIdByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
/**
* 更新门店名称
*
* @param enterpriseId
* @return
*/
public
int
updateStoreName
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"storeId"
)
String
storeId
,
@Param
(
"storeName"
)
String
storeName
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/QywxSyncTagFormatPojo.java
0 → 100644
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
pojo
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* Created 2021/7/28.
*
* @author hua
*/
public
class
QywxSyncTagFormatPojo
implements
Serializable
{
/**
* 企业微信与gic标签项对应map
*/
private
Map
<
String
,
String
>
qywxToGicTagItemIdMap
;
/**
* gic与企业微信标签项对应map
*/
private
Map
<
String
,
String
>
gicToQywxTagItemIdMap
;
/**
* 商户对应的企业微信标签列表
*/
private
Map
<
String
,
Set
<
String
>>
entQywxTagKeysMap
;
/**
* 商户对应的gic标签列表
*/
private
Map
<
String
,
Set
<
String
>>
entGicTagItemIdMap
;
public
Map
<
String
,
String
>
getQywxToGicTagItemIdMap
()
{
return
qywxToGicTagItemIdMap
;
}
public
void
setQywxToGicTagItemIdMap
(
Map
<
String
,
String
>
qywxToGicTagItemIdMap
)
{
this
.
qywxToGicTagItemIdMap
=
qywxToGicTagItemIdMap
;
}
public
Map
<
String
,
String
>
getGicToQywxTagItemIdMap
()
{
return
gicToQywxTagItemIdMap
;
}
public
void
setGicToQywxTagItemIdMap
(
Map
<
String
,
String
>
gicToQywxTagItemIdMap
)
{
this
.
gicToQywxTagItemIdMap
=
gicToQywxTagItemIdMap
;
}
public
Map
<
String
,
Set
<
String
>>
getEntQywxTagKeysMap
()
{
return
entQywxTagKeysMap
;
}
public
void
setEntQywxTagKeysMap
(
Map
<
String
,
Set
<
String
>>
entQywxTagKeysMap
)
{
this
.
entQywxTagKeysMap
=
entQywxTagKeysMap
;
}
public
Map
<
String
,
Set
<
String
>>
getEntGicTagItemIdMap
()
{
return
entGicTagItemIdMap
;
}
public
void
setEntGicTagItemIdMap
(
Map
<
String
,
Set
<
String
>>
entGicTagItemIdMap
)
{
this
.
entGicTagItemIdMap
=
entGicTagItemIdMap
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/QywxTagSyncInfoPojo.java
0 → 100644
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
pojo
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* Created 2021/7/19.
*
* @author hua
*/
public
class
QywxTagSyncInfoPojo
implements
Serializable
{
/**
* 任务id
*/
private
String
taskId
;
/**
* 任务类型 0标签同步 1会员标签同步
* #taskTypeEnum
*/
private
int
taskType
;
/**
* 数据id 对应memberId
*/
private
String
dataId
;
/**
* 同步类型
*/
private
int
syncType
;
private
Integer
times
=
0
;
/**
* 批量导入时
*/
private
List
<
String
>
memberIds
;
/**
* 非必传
*/
private
String
wxEnterpriseId
;
/**
* 非必传
*/
private
String
enterpriseId
;
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
List
<
String
>
getMemberIds
()
{
return
memberIds
;
}
public
void
setMemberIds
(
List
<
String
>
memberIds
)
{
this
.
memberIds
=
memberIds
;
}
public
int
getSyncType
()
{
return
syncType
;
}
public
void
setSyncType
(
int
syncType
)
{
this
.
syncType
=
syncType
;
}
/**
* 同步的id
*/
private
Integer
syncLogId
;
public
Integer
getTimes
()
{
return
times
;
}
public
void
setTimes
(
Integer
times
)
{
this
.
times
=
times
;
}
public
Integer
getSyncLogId
()
{
return
syncLogId
;
}
public
void
setSyncLogId
(
Integer
syncLogId
)
{
this
.
syncLogId
=
syncLogId
;
}
public
String
getTaskId
()
{
return
taskId
;
}
public
void
setTaskId
(
String
taskId
)
{
this
.
taskId
=
taskId
;
}
public
int
getTaskType
()
{
return
taskType
;
}
public
void
setTaskType
(
int
taskType
)
{
this
.
taskType
=
taskType
;
}
public
String
getDataId
()
{
return
dataId
;
}
public
void
setDataId
(
String
dataId
)
{
this
.
dataId
=
dataId
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/StoreSyncPojo.java
View file @
804b58a8
...
...
@@ -23,10 +23,31 @@ public class StoreSyncPojo extends BinlogBasePojo {
@JSONField
(
name
=
"enterprise_id"
)
private
String
enterpriseId
;
@JSONField
(
name
=
"store_name"
)
private
String
storeName
;
private
String
oldStoreName
;
private
Integer
status
;
private
Integer
oldStatus
;
public
String
getStoreName
()
{
return
storeName
;
}
public
void
setStoreName
(
String
storeName
)
{
this
.
storeName
=
storeName
;
}
public
String
getOldStoreName
()
{
return
oldStoreName
;
}
public
void
setOldStoreName
(
String
oldStoreName
)
{
this
.
oldStoreName
=
oldStoreName
;
}
public
String
getOldStoreGroupId
()
{
return
oldStoreGroupId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/ExternalClerkRelatedService.java
View file @
804b58a8
...
...
@@ -49,4 +49,13 @@ public interface ExternalClerkRelatedService {
*/
List
<
TabHaobanExternalClerkRelated
>
listExternalByUnionId
(
String
enterpriseId
,
String
unionId
);
/**
* 根据externalUserid获取外部联系人的绑定导购
*
* @param wxEnterpriseId
* @param externalUserid
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listExternalByExternalUserid
(
String
wxEnterpriseId
,
String
externalUserid
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/QywxTagService.java
View file @
804b58a8
...
...
@@ -112,6 +112,14 @@ public interface QywxTagService {
public
List
<
TabQywxTagRelation
>
listQywxTagRelationByMemberTagId
(
String
wxEnterpriseId
,
String
memberTagId
);
/**
* 根据tagItemId 查询
*
* @param tagItemId
* @return
*/
public
TabQywxTagRelation
getQywxTagRelationByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
);
/**
* 根据qywxTagId查询
*
* @param qywxTagId
...
...
@@ -156,6 +164,62 @@ public interface QywxTagService {
*/
public
TabQywxTagRelation
getQywxTagRelationByQywxKey
(
String
wxEnterpriseId
,
String
key
,
Integer
qywxTagRelationType
);
/**
* 根据企业微信的标签项获取 标签项列表
*
* @param wxEnterpriseId
* @param ids
* @return
*/
public
List
<
TabQywxTagItem
>
listQywxTagItemByIds
(
String
wxEnterpriseId
,
List
<
String
>
ids
);
/**
* 根据企业微信的标签项获取 标签项列表
*
* @param wxEnterpriseId
* @param keys
* @return
*/
public
List
<
TabQywxTagItem
>
listQywxTagItemByKeys
(
String
wxEnterpriseId
,
List
<
String
>
keys
);
/**
* 变更状态
*
* @param id
* @param status
*/
public
void
changeTagRelationStatus
(
String
id
,
int
status
);
/**
* 根据企业微信的标签项获取 标签项
*
* @param wxEnterpriseId
* @param id
* @return
*/
public
TabQywxTagItem
getQywxTagItemById
(
String
wxEnterpriseId
,
String
id
);
/**
* 更新名称
*
* @return
*/
public
boolean
saveQywxTagOrTagItemName
(
String
id
,
String
name
,
Integer
relationType
);
/**
* 更新名称
*
* @return
*/
public
boolean
changeRelationSyncFlagByMemberTagId
(
String
wxEnterpriseId
,
String
memberTagId
,
Integer
syncFlag
);
/**
* 更新状态
*
* @return
*/
public
boolean
changeRelationSyncFlagByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
,
Integer
syncFlag
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffClerkRelationService.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
import
java.util.List
;
import
java.util.Set
;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
public
interface
StaffClerkRelationService
{
...
...
@@ -20,10 +17,11 @@ public interface StaffClerkRelationService {
/**
* 删除绑定
*
* @param clerkId
* @return
*/
public
boolean
delBind
(
String
clerkId
,
String
optStaffId
,
int
chanelCode
);
boolean
delBind
(
String
clerkId
,
String
optStaffId
,
int
chanelCode
);
/**
* 删除绑定
...
...
@@ -32,7 +30,7 @@ public interface StaffClerkRelationService {
* @param storeIds
* @return
*/
public
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
boolean
delBindByStoreIds
(
String
wxEnterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
/**
* 删除绑定
...
...
@@ -42,35 +40,37 @@ public interface StaffClerkRelationService {
* @param storeIds 解除除了这些门店之外的绑定的门店
* @return
*/
public
boolean
delBindNotInStoreIds
(
String
wxEnterpriseId
,
String
enterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
boolean
delBindNotInStoreIds
(
String
wxEnterpriseId
,
String
enterpriseId
,
Set
<
String
>
storeIds
,
String
optStaffId
,
int
chanelCode
);
/**
* 绑定
*
* @param dto
* @return
*/
public
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chanelCode
);
String
bind
(
StaffClerkRelationDTO
dto
,
String
optStaffId
,
int
chanelCode
);
/**
* 根据clerkId 更新数据
* @param dto
* @return
*/
public
boolean
updateByClerkId
(
StaffClerkRelationDTO
dto
);
boolean
updateByClerkId
(
StaffClerkRelationDTO
dto
);
/**
* 查询绑定根据clerkId
*
* @param clerkId
* @param wxEnterpriseId
* @return
*/
public
StaffClerkRelationDTO
getBindByClerkId
(
String
clerkId
,
String
wxEnterpriseId
);
StaffClerkRelationDTO
getBindByClerkId
(
String
clerkId
,
String
wxEnterpriseId
);
StaffClerkRelationDTO
getByCodeAndEnterpriseId
(
String
clerkCode
,
String
enterpriseId
);
String
insert
(
StaffClerkRelationDTO
staffClerkRelation
);
public
int
cleanStaffClerk
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
int
cleanStaffClerk
(
String
wxEnterpriseId
,
List
<
String
>
staffIds
);
StaffClerkRelationDTO
getOneBindCodeNoStatus
(
String
enterpriseId
,
String
clerkCode
);
...
...
@@ -86,15 +86,15 @@ public interface StaffClerkRelationService {
* 保存
* @param memberClerkChatConfig
*/
public
void
saveChatConfig
(
MemberClerkChatConfig
memberClerkChatConfig
);
void
saveChatConfig
(
MemberClerkChatConfig
memberClerkChatConfig
);
/**
*
* @param staffId
* @param memberId
* @return
*/
public
MemberClerkChatConfig
getChatConfig
(
String
staffId
,
String
memberId
);
MemberClerkChatConfig
getChatConfig
(
String
staffId
,
String
memberId
);
/**
* 根据企业查询
* @param wxEnterpriseId
...
...
@@ -121,5 +121,14 @@ public interface StaffClerkRelationService {
*/
List
<
StaffClerkRelationDTO
>
listBindStoreIdByEnterpriseId
(
String
enterpriseId
);
/**
* 查询所有正常导购
*
* @return {@link List<StaffClerkRelationDTO> }
* @author xuwenqian
* @date 2021-07-15 16:26:17
*/
List
<
StaffClerkRelationDTO
>
listAll
();
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StoreRangeService.java
View file @
804b58a8
...
...
@@ -96,5 +96,13 @@ public interface StoreRangeService {
*/
public
List
<
String
>
listStoreIdByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
);
/**
* 更新门店名称
*
* @param enterpriseId
* @param storeId
* @param storeName
*/
public
void
updatwStoreName
(
String
enterpriseId
,
String
storeId
,
String
storeName
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseService.java
View file @
804b58a8
...
...
@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
java.util.List
;
public
interface
WxEnterpriseService
{
String
add
(
WxEnterpriseDTO
wxDTO
);
...
...
@@ -30,4 +32,11 @@ public interface WxEnterpriseService {
int
unbind
(
String
wxEnterpriseId
);
TabHaobanWxEnterprise
getEnterpriseBycorpIdNoStatus
(
String
corpid
);
/**
* 所有企业微信
*
* @return
*/
List
<
TabHaobanWxEnterprise
>
listAll
();
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/ExternalClerkRelatedServiceImpl.java
View file @
804b58a8
...
...
@@ -105,4 +105,9 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
public
List
<
TabHaobanExternalClerkRelated
>
listExternalByUnionId
(
String
enterpriseId
,
String
unionId
)
{
return
mapper
.
listExternalByUnionId
(
enterpriseId
,
unionId
);
}
@Override
public
List
<
TabHaobanExternalClerkRelated
>
listExternalByExternalUserid
(
String
wxEnterpriseId
,
String
externalUserid
)
{
return
mapper
.
listByExternalUserId
(
wxEnterpriseId
,
externalUserid
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/QywxTagServiceImpl.java
View file @
804b58a8
...
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.impl;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.manage.api.dto.QywxTagInfoDTO
;
import
com.gic.haoban.manage.api.dto.QywxTagItemDTO
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationSyncFlagEnum
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationTypeEnum
;
import
com.gic.haoban.manage.service.dao.mapper.QywxTagItemMapper
;
import
com.gic.haoban.manage.service.dao.mapper.QywxTagMapper
;
...
...
@@ -11,6 +12,7 @@ import com.gic.haoban.manage.service.entity.TabQywxTag;
import
com.gic.haoban.manage.service.entity.TabQywxTagItem
;
import
com.gic.haoban.manage.service.entity.TabQywxTagRelation
;
import
com.gic.haoban.manage.service.service.QywxTagService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.QywxTagDTO
;
import
com.gic.wechat.api.dto.qywx.QywxTagGroupDTO
;
import
org.apache.commons.lang3.tuple.Pair
;
...
...
@@ -60,6 +62,8 @@ public class QywxTagServiceImpl implements QywxTagService {
@Override
public
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
saveQywxTagByQywxGroupKey
(
String
wxEnterpriseId
,
QywxTagGroupDTO
groupDTO
)
{
String
lockKey
=
"group-add-"
+
groupDTO
.
getGroupId
();
RedisUtil
.
lock
(
lockKey
,
3L
);
//判断保存 分组
TabQywxTag
qywxTag
=
this
.
getQywxTagByQywxGroupKey
(
wxEnterpriseId
,
groupDTO
.
getGroupId
());
if
(
null
==
qywxTag
)
{
...
...
@@ -115,6 +119,7 @@ public class QywxTagServiceImpl implements QywxTagService {
}
items
.
add
(
qywxTagItem
);
}
RedisUtil
.
unlock
(
lockKey
);
return
Pair
.
of
(
qywxTag
,
items
);
}
...
...
@@ -169,6 +174,11 @@ public class QywxTagServiceImpl implements QywxTagService {
}
@Override
public
TabQywxTagRelation
getQywxTagRelationByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
)
{
return
qywxTagRelationMapper
.
getQywxTagRelationByTagItemId
(
wxEnterpriseId
,
tagItemId
);
}
@Override
public
List
<
TabQywxTagRelation
>
listQywxTagRelationByQywxTagId
(
String
wxEnterpriseId
,
String
qywxTagId
)
{
List
<
TabQywxTagRelation
>
ret
=
qywxTagRelationMapper
.
listByQywxTagId
(
wxEnterpriseId
,
qywxTagId
);
return
ret
;
...
...
@@ -205,4 +215,68 @@ public class QywxTagServiceImpl implements QywxTagService {
return
qywxTagRelationMapper
.
getQywxTagByQywxTagItemId
(
wxEnterpriseId
,
qywxTagItem
.
getQywxTagItemId
());
}
}
@Override
public
List
<
TabQywxTagItem
>
listQywxTagItemByIds
(
String
wxEnterpriseId
,
List
<
String
>
ids
)
{
return
qywxTagItemMapper
.
listByQywxTagItemsIds
(
wxEnterpriseId
,
ids
);
}
@Override
public
List
<
TabQywxTagItem
>
listQywxTagItemByKeys
(
String
wxEnterpriseId
,
List
<
String
>
keys
)
{
return
qywxTagItemMapper
.
listByQywxTagItemsKeys
(
wxEnterpriseId
,
keys
);
}
@Override
public
void
changeTagRelationStatus
(
String
id
,
int
status
)
{
TabQywxTagRelation
tabQywxTagRelation
=
new
TabQywxTagRelation
();
tabQywxTagRelation
.
setQywxTagRelationId
(
id
);
tabQywxTagRelation
.
setStatusFlag
(
status
);
tabQywxTagRelation
.
setUpdateTime
(
new
Date
());
qywxTagRelationMapper
.
updateByPrimaryKeySelective
(
tabQywxTagRelation
);
}
@Override
public
TabQywxTagItem
getQywxTagItemById
(
String
wxEnterpriseId
,
String
id
)
{
return
qywxTagItemMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
boolean
saveQywxTagOrTagItemName
(
String
id
,
String
name
,
Integer
relationType
)
{
if
(
relationType
==
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
())
{
TabQywxTag
tabQywxTag
=
new
TabQywxTag
();
tabQywxTag
.
setQywxTagId
(
id
);
tabQywxTag
.
setQywxGroupName
(
name
);
tabQywxTag
.
setUpdateTime
(
new
Date
());
qywxTagMapper
.
updateByPrimaryKeySelective
(
tabQywxTag
);
}
else
if
(
relationType
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
())
{
TabQywxTagItem
tabQywxTagItem
=
new
TabQywxTagItem
();
tabQywxTagItem
.
setQywxTagItemId
(
id
);
tabQywxTagItem
.
setQywxTagName
(
name
);
tabQywxTagItem
.
setUpdateTime
(
new
Date
());
qywxTagItemMapper
.
updateByPrimaryKeySelective
(
tabQywxTagItem
);
}
return
true
;
}
@Override
public
boolean
changeRelationSyncFlagByMemberTagId
(
String
wxEnterpriseId
,
String
memberTagId
,
Integer
syncFlag
)
{
if
(
syncFlag
==
QywxTagRelationSyncFlagEnum
.
DEL
.
getType
()
||
syncFlag
==
QywxTagRelationSyncFlagEnum
.
FAIL
.
getType
())
{
this
.
closeSync
(
wxEnterpriseId
,
memberTagId
);
return
true
;
}
qywxTagRelationMapper
.
changeRelationSyncFlag
(
wxEnterpriseId
,
memberTagId
,
syncFlag
);
return
true
;
}
@Override
public
boolean
changeRelationSyncFlagByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
,
Integer
syncFlag
)
{
TabQywxTagRelation
qywxTagRelation
=
qywxTagRelationMapper
.
getQywxTagRelationByTagItemId
(
wxEnterpriseId
,
tagItemId
);
if
(
null
==
qywxTagRelation
)
{
return
true
;
}
qywxTagRelation
.
setSyncFlag
(
syncFlag
);
qywxTagRelation
.
setUpdateTime
(
new
Date
());
qywxTagRelationMapper
.
updateByPrimaryKeySelective
(
qywxTagRelation
);
return
true
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffClerkRelationServiceImpl.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanMemberClerkChatConfigMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.StaffClerkBindLogService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.wechat.api.dto.qywx.QywxExternalcontactDTO
;
import
com.gic.haoban.manage.service.service.*
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
javafx.scene.control.Tab
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -31,14 +24,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
StaffClerkRelationServiceImpl
implements
StaffClerkRelationService
{
...
...
@@ -293,4 +280,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
return
EntityUtil
.
changeEntityListNew
(
StaffClerkRelationDTO
.
class
,
clerkRelations
);
}
@Override
public
List
<
StaffClerkRelationDTO
>
listAll
()
{
return
mapper
.
listAll
();
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StoreRangeServiceImpl.java
View file @
804b58a8
...
...
@@ -262,4 +262,9 @@ public class StoreRangeServiceImpl implements StoreRangeService {
public
List
<
String
>
listStoreIdByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
return
tabHaobanStoreRelationMapper
.
listStoreIdByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
}
@Override
public
void
updatwStoreName
(
String
enterpriseId
,
String
storeId
,
String
storeName
)
{
tabHaobanStoreRelationMapper
.
updateStoreName
(
enterpriseId
,
storeId
,
storeName
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseServiceImpl.java
View file @
804b58a8
...
...
@@ -89,4 +89,9 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
return
null
;
}
@Override
public
List
<
TabHaobanWxEnterprise
>
listAll
()
{
List
<
TabHaobanWxEnterprise
>
ret
=
mapper
.
listAll
();
return
ret
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/AuditApiServiceImpl.java
View file @
804b58a8
...
...
@@ -173,6 +173,10 @@ public class AuditApiServiceImpl implements AuditApiService{
String
oldValue
=
tab
.
getOldValue
();
String
newValue
=
tab
.
getNewValue
();
String
changeField
=
tab
.
getChangeField
();
StoreDTO
store
=
storeService
.
getStore
(
storeId
);
if
(
store
!=
null
)
{
return
"门店不存在"
;
}
this
.
editStoreInfo
(
storeId
,
changeField
,
oldValue
,
newValue
);
//发送消息
String
title
=
"门店信息修改通知"
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/CheckQywxSettingApiServiceImpl.java
View file @
804b58a8
...
...
@@ -3,13 +3,14 @@ package com.gic.haoban.manage.service.service.out.impl;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.
haoban.manage.api.dto.CheckFriendSetting
DTO
;
import
com.gic.
haoban.manage.api.dto.ExternalUserDTO
;
import
com.gic.haoban.manage.api.dto.
MemberUnionidRelatedDTO
;
import
com.gic.haoban.manage.api.
dto.WxEnterpriseDTO
;
import
com.gic.
enterprise.api.dto.Enterprise
DTO
;
import
com.gic.
enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.manage.api.dto.
*
;
import
com.gic.haoban.manage.api.
enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RMap
;
...
...
@@ -18,9 +19,7 @@ import org.slf4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -47,6 +46,9 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
EnterpriseService
enterpriseService
;
@Override
public
void
setFriendSetting
(
String
wxEnterpriseId
,
String
name
)
{
CheckFriendSettingDTO
checkFriendSettingDTO
=
new
CheckFriendSettingDTO
();
...
...
@@ -124,4 +126,68 @@ public class CheckQywxSettingApiServiceImpl implements CheckQywxSettingApiServic
String
post
=
HttpUtil
.
post
(
ALERT_URL
,
JSONObject
.
toJSONString
(
map
));
logger
.
info
(
"alert:{}"
,
post
);
}
@Override
public
void
alertCallback
(
String
params
)
{
logger
.
info
(
"告警:{}"
,
params
);
AlertMessageDTO
messageDTO
=
JSONObject
.
parseObject
(
params
,
AlertMessageDTO
.
class
);
if
(
null
==
messageDTO
)
{
return
;
}
//告警是否拦截重复告警 防止批量触发
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getKey
()))
{
RBucket
<
Object
>
bucket
=
RedisUtil
.
getRedisClient
().
getBucket
(
messageDTO
.
getKey
());
boolean
b
=
bucket
.
trySet
(
1
,
60L
,
TimeUnit
.
SECONDS
);
if
(!
b
)
{
return
;
}
}
Map
<
String
,
Object
>
dingMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
markdownMap
=
new
HashMap
<>();
dingMap
.
put
(
"msgtype"
,
"markdown"
);
dingMap
.
put
(
"markdown"
,
markdownMap
);
String
text
=
""
;
String
dingUrl
=
ALERT_URL
;
AlertTypeEnum
anEnum
=
AlertTypeEnum
.
getEnum
(
messageDTO
.
getAlertType
());
if
(
anEnum
!=
null
)
{
markdownMap
.
put
(
"title"
,
anEnum
.
getName
()
+
"-"
+
messageDTO
.
getAlertTitle
());
text
+=
"标题:"
+
anEnum
.
getName
()
+
"-"
+
messageDTO
.
getAlertTitle
()
+
"\n\r"
;
if
(
anEnum
.
getDingUrl
()
!=
null
)
{
dingUrl
=
anEnum
.
getDingUrl
();
}
}
else
{
markdownMap
.
put
(
"title"
,
messageDTO
.
getAlertTitle
());
text
+=
"标题:"
+
messageDTO
.
getAlertTitle
()
+
"\n\r"
;
}
//企业信息
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getWxEnterpriseId
()))
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
messageDTO
.
getWxEnterpriseId
());
text
+=
"企业:"
+
wxEnterpriseDTO
.
getCorpName
()
+
"\n\r"
;
}
// 商户信息
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getEnterpriseId
()))
{
EnterpriseDTO
enterpriseDTO
=
enterpriseService
.
getEnterpriseById
(
messageDTO
.
getEnterpriseId
());
text
+=
"商户:"
+
enterpriseDTO
.
getEnterpriseName
()
+
"("
+
enterpriseDTO
.
getBrandName
()
+
")\n\r"
;
}
Map
<
String
,
Object
>
contentMap
=
messageDTO
.
getContentMap
();
if
(
MapUtils
.
isNotEmpty
(
contentMap
))
{
Set
<
String
>
keySet
=
contentMap
.
keySet
();
for
(
String
k
:
keySet
)
{
Object
o
=
contentMap
.
get
(
k
);
text
+=
k
+
":"
+
o
+
"\n\r"
;
}
}
if
(
StringUtils
.
isNotBlank
(
messageDTO
.
getTraceId
()))
{
String
traceUrl
=
"http://10.105.8.172:8780/damo-stats/mongodb/getLogMessagesView?trace_id="
+
messageDTO
.
getTraceId
();
text
+=
"链路:["
+
messageDTO
.
getTraceId
()
+
"]("
+
traceUrl
+
")"
;
}
markdownMap
.
put
(
"text"
,
text
);
String
post
=
HttpUtil
.
post
(
dingUrl
,
JSONObject
.
toJSONString
(
dingMap
));
logger
.
info
(
"alert:{}"
,
post
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/ExternalClerkRelatedApiServiceImpl.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum
;
import
com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
...
...
@@ -13,6 +17,8 @@ import com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper
;
import
com.gic.haoban.manage.service.entity.MemberUnionidRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -133,9 +139,35 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
memberUnionidRelatedMapper
.
updateByPrimaryKeySelective
(
memberUnionidRelated
);
resp
.
setResult
(
EntityUtil
.
changeEntityNew
(
ExternalClerkRelatedDTO
.
class
,
externalClerkRelated
));
pushTagSync
(
memberId
,
externalClerkRelated
.
getWxEnterpriseId
(),
enterpriseId
);
return
resp
;
}
/**
* 刷新标签信息
*
* @param memberId
* @param wxEnterpriseId
* @param enterpriseId
*/
private
void
pushTagSync
(
String
memberId
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
QywxTagSyncInfoPojo
pojo
=
new
QywxTagSyncInfoPojo
();
pojo
.
setDataId
(
memberId
);
pojo
.
setTaskId
(
"-1"
);
pojo
.
setTaskType
(
QywxSyncTaskTypeEnum
.
MEMBER_SYNC
.
getType
());
//单个会员同步
pojo
.
setSyncType
(
GicQywxSyncTypeEnum
.
SINGLE_WXENT_MEMNER_SYNC
.
getType
());
pojo
.
setWxEnterpriseId
(
wxEnterpriseId
);
pojo
.
setEnterpriseId
(
enterpriseId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"qywxTagSyncDeal"
,
JSONObject
.
toJSONString
(
pojo
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"异常:{}"
,
e
);
}
}
@Override
public
ExternalClerkRelatedDTO
getClerkFriendByUnionid
(
String
enterpriseId
,
String
clerkId
,
String
unionid
)
{
TabHaobanExternalClerkRelated
externalClerkRelated
=
tabHaobanExternalClerkRelatedMapper
.
getClerkExternalByUnionId
(
enterpriseId
,
clerkId
,
unionid
);
...
...
@@ -163,6 +195,18 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
@Override
public
Page
<
String
>
pageExternalByEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
List
<
String
>
memberIDs
=
tabHaobanExternalClerkRelatedMapper
.
listMemberIdByEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
return
PageUtil
.
changePageHelperToCurrentPage
(
new
PageInfo
<>(
memberIDs
));
}
@Override
public
List
<
String
>
listExternalClerkMemberIdsByMemberIds
(
String
wxEnterpriseId
,
List
<
String
>
memberIds
)
{
return
tabHaobanExternalClerkRelatedMapper
.
listMemberIdsByMemberIds
(
memberIds
,
wxEnterpriseId
);
}
@Override
public
List
<
ExternalClerkRelatedShortInfoDTO
>
listExternalClerkByMemberIds
(
String
wxEnterpriseId
,
List
<
String
>
memberIds
)
{
List
<
TabHaobanExternalClerkRelated
>
list
=
tabHaobanExternalClerkRelatedMapper
.
listByMemberIds
(
memberIds
,
wxEnterpriseId
);
return
EntityUtil
.
changeEntityListNew
(
ExternalClerkRelatedShortInfoDTO
.
class
,
list
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
804b58a8
...
...
@@ -22,16 +22,15 @@ import com.gic.haoban.app.customer.dto.ChildDTO;
import
com.gic.haoban.app.customer.dto.CustomerDTO
;
import
com.gic.haoban.app.customer.dto.FilterListDTO
;
import
com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO
;
import
com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum
;
import
com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum
;
import
com.gic.haoban.app.customer.service.api.service.CustomerApiService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.MaterialApiService
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.MemberUnionidRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper
;
...
...
@@ -39,6 +38,7 @@ import com.gic.haoban.manage.service.entity.*;
import
com.gic.haoban.manage.service.exception.WxApiLimitException
;
import
com.gic.haoban.manage.service.pojo.DealQywxExternalUserPojo
;
import
com.gic.haoban.manage.service.pojo.ExternalUserPojo
;
import
com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.member.api.dto.MemberDTO
;
...
...
@@ -138,6 +138,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Autowired
private
CustomerApiService
customerApiService
;
@Autowired
private
QywxTagApiService
qywxTagApiService
;
@Override
public
void
dealQywxExternalUser
(
String
params
)
{
log
.
info
(
"回调:{}"
,
params
);
...
...
@@ -146,12 +149,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
this
.
delMemberUnionidRelatedProcess
(
externalUserPojo
.
getData
());
}
else
if
(
externalUserPojo
.
getType
()
==
DealQywxExternalUserPojo
.
DealType
.
add
.
getType
())
{
this
.
addMemberUnionidRelatedNew
(
externalUserPojo
.
getData
());
}
else
if
(
externalUserPojo
.
getType
()
==
DealQywxExternalUserPojo
.
DealType
.
edit
.
getType
())
{
this
.
editMemberUnionidRelatedProcess
(
externalUserPojo
.
getData
());
}
}
@Override
public
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
)
{
public
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
,
String
storeId
)
{
List
<
TabHaobanExternalClerkRelated
>
list
=
externalClerkRelatedService
.
listByExTernalUseridAndWxUserId
(
externalUserid
,
wxUserId
);
List
<
MemberStoreDTO
>
result
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
list
))
{
...
...
@@ -168,23 +173,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log
.
info
(
"staff关联门店不存在1"
);
return
null
;
}
// Map<String, StaffClerkRelationDTO> storeMap = clerkRelationDTOS.stream().collect(Collectors.toMap(mid -> mid.getStoreId(), dto -> dto, (o, n) -> n));
// //1、查该staff的门店id
// List<TabHaobanStaffDepartmentRelated> relatedIds = staffDepartmentRelatedService.listByWxUserId(wxUserId);
// if(CollectionUtil.isEmpty(relatedIds)){
// log.info("staff关联部门不存在1");
// return null;
// }
// List<String> departmentIds = relatedIds.stream().map(s->s.getDepartmentId()).collect(Collectors.toList());
// if(CollectionUtil.isEmpty(departmentIds)){
// log.info("staff部门不存在1");
// return null;
// }
// List<DepartmentDTO> stores = departmentApiService.listByDepartmentIds(departmentIds, 1);
// if(CollectionUtil.isEmpty(stores)){
// log.info("staff关联门店不存在1");
// return null;
// }
List
<
String
>
storeIds
=
clerkRelationDTOS
.
stream
().
filter
(
s
->
(
s
.
getStoreId
()
!=
null
||
""
.
equals
(
s
.
getStoreId
()))).
map
(
s
->
s
.
getStoreId
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
storeIds
))
{
log
.
info
(
"staff关联门店不存在2"
);
...
...
@@ -192,6 +180,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
//2、获取member的storeId
for
(
TabHaobanExternalClerkRelated
tab
:
list
)
{
if
(
StringUtils
.
isNotBlank
(
storeId
)
&&
(!
storeId
.
equals
(
tab
.
getStoreId
())))
{
continue
;
}
String
memberId
=
tab
.
getMemberId
();
if
(
StringUtils
.
isEmpty
(
memberId
))
{
continue
;
...
...
@@ -539,8 +530,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
exsitDTO
.
setStatusFlag
(
1
);
externalClerkRelatedService
.
update
(
exsitDTO
);
}
sendWelcome
(
dto
,
staffClerkRelationDTO
,
false
);
//同步好友标签
pushTagSync
(
member
.
getMemberId
(),
wxEnterpriseId
,
staffClerkRelationDTO
.
getEnterpriseId
());
}
}
...
...
@@ -996,8 +988,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param dto
*/
private
void
editMemberUnionidRelatedProcess
(
MemberUnionidRelatedDTO
dto
)
{
//todo 修改主要是修改标签 同步所有标签
log
.
info
(
"修改标签/会员信息回调:{}"
,
JSONObject
.
toJSONString
(
dto
));
TabHaobanWxEnterprise
wxEnterprise
=
wxEnterpriseService
.
getEnterpriseBycorpId
(
dto
.
getCorpid
());
if
(
null
==
wxEnterprise
)
{
return
;
}
if
(
dto
.
getSuiteid
().
equals
(
SELF_APP
))
{
log
.
info
(
"self不执行"
);
return
;
}
pushTagSync
(
dto
.
getExternalUserid
(),
dto
.
getWxUserId
()
,
GicQywxSyncTypeEnum
.
FRIEND_TAG_SYNC
.
getType
(),
QywxSyncTaskTypeEnum
.
MEMBER_SYNC
.
getType
(),
wxEnterprise
.
getWxEnterpriseId
(),
null
);
// qywxTagApiService.syncQywxTagToGicByExternalUserId(wxEnterprise.getWxEnterpriseId(), dto.getExternalUserid(), dto.getWxUserId());
}
@Override
...
...
@@ -1561,9 +1565,47 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
external
.
setStatusFlag
(
1
);
externalClerkRelatedService
.
update
(
external
);
}
//同步标签
pushTagSync
(
memberId
,
wxEnterpriseId
,
enterpriseId
);
return
""
;
}
/**
* 同步
*
* @param wxEnterpriseId
* @param enterpriseId
*/
private
void
pushTagSync
(
String
dataId
,
String
taskId
,
int
syncType
,
int
taskType
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
QywxTagSyncInfoPojo
pojo
=
new
QywxTagSyncInfoPojo
();
pojo
.
setDataId
(
dataId
);
pojo
.
setTaskId
(
taskId
);
pojo
.
setTaskType
(
taskType
);
//单个会员同步
pojo
.
setSyncType
(
syncType
);
pojo
.
setWxEnterpriseId
(
wxEnterpriseId
);
pojo
.
setEnterpriseId
(
enterpriseId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"qywxTagSyncDeal"
,
JSONObject
.
toJSONString
(
pojo
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"异常:{}"
,
e
);
}
}
/**
* 同步
*
* @param memberId
* @param wxEnterpriseId
* @param enterpriseId
*/
private
void
pushTagSync
(
String
memberId
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
this
.
pushTagSync
(
memberId
,
"-1"
,
GicQywxSyncTypeEnum
.
SINGLE_WXENT_MEMNER_SYNC
.
getType
(),
QywxSyncTaskTypeEnum
.
MEMBER_SYNC
.
getType
(),
wxEnterpriseId
,
enterpriseId
);
}
@Override
public
String
addFriendExternal
(
ExternalUserDTO
dto
)
{
String
wxUserId
=
dto
.
getWxUserId
();
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
804b58a8
...
...
@@ -6,31 +6,19 @@ 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.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.StoreService
;
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.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.dto.*
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
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.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.*
;
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.mq.sdk.GicMQClient
;
import
com.gic.thirdparty.api.dto.PicUploadResDTO
;
...
...
@@ -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.service.qywx.QywxDepartmentApiService
;
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.net.URL
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
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推送消息进行处理
* Created by tgs on 2020/2/20.
...
...
@@ -126,7 +112,7 @@ public class MessageApiServiceImpl implements MessageApiService {
public
void
wxMessageReceive
(
QywxCallBackDTO
qywxCallBackDTO
)
{
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
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
));
clientInstance
.
sendMessage
(
"dealWxMessageMq"
,
JSON
.
toJSONString
(
qywxCallBackDTO
));
}
...
...
@@ -137,7 +123,6 @@ public class MessageApiServiceImpl implements MessageApiService {
@Override
public
void
dealGicMessage
(
String
param
)
{
return
;
}
@Override
...
...
@@ -147,56 +132,56 @@ public class MessageApiServiceImpl implements MessageApiService {
return
;
}
QywxCallBackDTO
dto
=
JSON
.
parseObject
(
param
,
QywxCallBackDTO
.
class
);
log
.
info
(
"【处理微信回调】dto={}"
,
JSON
.
toJSONString
(
param
));
if
(
dto
!=
null
)
{
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"
))
{
if
(
enterprise
!=
null
)
{
if
(
dto
.
getChangeType
().
endsWith
(
"party"
))
{
this
.
dealDepartment
(
dto
);
}
else
{
}
else
{
this
.
dealUser
(
dto
);
}
}
}
}
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
){
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
)
{
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setIsStore
(
0
);
//departmentDTO.setRelatedId(qywxCallBackDTO.getId()+"");
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanDepartment
parentDepartment
=
new
TabHaobanDepartment
();
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
}
else
{
}
else
{
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
oldDepartment
!=
null
)
{
if
(
oldDepartment
!=
null
)
{
parentDepartment
=
departmentService
.
selectById
(
oldDepartment
.
getParentDepartmentId
());
}
}
if
(!
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
DELETEDEPART
.
getCode
()))
{
if
(
parentDepartment
==
null
)
{
if
(!
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
DELETEDEPART
.
getCode
()))
{
if
(
parentDepartment
==
null
)
{
log
.
info
(
"微信同步父部门不存在"
);
return
;
}
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainId
(
parentDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
parentDepartment
.
getDepartmentId
());
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
departmentDTO
.
setLevel
(
parentDepartment
.
getLevel
()
+
1
);
}
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listDepartment
(
qywxCallBackDTO
.
getAuthCorpId
(),
qywxCallBackDTO
.
getSuiteId
(),
qywxCallBackDTO
.
getParentId
());
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
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
());
}
else
{
}
else
{
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
departmentDTO2
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
tab
!=
null
)
{
if
(
tab
!=
null
)
{
tab
.
setSort
(
departmentDTO2
.
getOrder
());
this
.
departmentService
.
edit
(
EntityUtil
.
changeEntityByJSON
(
DepartmentDTO
.
class
,
tab
));
}
...
...
@@ -204,28 +189,28 @@ public class MessageApiServiceImpl implements MessageApiService {
}
}
}
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDDEPART
.
getCode
()))
{
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
()))
{
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEDEPART
.
getCode
()))
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"微信同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
}
else
{
}
else
{
departmentDTO
.
setIsStore
(
department
.
getIsStore
());
departmentDTO
.
setDepartmentId
(
department
.
getDepartmentId
());
this
.
departmentService
.
edit
(
departmentDTO
);
log
.
info
(
"企业微信更新同步完成"
);
}
}
else
{
}
else
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"微信同步删除部门不存在"
);
}
else
{
if
(
StringUtils
.
isBlank
(
department
.
getRelatedId
()))
{
}
else
{
if
(
StringUtils
.
isBlank
(
department
.
getRelatedId
()))
{
this
.
departmentService
.
del
(
department
.
getDepartmentId
());
}
else
{
}
else
{
this
.
departmentApiService
.
wxCallBackrecycle
(
department
.
getDepartmentId
());
}
log
.
info
(
"企业微信删除同步完成"
);
...
...
@@ -233,10 +218,10 @@ public class MessageApiServiceImpl implements MessageApiService {
}
}
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
){
private
void
dealUser
(
QywxCallBackDTO
qywxCallBackDTO
)
{
TabHaobanStaff
staff
=
new
TabHaobanStaff
();
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
if
(
enterprise
!=
null
)
{
if
(
enterprise
!=
null
)
{
staff
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
//staff.setActiveFlag(0);
staff
.
setPhoneNumber
(
qywxCallBackDTO
.
getMobile
());
...
...
@@ -245,44 +230,44 @@ public class MessageApiServiceImpl implements MessageApiService {
staff
.
setStaffName
(
qywxCallBackDTO
.
getUserName
());
staff
.
setWxUserId
(
qywxCallBackDTO
.
getUserid
());
staff
.
setPostion
(
qywxCallBackDTO
.
getPosition
());
if
(
StringUtils
.
isNotBlank
(
qywxCallBackDTO
.
getAvatar
()))
{
if
(
StringUtils
.
isNotBlank
(
qywxCallBackDTO
.
getAvatar
()))
{
staff
.
setHeadImg
(
changeHeaderImageUrl
(
qywxCallBackDTO
.
getAvatar
()));
}
staff
.
setNationCode
(
"86"
);
//激活状态
if
(
qywxCallBackDTO
.
getStatus
()
!=
null
&&
qywxCallBackDTO
.
getStatus
()
==
1
)
{
if
(
qywxCallBackDTO
.
getStatus
()
!=
null
&&
qywxCallBackDTO
.
getStatus
()
==
1
)
{
staff
.
setActiveFlag
(
1
);
}
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
ADDUSER
.
getCode
()))
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
0
);
}
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
oldStaff
!=
null
)
{
}
else
if
(
qywxCallBackDTO
.
getChangeType
().
equals
(
WxEditType
.
UPDATEUSER
.
getCode
()))
{
TabHaobanStaff
oldStaff
=
this
.
staffService
.
selectByUserIdAndEnterpriseId
(
qywxCallBackDTO
.
getUserid
(),
enterprise
.
getWxEnterpriseId
());
if
(
oldStaff
!=
null
)
{
staff
.
setWxUserId
(
qywxCallBackDTO
.
getNewUserid
());
staff
.
setStaffId
(
oldStaff
.
getStaffId
());
log
.
info
(
"【微信回调更新】staff={}"
,
JSON
.
toJSONString
(
staff
));
if
(
StringUtils
.
isBlank
(
staff
.
getPhoneNumber
()))
{
log
.
info
(
"【微信回调更新】staff={}"
,
JSON
.
toJSONString
(
staff
));
if
(
StringUtils
.
isBlank
(
staff
.
getPhoneNumber
()))
{
staff
.
setPhoneNumber
(
oldStaff
.
getPhoneNumber
());
}
if
(
StringUtils
.
isBlank
(
staff
.
getNationCode
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getNationCode
()))
{
staff
.
setNationCode
(
oldStaff
.
getNationCode
());
}
if
(
StringUtils
.
isBlank
(
staff
.
getStaffName
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getStaffName
()))
{
staff
.
setStaffName
(
oldStaff
.
getStaffName
());
}
if
(
StringUtils
.
isBlank
(
staff
.
getPostion
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getPostion
()))
{
staff
.
setPostion
(
oldStaff
.
getPostion
());
}
if
(
staff
.
getSex
()
==
null
)
{
if
(
staff
.
getSex
()
==
null
)
{
staff
.
setSex
(
oldStaff
.
getSex
());
}
if
(
staff
.
getActiveFlag
()
==
null
)
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
oldStaff
.
getActiveFlag
());
}
if
(
StringUtils
.
isBlank
(
staff
.
getHeadImg
()))
{
if
(
StringUtils
.
isBlank
(
staff
.
getHeadImg
()))
{
staff
.
setHeadImg
(
oldStaff
.
getHeadImg
());
}
// this.staffService.updateByPrimaryKey(staff);
...
...
@@ -291,80 +276,80 @@ public class MessageApiServiceImpl implements MessageApiService {
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
departmentIds
=
""
;
//部门修改了
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
continue
;
}
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
}
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
else
{
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
else
{
//部门没有修改
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
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
.
setWeixinPush
(
true
);
staffApiService
.
staffEdit
(
staffDTO
,
departmentIds
);
}
else
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
}
else
{
if
(
staff
.
getActiveFlag
()
==
null
)
{
staff
.
setActiveFlag
(
0
);
}
this
.
addUser
(
qywxCallBackDTO
,
staff
);
}
}
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());
if
(
oldStaff
!=
null
)
{
if
(
oldStaff
!=
null
)
{
List
<
TabHaobanStaffDepartmentRelated
>
relatedList
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
oldStaff
.
getStaffId
());
TabHaobanStaffDepartmentRelated
staffRelated
=
relatedList
.
get
(
0
);
if
(
StringUtils
.
isNotBlank
(
staffRelated
.
getClerkCode
()))
{
if
(
StringUtils
.
isNotBlank
(
staffRelated
.
getClerkCode
()))
{
staffApiService
.
cleanGicClerk
(
staffRelated
.
getClerkCode
(),
staffRelated
.
getDepartmentId
());
}
innerApiService
.
delCardByStaffId
(
oldStaff
.
getStaffId
());
this
.
staffDepartmentRelatedService
.
del
(
EntityUtil
.
changeEntityByJSON
(
StaffDepartmentRelatedDTO
.
class
,
staffRelated
));
this
.
staffService
.
delByuserid
(
oldStaff
.
getStaffId
());
}
else
{
}
else
{
log
.
info
(
"微信同步删除的门店不存在,{}"
,
qywxCallBackDTO
.
getUserid
());
}
}
}
else
{
}
else
{
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
());
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
String
[]
departArr
=
qywxCallBackDTO
.
getDepartment
();
String
departmentIds
=
""
;
for
(
String
s
:
departArr
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
enterprise
.
getWxEnterpriseId
());
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
continue
;
}
departmentIds
+=
department
.
getDepartmentId
()
+
","
;
}
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
if
(
staffDTO
==
null
)
{
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
if
(
staffDTO
==
null
)
{
staffApiService
.
wxGetAdd
(
staff
.
getWxUserId
(),
enterprise
.
getWxEnterpriseId
());
}
else
{
}
else
{
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedService
.
listStaffDepartmentByStaffId
(
staff
.
getStaffId
());
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
if
(!
departmentIds
.
contains
(
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()))
{
if
(!
departmentIds
.
contains
(
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()))
{
departmentIds
+=
tabHaobanStaffDepartmentRelated
.
getDepartmentId
()
+
","
;
}
if
(
departmentIds
.
endsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
if
(
departmentIds
.
endsWith
(
","
))
{
departmentIds
=
departmentIds
.
substring
(
0
,
departmentIds
.
length
()
-
1
);
}
}
StaffDTO
staffUpdate
=
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
);
...
...
@@ -376,12 +361,12 @@ public class MessageApiServiceImpl implements MessageApiService {
// 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
();
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
if
(
departArr
!=
null
)
{
for
(
String
s
:
departArr
)
{
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
s
,
wxEnterpriseId
);
if
(
department
==
null
)
{
if
(
department
==
null
)
{
log
.
info
(
"部门不存在"
);
continue
;
}
...
...
@@ -401,35 +386,36 @@ public class MessageApiServiceImpl implements MessageApiService {
}
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
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"上传腾讯云万象优图返回失败了:"
,
e
);
return
headImgUrl
;
}
}
/**
* 通过关联的父级ID链查询父级部门
*
* @param parentChain
* @return
*/
private
DepartmentDTO
getParentDepartment
(
String
parentChain
,
int
dataType
,
String
wxEnterpriseId
){
if
(
StringUtils
.
isNotBlank
(
parentChain
))
{
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
()
||
dataType
==
GicDataType
.
DEPARTMENT
.
getCode
())
{
if
(
dataType
==
GicDataType
.
STORE
.
getCode
()
||
dataType
==
GicDataType
.
DEPARTMENT
.
getCode
())
{
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
]);
log
.
info
(
"当前节点id:{}, {}"
,
arr
[
i
],
JSON
.
toJSONString
(
department
));
if
(
department
!=
null
)
{
if
(
department
!=
null
)
{
return
department
;
}
}
...
...
@@ -439,26 +425,25 @@ public class MessageApiServiceImpl implements MessageApiService {
}
@Override
public
Boolean
sendFaceMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
arrivalTime
,
String
storeId
)
{
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
);
if
(
relation
==
null
)
{
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
)
{
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
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"人脸匹配"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"到店时间"
,
arrivalTime
);
...
...
@@ -470,41 +455,23 @@ public class MessageApiServiceImpl implements MessageApiService {
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
return
b
;
}
return
false
;
return
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
}
private
List
<
ItemDTO
>
getItemsList
(
Map
<
String
,
String
>
map
)
{
List
<
ItemDTO
>
items
=
new
ArrayList
();
Iterator
<
String
>
it
=
map
.
keySet
().
iterator
();
while
(
it
.
hasNext
())
{
String
key
=
it
.
next
();
map
.
keySet
().
forEach
(
key
->
{
String
value
=
map
.
get
(
key
);
ItemDTO
dto
=
new
ItemDTO
();
dto
.
setKey
(
key
);
dto
.
setValue
(
value
);
items
.
add
(
dto
);
}
});
return
items
;
}
public
static
void
main
(
String
[]
args
){
String
parentChain
=
"1_"
;
String
[]
arr
=
parentChain
.
split
(
"_"
);
int
len
=
arr
.
length
;
int
startIndex
=
len
-
1
;
System
.
out
.
println
(
len
);
for
(
int
i
=
startIndex
;
i
>=
0
&&
i
<
len
;
i
--){
System
.
out
.
println
(
i
);
}
}
@Override
public
Boolean
sendPerfectRemarkMessage
(
String
clerkId
,
String
memberId
,
String
memberName
,
String
customerTime
,
String
orderId
,
String
storeId
)
{
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
);
...
...
@@ -512,19 +479,18 @@ public class MessageApiServiceImpl implements MessageApiService {
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
);
if
(
relation
==
null
)
{
log
.
info
(
"clerkId未绑定:clerkId={}"
,
clerkId
);
return
false
;
}
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
relation
.
getWxEnterpriseId
());
if
(
wxEnterprise
==
null
)
{
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
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"事件"
,
"会员完善标签"
);
map
.
put
(
"会员"
,
memberName
);
map
.
put
(
"消费订单"
,
orderId
);
...
...
@@ -537,11 +503,42 @@ public class MessageApiServiceImpl implements MessageApiService {
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
"我的顾客通知"
);
messageDTO
.
setItems
(
items
);
return
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
return
b
;
}
return
false
;
@Override
public
void
sendWxMessage
(
String
param
)
{
log
.
info
(
"发送企业微信消息:{}"
,
param
);
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/java/com/gic/haoban/manage/service/service/out/impl/QywxTagApiServiceImpl.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.haoban.app.customer.enums.QywxTaskStatusEnum
;
import
com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationSyncFlagEnum
;
import
com.gic.haoban.manage.api.enums.QywxTagRelationTypeEnum
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabQywxTag
;
import
com.gic.haoban.manage.service.entity.TabQywxTagItem
;
import
com.gic.haoban.manage.service.entity.TabQywxTagRelation
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.pojo.QywxSyncTagFormatPojo
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.QywxTagService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.member.api.dto.MemberTagDTO
;
import
com.gic.member.api.service.MemberTagService
;
import
com.gic.member.tag.api.dto.MemberTagItemDTO
;
import
com.gic.member.tag.api.service.MemberTagItemApiService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService
;
import
com.gic.wechat.api.dto.qywx.QywxTagDTO
;
import
com.gic.wechat.api.dto.qywx.QywxTagGroupDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxGetCorpTagListDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxResponseDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
import
org.slf4j.Logger
;
...
...
@@ -27,9 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -58,6 +71,24 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
ExternalClerkRelatedService
externalClerkRelatedService
;
@Autowired
private
ESDataDynamicOperationApiService
esDataDynamicOperationApiService
;
@Autowired
private
MemberTagService
memberTagService
;
@Autowired
private
QywxTagSyncApiService
qywxTagSyncApiService
;
@Autowired
private
MemberTagItemApiService
memberTagItemApiService
;
@Override
public
void
pullQywxTag
(
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
...
...
@@ -80,14 +111,16 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
@Override
public
void
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
public
ServiceResponse
syncTagToQywx
(
String
wxEnterpriseId
,
String
enterpriseId
,
QywxTagInfoDTO
infoDTO
,
List
<
QywxTagItemDTO
>
items
)
{
ServiceResponse
ret
=
new
ServiceResponse
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//调用企业微信接口保存
QywxGetCorpTagListDTO
resp
=
this
.
saveQywxTag
(
wxEnterpriseDTO
,
infoDTO
,
items
);
if
(
resp
.
getErrcode
()
!=
0
)
{
if
(
resp
.
getErrcode
()
!=
0
&&
CollectionUtils
.
isEmpty
(
resp
.
getTagGroup
())
)
{
logger
.
info
(
"同步失败:{}"
,
JSONObject
.
toJSONString
(
resp
));
return
;
ret
.
setCode
(
resp
.
getErrcode
());
ret
.
setMessage
(
resp
.
getErrmsg
());
return
ret
;
}
//拉取保存所有标签
List
<
QywxTagGroupDTO
>
tagGroup
=
resp
.
getTagGroup
();
...
...
@@ -96,18 +129,13 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
Pair
<
TabQywxTag
,
List
<
TabQywxTagItem
>>
savePair
=
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseId
,
groupDTO
);
if
(
null
==
savePair
)
{
logger
.
info
(
"保存失败:{}"
,
JSONObject
.
toJSONString
(
groupDTO
));
return
;
ret
.
setCode
(
1
);
ret
.
setMessage
(
"保存企业微信标签失败"
);
return
ret
;
}
//保存关联关系
saveRelation
(
wxEnterpriseId
,
enterpriseId
,
infoDTO
,
items
,
savePair
);
String
taskId
=
dealSyncOperationApiService
.
createTagTask
(
wxEnterpriseId
,
"-1"
,
infoDTO
.
getMemberTagId
());
if
(
null
==
taskId
)
{
logger
.
info
(
"标签不能重复执行"
);
throw
new
RuntimeException
(
"标签不能重复执行:"
+
infoDTO
.
getQywxGroupName
());
}
List
<
String
>
tagItemIds
=
items
.
stream
().
map
(
dto
->
dto
.
getQywxTagItemId
()).
collect
(
Collectors
.
toList
());
dealSyncOperationApiService
.
dealTagTask
(
wxEnterpriseId
,
enterpriseId
,
tagItemIds
,
taskId
);
return
ret
;
}
/**
...
...
@@ -132,7 +160,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
groupRelation
.
setQywxTagId
(
groupKey
.
getQywxTagId
());
groupRelation
.
setRelationType
(
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
groupRelation
.
setStatusFlag
(
1
);
groupRelation
.
setSyncFlag
(
1
);
groupRelation
.
setSyncFlag
(
QywxTagRelationSyncFlagEnum
.
PRE
.
getType
()
);
groupRelation
.
setQywxTagRelationId
(
ToolUtil
.
randomUUID
());
groupRelation
.
setWxEnterpriseId
(
wxEnterpriseId
);
saveRelationList
.
add
(
groupRelation
);
...
...
@@ -142,7 +170,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
TabQywxTagRelation
itemRelation
=
new
TabQywxTagRelation
();
itemRelation
.
setWxEnterpriseId
(
wxEnterpriseId
);
itemRelation
.
setQywxTagRelationId
(
ToolUtil
.
randomUUID
());
itemRelation
.
setSyncFlag
(
1
);
itemRelation
.
setSyncFlag
(
QywxTagRelationSyncFlagEnum
.
PRE
.
getType
()
);
itemRelation
.
setStatusFlag
(
1
);
itemRelation
.
setRelationType
(
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
itemRelation
.
setQywxTagId
(
groupKey
.
getQywxTagId
());
...
...
@@ -183,22 +211,54 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
@Override
public
void
closeSync
(
String
wxEnterpriseId
,
String
memberTagId
)
{
public
ServiceResponse
closeSync
(
String
wxEnterpriseId
,
String
memberTagId
)
{
ServiceResponse
resp
=
new
ServiceResponse
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listQywxTagRelationByMemberTagId
(
wxEnterpriseId
,
memberTagId
);
if
(
CollectionUtils
.
isEmpty
(
tagRelations
))
{
return
;
return
resp
;
}
TabQywxTag
tabQywxTag
=
qywxTagService
.
getQywxTagByQywxTagId
(
wxEnterpriseId
,
tagRelations
.
get
(
0
).
getQywxTagId
());
//关闭同步
qywxTagService
.
closeSync
(
wxEnterpriseId
,
memberTagId
);
List
<
String
>
delIds
=
new
ArrayList
<>();
delIds
.
add
(
memberTagId
);
delIds
.
add
(
tabQywxTag
.
getQywxGroupKey
()
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
delIds
,
0
);
if
(
responseDTO
.
getErrcode
()
==
0
)
{
logger
.
info
(
"关闭同步:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setCode
(
responseDTO
.
getErrcode
());
return
resp
;
}
qywxTagService
.
delQywxTag
(
tabQywxTag
.
getQywxGroupKey
(),
wxEnterpriseId
);
return
resp
;
}
@Override
public
ServiceResponse
delGicTagItem
(
String
wxEnterpriseId
,
String
tagItemId
)
{
ServiceResponse
resp
=
new
ServiceResponse
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
TabQywxTagRelation
qywxTagRelation
=
qywxTagService
.
getQywxTagRelationByTagItemId
(
wxEnterpriseId
,
tagItemId
);
if
(
null
==
qywxTagRelation
)
{
resp
.
setMessage
(
"没有同步,无需删除"
);
return
resp
;
}
TabQywxTagItem
qywxTagItem
=
qywxTagService
.
getQywxTagItemById
(
wxEnterpriseId
,
qywxTagRelation
.
getQywxTagItemId
());
List
<
String
>
delIds
=
new
ArrayList
<>();
delIds
.
add
(
qywxTagItem
.
getQywxTagKey
());
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
delCorpTag
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
delIds
,
1
);
logger
.
info
(
"删除标签项:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setCode
(
responseDTO
.
getErrcode
());
return
resp
;
}
//删除标签项 以及同步关系
qywxTagService
.
delQywxTagItemById
(
wxEnterpriseId
,
qywxTagItem
.
getQywxTagItemId
());
qywxTagService
.
changeTagRelationStatus
(
qywxTagRelation
.
getQywxTagRelationId
(),
0
);
return
resp
;
}
@Override
...
...
@@ -222,6 +282,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
QywxTagRelationTypeEnum
relationTypeEnum
=
QywxTagRelationTypeEnum
.
getByTagType
(
callbackDTO
.
getTagType
());
//标签组
if
(
relationTypeEnum
.
getTagType
()
==
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getTagType
())
{
logger
.
info
(
"新增标签组无需操作:{}"
,
callbackDTO
.
getTagId
());
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
callbackDTO
.
getTagId
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterpriseDto
.
getCorpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
...
...
@@ -229,8 +290,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger
.
info
(
"没有关联,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
return
;
}
QywxTagGroupDTO
qywxTagGroupDTO
=
tagDetail
.
getTagGroup
().
get
(
0
);
//保存标签项
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
tagDetail
.
getTagGroup
().
get
(
0
)
);
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagGroupDTO
);
//标签项
}
else
if
(
relationTypeEnum
.
getTagType
()
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getTagType
())
{
//查找对应的标签组 如果标签组关联了
...
...
@@ -238,7 +300,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
ids
.
add
(
callbackDTO
.
getTagId
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterpriseDto
.
getCorpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"
没有关联
,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
logger
.
info
(
"
查询失败
,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
return
;
}
if
(
CollectionUtils
.
isEmpty
(
tagDetail
.
getTagGroup
()))
{
...
...
@@ -247,15 +309,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
QywxTagGroupDTO
qywxTagGroupDTO
=
tagDetail
.
getTagGroup
().
get
(
0
);
TabQywxTagRelation
relationByQywxKey
=
qywxTagService
.
getQywxTagRelationByQywxKey
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagGroupDTO
.
getGroupId
(),
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
if
(
null
==
relationByQywxKey
)
{
logger
.
info
(
"没有关联,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
return
;
}
//关联的话 需要删除标签
List
<
String
>
items
=
new
ArrayList
<>();
items
.
add
(
callbackDTO
.
getTagId
());
qywxSuiteApiService
.
delCorpTag
(
wxEnterpriseDto
.
getCorpid
(),
config
.
getWxSuiteid
(),
items
,
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
//保存标签项
qywxTagService
.
saveQywxTagByQywxGroupKey
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagGroupDTO
);
}
}
...
...
@@ -286,9 +342,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagService
.
delQywxTag
(
callbackDTO
.
getTagId
(),
wxEnterpriseDto
.
getWxEnterpriseId
());
return
;
}
//存在同步关系 需要回写回去
List
<
TabQywxTagItem
>
tabQywxTagItems
=
qywxTagService
.
listByQywxTagId
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxGroupKey
.
getQywxTagId
());
this
.
reSyncTagGroupBack
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
relations
,
qywxGroupKey
,
tabQywxTagItems
);
TabQywxTagRelation
relation
=
relations
.
stream
().
findFirst
().
get
();
logger
.
info
(
"删除标签组 关闭同步:{}"
,
relation
.
getMemberTagId
());
//删除同步 关闭同步
qywxTagService
.
closeSync
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
relation
.
getMemberTagId
());
qywxTagService
.
delQywxTag
(
callbackDTO
.
getTagId
(),
wxEnterpriseDto
.
getWxEnterpriseId
());
saveCloseTask
(
qywxGroupKey
.
getQywxGroupName
().
substring
(
3
),
"-1"
,
relation
.
getWxEnterpriseId
(),
relation
.
getEnterpriseId
());
//标签项
}
else
if
(
relationTypeEnum
.
getTagType
()
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getTagType
())
{
TabQywxTagRelation
qywxTagRelation
=
qywxTagService
.
getQywxTagRelationByQywxKey
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
callbackDTO
.
getTagId
(),
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
());
...
...
@@ -297,11 +356,21 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagService
.
delQywxTagItemById
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagRelation
.
getQywxTagItemId
());
return
;
}
//同步
reSyncQywxTagItem
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagRelation
);
logger
.
info
(
"删除标签 关闭同步:{}"
,
qywxTagRelation
.
getMemberTagId
());
//删除同步 关闭同步
this
.
closeSync
(
wxEnterpriseDto
.
getWxEnterpriseId
(),
qywxTagRelation
.
getMemberTagId
());
TabQywxTag
tabQywxTag
=
qywxTagService
.
getQywxTagByQywxTagId
(
qywxTagRelation
.
getWxEnterpriseId
(),
qywxTagRelation
.
getQywxTagId
());
saveCloseTask
(
tabQywxTag
.
getQywxGroupName
(),
"-1"
,
qywxTagRelation
.
getWxEnterpriseId
(),
qywxTagRelation
.
getEnterpriseId
());
// qywxTagService.closeSync(wxEnterpriseDto.getWxEnterpriseId(), qywxTagRelation.getMemberTagId());
// qywxTagService.delQywxTagItemById(wxEnterpriseDto.getWxEnterpriseId(), qywxTagRelation.getQywxTagItemId());
}
}
private
void
saveCloseTask
(
String
tagName
,
String
staffId
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
String
content
=
tagName
+
"-关闭标签同步成功"
;
qywxTagSyncApiService
.
saveCloseTask
(
staffId
,
wxEnterpriseId
,
enterpriseId
,
content
,
QywxTaskStatusEnum
.
ALL_SUCCESS
.
getType
());
}
/**
...
...
@@ -432,7 +501,473 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
@Override
public
void
syncFriendTagToQywxByExternalUserId
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
externalUserId
,
String
tagItemId
)
{
public
ServiceResponse
syncFriendTagToQywxByExternalUserId
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
externalUserId
,
List
<
String
>
tagItemIds
)
{
logger
.
info
(
"同步微信好友到企业微信:{},{},{},{}"
,
wxEnterpriseId
,
enterpriseId
,
externalUserId
,
JSONObject
.
toJSONString
(
tagItemIds
));
ServiceResponse
resp
=
new
ServiceResponse
();
//获取需要同步的标签
QywxSyncTagFormatPojo
syncTagFormat
=
listSyncTagItems
(
wxEnterpriseId
);
if
(
syncTagFormat
==
null
)
{
logger
.
info
(
"没有需要同步的标签"
);
resp
.
setCode
(
2
);
resp
.
setMessage
(
"没有要同步的标签"
);
return
resp
;
}
//该会员要同步的打的企业微信标签 该商户下
Set
<
String
>
entQywxTagKeys
=
tagItemIds
.
stream
().
filter
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
containsKey
(
tagItemId
))
.
map
(
tagItemId
->
syncTagFormat
.
getGicToQywxTagItemIdMap
().
get
(
tagItemId
)).
collect
(
Collectors
.
toSet
());
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//查询外部联系人
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
logger
.
info
(
"好友不存在"
);
resp
.
setCode
(
3
);
resp
.
setMessage
(
"好友不存在"
);
return
resp
;
}
else
if
(
externalUseridInfo
.
equals
(
"1"
))
{
logger
.
info
(
"限制次数"
);
resp
.
setCode
(
45033
);
resp
.
setMessage
(
"getExternalUseridInfo接口次数限制"
);
return
resp
;
}
Map
<
String
,
Set
<
String
>>
externalTagMap
=
getExternalTagMap
(
externalUseridInfo
);
if
(
null
==
externalTagMap
)
{
logger
.
info
(
"没有好友需要同步"
);
resp
.
setCode
(
5
);
resp
.
setMessage
(
"没有好友需要同步"
);
return
resp
;
}
//商户下设置同步的企业微信标签keys
Set
<
String
>
entQywxTagSyncKeys
=
syncTagFormat
.
getEntQywxTagKeysMap
().
get
(
enterpriseId
);
//同步好友
externalTagMap
.
forEach
((
wxUserId
,
haveTagKes
)
->
{
//该用户在该商户下打的标签
Sets
.
SetView
<
String
>
entHasSetQywxTagKeys
=
Sets
.
intersection
(
haveTagKes
,
entQywxTagSyncKeys
);
//获取需要打的标签
Sets
.
SetView
<
String
>
needSetTags
=
Sets
.
difference
(
entQywxTagKeys
,
entHasSetQywxTagKeys
);
//需要删除的标签
Sets
.
SetView
<
String
>
needDelTags
=
Sets
.
difference
(
entHasSetQywxTagKeys
,
entQywxTagKeys
);
if
(
CollectionUtils
.
isEmpty
(
needDelTags
)
&&
CollectionUtils
.
isEmpty
(
needSetTags
))
{
logger
.
info
(
"不需要操作:{},{}"
,
wxUserId
,
externalUserId
);
return
;
}
QywxResponseDTO
responseDTO
=
qywxUserApiService
.
markTag
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
,
externalUserId
,
needSetTags
,
needDelTags
);
logger
.
info
(
"操作返回:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"权限不对:{},{}"
,
wxUserId
,
externalUserId
);
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setCode
(
responseDTO
.
getErrcode
());
return
;
}
});
return
resp
;
}
/**
* 获取以及同步的标签序列表
*/
private
QywxSyncTagFormatPojo
listSyncTagItems
(
String
wxEnterpriseId
)
{
QywxSyncTagFormatPojo
pojo
=
new
QywxSyncTagFormatPojo
();
List
<
TabQywxTagRelation
>
relations
=
qywxTagService
.
listAllQywxRelation
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
relations
))
{
return
null
;
}
//企业微信标签key 关联对应的 gic标签关系
Map
<
String
,
TabQywxTagRelation
>
relationMap
=
relations
.
stream
().
filter
(
dto
->
dto
.
getRelationType
()
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
()).
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getQywxTagItemId
(),
dto
->
dto
));
if
(
MapUtils
.
isEmpty
(
relationMap
))
{
return
null
;
}
List
<
String
>
syncTagItemsIds
=
relationMap
.
keySet
().
stream
().
collect
(
Collectors
.
toList
());
//同步的标签项
List
<
TabQywxTagItem
>
tagItems
=
qywxTagService
.
listQywxTagItemByIds
(
wxEnterpriseId
,
syncTagItemsIds
);
//企业微信标签id 对应的标签
Map
<
String
,
TabQywxTagItem
>
qywxTagItemMap
=
tagItems
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getQywxTagItemId
(),
dto
->
dto
));
//企业微信标签与gic标签id的对应关系
Map
<
String
,
String
>
qywxToGicTagItemIdMap
=
syncTagItemsIds
.
stream
().
collect
(
Collectors
.
toMap
(
qywxTagId
->
qywxTagItemMap
.
get
(
qywxTagId
).
getQywxTagKey
(),
qywxTagId
->
relationMap
.
get
(
qywxTagId
).
getTagItemId
()));
//gic标签与企业微信标签id的对应关系
Map
<
String
,
String
>
gicToQywxTagItemIdMap
=
syncTagItemsIds
.
stream
().
collect
(
Collectors
.
toMap
(
qywxTagId
->
relationMap
.
get
(
qywxTagId
).
getTagItemId
(),
qywxTagId
->
qywxTagItemMap
.
get
(
qywxTagId
).
getQywxTagKey
()));
//gic商户对应的已经同步的gic标签项列表
Map
<
String
,
Set
<
String
>>
entGicTagItemIdMap
=
relations
.
stream
().
filter
(
dto
->
dto
.
getRelationType
()
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
())
.
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getEnterpriseId
(),
Collectors
.
mapping
(
dto
->
dto
.
getTagItemId
(),
Collectors
.
toSet
())));
//gic商户对应的已经同步的企业微信表亲列表
Map
<
String
,
Set
<
String
>>
entQywxTagKeysMap
=
relations
.
stream
().
filter
(
dto
->
dto
.
getRelationType
()
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
())
.
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getEnterpriseId
(),
Collectors
.
mapping
(
dto
->
gicToQywxTagItemIdMap
.
get
(
dto
.
getTagItemId
()),
Collectors
.
toSet
())));
pojo
.
setEntGicTagItemIdMap
(
entGicTagItemIdMap
);
pojo
.
setEntQywxTagKeysMap
(
entQywxTagKeysMap
);
pojo
.
setGicToQywxTagItemIdMap
(
gicToQywxTagItemIdMap
);
pojo
.
setQywxToGicTagItemIdMap
(
qywxToGicTagItemIdMap
);
return
pojo
;
}
@Override
public
ServiceResponse
syncQywxTagToGicByExternalUserId
(
String
wxEnterpriseId
,
String
externalUserId
,
String
wxUserId
)
{
//todo 刷新标签的时候不允许同步
ServiceResponse
resp
=
new
ServiceResponse
();
//所有以及关联同步的标签
QywxSyncTagFormatPojo
syncTagFormatPojo
=
listSyncTagItems
(
wxEnterpriseId
);
if
(
syncTagFormatPojo
==
null
)
{
logger
.
info
(
"没有需要同步的标签,wxUserId:{},externalUserId:{},wxId:{}"
,
wxUserId
,
externalUserId
,
wxEnterpriseId
);
resp
.
setMessage
(
"没有需要同步的标签"
);
return
resp
;
}
//企业微信同步的标签key
Set
<
String
>
qywxTagKeys
=
syncTagFormatPojo
.
getQywxToGicTagItemIdMap
().
keySet
();
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//查询外部联系人
String
externalUseridInfo
=
qywxUserApiService
.
getExternalUseridInfo
(
enterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
externalUseridInfo
))
{
logger
.
info
(
"好友不存在"
);
resp
.
setCode
(
2
);
resp
.
setMessage
(
"好友不存在"
);
return
resp
;
}
else
if
(
externalUseridInfo
.
equals
(
"1"
))
{
logger
.
info
(
"限制次数"
);
resp
.
setCode
(
45033
);
resp
.
setMessage
(
"限制次数"
);
return
resp
;
}
Map
<
String
,
Set
<
String
>>
externalTagMap
=
getExternalTagMap
(
externalUseridInfo
);
//当前操作用户企业打的标签
Set
<
String
>
staffChangeTagKeys
=
externalTagMap
.
get
(
wxUserId
);
if
(
CollectionUtils
.
isEmpty
(
staffChangeTagKeys
))
{
logger
.
info
(
"该用户没有不存在好友关系,获取不到关联导购打的标签"
);
resp
.
setMessage
(
"该用户没有不存在好友关系,获取不到关联导购打的标签"
);
return
resp
;
}
Sets
.
SetView
<
String
>
staffHasSetTagKeys
=
Sets
.
intersection
(
staffChangeTagKeys
,
qywxTagKeys
);
//获取该外部联系人的所有会员
List
<
TabHaobanExternalClerkRelated
>
clerkRelateds
=
externalClerkRelatedService
.
listExternalByExternalUserid
(
wxEnterpriseId
,
externalUserId
);
if
(
CollectionUtils
.
isEmpty
(
clerkRelateds
))
{
logger
.
info
(
"该用户没关联对应的好友:{}"
);
resp
.
setMessage
(
"该用户没关联对应的好友"
);
return
resp
;
}
//企业下的企业微信标签对应关系
Map
<
String
,
Set
<
String
>>
entQywxTagKeysMap
=
syncTagFormatPojo
.
getEntQywxTagKeysMap
();
Map
<
String
,
Set
<
String
>>
entGicTagItemIdMap
=
syncTagFormatPojo
.
getEntGicTagItemIdMap
();
List
<
String
>
hasSaveMemberId
=
new
ArrayList
<>();
for
(
TabHaobanExternalClerkRelated
clerkRelated
:
clerkRelateds
)
{
logger
.
info
(
"需要处理的好友:{}"
,
JSONObject
.
toJSONString
(
clerkRelated
));
//该会员在该企业已经同步 无需同步
if
(
hasSaveMemberId
.
contains
(
clerkRelated
.
getMemberId
()))
{
continue
;
}
hasSaveMemberId
.
add
(
clerkRelated
.
getMemberId
());
//该会员所在企业下 配置的同步的标签列表
Set
<
String
>
entQywxSyncTagKeys
=
entQywxTagKeysMap
.
get
(
clerkRelated
.
getEnterpriseId
());
Set
<
String
>
entQywxSyncTagItemIds
=
entGicTagItemIdMap
.
get
(
clerkRelated
.
getEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
entQywxSyncTagKeys
))
{
logger
.
info
(
"该企业下没有配置需要同步的:{},{}"
,
externalUserId
,
clerkRelated
.
getEnterpriseId
());
continue
;
}
//该会员打的标签
List
<
MemberTagDTO
>
gicItems
=
memberTagService
.
listMemberTag
(
clerkRelated
.
getEnterpriseId
(),
clerkRelated
.
getMemberId
());
Set
<
String
>
noSyncTagItemIds
=
new
HashSet
<>();
if
(!
CollectionUtils
.
isEmpty
(
gicItems
))
{
noSyncTagItemIds
=
gicItems
.
stream
().
filter
(
item
->
!
entQywxSyncTagItemIds
.
contains
(
item
.
getTagsId
())).
map
(
dto
->
dto
.
getTagsId
()).
collect
(
Collectors
.
toSet
());
logger
.
info
(
"没有同步的标签:{}"
,
JSONObject
.
toJSONString
(
noSyncTagItemIds
));
}
//该企业下会员需要设置的标签
Sets
.
SetView
<
String
>
entMemberNeedSetQywxKeys
=
Sets
.
intersection
(
staffHasSetTagKeys
,
entQywxSyncTagKeys
);
Set
<
String
>
saveTagIds
=
entMemberNeedSetQywxKeys
.
stream
().
map
(
qywxKey
->
syncTagFormatPojo
.
getQywxToGicTagItemIdMap
().
get
(
qywxKey
)).
collect
(
Collectors
.
toSet
());
saveTagIds
.
addAll
(
noSyncTagItemIds
);
logger
.
info
(
"该企业会员需要打的标签:{}"
,
JSONObject
.
toJSONString
(
entMemberNeedSetQywxKeys
));
//更新标签 会自动同步
if
(
CollectionUtils
.
isEmpty
(
saveTagIds
))
{
saveMemberTags
(
new
HashSet
<>(),
clerkRelated
.
getEnterpriseId
(),
clerkRelated
.
getMemberId
(),
clerkRelated
.
getClerkId
());
}
else
{
saveMemberTags
(
saveTagIds
,
clerkRelated
.
getEnterpriseId
(),
clerkRelated
.
getMemberId
(),
clerkRelated
.
getClerkId
());
}
// hasSaveMemberId.add(clerkRelated.getMemberId());
// //同步企业的标签到企业微信
// syncToQywxByWxUserId(syncTagFormatPojo, clerkRelated.getEnterpriseId(), enterpriseDTO.getCorpid(), externalUserId, externalTagMap, entMemberNeedSetQywxKeys);
}
return
resp
;
}
private
void
saveMemberTags
(
Set
<
String
>
tagItemIds
,
String
enterpriseId
,
String
memberId
,
String
clerkId
)
{
List
<
MemberTagDTO
>
list
=
tagItemIds
.
stream
().
map
(
tagId
->
{
MemberTagDTO
memberTagDTO
=
new
MemberTagDTO
();
memberTagDTO
.
setTagsId
(
tagId
);
memberTagDTO
.
setEnterpriseId
(
enterpriseId
);
memberTagDTO
.
setMemberId
(
memberId
);
memberTagDTO
.
setClerkId
(
clerkId
);
return
memberTagDTO
;
}).
collect
(
Collectors
.
toList
());
logger
.
info
(
"会员打标签:{}"
,
JSONObject
.
toJSONString
(
list
));
memberTagService
.
saveOrUpdateMemberTagHB
(
enterpriseId
,
list
,
memberId
);
}
/**
* 获取企业微信的外部联系人的所有联系关系
*
* @param externalUseridInfo
* @return
*/
private
Map
<
String
,
Set
<
String
>>
getExternalTagMap
(
String
externalUseridInfo
)
{
Map
<
String
,
Set
<
String
>>
ret
=
new
HashMap
<>();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
externalUseridInfo
);
if
(!
jsonObject
.
containsKey
(
"follow_user"
))
{
logger
.
info
(
"没有相关的好友"
);
return
null
;
}
JSONArray
followUser
=
jsonObject
.
getJSONArray
(
"follow_user"
);
for
(
int
i
=
0
;
i
<
followUser
.
size
();
i
++)
{
JSONObject
midUser
=
followUser
.
getJSONObject
(
i
);
String
wxUserId
=
midUser
.
getString
(
"userid"
);
Set
<
String
>
midTagIds
=
new
HashSet
<>();
if
(!
midUser
.
containsKey
(
"tags"
))
{
ret
.
put
(
wxUserId
,
midTagIds
);
continue
;
}
JSONArray
tags
=
midUser
.
getJSONArray
(
"tags"
);
for
(
int
n
=
0
;
n
<
tags
.
size
();
n
++)
{
JSONObject
tagMid
=
tags
.
getJSONObject
(
n
);
String
tagId
=
tagMid
.
getString
(
"tag_id"
);
String
tagType
=
tagMid
.
getString
(
"type"
);
if
(
tagType
.
equals
(
"1"
))
{
midTagIds
.
add
(
tagId
);
}
}
ret
.
put
(
wxUserId
,
midTagIds
);
}
return
ret
;
}
@Override
public
void
changeQywxTagStatus
(
String
memberTagId
,
String
wxEnterpriseId
,
int
status
)
{
qywxTagService
.
changeRelationSyncFlagByMemberTagId
(
wxEnterpriseId
,
memberTagId
,
status
);
}
@Override
public
boolean
saveRelation
(
String
wxEnterpriseId
,
String
enterpriseId
,
List
<
String
>
memberTagIds
)
{
if
(
CollectionUtils
.
isEmpty
(
memberTagIds
))
{
return
false
;
}
return
false
;
}
@Override
public
ServiceResponse
renameQywxTag
(
String
wxEnterpriseId
,
String
id
,
String
name
,
Integer
type
)
{
ServiceResponse
resp
=
new
ServiceResponse
();
String
renameQywxKey
=
null
;
Long
order
=
null
;
String
relationId
=
null
;
//标签组
if
(
type
==
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
())
{
TabQywxTag
tabQywxTag
=
qywxTagService
.
getQywxTagByQywxTagId
(
wxEnterpriseId
,
id
);
if
(
null
==
tabQywxTag
)
{
resp
.
setMessage
(
"没有关联无需处理"
);
return
resp
;
}
renameQywxKey
=
tabQywxTag
.
getQywxGroupKey
();
order
=
tabQywxTag
.
getOrder
();
name
=
"GIC"
+
name
;
relationId
=
tabQywxTag
.
getQywxTagId
();
}
else
if
(
type
==
QywxTagRelationTypeEnum
.
TAG_ITEM
.
getType
())
{
TabQywxTagItem
qywxTagItem
=
qywxTagService
.
getQywxTagItemById
(
wxEnterpriseId
,
id
);
if
(
null
==
qywxTagItem
)
{
resp
.
setMessage
(
"没有关联无需处理"
);
return
resp
;
}
renameQywxKey
=
qywxTagItem
.
getQywxTagKey
();
order
=
qywxTagItem
.
getOrder
();
relationId
=
qywxTagItem
.
getQywxTagItemId
();
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//名称同步回去
QywxTagDTO
qywxTagDTO
=
new
QywxTagDTO
();
qywxTagDTO
.
setId
(
renameQywxKey
);
qywxTagDTO
.
setName
(
name
);
qywxTagDTO
.
setOrder
(
order
);
QywxResponseDTO
responseDTO
=
qywxSuiteApiService
.
editCorpTagNameOrOrder
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxTagDTO
);
logger
.
info
(
"同步名称:{}"
,
JSONObject
.
toJSONString
(
responseDTO
));
if
(
responseDTO
.
getErrcode
()
!=
0
)
{
resp
.
setMessage
(
responseDTO
.
getErrmsg
());
resp
.
setCode
(
responseDTO
.
getErrcode
());
}
qywxTagService
.
saveQywxTagOrTagItemName
(
relationId
,
name
,
type
);
return
resp
;
}
@Override
public
List
<
QywxTagRelationDTO
>
listQywxTagRelationByMemberTagId
(
String
wxEnterpriseId
,
String
memberTagId
)
{
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listQywxTagRelationByMemberTagId
(
wxEnterpriseId
,
memberTagId
);
return
EntityUtil
.
changeEntityListByJSON
(
QywxTagRelationDTO
.
class
,
tagRelations
);
}
@Override
public
QywxTagRelationDTO
getQywxTagRelationByRelationId
(
String
relationId
)
{
TabQywxTagRelation
tagRelation
=
qywxTagService
.
getQywxTagRelationById
(
relationId
);
return
EntityUtil
.
changeEntityByJSON
(
QywxTagRelationDTO
.
class
,
tagRelation
);
}
@Override
public
QywxTagInfoDTO
getQywxTagByQywxTagId
(
String
qywxTagId
)
{
TabQywxTag
tabQywxTag
=
qywxTagService
.
getQywxTagByQywxTagId
(
null
,
qywxTagId
);
return
EntityUtil
.
changeEntityByJSON
(
QywxTagInfoDTO
.
class
,
tabQywxTag
);
}
@Override
public
void
updateQywxTagRelationSyncStatusByTagItemId
(
String
wxEnterpriseId
,
String
tagItemId
)
{
qywxTagService
.
changeRelationSyncFlagByTagItemId
(
wxEnterpriseId
,
tagItemId
,
2
);
}
@Override
public
void
checkQywxSync
(
String
params
)
{
List
<
TabHaobanWxEnterprise
>
wxEnterprises
=
wxEnterpriseService
.
listAll
();
ProviderLocalTag
providerLocalTag
=
ProviderLocalTag
.
tag
.
get
();
String
traceIdMid
=
providerLocalTag
.
traceId
;
wxEnterprises
.
forEach
(
wxEnterprise
->
{
String
traceId
=
providerLocalTag
.
traceId
=
traceIdMid
+
"_"
+
wxEnterprise
.
getWxEnterpriseId
();
logger
.
info
(
"企业:{}"
,
wxEnterprise
.
getWxEnterpriseId
());
try
{
List
<
TabQywxTagRelation
>
tagRelations
=
qywxTagService
.
listAllQywxRelation
(
wxEnterprise
.
getWxEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
tagRelations
))
{
logger
.
info
(
"无需校验: 没有要同步的企业"
);
return
;
}
QywxSyncTagFormatPojo
pojo
=
this
.
listSyncTagItems
(
wxEnterprise
.
getWxEnterpriseId
());
List
<
TabQywxTagRelation
>
qywxTagRelations
=
tagRelations
.
stream
().
filter
(
dto
->
dto
.
getRelationType
()
==
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
()).
collect
(
Collectors
.
toList
());
for
(
TabQywxTagRelation
qywxTagRelation
:
qywxTagRelations
)
{
Map
<
String
,
Object
>
map
=
checkQywxSyncByQywxTag
(
qywxTagRelation
,
wxEnterprise
,
pojo
);
if
(
MapUtils
.
isNotEmpty
(
map
))
{
AlertMessageDTO
messageDTO
=
new
AlertMessageDTO
();
messageDTO
.
setAlertTitle
(
"企微与好办同步标签不相同"
);
messageDTO
.
setEnterpriseId
(
qywxTagRelation
.
getEnterpriseId
());
messageDTO
.
setAlertType
(
AlertTypeEnum
.
QYWX_TAG_SYNC
.
getType
());
messageDTO
.
setWxEnterpriseId
(
wxEnterprise
.
getWxEnterpriseId
());
messageDTO
.
setContentMap
(
map
);
messageDTO
.
setTraceId
(
traceId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"haobanAlertMq"
,
JSONObject
.
toJSONString
(
messageDTO
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"异常:{}"
,
e
);
}
}
}
}
catch
(
Exception
e
)
{
logger
.
info
(
"校验异常:{}"
,
e
);
}
});
}
/**
* 校验
*
* @param relation
* @param wxEnterprise
*/
private
LinkedHashMap
<
String
,
Object
>
checkQywxSyncByQywxTag
(
TabQywxTagRelation
relation
,
TabHaobanWxEnterprise
wxEnterprise
,
QywxSyncTagFormatPojo
pojo
)
{
LinkedHashMap
<
String
,
Object
>
ret
=
new
LinkedHashMap
<>();
boolean
flag
=
false
;
ret
.
put
(
"hb标签id"
,
relation
.
getQywxTagId
());
TabQywxTag
tabQywxTag
=
qywxTagService
.
getQywxTagByQywxTagId
(
relation
.
getWxEnterpriseId
(),
relation
.
getQywxTagId
());
if
(
null
==
tabQywxTag
)
{
logger
.
info
(
"数据库不存在该企业微信标签:{}"
,
relation
.
getQywxTagId
());
ret
.
put
(
"描述"
,
"标签数据库不存在:"
+
relation
.
getTagItemId
());
return
ret
;
}
ret
.
put
(
"名称(标签)"
,
tabQywxTag
.
getQywxGroupName
());
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
tabQywxTag
.
getQywxGroupKey
());
QywxGetCorpTagListDTO
tagDetail
=
qywxSuiteApiService
.
getCorpTagList
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
ids
,
QywxTagRelationTypeEnum
.
TAG_GROUP
.
getType
());
if
(
tagDetail
.
getErrcode
()
!=
0
)
{
logger
.
info
(
"查询失败,无需操作:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
ret
.
put
(
"描述"
,
"查询失败:"
+
tagDetail
.
getErrmsg
());
return
ret
;
}
if
(
CollectionUtils
.
isEmpty
(
tagDetail
.
getTagGroup
()))
{
logger
.
info
(
"标签组不存在:{}"
,
JSONObject
.
toJSONString
(
tagDetail
));
ret
.
put
(
"描述"
,
"标签组不存在:"
+
tabQywxTag
.
getQywxGroupName
());
return
ret
;
}
//获取该标签已经绑定的标签项key
Map
<
String
,
String
>
qywxToGicTagItemIdMap
=
pojo
.
getQywxToGicTagItemIdMap
();
List
<
TabQywxTagItem
>
gicQywxSyncTagItems
=
qywxTagService
.
listByQywxTagId
(
wxEnterprise
.
getWxEnterpriseId
(),
relation
.
getQywxTagId
());
Map
<
String
,
String
>
gicQywxTagNameMap
=
gicQywxSyncTagItems
.
stream
().
filter
(
tab
->
qywxToGicTagItemIdMap
.
containsKey
(
tab
.
getQywxTagKey
())).
collect
(
Collectors
.
toMap
(
mid
->
mid
.
getQywxTagKey
(),
mid
->
mid
.
getQywxTagName
()));
if
(
CollectionUtils
.
isEmpty
(
gicQywxSyncTagItems
))
{
logger
.
info
(
"gic同步企业微信标签异常"
);
ret
.
put
(
"描述"
,
"gic同步企业微信标签异常:"
+
tabQywxTag
.
getQywxGroupName
());
return
ret
;
}
Set
<
String
>
gicQywxKeysSet
=
gicQywxTagNameMap
.
keySet
();
//获取企业微信的标签项key
QywxTagGroupDTO
qywxTagGroupDTO
=
tagDetail
.
getTagGroup
().
get
(
0
);
List
<
QywxTagDTO
>
tagItems
=
qywxTagGroupDTO
.
getTag
();
if
(
CollectionUtils
.
isEmpty
(
tagItems
))
{
ret
.
put
(
"描述"
,
"企业微信标签项空:"
+
tabQywxTag
.
getQywxGroupName
());
return
ret
;
}
Map
<
String
,
QywxTagDTO
>
qywxTagDTOMap
=
tagItems
.
stream
().
filter
(
dto
->
dto
.
isDeleted
()
==
false
).
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getId
(),
dto
->
dto
));
Set
<
String
>
qywxKeysSet
=
qywxTagDTOMap
.
keySet
();
//gic没有同步的标签项
Map
<
String
,
String
>
gicToQywxTagItemIdMap
=
pojo
.
getGicToQywxTagItemIdMap
();
List
<
MemberTagItemDTO
>
gicTagItems
=
memberTagItemApiService
.
getItemListByTagId
(
relation
.
getMemberTagId
());
Set
<
MemberTagItemDTO
>
noSyncTags
=
gicTagItems
.
stream
().
filter
(
dto
->
!
gicToQywxTagItemIdMap
.
containsKey
(
dto
.
getTagItemId
())).
collect
(
Collectors
.
toSet
());
//在gic存在 企业微信不存在
Sets
.
SetView
<
String
>
qywxUnHaves
=
Sets
.
difference
(
gicQywxKeysSet
,
qywxKeysSet
);
//企业微信存在 gic不存在
Sets
.
SetView
<
String
>
gicUnHaves
=
Sets
.
difference
(
qywxKeysSet
,
gicQywxKeysSet
);
ret
.
put
(
"现企微标签项"
,
tagItems
.
stream
().
filter
(
dto
->
dto
.
isDeleted
()
==
false
).
map
(
dto
->
dto
.
getName
()).
collect
(
Collectors
.
joining
(
"],["
,
"["
,
"]"
)));
ret
.
put
(
"现gic标签项"
,
gicTagItems
.
stream
().
map
(
dto
->
dto
.
getTagItemName
()).
collect
(
Collectors
.
joining
(
"],["
,
"["
,
"]"
)));
//企业微信缺少
if
(!
CollectionUtils
.
isEmpty
(
qywxUnHaves
))
{
flag
=
true
;
ret
.
put
(
"标签项缺少(企微)"
,
qywxUnHaves
.
stream
().
map
(
mid
->
gicQywxTagNameMap
.
get
(
mid
)).
collect
(
Collectors
.
joining
(
"],["
,
"["
,
"]"
)));
}
//未同步标签项
if
(!
CollectionUtils
.
isEmpty
(
noSyncTags
))
{
flag
=
true
;
ret
.
put
(
"标签项未同步"
,
noSyncTags
.
stream
().
map
(
mid
->
mid
.
getTagItemName
()).
collect
(
Collectors
.
joining
(
"],["
,
"["
,
"]"
)));
}
//gic缺少
if
(!
CollectionUtils
.
isEmpty
(
gicUnHaves
))
{
flag
=
true
;
ret
.
put
(
"标签项缺少(gic)"
,
gicUnHaves
.
stream
().
map
(
id
->
qywxTagDTOMap
.
get
(
id
).
getName
()).
collect
(
Collectors
.
joining
(
"],["
,
"["
,
"]"
)));
}
if
(
flag
)
{
return
ret
;
}
return
null
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
804b58a8
...
...
@@ -1314,7 +1314,6 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
@RedisCache
(
value
=
"qrcode-${clerkCode}-${storeId}"
,
timeOut
=
1
,
timeunit
=
TimeUnit
.
DAYS
)
public
ServiceResponse
<
String
>
getStaffQrcode
(
String
clerkCode
,
String
storeId
)
{
ServiceResponse
<
String
>
resp
=
new
ServiceResponse
<>();
List
<
String
>
clerkCodes
=
new
ArrayList
<>();
...
...
@@ -1331,7 +1330,12 @@ public class StaffApiServiceImpl implements StaffApiService {
logger
.
info
(
"成员没有关联:{}"
,
clerkCode
);
return
null
;
}
String
key
=
"qrcode-"
+
relationDTO
.
getStaffId
();
Object
url
=
RedisUtil
.
getCache
(
key
);
if
(
null
!=
url
)
{
resp
.
setResult
((
String
)
url
);
return
resp
;
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
relationDTO
.
getWxEnterpriseId
());
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
...
...
@@ -1340,6 +1344,7 @@ public class StaffApiServiceImpl implements StaffApiService {
}
UserDTO
user
=
qywxUserApiService
.
getSelfWorkWxUser
(
wxEnterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
relationDTO
.
getWxUserId
());
if
(
user
!=
null
)
{
RedisUtil
.
setCache
(
key
,
user
.
getQr_code
(),
2L
,
TimeUnit
.
DAYS
);
resp
.
setResult
(
user
.
getQr_code
());
return
resp
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffClerkRelationApiServiceImpl.java
View file @
804b58a8
...
...
@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
@Service
public
class
StaffClerkRelationApiServiceImpl
implements
StaffClerkRelationApiService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffClerkRelationApiServiceImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffClerkRelationApiServiceImpl
.
class
);
@Autowired
private
StaffClerkRelationService
staffClerkRelatinService
;
...
...
@@ -86,9 +86,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
void
bindLogMq
(
String
params
)
{
logger
.
info
(
"绑定日志mq:{}"
,
params
);
logger
.
info
(
"绑定日志mq:{}"
,
params
);
StaffClerkBindLogInfoDTO
infoDTO
=
JSONObject
.
parseObject
(
params
,
StaffClerkBindLogInfoDTO
.
class
);
if
(
null
==
infoDTO
)
{
if
(
null
==
infoDTO
)
{
logger
.
info
(
"数据不存在"
);
return
;
}
...
...
@@ -98,11 +98,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return
;
}
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkIdNoStatus
(
clerkRelation
.
getClerkId
());
String
phoneNumber
=
""
;
String
phoneNumber
=
""
;
if
(
null
!=
clerkDTO
)
{
phoneNumber
=
clerkDTO
.
getPhoneNumber
();
phoneNumber
=
clerkDTO
.
getPhoneNumber
();
}
TabHaobanStaffClerkBindLog
staffClerkRelation
=
new
TabHaobanStaffClerkBindLog
();
TabHaobanStaffClerkBindLog
staffClerkRelation
=
new
TabHaobanStaffClerkBindLog
();
staffClerkRelation
.
setClerkId
(
clerkRelation
.
getClerkId
());
staffClerkRelation
.
setChannelCode
(
infoDTO
.
getChannelCode
());
staffClerkRelation
.
setClerkCode
(
clerkRelation
.
getClerkCode
());
...
...
@@ -123,11 +123,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
List
<
StaffClerkRelationDTO
>
listBindCode
(
String
enterpriseId
,
Set
<
String
>
clerkCodeList
)
{
return
staffClerkRelatinService
.
listBindCode
(
enterpriseId
,
clerkCodeList
);
return
staffClerkRelatinService
.
listBindCode
(
enterpriseId
,
clerkCodeList
);
}
@Override
public
List
<
StaffClerkRelationDTO
>
listBindCodeByStaffId
(
List
<
String
>
enterpriseIdList
,
String
staffId
)
{
return
staffClerkRelatinService
.
listBindCodeByStaffId
(
enterpriseIdList
,
staffId
);
return
staffClerkRelatinService
.
listBindCodeByStaffId
(
enterpriseIdList
,
staffId
);
}
@Override
...
...
@@ -137,26 +138,26 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return
null
;
}
List
<
StaffClerkInfoDTO
>
infoDTOS
=
EntityUtil
.
changeEntityListByJSON
(
StaffClerkInfoDTO
.
class
,
list
);
Map
<
String
,
String
>
nameMap
=
new
HashMap
<>();
infoDTOS
.
forEach
(
infoDTO
->
{
Map
<
String
,
String
>
nameMap
=
new
HashMap
<>();
infoDTOS
.
forEach
(
infoDTO
->
{
//企业
if
(!
nameMap
.
containsKey
(
infoDTO
.
getEnterpriseId
()))
{
EnterpriseDTO
enterpriseDTO
=
enterpriseService
.
getEnterpriseById
(
infoDTO
.
getEnterpriseId
());
if
(
null
!=
enterpriseDTO
)
{
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
enterpriseDTO
.
getEnterprise
Name
());
}
else
{
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
"未知商户"
);
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
enterpriseDTO
.
getEnterpriseName
()+
"_"
+
enterpriseDTO
.
getBrand
Name
());
}
else
{
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
"未知商户"
);
}
}
//门店店员名称
if
(!
nameMap
.
containsKey
(
infoDTO
.
getClerkId
()))
{
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
infoDTO
.
getClerkId
());
if
(
null
!=
clerkDTO
)
{
nameMap
.
put
(
infoDTO
.
getClerkId
(),
clerkDTO
.
getClerkName
());
nameMap
.
put
(
infoDTO
.
getStoreId
(),
clerkDTO
.
getStoreName
());
nameMap
.
put
(
infoDTO
.
getClerkId
(),
clerkDTO
.
getClerkName
());
nameMap
.
put
(
infoDTO
.
getStoreId
(),
clerkDTO
.
getStoreName
());
infoDTO
.
setClerkPhoneNumber
(
clerkDTO
.
getPhoneNumber
());
}
else
{
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
"未知店员"
);
}
else
{
nameMap
.
put
(
infoDTO
.
getEnterpriseId
(),
"未知店员"
);
}
}
...
...
@@ -164,25 +165,33 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
if
(!
nameMap
.
containsKey
(
infoDTO
.
getStoreId
()))
{
StoreDTO
storeDTO
=
storeService
.
getStore
(
infoDTO
.
getStoreId
());
if
(
null
!=
storeDTO
)
{
nameMap
.
put
(
infoDTO
.
getStoreId
(),
storeDTO
.
getStoreName
());
}
else
{
nameMap
.
put
(
infoDTO
.
getStoreId
(),
"未知门店"
);
nameMap
.
put
(
infoDTO
.
getStoreId
(),
storeDTO
.
getStoreName
());
}
else
{
nameMap
.
put
(
infoDTO
.
getStoreId
(),
"未知门店"
);
}
}
infoDTO
.
setClerkName
(
nameMap
.
get
(
infoDTO
.
getClerkId
()));
infoDTO
.
setStoreName
(
nameMap
.
get
(
infoDTO
.
getStoreId
()));
infoDTO
.
setEnterpriseName
(
nameMap
.
get
(
infoDTO
.
getEnterpriseId
()));
if
((
nameMap
.
get
(
infoDTO
.
getEnterpriseId
()))!=
null
){
String
EnterpriseandBrandName
=
nameMap
.
get
(
infoDTO
.
getEnterpriseId
());
String
split
[]=
EnterpriseandBrandName
.
split
(
"_"
);
infoDTO
.
setEnterpriseName
(
split
[
0
]);
if
(
split
[
1
]!=
null
){
infoDTO
.
setBrandName
(
split
[
1
]);
}
}
// infoDTO.setEnterpriseName(nameMap.get(infoDTO.getEnterpriseId()));
});
return
infoDTOS
;
}
@Override
public
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
)
{
public
ServiceResponse
bindStaffClerk
(
StaffClerkRelationDTO
staffClerkRelationDTO
,
String
optStaffId
,
int
chanelCode
)
{
logger
.
info
(
"绑定clerk:{}"
,
JSONObject
.
toJSONString
(
staffClerkRelationDTO
));
ServiceResponse
<
Object
>
response
=
new
ServiceResponse
<>();
StaffClerkRelationDTO
relationDTO
=
staffClerkRelatinService
.
getBindByClerkId
(
staffClerkRelationDTO
.
getClerkId
(),
staffClerkRelationDTO
.
getWxEnterpriseId
());
if
(
null
!=
relationDTO
)
{
if
(
null
!=
relationDTO
)
{
response
.
setCode
(
2
);
response
.
setMessage
(
"已经被绑定,不能绑定"
);
return
response
;
...
...
@@ -203,46 +212,48 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
}
StaffClerkRelationDTO
storeHasBind
=
staffClerkRelatinService
.
getOneBindByStoreId
(
staffClerkRelationDTO
.
getStaffId
(),
staffClerkRelationDTO
.
getStoreId
());
if
(
storeHasBind
!=
null
)
{
if
(
storeHasBind
!=
null
)
{
response
.
setCode
(
3
);
response
.
setMessage
(
"该导购已在该门店下有其它成员绑定"
);
return
response
;
}
String
relationId
=
staffClerkRelatinService
.
bind
(
staffClerkRelationDTO
,
optStaffId
,
chanelCode
);
String
relationId
=
staffClerkRelatinService
.
bind
(
staffClerkRelationDTO
,
optStaffId
,
chanelCode
);
response
.
setResult
(
relationId
);
return
response
;
}
@Override
public
StaffClerkRelationDTO
getByCodeAndEnterpriseId
(
String
clerkCode
,
String
enterpriseId
)
{
return
staffClerkRelatinService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
return
staffClerkRelatinService
.
getByCodeAndEnterpriseId
(
clerkCode
,
enterpriseId
);
}
@Override
public
String
delByStoreIdAndCode
(
String
storeId
,
String
clerkCode
)
{
TabHaobanStaffClerkRelation
staffClerkRelation
=
tabHaobanStaffClerkRelationMapper
.
getByCodeAndStoreId
(
clerkCode
,
storeId
);
tabHaobanStaffClerkRelationMapper
.
delByStoreIdAndCode
(
storeId
,
clerkCode
);
tabHaobanStaffClerkRelationMapper
.
delByStoreIdAndCode
(
storeId
,
clerkCode
);
delSetMainStore
(
staffClerkRelation
);
return
null
;
}
@Override
public
List
<
StaffClerkRelationDTO
>
listByClerkIds
(
List
<
String
>
clerkIds
)
{
if
(
clerkIds
==
null
||
clerkIds
.
isEmpty
())
{
if
(
clerkIds
==
null
||
clerkIds
.
isEmpty
())
{
return
Collections
.
EMPTY_LIST
;
}
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByClerkIds
(
clerkIds
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
new
ArrayList
<
StaffClerkRelationDTO
>();
}
List
<
StaffClerkRelationDTO
>
result
=
EntityUtil
.
changeEntityListByJSON
(
StaffClerkRelationDTO
.
class
,
list
);
return
result
;
}
@Override
public
List
<
StaffClerkRelationDTO
>
listByStoreId
(
String
storeId
)
{
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByStoreId
(
storeId
);
if
(
CollectionUtil
.
isEmpty
(
list
))
{
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
new
ArrayList
<
StaffClerkRelationDTO
>();
}
List
<
StaffClerkRelationDTO
>
result
=
EntityUtil
.
changeEntityListByJSON
(
StaffClerkRelationDTO
.
class
,
list
);
...
...
@@ -251,98 +262,92 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
boolean
unbindByStaffAndClerkId
(
String
staffId
,
String
clerkId
)
{
boolean
b
=
staffClerkRelatinService
.
delBind
(
clerkId
,
staffId
,
ChannelCodeEnum
.
ADMIN_UNBIND
.
getCode
());
return
b
;
return
staffClerkRelatinService
.
delBind
(
clerkId
,
staffId
,
ChannelCodeEnum
.
ADMIN_UNBIND
.
getCode
());
}
@Override
public
StaffClerkRelationDTO
getOneByClerkId
(
String
clerkId
)
{
TabHaobanStaffClerkRelation
tab
=
tabHaobanStaffClerkRelationMapper
.
getOneByClerkId
(
clerkId
);
StaffClerkRelationDTO
result
=
EntityUtil
.
changeEntityByJSON
(
StaffClerkRelationDTO
.
class
,
tab
);
return
result
;
}
@Override
public
StaffClerkRelationDTO
getByClerkId
(
String
clerkId
)
{
StaffClerkRelationDTO
staffRelation
=
staffClerkRelatinService
.
getByClerkId
(
clerkId
);
return
staffRelation
;
}
@Override
public
StaffClerkRelationDTO
getOneByStoreIdAndStaffId
(
String
storeId
,
String
staffId
)
{
TabHaobanStaffClerkRelation
tab
=
tabHaobanStaffClerkRelationMapper
.
getOneByStoreIdAndStaffId
(
storeId
,
staffId
);
if
(
tab
==
null
)
{
TabHaobanStaffClerkRelation
tab
=
tabHaobanStaffClerkRelationMapper
.
getOneByStoreIdAndStaffId
(
storeId
,
staffId
);
if
(
tab
==
null
)
{
return
null
;
}
StaffClerkRelationDTO
dto
=
EntityUtil
.
changeEntity
(
StaffClerkRelationDTO
.
class
,
tab
);
return
dto
;
return
EntityUtil
.
changeEntity
(
StaffClerkRelationDTO
.
class
,
tab
);
}
@Override
public
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chanelCode
)
{
if
(
StringUtils
.
isNotBlank
(
staffClerkRelation
.
getStaffClerkRelationId
()))
{
public
void
delAndInsert
(
StaffClerkRelationDTO
staffClerkRelation
,
String
optStaffId
,
int
chanelCode
)
{
if
(
StringUtils
.
isNotBlank
(
staffClerkRelation
.
getStaffClerkRelationId
()))
{
TabHaobanStaffClerkRelation
oldStaffClerkRelation
=
tabHaobanStaffClerkRelationMapper
.
selectByPrimaryKey
(
staffClerkRelation
.
getStaffClerkRelationId
());
tabHaobanStaffClerkRelationMapper
.
delByPrimaryKey
(
staffClerkRelation
.
getStaffClerkRelationId
());
staffClerkBindLogService
.
pushToMq
(
oldStaffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
staffClerkRelation
.
getStaffClerkRelationId
());
staffClerkBindLogService
.
pushToMq
(
oldStaffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
UNBIND
.
getVal
(),
chanelCode
,
staffClerkRelation
.
getStaffClerkRelationId
());
clerkMainStoreRelatedService
.
delMainStore
(
oldStaffClerkRelation
.
getStaffId
(),
oldStaffClerkRelation
.
getStoreId
(),
oldStaffClerkRelation
.
getWxEnterpriseId
());
}
String
relationId
=
staffClerkRelatinService
.
insert
(
staffClerkRelation
);
staffClerkBindLogService
.
pushToMq
(
staffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
BIND
.
getVal
(),
chanelCode
,
relationId
);
staffClerkBindLogService
.
pushToMq
(
staffClerkRelation
.
getStaffId
(),
optStaffId
,
BindTypeEnum
.
BIND
.
getVal
(),
chanelCode
,
relationId
);
//设置主门店
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffClerkRelation
.
getStaffId
(),
staffClerkRelation
.
getWxEnterpriseId
());
}
@Override
public
void
delByClerkId
(
String
clerkId
)
{
TabHaobanStaffClerkRelation
staffClerkRelation
=
tabHaobanStaffClerkRelationMapper
.
getOneByClerkId
(
clerkId
);
tabHaobanStaffClerkRelationMapper
.
delByClerkId
(
clerkId
);
delSetMainStore
(
staffClerkRelation
);
}
@Override
public
List
<
StaffClerkRelationDTO
>
listByEnterpriseIdAndWxUserId
(
String
enterpriseId
,
String
wxUserId
)
{
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByEnterpriseIdAndWxUserId
(
enterpriseId
,
wxUserId
);
public
List
<
StaffClerkRelationDTO
>
listByEnterpriseIdAndWxUserId
(
String
enterpriseId
,
String
wxUserId
)
{
List
<
TabHaobanStaffClerkRelation
>
list
=
tabHaobanStaffClerkRelationMapper
.
listByEnterpriseIdAndWxUserId
(
enterpriseId
,
wxUserId
);
return
EntityUtil
.
changeEntityListByJSON
(
StaffClerkRelationDTO
.
class
,
list
);
}
@Override
public
Page
<
StaffClerkBindLogDetailDTO
>
pageStaffClerkBindLog
(
String
wxEnterpriseId
,
String
search
,
String
enterpriseId
,
int
optType
,
BasePageInfo
pageInfo
)
{
List
<
TabHaobanWxEnterpriseRelated
>
wxEnterpriseRelateds
=
wxEnterpriseRelatedService
.
getByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
wxEnterpriseRelateds
))
{
logger
.
info
(
"没有关联企业"
);
return
null
;
}
List
<
String
>
enterpriseList
=
wxEnterpriseRelateds
.
stream
().
map
(
TabHaobanWxEnterpriseRelated:
:
getEnterpriseId
)
.
filter
(
eid
->
{
.
filter
(
eid
->
{
if
(
StringUtils
.
isBlank
(
enterpriseId
))
{
return
true
;
}
else
if
(
enterpriseId
.
equals
(
eid
))
{
return
true
;
}
else
{
return
false
;
}
else
{
return
enterpriseId
.
equals
(
eid
);
}
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
enterpriseList
))
{
logger
.
info
(
"没有有效的企业"
);
return
null
;
}
List
<
String
>
clerkIds
=
null
;
// if (StringUtils.isNotBlank(search)) {
// List<ClerkDTO> clerk = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseList, search);
// if (CollectionUtils.isEmpty(clerk)) {
// logger.info("没有搜索到相应信息");
// return new Page<StaffClerkBindLogDetailDTO>();
// }
// clerkIds = clerk.stream().map(ClerkDTO::getClerkId).collect(Collectors.toList());
// }
Page
<
StaffClerkBindLogDetailDTO
>
retList
=
staffClerkBindLogService
.
pageBindLog
(
wxEnterpriseId
,
clerkIds
,
null
,
enterpriseList
,
optType
,
search
,
pageInfo
);
List
<
String
>
clerkIds
=
null
;
Page
<
StaffClerkBindLogDetailDTO
>
retList
=
staffClerkBindLogService
.
pageBindLog
(
wxEnterpriseId
,
clerkIds
,
null
,
enterpriseList
,
optType
,
search
,
pageInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
retList
.
getResult
()))
{
retList
.
getResult
().
forEach
(
staffClerkBindLogDetailDTO
->
{
TabHaobanStaff
haobanStaff
=
staffService
.
selectById
(
staffClerkBindLogDetailDTO
.
getStaffId
());
if
(
null
!=
haobanStaff
)
{
if
(
null
!=
haobanStaff
)
{
staffClerkBindLogDetailDTO
.
setStaffName
(
haobanStaff
.
getStaffName
());
staffClerkBindLogDetailDTO
.
setWxUserId
(
haobanStaff
.
getWxUserId
());
}
else
{
}
else
{
staffClerkBindLogDetailDTO
.
setStaffName
(
"未知成员"
);
}
if
(
"-1"
.
equals
(
staffClerkBindLogDetailDTO
.
getOptStaffId
()))
{
staffClerkBindLogDetailDTO
.
setOptStaffName
(
"系统"
);
}
else
{
}
else
{
haobanStaff
=
staffService
.
selectById
(
staffClerkBindLogDetailDTO
.
getOptStaffId
());
if
(
null
!=
haobanStaff
)
{
staffClerkBindLogDetailDTO
.
setOptStaffName
(
haobanStaff
.
getStaffName
());
...
...
@@ -363,24 +368,24 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
void
pushToBindLog
(
String
staffId
,
String
optStaffId
,
int
optType
,
int
channelCode
,
String
relationId
)
{
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
optType
,
channelCode
,
relationId
);
staffClerkBindLogService
.
pushToMq
(
staffId
,
optStaffId
,
optType
,
channelCode
,
relationId
);
}
private
void
setMainStore
(
StaffClerkRelationDTO
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
private
void
setMainStore
(
StaffClerkRelationDTO
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
String
staffId
=
staffClerkRelation
.
getStaffId
();
String
wxEnterpriseId
=
staffClerkRelation
.
getWxEnterpriseId
();
List
<
StaffClerkRelationDTO
>
list
=
staffClerkRelatinService
.
lisByStaffId
(
wxEnterpriseId
,
staffId
);
if
(
list
!=
null
&&
list
.
size
()
==
1
)
{
if
(
list
!=
null
&&
list
.
size
()
==
1
)
{
clerkMainStoreRelatedService
.
setMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
}
}
private
void
delSetMainStore
(
TabHaobanStaffClerkRelation
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
private
void
delSetMainStore
(
TabHaobanStaffClerkRelation
staffClerkRelation
)
{
if
(
staffClerkRelation
==
null
)
{
logger
.
info
(
"staffClerkRelation为空"
);
return
;
}
...
...
@@ -389,29 +394,21 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
externalClerkRelatedService
.
delByClerkIdAndStaffId
(
staffClerkRelation
.
getClerkId
(),
staffId
);
//删除主门店
clerkMainStoreRelatedService
.
delMainStore
(
staffId
,
staffClerkRelation
.
getStoreId
(),
wxEnterpriseId
);
// TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
// r.setStatusFlag(0);
// clerkMainStoreRelatedService.update(r);
// List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
// if(list != null && list.size() >= 1){
// clerkMainStoreRelatedService.setMainStore(staffId, list.get(list.size()-1).getStoreId(), wxEnterpriseId);
// }
}
@Override
public
ServiceResponse
<
String
>
getClerkMemberChatConfig
(
String
clerkId
)
{
ServiceResponse
response
=
new
ServiceResponse
();
ServiceResponse
response
=
new
ServiceResponse
();
StaffClerkRelationDTO
relationDTO
=
staffClerkRelatinService
.
getByClerkId
(
clerkId
);
if
(
null
==
relationDTO
)
{
logger
.
info
(
"导购没有关联企业微信:{}"
,
clerkId
);
logger
.
info
(
"导购没有关联企业微信:{}"
,
clerkId
);
response
.
setCode
(
2
);
response
.
setMessage
(
"导购没有关联企业微信"
);
return
response
;
}
MemberClerkChatConfig
chatConfig
=
staffClerkRelatinService
.
getChatConfig
(
relationDTO
.
getStaffId
(),
"-1"
);
if
(
chatConfig
!=
null
)
{
if
(
chatConfig
!=
null
)
{
response
.
setResult
(
chatConfig
.
getConfigId
());
return
response
;
}
...
...
@@ -426,15 +423,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
relationDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
relationDTO
.
getWxEnterpriseId
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
logger
.
info
(
"没有配置secret:{}"
,
relationDTO
.
getWxEnterpriseId
());
response
.
setCode
(
3
);
response
.
setMessage
(
"企业微信配置异常"
);
return
response
;
}
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
relationDTO
.
getWxEnterpriseId
());
String
configId
=
qywxUserApiService
.
getExternalcontactByUserId
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
send
);
logger
.
info
(
"configId:{}"
,
configId
);
logger
.
info
(
"configId:{}"
,
configId
);
if
(
StringUtils
.
isBlank
(
configId
))
{
logger
.
info
(
"staff:{}"
,
configId
,
JSONObject
.
toJSONString
(
relationDTO
));
response
.
setCode
(
4
);
...
...
@@ -454,6 +451,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
)
{
return
staffClerkRelatinService
.
pageByWxEnterpriseId
(
wxEnterpriseId
,
pageInfo
);
return
staffClerkRelatinService
.
pageByWxEnterpriseId
(
wxEnterpriseId
,
pageInfo
);
}
@Override
public
List
<
StaffClerkRelationDTO
>
listAll
()
{
return
staffClerkRelatinService
.
listAll
();
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffDepartmentRelatedApiServiceImpl.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
java.net.URLEncoder
;
import
java.util.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.client.utils.URLEncodedUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.api.dto.MessageDTO
;
import
com.gic.haoban.manage.api.dto.ApplicationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.enums.AppPageType
;
import
com.gic.haoban.manage.api.service.ApplicationApiService
;
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.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanApplication
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.ApplicationService
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
@Service
public
class
StaffDepartmentRelatedApiServiceImpl
implements
StaffDepartmentRelatedApiService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffDepartmentRelatedApiServiceImpl
.
class
);
...
...
@@ -455,15 +445,20 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
String
baseUrl
=
"/pages/route/index"
;
String
addurl
=
AppPageType
.
getDescByCode
(
type
);
String
url
=
""
;
if
(
type
==
AppPageType
.
INDEX
.
getCode
())
{
if
(
type
==
AppPageType
.
INDEX
.
getCode
())
{
//工作台
url
=
baseUrl
+
"?pageType="
+
addurl
;
}
else
{
url
=
baseUrl
+
"?pageType="
+
addurl
;
}
url
=
url
+
"&data="
;
String
encodeData
=
URLEncoder
.
encode
(
data
);
url
=
url
+
encodeData
;
url
=
baseUrl
+
"?pageType="
+
addurl
;
}
else
{
url
=
baseUrl
+
"?pageType="
+
addurl
;
}
url
=
url
+
"&data="
;
String
encodeData
=
null
;
try
{
encodeData
=
URLEncoder
.
encode
(
data
,
StandardCharsets
.
UTF_8
.
name
());
}
catch
(
UnsupportedEncodingException
e
)
{
logger
.
error
(
e
.
getMessage
());
}
url
=
url
+
encodeData
;
return
url
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/KafkaMessageServiceImpl.java
View file @
804b58a8
...
...
@@ -207,6 +207,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
&&
recordType
.
equals
(
GicRecordType
.
UPDATE
)
&&
!
mid
.
containsKey
(
"oldStoreGroupId"
))
{
mid
.
put
(
"oldStoreGroupId"
,
gicField
.
getValue
());
}
else
if
(
gicField
.
getName
().
equals
(
"store_name"
)
&&
recordType
.
equals
(
GicRecordType
.
UPDATE
)
&&
!
mid
.
containsKey
(
"oldStoreName"
))
{
mid
.
put
(
"oldStoreName"
,
gicField
.
getValue
());
}
else
{
mid
.
put
(
gicField
.
getName
(),
gicField
.
getValue
());
}
...
...
@@ -223,6 +227,13 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
* @param syncPojo
*/
private
void
dealStore
(
StoreSyncPojo
syncPojo
)
{
if
(
syncPojo
.
getRecordType
()
==
GicRecordType
.
UPDATE
.
value
()
&&
(!
syncPojo
.
getStoreName
().
equals
(
syncPojo
.
getOldStoreName
())))
{
logger
.
info
(
"门店名称变更:{}"
,
JSONObject
.
toJSONString
(
syncPojo
));
storeRangeService
.
updatwStoreName
(
syncPojo
.
getEnterpriseId
(),
syncPojo
.
getStoreId
(),
syncPojo
.
getStoreName
());
}
//门店状态变更 包括删除
if
(
syncPojo
.
getRecordType
()
==
GicRecordType
.
UPDATE
.
value
()
&&
(!
syncPojo
.
getStatus
().
equals
(
syncPojo
.
getOldStatus
())))
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/friend/FriendSyncNewOperation.java
View file @
804b58a8
...
...
@@ -26,14 +26,15 @@ import com.gic.member.api.dto.MemberDTO;
import
com.gic.member.api.service.MemberOpenCardBusinessService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
...
...
@@ -217,7 +218,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
return
"导购码不存在:"
+
clerkCode
;
}
MemberDTO
member
=
null
;
if
(
clerk
!=
null
&&
StringUtils
.
isNotBlank
(
qrcodeParam
)
&&
StringUtils
.
isNotBlank
(
externalUserDTO
.
getUnionId
()))
{
if
(
StringUtils
.
isNotBlank
(
qrcodeParam
)
&&
StringUtils
.
isNotBlank
(
externalUserDTO
.
getUnionId
()))
{
member
=
memberOpenCardBusinessService
.
getMemberByQywxChannelParam
(
staffClerkRelationDTO
.
getEnterpriseId
(),
externalUserDTO
.
getUnionId
(),
""
,
externalUserDTO
.
getName
(),
externalUserDTO
.
getAvatar
(),
qrcodeParam
);
}
...
...
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
804b58a8
...
...
@@ -49,7 +49,8 @@
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.StaffClerkRelationApiService"
ref=
"staffClerkRelationApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.DealSyncOperationApiService"
ref=
"dealSyncOperationApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.CheckQywxSettingApiService"
ref=
"checkQywxSettingApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.HandoverOperationApiService"
ref=
"handoverOperationApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.QywxTagApiService"
ref=
"qywxTagApiServiceImpl"
...
...
@@ -80,11 +81,16 @@
interface=
"com.gic.haoban.app.customer.service.api.service.CustomerApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"qywxTagSyncApiService"
interface=
"com.gic.haoban.app.customer.service.api.service.QywxTagSyncApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"enterpriseService"
interface=
"com.gic.enterprise.api.service.EnterpriseService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
interface=
"com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi"
id=
"syncHaobanToGicServiceApi"
/>
<dubbo:reference
interface=
"com.gic.member.api.service.MemberTagService"
id=
"memberTagService"
/>
<dubbo:reference
interface=
"com.gic.member.tag.api.service.MemberTagApiService"
id=
"memberTagApiService"
/>
<dubbo:reference
interface=
"com.gic.member.tag.api.service.MemberTagItemApiService"
id=
"memberTagItemApiService"
/>
<dubbo:reference
interface=
"com.gic.clerk.api.service.PowerService"
id=
"powerService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.AuthorizeService"
id=
"authorizeService"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/QywxTagItemMapper.xml
View file @
804b58a8
...
...
@@ -187,4 +187,28 @@
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
<select
id=
"listByQywxTagItemsIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_item
where qywx_tag_item_id in
<foreach
collection=
"ids"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
<select
id=
"listByQywxTagItemsKeys"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_item
where qywx_tag_key in
<foreach
collection=
"qywxTagKeys"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/QywxTagRelationMapper.xml
View file @
804b58a8
...
...
@@ -192,7 +192,6 @@
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and sync_flag=1
and status_flag=1
</select>
...
...
@@ -200,11 +199,23 @@
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_relation
where
member_tag_id = #{memberTagId,jdbcType=VARCHAR}
<if
test=
"wxEnterpriseId!=null"
>
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
and status_flag=1
</select>
<select
id=
"getQywxTagRelationByTagItemId"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and
member_tag_id = #{memberTag
Id,jdbcType=VARCHAR}
and
tag_item_id = #{tagItem
Id,jdbcType=VARCHAR}
and status_flag=1
and sync_flag=1
</select>
<update
id=
"delByMemberTagId"
>
update tab_haoban_qywx_tag_relation
set
...
...
@@ -222,7 +233,6 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
and status_flag=1
and sync_flag=1
</select>
<select
id=
"getQywxGroupByQywxTagId"
resultMap=
"BaseResultMap"
>
...
...
@@ -233,7 +243,6 @@
and qywx_tag_id = #{qywxTagId,jdbcType=VARCHAR}
and relation_type=0
and status_flag=1
and sync_flag=1
</select>
<select
id=
"getQywxTagByQywxTagItemId"
resultMap=
"BaseResultMap"
>
...
...
@@ -241,9 +250,19 @@
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_tag_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and qywx_tag_item_id = #{qywxTag
Id,jdbcType=VARCHAR}
and qywx_tag_item_id = #{qywxTagItem
Id,jdbcType=VARCHAR}
and relation_type=1
and status_flag=1
and sync_flag=1
</select>
<update
id=
"changeRelationSyncFlag"
>
UPDATE tab_haoban_qywx_tag_relation
SET
sync_flag=#{syncFlag},
update_time=now()
where
wx_enterprise_id = #{wxEnterpriseId}
and member_tag_id = #{memberTagId,jdbcType=VARCHAR}
and status_flag=1
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
View file @
804b58a8
...
...
@@ -528,6 +528,7 @@
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id=#{enterpriseId}
and status_flag in(1,3,4)
order by create_time
</select>
<select
id=
"listByMemberIds"
resultMap=
"BaseResultMap"
>
...
...
@@ -543,6 +544,18 @@
and status_flag = 1
</select>
<select
id=
"listMemberIdsByMemberIds"
resultType=
"String"
>
select
member_id
from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId}
and member_id in
<foreach
collection=
"memberIds"
open=
"("
separator=
","
close=
")"
item=
"item"
>
#{item}
</foreach>
and status_flag = 1
</select>
<select
id=
"listByMemberId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
@@ -550,4 +563,13 @@
where member_id = #{memberId}
and status_flag = 1
</select>
<select
id=
"listByExternalUserId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and external_user_id = #{externalUserId}
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
View file @
804b58a8
...
...
@@ -233,12 +233,11 @@
<update
id=
"delByStoreIdAndCode"
>
update tab_haoban_staff_clerk_relation
set
status_flag = 0,
set status_flag = 0,
update_time = now()
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and store_id = #{storeId,jdbcType=VARCHAR}
and status_flag =
1
and status_flag =
1
</update>
<select
id=
"listByClerkIds"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
...
...
@@ -426,13 +425,24 @@
</update>
<select
id=
"listBindStoreIdByEnterpriseId"
resultMap=
"BaseResultMap"
>
select
store_id,
select store_id,
wx_enterprise_id
from tab_haoban_staff_clerk_relation
where
enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
where enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1
group by store_id
</select>
<select
id=
"listAll"
resultType=
"com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"
>
SELECT a.store_id storeId,
a.wx_enterprise_id wxEnterpriseId,
a.wx_user_id wxUserId,
a.staff_id staffId,
a.clerk_id clerkId,
b.staff_name staffName
FROM tab_haoban_staff_clerk_relation a
LEFT JOIN tab_haoban_staff b ON b.staff_id = a.staff_id
WHERE a.status_flag = 1
GROUP BY a.staff_id
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanStoreRelationMapper.xml
View file @
804b58a8
...
...
@@ -208,4 +208,14 @@
</foreach>
and status_flag=1
</update>
<update
id=
"updateStoreName"
>
update tab_haoban_store_relation
set
store_name = #{storeName},
update_time = now()
where enterprise_id=#{enterpriseId}
and store_id=#{storeId}
and status_flag=1
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/test/java/DealSyncTest.java
View file @
804b58a8
...
...
@@ -12,7 +12,10 @@ import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.TestService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.DepartmentDTO
;
import
com.gic.wechat.api.dto.qywx.QywxExternalcontactDTO
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -51,6 +54,9 @@ public class DealSyncTest {
private
QywxUserApiService
qywxUserApiService
;
@Autowired
private
QywxDepartmentApiService
qywxDepartmentApiService
;
@Autowired
private
TestService
testService
;
@Autowired
...
...
@@ -94,4 +100,17 @@ public class DealSyncTest {
// countDownLatch.countDown();
}
@Test
public
void
test3
()
{
List
<
DepartmentDTO
>
department
=
qywxDepartmentApiService
.
listSelfDepartment
(
"wweac4ef962720aa12"
,
"GFu4FwkfcGFPue-qinB7ThEU4wR2SadbBH1yT5sLDzs"
,
null
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
department
));
}
@Test
public
void
test4
()
{
UserDTO
workWxUser
=
qywxUserApiService
.
getSelfWorkWxUser
(
"wweac4ef962720aa12"
,
"GFu4FwkfcGFPue-qinB7ThEU4wR2SadbBH1yT5sLDzs"
,
"WuXiangHong"
);
System
.
out
.
println
(
JSONObject
.
toJSONString
(
workWxUser
));
}
}
haoban-manage3-service/src/test/java/QywxTagTest.java
View file @
804b58a8
...
...
@@ -2,7 +2,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.manage.api.dto.AlertMessageDTO
;
import
com.gic.haoban.manage.api.dto.HandoverExternalDTO
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.HandoverOperationApiService
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
import
com.gic.mq.sdk.GicMQClient
;
...
...
@@ -15,7 +18,9 @@ import org.springframework.test.context.ContextConfiguration;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
...
...
@@ -26,6 +31,9 @@ public class QywxTagTest {
@Autowired
private
QywxTagApiService
qywxTagApiService
;
@Autowired
private
CheckQywxSettingApiService
checkQywxSettingApiService
;
@Test
public
void
test
()
{
...
...
@@ -33,4 +41,24 @@ public class QywxTagTest {
qywxTagApiService
.
pullQywxTag
(
wxEnterpriseId
);
}
@Test
public
void
test2
()
{
AlertMessageDTO
messageDTO
=
new
AlertMessageDTO
();
messageDTO
.
setTraceId
(
"111"
);
messageDTO
.
setEnterpriseId
(
""
);
messageDTO
.
setWxEnterpriseId
(
"ca66a01b79474c40b3e7c7f93daf1a3b"
);
messageDTO
.
setAlertTitle
(
"测试标题"
);
messageDTO
.
setAlertType
(
AlertTypeEnum
.
QYWX_TAG_SYNC
.
getType
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"测试"
,
"test"
);
messageDTO
.
setContentMap
(
map
);
checkQywxSettingApiService
.
alertCallback
(
JSONObject
.
toJSONString
(
messageDTO
));
}
@Test
public
void
test3
()
{
qywxTagApiService
.
checkQywxSync
(
"-1"
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
804b58a8
...
...
@@ -130,15 +130,14 @@ public class ClerkController extends WebBaseController{
if
(
StringUtils
.
isNotBlank
(
oldClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
)
{
if
(
leader
==
null
)
{
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
staffDTO
.
getStaffName
();
String
leaderName
=
leader
.
getClerkName
();
String
clerkCode
=
oldClerkCode
;
String
content
=
"【"
+
leaderName
+
"】:【"
+
storeName
+
"】"
+
staffName
+
"导购code:"
+
clerkCode
+
"已解绑,请重新分配会员!"
;
String
content
=
"【"
+
leaderName
+
"】:【"
+
storeName
+
"】"
+
staffName
+
"导购code:"
+
oldClerkCode
+
"已解绑,请重新分配会员!"
;
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"storeId"
,
storeId
);
String
data
=
jsonObject
.
toJSONString
();
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
804b58a8
...
...
@@ -52,6 +52,7 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
@RestController
public
class
StaffController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffController
.
class
);
...
...
@@ -135,7 +136,7 @@ public class StaffController extends WebBaseController{
List
<
String
>
departmentIds
=
sonDepartmentList
.
stream
().
map
(
DepartmentDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
);
List
<
StaffDTO
>
list
=
page
.
getResult
();
logger
.
info
(
"pages={},totalPage={}"
,
page
.
getCurrentPage
(),
page
.
getTotalPage
());
PageResult
<
StaffDTO
>
pageVo
=
new
PageResult
<>();
pageVo
.
setList
(
list
);
pageVo
.
setPageNum
(
page
.
getCurrentPage
());
...
...
@@ -245,6 +246,7 @@ public class StaffController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"get-clerk-info"
)
public
HaobanResponse
getClerkInfo
(
String
clerkId
){
StaffVO
staffVO
=
new
StaffVO
();
...
...
@@ -262,7 +264,6 @@ public class StaffController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
staffVO
);
}
@RequestMapping
(
"get-staff-info"
)
public
HaobanResponse
getStaffInfo
(
String
staffId
){
StaffVO
staffVO
=
new
StaffVO
();
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
804b58a8
...
...
@@ -155,6 +155,21 @@ public class ClerkController extends WebBaseController{
}
//门店成员列表
@RequestMapping
(
"/clerk-edit-flag"
)
public
HaobanResponse
clerkEditFlag
(
String
wxEnterpriseId
,
String
storeId
)
{
if
(
StringUtils
.
isAnyBlank
(
storeId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
StoreDTO
storeDTO
=
storeService
.
getStore
(
storeId
);
if
(
storeDTO
==
null
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10009
);
}
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
enterpriseBindInfo
.
getClerkEditFlag
());
}
//获取后台认证配置
@RequestMapping
(
"/get-audit-setting"
)
...
...
@@ -452,7 +467,7 @@ public class ClerkController extends WebBaseController{
RedisUtil
.
setCache
(
key
,
true
,
31
*
24
*
60
*
60L
);
clerkMainStoreRelatedApiService
.
setMainStore
(
staffId
,
storeId
,
wxEnterpriseId
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10007
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10031
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
...
...
@@ -505,11 +520,29 @@ public class ClerkController extends WebBaseController{
*/
@HttpLimit
@RequestMapping
(
"/check-fresh-friend"
)
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
version
)
{
boolean
freshFriendSyncTask
=
dealSyncOperationApiService
.
getFreshFriendSyncTask
(
wxEnterpriseId
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
freshFriendSyncTask
);
}
/**
* 刷新好友状态
*
* @param staffId
* @param storeId
* @param wxEnterpriseId
* @return
*/
@HttpLimit
@RequestMapping
(
"/fresh-friend-count"
)
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM"
);
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
0
:
(
Integer
)
RedisUtil
.
getCache
(
key
);
int
ret
=
count
==
null
?
4
:
4
-
count
;
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
ret
);
}
//获取门店详情
public
boolean
isEnterpriseOver
(
String
eid
)
{
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/InfoController.java
View file @
804b58a8
...
...
@@ -139,29 +139,19 @@ public class InfoController extends WebBaseController{
staffDTOS
.
addAll
(
userDtos
);
}
if
(
CollectionUtils
.
isNotEmpty
(
staffDTOS
))
{
loginStaff
=
staffDTOS
.
get
(
0
);
if
(
staffDTOS
.
size
()
>
1
)
{
String
dictName
=
loginUserId
.
getDictName
();
String
[]
split
=
dictName
.
split
(
"-"
);
if
(
split
.
length
>
1
)
{
String
weiCorpId
=
split
[
1
];
WxEnterpriseDTO
weiWxEnterpriseDTO
=
wxEnterpriseApiService
.
getEnterpriseBycorpId
(
weiCorpId
);
if
(
null
!=
weiWxEnterpriseDTO
)
{
loginStaff
=
staffDTOS
.
stream
().
filter
(
staffDTO
->
{
if
(
weiWxEnterpriseDTO
.
getWxEnterpriseId
().
equals
(
staffDTO
.
getWxEnterpriseId
())
)
{
if
(
dictName
.
indexOf
(
staffDTO
.
getWxEnterpriseId
())
>
0
)
{
return
true
;
}
else
{
return
false
;
}
}).
findFirst
().
orElse
(
staffDTOS
.
get
(
0
)
);
}
}
}).
findFirst
().
orElse
(
loginStaff
);
}
else
{
loginStaff
=
staffDTOS
.
get
(
0
);
}
}
// StaffDTO staffDTO = staffApiService.selectByNationcodeAndPhoneNumber(enterprise.getWxEnterpriseId(), "86", midPhone);
// if (null !=staffDTO) {
// loginStaff=staffDTO;
// }
}
}
...
...
@@ -295,7 +285,7 @@ public class InfoController extends WebBaseController{
private
MemberLoginQo
getUserByCode
(
WxEnterpriseDTO
enterpriseDTO
,
String
code
,
String
enterpriseId
)
{
SecretSettingDTO
secretSetting
=
wxEnterpriseApiService
.
getSecretSetting
(
enterpriseDTO
.
getWxEnterpriseId
(),
SecretTypeEnum
.
MEMBER_WAPP
.
getVal
(),
enterpriseId
);
if
(
null
==
secretSetting
||
StringUtils
.
isBlank
(
secretSetting
.
getSecretVal
()))
{
logger
.
info
(
"MEMBER_WAPPsecret配置没有配置"
);
logger
.
info
(
"MEMBER_WAPPsecret配置没
1ss
有配置"
);
return
null
;
}
String
userDTOJson
=
qywxUserApiService
.
getUserByCode
(
enterpriseDTO
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
code
);
...
...
@@ -315,11 +305,11 @@ public class InfoController extends WebBaseController{
}
@RequestMapping
(
"get-member-store"
)
public
HaobanResponse
getMemberStore
(
String
externalUserid
,
String
wxUser
Id
)
{
public
HaobanResponse
getMemberStore
(
String
externalUserid
,
String
wxUserId
,
String
store
Id
)
{
if
(
StringUtils
.
isAnyBlank
(
externalUserid
,
wxUserId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
List
<
MemberStoreDTO
>
result
=
memberUnionidRelatedApiService
.
listByExTernalUseridAndWxUserId
(
externalUserid
,
wxUser
Id
);
List
<
MemberStoreDTO
>
result
=
memberUnionidRelatedApiService
.
listByExTernalUseridAndWxUserId
(
externalUserid
,
wxUserId
,
store
Id
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
result
);
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/StoreController.java
View file @
804b58a8
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
com.gic.haoban.manage.api.dto.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.dubbo.common.utils.CollectionUtils
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
...
...
@@ -37,20 +18,23 @@ import com.gic.enterprise.api.service.StoreService;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.data.api.dto.HaobanDataDTO
;
import
com.gic.haoban.data.api.service.HaobanDataApiService
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.StoreFieldEnum
;
import
com.gic.haoban.manage.api.service.AuditApiService
;
import
com.gic.haoban.manage.api.service.AuditSettingApiService
;
import
com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
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.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.anno.IgnoreLogin
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.StaffStoreVO
;
import
com.gic.haoban.manage.web.vo.StoreDetailVO
;
import
com.gic.haoban.manage.web.vo.StoreVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
public
class
StoreController
extends
WebBaseController
{
...
...
@@ -59,10 +43,6 @@ public class StoreController extends WebBaseController{
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
...
...
@@ -78,9 +58,9 @@ public class StoreController extends WebBaseController{
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
private
EnterpriseService
enterpriseService
;
//门店列表
@RequestMapping
(
"/store-list"
)
public
HaobanResponse
storeList
(
String
staffId
,
String
wxEnterpriseId
,
String
version
)
{
...
...
@@ -112,23 +92,22 @@ public class StoreController extends WebBaseController{
continue
;
}
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkCode
(
staffClerkRelationDTO
.
getEnterpriseId
(),
staffClerkRelationDTO
.
getClerkCode
());
if
(
clerk
!=
null
)
{
if
(
clerk
==
null
)
{
continue
;
}
StoreDTO
store
=
storeService
.
getStore
(
clerk
.
getStoreId
());
if
(
store
==
null
)
{
continue
;
}
//主门店标志
int
mainStoreFlag
=
0
;
if
(
StringUtils
.
isEmpty
(
storeId
))
{
mainStoreFlag
=
0
;
}
else
if
(
storeId
.
equals
(
store
.
getStoreId
()))
{
if
(
storeId
.
equals
(
store
.
getStoreId
()))
{
mainStoreFlag
=
1
;
}
EnterpriseDetailDTO
enterpriseDetailDTO
=
enterpriseTypeMap
.
get
(
clerk
.
getEnterpriseId
());
staffDepartmentRelatedApiService
.
listByStaffId
(
staffId
);
StaffStoreVO
vo
=
new
StaffStoreVO
();
vo
.
setClerkCode
(
clerk
.
getClerkCode
());
vo
.
setWxEnterpriseType
(
enterpriseDetailDTO
!=
null
?
enterpriseDetailDTO
.
getWxEnterpriseType
()
:
null
);
vo
.
setMemberOpenCardFlag
(
enterpriseDetailDTO
!=
null
?
enterpriseDetailDTO
.
getMemberOpenCardFlag
()
:
null
);
vo
.
setClerkId
(
clerk
.
getClerkId
());
...
...
@@ -145,7 +124,6 @@ public class StoreController extends WebBaseController{
vo
.
setBindFlag
(
1
);
list
.
add
(
vo
);
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
list
);
}
...
...
@@ -325,23 +303,22 @@ public class StoreController extends WebBaseController{
//获取门店详情
public
boolean
isEnterpriseOver
(
String
storeId
)
{
StoreDTO
store
=
storeService
.
getStore
(
storeId
);
if
(
store
==
null
)
{
if
(
store
==
null
)
{
return
true
;
}
EnterpriseDTO
enterprise
=
enterpriseService
.
getEnterpriseBy
Ei
d
(
store
.
getEnterpriseId
());
EnterpriseDTO
enterprise
=
enterpriseService
.
getEnterpriseBy
I
d
(
store
.
getEnterpriseId
());
if
(
enterprise
==
null
||
enterprise
.
getStatus
()
!=
1
)
{
return
true
;
}
if
(
enterprise
.
getExpireTime
()
==
null
)
{
if
(
enterprise
.
getEnabledState
()
==
null
)
{
return
false
;
}
else
if
(
enterprise
.
getEnabledState
()
==
1
)
{
return
false
;
}
else
{
return
enterprise
.
getEnabledState
()
!=
1
;
}
}
else
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()
&&
enterprise
.
getEnabledState
()
==
1
)
{
return
false
;
}
else
{
return
enterprise
.
getExpireTime
().
getTime
()
<=
System
.
currentTimeMillis
()
||
enterprise
.
getEnabledState
()
!=
1
;
}
return
true
;
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
804b58a8
...
...
@@ -193,7 +193,8 @@ public enum HaoBanErrCode {
ERR_10004
(
10004
,
"成员名称不能为空"
),
ERR_10005
(
10005
,
"成员已存在"
),
ERR_10006
(
10006
,
"成员不存在"
),
ERR_10007
(
10007
,
"本月已经设置过主导购"
),
ERR_10007
(
10007
,
"本月已经设置过主导购"
),
ERR_10031
(
10031
,
"本月已经设置过主门店"
),
ERR_10009
(
10009
,
"门店不存在"
),
ERR_10010
(
10010
,
"gic新增失败"
),
...
...
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