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
1
Merge Requests
1
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
6a6af4e7
Commit
6a6af4e7
authored
Jul 19, 2022
by
guojx
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
e613fe9d
0e09cd93
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
169 additions
and
80 deletions
+169
-80
HmLinkWxaDTO.java
...n/java/com/gic/haoban/manage/api/dto/hm/HmLinkWxaDTO.java
+9
-0
HmQrcodeApiService.java
.../gic/haoban/manage/api/service/hm/HmQrcodeApiService.java
+20
-0
TabHaobanHmQrcodeMapper.java
...manage/service/dao/mapper/hm/TabHaobanHmQrcodeMapper.java
+2
-0
HmQrcodeService.java
...gic/haoban/manage/service/service/hm/HmQrcodeService.java
+2
-0
HmQrcodeServiceImpl.java
...n/manage/service/service/hm/impl/HmQrcodeServiceImpl.java
+5
-0
HmQrcodeTempServiceImpl.java
...nage/service/service/hm/impl/HmQrcodeTempServiceImpl.java
+4
-2
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+0
-4
HmLinkApiServiceImpl.java
...age/service/service/out/impl/hm/HmLinkApiServiceImpl.java
+24
-9
HmQrcodeApiServiceImpl.java
...e/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
+68
-13
QywxStaffSyncOperation.java
...ic/haoban/manage/service/task/QywxStaffSyncOperation.java
+0
-33
TabHaobanHmClerkRelationMapper.xml
...in/resources/mapper/hm/TabHaobanHmClerkRelationMapper.xml
+4
-4
TabHaobanHmQrcodeMapper.xml
.../src/main/resources/mapper/hm/TabHaobanHmQrcodeMapper.xml
+9
-5
ServiceTest.java
haoban-manage3-service/src/test/java/ServiceTest.java
+5
-0
TestController.java
.../com/gic/haoban/manage/web/controller/TestController.java
+10
-5
HmQrcodeController.java
...c/haoban/manage/web/controller/hm/HmQrcodeController.java
+4
-1
HmQrcodeListQO.java
.../com/gic/haoban/manage/web/qo/hm/data/HmQrcodeListQO.java
+3
-4
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/hm/HmLinkWxaDTO.java
View file @
6a6af4e7
...
...
@@ -17,6 +17,7 @@ public class HmLinkWxaDTO implements Serializable {
private
static
final
long
serialVersionUID
=
6473795387449522116L
;
private
Long
pageId
;
private
HmPageDTO
page
;
// 二维码
private
String
hmQrcode
;
...
...
@@ -29,6 +30,14 @@ public class HmLinkWxaDTO implements Serializable {
private
List
<
HmLinkStoreDTO
>
storeList
;
// 说明
private
String
sm
;
public
HmPageDTO
getPage
()
{
return
page
;
}
public
void
setPage
(
HmPageDTO
page
)
{
this
.
page
=
page
;
}
public
Long
getPageId
()
{
return
pageId
;
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/hm/HmQrcodeApiService.java
View file @
6a6af4e7
...
...
@@ -122,6 +122,15 @@ public interface HmQrcodeApiService {
*/
void
checkStaffOpenContact
(
String
param
);
/**
* 检查员工开启联系我
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-07-19 15:53:37
*/
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
);
/**
* 活码门店ids
...
...
@@ -132,6 +141,17 @@ public interface HmQrcodeApiService {
* @date 2022-07-08 15:07:15
*/
List
<
HmQrcodeStoreDTO
>
getHmStoreByEnterpriseId
(
String
enterpriseId
);
/**
*
* @Title: getHmStoreForWxa
* @Description: 返回小程序有活码的门店列表
* @author xugh
* @param enterpriseId
* @return
* @throws
*/
List
<
String
>
getHmStoreForWxa
(
String
enterpriseId
)
;
/**
* 根据导购信息获取hmid
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/hm/TabHaobanHmQrcodeMapper.java
View file @
6a6af4e7
...
...
@@ -202,5 +202,7 @@ public interface TabHaobanHmQrcodeMapper {
int
getCanAddCount
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"storeIdList"
)
List
<
String
>
storeIdList
)
;
List
<
HmQrcodeClerkBO
>
listCanAddClerk
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"storeIdList"
)
List
<
String
>
storeIdList
);
List
<
String
>
getHmStoreForWxa
(
@Param
(
"enterpriseId"
)
String
enterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/hm/HmQrcodeService.java
View file @
6a6af4e7
...
...
@@ -180,4 +180,6 @@ public interface HmQrcodeService {
List
<
HmQrcodeClerkBO
>
listCanAddClerk
(
String
wxEnterpriseId
,
String
enterpriseId
,
String
clerkId
)
;
List
<
String
>
getHmStoreForWxa
(
String
enterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/hm/impl/HmQrcodeServiceImpl.java
View file @
6a6af4e7
...
...
@@ -169,5 +169,10 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
authStoreIdList
);
return
list
;
}
@Override
public
List
<
String
>
getHmStoreForWxa
(
String
enterpriseId
)
{
return
tabHaobanHmQrcodeMapper
.
getHmStoreForWxa
(
enterpriseId
)
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/hm/impl/HmQrcodeTempServiceImpl.java
View file @
6a6af4e7
...
...
@@ -53,7 +53,7 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
public
void
deleteForTimer
()
{
log
.
info
(
"删除临时活码定时开始"
);
List
<
TabHmQrcodeTemp
>
list
=
this
.
hmQrcodeTempMapper
.
listAll
();
if
(
CollectionUtils
.
isEmpty
(
list
))
{
if
(
CollectionUtils
.
is
Not
Empty
(
list
))
{
for
(
TabHmQrcodeTemp
item
:
list
)
{
this
.
del
(
item
);
}
...
...
@@ -67,7 +67,9 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
String
configId
=
item
.
getWxConfigId
();
QywxResponseDTO
resp
=
this
.
qywxUserApiService
.
delContactWay
(
corpid
,
suiteId
,
configId
);
log
.
info
(
"删除临时活码={}{},返回={}"
,
configId
,
corpid
,
JSON
.
toJSONString
(
resp
));
this
.
hmQrcodeTempMapper
.
deleteByPrimaryKey
(
item
.
getId
());
if
(
resp
.
getErrcode
()==
0
)
{
this
.
hmQrcodeTempMapper
.
deleteByPrimaryKey
(
item
.
getId
());
}
}
catch
(
Exception
e
)
{
log
.
info
(
"删除临时活码异常={}"
,
e
);
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
6a6af4e7
...
...
@@ -362,10 +362,6 @@ public class StaffApiServiceImpl implements StaffApiService {
String
openUserid
=
getOpenUserid
(
userId
,
corpid
);
if
(
StringUtils
.
isNotBlank
(
openUserid
))
{
staff
.
setWxOpenUseId
(
openUserid
);
String
userid
=
getUserid
(
openUserid
,
wxEnterpriseId
);
if
(
StringUtils
.
isNotBlank
(
userid
))
{
staff
.
setWxUserId
(
userid
);
}
}
//成员更改或更新
if
(
StringUtils
.
isBlank
(
staff
.
getStaffId
()))
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmLinkApiServiceImpl.java
View file @
6a6af4e7
...
...
@@ -30,6 +30,7 @@ import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmLinkWxaDTO
;
import
com.gic.haoban.manage.api.dto.hm.HmPageDTO
;
import
com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO
;
import
com.gic.haoban.manage.api.service.hm.HmLinkApiService
;
import
com.gic.haoban.manage.service.config.Config
;
...
...
@@ -37,6 +38,7 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMap
import
com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated
;
import
com.gic.haoban.manage.service.errorcode.HaoBanErrCode
;
import
com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO
;
import
com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO
;
import
com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO
;
import
com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO
;
import
com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO
;
...
...
@@ -45,6 +47,7 @@ import com.gic.haoban.manage.service.service.MemberQueryService;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.hm.HmLinkService
;
import
com.gic.haoban.manage.service.service.hm.HmLinkStoreService
;
import
com.gic.haoban.manage.service.service.hm.HmPageService
;
import
com.gic.haoban.manage.service.service.hm.HmQrcodeService
;
import
com.gic.haoban.manage.service.service.hm.HmQrcodeTempService
;
import
com.gic.member.api.dto.MemberClerkDTO
;
...
...
@@ -88,6 +91,8 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
private
TabHaobanExternalClerkRelatedMapper
tabHaobanExternalClerkRelatedMapper
;
@Autowired
private
MemberClerkApiService
memberClerkApiService
;
@Autowired
private
HmPageService
hmPageService
;
@Override
public
ServiceResponse
<
String
>
getHmLinkUrl
()
{
...
...
@@ -153,6 +158,13 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
log
.
error
(
"链接记录不存,linkShortCode={}"
,
linkShortCode
);
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"链接记录不存"
);
}
// 查询页面
retDTO
.
setPageId
(
link
.
getPageId
());
// 查询页面
HmPageBO
page
=
this
.
hmPageService
.
queryHmPageDetail
(
link
.
getPageId
());
if
(
null
!=
page
)
{
retDTO
.
setPage
(
EntityUtil
.
changeEntityByJSON
(
HmPageDTO
.
class
,
page
));
}
Long
linkId
=
link
.
getLinkId
();
String
wxEnterpriseId
=
link
.
getWxEnterpriseId
();
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
...
...
@@ -240,9 +252,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if
(
null
==
hm
&&
StringUtils
.
isNotBlank
(
mainStoreId
))
{
hm
=
this
.
getHmFormStore
(
wxEnterpriseId
,
mainStoreId
,
fwStore
.
getDz
(),
fwStore
.
getDy
());
}
}
if
(
null
!=
hm
)
{
retDTO
.
setSm
(
"会员主门店活码"
);
if
(
null
!=
hm
)
{
retDTO
.
setSm
(
"会员主门店活码"
);
}
}
// 协管门店
List
<
MemberStoreClerkDataDTO
>
list
=
member
.
getStoreClerkRel
();
...
...
@@ -281,9 +293,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
}
}
}
}
if
(
null
!=
hm
)
{
retDTO
.
setSm
(
"会员协管活码"
);
if
(
null
!=
hm
)
{
retDTO
.
setSm
(
"会员协管活码"
);
}
}
}
}
...
...
@@ -310,7 +322,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
}
}
if
(
null
!=
hm
)
{
log
.
info
(
"获取
的
单人活码={}"
,
JSON
.
toJSONString
(
hm
));
log
.
info
(
"获取
到
单人活码={}"
,
JSON
.
toJSONString
(
hm
));
// 判断是否已经是好友
boolean
isFriend
=
false
;
if
(
null
!=
memberId
)
{
...
...
@@ -321,6 +333,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
isFriend
=
true
;
log
.
info
(
"已经是好友,staffid={},memberId={}"
,
staffId
,
memberId
);
retDTO
.
setHmQrcode
(
hm
.
getWxQrcode
());
retDTO
.
setSm
(
"老好友,取单人活码"
);
}
}
...
...
@@ -333,14 +346,16 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if
(
null
!=
dthmKey
)
{
ServiceResponse
<
String
>
addResp
=
this
.
addQrcode
(
hm
,
dthmKey
,
wxEnterpriseDTO
.
getCorpid
(),
retDTO
);
if
(!
addResp
.
isSuccess
())
{
retDTO
.
setSm
(
"创建动态活码失败,取单人活码"
);
if
(
StringUtils
.
isBlank
(
hm
.
getWxQrcode
()))
{
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"导购活码不存在"
);
}
retDTO
.
setHmQrcode
(
hm
.
getWxQrcode
());
}
else
{
retDTO
.
setHmQrcode
(
addResp
.
getResult
());
}
}
}
// 查询页面
retDTO
.
setPageId
(
link
.
getPageId
());
}
// 生成动态活码
log
.
info
(
JSON
.
toJSONString
(
retDTO
,
true
));
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
View file @
6a6af4e7
...
...
@@ -60,7 +60,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -231,6 +230,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
Long
hmId
=
hmQrcodeQDTO
.
getHmId
();
HmQrcodeBO
hmQrcodeBO
=
hmQrcodeService
.
queryById
(
hmId
);
if
(
hmQrcodeBO
==
null
)
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"该活码不存在"
);
}
Integer
hmType
=
hmQrcodeQDTO
.
getHmType
();
List
<
String
>
clerkIdList
=
setStoreClerk
(
hmQrcodeQDTO
,
wxEnterpriseId
,
hmId
,
hmType
);
if
(
CollectionUtils
.
isEmpty
(
clerkIdList
))
{
...
...
@@ -239,10 +242,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//更新活码
QywxExternalcontactDTO
qywxExternalcontactDTO
=
new
QywxExternalcontactDTO
();
qywxExternalcontactDTO
.
setType
(
hmQrcodeQDTO
.
getHmType
());
qywxExternalcontactDTO
.
setScene
(
2
);
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
qywxExternalcontactDTO
.
setConfigId
(
hmQrcodeBO
.
getWxConfigId
());
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
...
...
@@ -505,14 +508,13 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"活码不存在"
);
}
String
wxConfigId
=
hmQrcodeBO
.
getWxConfigId
();
if
(
StringUtils
.
isBlank
(
wxConfigId
))
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"活码未生成"
);
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
hmQrcodeBO
.
getWxEnterpriseId
());
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
int
errcode
=
qywxResponseDTO
.
getErrcode
();
if
(
errcode
!=
0
)
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
if
(
StringUtils
.
isNotBlank
(
wxConfigId
))
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
hmQrcodeBO
.
getWxEnterpriseId
());
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
int
errcode
=
qywxResponseDTO
.
getErrcode
();
if
(
errcode
!=
0
)
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
qywxResponseDTO
.
getErrmsg
());
}
}
hmQrcodeService
.
deleteById
(
hmId
);
setLoggerContext
(
hmQrcodeBO
.
getEnterpriseId
(),
hmQrcodeBO
.
getWxEnterpriseId
(),
hmQrcodeBO
.
getModifierId
(),
hmQrcodeBO
.
getModifierName
());
...
...
@@ -597,9 +599,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//查询出所有正常的导购
String
wxEnterpriseId
=
tabHaobanWxEnterpris
.
getWxEnterpriseId
();
//企微已经开启联系我
String
wxUserIds
=
qywxUserApiService
.
listCorpExternalUser
(
tabHaobanWxEnterpris
.
getCorpid
(),
config
.
getWxSuiteid
());
String
[]
split
=
wxUserIds
.
split
(
","
);
List
<
String
>
wxUserIdsList
=
Arrays
.
asList
(
split
);
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
tabHaobanWxEnterpris
.
getCorpid
(),
config
.
getWxSuiteid
());
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
logger
.
error
(
"无导购关联数据"
);
...
...
@@ -640,6 +640,49 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
@Override
public
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
//查询出所有正常的导购
//企微已经开启联系我
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
());
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
logger
.
error
(
"无导购关联数据"
);
return
;
}
for
(
StaffClerkRelationDTO
staffClerkRelationDTO
:
staffClerkRelationDTOS
)
{
//具有联系我功能的导购创建活码
staffClerkRelationService
.
updateOpenConcatFlagById
(
1
,
staffClerkRelationDTO
.
getStaffClerkRelationId
());
//创建活码
HmQrcodeQDTO
hmQrcodeQDTO
=
new
HmQrcodeQDTO
();
hmQrcodeQDTO
.
setHmType
(
1
);
hmQrcodeQDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
hmQrcodeQDTO
.
setEnterpriseId
(
staffClerkRelationDTO
.
getEnterpriseId
());
hmQrcodeQDTO
.
setName
(
staffClerkRelationDTO
.
getStaffName
());
hmQrcodeQDTO
.
setPassFlag
(
1
);
hmQrcodeQDTO
.
setStoreId
(
staffClerkRelationDTO
.
getStoreId
());
hmQrcodeQDTO
.
setClerkIdList
(
Collections
.
singletonList
(
staffClerkRelationDTO
.
getClerkId
()));
add
(
hmQrcodeQDTO
);
}
List
<
StaffClerkRelationDTO
>
relationDTOS
=
staffClerkRelationService
.
listIdsByNotInWxOpenUserIds
(
wxUserIdsList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
relationDTOS
))
{
logger
.
error
(
"无导购不包含关联数据"
);
return
;
}
for
(
StaffClerkRelationDTO
relationDTO
:
relationDTOS
)
{
//有活码,但是企微联系我功能 被关闭
String
clerkId
=
relationDTO
.
getClerkId
();
HmQrcodeBO
hmQrcodeBO
=
hmQrcodeService
.
queryByClerkId
(
clerkId
,
relationDTO
.
getWxEnterpriseId
());
if
(
hmQrcodeBO
==
null
)
{
logger
.
info
(
"导购无活码,无需处理:clerkId:{}"
,
clerkId
);
continue
;
}
hmQrcodeService
.
updateStatusById
(
hmQrcodeBO
.
getHmId
(),
3
);
}
}
@Override
public
List
<
HmQrcodeStoreDTO
>
getHmStoreByEnterpriseId
(
String
enterpriseId
)
{
String
key
=
"HM:STORE:"
+
enterpriseId
;
Object
cache
=
RedisUtil
.
getCache
(
key
);
...
...
@@ -650,6 +693,18 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
RedisUtil
.
setCache
(
key
,
hmQrcodeStoreDTOS
,
10L
,
TimeUnit
.
MINUTES
);
return
hmQrcodeStoreDTOS
;
}
@Override
public
List
<
String
>
getHmStoreForWxa
(
String
enterpriseId
)
{
String
key
=
"HM:STORE:WXA"
+
enterpriseId
;
Object
cache
=
RedisUtil
.
getCache
(
key
);
if
(
cache
!=
null
)
{
return
(
List
<
String
>)
cache
;
}
List
<
String
>
list
=
hmQrcodeService
.
getHmStoreForWxa
(
enterpriseId
);
RedisUtil
.
setCache
(
key
,
list
,
10L
,
TimeUnit
.
MINUTES
);
return
list
;
}
@Override
public
Page
<
HmClerkRelationDTO
>
getHmClerkByHmId
(
BasePageInfo
basePageInfo
,
Long
hmId
)
{
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/QywxStaffSyncOperation.java
View file @
6a6af4e7
...
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.DealParamMqDTO
;
import
com.gic.haoban.manage.api.dto.SecretSettingDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.enums.PreDealStatusEnum
;
...
...
@@ -17,7 +16,6 @@ import com.gic.haoban.manage.service.config.Config;
import
com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncTask
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxApplication
;
import
com.gic.haoban.manage.service.service.PreDealService
;
import
com.gic.haoban.manage.service.service.SecretSettingService
;
import
com.gic.haoban.manage.service.service.SyncTaskService
;
...
...
@@ -165,37 +163,6 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
}
}
}
Integer
useridFlag
=
wxEnterpriseDTO
.
getUseridFlag
();
logger
.
info
(
"同步通讯录完成,批量处理wx_user_id,corpid:{},useridFlag:{}"
,
corpid
,
useridFlag
);
if
(
corpid
.
length
()
<
20
&&
useridFlag
==
1
)
{
// 限流器
RRateLimiter
rateLimiter
=
RedisUtil
.
getRedisClient
().
getRateLimiter
(
"haoban:manage3:updateWxUserId:limit"
);
// 每1秒产生5个令牌
rateLimiter
.
trySetRate
(
RateType
.
OVERALL
,
5
,
1
,
RateIntervalUnit
.
SECONDS
);
TabHaobanWxApplication
tabHaobanWxApplication
=
wxApplicationMapper
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
3
);
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
5
);
int
pageNum
=
1
;
while
(
true
)
{
// 获取令牌
rateLimiter
.
acquire
();
//企微转换最多支持1000个
//批量处理wx_user_id to wx_open_user_id
Page
<
StaffDTO
>
staffDTOPageInfo
=
staffApiService
.
listUserIdByWxEnterpriseId
(
wxEnterpriseId
,
pageNum
,
1000
);
List
<
StaffDTO
>
staffDTOS
=
staffDTOPageInfo
.
getResult
();
if
(
CollectionUtils
.
isEmpty
(
staffDTOS
))
{
logger
.
info
(
"openuseridToUserid 转换完成,为最后一个"
);
break
;
}
pageNum
++;
logger
.
info
(
"openuseridToUserid 请求:corpid:{}"
,
corpid
);
List
<
QywxNewUseridDTO
>
qywxNewUseridDTOS
=
qywxUserApiService
.
getSelfOpenuseridToUserid
(
tabHaobanWxApplication
.
getCorpid
(),
secretSetting
.
getSecretVal
(),
tabHaobanWxApplication
.
getAgentId
(),
staffDTOS
.
stream
().
map
(
StaffDTO:
:
getWxUserId
).
collect
(
Collectors
.
toList
()));
if
(
CollectionUtils
.
isNotEmpty
(
qywxNewUseridDTOS
))
{
for
(
QywxNewUseridDTO
qywxNewUseridDTO
:
qywxNewUseridDTOS
)
{
staffApiService
.
updateWxUserIdsByWxOpenUserId
(
wxEnterpriseId
,
qywxNewUseridDTO
.
getOpen_userid
(),
qywxNewUseridDTO
.
getUserid
());
}
}
}
}
}
}
RedisUtil
.
unlock
(
key
);
...
...
haoban-manage3-service/src/main/resources/mapper/hm/TabHaobanHmClerkRelationMapper.xml
View file @
6a6af4e7
...
...
@@ -38,19 +38,19 @@
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"relationId"
useGeneratedKeys=
"true"
>
insert into tab_haoban_hm_clerk_relation(hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
insert into tab_haoban_hm_clerk_relation(
relation_id,
hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
store_name, store_code, clerk_id, clerk_name, clerk_code, status,
create_time, update_time, over_flag, add_num,staff_id,staff_name)
values (#{hmId}, #{wxUserId}, #{wxEnterpriseId}, #{enterpriseId}, #{storeId}, #{storeName}, #{storeCode},
values (#{
relationId},#{
hmId}, #{wxUserId}, #{wxEnterpriseId}, #{enterpriseId}, #{storeId}, #{storeName}, #{storeCode},
#{clerkId}, #{clerkName}, #{clerkCode}, #{status}, #{createTime}, #{updateTime}, #{overFlag}, #{addNum},#{staffId},#{staffName})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"relationId"
useGeneratedKeys=
"true"
>
insert into tab_haoban_hm_clerk_relation(hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
insert into tab_haoban_hm_clerk_relation(
relation_id,
hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
store_name, store_code, clerk_id, clerk_name, clerk_code, status, create_time, update_time, over_flag,add_num,staff_id,staff_name)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.hmId}, #{entity.wxUserId}, #{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.storeId},
(#{entity.
relationId},#{entity.
hmId}, #{entity.wxUserId}, #{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.storeId},
#{entity.storeName}, #{entity.storeCode}, #{entity.clerkId}, #{entity.clerkName}, #{entity.clerkCode},
#{entity.status}, #{entity.createTime}, #{entity.updateTime}, #{entity.overFlag},#{entity.addNum},
#{entity.staffId},#{entity.staffName})
...
...
haoban-manage3-service/src/main/resources/mapper/hm/TabHaobanHmQrcodeMapper.xml
View file @
6a6af4e7
...
...
@@ -313,15 +313,19 @@
<select
id=
"getHmStoreByEnterpriseId"
resultMap=
"TabHaobanHmQrcodeMap"
>
select store_id storeId,
store_name storeName,
store_code storeCode,
enterprise_id enterpriseId,
MIN(over_flag) overFlag
from tab_haoban_hm_qrcode
where
status_flag in (1, 3)
and
enterprise_id = #{enterpriseId}
where
enterprise_id = #{enterpriseId} and status_flag = 1
and
store_id is not null
GROUP BY store_id
</select>
<select
id=
"getHmStoreForWxa"
resultType=
"String"
>
select distinct(store_id)
from tab_haoban_hm_qrcode
where enterprise_id = #{enterpriseId} and status_flag = 1 and over_flag = 0 and store_id is not null
</select>
<select
id=
"getGroupIdNumByEnterpriseId"
resultType=
"com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO"
>
select hm_group_id as hmGroupId,
...
...
haoban-manage3-service/src/test/java/ServiceTest.java
View file @
6a6af4e7
...
...
@@ -51,4 +51,9 @@ public class ServiceTest {
}
@Test
public
void
test2
()
{
hmQrcodeApiService
.
checkStaffOpenContactByWxEnterpriseId
(
"5bd929fd3b2c49deaa1184bcb0d669b3"
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/TestController.java
View file @
6a6af4e7
...
...
@@ -7,6 +7,7 @@ import com.gic.haoban.common.utils.EntityUtil;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.api.service.hm.HmQrcodeApiService
;
import
com.gic.haoban.manage.web.config.Config
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo
;
...
...
@@ -61,17 +62,12 @@ public class TestController extends WebBaseController {
private
TestApiService
testApiService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
MaidianLogApiService
maidianLogApiService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
ExternalClerkRelatedApiService
externalClerkRelatedApiService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
QywxUserApiService
qywxUserApiService
;
...
...
@@ -81,6 +77,8 @@ public class TestController extends WebBaseController {
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
private
Config
config
;
@Autowired
private
HmQrcodeApiService
hmQrcodeApiService
;
@RequestMapping
(
"/send-message-test"
)
public
HaobanResponse
testSendMessage
(
QywxXcxSendMessageQo
qo
)
{
...
...
@@ -321,4 +319,11 @@ public class TestController extends WebBaseController {
List
<
QywxNewUseridDTO
>
list
=
qywxUserApiService
.
getSelfUseridToOpenuserid
(
corpid
,
secret
,
Arrays
.
asList
(
split
));
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
list
);
}
@RequestMapping
(
"/checkStaffOpenContactByWxEnterpriseId"
)
public
HaobanResponse
checkStaffOpenContact
(
String
wxEnterpriseId
)
{
hmQrcodeApiService
.
checkStaffOpenContactByWxEnterpriseId
(
wxEnterpriseId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmQrcodeController.java
View file @
6a6af4e7
...
...
@@ -126,8 +126,11 @@ public class HmQrcodeController {
if
(
CollectionUtils
.
isEmpty
(
storeList
))
{
return
RestResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCode
.
ERR_100007
.
getCode
()),
HaoBanErrCode
.
ERR_100007
.
getMsg
());
}
if
(!
storeList
.
contains
(
"-1"
))
{
hmQrcodeListQO
.
getInFields
().
setStoreId
(
storeList
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
storeList
.
forEach
(
c
->
stringBuffer
.
append
(
c
).
append
(
","
));
hmQrcodeListQO
.
getInFields
().
setStoreId
(
stringBuffer
.
toString
());
}
StatisticsDTO
statisticsDTO
=
DataHttpUtil
.
post
(
StatisticsApolloKeyConstant
.
data_haoban_hm_list
,
hmQrcodeListQO
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/qo/hm/data/HmQrcodeListQO.java
View file @
6a6af4e7
...
...
@@ -2,7 +2,6 @@ package com.gic.haoban.manage.web.qo.hm.data;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 活码(TabHaobanHmQrcode)实体类
...
...
@@ -76,7 +75,7 @@ public class HmQrcodeListQO implements Serializable {
*/
private
Long
hmGroupId
;
private
List
<
String
>
storeId
;
private
String
storeId
;
public
Long
getHmId
()
{
return
hmId
;
...
...
@@ -174,11 +173,11 @@ public class HmQrcodeListQO implements Serializable {
this
.
hmGroupId
=
hmGroupId
;
}
public
List
<
String
>
getStoreId
()
{
public
String
getStoreId
()
{
return
storeId
;
}
public
void
setStoreId
(
List
<
String
>
storeId
)
{
public
void
setStoreId
(
String
storeId
)
{
this
.
storeId
=
storeId
;
}
}
...
...
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