Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-cloud-platform
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
周健威
rs-cloud-platform
Commits
0f92aa9f
Commit
0f92aa9f
authored
Jun 26, 2024
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
64852da0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
GainDataController.java
...latform/rs/website/controller/web/GainDataController.java
+27
-25
No files found.
rs-website/rs-website-server/src/main/java/com/upyuns/platform/rs/website/controller/web/GainDataController.java
View file @
0f92aa9f
package
com
.
upyuns
.
platform
.
rs
.
website
.
controller
.
web
;
package
com
.
upyuns
.
platform
.
rs
.
website
.
controller
.
web
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
...
@@ -83,36 +84,37 @@ public class GainDataController extends BaseController<GainDataBiz,GainData> {
...
@@ -83,36 +84,37 @@ public class GainDataController extends BaseController<GainDataBiz,GainData> {
gainData
.
setIsDel
(
SYS_FALSE
);
gainData
.
setIsDel
(
SYS_FALSE
);
List
<
GainData
>
gainData1
=
baseBiz
.
selectAll
(
gainData
);
List
<
GainData
>
gainData1
=
baseBiz
.
selectAll
(
gainData
);
for
(
GainData
gainData2
:
gainData1
)
{
for
(
GainData
gainData2
:
gainData1
)
{
String
path
=
gainData2
.
getPictureUrl
().
replaceAll
(
"https://gdxm.upyuns.com/image"
,
"/sdbdata/www/gdweb_resources/image"
);
if
(
StrUtil
.
isNotBlank
(
gainData2
.
getPictureUrl
()))
{
path
=
path
.
replaceAll
(
"https://zzrsmgmt.upyuns.com/image"
,
"/sdbdata/www/gdweb_resources/image"
);
String
path
=
gainData2
.
getPictureUrl
().
replaceAll
(
"https://gdxm.upyuns.com/image"
,
"/sdbdata/www/gdweb_resources/image"
);
String
path250
=
path
+
"_250"
;
path
=
path
.
replaceAll
(
"https://zzrsmgmt.upyuns.com/image"
,
"/sdbdata/www/gdweb_resources/image"
);
if
(!
FileUtil
.
exist
(
path250
))
{
String
path250
=
path
+
"_250"
;
//生成250
if
(!
FileUtil
.
exist
(
path250
))
{
BufferedImage
originalImage
=
ImageIO
.
read
(
new
File
(
path
));
//生成250
int
originalWidth
=
originalImage
.
getWidth
();
BufferedImage
originalImage
=
ImageIO
.
read
(
new
File
(
path
));
int
originalHeight
=
originalImage
.
getHeight
();
int
originalWidth
=
originalImage
.
getWidth
();
double
scaleFactor
=
1.0
;
int
originalHeight
=
originalImage
.
getHeight
();
double
scaleFactor
=
1.0
;
if
(
originalWidth
>
originalHeight
)
{
if
(
originalWidth
>
originalHeight
)
{
scaleFactor
=
(
double
)
500
/
originalWidth
;
scaleFactor
=
(
double
)
500
/
originalWidth
;
}
else
{
}
else
{
scaleFactor
=
(
double
)
500
/
originalHeight
;
scaleFactor
=
(
double
)
500
/
originalHeight
;
}
}
int
newWidth
=
(
int
)
(
originalWidth
*
scaleFactor
);
int
newWidth
=
(
int
)
(
originalWidth
*
scaleFactor
);
int
newHeight
=
(
int
)
(
originalHeight
*
scaleFactor
);
int
newHeight
=
(
int
)
(
originalHeight
*
scaleFactor
);
BufferedImage
resizedImage
=
new
BufferedImage
(
newWidth
,
newHeight
,
originalImage
.
getType
());
BufferedImage
resizedImage
=
new
BufferedImage
(
newWidth
,
newHeight
,
originalImage
.
getType
());
Graphics2D
g
=
resizedImage
.
createGraphics
();
Graphics2D
g
=
resizedImage
.
createGraphics
();
g
.
drawImage
(
originalImage
,
0
,
0
,
newWidth
,
newHeight
,
null
);
g
.
drawImage
(
originalImage
,
0
,
0
,
newWidth
,
newHeight
,
null
);
g
.
dispose
();
g
.
dispose
();
// 保存压缩后的图片
// 保存压缩后的图片
String
compressedFilePath
=
path250
;
String
compressedFilePath
=
path250
;
String
lastFormat
=
path
.
substring
(
path
.
lastIndexOf
(
"."
));
String
lastFormat
=
path
.
substring
(
path
.
lastIndexOf
(
"."
));
ImageIO
.
write
(
resizedImage
,
lastFormat
.
substring
(
1
,
lastFormat
.
length
()),
new
File
(
compressedFilePath
));
ImageIO
.
write
(
resizedImage
,
lastFormat
.
substring
(
1
,
lastFormat
.
length
()),
new
File
(
compressedFilePath
));
}
}
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
...
...
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