Commit e610b5b0 by xmh

<feat>修正pom文件,导出超链接测试

1 parent 86f9720e
......@@ -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
......@@ -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
......@@ -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
......@@ -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
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;
}
......@@ -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 + "\")";
}
}
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();
......
......@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!