Authored by qinchao

fix bug

@@ -32,8 +32,10 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -32,8 +32,10 @@ import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.beans.factory.annotation.Value; 32 import org.springframework.beans.factory.annotation.Value;
33 import org.springframework.stereotype.Service; 33 import org.springframework.stereotype.Service;
34 34
  35 +import java.text.SimpleDateFormat;
35 import java.time.LocalDateTime; 36 import java.time.LocalDateTime;
36 import java.time.ZoneOffset; 37 import java.time.ZoneOffset;
  38 +import java.util.Date;
37 39
38 40
39 /** 41 /**
@@ -308,6 +310,23 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -308,6 +310,23 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
308 return zhiMaCert; 310 return zhiMaCert;
309 } 311 }
310 312
  313 +
  314 + /**
  315 + 38 * 获取现在时间
  316 + 39 *
  317 + 40 * @return返回字符串格式 yyyy-MM-dd HH:mm:ss
  318 + 41 */
  319 + public static String getStringDate() {
  320 + Date currentTime = new Date();
  321 + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  322 + String dateString = formatter.format(currentTime);
  323 + return dateString;
  324 + }
  325 +
  326 + public static void main(String[] args) {
  327 + System.out.println(getStringDate());
  328 + }
  329 +
311 @Override 330 @Override
312 public AuthorizeResultRespVO zhiMaCertInit(RealNameAuthorizeReqVO reqVO) { 331 public AuthorizeResultRespVO zhiMaCertInit(RealNameAuthorizeReqVO reqVO) {
313 logger.info("real name zhiMaCertInit reqVO {}", reqVO); 332 logger.info("real name zhiMaCertInit reqVO {}", reqVO);
@@ -340,7 +359,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -340,7 +359,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
340 throw new ServiceException(400, "错误:保存实名认知信息异常!"); 359 throw new ServiceException(400, "错误:保存实名认知信息异常!");
341 } 360 }
342 361
343 - String transactionId="ufoCert"+zhiMaCert.getId(); 362 + //7+14+
  363 + String transactionId="ufoCert"+getStringDate()+zhiMaCert.getId();
344 364
345 String bizNo=ZhiMaCallUtil.zhiMaCertInit(transactionId,reqVO.getCertName(),reqVO.getCertNo()); 365 String bizNo=ZhiMaCallUtil.zhiMaCertInit(transactionId,reqVO.getCertName(),reqVO.getCertNo());
346 366
@@ -352,7 +372,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -352,7 +372,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
352 372
353 //不需要更新bizNO到数据库了,不需要记录 373 //不需要更新bizNO到数据库了,不需要记录
354 zhiMaCertDao.updateBizNoByByPrimaryKey(zhiMaCert.getId(),bizNo); 374 zhiMaCertDao.updateBizNoByByPrimaryKey(zhiMaCert.getId(),bizNo);
355 - 375 +
356 //通过biz_no,生成returnUrl 376 //通过biz_no,生成returnUrl
357 String returnUrl = ZhiMaCallUtil.zhiMaCertUrl(bizNo); 377 String returnUrl = ZhiMaCallUtil.zhiMaCertUrl(bizNo);
358 378
1 package com.yohoufo.user.service.impl; 1 package com.yohoufo.user.service.impl;
2 2
  3 +import com.alibaba.fastjson.JSON;
3 import com.alipay.api.AlipayClient; 4 import com.alipay.api.AlipayClient;
4 import com.alipay.api.DefaultAlipayClient; 5 import com.alipay.api.DefaultAlipayClient;
5 import com.alipay.api.request.ZhimaCustomerCertificationCertifyRequest; 6 import com.alipay.api.request.ZhimaCustomerCertificationCertifyRequest;
@@ -75,9 +76,9 @@ public class ZhiMaCallUtil { @@ -75,9 +76,9 @@ public class ZhiMaCallUtil {
75 //String bizContent=JSON.toJSONString(jo); 76 //String bizContent=JSON.toJSONString(jo);
76 request.setBizContent(bizContent); 77 request.setBizContent(bizContent);
77 78
78 - logger.info("zhi ma cert init begin request is {} ",request); 79 + logger.info("zhi ma cert init begin request is {} ",JSON.toJSONString(request));
79 ZhimaCustomerCertificationInitializeResponse response = alipayClient.execute(request); 80 ZhimaCustomerCertificationInitializeResponse response = alipayClient.execute(request);
80 - logger.info("zhi ma cert init end response {}",response); 81 + logger.info("zhi ma cert init end response {}", JSON.toJSONString(response));
81 82
82 if (response.isSuccess()) { 83 if (response.isSuccess()) {
83 logger.info("zhi ma cert init end ,call success "); 84 logger.info("zhi ma cert init end ,call success ");
@@ -120,11 +121,11 @@ public class ZhiMaCallUtil { @@ -120,11 +121,11 @@ public class ZhiMaCallUtil {
120 // alipay://www.taobao.com 或者 alipays://www.taobao.com,分别对应http和https请求 121 // alipay://www.taobao.com 或者 alipays://www.taobao.com,分别对应http和https请求
121 request.setReturnUrl("yohobuyufo://www.yohobuy.com/ufo?pagename=NameAuth&"); 122 request.setReturnUrl("yohobuyufo://www.yohobuy.com/ufo?pagename=NameAuth&");
122 123
123 - logger.info("zhi ma cert url begin ,request {} ",request); 124 + logger.info("zhi ma cert url begin ,request {} ",JSON.toJSONString(request));
124 // 这里一定要使用GET模式 125 // 这里一定要使用GET模式
125 ZhimaCustomerCertificationCertifyResponse response = alipayClient.pageExecute(request, "GET"); 126 ZhimaCustomerCertificationCertifyResponse response = alipayClient.pageExecute(request, "GET");
126 127
127 - logger.info("zhi ma cert url end ,response {} " ,response); 128 + logger.info("zhi ma cert url end ,response {} " ,JSON.toJSONString(response));
128 // 从body中获取URL 129 // 从body中获取URL
129 String url = response.getBody(); 130 String url = response.getBody();
130 return url; 131 return url;
@@ -159,7 +160,7 @@ public class ZhiMaCallUtil { @@ -159,7 +160,7 @@ public class ZhiMaCallUtil {
159 160
160 logger.info("zhi ma result begin ,request {} ",request); 161 logger.info("zhi ma result begin ,request {} ",request);
161 response = alipayClient.execute(request); 162 response = alipayClient.execute(request);
162 - logger.info("zhi ma result end ,response {} ",response); 163 + logger.info("zhi ma result end ,response {} ",JSON.toJSONString(response));
163 return response; 164 return response;
164 165
165 }catch (Exception e){ 166 }catch (Exception e){