Browse Source

省厅置信接口入参首字母大写

FanQun 2 years ago
parent
commit
a8544752e4

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

@@ -85,7 +85,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
 
         rshyParam.setTimeout((int) (rshyParam.getTimeout() - DateUtil.between(beginDate, DateTime.now(), DateUnit.MS)));
         List<Runnable> taskList = null;
-        if(barCodes == null || PassStatusEnum.GREEN_CODE.getDesc().equals(barCodes.getCOLOR_CODE_LABEL())) {
+        if (barCodes == null || PassStatusEnum.GREEN_CODE.getDesc().equals(barCodes.getCOLOR_CODE_LABEL())) {
             taskList = new ArrayList<Runnable>() {
                 {
                     add(() -> resultDTO.setPctdfkDTO(itfwServer.getPctdfk(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
@@ -98,15 +98,17 @@ public class RshyJkManagerImpl implements RshyJkManager {
                     add(() -> resultDTO.setPctrchlDTO(itfwServer.getPctrchl(rshyParam.getSfzh(), rshyParam.getTimeout())));
                     add(() -> resultDTO.setPctymDataDTOS(itfwServer.getPctym(rshyParam.getSfzh(), rshyParam.getTimeout())));
                     add(() -> resultDTO.setPcthsResultDTO(itfwServer.getPcths(rshyParam.getSfzh(), rshyParam.getTimeout())));
-                    add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
+                    if (StrUtil.isNotBlank(rshyParam.getPhoto()))
+                        add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
                 }
             };
-        }else{
+        } else {
             taskList = new ArrayList<Runnable>() {
                 {
                     add(() -> resultDTO.setPctymDataDTOS(itfwServer.getPctym(rshyParam.getSfzh(), rshyParam.getTimeout())));
                     add(() -> resultDTO.setPcthsResultDTO(itfwServer.getPcths(rshyParam.getSfzh(), rshyParam.getTimeout())));
-                    add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
+                    if (StrUtil.isNotBlank(rshyParam.getPhoto()))
+                        add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
                 }
             };
         }
@@ -135,14 +137,14 @@ public class RshyJkManagerImpl implements RshyJkManager {
             hcjg = pctrchlDTO.getHcjg();
         }
 
-        if(resultDTO.getPersonIdentifyDTO() != null && !rshyParam.getSfzh().equals(resultDTO.getPersonIdentifyDTO().getIdNumber())){
-            rshyVo.setPass(PassStatusEnum.NO_PASSING.getCode()).setTimes(times(rshyParam.getSfzh())).setTts(PassStatusEnum.NO_PASSING.getTts()).setDisplayMsg(PassStatusEnum.NO_PASSING.getDesc()).setWarning(PassStatusEnum.NO_PASSING.getDesc()).setKind("人证不一致");
+        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())) {
             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())) {
             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.getPctztDTO() != null || StrUtil.containsAnyIgnoreCase(hcjg, "抓捕")) {
-            rshyVo.setPass(PassStatusEnum.NO_PASSING.getCode()).setTts(PassStatusEnum.NO_PASSING.getTts()).setDisplayMsg(PassStatusEnum.NO_PASSING.getDesc()).setWarning(new StringBuilder().append("在逃人员:").append(resultDTO.getPctztDTO().getJyaq()).toString()).setKind(resultDTO.getPctztDTO().getZtrylxmc());
+            rshyVo.setPass(PassStatusEnum.NO_PASSING.getCode()).setTts(PassStatusEnum.NO_PASSING.getTts()).setDisplayMsg(PassStatusEnum.NO_PASSING.getDesc()).setWarning("在逃人员:" + resultDTO.getPctztDTO().getJyaq()).setKind(resultDTO.getPctztDTO().getZtrylxmc());
         } else if (ObjectUtils.allFieldIsNULL(resultDTO) || StrUtil.containsAnyIgnoreCase(hcjg, "通过")) {
             rshyVo.setPass(PassStatusEnum.NORMAL_TRAFFIC.getCode()).setDisplayMsg(PassStatusEnum.NORMAL_TRAFFIC.getDesc()).setTts(PassStatusEnum.NORMAL_TRAFFIC.getTts());
         } else {
@@ -157,18 +159,18 @@ public class RshyJkManagerImpl implements RshyJkManager {
         return rshyVo;
     }
 
-    private NucleicAcidDTO nucleicAcid(PcthsResultDTO pcthsResultDTO){
+    private NucleicAcidDTO nucleicAcid(PcthsResultDTO pcthsResultDTO) {
         NucleicAcidDTO nucleicAcidDTO = new NucleicAcidDTO();
-        if(pcthsResultDTO == null){
+        if (pcthsResultDTO == null) {
             nucleicAcidDTO.setStatus(NucleicAcidEnum.NOT_CONFORM.getCode()).setResults("48h内未采集");
             return nucleicAcidDTO;
         }
 
-        if(pcthsResultDTO.getSHE_RQSJ() != null){
+        if (pcthsResultDTO.getSHE_RQSJ() != null) {
             DateTime parse = DateUtil.parse(String.valueOf(Integer.valueOf(pcthsResultDTO.getSHE_RQSJ()) * 1000));
             long betweenMs = DateUtil.betweenMs(parse, DateUtil.date());
             //48h防疫规则
-            if(betweenMs > 48 * 60 * 60 * 1000){
+            if (betweenMs > 48 * 60 * 60 * 1000) {
                 nucleicAcidDTO.setStatus(NucleicAcidEnum.NOT_CONFORM.getCode()).setResults(new StringBuilder("48小时之外已出结果,结果").append(pcthsResultDTO.getJGU_MC()).toString()).setTime(DateUtil.format(parse, "MM-dd HH:mm"));
                 return nucleicAcidDTO;
             }
@@ -180,7 +182,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
         DateTime parse = DateUtil.parse(String.valueOf(Integer.valueOf(pcthsResultDTO.getCJSJ()) * 1000));
         long betweenMs = DateUtil.betweenMs(parse, DateUtil.date());
         //48h防疫规则
-        if(betweenMs > 48 * 60 * 60 * 1000){
+        if (betweenMs > 48 * 60 * 60 * 1000) {
             nucleicAcidDTO.setStatus(NucleicAcidEnum.NOT_CONFORM.getCode()).setResults("48小时之外未出结果");
             return nucleicAcidDTO;
         }

+ 3 - 2
src/main/java/com/rshy/project/hy/model/enums/PassStatusEnum.java

@@ -11,11 +11,12 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum PassStatusEnum {
-    NO_PASSING(0, "核验不通过", "请重刷"),
-    RIGHT_WAY(1, "核验通过", "请稍等"),
+    NO_PASSING(0, "拦截", "请重刷"),
+    RIGHT_WAY(1, "存疑", "请稍等"),
     NORMAL_TRAFFIC(2, "核验通过", "通过"),
     RED_CODE(3, "红码", "健康码异常"),
     YELLOW_CODE(3, "黄码", "健康码异常"),
+    NO_MATCHED(3, "人证不符", "健康码异常"),
     GREEN_CODE(2, "绿码", "通过");;
 
     private Integer code;

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

@@ -2,7 +2,6 @@ package com.rshy.project.hy.server;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.google.common.collect.Lists;
 import com.rshy.project.hy.baseRe.BaseException;
@@ -10,7 +9,7 @@ import com.rshy.project.hy.server.dto.PersonIdentifyBodyDTO;
 import com.rshy.project.hy.server.dto.PersonIdentifyDTO;
 import com.rshy.project.hy.server.dto.PersonIdentifyImageDTO;
 import com.rshy.project.hy.server.vo.PersonIdentifyVO;
-import org.apache.commons.lang3.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
@@ -20,6 +19,7 @@ import org.springframework.stereotype.Component;
  * @description: 省厅应用域常口库接口
  */
 @Component
+@Slf4j
 public class VIIDServer {
     /**
      * 授权凭证请求头
@@ -32,15 +32,16 @@ public class VIIDServer {
     private String userIdentify;
 
     /**
-     *
-     * @param photo base64 图片
+     * @param photo   base64 图片
      * @param timeout
      * @return
      */
-    public PersonIdentifyDTO personIdentify(String photo, Integer timeout){
+    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));
         String body = HttpRequest.post(url).header(HEADERS_KEY, userIdentify).body(JSON.toJSONString(bodyDTO)).timeout(timeout).execute().body();
+        //log.info("浙江省厅统一身份置信接口服务响应信息:{}", body);
         PersonIdentifyVO personIdentifyVO = JSON.parseObject(body, PersonIdentifyVO.class);
 
         if (personIdentifyVO != null && !"0".equals(personIdentifyVO.getCode())) {

+ 4 - 0
src/main/java/com/rshy/project/hy/server/dto/PersonIdentifyBodyDTO.java

@@ -1,5 +1,6 @@
 package com.rshy.project.hy.server.dto;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
@@ -13,9 +14,12 @@ import java.util.List;
 @Data
 @Accessors(chain = true)
 public class PersonIdentifyBodyDTO {
+    @JSONField(name = "ProfileID")
     private String ProfileID;
 
+    @JSONField(name = "Priority")
     private String Priority;
 
+    @JSONField(name = "FaceImageList")
     private List<PersonIdentifyImageDTO> FaceImageList;
 }

+ 9 - 2
src/main/java/com/rshy/project/hy/server/dto/PersonIdentifyDTO.java

@@ -1,5 +1,6 @@
 package com.rshy.project.hy.server.dto;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
@@ -16,18 +17,24 @@ public class PersonIdentifyDTO {
     /**
      * 姓名
      */
+    @JSONField(name = "Name")
     private String Name;
 
     /**
      * 身份证
      */
+    @JSONField(name = "IdNumber")
     private String IdNumber;
 
     /**
-     *
+     * 照片
      */
+    @JSONField(name = "PhotoData")
     private String PhotoData;
 
-
+    /**
+     * 比对分值
+     */
+    @JSONField(name = "SimilarityDegree")
     private BigDecimal SimilarityDegree;
 }

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

@@ -1,5 +1,6 @@
 package com.rshy.project.hy.server.dto;
 
+import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 import lombok.experimental.Accessors;
 
@@ -11,11 +12,15 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 public class PersonIdentifyImageDTO {
+    @JSONField(name = "ImageID")
     private String ImageID;
 
+    @JSONField(name = "Data")
     private String Data;
 
+    @JSONField(name = "ShotTime")
     private String ShotTime;
 
+    @JSONField(name = "DeviceID")
     private String DeviceID;
 }

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

@@ -39,10 +39,13 @@ public class RshyController {
             return Ret.error(10001,"身份证不合法");
         }
 
+        /*
         if(StrUtil.isEmpty(rshyParam.getPhoto())){
-            return Ret.error(10001, "人员照片必传");
+            return Ret.error(10002, "人员照片必传");
         }
 
+         */
+
         return Ret.success(rshyJkManager.getRshyInfo(rshyParam));
     }