Browse Source

身份信息已经在数据库里不保存

FanQun 2 years ago
parent
commit
10bf2c940f

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

@@ -323,15 +323,25 @@ public class RshyJkManagerImpl implements RshyJkManager {
     protected void saveIdentity2DB(String barCode, RshyVo rshyVo) {
         log.info("保存身份信息到数据库, 身份证号码: {}", rshyVo.getSfzh());
         Identity identity = new Identity();
+        LambdaQueryWrapper<Identity> wrapper = new LambdaQueryWrapper<>();
         if (StrUtil.isNotBlank(barCode)) {
             identity.setBarCode(barCode);
+            wrapper.eq(Identity::getBarCode, barCode);
         }
         identity.setIdNum(rshyVo.getSfzh());
+        wrapper.eq(Identity::getIdNum, rshyVo.getSfzh());
         identity.setName(rshyVo.getXm());
+        wrapper.eq(Identity::getName, rshyVo.getXm());
         identity.setAddress(rshyVo.getAddress());
+        wrapper.eq(Identity::getAddress, rshyVo.getAddress());
         identity.setPhone(rshyVo.getPhone());
+        if (StrUtil.isNotBlank(rshyVo.getPhone())) {
+            wrapper.eq(Identity::getPhone, rshyVo.getPhone());
+        }
         //identity.setPhoto(rshyVo.getPhoto());
-        identityService.saveOK(identity);
+        if (identityService.getOne(wrapper) == null) {
+            identityService.saveOK(identity);
+        }
     }
 
     @Async

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

@@ -613,7 +613,7 @@ public class ItfwServer {
         PctrchlBodyDTO pctrchlBodyDTO = new PctrchlBodyDTO();
         pctrchlBodyDTO.setExamineCode(RandomUtil.randomNumbers(12));
         PctrchlDlxxDTO dlxx = new PctrchlDlxxDTO();
-        if (loginInfo != null) {
+        if (loginInfo != null && !StrUtil.containsAnyIgnoreCase(loginInfo.getName(), "测试")) {
             pctrchlBodyDTO.setDeviceIp(loginInfo.getIp());
             dlxx.setDlip(loginInfo.getIp());
             dlxx.setHcdz("杭州地铁 " + loginInfo.getLocation());
@@ -692,7 +692,7 @@ public class ItfwServer {
         BeanUtil.copyProperties(pctymProperties, properties);
         properties.setBody(new PctymBodyDTO().setIdcardNo(idNumber));
         log.info("浙江省疫苗注射数据服务请求入参:{}", JSON.toJSONString(properties));
-        String body = null;
+        String body;
 
         try {
             body = this.baseAgentApi(properties, timeout);