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
e36c9f68
Commit
e36c9f68
authored
Feb 17, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:增加打印日志
parent
e391a31f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
24 deletions
+14
-24
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+14
-24
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
e36c9f68
...
...
@@ -49,6 +49,7 @@ import com.gic.haoban.manage.service.pojo.bo.welcome.FriendSettingDetailBO;
import
com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO
;
import
com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.util.CommonUtil
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.member.api.dto.MemberDTO
;
import
com.gic.member.api.service.MemberApiService
;
...
...
@@ -66,7 +67,6 @@ 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.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -76,8 +76,6 @@ import org.redisson.api.RateType;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -448,15 +446,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
}
private
static
byte
[]
getFileByte
(
String
url
)
{
try
{
InputStream
in
=
new
URL
(
url
).
openStream
();
return
IOUtils
.
toByteArray
(
in
);
}
catch
(
Exception
e
)
{
log
.
info
(
"【异常】"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 欢迎语新增好友
...
...
@@ -553,12 +542,16 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String
sceneStr
=
"QWHY_"
+
relationKey
+
"_"
+
clerkId
;
//7天失效
String
temporaryQRcodeURL
=
weixinBaseFunService
.
getTemporaryQRcodeURL
(
enterpriseDTO
.
getAppkey
(),
sceneStr
,
604800
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
getFileByte
(
temporaryQRcodeURL
),
sceneStr
,
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
log
.
info
(
"欢迎语发送带参数的公众号二维码返回:{}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
==
0
)
{
QywxImageExternalBaseDTO
qywxImageExternalBaseDTO
=
new
QywxImageExternalBaseDTO
();
qywxImageExternalBaseDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
attachments
.
add
(
qywxImageExternalBaseDTO
);
log
.
info
(
"参数的公众号二维码返回:{}"
,
temporaryQRcodeURL
);
if
(
StringUtils
.
isNotBlank
(
temporaryQRcodeURL
))
{
String
[]
arr
=
temporaryQRcodeURL
.
split
(
"/"
);
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
temporaryQRcodeURL
),
arr
[
arr
.
length
-
1
],
QywxMediaTypeEnum
.
IMAGE
.
getCode
());
log
.
info
(
"欢迎语发送带参数的公众号企微二维码返回:{}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
==
0
)
{
QywxImageExternalBaseDTO
qywxImageExternalBaseDTO
=
new
QywxImageExternalBaseDTO
();
qywxImageExternalBaseDTO
.
setMediaId
(
jp
.
getResult
().
toString
());
attachments
.
add
(
qywxImageExternalBaseDTO
);
}
}
}
else
if
(
friendSettingType
.
equals
(
FriendSettingTypeEnum
.
TEXT_AND_MINI_PROGRAM
.
getCode
()))
{
log
.
info
(
"发送小程序:wxEnterpriseId:{},sendApp:{}"
,
wxEnterpriseId
,
sendApp
);
...
...
@@ -585,8 +578,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
mediaType
.
equals
(
WelcomeMediaTypeEnum
.
IMAGE
.
getCode
()))
{
String
mediaUrl
=
welcomeMediaBO
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
getFileByte
(
mediaUrl
),
arr
[
count
-
1
],
QywxExternalMessageTypeEnum
.
IMAGE
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
QywxExternalMessageTypeEnum
.
IMAGE
.
getCode
());
log
.
info
(
"欢迎语发送图片返回:{}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
==
0
)
{
QywxImageExternalBaseDTO
qywxImageExternalBaseDTO
=
new
QywxImageExternalBaseDTO
();
...
...
@@ -597,8 +589,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
mediaType
.
equals
(
WelcomeMediaTypeEnum
.
VIDEO
.
getCode
()))
{
String
mediaUrl
=
welcomeMediaBO
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
getFileByte
(
mediaUrl
),
arr
[
count
-
1
],
QywxExternalMessageTypeEnum
.
VIDEO
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
QywxExternalMessageTypeEnum
.
VIDEO
.
getCode
());
log
.
info
(
"欢迎语发送视频返回:{}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
==
0
)
{
QywxVideoExternalBaseDTO
qywxVideoExternalBaseDTO
=
new
QywxVideoExternalBaseDTO
();
...
...
@@ -609,8 +600,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if
(
mediaType
.
equals
(
WelcomeMediaTypeEnum
.
FILE
.
getCode
()))
{
String
mediaUrl
=
welcomeMediaBO
.
getMediaUrl
();
String
[]
arr
=
mediaUrl
.
split
(
"/"
);
int
count
=
arr
.
length
;
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
getFileByte
(
mediaUrl
),
arr
[
count
-
1
],
QywxExternalMessageTypeEnum
.
FILE
.
getCode
());
JSONResponse
jp
=
qywxSuiteApiService
.
uploadMedia
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
CommonUtil
.
getFileByte
(
mediaUrl
),
arr
[
arr
.
length
-
1
],
QywxExternalMessageTypeEnum
.
FILE
.
getCode
());
log
.
info
(
"欢迎语发送文件返回:{}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
==
0
)
{
QywxFileExternalBaseDTO
qywxFileExternalBaseDTO
=
new
QywxFileExternalBaseDTO
();
...
...
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