Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
bc6cb6a7
Commit
bc6cb6a7
authored
Feb 01, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化项目Service
parent
6a86d0c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletions
+12
-1
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectApi.java
+0
-1
src/main/java/cn/meteor/beyondclouds/modules/project/service/impl/ProjectServiceImpl.java
+12
-0
No files found.
src/main/java/cn/meteor/beyondclouds/modules/project/api/ProjectApi.java
View file @
bc6cb6a7
...
@@ -160,7 +160,6 @@ public class ProjectApi {
...
@@ -160,7 +160,6 @@ public class ProjectApi {
* @param pageForm
* @param pageForm
* @return
* @return
*/
*/
@Anonymous
@ApiOperation
(
"我的项目列表"
)
@ApiOperation
(
"我的项目列表"
)
@GetMapping
(
"/my/projects"
)
@GetMapping
(
"/my/projects"
)
public
Response
<
PageVO
<
Project
>>
getMyProjects
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
public
Response
<
PageVO
<
Project
>>
getMyProjects
(
@Valid
PageForm
pageForm
,
@CurrentSubject
Subject
subject
)
{
...
...
src/main/java/cn/meteor/beyondclouds/modules/project/service/impl/ProjectServiceImpl.java
View file @
bc6cb6a7
...
@@ -20,6 +20,7 @@ import org.springframework.beans.BeanUtils;
...
@@ -20,6 +20,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
/**
/**
...
@@ -54,6 +55,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -54,6 +55,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
void
publishProject
(
Project
project
,
String
detail
)
throws
ProjectServiceException
{
public
void
publishProject
(
Project
project
,
String
detail
)
throws
ProjectServiceException
{
Assert
.
notNull
(
project
,
"project must not be null"
);
Assert
.
hasText
(
project
.
getUserId
(),
"userId must not be empty"
);
// 1.检查项目类别是否存在
// 1.检查项目类别是否存在
Integer
categoryId
=
project
.
getCategoryId
();
Integer
categoryId
=
project
.
getCategoryId
();
ProjectCategory
projectCategory
=
projectCategoryMapper
.
selectById
(
categoryId
);
ProjectCategory
projectCategory
=
projectCategoryMapper
.
selectById
(
categoryId
);
...
@@ -75,6 +79,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -75,6 +79,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
@Override
@Override
public
void
deleteProject
(
String
projectId
,
String
userId
)
throws
ProjectServiceException
{
public
void
deleteProject
(
String
projectId
,
String
userId
)
throws
ProjectServiceException
{
Assert
.
notNull
(
projectId
,
"projectId must not be null"
);
Assert
.
notNull
(
userId
,
"userId must not be null"
);
// 1.判断自己有没有发过这个项目
// 1.判断自己有没有发过这个项目
QueryWrapper
<
Project
>
projectQueryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
Project
>
projectQueryWrapper
=
new
QueryWrapper
<>();
projectQueryWrapper
projectQueryWrapper
...
@@ -103,6 +110,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -103,6 +110,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
@Override
@Override
public
ProjectDetail
getProject
(
String
projectId
)
throws
ProjectServiceException
{
public
ProjectDetail
getProject
(
String
projectId
)
throws
ProjectServiceException
{
Assert
.
notNull
(
projectId
,
"projectId must not be null"
);
// 1.获取项目
// 1.获取项目
Project
project
=
getById
(
projectId
);
Project
project
=
getById
(
projectId
);
...
@@ -130,6 +138,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
...
@@ -130,6 +138,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
@Override
@Override
public
void
updateProject
(
Project
project
,
String
projectDetail
)
throws
ProjectServiceException
{
public
void
updateProject
(
Project
project
,
String
projectDetail
)
throws
ProjectServiceException
{
Assert
.
notNull
(
project
,
"project must not be null"
);
Assert
.
hasText
(
project
.
getUserId
(),
"userId must not be empty"
);
Assert
.
notNull
(
project
.
getProjectId
(),
"projectId must not be null"
);
// 1.判断自己有没有发过这个项目
// 1.判断自己有没有发过这个项目
Project
projectInDb
=
getById
(
project
);
Project
projectInDb
=
getById
(
project
);
// 若找不到该项目,则抛出业务异常
// 若找不到该项目,则抛出业务异常
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment