Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart_gov_platform
Commits
0c722e91
Commit
0c722e91
authored
Apr 11, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加文件压缩
parent
f6832052
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
11 deletions
+42
-11
base-manager/src/main/java/com/mortals/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
...als/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
+42
-11
No files found.
base-manager/src/main/java/com/mortals/xhx/module/skin/service/impl/SkinBaseServiceImpl.java
View file @
0c722e91
...
...
@@ -307,20 +307,31 @@ public class SkinBaseServiceImpl extends AbstractCRUDServiceImpl<SkinBaseDao, Sk
*/
@Override
public
Rest
<
byte
[]>
compressSkinZip
(
SkinBaseEntity
query
,
Context
context
)
{
String
sourcePathZip
=
uploadService
.
getFilePath
(
query
.
getLocalZipPath
());
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
ZipOutputStream
zip
=
new
ZipOutputStream
(
outputStream
);
//查询所有
//查询所有
皮肤
List
<
SkinBaseEntity
>
skinBaseEntities
=
this
.
find
(
new
SkinBaseEntity
());
for
(
SkinBaseEntity
skinBaseEntity
:
skinBaseEntities
)
{
String
cssFilePath
=
skinBaseEntity
.
getCssFilePath
();
String
filePath
=
uploadService
.
getFilePath
(
cssFilePath
);
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
())
{
continue
;
if
(
file
.
exists
())
{
try
{
zip
.
putNextEntry
(
new
ZipEntry
(
StrUtil
.
subAfter
(
cssFilePath
,
"/"
,
false
)));
IOUtils
.
write
(
FileUtil
.
readBytes
(
file
),
zip
);
zip
.
flush
();
zip
.
closeEntry
();
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
}
String
previewImagePath
=
skinBaseEntity
.
getPreviewImagePath
();
filePath
=
uploadService
.
getFilePath
(
previewImagePath
);
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
{
try
{
zip
.
putNextEntry
(
new
ZipEntry
(
StrUtil
.
subAfter
(
fil
ePath
,
"/"
,
false
)));
zip
.
putNextEntry
(
new
ZipEntry
(
StrUtil
.
subAfter
(
previewImag
ePath
,
"/"
,
false
)));
IOUtils
.
write
(
FileUtil
.
readBytes
(
file
),
zip
);
zip
.
flush
();
zip
.
closeEntry
();
...
...
@@ -328,6 +339,26 @@ public class SkinBaseServiceImpl extends AbstractCRUDServiceImpl<SkinBaseDao, Sk
log
.
error
(
"异常"
,
e
);
}
}
}
//查询所有皮肤skinFiled
SkinFieldEntity
skinFieldQuery
=
new
SkinFieldEntity
();
skinFieldQuery
.
setFieldType
(
"2"
);
List
<
SkinFieldEntity
>
skinFieldEntities
=
skinFieldService
.
find
(
skinFieldQuery
);
for
(
SkinFieldEntity
skinFieldEntity
:
skinFieldEntities
)
{
String
fieldValue
=
skinFieldEntity
.
getFieldValue
();
String
filePath
=
uploadService
.
getFilePath
(
fieldValue
);
File
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
{
try
{
zip
.
putNextEntry
(
new
ZipEntry
(
StrUtil
.
subAfter
(
fieldValue
,
"/"
,
false
)));
IOUtils
.
write
(
FileUtil
.
readBytes
(
file
),
zip
);
zip
.
flush
();
zip
.
closeEntry
();
}
catch
(
Exception
e
)
{
log
.
error
(
"异常"
,
e
);
}
}
}
IOUtils
.
closeQuietly
(
zip
);
return
Rest
.
ok
(
outputStream
.
toByteArray
());
...
...
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