| | |
| | | import org.springblade.modules.securitypaper.entity.SecurityPaper; |
| | | import org.springblade.modules.securitypaper.service.SecurityPaperService; |
| | | import org.springblade.modules.system.entity.*; |
| | | import org.springblade.modules.system.excel.QrCodeExcel; |
| | | import org.springblade.modules.system.excel.SecurityExcel; |
| | | import org.springblade.modules.system.excel.SecurityYyExcel; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.*; |
| | | import org.springblade.modules.system.mapper.UserMapper; |
| | | import org.springblade.modules.system.node.TreeNode; |
| | | import org.springblade.modules.system.service.*; |
| | |
| | | */ |
| | | @Override |
| | | public UserVO getUserDetails(User user) { |
| | | |
| | | |
| | | |
| | | return baseMapper.getUserDetails(user); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Boolean wxRegister(User user) { |
| | | User params = new User(); |
| | | params.setPhone(user.getPhone()); |
| | | //查看数据库是否有相同手机号 |
| | | params.setCardid(user.getCardid()); |
| | | //查看数据库是否有相同身份证号 |
| | | List<User> list = list(Condition.getQueryWrapper(params)); |
| | | if (list.size()>0){ |
| | | throw new ServiceException("该用户已注册"); |
| | | throw new ServiceException("该身份证号已注册"); |
| | | } |
| | | |
| | | //注册新用户 |
| | |
| | | public boolean batchAudit(String ids, String auditStatus) { |
| | | return baseMapper.batchAudit(ids,auditStatus); |
| | | } |
| | | |
| | | @Override |
| | | public void importSecurityPaperTime(List<UserCertificateExcel> data, Boolean isCovered, String deptId) { |
| | | //将不能导入的保安员账号存起来 |
| | | List<String> errorList = new ArrayList<>(); |
| | | |
| | | //导入状态,默认为true ,如果有一个出现问题则为 false |
| | | AtomicBoolean status = new AtomicBoolean(true); |
| | | AtomicBoolean securityInvalidStatus = new AtomicBoolean(true); |
| | | //遍历 |
| | | for (UserCertificateExcel userExcel : data) { |
| | | |
| | | //身份证校验 |
| | | if (null == userExcel.getCardid() || userExcel.getCardid().equals("")) { |
| | | throw new ServiceException("导入失败!身份证号码不能为空!"); |
| | | } |
| | | if (null != userExcel.getCardid() && !userExcel.getCardid().equals("")) { |
| | | //去除所有空格 |
| | | String cardid = userExcel.getCardid().replaceAll(" ", ""); |
| | | //校验 |
| | | boolean b = IdCardNoUtil.checkIdCardNo(cardid); |
| | | if (b) { |
| | | userExcel.setCardid(cardid); |
| | | } else { |
| | | //forEach 只能使用 return 跳出本次循环 |
| | | // return; |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | //根据身份证、保安证编号获取用户 |
| | | User userInfoByIdCardNo = baseMapper.getUserInfoByIdCardNoAndSecurityNumber(userExcel.getCardid(),userExcel.getSecuritynumber()); |
| | | |
| | | if (userInfoByIdCardNo == null){ |
| | | throw new ServiceException("导入失败!身份证号和保安证编号与系统不匹配!"); |
| | | } |
| | | |
| | | User user = new User(); |
| | | user.setId(userInfoByIdCardNo.getId()); |
| | | |
| | | if (!Strings.isBlank(userExcel.getPaperTime())) { |
| | | try { |
| | | user.setPaperTime(new SimpleDateFormat("yyyy-MM-dd").parse(userExcel.getPaperTime())); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | updateById(user); |
| | | |
| | | //如果所有数据导入有一个异常 |
| | | StringBuilder errorBuilder = new StringBuilder(); |
| | | if (!status.get()) { |
| | | String errorAccount = StringUtils.join(errorList, "\\\n"); |
| | | errorBuilder.append("用户:[" + errorAccount + "]导入失败!已在其他单位存在!"); |
| | | } |
| | | |
| | | //抛出异常 |
| | | if (errorBuilder.length() > 0) { |
| | | throw new ServiceException(errorBuilder.toString()); |
| | | } |
| | | } |
| | | } |
| | | } |