合并修改
This commit is contained in:
commit
c7346ba476
@ -0,0 +1,6 @@
|
|||||||
|
package com.heyu.api.common;
|
||||||
|
|
||||||
|
public class LogAspect {
|
||||||
|
public static ThreadLocal<String> threadLocalNo = new ThreadLocal();
|
||||||
|
public static ThreadLocal<Long> threadLocalTime = new ThreadLocal();
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.heyu.api.common;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.pattern.ClassicConverter;
|
||||||
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
|
|
||||||
|
public class LogClassicConverter extends ClassicConverter {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String convert(ILoggingEvent event) {
|
||||||
|
if (LogAspect.threadLocalNo != null && LogAspect.threadLocalNo.get() != null) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("[").append(LogAspect.threadLocalNo.get());
|
||||||
|
Long start = LogAspect.threadLocalTime.get();
|
||||||
|
Long end;
|
||||||
|
if (start != null) {
|
||||||
|
end = System.currentTimeMillis();
|
||||||
|
sb.append(",").append(end - start);
|
||||||
|
}
|
||||||
|
sb.append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -88,14 +88,15 @@ public class AuthWebFilter implements WebFilter {
|
|||||||
|
|
||||||
String realIpAddress = getRealIpAddress(request);
|
String realIpAddress = getRealIpAddress(request);
|
||||||
String m = request.getMethod().toString();
|
String m = request.getMethod().toString();
|
||||||
log.info("AuthWebFilter api start time:{} ip:{} method:{} url:{},uri:{} param:{} headers:{}",
|
log.info("AuthWebFilter api start time:{} ip:{} method:{} url:{},uri:{} param:{} headers:{},xForwardedPath:{}",
|
||||||
startTime,
|
startTime,
|
||||||
realIpAddress,
|
realIpAddress,
|
||||||
m,
|
m,
|
||||||
request.getPath(),
|
request.getPath(),
|
||||||
uri,
|
uri,
|
||||||
request.getQueryParams(),
|
request.getQueryParams(),
|
||||||
httpHeaders
|
httpHeaders,
|
||||||
|
xForwardedPath
|
||||||
);
|
);
|
||||||
|
|
||||||
if(xssProperties.getEnabled()) {
|
if(xssProperties.getEnabled()) {
|
||||||
@ -196,8 +197,8 @@ public class AuthWebFilter implements WebFilter {
|
|||||||
ServerHttpRequest request = exchange.getRequest();
|
ServerHttpRequest request = exchange.getRequest();
|
||||||
if (StringUtils.isNotEmpty(xForwardedPath)) {
|
if (StringUtils.isNotEmpty(xForwardedPath)) {
|
||||||
String originXForwardedPath = xForwardedPath;
|
String originXForwardedPath = xForwardedPath;
|
||||||
if (xForwardedPath.contains(ApiConstants.API_USER)) {
|
if (xForwardedPath.contains(ApiConstants.API_INTERFACE)) {
|
||||||
xForwardedPath = "/" + ApiConstants.API_USER + xForwardedPath.split(ApiConstants.API_USER)[1];
|
xForwardedPath = "/" + ApiConstants.API_INTERFACE + xForwardedPath.split(ApiConstants.API_INTERFACE)[1];
|
||||||
}
|
}
|
||||||
log.info("getRequest xForwardedPath is not null originXForwardedPath:{},xForwardedPath:{}",originXForwardedPath, xForwardedPath);
|
log.info("getRequest xForwardedPath is not null originXForwardedPath:{},xForwardedPath:{}",originXForwardedPath, xForwardedPath);
|
||||||
request = request.mutate().path(xForwardedPath).build();
|
request = request.mutate().path(xForwardedPath).build();
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public class ApiConstants {
|
|||||||
public static final String ECHOBACK = "echoback";
|
public static final String ECHOBACK = "echoback";
|
||||||
public static final String X_FORWARDED_PATH = "X-Forwarded-Path";
|
public static final String X_FORWARDED_PATH = "X-Forwarded-Path";
|
||||||
|
|
||||||
public static final String API_USER = "api-user";
|
public static final String API_INTERFACE = "api-interface";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="${user.home}/logs/gateway-api" />
|
<property name="log.path" value="${user.home}/logs/gateway-api" />
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] [%X{logid}]- %msg%n" />
|
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] [%X{logid}]- %msg%n" />
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="/mnt/admin/eb-service-api/logs/api-gateway" />
|
<property name="log.path" value="/mnt/admin/eb-service-api/logs/api-gateway" />
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] [%X{logid}]- %msg%n" />
|
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] [%X{logid}]- %msg%n" />
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
<!-- 控制台输出 -->
|
<!-- 控制台输出 -->
|
||||||
|
|||||||
@ -4,7 +4,6 @@ package com.heyu.api.data.utils;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class OrderUtil {
|
public class OrderUtil {
|
||||||
@ -14,9 +13,6 @@ public class OrderUtil {
|
|||||||
public static String getUserPoolOrder(String pre) {
|
public static String getUserPoolOrder(String pre) {
|
||||||
SimpleDateFormat dateformat = new SimpleDateFormat("SSSyyyyMMddHHmmss");
|
SimpleDateFormat dateformat = new SimpleDateFormat("SSSyyyyMMddHHmmss");
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
if (EnvUtils.isLinux(SpringContextUtils.getActiveProfile())) {
|
|
||||||
sb.append(DateUtils.dateStr(DateUtils.addHours(new Date(), 8), DateUtils.YYYY_MM_DD_HH_MM_SS_SSS_str)).append("_");
|
|
||||||
}
|
|
||||||
sb.append(pre);
|
sb.append(pre);
|
||||||
return sb.
|
return sb.
|
||||||
append((int) (Math.random() * 1000)).append(dateformat.format(System.currentTimeMillis())).toString();
|
append((int) (Math.random() * 1000)).append(dateformat.format(System.currentTimeMillis())).toString();
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
package com.heyu.api.data.utils;
|
package com.heyu.api.data.utils;
|
||||||
|
|
||||||
|
|
||||||
import com.heyu.api.data.constants.ApiConstants;
|
import com.heyu.api.common.LogAspect;
|
||||||
import com.heyu.api.data.dto.RespCode;
|
import com.heyu.api.data.dto.RespCode;
|
||||||
import org.slf4j.MDC;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -25,11 +24,11 @@ public class R<T> {
|
|||||||
private String msg;
|
private String msg;
|
||||||
|
|
||||||
// 联系方式
|
// 联系方式
|
||||||
private String contactUs = "如果接口有疑问请加微信 fmai0923,shell_quyixiao,wulinq,或 致电18969093321,或发邮" +
|
//private String contactUs = "如果接口有疑问请加微信 fmai0923,shell_quyixiao,wulinq,或 致电18969093321,或发邮" +
|
||||||
"件service@ihzhy.com,如需咨询技术问题,请提供traceId";
|
// "件service@ihzhy.com,如需咨询技术问题,请提供traceId";
|
||||||
|
|
||||||
// 官网地址
|
// 官网地址
|
||||||
private String officialWebsiteAddress = "https://www.ihzhy.com";
|
// private String officialWebsiteAddress = "https://www.ihzhy.com";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志编号
|
* 日志编号
|
||||||
@ -39,7 +38,9 @@ public class R<T> {
|
|||||||
public R() {
|
public R() {
|
||||||
this.code = RespCode.SUCCESS.code;
|
this.code = RespCode.SUCCESS.code;
|
||||||
this.msg = RespCode.SUCCESS.msg;
|
this.msg = RespCode.SUCCESS.msg;
|
||||||
this.traceId = MDC.get(ApiConstants.TRACE_ID);
|
if (LogAspect.threadLocalNo != null) {
|
||||||
|
this.traceId = LogAspect.threadLocalNo.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public R(RespCode respCode) {
|
public R(RespCode respCode) {
|
||||||
@ -147,22 +148,5 @@ public class R<T> {
|
|||||||
this.traceId = traceId;
|
this.traceId = traceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getContactUs() {
|
|
||||||
return contactUs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContactUs(String contactUs) {
|
|
||||||
this.contactUs = contactUs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOfficialWebsiteAddress() {
|
|
||||||
return officialWebsiteAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOfficialWebsiteAddress(String officialWebsiteAddress) {
|
|
||||||
this.officialWebsiteAddress = officialWebsiteAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,126 +22,5 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>facebody20200910</artifactId>
|
|
||||||
<version>3.0.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>ocr20191230</artifactId>
|
|
||||||
<version>2.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>imageaudit20191230</artifactId>
|
|
||||||
<version>2.0.6</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>imageseg20191230</artifactId>
|
|
||||||
<version>2.0.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>goodstech20191230</artifactId>
|
|
||||||
<version>1.0.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>facebody20191230</artifactId>
|
|
||||||
<version>5.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>imagerecog20190930</artifactId>
|
|
||||||
<version>1.0.11</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>imageenhan20190930</artifactId>
|
|
||||||
<version>1.0.12</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>objectdet20191230</artifactId>
|
|
||||||
<version>2.0.14</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>viapi-utils</artifactId>
|
|
||||||
<version>1.0.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>viapi20230117</artifactId>
|
|
||||||
<version>2.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>tea-openapi</artifactId>
|
|
||||||
<version>0.3.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>tea-console</artifactId>
|
|
||||||
<version>0.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>tea-util</artifactId>
|
|
||||||
<version>0.2.23</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--阿里API相关SDK,实人认证-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>alibabacloud-cloudauth20190307</artifactId>
|
|
||||||
<version>2.0.6</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>cloudauth20190307</artifactId>
|
|
||||||
<version>3.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--腾讯云人脸sdk-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.tencentcloudapi</groupId>
|
|
||||||
<artifactId>tencentcloud-sdk-java-faceid</artifactId>
|
|
||||||
<version>3.1.1189</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>4.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>kotlin-stdlib</artifactId>
|
|
||||||
<version>1.2.71</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.heyu.api.alibaba;
|
package com.heyu.api.alibaba;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.heyu.api.alibaba.request.ACommonTextRequest;
|
import com.heyu.api.alibaba.request.ACommonTextRequest;
|
||||||
import com.heyu.api.data.dto.ImageInfoModel;
|
import com.heyu.api.data.dto.ImageInfoModel;
|
||||||
import com.heyu.api.data.utils.*;
|
import com.heyu.api.data.utils.*;
|
||||||
@ -33,6 +34,7 @@ public abstract class AlibabaBaseHandle<PP, RR> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object resp = run(p, runtime);
|
Object resp = run(p, runtime);
|
||||||
|
log.info(this.getClass().getSimpleName() + " handle resp:{}", JSON.toJSONString(resp));
|
||||||
if (resp != null) {
|
if (resp != null) {
|
||||||
if (resp instanceof String) {
|
if (resp instanceof String) {
|
||||||
return ApiR.error((String) resp);
|
return ApiR.error((String) resp);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.heyu.api.alibaba.handle.common.text;
|
package com.heyu.api.alibaba.handle.common.text;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.aliyun.cloudauth20190307.models.BankMetaVerifyRequest;
|
import com.aliyun.cloudauth20190307.models.BankMetaVerifyRequest;
|
||||||
import com.aliyun.cloudauth20190307.models.BankMetaVerifyResponse;
|
import com.aliyun.cloudauth20190307.models.BankMetaVerifyResponse;
|
||||||
import com.aliyun.teautil.models.RuntimeOptions;
|
import com.aliyun.teautil.models.RuntimeOptions;
|
||||||
@ -13,6 +14,12 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
/****
|
/****
|
||||||
* https://next.api.aliyun.com/api/Cloudauth/2019-03-07/BankMetaVerify?tab=DOC&lang=JAVA
|
* https://next.api.aliyun.com/api/Cloudauth/2019-03-07/BankMetaVerify?tab=DOC&lang=JAVA
|
||||||
|
*
|
||||||
|
* 银行卡二,三,四要素核验
|
||||||
|
*
|
||||||
|
* BankMetaVerify
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -84,6 +91,7 @@ public class ABankMetaVerifyHandle extends AlibabaBaseHandle<ABankMetaVerifyRequ
|
|||||||
bankMetaVerifyRequest.setIdentifyNum(ap.getIdentifyNum());
|
bankMetaVerifyRequest.setIdentifyNum(ap.getIdentifyNum());
|
||||||
bankMetaVerifyRequest.setMobile(ap.getMobile());
|
bankMetaVerifyRequest.setMobile(ap.getMobile());
|
||||||
bankMetaVerifyRequest.setIdentityType(ap.getIdentityType());
|
bankMetaVerifyRequest.setIdentityType(ap.getIdentityType());
|
||||||
|
log.info("bankMetaVerifyRequest json : {}", JSON.toJSONString(bankMetaVerifyRequest));
|
||||||
|
|
||||||
// 复制代码运行请自行打印 API 的返回值
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
return client.bankMetaVerifyWithOptions(bankMetaVerifyRequest, runtime);
|
return client.bankMetaVerifyWithOptions(bankMetaVerifyRequest, runtime);
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class AlibabaClientConfig {
|
public class AlibabaClientConfig {
|
||||||
|
|
||||||
@ -245,4 +247,5 @@ public class AlibabaClientConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.heyu.api.tencent.handle;
|
package com.heyu.api.tencent.handle;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.heyu.api.data.utils.BankCardUtils;
|
import com.heyu.api.data.utils.BankCardUtils;
|
||||||
import com.heyu.api.data.utils.StringUtils;
|
import com.heyu.api.data.utils.StringUtils;
|
||||||
import com.heyu.api.tencent.TencentBaseHandle;
|
import com.heyu.api.tencent.TencentBaseHandle;
|
||||||
@ -44,6 +45,7 @@ public class TBankCard2EVerificationHandle extends TencentBaseHandle<TBankCard2E
|
|||||||
req.setBankCard(ap.getBankCard());
|
req.setBankCard(ap.getBankCard());
|
||||||
req.setName(ap.getName());
|
req.setName(ap.getName());
|
||||||
req.setEncryption(ap.getEncryption());
|
req.setEncryption(ap.getEncryption());
|
||||||
|
log.info("TBankCard2EVerificationHandle req : {}", JSON.toJSONString(req));
|
||||||
return client.BankCard2EVerification(req);
|
return client.BankCard2EVerification(req);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,23 @@ import org.springframework.stereotype.Component;
|
|||||||
*
|
*
|
||||||
*身份信息认证(二要素核验)
|
*身份信息认证(二要素核验)
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* SecretId
|
||||||
|
*
|
||||||
|
* AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||||
|
*
|
||||||
|
* SecretKey
|
||||||
|
*
|
||||||
|
* mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*SecretId,SecretKey
|
||||||
|
*
|
||||||
|
* AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu,
|
||||||
|
*
|
||||||
|
* mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class TIdCardVerificationHandle extends TencentBaseHandle<TIdCardVerificationRequest, IdCardVerificationResponse> {
|
public class TIdCardVerificationHandle extends TencentBaseHandle<TIdCardVerificationRequest, IdCardVerificationResponse> {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package com.heyu.api.aop;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.heyu.api.common.LogAspect;
|
||||||
import com.heyu.api.data.constants.ApiConstants;
|
import com.heyu.api.data.constants.ApiConstants;
|
||||||
import com.heyu.api.data.dto.AccountDTO;
|
import com.heyu.api.data.dto.AccountDTO;
|
||||||
import com.heyu.api.data.dto.BaseReq;
|
import com.heyu.api.data.dto.BaseReq;
|
||||||
@ -30,10 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志aop
|
* 日志aop
|
||||||
@ -79,6 +76,11 @@ public class LogAop {
|
|||||||
try {
|
try {
|
||||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
String traceId = attributes.getRequest().getHeader("traceId");
|
String traceId = attributes.getRequest().getHeader("traceId");
|
||||||
|
if(StringUtils.isBlank(traceId)){
|
||||||
|
traceId = OrderUtil.getUserPoolOrder("on");
|
||||||
|
}
|
||||||
|
LogAspect.threadLocalNo.set(traceId);
|
||||||
|
LogAspect.threadLocalTime.set(System.currentTimeMillis());
|
||||||
HttpServletRequest request = attributes.getRequest();
|
HttpServletRequest request = attributes.getRequest();
|
||||||
uri = attributes.getRequest().getRequestURI();
|
uri = attributes.getRequest().getRequestURI();
|
||||||
|
|
||||||
@ -149,30 +151,28 @@ public class LogAop {
|
|||||||
log.error("LogAop set error " + sb.toString(), e);
|
log.error("LogAop set error " + sb.toString(), e);
|
||||||
} finally {
|
} finally {
|
||||||
printLog(result, args, ip, className, methodName, uri);
|
printLog(result, args, ip, className, methodName, uri);
|
||||||
|
LogAspect.threadLocalNo.remove();
|
||||||
|
LogAspect.threadLocalTime.remove();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Object printLog(Object result, String args, String ip, String className, String methodName,
|
public void printLog(Object result, String args, String ip, String className, String methodName,
|
||||||
String preUri) {
|
String preUri) {
|
||||||
doPrintLog(args, ip, preUri, className, methodName, result);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doPrintLog(String args, String ip, String uri,
|
|
||||||
String className, String methodName, Object result) {
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("LoggerAop args:").append(args).append(BLANK_SPACE)
|
sb.append("LoggerAop args:").append(args).append(BLANK_SPACE)
|
||||||
.append("ip:").append(ip).append(BLANK_SPACE)
|
.append("ip:").append(ip).append(BLANK_SPACE)
|
||||||
.append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE)
|
.append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE)
|
||||||
.append("uri:").append(uri).append(BLANK_SPACE)
|
.append("uri:").append(preUri).append(BLANK_SPACE)
|
||||||
.append("result:").append(JSON.toJSONString(result));
|
.append("result:").append(JSON.toJSONString(result));
|
||||||
log.info(sb.toString());
|
log.info(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Object tokenVerify(String tokenInfoStr, String args, String ip, String className, String methodName,
|
public Object tokenVerify(String tokenInfoStr, String args, String ip, String className, String methodName,
|
||||||
String uri, String token, String traceId, ProceedingJoinPoint point) {
|
String uri, String token, String traceId, ProceedingJoinPoint point) {
|
||||||
TokenDTO tokenDTO = JSONObject.parseObject(tokenInfoStr, TokenDTO.class);
|
TokenDTO tokenDTO = JSONObject.parseObject(tokenInfoStr, TokenDTO.class);
|
||||||
|
|||||||
@ -33,6 +33,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 银行卡二要素核验
|
* 银行卡二要素核验
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 银行卡二,三,四要素核验
|
||||||
|
*
|
||||||
|
* BankMetaVerify
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@ -46,7 +51,9 @@ public class BankCard2MetaController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TBankCard2EVerificationHandle tBankCard2EVerificationHandle;
|
private TBankCard2EVerificationHandle tBankCard2EVerificationHandle;
|
||||||
|
|
||||||
|
// http://localhost:8888/bank/card/2/verify?bankCardNumber=6214855713516769&realName=瞿贻晓
|
||||||
|
|
||||||
|
// https://api.1024api.com/api-interface/bank/card/2/verify?bankCardNumber=6214855713516769&realName=瞿贻晓
|
||||||
@RequestMapping("/verify")
|
@RequestMapping("/verify")
|
||||||
@CacheResult(exclude = {"验证中心服务繁忙","验证次数超限,请次日重试"})
|
@CacheResult(exclude = {"验证中心服务繁忙","验证次数超限,请次日重试"})
|
||||||
public R verify(BankCard2MetaRequest bankCard2MetaRequest) {
|
public R verify(BankCard2MetaRequest bankCard2MetaRequest) {
|
||||||
@ -87,7 +94,7 @@ public class BankCard2MetaController extends BaseController {
|
|||||||
return R.ok().setData(bankCard2MetaResp);
|
return R.ok().setData(bankCard2MetaResp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return R.error();
|
return R.error(tR.getErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,9 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
*
|
||||||
* https://next.api.aliyun.com/api/ocr/2019-12-30/RecognizeBankCard?RegionId=cn-shanghai&tab=DOC&lang=JAVA
|
* https://next.api.aliyun.com/api/ocr/2019-12-30/RecognizeBankCard?RegionId=cn-shanghai&tab=DOC&lang=JAVA
|
||||||
@ -45,7 +42,6 @@ public class BankCardRecognizeController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BBankcardHandle bBankcardHandle;
|
private BBankcardHandle bBankcardHandle;
|
||||||
|
|
||||||
public final static Map<String, String> resultDesc = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/recognize")
|
@RequestMapping("/recognize")
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class IdCardSecondCheckController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TIdCardVerificationHandle idCardVerificationHandle;
|
private TIdCardVerificationHandle idCardVerificationHandle;
|
||||||
|
// http://localhost:8888/id/card/certification?idCardNumber=430529199209255030&realName=瞿贻晓
|
||||||
@RequestMapping("/certification")
|
@RequestMapping("/certification")
|
||||||
@CacheResult
|
@CacheResult
|
||||||
public R certification(ApiIdentityCardSecondRequest apiIdentityCardRequest) {
|
public R certification(ApiIdentityCardSecondRequest apiIdentityCardRequest) {
|
||||||
|
|||||||
@ -61,8 +61,8 @@ eb:
|
|||||||
|
|
||||||
tencent:
|
tencent:
|
||||||
face:
|
face:
|
||||||
ak: zs9oN4gSuoS3eK8dVJg6jyKh
|
ak: AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||||
sk: uHIRXkj6rbW1eXy8eRVCeP1e3cRQKXay
|
sk: mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||||
endpoint: faceid.tencentcloudapi.com
|
endpoint: faceid.tencentcloudapi.com
|
||||||
|
|
||||||
aliyun:
|
aliyun:
|
||||||
|
|||||||
@ -6,9 +6,15 @@
|
|||||||
<!-- 定义log文件的目录 -->
|
<!-- 定义log文件的目录 -->
|
||||||
<property name="LOG_HOME" value="${user.home}/logs/api-interface"></property>
|
<property name="LOG_HOME" value="${user.home}/logs/api-interface"></property>
|
||||||
|
|
||||||
|
<!-- 彩色日志依赖的渲染类 -->
|
||||||
|
<conversionRule conversionWord="convertMessage"
|
||||||
|
converterClass="com.heyu.api.common.LogClassicConverter"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="LOG_PATTERN"
|
<property name="LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{X-B3-TraceId:-},%X{X-B3-SpanId:-}] [%thread]%-5level %F:%L %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{X-B3-TraceId:-},%X{X-B3-SpanId:-}] [%thread]%-5level %F:%L %convertMessage %msg%n"/>
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<!--日志文件输出格式-->
|
<!--日志文件输出格式-->
|
||||||
|
|||||||
@ -6,9 +6,15 @@
|
|||||||
<!-- 定义log文件的目录 -->
|
<!-- 定义log文件的目录 -->
|
||||||
<property name="LOG_HOME" value="/home/heyu/logs/api-interface"></property>
|
<property name="LOG_HOME" value="/home/heyu/logs/api-interface"></property>
|
||||||
|
|
||||||
|
<!-- 彩色日志依赖的渲染类 -->
|
||||||
|
<conversionRule conversionWord="convertMessage"
|
||||||
|
converterClass="com.heyu.api.common.LogClassicConverter"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="LOG_PATTERN"
|
<property name="LOG_PATTERN"
|
||||||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{X-B3-TraceId:-},%X{X-B3-SpanId:-}] [%thread]%-5level %F:%L %msg%n"/>
|
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{X-B3-TraceId:-},%X{X-B3-SpanId:-}] [%thread]%-5level %F:%L %convertMessage %msg%n"/>
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<!--日志文件输出格式-->
|
<!--日志文件输出格式-->
|
||||||
|
|||||||
@ -61,6 +61,6 @@ oss:
|
|||||||
|
|
||||||
tencent:
|
tencent:
|
||||||
face:
|
face:
|
||||||
ak: zs9oN4gSuoS3eK8dVJg6jyKh
|
ak: AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||||
sk: uHIRXkj6rbW1eXy8eRVCeP1e3cRQKXay
|
sk: mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||||
endpoint: faceid.tencentcloudapi.com
|
endpoint: faceid.tencentcloudapi.com
|
||||||
133
pom.xml
133
pom.xml
@ -217,6 +217,139 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>facebody20200910</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>ocr20191230</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>imageaudit20191230</artifactId>
|
||||||
|
<version>2.0.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>imageseg20191230</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>goodstech20191230</artifactId>
|
||||||
|
<version>1.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>facebody20191230</artifactId>
|
||||||
|
<version>5.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>imagerecog20190930</artifactId>
|
||||||
|
<version>1.0.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>imageenhan20190930</artifactId>
|
||||||
|
<version>1.0.12</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>objectdet20191230</artifactId>
|
||||||
|
<version>2.0.14</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>viapi-utils</artifactId>
|
||||||
|
<version>1.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>viapi20230117</artifactId>
|
||||||
|
<version>2.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-openapi</artifactId>
|
||||||
|
<version>0.3.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-console</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-util</artifactId>
|
||||||
|
<version>0.2.23</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!--阿里API相关SDK,实人认证-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>alibabacloud-cloudauth20190307</artifactId>
|
||||||
|
<version>2.0.6</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>cloudauth20190307</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--腾讯云人脸sdk-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tencentcloudapi</groupId>
|
||||||
|
<artifactId>tencentcloud-sdk-java-faceid</artifactId>
|
||||||
|
<version>3.1.1189</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
|
<version>1.2.71</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>credentials-java</artifactId>
|
||||||
|
<version>0.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user