Commit de6e6741 authored by wdy's avatar wdy

车型试验原始记录转为图片

parent 20424dcd
...@@ -844,12 +844,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -844,12 +844,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
return testSchemeId; return testSchemeId;
} }
/**
* pdf转图片
* @param request
* @return
* @throws IOException
*/
@Override @Override
public String getPicture(TaskPictureRequest request) throws IOException { public String getPicture(TaskPictureRequest request) throws IOException {
Task task = taskMapper.selectById(request.getTaskId()); Task task = taskMapper.selectById(request.getTaskId());
if (task.getPictureUrl() != null) { if (!Objects.equals(task.getPictureUrl(), "") && task.getPictureUrl() != null) {
return task.getPictureUrl(); return task.getPictureUrl();
} else { } else {
String pictureUrl = processRemotePDF(request.getUrl()); String pictureUrl = processRemotePDF(request.getUrl());
...@@ -860,6 +866,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -860,6 +866,12 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
} }
} }
/**
* pdf转图片
* @param urlStr
* @return
* @throws IOException
*/
public String processRemotePDF(String urlStr) throws IOException { public String processRemotePDF(String urlStr) throws IOException {
URL url = new URL(urlStr); URL url = new URL(urlStr);
String pictureUrl = ""; String pictureUrl = "";
......
...@@ -24,17 +24,20 @@ public class TestPdfBox { ...@@ -24,17 +24,20 @@ public class TestPdfBox {
private static String bucketName = "vehicle-quality-review-oss"; private static String bucketName = "vehicle-quality-review-oss";
// @Value("${minio.url}") // @Value("${minio.url}")
private static String minioEndpoint = "http://106.3.99.64:22013"; // private static String minioEndpoint = "http://106.3.99.64:22013";
private static String minioEndpoint = "http://10.12.48.79:22038";
// @Value("${minio.accessKey}") // @Value("${minio.accessKey}")
private static String accessKey = "FNGqDZnHJhrugLlZBh77"; // private static String accessKey = "FNGqDZnHJhrugLlZBh77";
private static String accessKey = "jockOVg2UG0dy2GZ";
// @Value("${minio.secretKey}") // @Value("${minio.secretKey}")
private static String secretKey = "TvnWeQxAQ1OYiAN68qlzEDJl5RqZ7tQYTMJ8XM0M"; // private static String secretKey = "TvnWeQxAQ1OYiAN68qlzEDJl5RqZ7tQYTMJ8XM0M";
private static String secretKey = "AIZ4Ppls4xYrheSZfik8vbq4v6i1wm7m";
@Test @Test
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String url = "http://106.3.99.64:22013/vehicle-quality-review-oss/2024/06/14/车型审查原始记录-202406141755.pdf"; String url = "http://10.12.48.79:22038/vehicle-quality-review-oss/2024/06/24/车型审查原始记录-202406241741.pdf";
String pictureUrl = processRemotePDF(url); String pictureUrl = processRemotePDF(url);
System.out.println(pictureUrl); System.out.println(pictureUrl);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment