Browse Source

人车核录接口参数初始值,返回数据处理

FanQun 2 years ago
parent
commit
b2233e0fdf

+ 1 - 1
src/main/java/com/rshy/project/hy/config/properties/PctrchlProperties.java

@@ -20,5 +20,5 @@ import org.springframework.context.annotation.Configuration;
 public class PctrchlProperties extends AgentApiParam {
     private PctrchlBodyDTO body;
 
-    private PctrchlRyxxDTO ryxx;
+
 }

+ 12 - 4
src/main/java/com/rshy/project/hy/manager/impl/RshyJkManagerImpl.java

@@ -16,6 +16,7 @@ import com.rshy.project.hy.model.enums.SexEnum;
 import com.rshy.project.hy.server.FaceRetrievaServer;
 import com.rshy.project.hy.server.ItfwServer;
 import com.rshy.project.hy.server.dto.PctjkmInfoDTO;
+import com.rshy.project.hy.server.dto.PctrchlDTO;
 import com.rshy.project.hy.server.dto.RepositoryDTO;
 import com.rshy.project.hy.server.dto.ResultDTO;
 import com.rshy.project.hy.server.param.RshyParam;
@@ -27,7 +28,6 @@ import com.rshy.project.hy.util.ObjectUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
@@ -119,9 +119,16 @@ public class RshyJkManagerImpl implements RshyJkManager {
         Date date = DateUtil.parse(IdcardUtil.getBirthByIdCard(rshyParam.getSfzh()));
         rshyVo.setBirthday(DateUtil.format(date, "yyyy-M-d"));
 
-        if (resultDTO.getPctztDTO() != null) {
+        PctrchlDTO pctrchlDTO = resultDTO.getPctrchlDTO();
+        resultDTO.setPctrchlDTO(null);
+        String hcjg = "";
+        if (pctrchlDTO != null) {
+            hcjg = pctrchlDTO.getHcjg();
+        }
+
+        if (resultDTO.getPctztDTO() != null || StrUtil.containsAnyIgnoreCase(hcjg, "抓捕")) {
             rshyVo.setPass(PassStatusEnum.NO_PASSING.getCode()).setTts(PassStatusEnum.NO_PASSING.getDesc()).setDisplayMsg(PassStatusEnum.NO_PASSING.getDesc()).setWarning(new StringBuilder().append("在逃人员:").append(resultDTO.getPctztDTO().getJyaq()).toString()).setKind(resultDTO.getPctztDTO().getZtrylxmc());
-        } else if (ObjectUtils.allFieldIsNULL(resultDTO)) {
+        } else if (ObjectUtils.allFieldIsNULL(resultDTO) || StrUtil.containsAnyIgnoreCase(hcjg, "通过")) {
             rshyVo.setPass(PassStatusEnum.NORMAL_TRAFFIC.getCode()).setDisplayMsg(PassStatusEnum.NORMAL_TRAFFIC.getDesc()).setTts(PassStatusEnum.NORMAL_TRAFFIC.getDesc());
         } else {
             rshyVo.setPass(PassStatusEnum.RIGHT_WAY.getCode()).setKind(kind(resultDTO)).setWarning(warning(resultDTO)).setDisplayMsg(PassStatusEnum.RIGHT_WAY.getDesc()).setTts(PassStatusEnum.RIGHT_WAY.getDesc());
@@ -161,6 +168,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
 
     /**
      * 今日进站次数
+     *
      * @param idNumber 身份证号
      * @return
      */
@@ -170,7 +178,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
         String timesStr = stringRedisTemplate.opsForValue().get(cacheKey);
         if (timesStr == null) {
             //今日进站次数
-            stringRedisTemplate.opsForValue().set(cacheKey, String.valueOf(times),DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
+            stringRedisTemplate.opsForValue().set(cacheKey, String.valueOf(times), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
         } else {
             times = Integer.valueOf(timesStr) + 1;
             stringRedisTemplate.opsForValue().increment(cacheKey);

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

@@ -545,38 +545,40 @@ 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;
         }
 
         PctrchlProperties properties = new PctrchlProperties();
         BeanUtil.copyProperties(pctrchlProperties, properties);
         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));
         String body = null;
 
         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);
             }
@@ -590,11 +592,11 @@ public class ItfwServer {
         Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
         stringRedisTemplate.delete(keys);
 
-        if(StrUtil.isEmpty(body)){
+        if (StrUtil.isEmpty(body) || !StrUtil.containsAnyIgnoreCase(body, "datas")) {
             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;
         }

+ 3 - 1
src/main/java/com/rshy/project/hy/server/dto/PctrchlBodyDTO.java

@@ -8,7 +8,7 @@ import lombok.Data;
  * @description:
  */
 @Data
-public class PctrchlBodyDTO {
+public class    PctrchlBodyDTO {
     private String appId = "330196";
 
     private String examineType = "person";
@@ -27,4 +27,6 @@ public class PctrchlBodyDTO {
 
     private PctrchlDlxxDTO dlxx;
 
+    private PctrchlRyxxDTO ryxx;
+
 }

+ 5 - 5
src/main/java/com/rshy/project/hy/server/dto/PctrchlDlxxDTO.java

@@ -11,14 +11,14 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 public class PctrchlDlxxDTO {
-    private String xm;
-    private String sfzh;
-    private String sjhml;
+    private String xm = "陈云刚";
+    private String sfzh = "331081198709099418";
+    private String sjhm = "13616542978";
     private String jgdm = "";
-    private String zsbh;
+    private String zsbh = "331081198709099418";
     private String dlip = "41.196.218.11";
     private String hcdz = "定安路地铁口";
-    private String userCode;
+    private String userCode = "331081198709099418";
     private String orgCode = "330103590000";
     private String jyCode = "113826";
     private String jyName = "陈云刚";