|
@@ -99,7 +99,7 @@ public class OwnBillServiceImpl implements IOwnBillService {
|
|
|
System.out.print("发票文字提取结果==========>" + result);
|
|
|
ZcInvoiceInf zcInvoiceInf = new ZcInvoiceInf();
|
|
|
//校验返回结果是否成功
|
|
|
- if (result != null && result.get(WORDS_RESULT) != null) {
|
|
|
+ try{
|
|
|
JSONObject wordsResult = result.getJSONObject(WORDS_RESULT);
|
|
|
//时间格式化
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
|
@@ -139,6 +139,8 @@ public class OwnBillServiceImpl implements IOwnBillService {
|
|
|
String totalAmount = wordsResult.getString("TotalAmount");
|
|
|
zcInvoiceInf.setZiiExcludedAmount(totalAmount);
|
|
|
zcInvoiceInf.setZiiTotalAmount(totalAmount);
|
|
|
+ }catch(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
//返回获取文字后的发票信息
|
|
|
return zcInvoiceInf;
|
|
@@ -177,15 +179,21 @@ public class OwnBillServiceImpl implements IOwnBillService {
|
|
|
JSONObject result = OcrUtil.invoiceVerification(getToken(), no, number, date, checkCode, type, amount);
|
|
|
System.out.println("发票验真结果==========>" + result);
|
|
|
//返回结果校验是否成功
|
|
|
- if (result != null
|
|
|
- && result.get(WORDS_RESULT) != null
|
|
|
- && VERIFY_SUCCESS.equals(result.getString(VERIFY_RESULT))
|
|
|
- ) {
|
|
|
- //校验成功
|
|
|
- zcInvoiceInf.setZiiCheckStt(CHECK_SUCCESS);
|
|
|
- } else {
|
|
|
+ try{
|
|
|
+ if (result != null
|
|
|
+ && result.get(WORDS_RESULT) != null
|
|
|
+ && VERIFY_SUCCESS.equals(result.getString(VERIFY_RESULT))
|
|
|
+ ) {
|
|
|
+ //校验成功
|
|
|
+ zcInvoiceInf.setZiiCheckStt(CHECK_SUCCESS);
|
|
|
+ } else {
|
|
|
+ //校验失败
|
|
|
+ zcInvoiceInf.setZiiCheckStt(CHECK_ERROR);
|
|
|
+ }
|
|
|
+ }catch(Exception e){
|
|
|
//校验失败
|
|
|
zcInvoiceInf.setZiiCheckStt(CHECK_ERROR);
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
return zcInvoiceInf;
|
|
|
}
|