提交修改
This commit is contained in:
parent
156866292f
commit
ff36745f41
@ -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 "";
|
||||
}
|
||||
}
|
||||
@ -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>
|
||||
</project>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.heyu.api.alibaba;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.ACommonTextRequest;
|
||||
import com.heyu.api.data.dto.ImageInfoModel;
|
||||
import com.heyu.api.data.utils.*;
|
||||
@ -33,6 +34,7 @@ public abstract class AlibabaBaseHandle<PP, RR> {
|
||||
}
|
||||
}
|
||||
Object resp = run(p, runtime);
|
||||
log.info(this.getClass().getSimpleName() + " handle resp:{}", JSON.toJSONString(resp));
|
||||
if (resp != null) {
|
||||
if (resp instanceof String) {
|
||||
return ApiR.error((String) resp);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.heyu.api.alibaba.handle.common.text;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.aliyun.cloudauth20190307.models.BankMetaVerifyRequest;
|
||||
import com.aliyun.cloudauth20190307.models.BankMetaVerifyResponse;
|
||||
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
|
||||
*
|
||||
* 银行卡二,三,四要素核验
|
||||
*
|
||||
* BankMetaVerify
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@ -84,6 +91,7 @@ public class ABankMetaVerifyHandle extends AlibabaBaseHandle<ABankMetaVerifyRequ
|
||||
bankMetaVerifyRequest.setIdentifyNum(ap.getIdentifyNum());
|
||||
bankMetaVerifyRequest.setMobile(ap.getMobile());
|
||||
bankMetaVerifyRequest.setIdentityType(ap.getIdentityType());
|
||||
log.info("bankMetaVerifyRequest json : {}", JSON.toJSONString(bankMetaVerifyRequest));
|
||||
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
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.Configuration;
|
||||
|
||||
|
||||
|
||||
@Configuration
|
||||
public class AlibabaClientConfig {
|
||||
|
||||
@ -245,4 +247,5 @@ public class AlibabaClientConfig {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.heyu.api.tencent.handle;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.data.utils.BankCardUtils;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.TencentBaseHandle;
|
||||
@ -44,6 +45,7 @@ public class TBankCard2EVerificationHandle extends TencentBaseHandle<TBankCard2E
|
||||
req.setBankCard(ap.getBankCard());
|
||||
req.setName(ap.getName());
|
||||
req.setEncryption(ap.getEncryption());
|
||||
log.info("TBankCard2EVerificationHandle req : {}", JSON.toJSONString(req));
|
||||
return client.BankCard2EVerification(req);
|
||||
|
||||
}
|
||||
|
||||
@ -13,6 +13,23 @@ import org.springframework.stereotype.Component;
|
||||
*
|
||||
*身份信息认证(二要素核验)
|
||||
*
|
||||
*
|
||||
*
|
||||
* SecretId
|
||||
*
|
||||
* AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||
*
|
||||
* SecretKey
|
||||
*
|
||||
* mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||
*
|
||||
*
|
||||
*
|
||||
*SecretId,SecretKey
|
||||
*
|
||||
* AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu,
|
||||
*
|
||||
* mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||
*/
|
||||
@Component
|
||||
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.JSONObject;
|
||||
|
||||
import com.heyu.api.common.LogAspect;
|
||||
import com.heyu.api.data.constants.ApiConstants;
|
||||
import com.heyu.api.data.dto.AccountDTO;
|
||||
import com.heyu.api.data.dto.BaseReq;
|
||||
@ -30,10 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 日志aop
|
||||
@ -79,6 +76,11 @@ public class LogAop {
|
||||
try {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
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();
|
||||
uri = attributes.getRequest().getRequestURI();
|
||||
|
||||
@ -149,30 +151,28 @@ public class LogAop {
|
||||
log.error("LogAop set error " + sb.toString(), e);
|
||||
} finally {
|
||||
printLog(result, args, ip, className, methodName, uri);
|
||||
LogAspect.threadLocalNo.remove();
|
||||
LogAspect.threadLocalTime.remove();
|
||||
}
|
||||
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) {
|
||||
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();
|
||||
sb.append("LoggerAop args:").append(args).append(BLANK_SPACE)
|
||||
.append("ip:").append(ip).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));
|
||||
log.info(sb.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Object tokenVerify(String tokenInfoStr, String args, String ip, String className, String methodName,
|
||||
String uri, String token, String traceId, ProceedingJoinPoint point) {
|
||||
TokenDTO tokenDTO = JSONObject.parseObject(tokenInfoStr, TokenDTO.class);
|
||||
|
||||
@ -33,6 +33,11 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*
|
||||
*
|
||||
* 银行卡二要素核验
|
||||
*
|
||||
*
|
||||
* 银行卡二,三,四要素核验
|
||||
*
|
||||
* BankMetaVerify
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -46,7 +51,7 @@ public class BankCard2MetaController extends BaseController {
|
||||
@Autowired
|
||||
private TBankCard2EVerificationHandle tBankCard2EVerificationHandle;
|
||||
|
||||
|
||||
// http://localhost:8888/bank/card/2/verify?bankCardNumber=6214855713516769&realName=瞿贻晓
|
||||
@RequestMapping("/verify")
|
||||
@CacheResult(exclude = {"验证中心服务繁忙","验证次数超限,请次日重试"})
|
||||
public R verify(BankCard2MetaRequest bankCard2MetaRequest) {
|
||||
@ -87,7 +92,7 @@ public class BankCard2MetaController extends BaseController {
|
||||
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.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
|
||||
@ -45,7 +42,6 @@ public class BankCardRecognizeController extends BaseController {
|
||||
@Autowired
|
||||
private BBankcardHandle bBankcardHandle;
|
||||
|
||||
public final static Map<String, String> resultDesc = new HashMap<>();
|
||||
|
||||
|
||||
@RequestMapping("/recognize")
|
||||
|
||||
@ -28,7 +28,7 @@ public class IdCardSecondCheckController {
|
||||
|
||||
@Autowired
|
||||
private TIdCardVerificationHandle idCardVerificationHandle;
|
||||
|
||||
// http://localhost:8888/id/card/certification?idCardNumber=430529199209255030&realName=瞿贻晓
|
||||
@RequestMapping("/certification")
|
||||
@CacheResult
|
||||
public R certification(ApiIdentityCardSecondRequest apiIdentityCardRequest) {
|
||||
|
||||
@ -61,8 +61,8 @@ eb:
|
||||
|
||||
tencent:
|
||||
face:
|
||||
ak: zs9oN4gSuoS3eK8dVJg6jyKh
|
||||
sk: uHIRXkj6rbW1eXy8eRVCeP1e3cRQKXay
|
||||
ak: AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||
sk: mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||
endpoint: faceid.tencentcloudapi.com
|
||||
|
||||
aliyun:
|
||||
|
||||
@ -6,9 +6,15 @@
|
||||
<!-- 定义log文件的目录 -->
|
||||
<property name="LOG_HOME" value="${user.home}/logs/api-interface"></property>
|
||||
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="convertMessage"
|
||||
converterClass="com.heyu.api.common.LogClassicConverter"/>
|
||||
|
||||
|
||||
|
||||
<!-- 日志输出格式 -->
|
||||
<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">
|
||||
<!--日志文件输出格式-->
|
||||
|
||||
@ -61,6 +61,6 @@ oss:
|
||||
|
||||
tencent:
|
||||
face:
|
||||
ak: zs9oN4gSuoS3eK8dVJg6jyKh
|
||||
sk: uHIRXkj6rbW1eXy8eRVCeP1e3cRQKXay
|
||||
ak: AKIDCxZyA9xZx8D6lFZfcLsBHH3e1A8uTqzu
|
||||
sk: mJcjcIkz0nPnyxlMkupW1MUP7brthHjz
|
||||
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>
|
||||
|
||||
<build>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user