Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
27eddd52
Commit
27eddd52
authored
Jan 06, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 绿波诱导查询历史下发文件
parent
f40d31e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
InduceSendController.java
...net/wanji/opt/controller/induce/InduceSendController.java
+40
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/induce/InduceSendController.java
View file @
27eddd52
...
...
@@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.ws.rs.core.MediaType
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -153,6 +154,45 @@ public class InduceSendController {
.
body
(
"程序查询错误请联系管理员"
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
}
@ApiOperation
(
value
=
"根据设备编号和发布时间获取诱导发布图片"
,
notes
=
"根据设备编号和发布时间获取诱导发布图片"
)
@GetMapping
(
value
=
"/fileCodeHist"
)
public
ResponseEntity
<
byte
[]>
ftpFileByCodeAndTime
(
@RequestParam
(
"equipCode"
)
String
equipCode
,
@RequestParam
(
"date"
)
Date
date
)
{
LambdaQueryWrapper
<
InduceHist
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
InduceHist:
:
getEquipCode
,
equipCode
);
queryWrapper
.
le
(
InduceHist:
:
getCreateTime
,
date
);
queryWrapper
.
orderByDesc
(
InduceHist:
:
getCreateTime
);
queryWrapper
.
last
(
"limit 1"
);
InduceHist
pictureFile
=
this
.
induceHistService
.
getOne
(
queryWrapper
,
false
);
if
(
Objects
.
isNull
(
pictureFile
)
||
pictureFile
.
getFilePath
()
==
null
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
"无效的文件ID"
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
try
{
// 获取ftp服务器图片
byte
[]
imageBytes
=
this
.
induceSendService
.
downloadImage
(
pictureFile
.
getFilePath
());
if
(
imageBytes
!=
null
&&
imageBytes
.
length
>
0
)
{
// 设置响应头
HttpHeaders
headers
=
new
HttpHeaders
();
// 图片类型
headers
.
set
(
"Content-Type"
,
"image/jpeg"
);
// 设置内容长度
headers
.
set
(
"Content-Length"
,
String
.
valueOf
(
imageBytes
.
length
));
// 设置文件名
headers
.
set
(
"Content-Disposition"
,
"inline; filename=\""
+
pictureFile
.
getSourceId
()
+
".bmp\""
);
// 返回响应
return
new
ResponseEntity
<>(
imageBytes
,
headers
,
HttpStatus
.
OK
);
}
else
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
"未查询到对应文件"
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
}
catch
(
IOException
e
)
{
log
.
error
(
"ftp文件下载失败: "
,
e
.
getMessage
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
body
(
"程序查询错误请联系管理员"
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
}
/**
* 获取ftp图片
*/
...
...
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