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
b5558721
Commit
b5558721
authored
Sep 29, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pendingid
parent
b603ed9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
7 deletions
+63
-7
QwFriendApiService.java
...com/gic/haoban/manage/api/service/QwFriendApiService.java
+15
-0
QwFriendApiServiceImpl.java
...nage/service/service/out/impl/QwFriendApiServiceImpl.java
+46
-5
QwTimesUtils.java
...java/com/gic/haoban/manage/service/util/QwTimesUtils.java
+2
-2
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/QwFriendApiService.java
View file @
b5558721
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.QwPendingIdDTO
;
import
com.gic.haoban.manage.api.dto.QwPendingIdDTO
;
...
@@ -17,6 +18,20 @@ public interface QwFriendApiService {
...
@@ -17,6 +18,20 @@ public interface QwFriendApiService {
/**
/**
*
*
* @Title: pendingCheck
* @Description: 校验商户能否获取pending
* @author xugh
* @param enterpriseId
* @param unionid
* @param openid
* @param wxaOpenid
* @return
* @throws
*/
public
ServiceResponse
<
Map
<
String
,
String
>>
pendingIdCheck
(
String
enterpriseId
,
String
unionid
,
String
openid
,
String
wxaOpenid
);
/**
*
* @Title: getPendingIdByUnionid
* @Title: getPendingIdByUnionid
* @Description: 通过uniond获取好友id/pendingid
* @Description: 通过uniond获取好友id/pendingid
* @author xugh
* @author xugh
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/QwFriendApiServiceImpl.java
View file @
b5558721
...
@@ -2,7 +2,9 @@ package com.gic.haoban.manage.service.service.out.impl;
...
@@ -2,7 +2,9 @@ package com.gic.haoban.manage.service.service.out.impl;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -44,24 +46,63 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
...
@@ -44,24 +46,63 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
private
Config
config
;
private
Config
config
;
@Override
@Override
public
ServiceResponse
<
QwPendingIdDTO
>
getPendingIdByUnionid
(
String
enterpriseId
,
String
unionid
,
String
openid
)
{
public
ServiceResponse
<
Map
<
String
,
String
>>
pendingIdCheck
(
String
enterpriseId
,
String
unionid
,
String
openid
,
String
wxaOpenid
)
{
ServiceResponse
<
WxEnterpriseQwDTO
>
corpidResp
=
this
.
checkAndGetCorpid
(
enterpriseId
);
if
(!
corpidResp
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
corpidResp
.
getCode
(),
corpidResp
.
getMessage
());
}
String
suiteid
=
config
.
getWxSuiteid
();
String
suiteid
=
config
.
getWxSuiteid
();
WxEnterpriseQwDTO
qwDTO
=
corpidResp
.
getResult
();
String
corpid
=
qwDTO
.
getThirdCorpid
();
ServiceResponse
<
PendingIdDTO
>
wxResp
=
this
.
qywxExternalUserService
.
unionidToExternalUserid
(
corpid
,
suiteid
,
unionid
,
openid
,
0
);
Map
<
String
,
String
>
retMap
=
new
HashMap
<>();
StringBuilder
sb
=
new
StringBuilder
();
String
result
=
""
;
String
wxCode
=
"0"
;
String
wxaCode
=
"0"
;
if
(
wxResp
.
isSuccess
())
{
result
=
"ok"
;
}
else
{
result
=
wxResp
.
getCode
();
wxCode
=
result
;
}
retMap
.
put
(
"wxCode"
,
wxCode
);
sb
.
append
(
"服务号-"
).
append
(
result
).
append
(
","
);
ServiceResponse
<
PendingIdDTO
>
wxaResp
=
this
.
qywxExternalUserService
.
unionidToExternalUserid
(
corpid
,
suiteid
,
unionid
,
wxaOpenid
,
0
);
if
(
wxaResp
.
isSuccess
())
{
result
=
"ok"
;
}
else
{
result
=
wxResp
.
getCode
();
wxaCode
=
result
;
}
sb
.
append
(
"小程序-"
).
append
(
result
);
retMap
.
put
(
"remark"
,
sb
.
toString
());
retMap
.
put
(
"wxaCode"
,
wxaCode
);
return
ServiceResponse
.
success
(
retMap
);
}
@Override
public
ServiceResponse
<
QwPendingIdDTO
>
getPendingIdByUnionid
(
String
enterpriseId
,
String
unionid
,
String
openid
)
{
ServiceResponse
<
WxEnterpriseQwDTO
>
corpidResp
=
this
.
checkAndGetCorpid
(
enterpriseId
);
ServiceResponse
<
WxEnterpriseQwDTO
>
corpidResp
=
this
.
checkAndGetCorpid
(
enterpriseId
);
if
(!
corpidResp
.
isSuccess
())
{
if
(!
corpidResp
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
corpidResp
.
getCode
(),
corpidResp
.
getMessage
());
return
ServiceResponse
.
failure
(
corpidResp
.
getCode
(),
corpidResp
.
getMessage
());
}
}
String
suiteid
=
config
.
getWxSuiteid
();
WxEnterpriseQwDTO
qwDTO
=
corpidResp
.
getResult
();
WxEnterpriseQwDTO
qwDTO
=
corpidResp
.
getResult
();
String
wxEnterpriseId
=
qwDTO
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
qwDTO
.
getWxEnterpriseId
();
boolean
isLimit
=
QwTimesUtils
.
isLimit
(
wxEnterpriseId
,
enterpriseId
,
QwInterfaceLimitEnum
.
GET_PENDING_ID
);
boolean
isLimit
=
QwTimesUtils
.
isLimit
(
wxEnterpriseId
,
enterpriseId
,
QwInterfaceLimitEnum
.
GET_PENDING_ID
);
if
(
isLimit
)
{
if
(
isLimit
)
{
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_2000
.
getCode
(),
HaoBanErrCode
.
ERR_2000
.
getMsg
());
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_2000
.
getCode
(),
HaoBanErrCode
.
ERR_2000
.
getMsg
());
}
}
String
corpid
=
qwDTO
.
getThirdCorpid
();
String
corpid
=
qwDTO
.
getThirdCorpid
();
ServiceResponse
<
PendingIdDTO
>
qwResp
=
this
.
qywxExternalUserService
.
unionidToExternalUserid
(
corpid
,
suiteid
,
ServiceResponse
<
PendingIdDTO
>
qwResp
=
this
.
qywxExternalUserService
.
unionidToExternalUserid
(
corpid
,
suiteid
,
unionid
,
openid
,
1
);
unionid
,
openid
,
0
);
QwTimesUtils
.
addTimes
(
wxEnterpriseId
,
QwInterfaceLimitEnum
.
GET_PENDING_ID
);
QwTimesUtils
.
addTimes
(
wxEnterpriseId
,
QwInterfaceLimitEnum
.
GET_PENDING_ID
);
log
.
info
(
"获取pendingid,参数={},
返回={}"
,
unio
nid
,
JSON
.
toJSONString
(
qwResp
));
log
.
info
(
"获取pendingid,参数={},
{},返回={}"
,
unionid
,
ope
nid
,
JSON
.
toJSONString
(
qwResp
));
if
(!
qwResp
.
isSuccess
())
{
if
(!
qwResp
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
qwResp
.
getCode
(),
qwResp
.
getMessage
());
return
ServiceResponse
.
failure
(
qwResp
.
getCode
(),
qwResp
.
getMessage
());
}
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/QwTimesUtils.java
View file @
b5558721
...
@@ -72,8 +72,8 @@ public class QwTimesUtils {
...
@@ -72,8 +72,8 @@ public class QwTimesUtils {
private
static
boolean
timesCheck
(
int
type
,
String
cacheKey
,
QwInterfaceLimitEnum
qwInterface
,
private
static
boolean
timesCheck
(
int
type
,
String
cacheKey
,
QwInterfaceLimitEnum
qwInterface
,
String
wxEnterpriseId
,
String
enterpriseId
,
Date
now
,
QwLimitTimesBO
setTimeBO
)
{
String
wxEnterpriseId
,
String
enterpriseId
,
Date
now
,
QwLimitTimesBO
setTimeBO
)
{
Integer
doneTimes
=
RedisUtil
.
getCache
(
cacheKey
,
Integer
.
class
);
Integer
doneTimes
=
RedisUtil
.
getCache
(
cacheKey
,
Integer
.
class
);
logger
.
info
(
"
获取已调次数={},cacheKey={}"
,
doneTimes
,
cacheKey
);
logger
.
info
(
"
type{}获取已调次数={},cacheKey={}"
,
type
,
doneTimes
==
null
?
0
:
doneTimes
,
cacheKey
);
if
(
null
==
doneTimes
)
{
if
(
null
==
doneTimes
||
doneTimes
==
0
)
{
return
false
;
return
false
;
}
}
int
setTimes
=
0
;
int
setTimes
=
0
;
...
...
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