Kaynağa Gözat

发票手机条码校验增加测试环境跳过开关

- OrderInvoiceService 新增 barcodeCheckEnabled(@Value ezpay.barcode-check,默认 true)
- PHONE_BARCODE 分支用开关包裹联网校验,测试环境 false 跳过
- application.yml ezpay 段新增 barcode-check: false(测试环境值,正式改 true)

Co-Authored-By: Claude <noreply@anthropic.com>
qmj 1 saat şu andan
ebeveyn
işleme
f96c92faef

+ 14 - 8
ruoyi-admin/src/main/java/com/ruoyi/app/order/OrderInvoiceService.java

@@ -70,6 +70,10 @@ public class OrderInvoiceService {
     @Value("${ezpay.base-url}")
     private String ezpayBaseUrl;
 
+    /** 手机条码联网校验开关:测试环境 false 跳过(ezPay 测试网关无真实条码数据,会误判为不存在),正式环境 true 开启 */
+    @Value("${ezpay.barcode-check:true}")
+    private boolean barcodeCheckEnabled;
+
     /** 发票状态:0未开/1已开/2失败/3作废 */
     private static final int STATUS_NOT_ISSUED = 0;
     private static final int STATUS_ISSUED = 1;
@@ -589,14 +593,16 @@ public class OrderInvoiceService {
                 if (barCfg == null) {
                     throw new ServiceException(MessageUtils.message("no.invoice.store.notsupport.barcode"));
                 }
-                boolean barExist;
-                try {
-                    barExist = ezPay.checkBarCode(ezpayBaseUrl, barCfg, carrierNum);
-                } catch (Exception e) {
-                    throw new ServiceException(MessageUtils.message("no.invoice.barcode.service.unavailable"));
-                }
-                if (!barExist) {
-                    throw new ServiceException(MessageUtils.message("no.invoice.barcode.notexist"));
+                if (barcodeCheckEnabled) {
+                    boolean barExist;
+                    try {
+                        barExist = ezPay.checkBarCode(ezpayBaseUrl, barCfg, carrierNum);
+                    } catch (Exception e) {
+                        throw new ServiceException(MessageUtils.message("no.invoice.barcode.service.unavailable"));
+                    }
+                    if (!barExist) {
+                        throw new ServiceException(MessageUtils.message("no.invoice.barcode.notexist"));
+                    }
                 }
                 break;
             case "CITIZEN":

+ 2 - 0
ruoyi-admin/src/main/resources/application.yml

@@ -21,6 +21,8 @@ ruoyi:
 ezpay:
   # 开票/作废根地址(测试环境 cinv.ezpay.com.tw;上线改 https://inv.ezpay.com.tw)
   base-url: https://cinv.ezpay.com.tw
+  # 手机条码联网校验:测试环境 false(ezPay 测试网关无真实条码数据,会误判为不存在),正式环境改 true
+  barcode-check: false
 
 # 蓝新金流(NewebPay)线上支付配置
 newebpay: