智慧保安后台管理-外网项目备份
Administrator
2021-12-31 4fa826960b4a4d758733715a19ce0d2abdf77ba7
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -1419,4 +1419,37 @@
//      ExcelUtil.export(response, "保安员导入数据模板", "保安员数据表", list, UserExcel.class);
   }
   /**
    * 保安员账号校验
    * @param user
    * @return
    */
   @GetMapping("/checkAccount")
   public void checkAccount(User user) {
      //根据身份证号查询用户
      User user1 = new User();
      user1.setAccount(user.getCardid());
      user1.setIsDeleted(0);
      user1.setStatus(1);
      User user2 = userService.getOne(Condition.getQueryWrapper(user1));
      if (null!=user2){
         //判断是单位否一致
         if (null!=user.getDeptId() && !user.getDeptId().equals("")) {
            if (!user2.getDeptId().equals(user.getDeptId())) {
               throw new ServiceException(StringUtil.format("当前用户 [{}] 已在其他单位录入!", user.getCardid()));
            } else {
               throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getCardid()));
            }
         }else {
            //没有传 deptId 的情况
            throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getCardid()));
         }
      }
   }
}