Browse Source

增加 常规盘查核验接口,后面提供供给场所码扫描记录调用

FanQun 2 years ago
parent
commit
6b3480db1f

+ 9 - 0
src/main/java/com/rshy/project/hy/manager/RshyJkManager.java

@@ -1,5 +1,6 @@
 package com.rshy.project.hy.manager;
 
+import com.rshy.project.hy.server.param.RshyCommonParam;
 import com.rshy.project.hy.server.param.RshyParam;
 import com.rshy.project.hy.server.param.RshyQuickParam;
 import com.rshy.project.hy.server.vo.RshyVo;
@@ -27,4 +28,12 @@ public interface RshyJkManager {
      * @return
      */
     RshyVo getQuickRyhyInfo(RshyQuickParam rshyQuickParam);
+
+    /**
+     * 常规盘查核验
+     *
+     * @param rshyCommonParam 核验参数
+     * @return
+     */
+    RshyVo getCommonRshy(RshyCommonParam rshyCommonParam);
 }

+ 64 - 1
src/main/java/com/rshy/project/hy/manager/impl/RshyJkManagerImpl.java

@@ -20,6 +20,7 @@ import com.rshy.project.hy.server.ItfwServer;
 import com.rshy.project.hy.server.VIIDServer;
 import com.rshy.project.hy.server.YituFaceServer;
 import com.rshy.project.hy.server.dto.*;
+import com.rshy.project.hy.server.param.RshyCommonParam;
 import com.rshy.project.hy.server.param.RshyParam;
 import com.rshy.project.hy.server.param.RshyQuickParam;
 import com.rshy.project.hy.server.vo.RetrievaResultVO;
