|
|
@@ -38,7 +38,10 @@ public class LocalAppDoctorUserService extends BaseService<AppDoctorUserMapper,
|
|
|
if(StrUtil.isEmpty(entity.getTenantId())){
|
|
|
throw new CustomException("新增医生账号租户id不能为空");
|
|
|
}
|
|
|
- String username = entity.getUsername();
|
|
|
+ if (StrUtil.isEmpty(entity.getPassword())) {
|
|
|
+ entity.setPassword(SecurityUtil.encryptPassword(entity.getPassword()));
|
|
|
+ }
|
|
|
+ String username = entity.getUsername();
|
|
|
AppDoctorUserEntity doctor = this.getOne(new QueryWrapper<AppDoctorUserEntity>()
|
|
|
.lambda().eq(AppDoctorUserEntity::getUsername, username)
|
|
|
.last("limit 1"));
|
|
|
@@ -66,7 +69,16 @@ public class LocalAppDoctorUserService extends BaseService<AppDoctorUserMapper,
|
|
|
if(CollectionUtil.isEmpty(sources)){
|
|
|
return true;
|
|
|
}
|
|
|
- List<String> userNames = sources.stream().map(AppDoctorUserEntity::getUsername).collect(Collectors.toList());
|
|
|
+ List<String> userNames = sources.stream()
|
|
|
+ .peek(source->{
|
|
|
+ if(StrUtil.isEmpty(source.getPassword())){
|
|
|
+ source.setPassword("123456");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .peek(source->{
|
|
|
+ source.setPassword(SecurityUtil.encryptPassword(source.getPassword()));
|
|
|
+ })
|
|
|
+ .map(AppDoctorUserEntity::getUsername).collect(Collectors.toList());
|
|
|
Set<String> userNameDistinct = new HashSet<>(userNames);
|
|
|
if(CollectionUtil.size(userNames)!=CollectionUtil.size(userNameDistinct)){
|
|
|
throw new CustomException("请检查新增的医生账户中是否存在重复用户名");
|