|
|
@@ -345,6 +345,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
public int addCustomer(InputAddCustomer in) throws BusinessException {
|
|
|
User user = new User();
|
|
|
Date now = new Date();
|
|
|
+ String aid=TokenManager.getAdminId();
|
|
|
String uid = UUID.randomUUID().toString();
|
|
|
String identifyId = UUID.randomUUID().toString();
|
|
|
user.setId(uid);
|
|
|
@@ -375,8 +376,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
user.setChannel(0);
|
|
|
passwordUtil.encryptPassword(user);
|
|
|
String aname = adminMapper.selectByPrimaryKey(TokenManager.getAdminId()).getName();
|
|
|
- if (in.getType() == UserType.PERSONAL.getCode()) {
|
|
|
- if (userMapper.checkUser("", "", in.getContactMobile(), in.getType(), null, null).size() > 0)
|
|
|
+ if (Objects.equals(in.getType(), UserType.PERSONAL.getCode())) {
|
|
|
+ if (!userMapper.checkUser("", "", in.getContactMobile(), in.getType(), null, null).isEmpty())
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, in.getName(), ""));
|
|
|
UserIdentity ui = new UserIdentity();
|
|
|
ui.setId(identifyId);
|
|
|
@@ -392,7 +393,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
ui.setInternational(AFTConstants.NO);
|
|
|
ui.setAuditStatus(IdentityProcess.SUCCESS.getCode());// 认证个人
|
|
|
userIdentityMapper.insert(ui);
|
|
|
- } else if (in.getType() == UserType.ORGANIZATION.getCode()) {
|
|
|
+ } else if (Objects.equals(in.getType(), UserType.ORGANIZATION.getCode())) {
|
|
|
checkUserName(in);
|
|
|
UserMid um=new UserMid();
|
|
|
um.setAid(user.getAid());
|
|
|
@@ -425,7 +426,8 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
userMapper.insertSelective(user);
|
|
|
UserNames un=new UserNames();
|
|
|
- un.setUid(user.getId());
|
|
|
+ un.setUid(uid);
|
|
|
+ un.setAid(aid);
|
|
|
un.setName(user.getNickname());
|
|
|
userNamesMapper.insertSelective(un);
|
|
|
|
|
|
@@ -533,7 +535,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
|
|
|
private void checkUserName(InputAddCustomer in) {
|
|
|
- if (userMapper.checkUser("", in.getName(), "", in.getType(), null, null).size() > 0)
|
|
|
+ if (!userMapper.checkUser("", in.getName(), "", in.getType(), null, null).isEmpty())
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, in.getName(), ""));
|
|
|
String name2=null;
|
|
|
if (in.getName().contains("(")){
|
|
|
@@ -542,7 +544,7 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
name2=in.getName().replace("(","(").replace(")",")");
|
|
|
}
|
|
|
if (name2!=null){
|
|
|
- if (userMapper.checkUser("", name2, "", in.getType(), null, null).size() > 0)
|
|
|
+ if (!userMapper.checkUser("", name2, "", in.getType(), null, null).isEmpty())
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, name2, ""));
|
|
|
}
|
|
|
}
|