|
|
|
@ -15,6 +15,7 @@ import org.apache.http.client.ClientProtocolException;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@ -51,15 +52,17 @@ public class PictureImgToLocalTask implements Runnable {
|
|
|
|
|
this.pictureImgToLocal = pictureImgToLocal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public static String api_test2_identify_url="http://127.0.0.1:7003/semantic";
|
|
|
|
|
public static String api_test2_identify_url="http://47.93.59.251/semantic/semantic";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
OcrPictureService ocrPictureService = SpringUtils.getBean("ocrPictureService");
|
|
|
|
|
OcrPicture picture = ocrPictureService.getById(pictureImgToLocal.getPictureId());
|
|
|
|
|
//1.开始转储图片
|
|
|
|
|
Boolean result = DownloadImgUtil.downloadImage(pictureImgToLocal.getImgUrl(), pictureImgToLocal.getLocalPath());
|
|
|
|
|
Boolean result = true;
|
|
|
|
|
//检查是否已经存在本地图片,存在则不进行转储了。
|
|
|
|
|
File file = new File(pictureImgToLocal.getLocalPath());
|
|
|
|
|
if(!file.isFile()){
|
|
|
|
|
result = DownloadImgUtil.downloadImage(pictureImgToLocal.getImgUrl(), pictureImgToLocal.getLocalPath());
|
|
|
|
|
}
|
|
|
|
|
if (Boolean.TRUE.equals(result)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(picture)) {
|
|
|
|
|
picture.setLocalpictrueurl(pictureImgToLocal.getLocalPath());
|
|
|
|
|