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
ec742df9
Commit
ec742df9
authored
Oct 21, 2024
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片压缩
parent
f59ded01
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
+19
-1
MaterialServiceImpl.java
...oban/manage/service/service/impl/MaterialServiceImpl.java
+3
-1
ApolloUtils.java
.../java/com/gic/haoban/manage/service/util/ApolloUtils.java
+16
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/MaterialServiceImpl.java
View file @
ec742df9
...
...
@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.HttpClient
;
import
com.gic.haoban.manage.service.util.ApolloUtils
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
...
...
@@ -246,7 +247,8 @@ public class MaterialServiceImpl implements MaterialService {
String
extensions
=
url
.
substring
(
url
.
lastIndexOf
(
"."
)
+
1
);
//朋友圈类型图片,长边不超过10800像素,短边不超过1080像素
//图片宽高超过限制 或 大小大于2m 处理图片
if
(
size
/
1000
>
2000
||
width
>
1080
||
height
>
10800
||
(
Objects
.
equals
(
extensions
,
"png"
)
&&
size
/
1000
>
1000
))
{
if
(
size
/
1000
>
2000
||
width
>
1080
||
height
>
10800
||
(
Objects
.
equals
(
extensions
,
"png"
)
&&
size
/
1000
>
1000
&&
ApolloUtils
.
compressShareEid
(
wxEnterpriseId
)))
{
url
+=
"?imageView2/2/w/1080/h/10800/format/jpg"
;
}
logger
.
info
(
"url={}"
,
url
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/ApolloUtils.java
View file @
ec742df9
...
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.util;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -20,6 +21,21 @@ public class ApolloUtils {
}
/**
* 分享朋友圈压缩开关
* @return
*/
public
static
boolean
compressShareEid
(
String
wxEnterpriseId
)
{
Config
config
=
ConfigService
.
getAppConfig
();
String
compressShareEid
=
config
.
getProperty
(
"compressShareEid"
,
""
);
if
(
StringUtils
.
isBlank
(
compressShareEid
))
{
return
true
;
}
boolean
contains
=
compressShareEid
.
contains
(
wxEnterpriseId
);
log
.
info
(
"分享朋友圈压缩开关:{}"
,
contains
);
return
contains
;
}
/**
* 导购通知一批次间隔时间
* @return
*/
...
...
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