Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
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
常超
map-parent
Commits
12645d41
Commit
12645d41
authored
Nov 18, 2022
by
宋珺琪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
他是谁他在哪儿入参修改
parent
b6690163
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
2 deletions
+73
-2
common/common_utils/src/main/java/com/founder/commonutils/model/vo/param/SkTrailParam.java
+4
-0
common/common_utils/src/main/java/com/founder/commonutils/util/Base64Util.java
+43
-0
service/publicapi/src/main/java/com/founder/publicapi/controller/SkDataOperation/SkRxController.java
+14
-1
service/publicapi/src/main/java/com/founder/publicapi/controller/SkDataOperation/SkTrailController.java
+12
-1
No files found.
common/common_utils/src/main/java/com/founder/commonutils/model/vo/param/SkTrailParam.java
View file @
12645d41
...
...
@@ -108,6 +108,10 @@ public class SkTrailParam {
* 照片二进制
*/
private
MultipartFile
[]
files
;
/**
* 照片Http
*/
private
String
httpFiles
;
private
int
week
;
private
int
hour
;
...
...
common/common_utils/src/main/java/com/founder/commonutils/util/Base64Util.java
View file @
12645d41
...
...
@@ -5,8 +5,13 @@ import org.springframework.web.multipart.MultipartFile;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.Base64
;
/**
* Base64加密,解密
...
...
@@ -67,5 +72,42 @@ public class Base64Util {
}
/**
* 将网络路径图片转为base64的格式
* @param requestUrl 请求网络路径
* @param photoType 响应的格式(png,jpg,ico等)
* @throws Exception
*/
public
static
String
getUrlImageToBase64
(
String
requestUrl
,
String
photoType
)
throws
Exception
{
ByteArrayOutputStream
data
=
new
ByteArrayOutputStream
();
try
{
// 创建URL
URL
url
=
new
URL
(
requestUrl
);
byte
[]
by
=
new
byte
[
1024
];
// 创建链接
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
conn
.
setRequestMethod
(
"GET"
);
conn
.
setConnectTimeout
(
5
*
1000
);
InputStream
is
=
conn
.
getInputStream
();
// 将内容读取内存中
int
len
=
-
1
;
while
((
len
=
is
.
read
(
by
))
!=
-
1
)
{
data
.
write
(
by
,
0
,
len
);
}
// 关闭流
is
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
// 对字节数组Base64编码
Base64
.
Encoder
encoder
=
Base64
.
getEncoder
();
return
"data:image/"
+
photoType
+
";base64,"
+
encoder
.
encodeToString
(
data
.
toByteArray
());
}
}
\ No newline at end of file
service/publicapi/src/main/java/com/founder/publicapi/controller/SkDataOperation/SkRxController.java
View file @
12645d41
...
...
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSONArray;
import
com.baomidou.mybatisplus.extension.api.ApiController
;
import
com.founder.commonutils.model.newPublicEntity.MapRestResult
;
import
com.founder.commonutils.model.vo.param.SkTrailParam
;
import
com.founder.commonutils.util.Base64Util
;
import
com.founder.commonutils.util.JsonUtils
;
import
com.founder.servicebase.logs.OperLog
;
import
com.founder.servicebase.logs.OperationType
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
...
...
@@ -27,7 +29,18 @@ public class SkRxController extends ApiController {
@PostMapping
(
"queryRxbd"
)
@ApiOperation
(
value
=
"以人侦查_Ta是谁"
)
@OperLog
(
message
=
"以人侦查_Ta是谁"
,
operation
=
OperationType
.
QUERY
)
public
MapRestResult
queryRxgj
(
SkTrailParam
sktrailParam
)
{
public
MapRestResult
queryRxgj
(
SkTrailParam
sktrailParam
)
throws
Exception
{
if
(
sktrailParam
.
getHttpFiles
()!=
null
){
String
httpfile
=
Base64Util
.
getUrlImageToBase64
(
sktrailParam
.
getHttpFiles
(),
"jpg"
);
System
.
out
.
println
(
httpfile
);
}
if
(
sktrailParam
.
getFiles
()!=
null
){
for
(
MultipartFile
file
:
sktrailParam
.
getFiles
())
{
String
photo
=
"data:image/jpg;base64,"
+
Base64Util
.
getBase64
(
file
);
System
.
out
.
println
(
photo
);
}
}
JSONArray
jsonArray
=
new
JSONArray
();
try
{
jsonArray
=
JsonUtils
.
readJsonFromClassPath
(
"data/getRxbd.json"
,
JSONArray
.
class
);
...
...
service/publicapi/src/main/java/com/founder/publicapi/controller/SkDataOperation/SkTrailController.java
View file @
12645d41
...
...
@@ -408,7 +408,18 @@ public class SkTrailController extends ApiController implements ExcelControllerI
@PostMapping
(
"queryRxgj"
)
@ApiOperation
(
value
=
"以人侦查_Ta在哪"
)
@OperLog
(
message
=
"以人侦查_Ta在哪"
,
operation
=
OperationType
.
QUERY
)
public
MapRestResult
queryRxgj
(
SkTrailParam
sktrailParam
)
{
public
MapRestResult
queryRxgj
(
SkTrailParam
sktrailParam
)
throws
Exception
{
if
(
sktrailParam
.
getHttpFiles
()!=
null
){
String
httpfile
=
Base64Util
.
getUrlImageToBase64
(
sktrailParam
.
getHttpFiles
(),
"jpg"
);
System
.
out
.
println
(
httpfile
);
}
if
(
sktrailParam
.
getFiles
()!=
null
){
for
(
MultipartFile
file
:
sktrailParam
.
getFiles
())
{
String
photo
=
"data:image/jpg;base64,"
+
Base64Util
.
getBase64
(
file
);
System
.
out
.
println
(
photo
);
}
}
//分页
Page
page
=
new
Page
(
sktrailParam
.
getPage
(),
sktrailParam
.
getPageSize
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
...
...
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