소스 검색

修改订单列表待支付去掉已取消的订单

qmj 1 개월 전
부모
커밋
0810fc72a4

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 45 - 0
.claude/homunculus/observations.jsonl


+ 9 - 1
ruoyi-admin/src/main/java/com/ruoyi/app/order/OrderInvoiceService.java

@@ -448,7 +448,15 @@ public class OrderInvoiceService {
                 saveOrUpdate(row);
                 return 1;
             }
-            throw new ServiceException("作废失败:" + (resp == null ? "ezPay 无回应" : resp.getString("Message")));
+            // ezPay 回非 SUCCESS 且消息含「已作廢」:该票在 ezPay 端已是作废态,本地对齐成作废,
+            // 避免与 ezPay 不同步时(如作废后 retry 复活死票)陷入「再作废也改不回 status」的死锁
+            String msg = resp == null ? "" : resp.getString("Message");
+            if (msg != null && msg.contains("已作廢")) {
+                row.setInvoiceStatus(STATUS_INVALID);
+                saveOrUpdate(row);
+                return 1;
+            }
+            throw new ServiceException("作废失败:" + (resp == null ? "ezPay 无回应" : msg));
         } catch (ServiceException se) {
             throw se;
         } catch (Exception e) {

+ 13 - 7
ruoyi-admin/src/main/java/com/ruoyi/app/utils/ezPay/EzPay.java

@@ -100,10 +100,7 @@ public class EzPay {
         postData.put("RespondType", "JSON");
         postData.put("Version", "1.5");
         postData.put("Status", "1"); // 1=即时开立
-        log.info("[EzPay] invoice_issue 请求明文参数: {}", postData);
-        JSONObject resp = doPost(baseUrl + URL_ISSUE, config, postData);
-        log.info("[EzPay] invoice_issue 回应: {}", resp);
-        return resp;
+        return doPost(baseUrl + URL_ISSUE, config, postData);
     }
 
     /**
@@ -174,8 +171,10 @@ public class EzPay {
         String query = buildQuery(postData);
         String postDataHex = EzPayEncryptUtil.encrypt(query, config.getHashKey(), config.getHashIV());
         String checkValue = EzPayEncryptUtil.genCheckValue(postDataHex, config.getHashKey(), config.getHashIV());
+        log.info("[EzPay] checkBarCode 全量参数 >>> MerchantID={}, Version=1.0, RespondType=JSON, "
+                + "PostData明文={}, PostData密文={}, CheckValue={}",
+                config.getMerchantId(), postData, postDataHex, checkValue);
         String resp = postFormWithCheck(baseUrl + URL_CHECK_BARCODE, config.getMerchantId(), "1.0", "JSON", postDataHex, checkValue);
-        log.info("[EzPay] checkBarCode barCode={}, resp={}", barCode, resp);
 
         JSONObject json = JSON.parseObject(resp);
         if (json == null || !"SUCCESS".equals(json.getString("Status"))) {
@@ -204,6 +203,7 @@ public class EzPay {
      */
     public JSONObject doPost(String fullUrl, EzPayConfig config, Map<String, Object> postData) throws Exception {
         postData.put("TimeStamp", String.valueOf(System.currentTimeMillis() / 1000L));
+        log.info("[EzPay] doPost 明文 >>> url={}, 明文参数={}", fullUrl, postData);
         String query = buildQuery(postData);
         String postDataEncrypted = EzPayEncryptUtil.encrypt(query, config.getHashKey(), config.getHashIV());
         String resp = postForm(fullUrl, config.getMerchantId(), postDataEncrypted);
@@ -239,9 +239,12 @@ public class EzPay {
         params.add(new BasicNameValuePair("PostData_", postData));
         HttpPost post = new HttpPost(url);
         post.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8));
+        log.info("[EzPay] postForm >>> url={}, body={}", url, EntityUtils.toString(post.getEntity(), StandardCharsets.UTF_8));
         try (CloseableHttpClient client = HttpClients.createDefault();
              CloseableHttpResponse res = client.execute(post)) {
-            return EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
+            String resp = EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
+            log.info("[EzPay] postForm <<< resp={}", resp);
+            return resp;
         }
     }
 
@@ -259,9 +262,12 @@ public class EzPay {
         params.add(new BasicNameValuePair("CheckValue", checkValue));
         HttpPost post = new HttpPost(url);
         post.setEntity(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8));
+        log.info("[EzPay] postFormWithCheck >>> url={}, body={}", url, EntityUtils.toString(post.getEntity(), StandardCharsets.UTF_8));
         try (CloseableHttpClient client = HttpClients.createDefault();
              CloseableHttpResponse res = client.execute(post)) {
-            return EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
+            String resp = EntityUtils.toString(res.getEntity(), StandardCharsets.UTF_8);
+            log.info("[EzPay] postFormWithCheck <<< resp={}", resp);
+            return resp;
         }
     }
 }

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.