Commit 19f3f045 19f3f04588f5cb0cd85bffab6606705be592ce5f by wenxin

refactor(dependencies): 更新 fastjson 版本并移除静态资源映射

- 将 fastjson 从 1.2.47 升级到 1.2.83 版本- 移除了 application-test.yml 中的静态资源映射配置
- 删除了 src/main/resources/static/index.html 文件
- 优化了 ApiController 中的 imports 和日志输出
- 移除了 ApiTest 中未使用的 BouncyCastle 相关代码
1 parent 2c871b2e
......@@ -24,6 +24,11 @@
<version>1.5.36</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.26</version>
......
......@@ -2,7 +2,7 @@ package com.topdraw.dockingapi.controller;
import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.digital.szzz.gateway.sdk.api.GatewaySender;
import com.digital.szzz.gateway.sdk.bean.GatewayResponse;
......@@ -85,7 +85,8 @@ public class ApiController {
param.put("appId", appId);
String userId = data.getString("userId");
param.put("userId", userId);
param.put("forceScopes", new JSONArray().fluentAdd("ykb_user_info").fluentAdd("ykb_divide"));
param.put("forceScopes", new com.alibaba.fastjson.JSONArray()
.fluentAdd("ykb_user_info").fluentAdd("ykb_divide"));
Map<String, String> headerMap = new HashMap<>();
return GatewaySender.send(url, appId, method,
iv, appKey, appSecretKey,
......@@ -102,7 +103,7 @@ public class ApiController {
GatewayResponse send = GatewaySender.send(url, appId, method,
iv, appKey, appSecretKey, param, authCode,
headerMap, readTimeout, connTimeout);
log.info("获取手机号返回的结果是:{}", JSONArray.toJSONString(send));
log.info("获取手机号返回的结果是:{}", JSON.toJSONString(send));
String data = send.getData();
return Optional.ofNullable(JSONObject.parseObject(data, JSONObject.class))
.map(t -> t.getJSONObject("data"))
......
......@@ -11,3 +11,8 @@ forest:
key: wmsj2021
server:
port: 7077
spring:
web:
resources:
add-mappings: false
\ No newline at end of file
......
<html lang="zh" xmlns="">
<body>
<h1>hello word!!!</h1>
<p>this is a html page</p>
<div >
test
<div>
test
<table>
<li>1</li>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -2,7 +2,6 @@ package com.topdraw.dockingapi;
import com.topdraw.dockingapi.util.DecryptUtils;
import lombok.SneakyThrows;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.Test;
import javax.crypto.Cipher;
......@@ -18,26 +17,7 @@ import java.security.Security;
public class ApiTest {
@Test
public void testMain() throws Exception {
// 添加BouncyCastle提供者
Security.addProvider(new BouncyCastleProvider());
// 密钥
byte[] keyBytes = "wmsj2021".getBytes(StandardCharsets.UTF_8); // DES密钥长度为8字节
// 需要加密的数据
String text = "{\"phoneNum\":\"13627618074\"}";
byte[] data = text.getBytes(StandardCharsets.UTF_8);
// 创建密钥
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "DES");
// 创建Cipher实例
Cipher cipher = Cipher.getInstance("DES/ECB/PKCS7Padding", "BC");
// 初始化Cipher
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
// 执行加密
byte[] encryptedData = cipher.doFinal(data);
// 打印加密结果(通常加密后的数据进行Base64编码或者十六进制编码显示)
System.out.println("Encrypted Data: " + bytesToHex(encryptedData));
}
// 将字节转换为十六进制字符串
public static String bytesToHex(byte[] bytes) {
......