Authored by qinchao

实名认证接口-开启图形验证码

package com.yohoufo.user.common;
package com.yohoufo.user.helper;
import com.yohoufo.user.controller.passport.RealNameAuthorizeController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
... ... @@ -13,8 +12,8 @@ import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@Configuration
public class CustomRestTemplateConfig {
private Logger logger = LoggerFactory.getLogger(CustomRestTemplateConfig.class);
public class RestTemplateForBank {
private Logger logger = LoggerFactory.getLogger(RestTemplateForBank.class);
/**
* 定义一个500毫秒超时的RestTemplate,调用银联接口用
... ...
package com.yohoufo.user.helper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Resource;
import java.net.URI;
import java.util.Map;
@Component
public class RestTemplateHelper {
private static Logger log = LoggerFactory.getLogger(RestTemplateHelper.class);
@Autowired
RestTemplate restTemplate;
/**
* 使用json格式调用post请求
*
* @param url
* @param params
* @return
*/
public <T> T postByJson(String url, Object params, Class<T> responseType) throws RuntimeException {
log.info("call post with url={}, params={}", url, params);
MultiValueMap<String, String> headers = new LinkedMultiValueMap();
headers.set("Content-Type", "application/json; charset=UTF-8");
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
HttpEntity<Object> entity = new HttpEntity<>(params, headers);
T response = restTemplate.postForObject(url, entity, responseType);
return response;
}
}
... ...
package com.yohoufo.user.service.risk;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.service.model.uic.request.VerifiedGraphicReqBO;
import com.yoho.uic.client.SDK.yoho.GraphicVerifiedSDK;
import com.yoho.uic.client.model.UicResponse;
import com.yohoufo.common.interceptor.RemoteIPInterceptor;
import com.yohoufo.user.helper.RestTemplateHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.List;
... ... @@ -23,16 +23,13 @@ public class GraphVerifyService implements ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(GraphVerifyService.class);
@Resource
ServiceCaller serviceCaller;
@Autowired
GraphicVerifiedSDK graphicVerifiedSDK;
private ApplicationEventPublisher publisher;
@Autowired
private RestTemplateHelper restTemplateHelper;
@Value("${uic.service.url}")
private String uicServiceUrl;
/**
* 验证图形验证码
... ... @@ -47,8 +44,10 @@ public class GraphVerifyService implements ApplicationEventPublisherAware {
String ip = RemoteIPInterceptor.getRemoteIP();
//ip="172.16.6.90";
logger.info("checkAndVerifyGrap, clientType is {}, appVersion is {}, fromPage is {}, udid is {}, degrees is {}, ip is {}, appType is {}", clientType, appVersion, fromPage, udid, degrees, ip, appType);
com.yoho.uic.client.model.request.VerifiedGraphicReqBO reqBO = new com.yoho.uic.client.model.request.VerifiedGraphicReqBO();
VerifiedGraphicReqBO reqBO = new VerifiedGraphicReqBO();
reqBO.setUdid(udid);
reqBO.setAppType(appType);
reqBO.setFromPage(fromPage);
... ... @@ -58,8 +57,7 @@ public class GraphVerifyService implements ApplicationEventPublisherAware {
reqBO.setIp(ip);
reqBO.setBusinessLine("ufo");
graphicVerifiedSDK.checkAndVerifyGrap(reqBO);
restTemplateHelper.postByJson(uicServiceUrl+"/VerifiedGraphicRest/checkAndVerifyGrap",reqBO,Object.class);
}
/**
... ... @@ -75,6 +73,8 @@ public class GraphVerifyService implements ApplicationEventPublisherAware {
String ip = RemoteIPInterceptor.getRemoteIP();
//ip="172.16.6.90";
logger.info("triggerUfoGraphVerifySwitch, clientType is {}, appVersion is {}, fromPage is {}, udid is {}, degrees is {}, ip is {}, appType is {}", clientType, appVersion, fromPage, udid, degrees, ip, appType);
VerifiedGraphicReqBO reqBO = new VerifiedGraphicReqBO();
reqBO.setUdid(udid);
... ... @@ -84,9 +84,9 @@ public class GraphVerifyService implements ApplicationEventPublisherAware {
reqBO.setApp_version(appVersion);
reqBO.setClient_type(clientType);
reqBO.setIp(ip);
reqBO.setBusinessLine("ufo");
serviceCaller.call("uic.triggerUfoGraphVerifySwitch", reqBO, UicResponse.class);
restTemplateHelper.postByJson(uicServiceUrl+"/VerifiedGraphicRest/triggerUfoGraphVerifySwitch",reqBO,Object.class);
}
@Override
... ...
... ... @@ -44,7 +44,7 @@ password.aes.key=yoho9646yoho9646
#用户uic服务地址
uic.service.url=http://192.168.103.73:8096/uic
uic.service.url=http://java-yoho-uic.test3.ingress.dev.yohocorp.com/uic
#signature encrypt key salt
gateway.signature.key.salt=mQyMTMwZjlmZTZmYjY4UjkNmYwZGM0OTk0Y
... ... @@ -74,7 +74,6 @@ unionpay.pay.mid=898310148160568
unionpay.pay.tid=00000001
unionPay.pay.signKey=fcAmtnx7MwismjWNhNKdHC44mNXtnEQeJkRrhKJwyrW2ysRR
redis.readonly.proxy.address=192.168.102.45
redis.readonly.proxy.auth=redis9646
redis.readonly.proxy.port=6379
... ...