13 changed files with 162 additions and 23 deletions
@ -0,0 +1,30 @@
|
||||
package com.biutag.outer.config; |
||||
|
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.web.cors.CorsConfiguration; |
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
import org.springframework.web.filter.CorsFilter; |
||||
|
||||
/** |
||||
* @author wxc |
||||
* @date 2025/9/30 |
||||
*/ |
||||
@Configuration |
||||
public class CorsConfig { |
||||
|
||||
@Bean |
||||
public CorsFilter corsFilter() { |
||||
CorsConfiguration config = new CorsConfiguration(); |
||||
config.addAllowedOriginPattern("*"); |
||||
config.addAllowedMethod("*"); |
||||
config.addAllowedHeader("*"); |
||||
config.setAllowCredentials(true); |
||||
config.setMaxAge(3600L); |
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||
source.registerCorsConfiguration("/**", config); |
||||
return new CorsFilter(source); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,14 @@
|
||||
package com.biutag.outer.enums; |
||||
|
||||
/** |
||||
* @author wxc |
||||
* @date 2025/9/28 |
||||
*/ |
||||
public enum RealLvlEnum { |
||||
|
||||
RC01, |
||||
RC02, |
||||
RC03, |
||||
RC04, |
||||
RC05; |
||||
} |
||||
@ -0,0 +1,38 @@
|
||||
package com.biutag.outer; |
||||
|
||||
import cn.hutool.crypto.asymmetric.KeyType; |
||||
import cn.hutool.crypto.asymmetric.RSA; |
||||
import cn.hutool.http.HttpResponse; |
||||
import cn.hutool.http.HttpUtil; |
||||
import com.alibaba.fastjson2.JSON; |
||||
import com.alibaba.fastjson2.JSONObject; |
||||
import com.biutag.outer.domain.vo.XybUserInfo; |
||||
import com.biutag.outer.util.XybApi; |
||||
import org.junit.jupiter.api.Test; |
||||
|
||||
/** |
||||
* @author wxc |
||||
* @date 2025/9/28 |
||||
*/ |
||||
public class XybTest { |
||||
|
||||
@Test |
||||
public void test() { |
||||
String accessLink = "code_if8dCnu8TgyTk-USgkzH_Q"; |
||||
String url = String.format("https://mycs.csbtv.com/my-exclusive-api/xyb/getXybUserInfo?accessLink=%s&clientId=%s", accessLink, |
||||
"VON6F9E15L"); |
||||
HttpResponse httpResponse = HttpUtil.createGet(url) |
||||
.execute(); |
||||
if (!httpResponse.isOk()) { |
||||
throw new RuntimeException("湘易办服务异常"); |
||||
} |
||||
System.out.println(httpResponse.body()); |
||||
JSONObject response = JSON.parseObject(httpResponse.body()); |
||||
RSA rsaPri = new RSA(null, "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFBLOuFMyRN9QR2oqAwaWbrICn83E0JEP5n+8LFet0Dlj11nvzCmJTUCuy0Dx2YDa2lhr/b+CvjWy/qqdb7wbKJSo9z8MvkAAC/uEWaKsludTL8EUWttlwiXJZmMfj5QMOVfCbVCpI91+rBcWRR8Vg5MQGqDh0ZA4ym5j6mGYyRwIDAQAB"); |
||||
String jsonStr = rsaPri.decryptStr(response.getString("data"), KeyType.PublicKey); |
||||
// String jsonStr = rsaPri.decryptStr("HdLGrWa3fg1hBdYpQHhpG9L1QMi2FnhN6ZsXzEXumXnPnwDauG7t2efZ2eFIM7kifFurXU6DftULecezi2ouUVzWyqMffBfZDzlPrapQgQcAVpV8N8VMEH8FwgiAg0yjP9AwdKpsfOGhiEGkascaj2U99gpqNL4P02Vdz67sbnVmkjD3VWOZkh6P5h1i12ldEZTdoLmYT24V5n4QnK7O63oSIDMzaOH1A8ZhBKpYuG0XqzvklpHpllthqajMsAtXN3RFcXmvzQX8aIm9QHDECHl4syl1SJgegdJuyngbFzOkmUrBLVSRrBBRsHXMTg/Iydb9cC3CkyNlLEHqCgJwGg==", KeyType.PublicKey);
|
||||
XybUserInfo xybUserInfo = JSON.parseObject(jsonStr, XybUserInfo.class); |
||||
System.out.println(xybUserInfo); |
||||
|
||||
} |
||||
} |
||||
Loading…
Reference in new issue