|
@@ -545,38 +545,40 @@ public class ItfwServer {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 人车核录
|
|
* 人车核录
|
|
|
|
+ *
|
|
* @param idNumber
|
|
* @param idNumber
|
|
* @param timeout
|
|
* @param timeout
|
|
*/
|
|
*/
|
|
- public PctrchlDTO getPctrchl(String idNumber, Integer timeout){
|
|
|
|
|
|
+ public PctrchlDTO getPctrchl(String idNumber, Integer timeout) {
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
String cacheKey = new StringBuilder().append(idNumber).append(ItfwConstant.PCTRCHL_KEY).toString();
|
|
String cacheKey = new StringBuilder().append(idNumber).append(ItfwConstant.PCTRCHL_KEY).toString();
|
|
String cacheValue = stringRedisTemplate.opsForValue().get(cacheKey);
|
|
String cacheValue = stringRedisTemplate.opsForValue().get(cacheKey);
|
|
- if(StrUtil.isNotEmpty(cacheValue)){
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(cacheValue)) {
|
|
log.info("人车核录服务走缓存读取,响应内容: {}", cacheValue);
|
|
log.info("人车核录服务走缓存读取,响应内容: {}", cacheValue);
|
|
return JSON.parseObject(cacheValue, PctrchlDTO.class);
|
|
return JSON.parseObject(cacheValue, PctrchlDTO.class);
|
|
}
|
|
}
|
|
|
|
|
|
String cacheStatusKey = ItfwConstant.PCTRCHL_STATUS_KEY;
|
|
String cacheStatusKey = ItfwConstant.PCTRCHL_STATUS_KEY;
|
|
String cacheStatusValue = stringRedisTemplate.opsForValue().get(cacheStatusKey);
|
|
String cacheStatusValue = stringRedisTemplate.opsForValue().get(cacheStatusKey);
|
|
- if(StrUtil.isNotEmpty(cacheStatusValue)){
|
|
|
|
|
|
+ if (StrUtil.isNotEmpty(cacheStatusValue)) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
PctrchlProperties properties = new PctrchlProperties();
|
|
PctrchlProperties properties = new PctrchlProperties();
|
|
BeanUtil.copyProperties(pctrchlProperties, properties);
|
|
BeanUtil.copyProperties(pctrchlProperties, properties);
|
|
PctrchlBodyDTO pctrchlBodyDTO = new PctrchlBodyDTO();
|
|
PctrchlBodyDTO pctrchlBodyDTO = new PctrchlBodyDTO();
|
|
- pctrchlBodyDTO.setDlxx(new PctrchlDlxxDTO().setSfzh(idNumber).setZsbh(idNumber).setUserCode(idNumber));
|
|
|
|
- properties.setBody(pctrchlBodyDTO).setRyxx(new PctrchlRyxxDTO().setZjhm(idNumber));
|
|
|
|
|
|
+ pctrchlBodyDTO.setDlxx(new PctrchlDlxxDTO());
|
|
|
|
+ pctrchlBodyDTO.setRyxx(new PctrchlRyxxDTO().setZjhm(idNumber));
|
|
|
|
+ properties.setBody(pctrchlBodyDTO);
|
|
log.info("人车核录服务请求入参:{}", JSON.toJSONString(properties));
|
|
log.info("人车核录服务请求入参:{}", JSON.toJSONString(properties));
|
|
String body = null;
|
|
String body = null;
|
|
|
|
|
|
try {
|
|
try {
|
|
body = this.baseAgentApi(properties, timeout);
|
|
body = this.baseAgentApi(properties, timeout);
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
}
|
|
}
|
|
@@ -590,11 +592,11 @@ public class ItfwServer {
|
|
Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
|
|
Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
|
|
stringRedisTemplate.delete(keys);
|
|
stringRedisTemplate.delete(keys);
|
|
|
|
|
|
- if(StrUtil.isEmpty(body)){
|
|
|
|
|
|
+ if (StrUtil.isEmpty(body) || !StrUtil.containsAnyIgnoreCase(body, "datas")) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
PctrchlVO pctrchlVO = JSON.parseObject(body, PctrchlVO.class);
|
|
PctrchlVO pctrchlVO = JSON.parseObject(body, PctrchlVO.class);
|
|
- if(CollectionUtil.isEmpty(pctrchlVO.getDatas())){
|
|
|
|
|
|
+ if (CollectionUtil.isEmpty(pctrchlVO.getDatas())) {
|
|
stringRedisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(null), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
|
|
stringRedisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(null), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|