浏览代码

证件号唯一性判断

wangqiang 1 年之前
父节点
当前提交
a1f58784ee

+ 13 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -93,6 +93,19 @@ public class UserController {
     @Autowired
     private RedisUtils redisUtils;
 
+
+    /**
+     * 查询身份证号码唯一性
+     * @param otherInfo
+     * @return
+     */
+    @ApiOperation(value = "查询身份证号码唯一性")
+    @GetMapping("/findIdCardOnly")
+    public ResponseEntity<Integer> findIdCardOnly( UserOtherInfo otherInfo) throws Exception{
+        Integer idCardOnly = userService.findIdCardOnly(otherInfo);
+        return ResponseEntity.ok(idCardOnly);
+    }
+
     /**
      * 根据ids查询用户基本信息(姓名、手机、角色、部门)
      *

+ 15 - 4
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -18,12 +18,10 @@ import com.jeeplus.common.constant.CacheNames;
 import com.jeeplus.common.constant.CommonConstants;
 import com.jeeplus.common.redis.RedisUtils;
 import com.jeeplus.common.utils.RequestUtils;
-import com.jeeplus.sys.domain.Cert;
-import com.jeeplus.sys.domain.Office;
-import com.jeeplus.sys.domain.SysConfig;
-import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.domain.*;
 import com.jeeplus.sys.feign.IUserApi;
 import com.jeeplus.sys.mapper.OfficeMapper;
+import com.jeeplus.sys.mapper.OtherUserInfoMapper;
 import com.jeeplus.sys.mapper.UserMapper;
 import com.jeeplus.sys.service.dto.*;
 import com.jeeplus.sys.service.mapstruct.CertWrapper;
@@ -64,6 +62,9 @@ public class UserService extends ServiceImpl <UserMapper, User> {
     @Resource
     private UserMapper userMapper;
 
+    @Resource
+    private OtherUserInfoMapper otherUserInfoMapper;
+
     @Autowired
     private OfficeService officeService;
 
@@ -79,6 +80,16 @@ public class UserService extends ServiceImpl <UserMapper, User> {
     @Autowired
     private RedisUtils redisUtils;
 
+    public Integer findIdCardOnly(UserOtherInfo otherInfo) throws Exception {
+        QueryWrapper<UserOtherInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id_card", otherInfo.getIdCard());
+        queryWrapper.eq("del_flag", 0);
+        queryWrapper.eq("certificates_type", otherInfo.getCertificatesType());
+        // 删除基础信息表
+        Integer integer = otherUserInfoMapper.selectCount(queryWrapper);
+        return integer;
+    }
+
     public void insertWorkAttachment (WorkAttachmentInfo2 workAttachment, UserDTO userDto){
         userMapper.insertWorkAttachment(workAttachment, userDto);
     }