|
@@ -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
|
} |