mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 23:57:12 +08:00
完善
This commit is contained in:
@@ -8,4 +8,7 @@ import lombok.Data;
|
|||||||
public class CreateOrganizationDto extends CommonDto {
|
public class CreateOrganizationDto extends CommonDto {
|
||||||
|
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
|
private String orgAdminUserName;
|
||||||
|
private String orgAdminPassword;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import cn.lihongjie.coal.organization.dto.UpdateOrganizationDto;
|
|||||||
import cn.lihongjie.coal.organization.entity.OrganizationEntity;
|
import cn.lihongjie.coal.organization.entity.OrganizationEntity;
|
||||||
import cn.lihongjie.coal.organization.mapper.OrganizationMapper;
|
import cn.lihongjie.coal.organization.mapper.OrganizationMapper;
|
||||||
import cn.lihongjie.coal.organization.repository.OrganizationRepository;
|
import cn.lihongjie.coal.organization.repository.OrganizationRepository;
|
||||||
|
import cn.lihongjie.coal.user.dto.CreateUserDto;
|
||||||
|
import cn.lihongjie.coal.user.service.UserService;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
@@ -30,6 +32,8 @@ public class OrganizationService extends BaseService<OrganizationEntity, Organiz
|
|||||||
@Autowired OrganizationMapper mapper;
|
@Autowired OrganizationMapper mapper;
|
||||||
@Autowired ConversionService conversionService;
|
@Autowired ConversionService conversionService;
|
||||||
|
|
||||||
|
@Autowired UserService userService;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {}
|
public void init() {}
|
||||||
|
|
||||||
@@ -38,6 +42,13 @@ public class OrganizationService extends BaseService<OrganizationEntity, Organiz
|
|||||||
OrganizationEntity entity = mapper.toEntity(request);
|
OrganizationEntity entity = mapper.toEntity(request);
|
||||||
|
|
||||||
this.repository.save(entity);
|
this.repository.save(entity);
|
||||||
|
|
||||||
|
CreateUserDto dto = new CreateUserDto();
|
||||||
|
dto.setOrganizationId(entity.getId());
|
||||||
|
dto.setUsername(request.getOrgAdminUserName());
|
||||||
|
dto.setPassword(request.getOrgAdminPassword());
|
||||||
|
userService.create(dto);
|
||||||
|
|
||||||
return getById(entity.getId());
|
return getById(entity.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -119,12 +120,15 @@ public class PermissionService extends BaseService<PermissionEntity, PermissionR
|
|||||||
|
|
||||||
PermissionEntity permission =
|
PermissionEntity permission =
|
||||||
dbPermissionMap
|
dbPermissionMap
|
||||||
.get(
|
.getOrDefault(
|
||||||
Tuple.of(
|
Tuple.of(
|
||||||
exportDto.getCode(),
|
exportDto.getCode(),
|
||||||
exportDto.getName(),
|
exportDto.getName(),
|
||||||
exportDto.getParentName()))
|
exportDto.getParentName()),
|
||||||
.get(0);
|
new ArrayList<>())
|
||||||
|
.stream()
|
||||||
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
if (permission == null) {
|
if (permission == null) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user