Commit e2409a8b authored by wujipeng's avatar wujipeng
Browse files

新增用户优化

parent 8d02e7ff
...@@ -197,6 +197,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme ...@@ -197,6 +197,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
@Override @Override
@Transactional @Transactional
public Boolean add(UserDTO userDTO) { public Boolean add(UserDTO userDTO) {
try {
//解析身份证号 //解析身份证号
Map<String, String> idCardInfo = IdCardUtils.parseIdCardInfo(userDTO.getIdCard()); Map<String, String> idCardInfo = IdCardUtils.parseIdCardInfo(userDTO.getIdCard());
if (MapUtil.isNotEmpty(idCardInfo)) { if (MapUtil.isNotEmpty(idCardInfo)) {
...@@ -208,6 +209,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme ...@@ -208,6 +209,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
userDTO.setUserName(userDTO.getUserName() + userDTO.getIdCard()); userDTO.setUserName(userDTO.getUserName() + userDTO.getIdCard());
userDTO.setType("1"); userDTO.setType("1");
return save(userDTO); return save(userDTO);
} catch (Exception e) {
throw new BusinessException("用户" + userDTO.getUserName() + "已经存在");
}
} }
@Override @Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment