Authored by qinchao

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

@@ -19,9 +19,9 @@ public class UserAuthorizeHistory { @@ -19,9 +19,9 @@ public class UserAuthorizeHistory {
19 //银联返回内容 19 //银联返回内容
20 private String responseContent; 20 private String responseContent;
21 21
22 - private Integer createTime; 22 + private long createTime;
23 23
24 - private Integer updateTime; 24 + private long updateTime;
25 25
26 public Integer getId() { 26 public Integer getId() {
27 return id; 27 return id;
@@ -79,19 +79,19 @@ public class UserAuthorizeHistory { @@ -79,19 +79,19 @@ public class UserAuthorizeHistory {
79 this.responseContent = responseContent; 79 this.responseContent = responseContent;
80 } 80 }
81 81
82 - public Integer getCreateTime() { 82 + public long getCreateTime() {
83 return createTime; 83 return createTime;
84 } 84 }
85 85
86 - public void setCreateTime(Integer createTime) { 86 + public void setCreateTime(long createTime) {
87 this.createTime = createTime; 87 this.createTime = createTime;
88 } 88 }
89 89
90 - public Integer getUpdateTime() { 90 + public long getUpdateTime() {
91 return updateTime; 91 return updateTime;
92 } 92 }
93 93
94 - public void setUpdateTime(Integer updateTime) { 94 + public void setUpdateTime(long updateTime) {
95 this.updateTime = updateTime; 95 this.updateTime = updateTime;
96 } 96 }
97 } 97 }
@@ -16,9 +16,9 @@ public class UserAuthorizeInfo { @@ -16,9 +16,9 @@ public class UserAuthorizeInfo {
16 private String certNo; 16 private String certNo;
17 private String certName; 17 private String certName;
18 18
19 - private Integer createTime; 19 + private long createTime;
20 20
21 - private Integer updateTime; 21 + private long updateTime;
22 22
23 public Integer getId() { 23 public Integer getId() {
24 return id; 24 return id;
@@ -68,19 +68,19 @@ public class UserAuthorizeInfo { @@ -68,19 +68,19 @@ public class UserAuthorizeInfo {
68 this.certName = certName; 68 this.certName = certName;
69 } 69 }
70 70
71 - public Integer getCreateTime() { 71 + public long getCreateTime() {
72 return createTime; 72 return createTime;
73 } 73 }
74 74
75 - public void setCreateTime(Integer createTime) { 75 + public void setCreateTime(long createTime) {
76 this.createTime = createTime; 76 this.createTime = createTime;
77 } 77 }
78 78
79 - public Integer getUpdateTime() { 79 + public long getUpdateTime() {
80 return updateTime; 80 return updateTime;
81 } 81 }
82 82
83 - public void setUpdateTime(Integer updateTime) { 83 + public void setUpdateTime(long updateTime) {
84 this.updateTime = updateTime; 84 this.updateTime = updateTime;
85 } 85 }
86 } 86 }
@@ -16,6 +16,9 @@ public class AuthorizeResultRespVO extends BaseBO { @@ -16,6 +16,9 @@ public class AuthorizeResultRespVO extends BaseBO {
16 //认证的姓名 16 //认证的姓名
17 private String name; 17 private String name;
18 18
  19 + //创建时间
  20 + private long createTime;
  21 +
19 public int getUid() { 22 public int getUid() {
20 return uid; 23 return uid;
21 } 24 }
@@ -55,4 +58,12 @@ public class AuthorizeResultRespVO extends BaseBO { @@ -55,4 +58,12 @@ public class AuthorizeResultRespVO extends BaseBO {
55 public void setName(String name) { 58 public void setName(String name) {
56 this.name = name; 59 this.name = name;
57 } 60 }
  61 +
  62 + public long getCreateTime() {
  63 + return createTime;
  64 + }
  65 +
  66 + public void setCreateTime(long createTime) {
  67 + this.createTime = createTime;
  68 + }
58 } 69 }
@@ -30,6 +30,7 @@ import org.springframework.web.client.RestTemplate; @@ -30,6 +30,7 @@ import org.springframework.web.client.RestTemplate;
30 30
31 import javax.annotation.Resource; 31 import javax.annotation.Resource;
32 import java.time.LocalDateTime; 32 import java.time.LocalDateTime;
  33 +import java.time.ZoneOffset;
33 import java.time.format.DateTimeFormatter; 34 import java.time.format.DateTimeFormatter;
34 import java.util.Random; 35 import java.util.Random;
35 import java.util.concurrent.ExecutorService; 36 import java.util.concurrent.ExecutorService;
@@ -86,6 +87,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -86,6 +87,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
86 result.setCardNo(info.getCardNo()); 87 result.setCardNo(info.getCardNo());
87 result.setCertNo(info.getCertNo()); 88 result.setCertNo(info.getCertNo());
88 result.setName(info.getCertName()); 89 result.setName(info.getCertName());
  90 + result.setCreateTime(info.getCreateTime());
89 }else{ 91 }else{
90 result.setAuthorizeFlag(false); 92 result.setAuthorizeFlag(false);
91 } 93 }
@@ -118,6 +120,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -118,6 +120,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
118 int responseCode=responseEntity.getStatusCodeValue(); 120 int responseCode=responseEntity.getStatusCodeValue();
119 String responseContent=String.valueOf(responseEntity.getBody()); 121 String responseContent=String.valueOf(responseEntity.getBody());
120 ApiResponse apiResponse=new ApiResponse(400,responseContent,null); 122 ApiResponse apiResponse=new ApiResponse(400,responseContent,null);
  123 + long ts=getLocalDateTime().toEpochSecond(ZoneOffset.of("+8"));
121 if(responseCode==200){ 124 if(responseCode==200){
122 UserAuthorizeInfo userAuthorizeInfo =new UserAuthorizeInfo(); 125 UserAuthorizeInfo userAuthorizeInfo =new UserAuthorizeInfo();
123 try{ 126 try{
@@ -126,6 +129,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -126,6 +129,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
126 userAuthorizeInfo.setCardNo(cardNo); 129 userAuthorizeInfo.setCardNo(cardNo);
127 userAuthorizeInfo.setCertNo(certNo); 130 userAuthorizeInfo.setCertNo(certNo);
128 userAuthorizeInfo.setCertName(name); 131 userAuthorizeInfo.setCertName(name);
  132 + userAuthorizeInfo.setCreateTime(ts);
  133 + userAuthorizeInfo.setUpdateTime(ts);
129 userAuthorizeInfoDao.insert(userAuthorizeInfo); 134 userAuthorizeInfoDao.insert(userAuthorizeInfo);
130 135
131 apiResponse.setCode(200); 136 apiResponse.setCode(200);
@@ -139,7 +144,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -139,7 +144,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
139 } 144 }
140 145
141 //访问银联接口记录日志 146 //访问银联接口记录日志
142 - recordHistory(uid,cardNo,certNo,name,responseCode,responseContent); 147 + recordHistory(uid,cardNo,certNo,name,responseCode,responseContent,ts);
143 148
144 return apiResponse; 149 return apiResponse;
145 } 150 }
@@ -221,7 +226,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -221,7 +226,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
221 /** 226 /**
222 * 无论成功还是失败,都把访问记录日志表 227 * 无论成功还是失败,都把访问记录日志表
223 */ 228 */
224 - private void recordHistory(int uid,String cardNo,String certNo,String name,int responseCode,String responseContent){ 229 + private void recordHistory(int uid,String cardNo,String certNo,String name,int responseCode,String responseContent,long ts){
225 UserAuthorizeHistory history=new UserAuthorizeHistory(); 230 UserAuthorizeHistory history=new UserAuthorizeHistory();
226 history.setUid(uid); 231 history.setUid(uid);
227 history.setCardNo(cardNo); 232 history.setCardNo(cardNo);
@@ -229,7 +234,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -229,7 +234,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
229 history.setCertName(name); 234 history.setCertName(name);
230 history.setResponseCode(responseCode); 235 history.setResponseCode(responseCode);
231 history.setResponseContent(responseContent); 236 history.setResponseContent(responseContent);
232 - 237 + history.setCreateTime(ts);
  238 + history.setUpdateTime(ts);
233 //最后记录日志 ,异步 239 //最后记录日志 ,异步
234 executeService.execute(()->{ 240 executeService.execute(()->{
235 try{ 241 try{
@@ -251,8 +257,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -251,8 +257,7 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
251 String appId="2c909a515499b76b01549a01d2730000"; 257 String appId="2c909a515499b76b01549a01d2730000";
252 String appKey="keyqinchao"; 258 String appKey="keyqinchao";
253 //当前时间戳 ,要求格式 yyyyMMddHHmmss 259 //当前时间戳 ,要求格式 yyyyMMddHHmmss
254 - LocalDateTime now=LocalDateTime.now();  
255 - String timestamp=df.format(now); 260 + String timestamp=getLocalDateTime().format(df);
256 //随机的正整数,不超过128位 261 //随机的正整数,不超过128位
257 int nonce = (new Random()).nextInt(100000); 262 int nonce = (new Random()).nextInt(100000);
258 263
@@ -276,4 +281,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService { @@ -276,4 +281,8 @@ public class RealNameAuthorizeServiceImpl implements IRealNameAuthorizeService {
276 return sb.toString(); 281 return sb.toString();
277 } 282 }
278 283
  284 + private LocalDateTime getLocalDateTime(){
  285 + LocalDateTime now=LocalDateTime.now();
  286 + return now;
  287 + }
279 } 288 }