Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
work_service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
work_service
Commits
8209cac5
Commit
8209cac5
authored
Mar 08, 2021
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
42b3925f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
WorkProjectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
+18
-10
WorkUserProjectServiceImpl.java
...cn/wisenergy/service/impl/WorkUserProjectServiceImpl.java
+1
-1
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkProjectServiceImpl.java
View file @
8209cac5
...
...
@@ -305,11 +305,13 @@ public class WorkProjectServiceImpl implements WorkProjectService {
// 查询当前项目的人员
List
<
UserProjectDto
>
users
=
workUserProjectService
.
getUserProjectByProjectId
(
modifyProjectVo
.
getProjectId
());
List
<
Integer
>
userIds
=
new
ArrayList
<>();
for
(
UserProjectDto
user
:
users
)
{
userIds
.
add
(
user
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
users
))
{
for
(
UserProjectDto
user
:
users
)
{
userIds
.
add
(
user
.
getId
());
}
}
// 验证项目
verificationItem
(
modifyProjectVo
,
workProject
,
userIds
);
verificationItem
(
modifyProjectVo
,
workProject
,
null
);
// 2.更新表数据
...
...
@@ -394,13 +396,16 @@ public class WorkProjectServiceImpl implements WorkProjectService {
// 更新workUserProject数据
if
(!
userIds
.
containsAll
(
modifyProjectVo
.
getUserIds
())
||
!
modifyProjectVo
.
getUserIds
().
containsAll
(
userIds
))
{
// 先删除,后插入
if
(!
workUserProjectService
.
deleteByProjectId
(
modifyProjectVo
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
DELETE_OLD_WORK_ORDER_FAIL
);
if
(!
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(!
workUserProjectService
.
deleteByProjectId
(
modifyProjectVo
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
DELETE_OLD_WORK_ORDER_FAIL
);
}
}
if
(!
workUserProjectService
.
insertBatch
(
modifyProjectVo
.
getUserIds
(),
modifyProjectVo
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INSERT_DATA_IS_FAIL
);
if
(!
CollectionUtils
.
isEmpty
(
modifyProjectVo
.
getUserIds
()))
{
if
(!
workUserProjectService
.
insertBatch
(
modifyProjectVo
.
getUserIds
(),
modifyProjectVo
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INSERT_DATA_IS_FAIL
);
}
}
}
return
true
;
}
...
...
@@ -414,7 +419,7 @@ public class WorkProjectServiceImpl implements WorkProjectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
if
(
null
==
createProjectVo
.
getManagerId
()
||
null
==
createProjectVo
.
getStartTime
()
||
null
==
createProjectVo
.
getEndTime
()
||
StringUtils
.
isBlank
(
createProjectVo
.
getOaProjectId
())
||
null
==
createProjectVo
.
getWorkTime
()
||
null
==
createProjectVo
.
getCostBudget
()
||
null
==
createProjectVo
.
getDeptId
()
||
StringUtils
.
isBlank
(
createProjectVo
.
getProjectName
())
||
CollectionUtils
.
isEmpty
(
createProjectVo
.
getUserIds
())
||
null
==
createProjectVo
.
getDeptId
())
{
StringUtils
.
isBlank
(
createProjectVo
.
getProjectName
())
||
null
==
createProjectVo
.
getDeptId
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
if
(
createProjectVo
.
getStartTime
().
compareTo
(
createProjectVo
.
getEndTime
())
>
0
)
{
...
...
@@ -447,7 +452,10 @@ public class WorkProjectServiceImpl implements WorkProjectService {
}
// 插入参与人员信息
return
workUserProjectService
.
insertBatch
(
createProjectVo
.
getUserIds
(),
workProject
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
createProjectVo
.
getUserIds
()))
{
return
workUserProjectService
.
insertBatch
(
createProjectVo
.
getUserIds
(),
workProject
.
getId
());
}
return
true
;
}
private
PageInfo
<
ManagerProjectsDto
>
returnPageInfo
(
List
<
ManagerProjectsDto
>
managerProjectsDto
)
{
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkUserProjectServiceImpl.java
View file @
8209cac5
...
...
@@ -76,7 +76,7 @@ public class WorkUserProjectServiceImpl implements WorkUserProjectService {
}
List
<
UserProjectDto
>
userByProjectId
=
workUserProjectMapper
.
getUserByProjectId
(
projectId
);
if
(
CollectionUtils
.
isEmpty
(
userByProjectId
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
PROJECT_NOT_USER
)
;
return
null
;
}
return
userByProjectId
;
}
...
...
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