Quellcode durchsuchen

Merge remote-tracking branch 'remotes/origin/master' into master

# Conflicts:
#	src/main/java/com/rshy/project/hy/server/ItfwServer.java
FanQun vor 2 Jahren
Ursprung
Commit
3279ae79b8
1 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen
  1. 8 7
      src/main/java/com/rshy/project/hy/server/ItfwServer.java

+ 8 - 7
src/main/java/com/rshy/project/hy/server/ItfwServer.java

@@ -545,25 +545,24 @@ public class ItfwServer {
 
     /**
      * 人车核录
-     *
      * @param idNumber
      * @param timeout
      */
-    public PctrchlDTO getPctrchl(String idNumber, Integer timeout) {
+    public PctrchlDTO getPctrchl(String idNumber, Integer timeout){
         if (StringUtils.isBlank(idNumber)) {
             return null;
         }
 
         String cacheKey = new StringBuilder().append(idNumber).append(ItfwConstant.PCTRCHL_KEY).toString();
         String cacheValue = stringRedisTemplate.opsForValue().get(cacheKey);
-        if (StrUtil.isNotEmpty(cacheValue)) {
+        if(StrUtil.isNotEmpty(cacheValue)){
             log.info("人车核录服务走缓存读取,响应内容: {}", cacheValue);
             return JSON.parseObject(cacheValue, PctrchlDTO.class);
         }
 
         String cacheStatusKey = ItfwConstant.PCTRCHL_STATUS_KEY;
         String cacheStatusValue = stringRedisTemplate.opsForValue().get(cacheStatusKey);
-        if (StrUtil.isNotEmpty(cacheStatusValue)) {
+        if(StrUtil.isNotEmpty(cacheStatusValue)){
             return null;
         }
 
@@ -577,10 +576,11 @@ public class ItfwServer {
 
         try {
             body = this.baseAgentApi(properties, timeout);
-        } catch (Exception e) {
+        }catch (Exception e){
             if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
                 stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
             }
+
             log.error("请求人车核录服务接口超时异常:{} {}", e.getMessage(), e.getLocalizedMessage());
             e.printStackTrace();
             return null;
@@ -589,11 +589,12 @@ public class ItfwServer {
         log.info("人车核录服务响应信息:{}", body);
         Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
         stringRedisTemplate.delete(keys);
-        if (StrUtil.isEmpty(body)) {
+
+        if(StrUtil.isEmpty(body)){
             return null;
         }
         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);
             return null;
         }