|
@@ -22,6 +22,7 @@ import top.lvzhiqiang.util.StringUtils;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
@@ -328,7 +329,16 @@ public class BgServiceImpl implements BgService {
|
|
|
|
|
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
Connection.Response response = Jsoup.connect(href).method(Connection.Method.GET).ignoreContentType(true).timeout(50 * 1000).execute();
|
|
|
- String fileName = issueDate.concat(" ").concat(h3).concat(".jpg");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ String fileName = issueDate.concat(" ").concat(h3);
|
|
|
|
|
+ byte[] imgUrlBytes = fileName.getBytes(StandardCharsets.UTF_8);
|
|
|
|
|
+ if (imgUrlBytes.length > 251) {
|
|
|
|
|
+ byte[] imgUrlDestBytes = new byte[251];
|
|
|
|
|
+ System.arraycopy(imgUrlBytes, 0, imgUrlDestBytes, 0, 251);
|
|
|
|
|
+ fileName = new String(imgUrlDestBytes, StandardCharsets.UTF_8).replace("�","");
|
|
|
|
|
+ }
|
|
|
|
|
+ fileName = fileName.concat(".jpg");
|
|
|
|
|
+
|
|
|
saveFile(response.bodyStream(), machiPath.concat(fileName));
|
|
saveFile(response.bodyStream(), machiPath.concat(fileName));
|
|
|
long end = System.currentTimeMillis();
|
|
long end = System.currentTimeMillis();
|
|
|
|
|
|