Authored by qinchao

fix bug

... ... @@ -32,8 +32,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
/**
... ... @@ -308,6 +310,23 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
return zhiMaCert;
}
/**
38 * 获取现在时间
39 *
40 * @return返回字符串格式 yyyy-MM-dd HH:mm:ss
41 */
public static String getStringDate() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static void main(String[] args) {
System.out.println(getStringDate());
}
@Override
public AuthorizeResultRespVO zhiMaCertInit(RealNameAuthorizeReqVO reqVO) {
logger.info("real name zhiMaCertInit reqVO {}", reqVO);
... ... @@ -340,7 +359,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
throw new ServiceException(400, "错误:保存实名认知信息异常!");
}
String transactionId="ufoCert"+zhiMaCert.getId();
//7+14+
String transactionId="ufoCert"+getStringDate()+zhiMaCert.getId();
String bizNo=ZhiMaCallUtil.zhiMaCertInit(transactionId,reqVO.getCertName(),reqVO.getCertNo());
... ... @@ -352,7 +372,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
//不需要更新bizNO到数据库了,不需要记录
zhiMaCertDao.updateBizNoByByPrimaryKey(zhiMaCert.getId(),bizNo);
//通过biz_no,生成returnUrl
String returnUrl = ZhiMaCallUtil.zhiMaCertUrl(bizNo);
... ...
package com.yohoufo.user.service.impl;
import com.alibaba.fastjson.JSON;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.ZhimaCustomerCertificationCertifyRequest;
... ... @@ -75,9 +76,9 @@ public class ZhiMaCallUtil {
//String bizContent=JSON.toJSONString(jo);
request.setBizContent(bizContent);
logger.info("zhi ma cert init begin request is {} ",request);
logger.info("zhi ma cert init begin request is {} ",JSON.toJSONString(request));
ZhimaCustomerCertificationInitializeResponse response = alipayClient.execute(request);
logger.info("zhi ma cert init end response {}",response);
logger.info("zhi ma cert init end response {}", JSON.toJSONString(response));
if (response.isSuccess()) {
logger.info("zhi ma cert init end ,call success ");
... ... @@ -120,11 +121,11 @@ public class ZhiMaCallUtil {
// alipay://www.taobao.com 或者 alipays://www.taobao.com,分别对应http和https请求
request.setReturnUrl("yohobuyufo://www.yohobuy.com/ufo?pagename=NameAuth&");
logger.info("zhi ma cert url begin ,request {} ",request);
logger.info("zhi ma cert url begin ,request {} ",JSON.toJSONString(request));
// 这里一定要使用GET模式
ZhimaCustomerCertificationCertifyResponse response = alipayClient.pageExecute(request, "GET");
logger.info("zhi ma cert url end ,response {} " ,response);
logger.info("zhi ma cert url end ,response {} " ,JSON.toJSONString(response));
// 从body中获取URL
String url = response.getBody();
return url;
... ... @@ -159,7 +160,7 @@ public class ZhiMaCallUtil {
logger.info("zhi ma result begin ,request {} ",request);
response = alipayClient.execute(request);
logger.info("zhi ma result end ,response {} ",response);
logger.info("zhi ma result end ,response {} ",JSON.toJSONString(response));
return response;
}catch (Exception e){
... ...