Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-execute-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6f5d4833
authored
Oct 16, 2023
by
chizw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sop短链 短链转换优化
1 parent
7ab36120
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
platform-execute/pom.xml
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/SopEventProcessFilter.java
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/UrlTransformFilter.java
platform-execute/src/main/java/cn/com/glsx/execute/modules/controller/shorturl/UrlMapController.java
platform-execute/src/main/java/cn/com/glsx/execute/modules/service/shorturl/ShortUrlService.java
platform-execute/src/main/java/cn/com/glsx/execute/utils/UrlUtil.java
platform-execute/target/generated-sources/annotations/cn/com/glsx/execute/modules/converter/UserConverterImpl.java
platform-execute/pom.xml
View file @
6f5d483
...
...
@@ -101,6 +101,7 @@
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-amqp
</artifactId>
<version>
2.6.0
</version>
</dependency>
<dependency>
...
...
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/SopEventProcessFilter.java
View file @
6f5d483
...
...
@@ -57,11 +57,12 @@ public class SopEventProcessFilter implements AccessFilter {
public
void
doFilter
(
AccessFilterChain
chain
,
TransformContext
context
)
{
//sop事件
try
{
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
String
urlParam
=
context
.
getParam
(
TransformContext
.
PARAM_URL_PARAM_KEY
);
String
queryString
=
context
.
getParam
(
TransformContext
.
PARAM_QUERY_STRING_KEY
);
Map
<
String
,
String
>
extra
=
UrlUtil
.
convertUrlParamsToMap
(
urlParam
,
queryString
);
String
unionId
=
extra
.
get
(
"unionId"
);
if
(
StringUtils
.
isNotEmpty
(
unionId
))
{
List
<
Map
<
String
,
Object
>>
mapList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"org_id"
,
extra
.
get
(
"merchantId"
));
map
.
put
(
"add_way"
,
"SHORT_LINK"
);
...
...
@@ -76,9 +77,6 @@ public class SopEventProcessFilter implements AccessFilter {
map
.
put
(
"ip"
,
context
.
getParam
(
TransformContext
.
PARAM_CLIENT_ID_KEY
));
map
.
put
(
"gps"
,
null
);
map
.
put
(
"extra"
,
JSON
.
toJSONString
(
extra
));
log
.
info
(
"sop event mq message:{}"
,
JSON
.
toJSONString
(
mapList
));
msgProducer
.
customerEventSend
(
mapList
);
if
(
StringUtils
.
isNotEmpty
(
unionId
))
{
GetUserInfoRequest
requestDTO
=
new
GetUserInfoRequest
();
requestDTO
.
setUnionId
(
unionId
);
List
<
GetUserInfoResponse
>
userList
=
wechatUserInfoService
.
getUserListByUnionId
(
requestDTO
);
...
...
platform-execute/src/main/java/cn/com/glsx/execute/filter/shorturl/UrlTransformFilter.java
View file @
6f5d483
...
...
@@ -38,7 +38,7 @@ public class UrlTransformFilter implements AccessFilter {
@Resource
private
Environment
environment
;
private
String
b4RedirectPage
;
//
private String b4RedirectPage;
private
String
protocol
;
...
...
@@ -52,7 +52,7 @@ public class UrlTransformFilter implements AccessFilter {
@Override
public
void
init
(
TransformContext
context
)
{
String
page
=
environment
.
getProperty
(
"sop.shorturl.default.auth.page"
);
if
(
StringUtils
.
isNotEmpty
(
page
))
b4RedirectPage
=
page
;
//
if (StringUtils.isNotEmpty(page)) b4RedirectPage = page;
ShortUrlDomainConfigDTO
domain
=
shortUrlService
.
selectDomain
(
RedirectType
.
DIRECT
);
if
(
domain
!=
null
)
{
protocol
=
domain
.
getProtocol
();
...
...
@@ -77,9 +77,9 @@ public class UrlTransformFilter implements AccessFilter {
context
.
setParam
(
TransformContext
.
PARAM_URL_PARAM_KEY
,
urlParam
);
context
.
setParam
(
TransformContext
.
PARAM_SHORT_URL_KEY
,
mappingDTO
.
getShortUrl
());
context
.
setParam
(
TransformContext
.
PARAM_LONG_URL_KEY
,
mappingDTO
.
getLongUrl
());
b4RedirectPage
=
StringUtils
.
isNotEmpty
(
mappingDTO
.
getB4RedirectPage
())
?
mappingDTO
.
getB4RedirectPage
()
:
b4RedirectPage
;
String
b4RedirectPage
=
mappingDTO
.
getB4RedirectPage
()
;
Boolean
addTimestamp
=
mappingDTO
.
getAddTimestamp
();
if
(
redirectType
.
equals
(
RedirectType
.
THROUGH_AUTH_PAGE
))
{
if
(
redirectType
.
equals
(
RedirectType
.
THROUGH_AUTH_PAGE
)
&&
StringUtils
.
isNotEmpty
(
b4RedirectPage
)
)
{
longUrl
=
b4RedirectPage
+
"?url="
+
UrlUtil
.
splicingUrl
(
protocol
,
domainValue
,
context
.
getCompressCode
());
}
else
{
if
(
StringUtils
.
isNotEmpty
(
urlParam
))
{
...
...
platform-execute/src/main/java/cn/com/glsx/execute/modules/controller/shorturl/UrlMapController.java
View file @
6f5d483
...
...
@@ -26,6 +26,7 @@ import java.util.Enumeration;
@Tag
(
name
=
"短链映射"
)
@RestController
@RequiredArgsConstructor
@RequestMapping
(
value
=
"/sop"
)
public
class
UrlMapController
{
@Resource
...
...
platform-execute/src/main/java/cn/com/glsx/execute/modules/service/shorturl/ShortUrlService.java
View file @
6f5d483
...
...
@@ -64,8 +64,8 @@ public class ShortUrlService {
@Resource
private
SopEventDelaySendLogMapper
sopEventDelaySendLogMapper
;
@Value
(
"
sop.shorturl.default.auth.page:https://scrm.dev.glsx.com.cn/sopurl
"
)
private
String
DEFAULT_AUTH_PAGE
;
@Value
(
"
${sop.shorturl.default.auth.page:https://scrm.dev.glsx.com.cn/sopurl}
"
)
private
String
defaultAuthPage
;
private
ShortUrlService
self
;
...
...
@@ -143,7 +143,7 @@ public class ShortUrlService {
RedirectType
redirectType
=
RedirectType
.
DIRECT
;
if
(
isThroughAuth
!=
null
&&
isThroughAuth
)
{
redirectType
=
RedirectType
.
THROUGH_AUTH_PAGE
;
b4RedirectPage
=
StringUtils
.
isNotEmpty
(
b4RedirectPage
)
?
b4RedirectPage
:
DEFAULT_AUTH_PAGE
;
b4RedirectPage
=
StringUtils
.
isNotEmpty
(
b4RedirectPage
)
?
b4RedirectPage
:
defaultAuthPage
;
}
// 获取域名
ShortUrlDomainConfigDTO
domain
=
selectDomain
(
redirectType
);
...
...
platform-execute/src/main/java/cn/com/glsx/execute/utils/UrlUtil.java
View file @
6f5d483
...
...
@@ -30,7 +30,7 @@ public enum UrlUtil {
*/
public
static
String
extractUrl
(
String
url
)
{
int
index
=
url
.
indexOf
(
"?"
);
String
target
=
nul
l
;
String
target
=
ur
l
;
if
(
index
>
0
)
{
String
substring
=
url
.
substring
(
0
,
index
);
if
(
StringUtils
.
isNotEmpty
(
substring
))
{
...
...
platform-execute/target/generated-sources/annotations/cn/com/glsx/execute/modules/converter/UserConverterImpl.java
View file @
6f5d483
...
...
@@ -7,7 +7,7 @@ import javax.annotation.Generated;
@Generated
(
value
=
"org.mapstruct.ap.MappingProcessor"
,
date
=
"2023-10-1
3T10:56:15
+0800"
,
date
=
"2023-10-1
5T17:20:19
+0800"
,
comments
=
"version: 1.5.2.Final, compiler: javac, environment: Java 1.8.0_181 (Oracle Corporation)"
)
public
class
UserConverterImpl
implements
UserConverter
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment