Commit 92d62da3 authored by 王向伟's avatar 王向伟

user 添加channelName字段

parent 2f33b3a6
...@@ -4,9 +4,7 @@ import cn.quantgroup.cashloanflowboss.api.role.entity.Role; ...@@ -4,9 +4,7 @@ import cn.quantgroup.cashloanflowboss.api.role.entity.Role;
import cn.quantgroup.cashloanflowboss.api.role.model.RoleModel; import cn.quantgroup.cashloanflowboss.api.role.model.RoleModel;
import cn.quantgroup.cashloanflowboss.api.role.model.RoleModelVo; import cn.quantgroup.cashloanflowboss.api.role.model.RoleModelVo;
import cn.quantgroup.cashloanflowboss.api.role.model.RoleQueryModel; import cn.quantgroup.cashloanflowboss.api.role.model.RoleQueryModel;
import cn.quantgroup.cashloanflowboss.api.role.model.RoleVO;
import cn.quantgroup.cashloanflowboss.api.role.service.RoleService; import cn.quantgroup.cashloanflowboss.api.role.service.RoleService;
import cn.quantgroup.cashloanflowboss.component.security.annotiation.Security;
import cn.quantgroup.cashloanflowboss.core.base.Result; import cn.quantgroup.cashloanflowboss.core.base.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
......
...@@ -48,6 +48,9 @@ public class User extends Primary { ...@@ -48,6 +48,9 @@ public class User extends Primary {
@Column(name = "channel_id") @Column(name = "channel_id")
private Long channelId; private Long channelId;
@Column(name = "channel_name")
private String channelName;
/** /**
* 用户级别 * 用户级别
*/ */
......
...@@ -15,6 +15,8 @@ import cn.quantgroup.cashloanflowboss.core.asserts.Assert; ...@@ -15,6 +15,8 @@ import cn.quantgroup.cashloanflowboss.core.asserts.Assert;
import cn.quantgroup.cashloanflowboss.core.base.Result; import cn.quantgroup.cashloanflowboss.core.base.Result;
import cn.quantgroup.cashloanflowboss.core.base.Tuple; import cn.quantgroup.cashloanflowboss.core.base.Tuple;
import cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus; import cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfChannelConfiguration;
import cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfChannelConfigurationRepository;
import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService; import cn.quantgroup.cashloanflowboss.spi.user.service.XyqbUserService;
import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService; import cn.quantgroup.cashloanflowboss.spi.xyqb.service.XYQBCenterService;
import cn.quantgroup.cashloanflowboss.utils.MD5Tools; import cn.quantgroup.cashloanflowboss.utils.MD5Tools;
...@@ -50,6 +52,9 @@ public class UserServiceImpl implements UserService { ...@@ -50,6 +52,9 @@ public class UserServiceImpl implements UserService {
@Autowired @Autowired
private RoleRepository roleRepository; private RoleRepository roleRepository;
@Autowired
private ClfChannelConfigurationRepository clfChannelConfigurationRepository;
/** /**
* 创建用户 * 创建用户
...@@ -238,6 +243,17 @@ public class UserServiceImpl implements UserService { ...@@ -238,6 +243,17 @@ public class UserServiceImpl implements UserService {
} }
User user = User.valueOf(userModelVo, role); User user = User.valueOf(userModelVo, role);
//渠道检查
Long channelId = user.getChannelId();
if (channelId != null) {
if (!clfChannelConfigurationRepository.exists(channelId)) {
log.error("{},渠道不存在 channelId={}",LOG_PRE,channelId);
return Result.buildFail("channelId="+channelId+"的渠道不存在");
}
ClfChannelConfiguration configuration = clfChannelConfigurationRepository.findOne(channelId);
user.setChannelName(configuration.getChannelName());
}
userRepository.save(user); userRepository.save(user);
return Result.buildSuccess(true); return Result.buildSuccess(true);
} }
...@@ -277,6 +293,18 @@ public class UserServiceImpl implements UserService { ...@@ -277,6 +293,18 @@ public class UserServiceImpl implements UserService {
BeanUtils.copyProperties(userModelVo, exist); BeanUtils.copyProperties(userModelVo, exist);
Long channelId = exist.getChannelId();
if (channelId != null) {
if (!clfChannelConfigurationRepository.exists(channelId)) {
log.error("{},渠道不存在 channelId={}",LOG_PRE,channelId);
return Result.buildFail("channelId="+channelId+"的渠道不存在");
}
ClfChannelConfiguration configuration = clfChannelConfigurationRepository.findOne(channelId);
exist.setChannelName(configuration.getChannelName());
}
exist.setPassword(MD5Tools.md5(userModelVo.getPassword())); exist.setPassword(MD5Tools.md5(userModelVo.getPassword()));
exist.setRoles(Collections.singletonList(role)); exist.setRoles(Collections.singletonList(role));
exist.setUpdateTime(new Date()); exist.setUpdateTime(new Date());
......
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