Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gk
Project
Project
Details
Activity
Releases
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
micro_app
gk
Commits
6d7b4aa4
Commit
6d7b4aa4
authored
Jul 11, 2025
by
daniel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(resource): 资源处理
parent
510bf5f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
CmptController.java
...va/com/dlbridge/jadp/plugins/cmpt/web/CmptController.java
+1
-1
ResourcesController.java
...m/dlbridge/jadp/plugins/cmpt/web/ResourcesController.java
+38
-1
No files found.
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/CmptController.java
View file @
6d7b4aa4
...
...
@@ -206,7 +206,7 @@ public class CmptController {
}
String
param
=
"uId="
+
user2
.
getId
();
// 跳转到赛客助手后台赛事列表
if
(
partnerId
!=
null
&&
!
partnerId
.
isEmpty
()){
if
(
partnerId
!=
null
&&
!
partnerId
.
isEmpty
()
&&!
partnerId
.
equals
(
"null"
)
){
param
=
param
+
"&partnerId="
+
partnerId
;
return
"redirect:"
+
serverURL
+
"gk/guide/index/"
+
cmptId
+
"?"
+
param
;
}
...
...
src/main/java/com/dlbridge/jadp/plugins/cmpt/web/ResourcesController.java
View file @
6d7b4aa4
...
...
@@ -123,7 +123,7 @@ public class ResourcesController {
if
(
resourceResponseEntity
.
getBody
().
getInputStream
()
!=
null
){
BufferedImage
bg
=
ImageIO
.
read
(
resourceResponseEntity
.
getBody
().
getInputStream
());
BufferedImage
qr
=
ImageIO
.
read
(
new
URL
(
cmpt
.
getLogo
()));
overlapImageHD
(
bg
,
qr
,
response
);
overlapImageHD
Plus
(
bg
,
qr
,
response
);
}
else
{
log
.
info
(
"=====获取小程序码为空:"
+
resourceResponseEntity
.
getBody
().
toString
());
}
...
...
@@ -133,6 +133,43 @@ public class ResourcesController {
}
}
// ... 已有代码 ...
public
static
String
overlapImageHDPlus
(
BufferedImage
bg
,
BufferedImage
qrCodeIps
,
HttpServletResponse
response
)
throws
Exception
{
// 进一步增大背景图片尺寸
BufferedImage
background
=
resizeImageHighQuality
(
2400
,
2400
,
bg
);
// 进一步增大二维码图片尺寸
BufferedImage
qrCode
=
resizeImageHighQuality
(
1120
,
1120
,
qrCodeIps
);
qrCode
=
converToRadius
(
qrCode
,
1120
,
1120
);
qrCode
.
createGraphics
().
setBackground
(
Color
.
WHITE
);
Graphics2D
g
=
background
.
createGraphics
();
// 调整二维码位置
g
.
drawImage
(
qrCode
,
640
,
640
,
qrCode
.
getWidth
(),
qrCode
.
getHeight
(),
null
);
g
.
dispose
();
ImageIO
.
write
(
background
,
"jpg"
,
response
.
getOutputStream
());
return
null
;
}
/**
* 使用高质量算法调整图片尺寸
* @param x 目标宽度
* @param y 目标高度
* @param bfi 原始图片
* @return 调整尺寸后的图片
*/
public
static
BufferedImage
resizeImageHighQuality
(
int
x
,
int
y
,
BufferedImage
bfi
)
{
BufferedImage
bufferedImage
=
new
BufferedImage
(
x
,
y
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics2D
g
=
bufferedImage
.
createGraphics
();
// 设置高质量的渲染提示
g
.
setRenderingHint
(
RenderingHints
.
KEY_INTERPOLATION
,
RenderingHints
.
VALUE_INTERPOLATION_BICUBIC
);
g
.
setRenderingHint
(
RenderingHints
.
KEY_RENDERING
,
RenderingHints
.
VALUE_RENDER_QUALITY
);
g
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
g
.
drawImage
(
bfi
,
0
,
0
,
x
,
y
,
null
);
g
.
dispose
();
return
bufferedImage
;
}
public
static
String
overlapImage
(
BufferedImage
bg
,
BufferedImage
qrCodeIps
,
HttpServletResponse
response
)
throws
Exception
{
//设置图片大小
BufferedImage
background
=
resizeImage
(
300
,
300
,
bg
);
...
...
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