From 836ec39fdad422b1a148699a4c5fb8c5b4d395f0 Mon Sep 17 00:00:00 2001
From: zuoxiao <lf_zuo@163.com>
Date: 星期三, 25 六月 2025 11:04:33 +0800
Subject: [PATCH] feat(card): 添加管理类型卡写卡功能并优化卡片相关逻辑- 在 OperateTypeENUM 中添加 SUPPLEMENT 和 MANAGEMENT_CARD_WRITE 枚举值 - 在 SeManagementCard 中添加 cancelTime 和 state 字段 - 更新相关 mapper 和 XML 文件以支持新增字段 - 修改 CardSv 中的回调处理逻辑,支持管理类型卡写卡 - 优化 CreateManagementCardDto 中识别码的示例值

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java
new file mode 100644
index 0000000..176dd63
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java
@@ -0,0 +1,43 @@
+package com.dy.pipIrrSell.util;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @author ZhuBaoMin
+ * @date 2024-03-06 11:47
+ * @LastEditTime 2024-03-06 11:47
+ * @Description
+ */
+public class HmacSha256 {
+    public static String getSignature(String secretKey, String data) throws NoSuchAlgorithmException, InvalidKeyException {
+        // 鍒涘缓瀵嗛挜瀵硅薄
+        byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8);
+        SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "HmacSHA256");
+
+        // 鍒涘缓Mac瀵硅薄骞跺垵濮嬪寲
+        Mac mac = Mac.getInstance("HmacSHA256");
+        mac.init(secretKeySpec);
+
+        // 灏嗗緟鍔犲瘑鐨勬暟鎹浆鎹负瀛楄妭鏁扮粍
+        byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
+
+        // 浣跨敤瀵嗛挜瀵规暟鎹繘琛屽姞瀵�
+        byte[] encryptedBytes = mac.doFinal(dataBytes);
+
+        // 灏嗗姞瀵嗗悗鐨勭粨鏋滆浆鎹负鍗佸叚杩涘埗瀛楃涓�
+        StringBuilder hexString = new StringBuilder();
+        for (byte b : encryptedBytes) {
+            String hex = Integer.toHexString(0xff & b);
+            if (hex.length() == 1) {
+                hexString.append('0');
+            }
+            hexString.append(hex);
+        }
+        String hmacSha256 = hexString.toString();
+        return hmacSha256;
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0