Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-app-report
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
Administrator
xzxt-app-report
Commits
183e43b0
Commit
183e43b0
authored
Jan 25, 2022
by
wang_jiaxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改新版本文件下载方法
parent
2247e7e7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
src/main/java/org/springblade/founder/bbgx/controller/AppBbgxController.java
+2
-2
src/main/java/org/springblade/founder/bbgx/entity/AppBbgx.java
+1
-1
src/main/java/org/springblade/founder/bbgx/service/AppBbgxService.java
+1
-1
src/main/java/org/springblade/founder/bbgx/service/impl/AppBbgxServiceImpl.java
+10
-7
No files found.
src/main/java/org/springblade/founder/bbgx/controller/AppBbgxController.java
View file @
183e43b0
...
...
@@ -31,9 +31,9 @@ public class AppBbgxController {
}
@PostMapping
(
"/fileUpload"
)
public
R
fileUpload
(
String
version
,
String
gxbz
,
MultipartFile
file
){
public
R
fileUpload
(
String
version
,
String
gxbz
,
String
wjwz
){
try
{
String
result
=
appBbgxService
.
fileUpload
(
version
,
gxbz
,
file
);
String
result
=
appBbgxService
.
fileUpload
(
version
,
gxbz
,
wjwz
);
if
(
result
==
null
){
return
R
.
error
(
"该版本已经存在"
);
}
...
...
src/main/java/org/springblade/founder/bbgx/entity/AppBbgx.java
View file @
183e43b0
...
...
@@ -13,7 +13,7 @@ public class AppBbgx {
@TableId
(
type
=
IdType
.
INPUT
)
private
String
appVersion
;
//版本号
private
String
appGxbz
;
//更新备注
private
byte
[]
appGxwj
;
//更新文件
private
String
appGxwjwz
;
//更新文件
private
Date
rksj
;
//入库时间
private
String
xxscPdbz
;
//删除标志
}
src/main/java/org/springblade/founder/bbgx/service/AppBbgxService.java
View file @
183e43b0
...
...
@@ -11,5 +11,5 @@ public interface AppBbgxService {
void
getXbbwj
(
String
version
,
HttpServletResponse
response
)
throws
IOException
;
String
fileUpload
(
String
version
,
String
gxbz
,
MultipartFile
file
)
throws
IOException
;
String
fileUpload
(
String
version
,
String
gxbz
,
String
wjwz
)
;
}
src/main/java/org/springblade/founder/bbgx/service/impl/AppBbgxServiceImpl.java
View file @
183e43b0
...
...
@@ -15,9 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -56,8 +54,12 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
@Override
public
void
getXbbwj
(
String
version
,
HttpServletResponse
response
)
throws
IOException
{
long
l1
=
System
.
currentTimeMillis
();
AppBbgx
bbgx
=
appBbgxMapper
.
selectById
(
version
);
InputStream
inputStream
=
new
ByteArrayInputStream
(
bbgx
.
getAppGxwj
());
long
l2
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
l2
-
l1
);
File
file
=
new
File
(
bbgx
.
getAppGxwjwz
());
InputStream
inputStream
=
new
FileInputStream
(
file
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"智慧警务app"
+
version
+
".apk"
,
"UTF-8"
));
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
IOUtils
.
copy
(
inputStream
,
outputStream
);
...
...
@@ -67,15 +69,16 @@ public class AppBbgxServiceImpl extends ServiceImpl<AppBbgxMapper, AppBbgx> impl
}
catch
(
Exception
ignored
)
{
}
long
l3
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
l3
-
l2
);
}
@Override
public
String
fileUpload
(
String
version
,
String
gxbz
,
MultipartFile
file
)
throws
IOException
{
byte
[]
bytes
=
file
.
getBytes
();
public
String
fileUpload
(
String
version
,
String
gxbz
,
String
wjwz
)
{
AppBbgx
bbgx
=
new
AppBbgx
();
bbgx
.
setAppVersion
(
version
);
bbgx
.
setAppGxbz
(
gxbz
);
bbgx
.
setAppGxwj
(
bytes
);
bbgx
.
setAppGxwj
wz
(
wjwz
);
int
insert
;
try
{
insert
=
appBbgxMapper
.
insert
(
bbgx
);
...
...
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