Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e610b5b0
authored
Dec 03, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<feat>修正pom文件,导出超链接测试
1 parent
86f9720e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
8 deletions
fanxing-forward/pom.xml
fanxing-gateway/pom.xml
fanxing-ops/pom.xml
fanxing-query/pom.xml
fanxing-query/src/main/java/com/viontech/fanxing/query/model/export/ExportBaseModel.java
fanxing-query/src/main/java/com/viontech/fanxing/query/runner/ExportDataJob.java
fanxing-query/src/test/java/com/viontech/fanxing/query/MainTest.java
fanxing-task/pom.xml
fanxing-forward/pom.xml
View file @
e610b5b
...
...
@@ -71,6 +71,9 @@
<include>
**/*.xml
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
fanxing-gateway/pom.xml
View file @
e610b5b
...
...
@@ -64,8 +64,10 @@
<include>
**/*.xml
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
fanxing-ops/pom.xml
View file @
e610b5b
...
...
@@ -55,6 +55,9 @@
<include>
**/*.xml
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
fanxing-query/pom.xml
View file @
e610b5b
...
...
@@ -65,6 +65,9 @@
<include>
**/*.xml
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/model/export/ExportBaseModel.java
View file @
e610b5b
package
com
.
viontech
.
fanxing
.
query
.
model
.
export
;
import
cn.hutool.poi.excel.cell.FormulaCellValue
;
import
lombok.Getter
;
import
lombok.Setter
;
...
...
@@ -13,7 +14,7 @@ import lombok.Setter;
@Getter
@Setter
public
class
ExportBaseModel
{
private
String
picName
;
private
String
videoName
;
private
FormulaCellValue
picName
;
private
FormulaCellValue
videoName
;
private
String
eventTime
;
}
fanxing-query/src/main/java/com/viontech/fanxing/query/runner/ExportDataJob.java
View file @
e610b5b
...
...
@@ -3,6 +3,8 @@ package com.viontech.fanxing.query.runner;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.poi.excel.StyleSet
;
import
cn.hutool.poi.excel.cell.CellSetter
;
import
cn.hutool.poi.excel.cell.FormulaCellValue
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
...
...
@@ -223,7 +225,7 @@ public class ExportDataJob {
// 写入图片文件
if
(
withPic
&&
StringUtils
.
isNotEmpty
(
vo
.
getPics
()))
{
File
file
=
new
File
(
vo
.
getPics
());
o
.
setPicName
(
file
.
getName
(
));
o
.
setPicName
(
new
FormulaCellValue
(
getHyperLink
(
file
.
getName
())
));
if
(
file
.
exists
())
{
try
{
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
file
);
...
...
@@ -238,7 +240,7 @@ public class ExportDataJob {
// 写入视频文件
if
(
withVideo
&&
StringUtils
.
isNotEmpty
(
vo
.
getVideoName
()))
{
File
file
=
new
File
(
vo
.
getVideoName
());
o
.
setVideoName
(
file
.
getName
(
));
o
.
setVideoName
(
new
FormulaCellValue
(
getHyperLink
(
file
.
getName
())
));
if
(
file
.
exists
())
{
try
{
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
file
);
...
...
@@ -305,7 +307,7 @@ public class ExportDataJob {
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
file
);
zipO
.
putNextEntry
(
new
ZipEntry
(
file
.
getName
()));
zipO
.
write
(
bytes
);
o
.
setPicName
(
file
.
getName
(
));
o
.
setPicName
(
new
FormulaCellValue
(
getHyperLink
(
file
.
getName
())
));
}
catch
(
Exception
e
)
{
log
.
error
(
""
,
e
);
}
...
...
@@ -319,7 +321,7 @@ public class ExportDataJob {
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
file
);
zipO
.
putNextEntry
(
new
ZipEntry
(
file
.
getName
()));
zipO
.
write
(
bytes
);
o
.
setVideoName
(
file
.
getName
(
));
o
.
setVideoName
(
new
FormulaCellValue
(
getHyperLink
(
file
.
getName
())
));
}
catch
(
Exception
e
)
{
log
.
error
(
""
,
e
);
}
...
...
@@ -474,4 +476,8 @@ public class ExportDataJob {
return
writer
;
}
private
String
getHyperLink
(
String
str
)
{
return
"HYPERLINK("
+
"\""
+
str
+
"\","
+
"\""
+
str
+
"\")"
;
}
}
fanxing-query/src/test/java/com/viontech/fanxing/query/MainTest.java
View file @
e610b5b
package
com
.
viontech
.
fanxing
.
query
;
import
cn.hutool.poi.excel.cell.FormulaCellValue
;
import
com.viontech.fanxing.commons.model.DictCode
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.vo.TrafficVo
;
...
...
@@ -46,7 +47,7 @@ public class MainTest {
ETrafficModel
e
=
new
ETrafficModel
();
Date
eventTime
=
trafficVo
.
getEventTime
();
e
.
setEventTime
(
DateUtil
.
format
(
DateUtil
.
FORMAT_FULL
,
eventTime
));
e
.
setPicName
(
UUID
.
randomUUID
()
+
".pic"
);
e
.
setPicName
(
new
FormulaCellValue
(
"HYPERLINK(\"https://www.baidu.com/\",\"下载\")"
)
);
e
.
setLocation
(
trafficVo
.
getLocationName
());
e
.
setPlateNumber
(
trafficVo
.
getPlateNumber
());
Map
<
String
,
DictCode
>
vehicleTypeDict
=
opsClientService
.
vehicleTypeDict
();
...
...
fanxing-task/pom.xml
View file @
e610b5b
...
...
@@ -61,6 +61,9 @@
<include>
**/*.xml
</include>
</includes>
</resource>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment