Browse Source

暂时不调用省厅常口库置信接口

FanQun 2 years ago
parent
commit
139c9e7973

+ 24 - 22
src/main/java/com/rshy/project/hy/manager/impl/RshyJkManagerImpl.java

@@ -64,25 +64,25 @@ public class RshyJkManagerImpl implements RshyJkManager {
         ResultDTO resultDTO = new ResultDTO();
         resultDTO.setPctgkryDTO(gkryDTO);
         DateTime beginDate = DateTime.now();
-        PctjkmInfoDTO barCodes = null;
+        PctjkmInfoDTO jkmInfo = null;
 
         if (StringUtils.isNotBlank(rshyParam.getBarCode()) || StringUtils.isNotBlank(rshyParam.getSfzh())) {
             try {
                 //查询健康码信息
-                barCodes = itfwServer.getPctjkm(rshyParam.getBarCode(), rshyParam.getSfzh(), rshyParam.getTimeout());
+                jkmInfo = itfwServer.getPctjkm(rshyParam.getBarCode(), rshyParam.getSfzh(), rshyParam.getTimeout());
             } catch (Exception e) {
                 log.error("查询健康码信息异常:{}", e.getMessage());
                 e.printStackTrace();
             }
 
-            if (barCodes == null) {
+            if (jkmInfo == null) {
                 return rshyVo;
             }
 
-            rshyParam.setSfzh(barCodes.getId_num());
-            rshyParam.setXm(barCodes.getUser_name());
-            String codeLabel = barCodes.getCOLOR_CODE_LABEL();
-            String phone = barCodes.getPn();
+            rshyParam.setSfzh(jkmInfo.getId_num());
+            rshyParam.setXm(jkmInfo.getUser_name());
+            String codeLabel = jkmInfo.getCOLOR_CODE_LABEL();
+            String phone = jkmInfo.getPn();
             rshyVo.setXm(rshyParam.getXm()).setSfzh(rshyParam.getSfzh()).setHealthCode(codeLabel).setPhone(phone);
         }
 
@@ -95,13 +95,15 @@ public class RshyJkManagerImpl implements RshyJkManager {
                 add(() -> resultDTO.setPcthsResultDTO(itfwServer.getPcths(rshyParam.getSfzh(), rshyParam.getTimeout())));
 
                 if (StrUtil.isNotBlank(rshyParam.getPhoto())) {
-                    add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
+                    //add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
                     add(() -> quickRshyVo.set(getQuickRyhyInfo(new RshyQuickParam().setPhoto(rshyParam.getPhoto()).setTimeout(rshyParam.getTimeout()))));
                 }
             }
         };
 
-        if (rshyParam.getScreenLocked() == 0 && (barCodes == null || PassStatusEnum.GREEN_CODE.getDesc().equals(barCodes.getCOLOR_CODE_LABEL()))) {
+        //if (rshyParam.getScreenLocked() == 0 && (barCodes == null || PassStatusEnum.GREEN_CODE.getDesc().equals(barCodes.getCOLOR_CODE_LABEL()))) {
+        //绿码人员继续进行七大类管控接口和人车核录接口比对
+        if (jkmInfo != null && PassStatusEnum.GREEN_CODE.getDesc().equals(jkmInfo.getCOLOR_CODE_LABEL())) {
             taskList.add(() -> resultDTO.getPctgkryDTO().setPctdfkDTO(itfwServer.getPctdfk(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
             taskList.add(() -> resultDTO.getPctgkryDTO().setPctjsryDTO(itfwServer.getPctjsry(rshyParam.getSfzh(), rshyParam.getTimeout())));
             taskList.add(() -> resultDTO.getPctgkryDTO().setPctztDTO(itfwServer.getPctzt(rshyParam.getSfzh(), rshyParam.getTimeout())));
@@ -133,44 +135,44 @@ public class RshyJkManagerImpl implements RshyJkManager {
         rshyVo.setXb(SexEnum.codeOf(IdcardUtil.getGenderByIdCard(rshyParam.getSfzh())).getDesc());
         Date date = DateUtil.parse(IdcardUtil.getBirthByIdCard(rshyParam.getSfzh()));
         rshyVo.setBirthday(DateUtil.format(date, "yyyy-M-d"));
-        PctrchlDTO pctrchlDTO = resultDTO.getPctrchlDTO();
-        //resultDTO.setPctrchlDTO(null);
-        String hcjg = "";
-        if (pctrchlDTO != null) {
-            hcjg = pctrchlDTO.getHcjg();
-        }
+
+        String hcjg = resultDTO.getPctrchlDTO() == null ? "" : resultDTO.getPctrchlDTO().getHcjg();
+
 
         //if (rshyVo.getNucleic_acid().getStatus() == 0) {
         //    rshyVo.setPass(PassStatusEnum.NO_COMPLIANCE.getCode()).setTts(PassStatusEnum.NO_COMPLIANCE.getTts()).setDisplayMsg(PassStatusEnum.NO_COMPLIANCE.getDesc());
         //}else {
 
+        System.out.println("省厅置信接口: " + resultDTO.getPersonIdentifyDTO());
         if (resultDTO.getPersonIdentifyDTO() != null && !rshyParam.getSfzh().equals(resultDTO.getPersonIdentifyDTO().getIdNumber())) {
-            //证或者人码不符
+            //证或者人码不符
             rshyVo.setPass(PassStatusEnum.NO_MATCHED.getCode()).setTimes(times(rshyParam.getSfzh())).setTts(PassStatusEnum.NO_MATCHED.getTts()).setDisplayMsg(PassStatusEnum.NO_MATCHED.getDesc()).setWarning(PassStatusEnum.NO_MATCHED.getDesc()).setKind(PassStatusEnum.NO_MATCHED.getDesc());
-        } else if (barCodes != null && PassStatusEnum.RED_CODE.getDesc().equalsIgnoreCase(barCodes.getCOLOR_CODE_LABEL())) {
+        } else if (jkmInfo != null && PassStatusEnum.RED_CODE.getDesc().equalsIgnoreCase(jkmInfo.getCOLOR_CODE_LABEL())) {
             //红码
             rshyVo.setPass(PassStatusEnum.RED_CODE.getCode()).setTimes(times(rshyParam.getSfzh())).setTts(PassStatusEnum.RED_CODE.getTts()).setDisplayMsg(PassStatusEnum.RED_CODE.getDesc()).setWarning(PassStatusEnum.RED_CODE.getDesc()).setKind("健康码" + PassStatusEnum.RED_CODE.getDesc());
-        } else if (barCodes != null && PassStatusEnum.YELLOW_CODE.getDesc().equalsIgnoreCase(barCodes.getCOLOR_CODE_LABEL())) {
+        } else if (jkmInfo != null && PassStatusEnum.YELLOW_CODE.getDesc().equalsIgnoreCase(jkmInfo.getCOLOR_CODE_LABEL())) {
             //黄码
             rshyVo.setPass(PassStatusEnum.YELLOW_CODE.getCode()).setTimes(times(rshyParam.getSfzh())).setTts(PassStatusEnum.YELLOW_CODE.getTts()).setDisplayMsg(PassStatusEnum.YELLOW_CODE.getDesc()).setWarning(PassStatusEnum.YELLOW_CODE.getDesc()).setKind("健康码" + PassStatusEnum.YELLOW_CODE.getDesc());
         } else if (resultDTO.getPctgkryDTO().getPctztDTO() != null || StrUtil.containsAnyIgnoreCase(hcjg, "抓捕") || StrUtil.containsAnyIgnoreCase(hcjg, "拦截")) {
             //在逃 或者 人车核录接口返回 抓捕或者拦截
             rshyVo.setPass(PassStatusEnum.NO_PASSING.getCode()).setTts(PassStatusEnum.NO_PASSING.getTts()).setDisplayMsg(PassStatusEnum.NO_PASSING.getDesc()).setWarning("在逃人员:" + resultDTO.getPctgkryDTO().getPctztDTO().getJyaq()).setKind(resultDTO.getPctgkryDTO().getPctztDTO().getZtrylxmc());
-        //} else if (ObjectUtils.allFieldIsNULL(resultDTO.getPctgkryDTO()) || StrUtil.containsAnyIgnoreCase(hcjg, "通过")) {
-        //    rshyVo.setPass(PassStatusEnum.NORMAL_TRAFFIC.getCode()).setDisplayMsg(PassStatusEnum.NORMAL_TRAFFIC.getDesc()).setTts(PassStatusEnum.NORMAL_TRAFFIC.getTts());
+            //} else if (ObjectUtils.allFieldIsNULL(resultDTO.getPctgkryDTO()) || StrUtil.containsAnyIgnoreCase(hcjg, "通过")) {
+            //    rshyVo.setPass(PassStatusEnum.NORMAL_TRAFFIC.getCode()).setDisplayMsg(PassStatusEnum.NORMAL_TRAFFIC.getDesc()).setTts(PassStatusEnum.NORMAL_TRAFFIC.getTts());
         } else if (!ObjectUtils.allFieldIsNULL(resultDTO.getPctgkryDTO()) || StrUtil.containsAnyIgnoreCase(hcjg, "存疑")) {
+            //七大类管控人员(在逃除外)和人车核录接口返回存疑人员
             rshyVo.setPass(PassStatusEnum.RIGHT_WAY.getCode()).setKind(kind(resultDTO)).setWarning(warning(resultDTO)).setDisplayMsg(PassStatusEnum.RIGHT_WAY.getDesc()).setTts(PassStatusEnum.RIGHT_WAY.getTts());
         } else if (quickRshyVo.get() != null && StrUtil.isNotEmpty(quickRshyVo.get().getSfzh())) {
             //快速通行
             rshyVo = quickRshyVo.get();
         } else {
+            //正常通过
             rshyVo.setPass(PassStatusEnum.NORMAL_TRAFFIC.getCode()).setDisplayMsg(PassStatusEnum.NORMAL_TRAFFIC.getDesc()).setTts(PassStatusEnum.NORMAL_TRAFFIC.getTts());
         }
 
         if (rshyVo.getHealthCode() != null) {
             rshyVo.setTts(rshyVo.getHealthCode());
         }
-        //}
+
         log.info("普通核验响应内容:{}", JSON.toJSONString(rshyVo));
         return rshyVo;
     }
@@ -227,7 +229,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
                 .setWarning(stringMap.get(repositoryVO.getRepository_id())).setDisplayMsg(RepositoryEnum.COUNTRY_LARGE.getId().equals(repositoryVO.getRepository_id()) ? PassStatusEnum.NO_PASSING.getDesc() : PassStatusEnum.RIGHT_WAY.getDesc())
                 .setTts(RepositoryEnum.COUNTRY_LARGE.getId().equals(repositoryVO.getRepository_id()) ? PassStatusEnum.NO_PASSING.getTts() : PassStatusEnum.RIGHT_WAY.getTts()).setHealthCode(StrUtil.EMPTY).setSfzh(repositoryVO.getPersonId())
                 .setXm(repositoryVO.getName()).setXb(SexEnum.codeOf(repositoryVO.getGender()).getDesc()).setMz(StrUtil.EMPTY).setPhone(StrUtil.EMPTY).setAddress(StrUtil.EMPTY).setPhoto(rshyQuickParam.getPhoto());
-        log.info("快速核验响应内容:{}", JSON.toJSONString(rshyVo));
+        //log.info("快速核验响应内容:{}", JSON.toJSONString(rshyVo));
         return rshyVo;
     }
 

+ 3 - 3
src/main/java/com/rshy/project/hy/server/VIIDServer.java

@@ -39,13 +39,13 @@ public class VIIDServer {
     public PersonIdentifyDTO personIdentify(String photo, Integer timeout) {
         PersonIdentifyBodyDTO bodyDTO = new PersonIdentifyBodyDTO().setProfileID("10111").setPriority("1");
         bodyDTO.setFaceImageList(Lists.newArrayList(new PersonIdentifyImageDTO().setImageID("1").setData(photo).setShotTime(String.valueOf(System.currentTimeMillis())).setDeviceID("010101")));
-        //log.info("浙江省厅统一身份置信接口服务请求入参:{}", JSON.toJSONString(bodyDTO));
+        log.info("浙江省厅统一身份置信接口服务请求入参:{}", JSON.toJSONString(bodyDTO));
         String body = HttpRequest.post(url).header(HEADERS_KEY, userIdentify).body(JSON.toJSONString(bodyDTO)).timeout(timeout).execute().body();
-        //log.info("浙江省厅统一身份置信接口服务响应信息:{}", body);
+        log.info("浙江省厅统一身份置信接口服务响应信息:{}", body);
         PersonIdentifyVO personIdentifyVO = JSON.parseObject(body, PersonIdentifyVO.class);
 
         if (personIdentifyVO != null && !"0".equals(personIdentifyVO.getCode())) {
-            throw new BaseException(personIdentifyVO.getMsg());
+            throw new BaseException(Integer.parseInt(personIdentifyVO.getCode()), personIdentifyVO.getMsg());
         }
 
         return CollectionUtil.isEmpty(personIdentifyVO.getResults()) ? null : personIdentifyVO.getResults().stream().findFirst().get();

+ 8 - 4
src/main/java/com/rshy/project/hy/web/controller/RshyController.java

@@ -1,6 +1,6 @@
 package com.rshy.project.hy.web.controller;
 
-import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.rshy.project.hy.baseRe.Ret;
 import com.rshy.project.hy.manager.RshyJkManager;
 import com.rshy.project.hy.server.param.RshyParam;
@@ -9,6 +9,7 @@ import com.rshy.project.hy.server.vo.RshyVo;
 import com.rshy.project.hy.util.PatternUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @Api(tags = "人身核验控制层")
 @RequestMapping("/rshy")
+@Slf4j
 public class RshyController {
     @Autowired
     private RshyJkManager rshyJkManager;
@@ -36,7 +38,7 @@ public class RshyController {
     @PostMapping("getRyhyInfo")
     public Ret<RshyVo> getRyhyInfo(@RequestBody RshyParam rshyParam) {
         if (StringUtils.isNotBlank(rshyParam.getSfzh()) && !PatternUtil.isIDNumber(rshyParam.getSfzh())) {
-            return Ret.error(10001,"身份证不合法");
+            return Ret.error(10001, "身份证不合法");
         }
 
         /*
@@ -51,7 +53,9 @@ public class RshyController {
 
     @ApiOperation("人脸快速核验模式")
     @PostMapping("getQuickRyhyInfo")
-    public Ret<RshyVo> getQuickRyhyInfo(@RequestBody RshyQuickParam rshyQuickParam){
-        return Ret.success(rshyJkManager.getQuickRyhyInfo(rshyQuickParam));
+    public Ret<RshyVo> getQuickRyhyInfo(@RequestBody RshyQuickParam rshyQuickParam) {
+        RshyVo rshyVo = rshyJkManager.getQuickRyhyInfo(rshyQuickParam);
+        log.info("快速核验响应内容:{}", JSON.toJSONString(rshyVo));
+        return Ret.success(rshyVo);
     }
 }