@@ -37,6 +37,8 @@ public class OcrResult extends StringPropertyUUIDEntity { | |||
private OcrType ocrType;// 类型 | |||
@Column(name = "CODE") | |||
private String code; | |||
@Column(name = "MESSAGE") | |||
private String message; | |||
@Column(name = "OCR_SERVICE_TYPE") | |||
private Integer ocrServiceType=1;// 1-百度 2-太极 | |||
// @Column(name = "RESULT_ID") |
@@ -26,10 +26,7 @@ public class BusinessLicenseOcrResponse extends AbstractAtsResponse { | |||
private String regAuthority;//登记机关 | |||
private String type;//类型 | |||
private String code; // 状态码 | |||
private String respCode; // 响应代码 | |||
private String respMessage; // 响应消息 | |||
private String status; // 状态 | |||
private String statusDesc; // 状态描述 | |||
private String ocrResultId; // OCR结果ID | |||
} |
@@ -19,10 +19,7 @@ public class IdCardOcrResponse extends AbstractAtsResponse { | |||
private String enddate; // 失效日期 | |||
private String agency; // 签发机关 | |||
private String code; // 状态码 | |||
private String respCode; // 响应代码 | |||
private String respMessage; // 响应消息 | |||
private String status; // 状态 | |||
private String statusDesc; // 状态描述 | |||
private String ocrResultId; // OCR结果ID | |||
} |
@@ -35,10 +35,7 @@ public class VehicleLicenseOcrResponse extends AbstractAtsResponse { | |||
private String codeNo; // 证芯编号 | |||
private String fuel; // 燃油类型 | |||
private String code; // 状态码 | |||
private String respCode; // 响应代码 | |||
private String respMessage; // 响应消息 | |||
private String status; // 状态 | |||
private String statusDesc; // 状态描述 | |||
private String ocrResultId; // OCR结果ID | |||
private String respCode; // 响应代码 | |||
private String respMessage; // 响应消息 | |||
private String ocrResultId; // OCR结果ID | |||
} |
@@ -7,7 +7,7 @@ import org.springframework.data.jpa.repository.Query; | |||
public interface OcrResultRepo extends AbstractJpaRepo<OcrResult, String>{ | |||
@Query(" from OcrResult where url = ?1 and ocrType = ?2") | |||
@Query(" from OcrResult where url = ?1 and ocrType = ?2 and code='0000'") | |||
OcrResult findByUrlAndType(String url, OcrType ocrType); | |||
} |
@@ -84,7 +84,10 @@ public abstract class AbstractIawManager extends AbstractCommManager { | |||
res.setImageUrl(new MinioUtil().getOuterUrl(res.getImageUrl())); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
throw new ManagerException("身份证OCR识别异常,请手动输入信息"); | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("身份证OCR识别异常,请重新上传照片或手动输入信息"); | |||
} | |||
} | |||
@@ -101,7 +104,10 @@ public abstract class AbstractIawManager extends AbstractCommManager { | |||
res.setImageUrl(new MinioUtil().getOuterUrl(res.getImageUrl())); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
throw new ManagerException("行驶证OCR识别异常,请手动输入信息"); | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("行驶证OCR识别异常,请重新上传照片或手动输入信息"); | |||
} | |||
} | |||
@@ -117,7 +123,10 @@ public abstract class AbstractIawManager extends AbstractCommManager { | |||
res.setImageUrl(new MinioUtil().getOuterUrl(res.getImageUrl())); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
throw new ManagerException("营业执照OCR识别异常,请手动输入信息"); | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("营业执照OCR识别异常,请重新上传照片或手动输入信息"); | |||
} | |||
} | |||
@@ -67,6 +67,9 @@ public abstract class AbstractUserwManager extends AbstractCommManager { | |||
res.setOcrResultId(ocrResult.getId()); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("身份证OCR识别异常"); | |||
} | |||
} | |||
@@ -83,6 +86,9 @@ public abstract class AbstractUserwManager extends AbstractCommManager { | |||
res.setOcrResultId(ocrResult.getId()); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("行驶证OCR识别异常"); | |||
} | |||
} | |||
@@ -98,6 +104,9 @@ public abstract class AbstractUserwManager extends AbstractCommManager { | |||
res.setOcrResultId(ocrResult.getId()); | |||
return res; | |||
} catch (ServiceHandleException e) { | |||
ocrResult.setCode(e.getErrorCode()); | |||
ocrResult.setMessage(e.getMessage()); | |||
ocrResultRepo.save(ocrResult); | |||
throw new ManagerException("营业执照OCR识别异常"); | |||
} | |||
} |
@@ -271,11 +271,8 @@ public class BaiduOcrUtil { | |||
res.setBirthday(birthday); | |||
} | |||
res.setCode("0"); | |||
res.setRespCode("0000"); | |||
res.setRespMessage("ocr识别成功"); | |||
res.setStatus("000000"); | |||
res.setStatusDesc("成功"); | |||
return res; | |||
} catch (Exception e) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("解析百度ocr返回值异常"); | |||
@@ -343,11 +340,8 @@ public class BaiduOcrUtil { | |||
res.setCodeNo(getValue(wordsResultObj, "证芯编号")); | |||
res.setFuel(getValue(wordsResultObj, "燃油类型")); | |||
res.setCode("0"); | |||
res.setRespCode("0000"); | |||
res.setRespMessage("ocr识别成功"); | |||
res.setStatusDesc("成功"); | |||
res.setStatus("000000"); | |||
return res; | |||
} catch (Exception e) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("解析百度ocr返回值异常"); | |||
@@ -390,11 +384,8 @@ public class BaiduOcrUtil { | |||
res.setRegAuthority(getValue(wordsResultObj, "登记机关")); | |||
res.setType(getValue(wordsResultObj, "类型")); | |||
res.setCode("0"); | |||
res.setRespCode("0000"); | |||
res.setRespMessage("ocr识别成功"); | |||
res.setStatusDesc("成功"); | |||
res.setStatus("000000"); | |||
return res; | |||
} catch (Exception e) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("解析百度ocr返回值异常"); |