|
|
|
@ -4,10 +4,12 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.core.util.StopWatch;
|
|
|
|
|
import com.docus.server.api.ocr.OcrApi;
|
|
|
|
|
import com.docus.server.vo.ocr.Datas;
|
|
|
|
|
import com.docus.server.vo.ocr.OcrResponse;
|
|
|
|
|
import com.docus.server.vo.ocr.Sort;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -18,6 +20,7 @@ import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class OcrServiceImpl implements OcrApi {
|
|
|
|
|
|
|
|
|
|
@Value("${ocr.api-url:http://192.168.16.85:9999/uploadfile}")
|
|
|
|
@ -25,8 +28,13 @@ public class OcrServiceImpl implements OcrApi {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getText(String path) {
|
|
|
|
|
|
|
|
|
|
StopWatch watch = new StopWatch();
|
|
|
|
|
|
|
|
|
|
OcrResponse response = ocr(path);
|
|
|
|
|
|
|
|
|
|
log.info("ocr请求截图耗时:{}ms,请求图片地址:{}", watch.elapsedTime(), path);
|
|
|
|
|
|
|
|
|
|
List<Datas> datas = response.getDatas();
|
|
|
|
|
|
|
|
|
|
List<String> texts = new ArrayList<>();
|
|
|
|
|