parent
2727cfe74c
commit
0218cd3d95
|
@ -112,7 +112,8 @@ public class ProjectService {
|
||||||
private ProjectApplicationMapper projectApplicationMapper;
|
private ProjectApplicationMapper projectApplicationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectApplicationService projectApplicationService;
|
private ProjectApplicationService projectApplicationService;
|
||||||
|
@Resource
|
||||||
|
private ProjectVersionMapper projectVersionMapper;
|
||||||
|
|
||||||
public Project addProject(AddProjectRequest project) {
|
public Project addProject(AddProjectRequest project) {
|
||||||
if (StringUtils.isBlank(project.getName())) {
|
if (StringUtils.isBlank(project.getName())) {
|
||||||
|
@ -171,9 +172,14 @@ public class ProjectService {
|
||||||
if (quotaService != null) {
|
if (quotaService != null) {
|
||||||
quotaService.projectUseDefaultQuota(pjId);
|
quotaService.projectUseDefaultQuota(pjId);
|
||||||
}
|
}
|
||||||
|
// 创建默认版本
|
||||||
|
addProjectVersion(project);
|
||||||
|
// 初始化项目应用管理
|
||||||
|
initProjectApplication(project.getId());
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
ProjectVersionService projectVersionService = CommonBeanFactory.getBean(ProjectVersionService.class);
|
public void addProjectVersion(Project project) {
|
||||||
if (projectVersionService != null) {
|
|
||||||
ProjectVersion projectVersion = new ProjectVersion();
|
ProjectVersion projectVersion = new ProjectVersion();
|
||||||
projectVersion.setId(UUID.randomUUID().toString());
|
projectVersion.setId(UUID.randomUUID().toString());
|
||||||
projectVersion.setName("v1.0.0");
|
projectVersion.setName("v1.0.0");
|
||||||
|
@ -184,10 +190,17 @@ public class ProjectService {
|
||||||
projectVersion.setPublishTime(System.currentTimeMillis());
|
projectVersion.setPublishTime(System.currentTimeMillis());
|
||||||
projectVersion.setLatest(true);
|
projectVersion.setLatest(true);
|
||||||
projectVersion.setStatus("open");
|
projectVersion.setStatus("open");
|
||||||
projectVersionService.addProjectVersion(projectVersion);
|
|
||||||
|
String name = projectVersion.getName();
|
||||||
|
ProjectVersionExample example = new ProjectVersionExample();
|
||||||
|
example.createCriteria().andProjectIdEqualTo(projectVersion.getProjectId()).andNameEqualTo(name);
|
||||||
|
if (projectVersionMapper.countByExample(example) > 0) {
|
||||||
|
MSException.throwException("当前版本已经存在");
|
||||||
}
|
}
|
||||||
initProjectApplication(project.getId());
|
projectVersion.setId(UUID.randomUUID().toString());
|
||||||
return project;
|
projectVersion.setCreateUser(SessionUtils.getUserId());
|
||||||
|
projectVersion.setCreateTime(System.currentTimeMillis());
|
||||||
|
projectVersionMapper.insertSelective(projectVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initProjectApplication(String projectId) {
|
private void initProjectApplication(String projectId) {
|
||||||
|
|
Loading…
Reference in New Issue