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
1b4fc3d0
Commit
1b4fc3d0
authored
Aug 19, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:创建活码定时任务改为消息队列
parent
133a4d52
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
59 deletions
+35
-59
HmQrcodeApiService.java
.../gic/haoban/manage/api/service/hm/HmQrcodeApiService.java
+5
-4
HmQrcodeApiServiceImpl.java
...e/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
+25
-47
ServiceTest.java
haoban-manage3-service/src/test/java/ServiceTest.java
+0
-7
TestController.java
.../com/gic/haoban/manage/web/controller/TestController.java
+5
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/hm/HmQrcodeApiService.java
View file @
1b4fc3d0
...
@@ -124,13 +124,14 @@ public interface HmQrcodeApiService {
...
@@ -124,13 +124,14 @@ public interface HmQrcodeApiService {
/**
/**
* 检查员工开启联系我
* 检查员工开启联系我
* <p>
* "routerName": "checkStaffOpenContactByWxEnterpriseIdMq"
*
*
* @param wxEnterpriseId wx企业标识
* @param param 参数
* @param enterpriseId 企业标识
* @author mozhu
* @author mozhu
* @date 2022-08-
08 22:01:43
* @date 2022-08-
19 15:18:29
*/
*/
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
);
void
checkStaffOpenContactByWxEnterpriseId
(
String
param
);
/**
/**
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmQrcodeApiServiceImpl.java
View file @
1b4fc3d0
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl.hm;
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service.out.impl.hm;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Convert
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.clerk.api.service.ClerkService
;
...
@@ -115,7 +116,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -115,7 +116,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ServiceResponse
add
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
public
ServiceResponse
add
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
if
(
qwDTO
==
null
)
{
if
(
qwDTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
logger
.
error
(
"未查询到微信企业"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
...
@@ -144,7 +145,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -144,7 +145,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setRemark
(
hmQrcodeQDTO
.
getName
());
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setSkipVerify
(
hmQrcodeQDTO
.
getPassFlag
()
==
1
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
qywxExternalcontactDTO
.
setState
(
"HM"
+
hmId
);
String
corpid
=
qwDTO
.
getThirdCorpid
()
;
String
corpid
=
qwDTO
.
getThirdCorpid
();
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
,
wxEnterpriseId
);
List
<
String
>
userIds
=
staffClerkRelationService
.
listWxUserIdByClerkIds
(
clerkIdList
,
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"导购未关联好办"
);
...
@@ -210,11 +211,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -210,11 +211,11 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
}
}
String
lockKey
=
"qrCodeAdd"
+
wxEnterpriseId
;
String
lockKey
=
"qrCodeAdd"
+
wxEnterpriseId
;
if
(
RedisUtil
.
isLocked
(
lockKey
))
{
if
(
RedisUtil
.
isLocked
(
lockKey
))
{
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_13
.
getCode
()),
"正在批量创建活码,请稍后再试"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_13
.
getCode
()),
"正在批量创建活码,请稍后再试"
);
}
}
RedisUtil
.
lock
(
lockKey
,
10L
);
RedisUtil
.
lock
(
lockKey
,
10L
);
String
enterpriseId
=
hmQrcodeQDTO
.
getEnterpriseId
();
String
enterpriseId
=
hmQrcodeQDTO
.
getEnterpriseId
();
List
<
String
>
clerkIdList
=
hmQrcodeQDTO
.
getClerkIdList
();
List
<
String
>
clerkIdList
=
hmQrcodeQDTO
.
getClerkIdList
();
if
(
CollectionUtils
.
isEmpty
(
clerkIdList
))
{
if
(
CollectionUtils
.
isEmpty
(
clerkIdList
))
{
...
@@ -241,7 +242,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -241,7 +242,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger
.
info
(
"发送消息到addHmQrcodeMq,{}"
,
clerkId
);
logger
.
info
(
"发送消息到addHmQrcodeMq,{}"
,
clerkId
);
clientInstance
.
sendMessage
(
"addHmQrcodeMq"
,
JSON
.
toJSONString
(
hmQrcodeQDTO
));
clientInstance
.
sendMessage
(
"addHmQrcodeMq"
,
JSON
.
toJSONString
(
hmQrcodeQDTO
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
"发送消息到addHmQrcodeMq报错"
,
e
);
logger
.
info
(
"发送消息到addHmQrcodeMq报错"
,
e
);
}
}
}
}
...
@@ -302,7 +303,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -302,7 +303,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ServiceResponse
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
public
ServiceResponse
update
(
HmQrcodeQDTO
hmQrcodeQDTO
)
{
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
hmQrcodeQDTO
.
getWxEnterpriseId
();
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
if
(
qwDTO
==
null
)
{
if
(
qwDTO
==
null
)
{
logger
.
error
(
"未查询到微信企业"
);
logger
.
error
(
"未查询到微信企业"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
return
ServiceResponse
.
failure
(
Convert
.
toStr
(
HaoBanErrCodeCommon
.
ERR_8
.
getCode
()),
"微信企业不存在"
);
...
@@ -411,7 +412,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -411,7 +412,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//标签
//标签
String
memberLabelId
=
hmQrcodeQDTO
.
getMemberLabelId
();
String
memberLabelId
=
hmQrcodeQDTO
.
getMemberLabelId
();
String
memberLabelIdOld
=
hmOld
.
getMemberLabelId
();
String
memberLabelIdOld
=
hmOld
.
getMemberLabelId
();
if
(
StringUtils
.
isBlank
(
memberLabelId
)&&
StringUtils
.
isNotBlank
(
memberLabelIdOld
))
{
if
(
StringUtils
.
isBlank
(
memberLabelId
)
&&
StringUtils
.
isNotBlank
(
memberLabelIdOld
))
{
logContent
.
append
(
"活码标签变更为空"
);
logContent
.
append
(
"活码标签变更为空"
);
}
}
if
(
StringUtils
.
isNotBlank
(
memberLabelId
)
&&
StringUtils
.
isBlank
(
memberLabelIdOld
))
{
if
(
StringUtils
.
isNotBlank
(
memberLabelId
)
&&
StringUtils
.
isBlank
(
memberLabelIdOld
))
{
...
@@ -678,7 +679,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -678,7 +679,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String
wxConfigId
=
hmQrcodeBO
.
getWxConfigId
();
String
wxConfigId
=
hmQrcodeBO
.
getWxConfigId
();
if
(
StringUtils
.
isNotBlank
(
wxConfigId
))
{
if
(
StringUtils
.
isNotBlank
(
wxConfigId
))
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
hmQrcodeBO
.
getWxEnterpriseId
())
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
hmQrcodeBO
.
getWxEnterpriseId
());
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
QywxResponseDTO
qywxResponseDTO
=
qywxUserApiService
.
delContactWay
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
(),
wxConfigId
);
int
errcode
=
qywxResponseDTO
.
getErrcode
();
int
errcode
=
qywxResponseDTO
.
getErrcode
();
//https://open.work.weixin.qq.com/devtool/query?e=41044
//https://open.work.weixin.qq.com/devtool/query?e=41044
...
@@ -697,6 +698,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -697,6 +698,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
/**
/**
* 删除活码
* 删除活码
*
* @param hmId
* @param hmId
* @param invokingType
* @param invokingType
* @param loginDTO
* @param loginDTO
...
@@ -780,52 +782,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -780,52 +782,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger
.
info
(
"该企业未与gic关联,无需开启:enterpriseId:{},wxEnterpriseId:{}"
,
enterpriseId
,
wxEnterpriseId
);
logger
.
info
(
"该企业未与gic关联,无需开启:enterpriseId:{},wxEnterpriseId:{}"
,
enterpriseId
,
wxEnterpriseId
);
continue
;
continue
;
}
}
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
JSONObject
jsonObject
=
new
JSONObject
();
//企微已经开启联系我
jsonObject
.
put
(
"wxEnterpriseId"
,
wxEnterpriseId
);
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
());
jsonObject
.
put
(
"enterpriseId"
,
enterpriseId
);
List
<
StaffClerkRelationDTO
>
staffClerkRelationDTOS
=
staffClerkRelationService
.
listIdsByWxUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
if
(
CollectionUtils
.
isEmpty
(
staffClerkRelationDTOS
))
{
try
{
logger
.
error
(
"无导购关联数据"
);
clientInstance
.
sendMessage
(
"checkStaffOpenContactByWxEnterpriseIdMq"
,
jsonObject
.
toJSONString
());
continue
;
}
catch
(
Exception
e
)
{
}
logger
.
info
(
"发送消息异常:{}"
,
e
.
getMessage
(),
e
);
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
.
listIdsByNotInWxUserIds
(
wxUserIdsList
,
wxEnterpriseId
,
enterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
relationDTOS
))
{
logger
.
error
(
"无导购不包含关联数据"
);
continue
;
}
for
(
StaffClerkRelationDTO
relationDTO
:
relationDTOS
)
{
//有活码,但是企微联系我功能 被关闭
String
clerkId
=
relationDTO
.
getClerkId
();
HmQrcodeBO
hmQrcodeBO
=
hmQrcodeService
.
queryByClerkId
(
clerkId
,
relationDTO
.
getWxEnterpriseId
());
if
(
hmQrcodeBO
==
null
)
{
logger
.
info
(
"导购无活码,无需处理:clerkId:{}"
,
clerkId
);
continue
;
}
staffClerkRelationService
.
updateOpenConcatFlagById
(
0
,
relationDTO
.
getStaffClerkRelationId
());
hmQrcodeService
.
updateStatusById
(
hmQrcodeBO
.
getHmId
(),
3
);
}
}
}
logger
.
info
(
"检查员工是否开启联系我,定时任务,end"
);
logger
.
info
(
"检查员工是否开启联系我,定时任务,end"
);
}
}
@Override
@Override
public
void
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
public
void
checkStaffOpenContactByWxEnterpriseId
(
String
param
)
{
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
String
wxEnterpriseId
=
jsonObject
.
getString
(
"wxEnterpriseId"
);
String
enterpriseId
=
jsonObject
.
getString
(
"enterpriseId"
);
logger
.
info
(
"检查企业员工是否开启联系我:wxEnterpriseId:{},enterpriseId:{}"
,
wxEnterpriseId
,
enterpriseId
);
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
);
//查询出所有正常的导购
//查询出所有正常的导购
//企微已经开启联系我
//企微已经开启联系我
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
());
List
<
String
>
wxUserIdsList
=
qywxUserApiService
.
listCorpExternalUser
(
qwDTO
.
getThirdCorpid
(),
config
.
getWxSuiteid
());
...
@@ -862,6 +839,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
...
@@ -862,6 +839,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logger
.
info
(
"导购无活码,无需处理:clerkId:{}"
,
clerkId
);
logger
.
info
(
"导购无活码,无需处理:clerkId:{}"
,
clerkId
);
continue
;
continue
;
}
}
staffClerkRelationService
.
updateOpenConcatFlagById
(
0
,
relationDTO
.
getStaffClerkRelationId
());
hmQrcodeService
.
updateStatusById
(
hmQrcodeBO
.
getHmId
(),
3
);
hmQrcodeService
.
updateStatusById
(
hmQrcodeBO
.
getHmId
(),
3
);
}
}
}
}
...
...
haoban-manage3-service/src/test/java/ServiceTest.java
View file @
1b4fc3d0
...
@@ -56,13 +56,6 @@ public class ServiceTest {
...
@@ -56,13 +56,6 @@ public class ServiceTest {
hmQrcodeApiService
.
add
(
hmQrcodeQDTO
);
hmQrcodeApiService
.
add
(
hmQrcodeQDTO
);
}
}
@Test
public
void
test2
()
{
hmQrcodeApiService
.
checkStaffOpenContactByWxEnterpriseId
(
"5bd929fd3b2c49deaa1184bcb0d669b3"
,
"ff8080815dacd3a2015dacd3ef5c0000"
);
}
@Test
@Test
public
void
test3
()
{
public
void
test3
()
{
haobanQywxFeeApiService
.
addFee
(
"5bd929fd3b2c49deaa1184bcb0d669b3"
);
haobanQywxFeeApiService
.
addFee
(
"5bd929fd3b2c49deaa1184bcb0d669b3"
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/TestController.java
View file @
1b4fc3d0
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.HttpClient
;
import
com.gic.commons.util.HttpClient
;
...
@@ -337,7 +338,10 @@ public class TestController extends WebBaseController {
...
@@ -337,7 +338,10 @@ public class TestController extends WebBaseController {
*/
*/
@RequestMapping
(
"/checkStaffOpenContactByWxEnterpriseId"
)
@RequestMapping
(
"/checkStaffOpenContactByWxEnterpriseId"
)
public
HaobanResponse
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
public
HaobanResponse
checkStaffOpenContactByWxEnterpriseId
(
String
wxEnterpriseId
,
String
enterpriseId
)
{
hmQrcodeApiService
.
checkStaffOpenContactByWxEnterpriseId
(
wxEnterpriseId
,
enterpriseId
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"wxEnterpriseId"
,
wxEnterpriseId
);
jsonObject
.
put
(
"enterpriseId"
,
enterpriseId
);
hmQrcodeApiService
.
checkStaffOpenContactByWxEnterpriseId
(
jsonObject
.
toJSONString
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
...
...
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