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
ae84e31c
Commit
ae84e31c
authored
Feb 11, 2023
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加好友队列
parent
491662b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+44
-2
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
ae84e31c
...
@@ -17,7 +17,9 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -17,7 +17,9 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RAtomicLong
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RRateLimiter
;
import
org.redisson.api.RSet
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateIntervalUnit
;
import
org.redisson.api.RateType
;
import
org.redisson.api.RateType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -45,6 +47,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum;
...
@@ -45,6 +47,7 @@ import com.gic.haoban.app.customer.enums.GicQywxSyncTypeEnum;
import
com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum
;
import
com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum
;
import
com.gic.haoban.app.customer.service.api.service.CustomerApiService
;
import
com.gic.haoban.app.customer.service.api.service.CustomerApiService
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.DingUtils
;
import
com.gic.haoban.manage.api.constants.Manage3Constants
;
import
com.gic.haoban.manage.api.constants.Manage3Constants
;
import
com.gic.haoban.manage.api.dto.ContentMaterialDTO
;
import
com.gic.haoban.manage.api.dto.ContentMaterialDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
import
com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO
;
...
@@ -395,20 +398,59 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
...
@@ -395,20 +398,59 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
return
null
;
return
null
;
}
}
// 加好友量大的迁移到mq2
int
maxCount
=
2
;
private
boolean
mqCheck
(
QwFrientNoticeDTO
dto
)
{
private
boolean
mqCheck
(
QwFrientNoticeDTO
dto
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
Object
obj
=
RedisUtil
.
getCache
(
"dealQywxExternalUserMq2"
)
;
Object
obj
=
RedisUtil
.
getCache
(
"dealQywxExternalUserMq2"
)
;
String
corpid
=
dto
.
getCorpid
()
;
if
(
null
!=
obj
)
{
if
(
null
!=
obj
)
{
String
str
=
obj
.
toString
()
;
String
str
=
obj
.
toString
()
;
String
corpid
=
dto
.
getCorpid
()
;
if
(
StringUtils
.
isNotBlank
(
corpid
)
&&
str
.
contains
(
corpid
))
{
if
(
StringUtils
.
isNotBlank
(
corpid
)
&&
str
.
contains
(
corpid
))
{
flag
=
true
;
flag
=
true
;
log
.
info
(
"加好友计数,手动配置到userMq2,corpid={}"
,
corpid
);
return
flag
;
}
}
TabHaobanWxEnterprise
wxEnterprise
=
this
.
wxEnterpriseService
.
getEnterpriseBycorpId
(
corpid
)
;
if
(
null
!=
wxEnterprise
)
{
String
wxEnterpriseId
=
wxEnterprise
.
getWxEnterpriseId
()
;
flag
=
this
.
needToMq2
(
wxEnterpriseId
)
;
if
(!
flag
)
{
long
times
=
this
.
getTimes
(
wxEnterpriseId
)
;
if
(
times
>
maxCount
)
{
if
(!
needToMq2
(
wxEnterpriseId
))
{
DingUtils
.
send
(
"加好友mq切换,企业="
+
wxEnterpriseId
,
false
);
}
log
.
info
(
"加好友计数,自动到userMq2,{}"
,
wxEnterpriseId
);
this
.
addToMq2Mark
(
wxEnterpriseId
);
flag
=
true
;
}
}
}
}
}
return
flag
;
return
flag
;
}
}
private
long
getTimes
(
String
wxEnterpriseId
)
{
String
key
=
"qwadd:count:"
+
wxEnterpriseId
;
RAtomicLong
cache
=
RedisUtil
.
getRedisClient
().
getAtomicLong
(
key
);
long
val
=
cache
.
addAndGet
(
1
);
if
(
val
<=
1
)
{
cache
.
expire
(
1
,
TimeUnit
.
MINUTES
);
}
return
val
;
}
private
void
addToMq2Mark
(
String
wxEnterpriseId
)
{
String
key
=
"qwadd:count2:"
+
wxEnterpriseId
;
RedisUtil
.
setCache
(
key
,
1
,
600L
);
}
private
boolean
needToMq2
(
String
wxEnterpriseId
)
{
String
key
=
"qwadd:count2:"
+
wxEnterpriseId
;
return
null
!=
RedisUtil
.
getCache
(
key
)
;
}
@Override
@Override
public
String
addMemberUnionidRelatedNew
(
MemberUnionidRelatedDTO
dto
,
String
wxUserId
)
{
public
String
addMemberUnionidRelatedNew
(
MemberUnionidRelatedDTO
dto
,
String
wxUserId
)
{
String
corpId
=
dto
.
getCorpid
();
String
corpId
=
dto
.
getCorpid
();
...
...
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