|
@@ -60,7 +60,7 @@ public class OcrServiceImpl implements OcrService {
|
|
|
log.info("step ***2: ocr***");
|
|
|
data = fileType.equals("18") ? ParseUtils.changeSourceDataBy18(data) : data;
|
|
|
Map<String,Object> ocrMap = toOcrMap(reqId,fileType,url,fileName,data,startTime);
|
|
|
- log.info("match pre:{}",JSON.toJSONString(ocrMap));
|
|
|
+ log.info("match-pre,only ocr:{}",JSON.toJSONString(ocrMap));
|
|
|
if (null != ocrMap && ocrMap.containsKey("req_id")){
|
|
|
// 3、用户画像相似匹配。
|
|
|
linkService.match(ocrMap.get("req_id").toString(),ocrMap.get("type").toString(),startTime,
|
|
@@ -69,6 +69,9 @@ public class OcrServiceImpl implements OcrService {
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
String excTime = DateUtils.getExcTime(startTime, endTime);
|
|
|
log.info("match exctime:{}",excTime);
|
|
|
+ }else{
|
|
|
+ // backService.back(fileType,reqId,startTime,new JSONObject());
|
|
|
+ log.info("step 2 error,maybe ocrmap null....");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -151,7 +154,7 @@ public class OcrServiceImpl implements OcrService {
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
log.info("step2 ocr excTime:{}", DateUtils.getExcTime(startTime,endTime));
|
|
|
log.info("ocr-mid res:{}", JSON.toJSONString(ocr));
|
|
|
- if (null != ocr && ocr.get("image_status").toString().equals("normal")) {
|
|
|
+ if (null != ocr && ocr.containsKey("image_status") && ocr.get("image_status").toString().equals("normal")) {
|
|
|
// 解析ocr数据。
|
|
|
JSONObject midOcr = new JSONObject();
|
|
|
String ocrData = "";
|
|
@@ -274,8 +277,6 @@ public class OcrServiceImpl implements OcrService {
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
public void singleFileOcr(String reqId, String fileType, FileDetails parsedFilePath, List<FileDetails> paths, String sourceData,Long startTime) {
|
|
|
- System.err.println(JSON.toJSONString(parsedFilePath));
|
|
|
- System.err.println("paths>"+JSON.toJSONString(paths));
|
|
|
Map<String, Object> matchMap = new HashMap<>();
|
|
|
Map<String, Object> ocrMap = new HashMap<>();
|
|
|
sourceData = fileType.equals("18") ? ParseUtils.changeSourceDataBy18(sourceData) : sourceData;
|
|
@@ -286,7 +287,7 @@ public class OcrServiceImpl implements OcrService {
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
log.info("ocr excTime:{}", DateUtils.getExcTime(startTime,endTime));
|
|
|
log.info("ocr-mid res:{}", JSON.toJSONString(ocr));
|
|
|
- if (null != ocr && ocr.get("image_status").toString().equals("normal")) {
|
|
|
+ if (null != ocr && ocr.containsKey("image_status") && ocr.get("image_status").toString().equals("normal")) {
|
|
|
// 解析ocr数据。
|
|
|
JSONObject midOcr = new JSONObject();
|
|
|
String ocrData = "";
|
|
@@ -315,7 +316,7 @@ public class OcrServiceImpl implements OcrService {
|
|
|
JSONObject midOcr = fileType.equals("10") ? ParseUtils.midOcrFront(false,"-1",fileType,"")
|
|
|
: ParseUtils.midOcrReverse(false,"-1",fileType,"");
|
|
|
uploadService.saveBack(backService.getNullBackResData(reqId, fileType),JSON.toJSONString(midOcr),startTime);
|
|
|
- boolean flag = null != ocr ? ocr.get("image_status").equals("non_idcard") ? true : false : false;
|
|
|
+ boolean flag = null != ocr ? ocr.containsKey("image_status") ? ocr.get("image_status").equals("non_idcard") ? true : false : false : false;
|
|
|
back(backService.getNullBackResData(reqId, fileType), reqId, fileType, flag ? "-1" : "0");
|
|
|
endTime = System.currentTimeMillis();
|
|
|
log.info("ocr back excTime:{}", DateUtils.getExcTime(startTime,endTime));
|