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
adf7e102
Commit
adf7e102
authored
Jun 02, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!104
parents
e0b33f52
b12b189a
Show whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
1317 additions
and
295 deletions
+1317
-295
CheckFriendSettingDTO.java
.../com/gic/haoban/manage/api/dto/CheckFriendSettingDTO.java
+29
-0
ClerkMainStoreRelatedDTO.java
...m/gic/haoban/manage/api/dto/ClerkMainStoreRelatedDTO.java
+10
-0
EnterpriseDetailDTO.java
...va/com/gic/haoban/manage/api/dto/EnterpriseDetailDTO.java
+12
-0
ExternalUserDTO.java
...n/java/com/gic/haoban/manage/api/dto/ExternalUserDTO.java
+13
-0
MaterialDTO.java
.../main/java/com/gic/haoban/manage/api/dto/MaterialDTO.java
+18
-0
StaffClerkInfoDTO.java
...java/com/gic/haoban/manage/api/dto/StaffClerkInfoDTO.java
+12
-0
WxEnterpriseRelationDetailDTO.java
.../haoban/manage/api/dto/WxEnterpriseRelationDetailDTO.java
+9
-0
CheckQywxSettingApiService.java
...haoban/manage/api/service/CheckQywxSettingApiService.java
+33
-0
ClerkMainStoreRelatedApiService.java
...n/manage/api/service/ClerkMainStoreRelatedApiService.java
+8
-0
DealSyncOperationApiService.java
...aoban/manage/api/service/DealSyncOperationApiService.java
+9
-0
ExternalClerkRelatedApiService.java
...an/manage/api/service/ExternalClerkRelatedApiService.java
+24
-6
MaterialApiService.java
...com/gic/haoban/manage/api/service/MaterialApiService.java
+8
-0
MemberUnionidRelatedApiService.java
...an/manage/api/service/MemberUnionidRelatedApiService.java
+35
-3
WxEnterpriseRelatedApiService.java
...ban/manage/api/service/WxEnterpriseRelatedApiService.java
+7
-0
TabHaobanExternalClerkRelatedMapper.java
...rvice/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
+21
-1
TabHaobanMaterialMapper.java
...an/manage/service/dao/mapper/TabHaobanMaterialMapper.java
+2
-0
TabHaobanStoreRelationMapper.java
...nage/service/dao/mapper/TabHaobanStoreRelationMapper.java
+9
-0
TabHaobanClerkMainStoreRelated.java
...manage/service/entity/TabHaobanClerkMainStoreRelated.java
+10
-0
TabHaobanMaterial.java
...m/gic/haoban/manage/service/entity/TabHaobanMaterial.java
+10
-0
TabHaobanWxEnterpriseRelated.java
...n/manage/service/entity/TabHaobanWxEnterpriseRelated.java
+8
-0
ExternalUserPojo.java
.../com/gic/haoban/manage/service/pojo/ExternalUserPojo.java
+13
-0
MaterialService.java
...om/gic/haoban/manage/service/service/MaterialService.java
+12
-0
MiniprogramSettingService.java
...ban/manage/service/service/MiniprogramSettingService.java
+1
-0
WxEnterpriseRelatedService.java
...an/manage/service/service/WxEnterpriseRelatedService.java
+8
-0
WxEnterpriseService.java
...ic/haoban/manage/service/service/WxEnterpriseService.java
+2
-0
ClerkMainStoreRelatedServiceImpl.java
...ervice/service/impl/ClerkMainStoreRelatedServiceImpl.java
+1
-0
MaterialServiceImpl.java
...oban/manage/service/service/impl/MaterialServiceImpl.java
+7
-0
StoreRangeServiceImpl.java
...an/manage/service/service/impl/StoreRangeServiceImpl.java
+58
-12
WxEnterpriseRelatedServiceImpl.java
.../service/service/impl/WxEnterpriseRelatedServiceImpl.java
+11
-0
WxEnterpriseServiceImpl.java
.../manage/service/service/impl/WxEnterpriseServiceImpl.java
+12
-1
CheckQywxSettingApiServiceImpl.java
...vice/service/out/impl/CheckQywxSettingApiServiceImpl.java
+120
-0
ClerkMainStoreRelatedApiServiceImpl.java
...service/out/impl/ClerkMainStoreRelatedApiServiceImpl.java
+9
-0
DealSyncOperationApiServiceImpl.java
...ice/service/out/impl/DealSyncOperationApiServiceImpl.java
+10
-0
ExternalClerkRelatedApiServiceImpl.java
.../service/out/impl/ExternalClerkRelatedApiServiceImpl.java
+38
-12
MaterialApiServiceImpl.java
...nage/service/service/out/impl/MaterialApiServiceImpl.java
+68
-3
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+392
-223
WxApplicationApiServiceImpl.java
...service/service/out/impl/WxApplicationApiServiceImpl.java
+2
-2
WxEnterpriseApiServiceImpl.java
.../service/service/out/impl/WxEnterpriseApiServiceImpl.java
+1
-0
WxEnterpriseRelatedApiServiceImpl.java
...e/service/out/impl/WxEnterpriseRelatedApiServiceImpl.java
+16
-0
FriendSyncNewOperation.java
...an/manage/service/task/friend/FriendSyncNewOperation.java
+4
-1
MemberUnionidRelatedMapper.xml
.../src/main/resources/mapper/MemberUnionidRelatedMapper.xml
+2
-2
TabHaobanClerkMainStoreRelatedMapper.xml
...resources/mapper/TabHaobanClerkMainStoreRelatedMapper.xml
+14
-2
TabHaobanExternalClerkRelatedMapper.xml
.../resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
+22
-0
TabHaobanMaterialMapper.xml
...ice/src/main/resources/mapper/TabHaobanMaterialMapper.xml
+30
-3
TabHaobanStoreRelationMapper.xml
...rc/main/resources/mapper/TabHaobanStoreRelationMapper.xml
+14
-0
WxEnterpriseRelatedMapper.xml
...e/src/main/resources/mapper/WxEnterpriseRelatedMapper.xml
+11
-1
ServiceTest.java
haoban-manage3-service/src/test/java/ServiceTest.java
+36
-15
test.java
haoban-manage3-service/src/test/java/test.java
+8
-3
GicDepartmentController.java
...haoban/manage/web/controller/GicDepartmentController.java
+2
-0
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+16
-0
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+20
-0
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+1
-0
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+2
-0
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+58
-5
AuditSettingVO.java
...ain/java/com/gic/haoban/manage/web/vo/AuditSettingVO.java
+9
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/CheckFriendSettingDTO.java
0 → 100644
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
/**
* Created 2021/5/31.
*
* @author hua
*/
public
class
CheckFriendSettingDTO
implements
Serializable
{
private
String
wxEnterpriseId
;
private
String
name
;
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/ClerkMainStoreRelatedDTO.java
View file @
adf7e102
...
...
@@ -15,6 +15,8 @@ public class ClerkMainStoreRelatedDTO implements Serializable{
private
Integer
mainStoreFlag
;
private
Integer
freshFriendFlag
;
private
Integer
statusFlag
;
private
Date
createTime
;
...
...
@@ -23,6 +25,14 @@ public class ClerkMainStoreRelatedDTO implements Serializable{
private
static
final
long
serialVersionUID
=
1L
;
public
Integer
getFreshFriendFlag
()
{
return
freshFriendFlag
;
}
public
void
setFreshFriendFlag
(
Integer
freshFriendFlag
)
{
this
.
freshFriendFlag
=
freshFriendFlag
;
}
public
String
getClerkMainStoreRelatedId
()
{
return
clerkMainStoreRelatedId
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/EnterpriseDetailDTO.java
View file @
adf7e102
...
...
@@ -18,6 +18,10 @@ public class EnterpriseDetailDTO implements Serializable{
private
String
version
;
private
int
nodeCount
;
private
String
enterpriseLogo
;
/**
* 导购编辑权限
*/
private
Integer
clerkEditFlag
;
private
String
staffId
;
private
String
staffName
;
private
Date
createTime
;
...
...
@@ -25,6 +29,14 @@ public class EnterpriseDetailDTO implements Serializable{
private
Integer
wxEnterpriseType
;
private
Integer
memberOpenCardFlag
;
public
Integer
getClerkEditFlag
()
{
return
clerkEditFlag
;
}
public
void
setClerkEditFlag
(
Integer
clerkEditFlag
)
{
this
.
clerkEditFlag
=
clerkEditFlag
;
}
public
Integer
getWxEnterpriseType
()
{
return
wxEnterpriseType
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/ExternalUserDTO.java
View file @
adf7e102
...
...
@@ -29,6 +29,19 @@ public class ExternalUserDTO implements Serializable{
private
String
staffId
;
private
String
selfExternalUserId
;
/**
* 好友类型
* 1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户
*/
private
Integer
friendType
;
public
Integer
getFriendType
()
{
return
friendType
;
}
public
void
setFriendType
(
Integer
friendType
)
{
this
.
friendType
=
friendType
;
}
public
String
getSelfExternalUserId
()
{
return
selfExternalUserId
;
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/MaterialDTO.java
View file @
adf7e102
...
...
@@ -42,9 +42,27 @@ public class MaterialDTO implements Serializable{
private
Date
updateTime
;
private
String
fromMaterialId
=
"-1"
;
//appid link路径 img_url 封面图 materialTitle
private
String
appId
;
private
static
final
long
serialVersionUID
=
1L
;
public
String
getMediaid
()
{
return
mediaid
;
}
public
void
setMediaid
(
String
mediaid
)
{
this
.
mediaid
=
mediaid
;
}
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getFromMaterialId
()
{
return
fromMaterialId
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffClerkInfoDTO.java
View file @
adf7e102
...
...
@@ -35,6 +35,18 @@ public class StaffClerkInfoDTO implements Serializable{
private
Date
updateTime
;
private
String
clerkPhoneNumber
;
/**
* 是否主门店
*/
private
Integer
mainStoreFlag
;
public
Integer
getMainStoreFlag
()
{
return
mainStoreFlag
;
}
public
void
setMainStoreFlag
(
Integer
mainStoreFlag
)
{
this
.
mainStoreFlag
=
mainStoreFlag
;
}
private
static
final
long
serialVersionUID
=
1L
;
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/WxEnterpriseRelationDetailDTO.java
View file @
adf7e102
...
...
@@ -18,8 +18,17 @@ public class WxEnterpriseRelationDetailDTO implements Serializable {
private
String
staffName
;
private
int
wxEnterpriseType
;
private
int
memberOpenCardFlag
;
private
Integer
clerkEditFlag
;
private
List
<
StoreOrGroupInfoDTO
>
relations
;
public
Integer
getClerkEditFlag
()
{
return
clerkEditFlag
;
}
public
void
setClerkEditFlag
(
Integer
clerkEditFlag
)
{
this
.
clerkEditFlag
=
clerkEditFlag
;
}
public
String
getWxEnterpriseRelatedId
()
{
return
wxEnterpriseRelatedId
;
}
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/CheckQywxSettingApiService.java
0 → 100644
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
com.gic.haoban.manage.api.dto.CheckFriendSettingDTO
;
import
com.gic.haoban.manage.api.dto.ExternalUserDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
/**
* Created 2021/5/31.
*
* @author hua
*/
public
interface
CheckQywxSettingApiService
{
/**
* 设置好友添加流程
*
* @param wxEnterpriseId
* @param name
*/
public
void
setFriendSetting
(
String
wxEnterpriseId
,
String
name
);
/**
* 获取设置的好友流程
*/
public
CheckFriendSettingDTO
getFriendSetting
();
/**
* 校验保存
*
* @param externalUserDTO
* @param dto
*/
public
void
saveFriendCallback
(
String
wxEnterpriseId
,
ExternalUserDTO
externalUserDTO
,
MemberUnionidRelatedDTO
dto
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/ClerkMainStoreRelatedApiService.java
View file @
adf7e102
...
...
@@ -8,4 +8,12 @@ public interface ClerkMainStoreRelatedApiService {
ClerkMainStoreRelatedDTO
getWxEnterpriseIdAndStaffId
(
String
wxEnterpriseId
,
String
staffId
);
/**
* 设置刷新好友状态为已刷新
*
* @param wxEnterpriseId
* @param staffId
*/
void
setFreshFriend
(
String
wxEnterpriseId
,
String
staffId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DealSyncOperationApiService.java
View file @
adf7e102
...
...
@@ -165,4 +165,13 @@ public interface DealSyncOperationApiService {
public
void
quartWxFriendClerk
(
String
res
);
void
test
(
String
wxEnterpriseId
,
String
taskId
);
/**
* 获取刷新状态
*
* @param wxEnterpriseId
* @param staffId
* @return true 刷新中 false 没刷新或刷新完成
*/
public
boolean
getFreshFriendSyncTask
(
String
wxEnterpriseId
,
String
staffId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/ExternalClerkRelatedApiService.java
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
java.util.Date
;
import
java.util.List
;
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.AuditDTO
;
import
com.gic.haoban.manage.api.dto.BatchAuditLogDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created by tgs on 2020/2/9.
*/
public
interface
ExternalClerkRelatedApiService
{
/**
* 查询导购好友关联
*
* @param wxUserId : 微信用户id
* @param wxEnterpriseId : 微信企业id
* @param enterpriseId : 企业id
* @return : 返回好友关联
*/
List
<
ExternalClerkRelatedDTO
>
listByWxUserIdAndWxEnterpriseId
(
String
wxUserId
,
String
wxEnterpriseId
,
String
enterpriseId
);
/**
* 查询会员在企业下的好友关系
*
* @param memberId : 会员id
* @param wxEnterpriseId : 微信企业id
* @param enterpriseId : 企业id
* @return : 返回会员导购关联关系
*/
List
<
ExternalClerkRelatedDTO
>
listByMemberIdAndWxEnterpriseId
(
String
memberId
,
String
wxEnterpriseId
,
String
enterpriseId
);
List
<
ExternalClerkRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
);
Page
<
ExternalClerkRelatedDTO
>
pageMemberUnionByParams
(
List
<
String
>
userIdList
,
List
<
String
>
sendMemberIds
,
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MaterialApiService.java
View file @
adf7e102
...
...
@@ -59,4 +59,12 @@ public interface MaterialApiService {
*/
void
delMaterial
(
List
<
String
>
ids
);
/**
* 自动刷新madiaid的 获取素材
*
* @param materialId
* @return
*/
MaterialDTO
getHasChangeMadieMaterialById
(
String
materialId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MemberUnionidRelatedApiService.java
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.api.base.commons.JSONResponse
;
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.*
;
import
java.util.Date
;
import
java.util.List
;
public
interface
MemberUnionidRelatedApiService
{
/**
...
...
@@ -52,6 +52,38 @@ public interface MemberUnionidRelatedApiService {
String
sendMessage
(
String
wxEnterpriseId
,
String
userId
,
List
<
String
>
extendUserList
,
String
materialId
);
/**
* 创建企业群发, 支出素材批量发送
*
* @param wxEnterpriseId : 微信企业id
* @param userId : 用户id
* @param extendUserList : 发送的用户id
* @param materialIdList : 素材id列表
* @return : 返回群发执行结果
*/
JSONResponse
sendMessage
(
String
wxEnterpriseId
,
String
userId
,
List
<
String
>
extendUserList
,
List
<
String
>
materialIdList
);
/**
* 获取群发成员发送任务列表
*
* @param wxEnterpriseId : 微信企业id
* @param wxMessageId : 消息id
* @param cursor : 分页游标
* @return : 返回请求结果
*/
JSONResponse
taskExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
);
/**
* 获取企业群发成员执行结果
*
* @param wxEnterpriseId : 微信企业id
* @param wxMessageId : 消息id
* @param cursor : 分页游标
* @param userId : 用户id
* @return : 返回请求结果
*/
JSONResponse
resultExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
,
String
userId
);
JSONResponse
getMessageStatus
(
String
wxEnterpriseId
,
String
wxMessageId
);
List
<
MemberUnionidRelatedDTO
>
getByWxUserIdListAndWxEnterpriseId
(
List
<
String
>
userIdList
,
String
wxEnterpriseId
);
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/WxEnterpriseRelatedApiService.java
View file @
adf7e102
...
...
@@ -134,4 +134,11 @@ public interface WxEnterpriseRelatedApiService {
*/
public
boolean
initHistoryEnterprise
(
String
wxEnterpriseId
);
/**
* 初始化历史门店数据
*
* @return
*/
public
boolean
setClerkEditFlag
(
String
wxEnterprieseRelatedId
,
int
clerkEditFlag
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanExternalClerkRelatedMapper.java
View file @
adf7e102
...
...
@@ -108,6 +108,25 @@ public interface TabHaobanExternalClerkRelatedMapper {
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"wxUserId"
)
String
wxUserId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"externalUserId"
)
String
externalUserId
);
/**
* 查询会员在企业下的好友关系
* @param memberId
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByMemberIdAndWxEnterpriseId
(
@Param
(
"memberId"
)
String
memberId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
/**
* 查询会员在企业下的好友关系
* @param wxUserId
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
List
<
TabHaobanExternalClerkRelated
>
listByWxUserIdAndWxEnterpriseId
(
@Param
(
"wxUserId"
)
String
wxUserId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanMaterialMapper.java
View file @
adf7e102
...
...
@@ -26,6 +26,8 @@ public interface TabHaobanMaterialMapper {
Page
<
TabHaobanMaterial
>
listMaterial
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"keyword"
)
String
keyword
,
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"materialType"
)
Integer
materialType
);
List
<
TabHaobanMaterial
>
listMaterialByCategoryIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"keyword"
)
String
keyword
,
@Param
(
"categoryIds"
)
List
<
String
>
categoryIds
,
@Param
(
"materialType"
)
Integer
materialType
);
TabHaobanMaterial
selectByfromMaterialId
(
@Param
(
"fromMaterialId"
)
String
fromMaterialId
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanMaterial
>
listByfromMaterialId
(
@Param
(
"fromMaterialId"
)
String
fromMaterialId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanStoreRelationMapper.java
View file @
adf7e102
...
...
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
@Mapper
public
interface
TabHaobanStoreRelationMapper
{
...
...
@@ -64,6 +65,14 @@ public interface TabHaobanStoreRelationMapper {
public
int
deleteAllStoreRalation
(
@Param
(
"enterpriseId"
)
String
enterpriseId
);
/**
* 删除门店
*
* @param enterpriseId
* @return
*/
public
int
deleteStoreRalationByStoreIds
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"storeIds"
)
Set
<
String
>
storeIds
);
/**
* 所有门店id
*
* @param wxEnterpriseId
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanClerkMainStoreRelated.java
View file @
adf7e102
...
...
@@ -14,6 +14,8 @@ public class TabHaobanClerkMainStoreRelated implements Serializable {
private
Integer
mainStoreFlag
;
private
Integer
freshFriendFlag
;
private
Integer
statusFlag
;
private
Date
createTime
;
...
...
@@ -22,6 +24,14 @@ public class TabHaobanClerkMainStoreRelated implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
public
Integer
getFreshFriendFlag
()
{
return
freshFriendFlag
;
}
public
void
setFreshFriendFlag
(
Integer
freshFriendFlag
)
{
this
.
freshFriendFlag
=
freshFriendFlag
;
}
public
String
getClerkMainStoreRelatedId
()
{
return
clerkMainStoreRelatedId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanMaterial.java
View file @
adf7e102
...
...
@@ -34,12 +34,22 @@ public class TabHaobanMaterial implements Serializable {
private
String
link
;
private
String
appId
;
private
Date
createTime
;
private
Date
updateTime
;
private
String
fromMaterialId
;
public
String
getAppId
()
{
return
appId
;
}
public
void
setAppId
(
String
appId
)
{
this
.
appId
=
appId
;
}
public
String
getFromMaterialId
()
{
return
fromMaterialId
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabHaobanWxEnterpriseRelated.java
View file @
adf7e102
...
...
@@ -28,7 +28,15 @@ public class TabHaobanWxEnterpriseRelated implements Serializable {
private
Integer
rangeType
;
private
Integer
clerkEditFlag
;
public
Integer
getClerkEditFlag
()
{
return
clerkEditFlag
;
}
public
void
setClerkEditFlag
(
Integer
clerkEditFlag
)
{
this
.
clerkEditFlag
=
clerkEditFlag
;
}
private
static
final
long
serialVersionUID
=
1L
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/ExternalUserPojo.java
View file @
adf7e102
...
...
@@ -15,6 +15,19 @@ public class ExternalUserPojo implements Serializable{
private
String
addCreateTime
;
private
String
externalUserId
;
/**
* 好友类型
* 1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户
*/
private
Integer
friendType
;
public
Integer
getFriendType
()
{
return
friendType
;
}
public
void
setFriendType
(
Integer
friendType
)
{
this
.
friendType
=
friendType
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/MaterialService.java
View file @
adf7e102
...
...
@@ -19,6 +19,18 @@ public interface MaterialService {
com
.
github
.
pagehelper
.
Page
listMaterial
(
String
wxEnterpriseId
,
String
keyword
,
String
categoryId
,
Integer
materialType
);
/**
* 查询素材
*
* @param wxEnterpriseId
* @param keyword
* @param categoryId
* @param materialType
* @return
*/
com
.
github
.
pagehelper
.
Page
listMaterial
(
String
wxEnterpriseId
,
String
keyword
,
List
<
String
>
categoryId
,
Integer
materialType
);
MaterialDTO
getMaterialByFromMaterialId
(
String
fromMaterialId
,
String
wxEnterpriseId
);
/**
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/MiniprogramSettingService.java
View file @
adf7e102
...
...
@@ -52,4 +52,5 @@ public interface MiniprogramSettingService {
*/
public
boolean
delMiniprogramSetting
(
String
id
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseRelatedService.java
View file @
adf7e102
...
...
@@ -27,4 +27,12 @@ public interface WxEnterpriseRelatedService {
* @return
*/
TabHaobanWxEnterpriseRelated
getByEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
);
/**
* 设置导购编辑权限
*
* @param id
* @return
*/
void
setClerkEdit
(
String
id
,
int
clerkEditFlag
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseService.java
View file @
adf7e102
...
...
@@ -27,5 +27,7 @@ public interface WxEnterpriseService {
int
delete
(
String
wxEnterpriseId
);
int
unbind
(
String
wxEnterpriseId
);
TabHaobanWxEnterprise
getEnterpriseBycorpIdNoStatus
(
String
corpid
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/ClerkMainStoreRelatedServiceImpl.java
View file @
adf7e102
...
...
@@ -39,6 +39,7 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
t
.
setCreateTime
(
now
);
t
.
setUpdateTime
(
now
);
t
.
setStatusFlag
(
1
);
t
.
setFreshFriendFlag
(
0
);
t
.
setClerkMainStoreRelatedId
(
uuId
);
mapper
.
insert
(
t
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/MaterialServiceImpl.java
View file @
adf7e102
...
...
@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.impl;
import
java.util.Date
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -65,6 +66,12 @@ public class MaterialServiceImpl implements MaterialService {
}
@Override
public
Page
<
TabHaobanMaterial
>
listMaterial
(
String
wxEnterpriseId
,
String
keyword
,
List
<
String
>
categoryIds
,
Integer
materialType
)
{
List
<
TabHaobanMaterial
>
materials
=
mapper
.
listMaterialByCategoryIds
(
wxEnterpriseId
,
keyword
,
categoryIds
,
materialType
);
return
(
Page
)
materials
;
}
@Override
public
MaterialDTO
getMaterialByFromMaterialId
(
String
fromMaterialId
,
String
wxEnterpriseId
)
{
TabHaobanMaterial
tabHaobanMaterial
=
mapper
.
selectByfromMaterialId
(
fromMaterialId
,
wxEnterpriseId
);
return
EntityUtil
.
changeEntityByJSON
(
MaterialDTO
.
class
,
tabHaobanMaterial
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StoreRangeServiceImpl.java
View file @
adf7e102
...
...
@@ -109,34 +109,80 @@ public class StoreRangeServiceImpl implements StoreRangeService {
@Override
public
boolean
saveStoreRelations
(
List
<
TabStoreRelation
>
list
,
String
optStaffId
,
int
channelCode
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
logger
.
info
(
"没有需要保存的"
);
logger
.
info
(
"没有需要保存的
: 有问题的授权
"
);
return
true
;
}
String
enterpriseId
=
list
.
get
(
0
).
getEnterpriseId
();
//更新前绑定门店列表
List
<
TabStoreRelation
>
storeRelations
=
tabHaobanStoreRelationMapper
.
listStoreRange
(
enterpriseId
);
Map
<
String
,
Set
<
String
>>
oldStoreIdByMap
=
storeRelations
.
stream
().
collect
(
Collectors
.
groupingBy
(
TabStoreRelation:
:
getWxEnterpriseId
,
Collectors
.
mapping
(
dto
->
dto
.
getStoreId
(),
Collectors
.
toSet
())));
//根据wxEnterpriseId 分组
Map
<
String
,
Set
<
String
>>
newStoreIdBywxEnterpriseMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
TabStoreRelation:
:
getWxEnterpriseId
,
Collectors
.
mapping
(
dto
->
dto
.
getStoreId
(),
Collectors
.
toSet
())));
//所有就的门店old绑定列表
Map
<
String
,
Set
<
String
>>
oldStoreIdBywxEnterpriseMap
=
getOldStoreIdsByWxEnterpriseId
(
enterpriseId
);
Map
<
String
,
Set
<
String
>>
oldStoreIdBywxEnterpriseMap
=
getOldStoreIdsByWxEnterpriseId
(
enterpriseId
,
oldStoreIdByMap
);
//需要解绑门店
Set
<
String
>
needUnBindStoreIds
=
new
HashSet
<>();
//需要新增权限门店
Set
<
String
>
needAddStoreIds
=
new
HashSet
<>();
oldStoreIdBywxEnterpriseMap
.
forEach
((
wxEid
,
oldStoreIds
)
->
{
Set
<
String
>
newStoreIds
=
newStoreIdBywxEnterpriseMap
.
get
(
wxEid
);
logger
.
info
(
"wxEnterpriseId-difference-"
+
wxEid
+
":{},{}"
,
JSONObject
.
toJSONString
(
oldStoreIds
),
JSONObject
.
toJSONString
(
newStoreIds
));
if
(
CollectionUtils
.
isEmpty
(
newStoreIds
))
{
//没有新的 老的都需要删除
needUnBindStoreIds
.
addAll
(
oldStoreIds
);
return
;
}
Sets
.
SetView
<
String
>
needDelStoreIds
=
Sets
.
difference
(
oldStoreIds
,
newStoreIds
);
logger
.
info
(
"wxEnterpriseId-difference-"
+
wxEid
+
":{},{}"
,
JSONObject
.
toJSONString
(
oldStoreIds
),
JSONObject
.
toJSONString
(
newStoreIds
));
logger
.
info
(
"wxEnterpriseId:{},{}"
,
wxEid
,
JSONObject
.
toJSONString
(
needDelStoreIds
));
Set
<
String
>
mid
=
needDelStoreIds
.
stream
().
collect
(
Collectors
.
toSet
());
needUnBindStoreIds
.
addAll
(
mid
);
//需要新增
Set
<
String
>
old
=
oldStoreIdByMap
.
get
(
wxEid
);
if
(
CollectionUtils
.
isEmpty
(
old
))
{
needAddStoreIds
.
addAll
(
newStoreIds
);
return
;
}
Sets
.
SetView
<
String
>
needAdd
=
Sets
.
difference
(
newStoreIds
,
old
);
if
(
CollectionUtils
.
isNotEmpty
(
needAdd
))
{
needAddStoreIds
.
addAll
(
needAdd
);
}
});
//这些门店解除绑定
staffClerkRelationService
.
delBindByStoreIds
(
null
,
needUnBindStoreIds
,
optStaffId
,
channelCode
);
//批量处理关联关系
dealStoreRelation
(
list
,
enterpriseId
,
needUnBindStoreIds
,
needAddStoreIds
);
return
true
;
}
/**
* 批量处理关联关系
*
* @param storeRelations
* @param enterpriseId
* @param delStoreIds
* @param addStoreIds
*/
private
void
dealStoreRelation
(
List
<
TabStoreRelation
>
storeRelations
,
String
enterpriseId
,
Set
<
String
>
delStoreIds
,
Set
<
String
>
addStoreIds
)
{
// //先删除 后新增
// tabHaobanStoreRelationMapper.deleteAllStoreRalation(enterpriseId);
// //批量插入
// insertStoreRelationBatch(storeRelations);
//先删除 后新增
tabHaobanStoreRelationMapper
.
deleteAllStoreRalation
(
enterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
delStoreIds
))
{
logger
.
info
(
"批量删除门店:{}"
,
JSONObject
.
toJSONString
(
delStoreIds
));
tabHaobanStoreRelationMapper
.
deleteStoreRalationByStoreIds
(
enterpriseId
,
delStoreIds
);
}
if
(
CollectionUtils
.
isNotEmpty
(
addStoreIds
))
{
logger
.
info
(
"批量新增门店:{}"
,
JSONObject
.
toJSONString
(
addStoreIds
));
List
<
TabStoreRelation
>
adds
=
storeRelations
.
stream
().
filter
(
dto
->
addStoreIds
.
contains
(
dto
.
getStoreId
())).
collect
(
Collectors
.
toList
());
//批量插入
insertStoreRelationBatch
(
list
);
return
true
;
insertStoreRelationBatch
(
adds
);
}
}
/**
...
...
@@ -163,21 +209,21 @@ public class StoreRangeServiceImpl implements StoreRangeService {
* @param enterpriseId
* @return
*/
private
Map
<
String
,
Set
<
String
>>
getOldStoreIdsByWxEnterpriseId
(
String
enterpriseId
)
{
private
Map
<
String
,
Set
<
String
>>
getOldStoreIdsByWxEnterpriseId
(
String
enterpriseId
,
Map
<
String
,
Set
<
String
>>
oldStoreIdBywxEnterpriseMap
)
{
Map
<
String
,
Set
<
String
>>
ret
=
new
HashMap
<>();
Set
<
String
>
wxEnterpriseIds
=
new
HashSet
<>();
//更新前绑定门店列表
List
<
TabStoreRelation
>
storeRelations
=
tabHaobanStoreRelationMapper
.
listStoreRange
(
enterpriseId
);
Map
<
String
,
Set
<
String
>>
oldStoreIdBywxEnterpriseMap
=
storeRelations
.
stream
().
collect
(
Collectors
.
groupingBy
(
TabStoreRelation:
:
getWxEnterpriseId
,
Collectors
.
mapping
(
dto
->
dto
.
getStoreId
(),
Collectors
.
toSet
())));
if
(
CollectionUtils
.
isNotEmpty
(
storeRelations
)
)
{
//
//更新前绑定门店列表
//
List<TabStoreRelation> storeRelations = tabHaobanStoreRelationMapper.listStoreRange(enterpriseId);
//
Map<String, Set<String>> oldStoreIdBywxEnterpriseMap = storeRelations.stream().collect(Collectors.groupingBy(TabStoreRelation::getWxEnterpriseId, Collectors.mapping(dto -> dto.getStoreId(), Collectors.toSet())));
if
(
oldStoreIdBywxEnterpriseMap
!=
null
&&
oldStoreIdBywxEnterpriseMap
.
size
()
>
0
)
{
wxEnterpriseIds
.
addAll
(
oldStoreIdBywxEnterpriseMap
.
keySet
());
}
//导购绑定列表
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listBindStoreIdByEnterpriseId
(
enterpriseId
);
Map
<
String
,
Set
<
String
>>
oldStaffStoreIdByWxEidMap
=
staffClerkRelationDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
StaffClerkRelationDTO:
:
getWxEnterpriseId
,
Collectors
.
mapping
(
dto
->
dto
.
getStoreId
(),
Collectors
.
toSet
())));
if
(
CollectionUtils
.
isNotEmpty
(
staffClerkRelationDTOS
)
)
{
if
(
oldStaffStoreIdByWxEidMap
!=
null
&&
oldStaffStoreIdByWxEidMap
.
size
()
>
0
)
{
wxEnterpriseIds
.
addAll
(
oldStaffStoreIdByWxEidMap
.
keySet
());
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseRelatedServiceImpl.java
View file @
adf7e102
...
...
@@ -13,6 +13,7 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import
com.gic.haoban.manage.service.service.WxEnterpriseRelatedService
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
...
...
@@ -59,4 +60,14 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
public
TabHaobanWxEnterpriseRelated
getByEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
return
mapper
.
findOneByEIdAndWxEid
(
enterpriseId
,
wxEnterpriseId
);
}
@Override
public
void
setClerkEdit
(
String
id
,
int
clerkEditFlag
)
{
TabHaobanWxEnterpriseRelated
record
=
new
TabHaobanWxEnterpriseRelated
();
record
.
setClerkEditFlag
(
clerkEditFlag
);
record
.
setWxEnterpriseRelatedId
(
id
);
record
.
setUpdateTime
(
new
Date
());
mapper
.
updateByPrimaryKeySelective
(
record
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseServiceImpl.java
View file @
adf7e102
...
...
@@ -27,6 +27,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
wxDTO
.
setUpdateTime
(
now
);
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanWxEnterprise
.
class
,
wxDTO
);
tabHaobanWxEnterprise
.
setStatusFlag
(
1
);
tabHaobanWxEnterprise
.
setBindFlag
(
1
);
mapper
.
insertSelective
(
tabHaobanWxEnterprise
);
return
wxDTO
.
getWxEnterpriseId
();
...
...
@@ -66,13 +67,23 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
TabHaobanWxEnterprise
enterprise
=
new
TabHaobanWxEnterprise
();
enterprise
.
setWxEnterpriseId
(
wxEnterpriseId
);
enterprise
.
setStatusFlag
(
0
);
enterprise
.
setUpdateTime
(
new
Date
());
return
this
.
mapper
.
updateByPrimaryKeySelective
(
enterprise
);
}
@Override
public
int
unbind
(
String
wxEnterpriseId
)
{
TabHaobanWxEnterprise
enterprise
=
new
TabHaobanWxEnterprise
();
enterprise
.
setWxEnterpriseId
(
wxEnterpriseId
);
enterprise
.
setBindFlag
(
0
);
enterprise
.
setUpdateTime
(
new
Date
());
return
this
.
mapper
.
updateByPrimaryKeySelective
(
enterprise
);
}
@Override
public
TabHaobanWxEnterprise
getEnterpriseBycorpIdNoStatus
(
String
corpId
)
{
List
<
TabHaobanWxEnterprise
>
list
=
this
.
mapper
.
getEnterpriseBycorpIdNoStatus
(
corpId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
.
get
(
0
);
}
return
null
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/CheckQywxSettingApiServiceImpl.java
0 → 100644
View file @
adf7e102
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.CheckFriendSettingDTO
;
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.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.api.RBucket
;
import
org.redisson.api.RMap
;
import
org.redisson.api.RedissonClient
;
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.concurrent.TimeUnit
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Created 2021/5/31.
*
* @author hua
*/
@Service
public
class
CheckQywxSettingApiServiceImpl
implements
CheckQywxSettingApiService
{
private
static
final
Logger
logger
=
getLogger
(
CheckQywxSettingApiServiceImpl
.
class
);
private
static
final
String
FRIEND_SETTING_KEY
=
"haoban-check-friend-setting"
;
private
static
final
String
FRIEND_SETTING_VAL_KEY
=
"haoban-check-friend-setting-val"
;
private
static
final
String
SELF_APP
=
"selfSuiteId"
;
private
static
final
String
THIRD_APP
=
"thirdSuiteId"
;
private
static
final
String
ALERT_KEY
=
"friend-alert:"
;
private
static
final
String
ALERT_URL
=
"https://oapi.dingtalk.com/robot/send?access_token=435c0ddaacda849e145b64cc3a83c37f742105d88cf27b719b2dbef167436ad4"
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Override
public
void
setFriendSetting
(
String
wxEnterpriseId
,
String
name
)
{
CheckFriendSettingDTO
checkFriendSettingDTO
=
new
CheckFriendSettingDTO
();
checkFriendSettingDTO
.
setName
(
name
);
checkFriendSettingDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
RedisUtil
.
setCache
(
FRIEND_SETTING_KEY
,
checkFriendSettingDTO
);
RedissonClient
redisClient
=
RedisUtil
.
getRedisClient
();
RMap
<
Object
,
Object
>
map
=
redisClient
.
getMap
(
FRIEND_SETTING_VAL_KEY
);
map
.
delete
();
}
@Override
public
CheckFriendSettingDTO
getFriendSetting
()
{
return
RedisUtil
.
getCache
(
FRIEND_SETTING_KEY
,
CheckFriendSettingDTO
.
class
);
}
@Override
public
void
saveFriendCallback
(
String
wxEnterpriseId
,
ExternalUserDTO
externalUserDTO
,
MemberUnionidRelatedDTO
dto
)
{
if
(
null
==
externalUserDTO
)
{
messageAlert
(
wxEnterpriseId
,
dto
,
null
);
//todo 告警
return
;
}
CheckFriendSettingDTO
friendSetting
=
this
.
getFriendSetting
();
if
(!
wxEnterpriseId
.
equals
(
friendSetting
.
getWxEnterpriseId
()))
{
return
;
}
if
(!
friendSetting
.
getName
().
equals
(
externalUserDTO
.
getName
()))
{
return
;
}
RedissonClient
redisClient
=
RedisUtil
.
getRedisClient
();
RMap
<
Object
,
Object
>
map
=
redisClient
.
getMap
(
FRIEND_SETTING_VAL_KEY
);
if
(
SELF_APP
.
equals
(
dto
.
getSuiteid
()))
{
map
.
put
(
SELF_APP
,
externalUserDTO
);
}
else
{
map
.
put
(
THIRD_APP
,
externalUserDTO
);
}
messageAlert
(
wxEnterpriseId
,
dto
,
"好友提醒:"
+
dto
.
getSuiteid
());
}
/**
* 告警
*
* @param wxEnterpriseId
* @param dto
*/
private
void
messageAlert
(
String
wxEnterpriseId
,
MemberUnionidRelatedDTO
dto
,
String
titleSub
)
{
titleSub
=
StringUtils
.
isBlank
(
titleSub
)
?
"加好友异常"
:
titleSub
;
String
key
=
ALERT_KEY
+
wxEnterpriseId
;
RBucket
<
Object
>
bucket
=
RedisUtil
.
getRedisClient
().
getBucket
(
key
);
boolean
b
=
bucket
.
trySet
(
1
,
60L
,
TimeUnit
.
SECONDS
);
if
(!
b
)
{
return
;
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
ProviderLocalTag
providerLocalTag
=
ProviderLocalTag
.
tag
.
get
();
String
traceId
=
providerLocalTag
.
traceId
;
String
traceUrl
=
"http://212.64.4.231:8780/damo-stats/mongodb/getLogMessagesView?trace_id="
+
traceId
;
String
title
=
wxEnterpriseDTO
.
getCorpName
()
+
": "
+
titleSub
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
link
=
new
HashMap
<>();
map
.
put
(
"msgtype"
,
"link"
);
link
.
put
(
"title"
,
title
);
link
.
put
(
"text"
,
JSONObject
.
toJSONString
(
dto
));
link
.
put
(
"messageUrl"
,
traceUrl
);
map
.
put
(
"link"
,
link
);
String
post
=
HttpUtil
.
post
(
ALERT_URL
,
JSONObject
.
toJSONString
(
map
));
logger
.
info
(
"alert:{}"
,
post
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/ClerkMainStoreRelatedApiServiceImpl.java
View file @
adf7e102
...
...
@@ -33,4 +33,13 @@ public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelate
return
EntityUtil
.
changeEntityByJSON
(
ClerkMainStoreRelatedDTO
.
class
,
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffId
,
wxEnterpriseId
));
}
@Override
public
void
setFreshFriend
(
String
wxEnterpriseId
,
String
staffId
)
{
TabHaobanClerkMainStoreRelated
related
=
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffId
,
wxEnterpriseId
);
if
(
related
!=
null
)
{
related
.
setUpdateTime
(
new
Date
());
related
.
setFreshFriendFlag
(
1
);
clerkMainStoreRelatedService
.
update
(
related
);
}
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DealSyncOperationApiServiceImpl.java
View file @
adf7e102
...
...
@@ -869,4 +869,14 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
e
.
printStackTrace
();
}
}
@Override
public
boolean
getFreshFriendSyncTask
(
String
wxEnterpriseId
,
String
staffId
)
{
String
staffLockKey
=
FRIEND_LOCK
+
staffId
;
Object
cache
=
RedisUtil
.
getCache
(
staffLockKey
);
if
(
null
==
cache
)
{
return
false
;
}
return
true
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/ExternalClerkRelatedApiServiceImpl.java
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
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
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
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.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
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
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.github.pagehelper.PageHelper
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
ExternalClerkRelatedApiServiceImpl
implements
ExternalClerkRelatedApiService
{
...
...
@@ -34,6 +32,34 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Autowired
private
MemberUnionidRelatedMapper
memberUnionidRelatedMapper
;
/**
* 查询导购好友关联
*
* @param wxUserId : 微信用户id
* @param wxEnterpriseId : 微信企业id
* @param enterpriseId : 企业id
* @return : 返回好友关联
*/
@Override
public
List
<
ExternalClerkRelatedDTO
>
listByWxUserIdAndWxEnterpriseId
(
String
wxUserId
,
String
wxEnterpriseId
,
String
enterpriseId
)
{
List
<
TabHaobanExternalClerkRelated
>
list
=
tabHaobanExternalClerkRelatedMapper
.
listByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
,
enterpriseId
);
return
EntityUtil
.
changeEntityListByJSON
(
ExternalClerkRelatedDTO
.
class
,
list
);
}
/**
* 查询会员在企业下的好友关系
*
* @param memberId : 会员id
* @param wxEnterpriseId : 微信企业id
* @param enterpriseId : 企业id
* @return : 返回会员导购关联关系
*/
@Override
public
List
<
ExternalClerkRelatedDTO
>
listByMemberIdAndWxEnterpriseId
(
String
memberId
,
String
wxEnterpriseId
,
String
enterpriseId
){
List
<
TabHaobanExternalClerkRelated
>
list
=
tabHaobanExternalClerkRelatedMapper
.
listByMemberIdAndWxEnterpriseId
(
memberId
,
wxEnterpriseId
,
enterpriseId
);
return
EntityUtil
.
changeEntityListByJSON
(
ExternalClerkRelatedDTO
.
class
,
list
);
}
@Override
public
List
<
ExternalClerkRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
)
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MaterialApiServiceImpl.java
View file @
adf7e102
...
...
@@ -2,11 +2,16 @@ package com.gic.haoban.manage.service.service.out.impl;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.
Date
;
import
java.util.
List
;
import
java.util.
*
;
import
java.util.
stream.Collectors
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.service.entity.TabMiniprogramSetting
;
import
com.gic.haoban.manage.service.service.MiniprogramSettingService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -53,6 +58,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
@Autowired
private
Config
config
;
@Autowired
private
MiniprogramSettingService
miniprogramSettingService
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
MaterialApiServiceImpl
.
class
);
@Override
...
...
@@ -123,6 +131,10 @@ public class MaterialApiServiceImpl implements MaterialApiService {
fileType
=
QywxMediaTypeEnum
.
FILE
;
url
=
materialDTO
.
getLink
();
}
if
(
type
==
6
)
{
fileType
=
QywxMediaTypeEnum
.
IMAGE
;
url
=
materialDTO
.
getImgUrl
();
}
if
(
type
==
3
){
String
imgUrl
=
materialDTO
.
getImgUrl
();
logger
.
info
(
"【上传图片】imgUrl={}"
,
imgUrl
);
...
...
@@ -236,6 +248,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if
(
type
==
5
){
fileType
=
QywxMediaTypeEnum
.
FILE
;
url
=
old
.
getLink
();
}
else
if
(
type
==
6
)
{
fileType
=
QywxMediaTypeEnum
.
IMAGE
;
url
=
old
.
getImgUrl
();
}
String
[]
arr
=
url
.
split
(
"/"
);
int
count
=
arr
.
length
;
...
...
@@ -248,11 +263,37 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return
old
.
getMediaId
();
}
private
List
<
String
>
listSubCategoryIdsByParentId
(
String
categoryId
)
{
List
<
String
>
categoryIds
=
new
ArrayList
<>();
categoryIds
.
add
(
categoryId
);
if
(
StringUtils
.
isBlank
(
categoryId
))
{
return
categoryIds
;
}
List
<
MaterialCategoryDTO
>
categoryDTOList
=
materialCategoryService
.
listByParentCategory
(
categoryId
);
if
(
CollectionUtils
.
isEmpty
(
categoryDTOList
))
{
return
categoryIds
;
}
for
(
MaterialCategoryDTO
categoryDTO
:
categoryDTOList
)
{
categoryIds
.
addAll
(
this
.
listSubCategoryIdsByParentId
(
categoryDTO
.
getCategoryId
()));
}
return
categoryIds
;
}
@Override
public
Page
<
MaterialDTO
>
listMaterial
(
String
wxEnterpriseId
,
String
keyword
,
String
categoryId
,
Integer
materialType
,
BasePageInfo
pageInfo
)
{
List
<
String
>
categoryIds
=
this
.
listSubCategoryIdsByParentId
(
categoryId
);
PageHelper
.
startPage
(
pageInfo
.
getPageNum
(),
pageInfo
.
getPageSize
());
com
.
github
.
pagehelper
.
Page
<
TabHaobanMaterial
>
page
=
materialService
.
listMaterial
(
wxEnterpriseId
,
keyword
,
categoryId
,
materialType
);
com
.
github
.
pagehelper
.
Page
<
TabHaobanMaterial
>
page
=
materialService
.
listMaterial
(
wxEnterpriseId
,
keyword
,
categoryIds
,
materialType
);
List
<
TabHaobanMaterial
>
result
=
page
.
getResult
();
List
<
TabMiniprogramSetting
>
settings
=
miniprogramSettingService
.
listMiniprogram
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
result
)
&&
CollectionUtils
.
isNotEmpty
(
settings
))
{
Map
<
String
,
TabMiniprogramSetting
>
settingMap
=
settings
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getAppId
(),
dto
->
dto
));
result
.
forEach
(
dto
->
{
TabMiniprogramSetting
miniprogramSetting
=
settingMap
.
get
(
dto
.
getAppId
());
dto
.
setMaterialDesc
(
miniprogramSetting
==
null
?
"--"
:
miniprogramSetting
.
getMiniprogramName
());
});
}
return
PageUtil
.
changePageHelperToCurrentPage
(
page
,
MaterialDTO
.
class
);
}
...
...
@@ -320,4 +361,28 @@ public class MaterialApiServiceImpl implements MaterialApiService {
public
void
delMaterial
(
List
<
String
>
ids
)
{
materialService
.
delmaterialByIds
(
ids
);
}
@Override
public
MaterialDTO
getHasChangeMadieMaterialById
(
String
materialId
)
{
MaterialDTO
materialDTO
=
this
.
selectMaterialById
(
materialId
);
if
(
null
==
materialDTO
)
{
return
null
;
}
Date
lastUploadTime
=
materialDTO
.
getWxLastUploadTime
();
Date
date
=
new
Date
();
Date
compareDate
=
DateUtils
.
addDays
(
date
,
-
3
);
if
(
lastUploadTime
!=
null
&&
lastUploadTime
.
after
(
compareDate
)
&&
StringUtils
.
isNotBlank
(
materialDTO
.
getMediaId
()))
{
return
materialDTO
;
}
Integer
materialType
=
materialDTO
.
getMaterialType
();
String
madiaId
=
materialDTO
.
getMediaId
();
//需要上传的类型
List
<
Integer
>
typeList
=
Arrays
.
asList
(
2
,
4
,
5
,
6
);
if
(
typeList
.
contains
(
materialType
))
{
madiaId
=
this
.
reUpdalodMetail
(
materialId
);
}
materialDTO
.
setMediaId
(
madiaId
);
materialDTO
.
setWxLastUploadTime
(
date
);
return
materialDTO
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
adf7e102
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
cn.hutool.Hutool
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.crypto.SecureUtil
;
import
cn.hutool.crypto.digest.MD5
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.*
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.enums.SecretTypeEnum
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper
;
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.service.*
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.wechat.api.dto.qywx.*
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.PageHelper
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.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
com.gic.api.base.commons.JSONResponse
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.PowerService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreService
;
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.contacts.manage.api.dto.SearchDataDTO
;
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.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
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
;
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.service.*
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.member.api.dto.MemberDTO
;
import
com.gic.member.api.service.MemberOpenCardBusinessService
;
import
com.gic.member.api.service.MemberService
;
import
com.gic.
redis.data.anno.RedisLock
;
import
com.gic.
mq.sdk.GicMQClient
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.search.engine.api.constant.MemberDataEnum
;
import
com.gic.search.engine.api.constant.OperateEnum
;
import
com.gic.search.engine.api.dto.ESResponseQueryBatch
;
import
com.gic.search.engine.api.dto.ESResponseQuerySingle
;
import
com.gic.search.engine.api.dto.dynamic.DynamicSearchDTO
;
import
com.gic.search.engine.api.filter.NewNodeAddUtil
;
import
com.gic.search.engine.api.service.dynamic.ESDataDynamicOperationApiService
;
import
com.gic.wechat.api.dto.qywx.*
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.PageHelper
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.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.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
MemberUnionidRelatedApiServiceImpl
implements
MemberUnionidRelatedApiService
{
public
class
MemberUnionidRelatedApiServiceImpl
implements
MemberUnionidRelatedApiService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
MemberUnionidRelatedApiServiceImpl
.
class
);
@Autowired
private
MemberUnionRelatedService
memberUnionRelatedService
;
...
...
@@ -134,6 +126,9 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Autowired
private
TabHaobanWelcomeMapper
welcomeMapper
;
@Autowired
private
CheckQywxSettingApiService
checkQywxSettingApiService
;
@Override
public
void
dealQywxExternalUser
(
String
params
)
{
log
.
info
(
"回调:{}"
,
params
);
...
...
@@ -150,7 +145,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
public
List
<
MemberStoreDTO
>
listByExTernalUseridAndWxUserId
(
String
externalUserid
,
String
wxUserId
)
{
List
<
TabHaobanExternalClerkRelated
>
list
=
externalClerkRelatedService
.
listByExTernalUseridAndWxUserId
(
externalUserid
,
wxUserId
);
List
<
MemberStoreDTO
>
result
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isEmpty
(
list
))
{
if
(
CollectionUtil
.
isEmpty
(
list
))
{
return
null
;
}
String
wxEnterpriseId
=
list
.
get
(
0
).
getWxEnterpriseId
();
...
...
@@ -160,7 +155,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
null
;
}
List
<
StaffClerkRelationDTO
>
clerkRelationDTOS
=
staffClerkRelationService
.
listBindCodeByStaffId
(
null
,
haobanStaff
.
getStaffId
());
if
(
CollectionUtil
.
isEmpty
(
clerkRelationDTOS
))
{
if
(
CollectionUtil
.
isEmpty
(
clerkRelationDTOS
))
{
log
.
info
(
"staff关联门店不存在1"
);
return
null
;
}
...
...
@@ -180,61 +175,61 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
// 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
))
{
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"
);
return
null
;
}
//2、获取member的storeId
for
(
TabHaobanExternalClerkRelated
tab
:
list
)
{
for
(
TabHaobanExternalClerkRelated
tab
:
list
)
{
String
memberId
=
tab
.
getMemberId
();
if
(
StringUtils
.
isEmpty
(
memberId
))
{
continue
;
if
(
StringUtils
.
isEmpty
(
memberId
))
{
continue
;
}
String
gicEnterpriseId
=
tab
.
getEnterpriseId
();
JSONObject
searchJson
=
new
JSONObject
();
searchJson
=
NewNodeAddUtil
.
addNewNodeForAnd
(
MemberDataEnum
.
member_memberId
.
getCode
(),
OperateEnum
.
OPERATE_EQ
.
getValue
(),
memberId
,
searchJson
);
searchJson
=
NewNodeAddUtil
.
addNewNodeForAnd
(
MemberDataEnum
.
member_memberId
.
getCode
(),
OperateEnum
.
OPERATE_EQ
.
getValue
(),
memberId
,
searchJson
);
DynamicSearchDTO
dynamicSearchDTO
=
new
DynamicSearchDTO
();
dynamicSearchDTO
.
setEnterpriseId
(
gicEnterpriseId
);
dynamicSearchDTO
.
setColumnCategoryCode
(
"member"
);
dynamicSearchDTO
.
setSearchJson
(
searchJson
);
dynamicSearchDTO
.
setBegin
(
0
);
dynamicSearchDTO
.
setRecordNumber
(
1
);
log
.
info
(
"gicEnterpriseId=========>{},searchJson=========={}"
,
gicEnterpriseId
,
searchJson
);
log
.
info
(
"gicEnterpriseId=========>{},searchJson=========={}"
,
gicEnterpriseId
,
searchJson
);
ESResponseQueryBatch
responseQuery
=
eSDataDynamicOperationApiService
.
queryDataBatch
(
dynamicSearchDTO
,
false
,
null
);
if
(
null
==
responseQuery
)
{
if
(
null
==
responseQuery
)
{
log
.
info
(
"会员不存在1"
);
continue
;
}
List
<
JSONObject
>
res
=
responseQuery
.
getRes
();
if
(
CollectionUtil
.
isEmpty
(
res
))
{
if
(
CollectionUtil
.
isEmpty
(
res
))
{
log
.
info
(
"会员不存在2"
);
continue
;
}
String
storeId
=
""
;
for
(
JSONObject
jsonObject
:
res
)
{
storeId
=
jsonObject
.
get
(
"storeId"
)
==
null
?
""
:
jsonObject
.
get
(
"storeId"
).
toString
();
storeId
=
jsonObject
.
get
(
"storeId"
)
==
null
?
""
:
jsonObject
.
get
(
"storeId"
).
toString
();
}
if
(
StringUtils
.
isEmpty
(
storeId
))
{
if
(
StringUtils
.
isEmpty
(
storeId
))
{
log
.
info
(
"会员门店不存在"
);
continue
;
}
String
[]
memberStoreIds
=
storeId
.
split
(
" "
);
String
[]
memberStoreIds
=
storeId
.
split
(
" "
);
List
<
String
>
memberStoreIdList
=
Arrays
.
asList
(
memberStoreIds
);
if
(
CollectionUtil
.
isEmpty
(
memberStoreIdList
))
{
if
(
CollectionUtil
.
isEmpty
(
memberStoreIdList
))
{
log
.
info
(
"会员门店不存在"
);
continue
;
}
log
.
info
(
"memberStoreIdList===============>{}"
,
JSONObject
.
toJSONString
(
memberStoreIdList
));
log
.
info
(
"storeIds===============>{}"
,
JSONObject
.
toJSONString
(
storeIds
));
log
.
info
(
"memberStoreIdList===============>{}"
,
JSONObject
.
toJSONString
(
memberStoreIdList
));
log
.
info
(
"storeIds===============>{}"
,
JSONObject
.
toJSONString
(
storeIds
));
//取交集(解决不支持的报错现象)
List
list3
=
new
ArrayList
(
memberStoreIdList
);
List
list4
=
new
ArrayList
(
storeIds
);
List
list3
=
new
ArrayList
(
memberStoreIdList
);
List
list4
=
new
ArrayList
(
storeIds
);
list3
.
retainAll
(
list4
);
if
(
CollectionUtil
.
isEmpty
(
list3
))
{
if
(
CollectionUtil
.
isEmpty
(
list3
))
{
continue
;
}
else
{
for
(
Object
resultStoreId
:
list3
)
{
}
else
{
for
(
Object
resultStoreId
:
list3
)
{
MemberStoreDTO
dto
=
new
MemberStoreDTO
();
dto
.
setMemberId
(
memberId
);
dto
.
setStoreId
(
resultStoreId
.
toString
());
...
...
@@ -259,12 +254,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
public
MemberUnionidRelatedDTO
getByUnionId
(
String
staffId
,
String
unionid
)
{
TabHaobanStaff
staff
=
staffService
.
selectById
(
staffId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
null
;
}
log
.
info
(
"【查询会员】wxUserId={},unionid={}"
,
staff
.
getWxUserId
(),
unionid
);
log
.
info
(
"【查询会员】wxUserId={},unionid={}"
,
staff
.
getWxUserId
(),
unionid
);
return
memberUnionRelatedService
.
getByUnionId
(
staff
.
getWxEnterpriseId
(),
staff
.
getWxUserId
(),
unionid
);
}
@Override
public
String
addMemberUnionidRelated
(
MemberUnionidRelatedDTO
dto
)
{
DealQywxExternalUserPojo
dealQywxExternalUserPojo
=
new
DealQywxExternalUserPojo
();
...
...
@@ -303,56 +299,56 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
externalUserId
=
dto
.
getExternalUserid
();
String
avatar
=
dto
.
getAvatar
();
String
unionId
=
dto
.
getUnionid
();
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
))
{
log
.
info
(
"【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={},avatar={},unionId={}"
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
avatar
,
unionId
);
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
))
{
log
.
info
(
"【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={},avatar={},unionId={}"
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
avatar
,
unionId
);
return
;
}
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
;
}
String
staffId
=
staff
.
getStaffId
();
MemberDTO
member
=
null
;
TabHaobanClerkMainStoreRelated
r
=
clerkMainStoreRelatedService
.
getMainStoreByStaffId
(
staffId
,
wxEnterpriseId
);
if
(
r
==
null
)
{
if
(
r
==
null
)
{
log
.
info
(
"【新增外部联系人】主门店为空"
);
return
;
}
String
storeId
=
r
.
getStoreId
();
StaffClerkRelationDTO
staffClerkRelationDTO
=
staffClerkRelationService
.
getOneBindByStoreId
(
staffId
,
storeId
);
if
(
staffClerkRelationDTO
==
null
)
{
StaffClerkRelationDTO
staffClerkRelationDTO
=
staffClerkRelationService
.
getOneBindByStoreId
(
staffId
,
storeId
);
if
(
staffClerkRelationDTO
==
null
)
{
log
.
info
(
"【新增外币联系人】导购和clerk关联为空"
);
return
;
}
//新增导购和外部联系人关系
String
clerkCode
=
staffClerkRelationDTO
.
getClerkCode
();
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkCode
(
staffClerkRelationDTO
.
getEnterpriseId
(),
clerkCode
);
log
.
info
(
"【新增外部联系人】clerkCode={},unionid:{}"
,
clerkCode
,
unionId
);
if
(
clerk
==
null
)
{
log
.
info
(
"【新增外部联系人】clerkCode={},unionid:{}"
,
clerkCode
,
unionId
);
if
(
clerk
==
null
)
{
log
.
info
(
"【新增外币联系人】导购为空"
);
return
;
}
String
qrcodeParam
=
clerk
.
getQrcodeParam
();
if
(
StringUtils
.
isBlank
(
qrcodeParam
))
{
if
(
StringUtils
.
isBlank
(
qrcodeParam
))
{
powerService
.
saveClerkQrCode
(
clerk
.
getClerkId
());
clerk
=
clerkService
.
getClerkByClerkCode
(
staffClerkRelationDTO
.
getEnterpriseId
(),
clerkCode
);
qrcodeParam
=
clerk
.
getQrcodeParam
();
}
if
(
clerk
!=
null
&&
StringUtils
.
isNotBlank
(
qrcodeParam
)&&
StringUtils
.
isNotBlank
(
unionId
))
{
log
.
info
(
"【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}"
,
staffClerkRelationDTO
.
getEnterpriseId
(),
unionId
,
name
,
avatar
,
qrcodeParam
);
if
(
clerk
!=
null
&&
StringUtils
.
isNotBlank
(
qrcodeParam
)
&&
StringUtils
.
isNotBlank
(
unionId
))
{
log
.
info
(
"【新增外部联系人会员】enterpriseId={},unionId={},name={},avatar={},QrcodeParam={}"
,
staffClerkRelationDTO
.
getEnterpriseId
(),
unionId
,
name
,
avatar
,
qrcodeParam
);
member
=
memberOpenCardBusinessService
.
getMemberByQywxChannelParam
(
staffClerkRelationDTO
.
getEnterpriseId
(),
unionId
,
""
,
name
,
avatar
,
qrcodeParam
);
}
TabHaobanExternalClerkRelated
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
String
key
=
wxUserId
+
wxEnterpriseId
+
name
+
createTime
;
if
(
exsitDTO
==
null
)
{
RedisUtil
.
lock
(
key
,
1L
);
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
TabHaobanExternalClerkRelated
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
String
key
=
wxUserId
+
wxEnterpriseId
+
name
+
createTime
;
if
(
exsitDTO
==
null
)
{
RedisUtil
.
lock
(
key
,
1L
);
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
RedisUtil
.
unlock
(
key
);
}
if
(
exsitDTO
==
null
)
{
if
(
exsitDTO
==
null
)
{
TabHaobanExternalClerkRelated
related
=
new
TabHaobanExternalClerkRelated
();
related
.
setAddCreateTime
(
createTime
);
related
.
setClerkId
(
staffClerkRelationDTO
.
getClerkId
());
...
...
@@ -365,13 +361,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
related
.
setUnionid
(
unionId
);
related
.
setWxEnterpriseId
(
wxEnterpriseId
);
related
.
setWxUserId
(
wxUserId
);
if
(
member
!=
null
)
{
if
(
member
!=
null
)
{
related
.
setMemberId
(
member
.
getMemberId
());
}
externalClerkRelatedService
.
insert
(
related
);
}
else
{
if
(
member
!=
null
)
{
}
else
{
if
(
member
!=
null
)
{
exsitDTO
.
setMemberId
(
member
.
getMemberId
());
}
exsitDTO
.
setMemberUnionidRelatedId
(
dto
.
getMemberUnionidRelatedId
());
...
...
@@ -582,22 +578,22 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Deprecated
private
String
insertMemberUnionIdRelated
(
MemberUnionidRelatedDTO
dto
)
{
if
(
dto
==
null
)
{
if
(
dto
==
null
)
{
return
""
;
}
String
wxUserId
=
dto
.
getWxUserId
();
String
wxEnterpriseId
=
dto
.
getWxEnterpriseId
();
String
name
=
dto
.
getExternalName
();
String
createTime
=
dto
.
getAddCreateTime
();
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
))
{
log
.
info
(
"【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={}"
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
))
{
log
.
info
(
"【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={}"
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
return
""
;
}
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
String
uuid
=
""
;
if
(
exsitDTO
==
null
)
{
if
(
exsitDTO
==
null
)
{
uuid
=
memberUnionRelatedService
.
addMemberUnionidRelated
(
dto
);
}
else
{
}
else
{
//如果是自建更新uuid
exsitDTO
.
setSelfExternalUserid
(
dto
.
getSelfExternalUserid
());
exsitDTO
.
setUnionid
(
dto
.
getUnionid
());
...
...
@@ -606,7 +602,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
memberUnionRelatedService
.
update
(
exsitDTO
);
uuid
=
exsitDTO
.
getMemberUnionidRelatedId
();
MemberUnionidRelatedDTO
fullDTO
=
memberUnionRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
MemberUnionidRelatedDTO
fullDTO
=
memberUnionRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
dto
.
setExternalUserid
(
fullDTO
.
getExternalUserid
());
dto
.
setUnionid
(
fullDTO
.
getUnionid
());
}
...
...
@@ -615,11 +611,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
@Deprecated
private
MemberUnionidRelatedDTO
getMemberUnionidRelatedDTO
(
MemberUnionidRelatedDTO
dto
){
log
.
info
(
"【新增外部联系人回调】dto={}"
,
JSON
.
toJSONString
(
dto
));
private
MemberUnionidRelatedDTO
getMemberUnionidRelatedDTO
(
MemberUnionidRelatedDTO
dto
)
{
log
.
info
(
"【新增外部联系人回调】dto={}"
,
JSON
.
toJSONString
(
dto
));
String
corpId
=
dto
.
getCorpid
();
TabHaobanWxEnterprise
wxEnterprise
=
wxEnterpriseService
.
getEnterpriseBycorpId
(
corpId
);
if
(
wxEnterprise
==
null
)
{
if
(
wxEnterprise
==
null
)
{
return
null
;
}
...
...
@@ -627,24 +623,24 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
userId
=
dto
.
getWxUserId
();
String
suiteid
=
dto
.
getSuiteid
();
String
unionIdJson
=
""
;
if
(
SELF_APP
.
equals
(
suiteid
))
{
if
(
SELF_APP
.
equals
(
suiteid
))
{
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
)
{
log
.
info
(
"没有配置secret"
);
return
null
;
}
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
dto
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
dto
.
getExternalUserid
());
}
else
{
}
else
{
unionIdJson
=
qywxUserApiService
.
getExternalUseridInfo
(
dto
.
getCorpid
(),
dto
.
getSuiteid
(),
dto
.
getExternalUserid
());
}
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
log
.
info
(
"【新增外部联系人回调】unionIdJson=null"
);
return
null
;
}
log
.
info
(
"【新增外部联系人回调】unionIdJson={}"
,
JSON
.
toJSONString
(
unionIdJson
));
log
.
info
(
"【新增外部联系人回调】unionIdJson={}"
,
JSON
.
toJSONString
(
unionIdJson
));
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
String
name
=
pojo
.
getName
();
String
createTime
=
pojo
.
getAddCreateTime
();
...
...
@@ -657,10 +653,10 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
externalUserId
=
null
;
String
selfExternalUserId
=
null
;
String
unionId
=
null
;
if
(
SELF_APP
.
equals
(
suiteid
))
{
if
(
SELF_APP
.
equals
(
suiteid
))
{
unionId
=
pojo
.
getUnionId
();
selfExternalUserId
=
dto
.
getExternalUserid
();
}
else
{
}
else
{
externalUserId
=
dto
.
getExternalUserid
();
}
dto
.
setUnionid
(
unionId
);
...
...
@@ -682,6 +678,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
wxEnterprise
==
null
)
{
return
null
;
}
//校验friend
CheckFriendSettingDTO
friendSettingDTO
=
checkQywxSettingApiService
.
getFriendSetting
();
String
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
();
String
userId
=
dto
.
getWxUserId
();
String
suiteid
=
dto
.
getSuiteid
();
...
...
@@ -691,13 +689,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
else
{
externalUserDTO
=
this
.
getExternalUseridInfo
(
wxEnterpriseId
,
userId
,
dto
.
getExternalUserid
());
}
checkQywxSettingApiService
.
saveFriendCallback
(
wxEnterpriseId
,
externalUserDTO
,
dto
);
if
(
externalUserDTO
==
null
)
{
log
.
info
(
"【新增外部联系人回调】unionIdJson=null"
);
return
null
;
}
dto
.
setWxEnterpriseId
(
wxEnterpriseId
);
dto
.
setExternalName
(
externalUserDTO
.
getName
(
));
dto
.
setExternalName
(
EmojiFilterUtil
.
removeAllEmoji
(
externalUserDTO
.
getName
()
));
dto
.
setAddCreateTime
(
externalUserDTO
.
getAddCreateTime
());
dto
.
setAvatar
(
externalUserDTO
.
getAvatar
());
if
(
SELF_APP
.
equals
(
suiteid
))
{
...
...
@@ -719,6 +718,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
dto
.
setSelfExternalUserid
(
dto
.
getSelfExternalUserid
()
==
null
?
midRelatedDto
.
getSelfExternalUserid
()
:
dto
.
getSelfExternalUserid
());
dto
.
setMemberUnionidRelatedId
(
midRelatedDto
.
getMemberUnionidRelatedId
());
dto
.
setAvatar
(
dto
.
getAvatar
()
==
null
?
midRelatedDto
.
getAvatar
()
:
dto
.
getAvatar
());
MemberUnionidRelatedDTO
oldRelation
=
memberUnionRelatedService
.
getBySelfExternalUserId
(
dto
.
getWxUserId
(),
dto
.
getWxEnterpriseId
(),
dto
.
getSelfExternalUserid
());
//老的关联需要删除
if
(
null
!=
oldRelation
&&
(!
oldRelation
.
getMemberUnionidRelatedId
().
equals
(
midRelatedDto
.
getMemberUnionidRelatedId
())))
{
oldRelation
.
setStatusFlag
(
0
);
memberUnionRelatedService
.
update
(
oldRelation
);
}
memberUnionRelatedService
.
update
(
dto
);
RedisUtil
.
unlock
(
lockKey
);
return
dto
;
...
...
@@ -732,7 +737,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
private
ExternalUserPojo
getExternalUserPojo
(
String
unionIdJson
,
String
userId1
,
String
wxEnterpriseId
)
{
private
ExternalUserPojo
getExternalUserPojo
(
String
unionIdJson
,
String
userId1
,
String
wxEnterpriseId
)
{
ExternalUserPojo
pojo
=
new
ExternalUserPojo
();
String
unionId
=
""
;
String
follow_user
=
""
;
...
...
@@ -741,14 +746,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
avatar
=
""
;
String
relaName
=
""
;
String
externalUserId
=
""
;
if
(
StringUtils
.
isNotBlank
(
unionIdJson
))
{
if
(
StringUtils
.
isNotBlank
(
unionIdJson
))
{
JSONObject
jo
=
JSON
.
parseObject
(
unionIdJson
);
String
external_contact
=
jo
.
getString
(
"external_contact"
);
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
JSONObject
jt
=
JSON
.
parseObject
(
external_contact
);
unionId
=
jt
.
getString
(
"unionid"
);
relaName
=
EmojiFilterUtil
.
filterEmojiLast
(
jt
.
getString
(
"name"
),
true
);
if
(
StringUtils
.
isBlank
(
relaName
))
{
if
(
StringUtils
.
isBlank
(
relaName
))
{
relaName
=
"--"
;
}
avatar
=
jt
.
getString
(
"avatar"
);
...
...
@@ -756,13 +761,13 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
follow_user
=
jo
.
getString
(
"follow_user"
);
if
(
StringUtils
.
isNotBlank
(
follow_user
))
{
if
(
StringUtils
.
isNotBlank
(
follow_user
))
{
JSONArray
j
=
JSON
.
parseArray
(
follow_user
);
for
(
Object
object
:
j
)
{
String
followJson
=
JSON
.
toJSONString
(
object
);
JSONObject
follow
=
JSON
.
parseObject
(
followJson
);
userId
=
follow
.
getString
(
"userid"
);
if
(
userId
.
equals
(
userId1
))
{
if
(
userId
.
equals
(
userId1
))
{
createTime
=
follow
.
getString
(
"createtime"
);
}
}
...
...
@@ -776,15 +781,16 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
pojo
.
setWxEnterpriseId
(
wxEnterpriseId
);
return
pojo
;
}
@Override
public
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId
,
String
storeId
)
{
public
String
add
(
String
wxEnterpriseId
,
String
selfExternalUserId
,
String
userId
,
String
storeId
)
{
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
)
{
if
(
wxEnterprise
==
null
)
{
return
""
;
}
TabHaobanStaff
staff
=
staffService
.
selectByUserIdAndEnterpriseId
(
userId
,
wxEnterpriseId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
""
;
}
...
...
@@ -795,7 +801,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
selfExternalUserId
);
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
ExternalUserPojo
pojo
=
getExternalUserPojo
(
unionIdJson
,
userId
,
wxEnterpriseId
);
String
unionId
=
pojo
.
getUnionId
();
String
name
=
pojo
.
getName
();
String
createTime
=
pojo
.
getAddCreateTime
();
...
...
@@ -812,20 +818,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
dto
.
setAddCreateTime
(
createTime
);
dto
.
setWxUserId
(
userId
);
dto
.
setAvatar
(
pojo
.
getAvatar
());
if
(
StringUtils
.
isBlank
(
unionId
))
{
if
(
StringUtils
.
isBlank
(
unionId
))
{
return
""
;
}
dto
.
setSuiteid
(
secretSetting
.
getSecretVal
());
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByParams
(
userId
,
wxEnterpriseId
,
name
,
createTime
);
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByParams
(
userId
,
wxEnterpriseId
,
name
,
createTime
);
String
uuid
=
""
;
if
(
exsitDTO
==
null
)
{
if
(
exsitDTO
==
null
)
{
dto
.
setUnionid
(
unionId
);
//更新对外联系人id
dto
.
setSelfExternalUserid
(
selfExternalUserId
);
uuid
=
memberUnionRelatedService
.
addMemberUnionidRelated
(
dto
);
}
else
{
}
else
{
exsitDTO
.
setExternalUserid
(
externalUserId
);
exsitDTO
.
setUnionid
(
unionId
);
//更新对外联系人id
...
...
@@ -841,39 +847,39 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
private
String
getExternalUserId
(
WxEnterpriseDTO
wxEnterprise
,
String
userId1
,
String
createTime
,
String
name
)
{
log
.
info
(
"新增外部联系人】corpid={},suiteId={},userId1={}"
,
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
userId1
);
private
String
getExternalUserId
(
WxEnterpriseDTO
wxEnterprise
,
String
userId1
,
String
createTime
,
String
name
)
{
log
.
info
(
"新增外部联系人】corpid={},suiteId={},userId1={}"
,
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
userId1
);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
userId1
);
String
externalUserId
=
""
;
log
.
info
(
"【新增外部联系人】wxRes={}"
,
wxRes
);
if
(
StringUtils
.
isNotBlank
(
wxRes
))
{
log
.
info
(
"【新增外部联系人】wxRes={}"
,
wxRes
);
if
(
StringUtils
.
isNotBlank
(
wxRes
))
{
JSONArray
jsonArr
=
JSON
.
parseArray
(
wxRes
);
String
wxName
=
""
;
for
(
Object
externalUserid
:
jsonArr
)
{
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
externalUserid
.
toString
());
log
.
info
(
"【新增外部联系人】uJ={}"
,
uJ
);
if
(
StringUtils
.
isNotBlank
(
uJ
))
{
log
.
info
(
"【新增外部联系人】uJ={}"
,
uJ
);
if
(
StringUtils
.
isNotBlank
(
uJ
))
{
JSONObject
jo
=
JSON
.
parseObject
(
uJ
);
String
external_contact
=
jo
.
getString
(
"external_contact"
);
String
uj_follow_user
=
jo
.
getString
(
"follow_user"
);
JSONObject
jt
=
null
;
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
jt
=
JSON
.
parseObject
(
external_contact
);
wxName
=
EmojiFilterUtil
.
filterEmojiLast
(
jt
.
getString
(
"name"
),
true
);
if
(
StringUtils
.
isBlank
(
wxName
))
{
if
(
StringUtils
.
isBlank
(
wxName
))
{
wxName
=
"--"
;
}
}
if
(
StringUtils
.
isNotBlank
(
uj_follow_user
))
{
if
(
StringUtils
.
isNotBlank
(
uj_follow_user
))
{
JSONArray
j
=
JSON
.
parseArray
(
uj_follow_user
);
String
uj_userId
=
""
;
for
(
Object
object
:
j
)
{
String
followJson
=
JSON
.
toJSONString
(
object
);
JSONObject
follow
=
JSON
.
parseObject
(
followJson
);
uj_userId
=
follow
.
getString
(
"userid"
);
log
.
info
(
"【新增外部联系人】createTime={},name={},followCreateTime={},wxName={}"
,
createTime
,
name
,
follow
.
getString
(
"createtime"
),
wxName
);
if
(
uj_userId
.
equals
(
userId1
)
&&
createTime
.
equals
(
follow
.
getString
(
"createtime"
))
&&
name
.
equals
(
wxName
))
{
if
(
jt
!=
null
)
{
log
.
info
(
"【新增外部联系人】createTime={},name={},followCreateTime={},wxName={}"
,
createTime
,
name
,
follow
.
getString
(
"createtime"
),
wxName
);
if
(
uj_userId
.
equals
(
userId1
)
&&
createTime
.
equals
(
follow
.
getString
(
"createtime"
))
&&
name
.
equals
(
wxName
))
{
if
(
jt
!=
null
)
{
externalUserId
=
jt
.
getString
(
"external_userid"
);
break
;
}
...
...
@@ -881,13 +887,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
}
if
(
StringUtils
.
isNotBlank
(
externalUserId
))
{
if
(
StringUtils
.
isNotBlank
(
externalUserId
))
{
break
;
}
}
}
return
externalUserId
;
}
@Override
public
void
delMemberUnionidRelated
(
MemberUnionidRelatedDTO
dto
)
{
DealQywxExternalUserPojo
dealQywxExternalUserPojo
=
new
DealQywxExternalUserPojo
();
...
...
@@ -917,35 +924,37 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override
public
ExternalClerkRelatedDTO
getByMemberId
(
String
staffId
,
String
memberId
)
{
TabHaobanStaff
staff
=
staffService
.
selectById
(
staffId
);
if
(
staff
==
null
)
{
if
(
staff
==
null
)
{
return
null
;
}
log
.
info
(
"【查询会员】wxUserId={},unionid={}"
,
staff
.
getWxUserId
(),
memberId
);
return
externalClerkRelatedService
.
getByMemberId
(
staff
.
getWxUserId
(),
memberId
);
log
.
info
(
"【查询会员】wxUserId={},unionid={}"
,
staff
.
getWxUserId
(),
memberId
);
return
externalClerkRelatedService
.
getByMemberId
(
staff
.
getWxUserId
(),
memberId
);
}
@Override
public
List
<
MemberUnionidRelatedDTO
>
getByWxUserIdAndWxEnterpriseId
(
String
wxUserId
,
String
wxEnterpriseId
)
{
List
<
MemberUnionidRelatedDTO
>
list
=
memberUnionRelatedService
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
List
<
MemberUnionidRelatedDTO
>
list
=
memberUnionRelatedService
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
return
list
;
}
@Override
public
List
<
MemberUnionidRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
)
{
List
<
MemberUnionidRelated
>
list
=
memberUnionidRelatedMapper
.
listByEnterpriseIdAndDate
(
enterpriseId
,
date
);
return
EntityUtil
.
changeEntityListByJSON
(
MemberUnionidRelatedDTO
.
class
,
list
);
public
List
<
MemberUnionidRelatedDTO
>
listByEnterpriseIdAndDate
(
String
enterpriseId
,
Date
date
)
{
List
<
MemberUnionidRelated
>
list
=
memberUnionidRelatedMapper
.
listByEnterpriseIdAndDate
(
enterpriseId
,
date
);
return
EntityUtil
.
changeEntityListByJSON
(
MemberUnionidRelatedDTO
.
class
,
list
);
}
@Override
public
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
)
{
log
.
info
(
"【刷下好友】wxUserId={}"
,
wxUserId
);
public
void
freshWxFrend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
storeId
)
{
log
.
info
(
"【刷下好友】wxUserId={}"
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
List
<
MemberUnionidRelatedDTO
>
list
=
this
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
.
collect
(
Collectors
.
toList
());
JSONArray
externalArr
=
JSON
.
parseArray
(
wxRes
);
for
(
String
externalUserId
:
externalUserIdList
)
{
if
(!
externalArr
.
contains
(
externalUserId
))
{
if
(!
externalArr
.
contains
(
externalUserId
))
{
//删除成员和外部联系人关系
MemberUnionidRelatedDTO
dto
=
new
MemberUnionidRelatedDTO
();
dto
.
setExternalUserid
(
externalUserId
);
...
...
@@ -958,36 +967,36 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
return
;
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
log
.
info
(
"【刷下好友】res={}"
,
res
);
if
(
StringUtils
.
isBlank
(
res
))
{
log
.
info
(
"【刷下好友】res={}"
,
res
);
if
(
StringUtils
.
isBlank
(
res
))
{
return
;
}
JSONArray
jsonArr
=
JSON
.
parseArray
(
res
);
if
(
jsonArr
.
size
()
==
0
)
{
if
(
jsonArr
.
size
()
==
0
)
{
return
;
}
for
(
Object
object
:
jsonArr
)
{
this
.
add
(
wxEnterpriseId
,
object
.
toString
(),
wxUserId
,
storeId
);
this
.
add
(
wxEnterpriseId
,
object
.
toString
(),
wxUserId
,
storeId
);
}
}
@Override
public
void
mqFreshWxFrend
(
String
res
)
{
public
void
mqFreshWxFrend
(
String
res
)
{
JSONObject
json
=
JSON
.
parseObject
(
res
);
String
wxEnterpriseId
=
json
.
getString
(
"wxEnterpriseId"
);
String
wxUserId
=
json
.
getString
(
"wxUserId"
);
String
storeId
=
json
.
getString
(
"storeId"
);
log
.
info
(
"【刷下微信好友】wxEnterpriseId={}.wxUserId={},storeId={}"
,
wxEnterpriseId
,
wxUserId
,
storeId
);
if
(
StringUtils
.
isAnyBlank
(
wxEnterpriseId
,
wxUserId
,
storeId
))
{
return
;
log
.
info
(
"【刷下微信好友】wxEnterpriseId={}.wxUserId={},storeId={}"
,
wxEnterpriseId
,
wxUserId
,
storeId
);
if
(
StringUtils
.
isAnyBlank
(
wxEnterpriseId
,
wxUserId
,
storeId
))
{
return
;
}
freshWxFrend
(
wxEnterpriseId
,
wxUserId
,
storeId
);
}
...
...
@@ -999,92 +1008,245 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
null
!=
wxEnterprise
)
{
memberUnionRelatedService
.
clean
(
wxEnterprise
.
getWxEnterpriseId
());
}
}
else
{
}
else
{
memberUnionRelatedService
.
clean
(
null
);
}
}
@Override
public
Page
<
MemberUnionidRelatedDTO
>
pageMemberUnionByParams
(
List
<
String
>
userIdList
,
List
<
String
>
sendMemberIds
,
String
enterpriseId
,
BasePageInfo
pageInfo
)
{
PageHelper
.
startPage
(
pageInfo
.
getPageNum
(),
pageInfo
.
getPageSize
());
return
PageUtil
.
changePageHelperToCurrentPage
(
memberUnionRelatedService
.
pageMemberUnionByParams
(
userIdList
,
sendMemberIds
,
enterpriseId
),
MemberUnionidRelatedDTO
.
class
);
return
PageUtil
.
changePageHelperToCurrentPage
(
memberUnionRelatedService
.
pageMemberUnionByParams
(
userIdList
,
sendMemberIds
,
enterpriseId
),
MemberUnionidRelatedDTO
.
class
);
}
// @Override
// public String sendMessage(String wxEnterpriseId,String userId,List<String> extendUserList,String materialId){
// WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
// MaterialDTO material = materialApiService.selectMaterialById(materialId);
// if(material == null){
// return "";
// }
// JSONResponse jp = null;
// if(material.getMaterialType() == 2 || material.getMaterialType() == 4 || material.getMaterialType() == 5){
// Date wxLastTime = material.getWxLastUploadTime();
// String maerialId = material.getMediaId();
// if(DateUtil.addDay(wxLastTime, 3).getTime() < System.currentTimeMillis()){
// maerialId = materialApiService.reUpdalodMetail(materialId);
// }
// QywxImageExternalMessageDTO dto = new QywxImageExternalMessageDTO();
// dto.setMediaId(maerialId);
// dto.setChatType("single");
// dto.setExternalUserid(extendUserList);
// dto.setSenderUserId(userId);
// log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
// jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
// }else if(material.getMaterialType() == 1){
// QywxTextExternalMessageDTO dto = new QywxTextExternalMessageDTO();
// dto.setChatType("single");
// dto.setExternalUserid(extendUserList);
// dto.setSenderUserId(userId);
// dto.setText(material.getMaterialContent());
// log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
// jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
// }else if(material.getMaterialType() == 3){
// QywxIinkExternalMessageDTO dto = new QywxIinkExternalMessageDTO();
// dto.setChatType("single");
// dto.setExternalUserid(extendUserList);
// dto.setSenderUserId(userId);
// dto.setDesc(material.getMaterialDesc());
// dto.setPicurl(material.getWxImgUrl());
// dto.setTitle(material.getMaterialTitle());
// dto.setUrl(material.getLink());
// log.info("【发送消息】dto = {}",JSON.toJSONString(dto));
// jp = qywxSuiteApiService.sendExternalMessage(enterprise.getCorpid(), config.getWxSuiteid(), dto);
// }
// log.info("【发送消息】jp = {}",JSON.toJSONString(jp));
// Map<String,Object> returnMap = jp.getReturnMap();
// return returnMap.get("msgid") == null?"":returnMap.get("msgid").toString();
// }
/**
* 老的单个素材群发的api
*
* @param wxEnterpriseId : 微信企业id
* @param userId : 用户id
* @param extendUserList : 发送的用户id
* @param materialId : 素材id
* @return : 返回群发执行结果
*/
@Override
public
String
sendMessage
(
String
wxEnterpriseId
,
String
userId
,
List
<
String
>
extendUserList
,
String
materialId
)
{
JSONResponse
jp
=
this
.
sendMessage
(
wxEnterpriseId
,
userId
,
extendUserList
,
Collections
.
singletonList
(
materialId
));
//返回执行结果, msgId
log
.
info
(
"【发送消息】jp = {}"
,
JSON
.
toJSONString
(
jp
));
Map
<
String
,
Object
>
returnMap
=
jp
.
getReturnMap
();
return
returnMap
.
get
(
"msgid"
)
==
null
?
""
:
returnMap
.
get
(
"msgid"
).
toString
();
}
/**
* 创建企业群发, 支出素材批量发送
*
* @param wxEnterpriseId : 微信企业id
* @param userId : 用户id
* @param extendUserList : 发送的用户id
* @param materialIdList : 素材id列表
* @return : 返回群发执行结果
*/
@Override
public
String
sendMessage
(
String
wxEnterpriseId
,
String
userId
,
List
<
String
>
extendUserList
,
String
materialId
){
public
JSONResponse
sendMessage
(
String
wxEnterpriseId
,
String
userId
,
List
<
String
>
extendUserList
,
List
<
String
>
materialIdList
)
{
//群发请求参数
QywxExternalMessageDTO
qywxExternalMessageDTO
=
new
QywxExternalMessageDTO
();
//素材列表
List
<
QywxMessageMaterialDTO
>
messageMaterialList
=
new
ArrayList
<>();
materialIdList
.
forEach
(
materialId
->
{
MaterialDTO
material
=
materialApiService
.
getHasChangeMadieMaterialById
(
materialId
);
if
(
material
==
null
)
{
return
;
}
if
(
material
.
getMaterialType
()
==
1
)
{
qywxExternalMessageDTO
.
setContent
(
material
.
getMaterialContent
());
}
else
{
messageMaterialList
.
add
(
this
.
getMessageMaterial
(
material
));
}
});
//素材列表不存在, 并且不存在文本内容, 不执行
if
(
messageMaterialList
.
isEmpty
()
&&
StringUtils
.
isBlank
(
qywxExternalMessageDTO
.
getContent
()))
{
JSONResponse
jp
=
new
JSONResponse
();
jp
.
setErrorCode
(-
1
);
jp
.
setErrorMessage
(
"群发素材不存在, 群发创建失败"
);
return
jp
;
}
//请求参数赋值
qywxExternalMessageDTO
.
setChatType
(
"single"
);
qywxExternalMessageDTO
.
setExternalUserid
(
extendUserList
);
qywxExternalMessageDTO
.
setSenderUserId
(
userId
);
qywxExternalMessageDTO
.
setAttachments
(
messageMaterialList
);
//调接口执行创建群发
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
MaterialDTO
material
=
materialApiService
.
selectMaterialById
(
materialId
);
if
(
material
==
null
){
return
""
;
return
qywxSuiteApiService
.
sendExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
qywxExternalMessageDTO
);
}
JSONResponse
jp
=
null
;
if
(
material
.
getMaterialType
()
==
2
||
material
.
getMaterialType
()
==
4
||
material
.
getMaterialType
()
==
5
){
Date
wxLastTime
=
material
.
getWxLastUploadTime
();
/**
* 素材发送对象构造
*
* @param material : 素材对象
* @return : 返回素材发送对象
*/
private
QywxMessageMaterialDTO
getMessageMaterial
(
MaterialDTO
material
)
{
//素材类型
Integer
materialType
=
material
.
getMaterialType
();
//主键id
String
materialId
=
material
.
getMaterialId
();
//企微对应的id
String
maerialId
=
material
.
getMediaId
();
if
(
DateUtil
.
addDay
(
wxLastTime
,
3
).
getTime
()
<
System
.
currentTimeMillis
()){
//判断素材企微id是否需要刷新
List
<
Integer
>
materialTypeList
=
Arrays
.
asList
(
2
,
4
,
6
);
if
(
materialTypeList
.
contains
(
materialType
))
{
Date
wxLastTime
=
material
.
getWxLastUploadTime
();
if
(
DateUtil
.
addDay
(
wxLastTime
,
3
).
getTime
()
<
System
.
currentTimeMillis
())
{
maerialId
=
materialApiService
.
reUpdalodMetail
(
materialId
);
}
QywxImageExternalMessageDTO
dto
=
new
QywxImageExternalMessageDTO
();
dto
.
setMediaId
(
maerialId
);
dto
.
setChatType
(
"single"
);
dto
.
setExternalUserid
(
extendUserList
);
dto
.
setSenderUserId
(
userId
);
log
.
info
(
"【发送消息】dto = {}"
,
JSON
.
toJSONString
(
dto
));
jp
=
qywxSuiteApiService
.
sendExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
dto
);
}
else
if
(
material
.
getMaterialType
()
==
1
){
QywxTextExternalMessageDTO
dto
=
new
QywxTextExternalMessageDTO
();
dto
.
setChatType
(
"single"
);
dto
.
setExternalUserid
(
extendUserList
);
dto
.
setSenderUserId
(
userId
);
dto
.
setText
(
material
.
getMaterialContent
());
log
.
info
(
"【发送消息】dto = {}"
,
JSON
.
toJSONString
(
dto
));
jp
=
qywxSuiteApiService
.
sendExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
dto
);
}
else
if
(
material
.
getMaterialType
()
==
3
){
QywxIinkExternalMessageDTO
dto
=
new
QywxIinkExternalMessageDTO
();
dto
.
setChatType
(
"single"
);
dto
.
setExternalUserid
(
extendUserList
);
dto
.
setSenderUserId
(
userId
);
dto
.
setDesc
(
material
.
getMaterialDesc
());
dto
.
setPicurl
(
material
.
getWxImgUrl
());
dto
.
setTitle
(
material
.
getMaterialTitle
());
dto
.
setUrl
(
material
.
getLink
());
log
.
info
(
"【发送消息】dto = {}"
,
JSON
.
toJSONString
(
dto
));
jp
=
qywxSuiteApiService
.
sendExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
dto
);
}
log
.
info
(
"【发送消息】jp = {}"
,
JSON
.
toJSONString
(
jp
));
Map
<
String
,
Object
>
returnMap
=
jp
.
getReturnMap
();
return
returnMap
.
get
(
"msgid"
)
==
null
?
""
:
returnMap
.
get
(
"msgid"
).
toString
();
}
//素材对象
QywxMessageMaterialDTO
dto
=
new
QywxMessageMaterialDTO
();
if
(
materialType
==
2
)
{
QywxImageMaterialDTO
imageMaterialDTO
=
new
QywxImageMaterialDTO
();
imageMaterialDTO
.
setMediaId
(
maerialId
);
dto
.
setMsgType
(
"image"
);
dto
.
setImage
(
imageMaterialDTO
);
}
else
if
(
materialType
==
3
)
{
QywxLinkMaterialDTO
linkMaterialDTO
=
new
QywxLinkMaterialDTO
();
linkMaterialDTO
.
setTitle
(
material
.
getMaterialTitle
());
linkMaterialDTO
.
setPicUrl
(
material
.
getWxImgUrl
());
linkMaterialDTO
.
setDesc
(
material
.
getMaterialDesc
());
linkMaterialDTO
.
setUrl
(
material
.
getLink
());
dto
.
setMsgType
(
"link"
);
dto
.
setLink
(
linkMaterialDTO
);
}
else
if
(
materialType
==
4
)
{
QywxVideoMaterialDTO
videoMaterialDTO
=
new
QywxVideoMaterialDTO
();
videoMaterialDTO
.
setMediaId
(
maerialId
);
dto
.
setMsgType
(
"video"
);
dto
.
setVideo
(
videoMaterialDTO
);
}
else
if
(
materialType
==
6
)
{
QywxMiniprogramMaterialDTO
miniprogramMaterialDTO
=
new
QywxMiniprogramMaterialDTO
();
miniprogramMaterialDTO
.
setTitle
(
material
.
getMaterialTitle
());
miniprogramMaterialDTO
.
setPicMediaId
(
maerialId
);
miniprogramMaterialDTO
.
setAppid
(
material
.
getAppId
());
miniprogramMaterialDTO
.
setPage
(
material
.
getLink
());
dto
.
setMsgType
(
"miniprogram"
);
dto
.
setMiniprogram
(
miniprogramMaterialDTO
);
}
return
dto
;
}
/**
* 获取群发成员发送任务列表
*
* @param wxEnterpriseId : 微信企业id
* @param wxMessageId : 消息id
* @param cursor : 分页游标
* @return : 返回请求结果
*/
@Override
public
JSONResponse
taskExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
)
{
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
enterprise
==
null
)
{
return
null
;
}
return
qywxSuiteApiService
.
taskExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
);
}
/**
* 获取企业群发成员执行结果
*
* @param wxEnterpriseId : 微信企业id
* @param wxMessageId : 消息id
* @param cursor : 分页游标
* @param userId : 用户id
* @return : 返回请求结果
*/
@Override
public
JSONResponse
resultExternalMessage
(
String
wxEnterpriseId
,
String
wxMessageId
,
String
cursor
,
String
userId
)
{
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
enterprise
==
null
)
{
return
null
;
}
return
qywxSuiteApiService
.
resultExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxMessageId
,
cursor
,
userId
);
}
@Override
public
JSONResponse
getMessageStatus
(
String
wxEnterpriseId
,
String
wxMessageId
)
{
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
enterprise
==
null
)
{
if
(
enterprise
==
null
)
{
return
null
;
}
JSONResponse
jp
=
qywxSuiteApiService
.
resultExternalMessage
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxMessageId
);
return
jp
;
}
@Override
public
List
<
MemberUnionidRelatedDTO
>
getByWxUserIdListAndWxEnterpriseId
(
List
<
String
>
userIdList
,
String
wxEnterpriseId
)
{
return
EntityUtil
.
changeEntityListByJSON
(
MemberUnionidRelatedDTO
.
class
,
memberUnionidRelatedMapper
.
getByWxUserIdListAndWxEnterpriseId
(
userIdList
,
wxEnterpriseId
));
return
EntityUtil
.
changeEntityListByJSON
(
MemberUnionidRelatedDTO
.
class
,
memberUnionidRelatedMapper
.
getByWxUserIdListAndWxEnterpriseId
(
userIdList
,
wxEnterpriseId
));
}
@Override
public
void
cleanNoExsitFriend
(
String
wxEnterpriseId
,
String
wxUserId
,
String
wxRes
)
{
log
.
info
(
"【清除不存在的好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
log
.
info
(
"【清除不存在的好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//String wxRes = qywxUserApiService.listExternalUserid(enterprise.getCorpid(), config.getWxSuiteid(), wxUserId);
List
<
MemberUnionidRelatedDTO
>
list
=
this
.
getByWxUserIdAndWxEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
List
<
String
>
externalUserIdList
=
list
.
stream
().
map
(
external
->
external
.
getExternalUserid
())
.
collect
(
Collectors
.
toList
());
if
(
StringUtils
.
isBlank
(
wxRes
))
{
log
.
info
(
"【清除不存在的好友不存在】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
if
(
StringUtils
.
isBlank
(
wxRes
))
{
log
.
info
(
"【清除不存在的好友不存在】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
return
;
}
JSONArray
externalArr
=
JSON
.
parseArray
(
wxRes
);
for
(
String
externalUserId
:
externalUserIdList
)
{
if
(!
externalArr
.
contains
(
externalUserId
))
{
if
(!
externalArr
.
contains
(
externalUserId
))
{
//删除成员和外部联系人关系
MemberUnionidRelatedDTO
dto
=
new
MemberUnionidRelatedDTO
();
dto
.
setExternalUserid
(
externalUserId
);
...
...
@@ -1096,28 +1258,29 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
@Override
public
List
<
String
>
listSelfExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
try
{
log
.
info
(
"【查询自建应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
log
.
info
(
"【查询自建应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
List
<
String
>
list
=
new
ArrayList
<>();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
CONTACT_CUSTOMER
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置客户联系secret:{}"
,
wxEnterpriseId
);
return
list
;
}
String
res
=
qywxUserApiService
.
listSelfExternalUserid
(
enterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
wxUserId
);
log
.
info
(
"【查询自建应用】res={}"
,
res
);
log
.
info
(
"【查询自建应用】res={}"
,
res
);
if
(
res
!=
null
&&
res
.
equals
(
"1"
))
{
log
.
info
(
"代表需要重试"
);
return
null
;
}
if
(
StringUtils
.
isBlank
(
res
))
{
if
(
StringUtils
.
isBlank
(
res
))
{
return
list
;
}
JSONArray
jsonArr
=
JSON
.
parseArray
(
res
);
if
(
jsonArr
.
size
()
==
0
)
{
if
(
jsonArr
.
size
()
==
0
)
{
return
list
;
}
for
(
Object
object
:
jsonArr
)
{
...
...
@@ -1125,27 +1288,28 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
return
list
;
}
catch
(
Exception
e
)
{
log
.
info
(
"错误={}"
,
e
);
log
.
info
(
"错误={}"
,
e
);
}
return
null
;
}
@Override
public
List
<
String
>
listExterialList
(
String
wxEnterpriseId
,
String
wxUserId
)
{
log
.
info
(
"【获取第三方应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
log
.
info
(
"【获取第三方应用好友】wxEnterpriseId={},wxUserId={}"
,
wxEnterpriseId
,
wxUserId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
// String wxRes = qywxUserApiService.listExternalUserid(enterprise.getCorpid(), "wwb3ef71aa8c6d9c06", wxUserId);
String
wxRes
=
qywxUserApiService
.
listExternalUserid
(
enterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxUserId
);
List
<
String
>
list
=
new
ArrayList
<>();
log
.
info
(
"【查询第三方应用】res={}"
,
wxRes
);
log
.
info
(
"【查询第三方应用】res={}"
,
wxRes
);
if
(
wxRes
!=
null
&&
wxRes
.
equals
(
"1"
))
{
log
.
info
(
"代表需要重试"
);
return
null
;
}
if
(
StringUtils
.
isBlank
(
wxRes
))
{
if
(
StringUtils
.
isBlank
(
wxRes
))
{
return
list
;
}
JSONArray
jsonArr
=
JSON
.
parseArray
(
wxRes
);
if
(
jsonArr
.
size
()
==
0
)
{
if
(
jsonArr
.
size
()
==
0
)
{
return
list
;
}
for
(
Object
object
:
jsonArr
)
{
...
...
@@ -1153,10 +1317,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
return
list
;
}
@Override
public
ExternalUserDTO
getCorpSelfExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
public
ExternalUserDTO
getCorpSelfExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
)
{
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"企业不存在"
);
return
null
;
}
...
...
@@ -1166,7 +1331,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return
null
;
}
String
unionIdJson
=
qywxUserApiService
.
getCorpSelfExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
if
(
StringUtils
.
isBlank
(
unionIdJson
))
{
log
.
info
(
"好友不存在"
);
return
null
;
}
else
if
(
unionIdJson
.
equals
(
"1"
))
{
...
...
@@ -1178,15 +1343,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
@Override
public
ExternalUserDTO
getExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
public
ExternalUserDTO
getExternalUseridInfo
(
String
wxEnterpriseId
,
String
wxUserId
,
String
externalUserId
)
{
WxEnterpriseDTO
wxEnterprise
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterprise
==
null
)
{
if
(
wxEnterprise
==
null
)
{
log
.
info
(
"企业不存在"
);
return
null
;
}
// String uJ = qywxUserApiService.getExternalUseridInfo(wxEnterprise.getCorpid(), "wwb3ef71aa8c6d9c06", externalUserId);
String
uJ
=
qywxUserApiService
.
getExternalUseridInfo
(
wxEnterprise
.
getCorpid
(),
config
.
getWxSuiteid
(),
externalUserId
);
if
(
StringUtils
.
isBlank
(
uJ
))
{
if
(
StringUtils
.
isBlank
(
uJ
))
{
log
.
info
(
"好友不存在"
);
return
null
;
}
else
if
(
uJ
.
equals
(
"1"
))
{
...
...
@@ -1196,28 +1361,30 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
name
=
""
;
String
createTime
=
""
;
String
avatar
=
""
;
if
(
StringUtils
.
isNotBlank
(
uJ
)){
Integer
friendType
=
1
;
if
(
StringUtils
.
isNotBlank
(
uJ
))
{
JSONObject
jo
=
JSON
.
parseObject
(
uJ
);
String
external_contact
=
jo
.
getString
(
"external_contact"
);
String
uj_follow_user
=
jo
.
getString
(
"follow_user"
);
JSONObject
jt
=
null
;
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
if
(
StringUtils
.
isNotBlank
(
external_contact
))
{
jt
=
JSON
.
parseObject
(
external_contact
);
name
=
EmojiFilterUtil
.
filterEmojiLast
(
jt
.
getString
(
"name"
),
true
);
if
(
StringUtils
.
isBlank
(
name
))
{
if
(
StringUtils
.
isBlank
(
name
))
{
name
=
"--"
;
}
friendType
=
jt
.
getInteger
(
"type"
);
avatar
=
jt
.
getString
(
"avatar"
);
}
if
(
StringUtils
.
isNotBlank
(
uj_follow_user
))
{
if
(
StringUtils
.
isNotBlank
(
uj_follow_user
))
{
JSONArray
j
=
JSON
.
parseArray
(
uj_follow_user
);
String
uj_userId
=
""
;
for
(
Object
object
:
j
)
{
String
followJson
=
JSON
.
toJSONString
(
object
);
JSONObject
follow
=
JSON
.
parseObject
(
followJson
);
uj_userId
=
follow
.
getString
(
"userid"
);
if
(
uj_userId
.
equals
(
wxUserId
))
{
if
(
jt
!=
null
)
{
if
(
uj_userId
.
equals
(
wxUserId
))
{
if
(
jt
!=
null
)
{
externalUserId
=
jt
.
getString
(
"external_userid"
);
createTime
=
follow
.
getString
(
"createtime"
);
break
;
...
...
@@ -1232,13 +1399,15 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
pojo
.
setAddCreateTime
(
createTime
);
pojo
.
setWxEnterpriseId
(
wxEnterpriseId
);
pojo
.
setAvatar
(
avatar
);
pojo
.
setFriendType
(
friendType
);
return
EntityUtil
.
changeEntityByJSON
(
ExternalUserDTO
.
class
,
pojo
);
}
@Override
public
String
addExternal
(
ExternalUserDTO
dto
)
{
String
wxUserId
=
dto
.
getWxUserId
();
String
wxEnterpriseId
=
dto
.
getWxEnterpriseId
();
String
name
=
StringUtils
.
isBlank
(
dto
.
getName
())?
"--"
:
dto
.
getName
();
String
name
=
StringUtils
.
isBlank
(
dto
.
getName
())
?
"--"
:
dto
.
getName
();
String
createTime
=
dto
.
getAddCreateTime
();
String
unionId
=
dto
.
getUnionId
();
String
externalUserId
=
dto
.
getExternalUserId
();
...
...
@@ -1248,14 +1417,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
staffId
=
dto
.
getStaffId
();
String
avatar
=
dto
.
getAvatar
();
String
clerkId
=
dto
.
getClerkId
();
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
,
externalUserId
,
memberId
,
storeId
,
enterpriseId
,
staffId
,
clerkId
))
{
if
(
StringUtils
.
isAnyBlank
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
,
externalUserId
,
memberId
,
storeId
,
enterpriseId
,
staffId
,
clerkId
))
{
log
.
info
(
"【新增外部联系人】wxUserId={},wxEnterpriseId={},name={},createTime={},unionId ={},externalUserId ={},memberId ={},storeId ={},enterpriseId ={},staffId={},clerkId={}"
+
""
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
,
externalUserId
,
memberId
,
storeId
,
enterpriseId
,
staffId
,
clerkId
);
+
""
,
wxUserId
,
wxEnterpriseId
,
name
,
createTime
,
unionId
,
externalUserId
,
memberId
,
storeId
,
enterpriseId
,
staffId
,
clerkId
);
return
"参数不对"
;
}
MemberUnionidRelatedDTO
exsitDTO
=
memberUnionRelatedService
.
getByUnionId
(
wxEnterpriseId
,
wxUserId
,
unionId
);
String
uuid
=
""
;
if
(
exsitDTO
==
null
)
{
if
(
exsitDTO
==
null
)
{
exsitDTO
=
new
MemberUnionidRelatedDTO
();
exsitDTO
.
setAvatar
(
avatar
);
exsitDTO
.
setExternalUserid
(
externalUserId
);
...
...
@@ -1267,7 +1436,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
exsitDTO
.
setWxUserId
(
wxUserId
);
exsitDTO
.
setUnionid
(
unionId
);
uuid
=
memberUnionRelatedService
.
addMemberUnionidRelated
(
exsitDTO
);
}
else
{
}
else
{
uuid
=
exsitDTO
.
getMemberUnionidRelatedId
();
exsitDTO
.
setAvatar
(
avatar
);
exsitDTO
.
setExternalUserid
(
externalUserId
);
...
...
@@ -1297,7 +1466,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
related
.
setStatusFlag
(
1
);
externalClerkRelatedService
.
insert
(
related
);
}
else
{
}
else
{
TabHaobanExternalClerkRelated
external
=
clerkRelateds
.
get
(
0
);
external
.
setMemberId
(
memberId
);
external
.
setMemberUnionidRelatedId
(
uuid
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxApplicationApiServiceImpl.java
View file @
adf7e102
...
...
@@ -40,8 +40,8 @@ public class WxApplicationApiServiceImpl implements WxApplicationApiService{
int
i
=
this
.
wxApplicationService
.
cancalWxApplication
(
enterprise
.
getWxEnterpriseId
(),
suiteId
);
log
.
info
(
"取消授权结果:{}"
,
i
);
TabHaobanWxApplication
wxApplication
=
this
.
wxApplicationService
.
selectByWxEnterpriseIdAndApplicationType
(
enterprise
.
getWxEnterpriseId
(),
2
);
if
(
wxApplication
==
null
){
//如果取消好办小程序应用授权,删除企业
this
.
wxEnterpriseService
.
delete
(
enterprise
.
getWxEnterpriseId
());
if
(
wxApplication
==
null
)
{
//如果取消好办小程序应用授权,临时解除绑定
this
.
wxEnterpriseService
.
unbind
(
enterprise
.
getWxEnterpriseId
());
}
}
log
.
info
(
"企业未绑定过,{}"
,
corpId
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseApiServiceImpl.java
View file @
adf7e102
...
...
@@ -70,6 +70,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxEnterpriseId
=
enterprise
.
getWxEnterpriseId
();
wxDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
());
wxDTO
.
setStatusFlag
(
1
);
wxDTO
.
setBindFlag
(
1
);
wxEnterpriseService
.
update
(
wxDTO
);
}
else
{
wxEnterpriseId
=
wxEnterpriseService
.
add
(
wxDTO
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/WxEnterpriseRelatedApiServiceImpl.java
View file @
adf7e102
...
...
@@ -457,6 +457,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
String
midGroupId
=
null
;
//如果是1的话 加入对应企业
if
(
midGroupIds
.
size
()
==
1
)
{
midGroupId
=
midGroupIds
.
iterator
().
next
();
}
else
{
...
...
@@ -511,6 +512,7 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
detailDTO
.
setMemberOpenCardFlag
(
wxEnterpriseRelated
.
getMemberOpenCardFlag
());
detailDTO
.
setWxEnterpriseType
(
wxEnterpriseRelated
.
getWxEnterpriseType
());
detailDTO
.
setWxEnterpriseRelatedId
(
wxEnterpriseRelated
.
getWxEnterpriseRelatedId
());
detailDTO
.
setClerkEditFlag
(
wxEnterpriseRelated
.
getClerkEditFlag
());
return
detailDTO
;
}
...
...
@@ -622,4 +624,18 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
}
return
true
;
}
@Override
public
boolean
setClerkEditFlag
(
String
wxEnterprieseRelatedId
,
int
clerkEditFlag
)
{
TabHaobanWxEnterpriseRelated
tabHaobanWxEnterpriseRelated
=
wxEnterpriseRelatedService
.
getByGicEnterpriseIdByEnterpriseRelatedId
(
wxEnterprieseRelatedId
);
if
(
tabHaobanWxEnterpriseRelated
==
null
)
{
return
false
;
}
if
(
tabHaobanWxEnterpriseRelated
.
getWxEnterpriseType
()
==
1
)
{
logger
.
info
(
"非总部不能设置好友"
);
return
false
;
}
wxEnterpriseRelatedService
.
setClerkEdit
(
wxEnterprieseRelatedId
,
clerkEditFlag
);
return
true
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/friend/FriendSyncNewOperation.java
View file @
adf7e102
...
...
@@ -165,6 +165,9 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
String
wxUserId
=
dataPre
.
getpDataId
();
String
taskId
=
dataPre
.
getTaskId
();
if
(
externalUserDTO
.
getFriendType
()
==
2
)
{
return
"不是微信好友,是企业微信好友:"
+
externalUserDTO
.
getFriendType
();
}
//staff信息
StaffDTO
staff
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
wxUserId
,
wxEnterpriseId
);
if
(
staff
==
null
)
{
...
...
@@ -219,7 +222,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
externalUserDTO
.
getUnionId
(),
""
,
externalUserDTO
.
getName
(),
externalUserDTO
.
getAvatar
(),
qrcodeParam
);
}
if
(
member
==
null
)
{
return
"会员不存在:"
+
externalUserDTO
.
getUnionId
();
return
"会员不存在:
unionid:
"
+
externalUserDTO
.
getUnionId
();
}
externalUserDTO
.
setMemberId
(
member
.
getMemberId
());
return
memberUnionidRelatedApiService
.
addExternal
(
externalUserDTO
);
...
...
haoban-manage3-service/src/main/resources/mapper/MemberUnionidRelatedMapper.xml
View file @
adf7e102
...
...
@@ -216,14 +216,14 @@
<update
id=
"deleteByUnionidAndUserId"
parameterType=
"com.gic.haoban.manage.service.entity.MemberUnionidRelated"
>
update tab_haoban_member_unionid_related
set status_flag = 0
set status_flag = 0
,update_time=now()
where external_userid = #{externalUserid,jdbcType=VARCHAR}
and wx_user_id = #{wxUserId}
</update>
<update
id=
"delMemberUnionidRelatedBatch"
parameterType=
"com.gic.haoban.manage.service.entity.MemberUnionidRelated"
>
update tab_haoban_member_unionid_related
set status_flag = 0
set status_flag = 0
,update_time=now()
where
wx_enterprise_id=#{wxEnterpriseId}
and wx_user_id = #{wxUserId}
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanClerkMainStoreRelatedMapper.xml
View file @
adf7e102
...
...
@@ -7,12 +7,13 @@
<result
column=
"wx_enterprise_id"
property=
"wxEnterpriseId"
jdbcType=
"VARCHAR"
/>
<result
column=
"store_id"
property=
"storeId"
jdbcType=
"VARCHAR"
/>
<result
column=
"main_store_flag"
property=
"mainStoreFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"fresh_friend_flag"
property=
"freshFriendFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"status_flag"
property=
"statusFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag,
clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag,
fresh_friend_flag,
status_flag, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
...
...
@@ -27,11 +28,12 @@
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated"
>
insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, staff_id,
wx_enterprise_id, store_id, main_store_flag,
wx_enterprise_id, store_id, main_store_flag, fresh_friend_flag,
status_flag, create_time, update_time
)
values (#{clerkMainStoreRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR}, #{mainStoreFlag,jdbcType=INTEGER},
#{freshFriendFlag},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
...
...
@@ -53,6 +55,9 @@
<if
test=
"mainStoreFlag != null"
>
main_store_flag,
</if>
<if
test=
"freshFriendFlag != null"
>
fresh_friend_flag,
</if>
<if
test=
"statusFlag != null"
>
status_flag,
</if>
...
...
@@ -79,6 +84,9 @@
<if
test=
"mainStoreFlag != null"
>
#{mainStoreFlag,jdbcType=INTEGER},
</if>
<if
test=
"freshFriendFlag != null"
>
#{freshFriendFlag},
</if>
<if
test=
"statusFlag != null"
>
#{statusFlag,jdbcType=INTEGER},
</if>
...
...
@@ -105,6 +113,9 @@
<if
test=
"mainStoreFlag != null"
>
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
</if>
<if
test=
"freshFriendFlag != null"
>
fresh_friend_flag = #{freshFriendFlag,jdbcType=INTEGER},
</if>
<if
test=
"statusFlag != null"
>
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
...
...
@@ -123,6 +134,7 @@
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
fresh_friend_flag = #{freshFriendFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanExternalClerkRelatedMapper.xml
View file @
adf7e102
...
...
@@ -481,4 +481,25 @@
and status_flag in(1,3,4)
order by update_time desc
</select>
<select
id=
"listByMemberIdAndWxEnterpriseId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and member_id = #{memberId}
and status_flag = 1
</select>
<select
id=
"listByWxUserIdAndWxEnterpriseId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId}
and enterprise_id = #{enterpriseId}
and wx_user_id = #{wxUserId}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanMaterialMapper.xml
View file @
adf7e102
...
...
@@ -18,13 +18,14 @@
<result
column=
"material_desc"
property=
"materialDesc"
jdbcType=
"VARCHAR"
/>
<result
column=
"status_flag"
property=
"statusFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"link"
property=
"link"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_id"
property=
"appId"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
material_id,from_material_id, material_title, material_type, category_id, material_content, wx_last_upload_time,
media_id, wx_enterprise_id, staff_id, staff_name, img_url, material_desc, status_flag,
link, create_time, update_time,wx_img_url
link,
app_id,
create_time, update_time,wx_img_url
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
...
...
@@ -52,14 +53,15 @@
category_id, material_content, wx_last_upload_time,
media_id, wx_enterprise_id, staff_id,
staff_name, img_url,wx_img_url, material_desc,
status_flag, link, create_time,
status_flag, link,app_id, create_time,
update_time)
values (#{materialId,jdbcType=VARCHAR},#{fromMaterialId}, #{materialTitle,jdbcType=VARCHAR},
#{materialType,jdbcType=INTEGER},
#{categoryId,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=TIMESTAMP},
#{mediaId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{wxImgUrl,jdbcType=VARCHAR}, #{materialDesc,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{link,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{statusFlag,jdbcType=INTEGER}, #{link,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanMaterial"
>
...
...
@@ -216,6 +218,9 @@
<if
test=
"link != null"
>
link = #{link,jdbcType=VARCHAR},
</if>
<if
test=
"appId != null"
>
app_id = #{appId,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -274,6 +279,28 @@
order by update_time desc
</select>
<select
id=
"listMaterialByCategoryIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_material
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId}
<if
test=
"keyword != null and keyword != ''"
>
and material_title like CONCAT('%',#{keyword},'%')
</if>
<if
test=
"materialType != null"
>
and material_type = #{materialType}
</if>
<if
test=
"categoryIds != null and categoryIds.size>0"
>
and category_id in
<foreach
collection=
"categoryIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
order by update_time desc
</select>
<select
id=
"selectByfromMaterialId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanStoreRelationMapper.xml
View file @
adf7e102
...
...
@@ -195,4 +195,17 @@
where enterprise_id=#{enterpriseId}
and status_flag=1
</update>
<update
id=
"deleteStoreRalationByStoreIds"
>
update tab_haoban_store_relation
set
status_flag = 0,
update_time = now()
where enterprise_id=#{enterpriseId}
and store_id in
<foreach
collection=
"storeIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
and status_flag=1
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/WxEnterpriseRelatedMapper.xml
View file @
adf7e102
...
...
@@ -11,12 +11,13 @@
<result
column=
"status_flag"
property=
"statusFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"wx_enterprise_type"
property=
"wxEnterpriseType"
jdbcType=
"INTEGER"
/>
<result
column=
"member_open_card_flag"
property=
"memberOpenCardFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"clerk_edit_flag"
property=
"clerkEditFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
wx_enterprise_related_id, wx_enterprise_id, enterprise_id, version, status_flag, wx_enterprise_type,
member_open_card
_flag,
member_open_card_flag,clerk_edit
_flag,
create_time, update_time,staff_id,staff_name
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
...
...
@@ -61,6 +62,9 @@
<if
test=
"memberOpenCardFlag != null"
>
member_open_card_flag,
</if>
<if
test=
"clerkEditFlag != null"
>
clerk_edit_flag,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
...
...
@@ -96,6 +100,9 @@
<if
test=
"memberOpenCardFlag != null"
>
#{memberOpenCardFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkEditFlag != null"
>
#{clerkEditFlag,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
...
...
@@ -131,6 +138,9 @@
<if
test=
"memberOpenCardFlag != null"
>
member_open_card_flag = #{memberOpenCardFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkEditFlag != null"
>
clerk_edit_flag = #{clerkEditFlag,jdbcType=INTEGER},
</if>
<if
test=
"wxEnterpriseType != null"
>
wx_enterprise_type = #{wxEnterpriseType,jdbcType=INTEGER},
</if>
...
...
haoban-manage3-service/src/test/java/ServiceTest.java
View file @
adf7e102
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.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.FlushStoreMqDTO
;
import
com.gic.haoban.manage.api.dto.MaterialDTO
;
import
com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.service.service.MemberUnionRelatedService
;
...
...
@@ -53,24 +56,34 @@ public class ServiceTest {
@Autowired
private
MaterialApiService
materialApiService
;
@Autowired
private
CheckQywxSettingApiService
checkQywxSettingApiService
;
private
final
ExecutorService
pools
=
Executors
.
newFixedThreadPool
(
50
);
@Test
public
void
test11
()
{
FlushStoreMqDTO
flushStoreMqDTO
=
new
FlushStoreMqDTO
();
flushStoreMqDTO
.
setEnterpriseId
(
"testEnteroriseId"
);
int
i
=
2
;
while
(
i
--
>
0
)
{
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
wxEnterpriseRelatedApiService
.
flushBindStoreByEnterpriseId
(
"ff8080815dacd3a2015dacd3ef5c0000"
,
"-1"
,
"-1"
,
ChannelCodeEnum
.
SYNC_UNBIND
.
getCode
());
}
// FlushStoreMqDTO flushStoreMqDTO = new FlushStoreMqDTO();
// flushStoreMqDTO.setEnterpriseId("testEnteroriseId");
// int i = 2;
// while (i-- > 0) {
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// wxEnterpriseRelatedApiService.flushBindStoreByEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000",
// "-1", "-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
// }
checkQywxSettingApiService
.
setFriendSetting
(
"ca66a01b79474c40b3e7c7f93daf1a3b"
,
"宿命の战"
);
// MemberUnionidRelatedDTO dto = new MemberUnionidRelatedDTO();
// dto.setSuiteid("selfSuiteId");
// checkQywxSettingApiService.saveFriendCallback("ca66a01b79474c40b3e7c7f93daf1a3b", null, dto);
// wxEnterpriseRelatedApiService.flushBindStoreByEnterpriseId("ff808081593917d90159398ec6340012",
// "ca66a01b79474c40b3e7c7f93daf1a3b", "-1", ChannelCodeEnum.SYNC_UNBIND.getCode());
// List<String> ids = new ArrayList<>();
// ids.add("8f5ddb9df0a54332acfa2d5804e90c64");
...
...
@@ -82,14 +95,13 @@ public class ServiceTest {
// System.out.println(JSONObject.toJSONString(response));
}
@Test
public
void
test
()
{
public
void
sendMessage
()
{
List
<
String
>
staffIds
=
new
ArrayList
<>();
staffIds
.
add
(
"0006ae5de6484cf9b55072d2d967c481"
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"haoban3OrderBackForFaceMq"
,
"11111"
);
clientInstance
.
sendMessage
(
"haoban3OrderBackForFaceMq"
,
"11111"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -107,6 +119,15 @@ public class ServiceTest {
}
@Test
public
void
test
()
{
BasePageInfo
basePageInfo
=
new
BasePageInfo
();
Page
<
MaterialDTO
>
ret
=
materialApiService
.
listMaterial
(
"ca66a01b79474c40b3e7c7f93daf1a3b"
,
null
,
"-1"
,
1
,
basePageInfo
);
System
.
out
.
println
(
ret
);
}
//// @Test
//// public void test1() {
//// String res = qywxUserApiService.leaveClerkExternal("ww9ede832a84b7ae5f"
...
...
haoban-manage3-service/src/test/java/test.java
View file @
adf7e102
...
...
@@ -7,10 +7,15 @@ import org.apache.commons.lang3.StringUtils;
public
class
test
{
public
static
void
main
(
String
[]
args
)
{
String
key
=
"3.2.1"
;
String
[]
split
=
key
.
split
(
"."
);
// String key = "3.2.1";
// String[] split = key.split(".");
//
// System.out.println(split[1]);
System
.
out
.
println
(
split
[
1
]);
Integer
num
=
2
;
int
i
=
2
&
4
;
System
.
out
.
println
(
i
);
//
// //插入不存在的我们pre表的企业微信数据
// int pageSize = 500;
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/GicDepartmentController.java
View file @
adf7e102
...
...
@@ -51,6 +51,7 @@ public class GicDepartmentController extends WebBaseController{
Map
<
String
,
StoreRangeInfoDTO
>
storeRangeMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
rangeInfoDTOList
))
{
List
<
WxEnterpriseDTO
>
wxEnterpriseDTOS
=
wxEnterpriseRelatedApiService
.
listWxEnterpriseByEid
(
enterpriseId
);
if
(
CollectionUtils
.
isNotEmpty
(
wxEnterpriseDTOS
))
{
Map
<
String
,
WxEnterpriseDTO
>
wxEnterpriseDTOMap
=
wxEnterpriseDTOS
.
stream
().
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getWxEnterpriseId
(),
dto
->
dto
));
storeRangeMap
=
rangeInfoDTOList
.
stream
().
filter
(
dto
->
(!
dto
.
getWxEnterpriseId
().
equals
(
wxEnterpriseId
))
&&
dto
.
getRelationType
()
==
1
)
...
...
@@ -59,6 +60,7 @@ public class GicDepartmentController extends WebBaseController{
return
dto
;
}).
collect
(
Collectors
.
toMap
(
dto
->
dto
.
getRelationId
(),
dto
->
dto
));
}
}
Map
<
String
,
StoreRangeInfoDTO
>
finalStoreRangeMap
=
storeRangeMap
;
List
<
StoreGroupVo
>
ret
=
departmentList
.
stream
().
map
(
dto
->
{
StoreRangeInfoDTO
mid
=
finalStoreRangeMap
.
get
(
dto
.
getStoreGroupId
());
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
adf7e102
...
...
@@ -84,6 +84,9 @@ public class StaffController extends WebBaseController{
@Autowired
private
EnterpriseService
enterpriseService
;
@Autowired
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
@RequestMapping
(
"staff-add"
)
public
HaobanResponse
staffAdd
(
StaffDTO
staffDTO
,
String
departmentIds
){
...
...
@@ -293,6 +296,19 @@ public class StaffController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_10007
);
}
List
<
StaffClerkInfoDTO
>
retList
=
staffClerkRelationApiService
.
listBindDetailByStaffId
(
staffId
);
if
(
CollectionUtils
.
isEmpty
(
retList
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
ClerkMainStoreRelatedDTO
mainStoreRelatedDTO
=
clerkMainStoreRelatedApiService
.
getWxEnterpriseIdAndStaffId
(
staff
.
getWxEnterpriseId
(),
staffId
);
if
(
null
!=
mainStoreRelatedDTO
)
{
retList
.
forEach
(
dto
->
{
if
(
dto
.
getStoreId
().
equals
(
mainStoreRelatedDTO
.
getStoreId
()))
{
dto
.
setMainStoreFlag
(
1
);
}
else
{
dto
.
setMainStoreFlag
(
0
);
}
});
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
retList
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
adf7e102
...
...
@@ -838,4 +838,24 @@ public class WxEnterpriseController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 授权绑定-设置导购编辑权限
*
* @return
*/
@IgnoreLogin
@RequestMapping
(
"set-clerk-edit"
)
public
HaobanResponse
setClerkEdit
(
String
wxEnterprieseRelatedId
,
int
clerkEditFlag
)
{
if
(
StringUtils
.
isBlank
(
wxEnterprieseRelatedId
))
{
logger
.
info
(
"缺少参数"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
boolean
b
=
wxEnterpriseRelatedApiService
.
setClerkEditFlag
(
wxEnterprieseRelatedId
,
clerkEditFlag
);
if
(
b
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_100032
);
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
adf7e102
...
...
@@ -117,6 +117,7 @@ public enum HaoBanErrCode {
ERR_100021
(
100021
,
"创建任务失败"
),
ERR_100031
(
100031
,
"该小程序已经绑定过,不能重复绑定"
),
ERR_100032
(
100032
,
"代理不能设置导购编辑权限"
),
ERR_DEFINE
(-
888
,
"自定义错误"
),
ERR_OTHER
(-
999
,
"未知错误code"
);
...
...
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
adf7e102
...
...
@@ -24,6 +24,8 @@
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
id=
"wxEnterpriseRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.ApplicationApiService"
id=
"applicationApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseApiService"
id=
"wxEnterpriseApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService"
id=
"clerkMainStoreRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.EnterpriseService"
id=
"enterpriseService"
/>
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
adf7e102
...
...
@@ -113,7 +113,7 @@ public class ClerkController extends WebBaseController{
//门店成员列表
@RequestMapping
(
"/store-clerks"
)
public
HaobanResponse
storeClerks
(
String
storeId
)
{
public
HaobanResponse
storeClerks
(
String
wxEnterpriseId
,
String
storeId
,
String
version
)
{
if
(
StringUtils
.
isAnyBlank
(
storeId
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
...
...
@@ -143,9 +143,19 @@ public class ClerkController extends WebBaseController{
}
resultList
.
add
(
vo
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultList
);
if
(
StringUtils
.
isBlank
(
version
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultList
);
}
else
{
WxEnterpriseRelationDetailDTO
enterpriseBindInfo
=
wxEnterpriseRelatedApiService
.
getEnterpriseBindInfo
(
wxEnterpriseId
,
storeDTO
.
getEnterpriseId
());
Map
<
String
,
Object
>
ret
=
new
HashMap
<>();
ret
.
put
(
"clerkEditFlag"
,
enterpriseBindInfo
.
getClerkEditFlag
());
ret
.
put
(
"clerkList"
,
resultList
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
ret
);
}
}
//获取后台认证配置
@RequestMapping
(
"/get-audit-setting"
)
public
HaobanResponse
getAuditSetting
(
String
wxEnterpriseId
)
{
...
...
@@ -186,7 +196,7 @@ public class ClerkController extends WebBaseController{
}
auditSettingVO
.
setMemberOpenCardFlag
(
enterpriseBindInfo
.
getMemberOpenCardFlag
());
auditSettingVO
.
setWxEnterpriseType
(
enterpriseBindInfo
.
getWxEnterpriseType
());
auditSettingVO
.
setFreshFriendFlag
(
mainStore
.
getFreshFriendFlag
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
auditSettingVO
);
}
...
...
@@ -399,6 +409,33 @@ public class ClerkController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 删除设置主门店和刷新微信好友的缓存限制
*
* @param staffId : 关联标识
* @param dateTime : 时间, 13位时间戳
* @param type : 类型, 1 : 主门店, 2 : 刷新微信好友
*/
@RequestMapping
(
"/delCache"
)
public
void
deleteCache
(
String
staffId
,
Long
dateTime
,
Integer
type
)
{
if
(
StringUtils
.
isBlank
(
staffId
)
||
dateTime
==
null
||
type
==
null
)
{
return
;
}
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(
dateTime
),
"yyyyMM"
);
String
key
=
null
;
//设置主门店缓存
if
(
Objects
.
equals
(
type
,
1
))
{
key
=
"haoban_set_main_store_"
+
yyyyMM
+
staffId
;
}
if
(
Objects
.
equals
(
type
,
2
))
{
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
}
if
(
StringUtils
.
isBlank
(
key
))
{
return
;
}
RedisUtil
.
delCache
(
key
);
}
//设置主导购
@HttpLimit
...
...
@@ -435,8 +472,6 @@ public class ClerkController extends WebBaseController{
logger
.
info
(
"次数超出限制:{}"
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
}
RedisUtil
.
setCache
(
key
,
count
+
1
,
31
*
24
*
60
*
60L
);
if
(
flushType
==
0
)
{
String
taskName
=
"刷新企业微信好友("
+
staff
.
getStaffName
()+
")"
;
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_SINGLE
.
getType
());
...
...
@@ -454,9 +489,27 @@ public class ClerkController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_10022
);
}
}
RedisUtil
.
setCache
(
key
,
count
+
1
,
31
*
24
*
60
*
60L
);
//刷新状态变更
clerkMainStoreRelatedApiService
.
setFreshFriend
(
wxEnterpriseId
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 刷新好友状态
*
* @param staffId
* @param storeId
* @param wxEnterpriseId
* @return
*/
@HttpLimit
@RequestMapping
(
"/check-fresh-friend"
)
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
boolean
freshFriendSyncTask
=
dealSyncOperationApiService
.
getFreshFriendSyncTask
(
wxEnterpriseId
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
freshFriendSyncTask
);
}
//获取门店详情
public
boolean
isEnterpriseOver
(
String
eid
)
{
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/vo/AuditSettingVO.java
View file @
adf7e102
...
...
@@ -20,9 +20,18 @@ public class AuditSettingVO implements Serializable {
private
int
wxEnterpriseType
;
private
int
memberOpenCardFlag
;
private
int
freshFriendFlag
;
private
static
final
long
serialVersionUID
=
1L
;
public
int
getFreshFriendFlag
()
{
return
freshFriendFlag
;
}
public
void
setFreshFriendFlag
(
int
freshFriendFlag
)
{
this
.
freshFriendFlag
=
freshFriendFlag
;
}
public
int
getWxEnterpriseType
()
{
return
wxEnterpriseType
;
}
...
...
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