@@ -79,7 +80,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
     @Override
     @Async("hstTaskExecutor")
     public Future<RshyVo> getRshyInfo(RshyParam rshyParam) {
-        // timeout 转成毫秒 这里考虑到网络传输延时等原因,减去300ms
+        // timeout 转成毫秒 这里考虑到网络传输延时等原因,减去500ms
         rshyParam.setTimeout((int) TimeUnit.MILLISECONDS.convert(rshyParam.getTimeout(), TimeUnit.SECONDS));
         int jkmTimeout = rshyParam.getTimeout() - 500;
         RshyVo rshyVo = new RshyVo();
@@ -395,6 +396,68 @@ public class RshyJkManagerImpl implements RshyJkManager {
         return rshyVo;
     }
 
+    @Override
+    public RshyVo getCommonRshy(RshyCommonParam rshyCommonParam) {
+        int timeout = rshyCommonParam.getTimeout() * 1000 - 100;
+        RshyVo rshyVo = new RshyVo();
+        PctgkryDTO gkryDTO = new PctgkryDTO();
+        ResultDTO resultDTO = new ResultDTO();
+        resultDTO.setPctgkryDTO(gkryDTO);
+
+        rshyVo.setSfzh(rshyCommonParam.getSfzh());
+        rshyVo.setXm(rshyCommonParam.getXm());
+
+        List<Runnable> taskList = new ArrayList<Runnable>() {
+            {
+                add(() -> resultDTO.getPctgkryDTO().setPctdfkDTO(itfwServer.getPctdfk(rshyCommonParam.getSfzh(), "", timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctjsryDTO(itfwServer.getPctjsry(rshyCommonParam.getSfzh(), timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctztDTO(itfwServer.getPctzt(rshyCommonParam.getSfzh(), timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctzfbaDTO(itfwServer.getPctzfba(rshyCommonParam.getSfzh(), timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctqkryDTO(itfwServer.getPctqkry(rshyCommonParam.getSfzh(), timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctxdryDTO(itfwServer.getPctxdry(rshyCommonParam.getSfzh(), "", timeout)));
+                add(() -> resultDTO.getPctgkryDTO().setPctzdryDTO(itfwServer.getPctzdry(rshyCommonParam.getSfzh(), timeout)));
+                add(() -> resultDTO.setPctrchlDTO(itfwServer.getPctrchl(rshyCommonParam.getSfzh(), null, timeout)));
+                add(() -> resultDTO.setPctzdrydkResultDTO(itfwServer.getPctzdrydk(rshyCommonParam.getSfzh(), rshyCommonParam.getTimeout())));
+            }
+        };
+
+        try {
+            log.info("{}个任务, 用时 {}毫秒", taskList.size(), startTaskAllInOnce(taskList, timeout + 100));
+        } catch (InterruptedException e) {
+            log.error("异常信息:{}", e.getMessage());
+            e.printStackTrace();
+        }
+
+        log.info("IT服务平台接口调用完成");
+
+        //人车核录核查结果
+        String hcjg = resultDTO.getPctrchlDTO() == null ? "" : resultDTO.getPctrchlDTO().getHcjg();
+
+        if (StrUtil.containsAnyIgnoreCase(hcjg, RchljgEnum.CAPTURE.getDesc()) || StrUtil.containsAnyIgnoreCase(hcjg, RchljgEnum.INTERCEPT.getDesc())) {
+            //人车核录接口返回抓捕或者拦截
+            if (StrUtil.isNotBlank(resultDTO.getPctrchlDTO().getXm())) {
+                rshyVo.setXm(resultDTO.getPctrchlDTO().getXm());
+                rshyVo.setMz(EnumUtil.likeValueOf(Nation.class, resultDTO.getPctrchlDTO().getMz()).getDesc());
+            }
+            rshyVo.setPassStatus(PassStatusEnum.NO_PASSING).setKind(kind(resultDTO)).setWarning(warning(resultDTO));
+        } else if (resultDTO.getPctgkryDTO().getPctztDTO() != null && resultDTO.getPctgkryDTO().getPctztDTO().getRyztmc().equalsIgnoreCase("在逃")) {
+            //在逃接口返回并且ryztmc字段为在逃
+            rshyVo.setXm(resultDTO.getPctgkryDTO().getPctztDTO().getXm());
+            rshyVo.setPassStatus(PassStatusEnum.NO_PASSING).setKind(kind(resultDTO)).setWarning(warning(resultDTO));
+        } else if (!ObjectUtils.allFieldIsNULL(resultDTO.getPctgkryDTO()) || StrUtil.containsAnyIgnoreCase(hcjg, RchljgEnum.IN_DOUBT.getDesc())) {
+            //七大类管控人员和人车核录接口返回存疑人员
+            rshyVo.setPassStatus(PassStatusEnum.RIGHT_WAY).setKind(kind(resultDTO)).setWarning(warning(resultDTO));
+        } else if (resultDTO.getPctzdrydkResultDTO() != null && resultDTO.getPctzdrydkResultDTO().getTotal() > 0) {
+            //杭州市重点人员底库查询接口
+            rshyVo.setPassStatus(PassStatusEnum.RIGHT_WAY).setKind(resultDTO.getPctzdrydkResultDTO().getData().get(0).getRyflList()[0]);
+        } else {
+            //正常通过
+            rshyVo.setPassStatus(PassStatusEnum.NORMAL_TRAFFIC);
+        }
+
+        return rshyVo;
+    }
+
     /**
      * 依图接口
      *

+ 27 - 0
src/main/java/com/rshy/project/hy/server/param/RshyCommonParam.java

@@ -0,0 +1,27 @@
+package com.rshy.project.hy.server.param;
+
+import com.rshy.project.hy.model.constant.WebConstant;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 常规盘查核验请求参数
+ *
+ * Created by fanqun on 2022/6/20.
+ */
+@Data
+@Accessors(chain = true)
+@ApiModel("常规盘查核验请求参数")
+public class RshyCommonParam {
+    @ApiModelProperty("身份证号")
+    private String sfzh;
+
+    @ApiModelProperty("姓名")
+    private String xm;
+
+    @ApiModelProperty("超时时间")
+    private Integer timeout = WebConstant.TIMEOUT;
+
+}

+ 26 - 1
src/main/java/com/rshy/project/hy/web/controller/RshyController.java

@@ -13,6 +13,7 @@ import com.rshy.project.hy.manager.RshyJkManager;
 import com.rshy.project.hy.model.constant.WebConstant;
 import com.rshy.project.hy.model.entity.Identity;
 import com.rshy.project.hy.model.enums.PassStatusEnum;
+import com.rshy.project.hy.server.param.RshyCommonParam;
 import com.rshy.project.hy.server.param.RshyParam;
 import com.rshy.project.hy.server.param.RshyQuickParam;
 import com.rshy.project.hy.server.vo.RshyVo;
@@ -22,7 +23,10 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import java.util.concurrent.ExecutionException;
@@ -107,4 +111,25 @@ public class RshyController {
         log.info("快速核验响应内容:{}", JSON.toJSONString(rshyVo));
         return Ret.success(rshyVo);
     }
+
+    @ApiOperation("常规盘查核验")
+    @PostMapping("getPchyInfo")
+    public Ret<RshyVo> getPchyInfo(@RequestBody RshyCommonParam rshyParam) {
+        if (StringUtils.isNotBlank(rshyParam.getSfzh()) && !IdcardUtil.isValidCard(rshyParam.getSfzh()) && !PatternUtil.isIDNumber(rshyParam.getSfzh())) {
+            log.error("无效的身份证号码");
+            //return Ret.error(ResultCode.INVALID_ID_NUMBER);
+            throw new BaseException(ResultCode.INVALID_ID_NUMBER);
+        }
+
+        DateTime time1 = DateTime.now();
+
+        log.info("常规盘查核验接口请求参数:{}", JSON.toJSONString(rshyParam));
+
+        RshyVo rshyVo = rshyJkManager.getCommonRshy(rshyParam);
+
+        log.info("常规盘查核验响应内容:{}", StrUtil.brief(JSON.toJSONString(rshyVo), WebConstant.DISPLAY_MAX_LENGTH * 2));
+        System.out.println("常规盘查核验接口用时: " + DateUtil.between(time1, DateTime.now(), DateUnit.MS) + "毫秒\n");
+        return Ret.success(rshyVo);
+    }
+
 }