Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
Project
Project
Details
Activity
Releases
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
王飞
vehicle-quality-review
Commits
84e1cf7d
Commit
84e1cf7d
authored
Mar 05, 2024
by
王飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangfei' into 'dev'
1、封装nextNode计算方式。 See merge request
!121
parents
8d9b9be4
bcbfe9de
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
63 deletions
+48
-63
TaskState.java
...ity-review/src/main/java/com/ruoyi/service/TaskState.java
+2
-1
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+0
-3
TaskStateAdapter.java
...rc/main/java/com/ruoyi/service/impl/TaskStateAdapter.java
+43
-0
TaskStateNew.java
...ew/src/main/java/com/ruoyi/service/impl/TaskStateNew.java
+1
-31
TaskStatePending.java
...rc/main/java/com/ruoyi/service/impl/TaskStatePending.java
+2
-28
No files found.
quality-review/src/main/java/com/ruoyi/service/TaskState.java
View file @
84e1cf7d
...
...
@@ -8,7 +8,8 @@ public interface TaskState {
void
doCreate
(
Task
task
,
List
<
String
>
taskList
);
void
doStart
(
Task
task
);
void
doSubmit
(
Task
task
);
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
84e1cf7d
...
...
@@ -55,9 +55,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
private
ReviewDetailsMapper
reviewDetailsMapper
;
@Autowired
private
AutomobileEnterpriseMapper
automobileEnterpriseMapper
;
@Autowired
private
TaskStateFacade
taskStateFacade
;
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateAdapter.java
0 → 100644
View file @
84e1cf7d
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.service.CarReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
@Component
public
abstract
class
TaskStateAdapter
implements
TaskState
{
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
CarReviewTaskService
carReviewTaskService
;
@Autowired
private
TaskService
taskService
;
@Override
public
void
doStart
(
Task
task
)
{
task
.
setTaskStatus
(
Task
.
TASK_STATUS_PENDING
);
task
.
setRunStatus
(
Task
.
RUN_STATUS_STATUS_RUNNING
);
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_SRAIF
))
{
systemReviewTaskService
.
start
(
task
.
getSystemReviewTaskId
());
task
.
setNextNode
(
Task
.
SUB_TASK_GRFIS
);
taskService
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
carReviewTaskService
.
startReviewTask
(
task
.
getCarReviewTaskId
());
task
.
setNextNode
(
Task
.
SUB_TASK_TRFIS
);
taskService
.
updateById
(
task
);
}
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateNew.java
View file @
84e1cf7d
...
...
@@ -3,8 +3,6 @@ package com.ruoyi.service.impl;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.service.CarReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -15,12 +13,10 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Transactional
@Service
public
class
TaskStateNew
implements
TaskState
,
InitializingBean
{
public
class
TaskStateNew
extends
TaskStateAdapter
implements
TaskState
,
InitializingBean
{
@Autowired
private
TaskStateContext
taskStateContext
;
...
...
@@ -31,12 +27,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
@Autowired
private
TaskService
taskService
;
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
CarReviewTaskService
carReviewTaskService
;
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
...
...
@@ -63,26 +53,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
taskService
.
updateById
(
task
);
}
@Override
public
void
doStart
(
Task
task
)
{
task
.
setTaskStatus
(
Task
.
TASK_STATUS_PENDING
);
task
.
setRunStatus
(
Task
.
RUN_STATUS_STATUS_RUNNING
);
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_SRAIF
))
{
systemReviewTaskService
.
start
(
task
.
getSystemReviewTaskId
());
taskService
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
carReviewTaskService
.
startReviewTask
(
task
.
getCarReviewTaskId
());
taskService
.
updateById
(
task
);
}
else
{
throw
new
ServiceException
(
"已没有可执行的子任务节点"
,
HttpStatus
.
ERROR
);
}
task
.
setPointer
(
task
.
getPointer
()
+
1
);
taskService
.
updateById
(
task
);
}
@Override
public
void
doSubmit
(
Task
task
)
{
throw
new
ServiceException
(
"不能提交一个尚未开始的任务"
,
HttpStatus
.
ERROR
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskStatePending.java
View file @
84e1cf7d
...
...
@@ -6,8 +6,7 @@ import com.ruoyi.domain.CarReviewTask;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.mapper.ReviewDetailsMapper
;
import
com.ruoyi.service.CarReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
...
...
@@ -17,11 +16,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Objects
;
@Transactional
@Service
public
class
TaskStatePending
implements
TaskState
,
InitializingBean
{
public
class
TaskStatePending
extends
TaskStateAdapter
implements
TaskState
,
InitializingBean
{
@Autowired
private
TaskStateContext
taskStateContext
;
...
...
@@ -35,37 +33,13 @@ public class TaskStatePending implements TaskState, InitializingBean {
@Autowired
private
ApplicationContext
applicationContext
;
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
CarReviewTaskService
carReviewTaskService
;
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
throw
new
ServiceException
(
"不能创建一个已经开始的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doStart
(
Task
task
)
{
task
.
setTaskStatus
(
Task
.
TASK_STATUS_PENDING
);
task
.
setRunStatus
(
Task
.
RUN_STATUS_STATUS_RUNNING
);
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_SRAIF
))
{
systemReviewTaskService
.
start
(
task
.
getSystemReviewTaskId
());
task
.
setNextNode
(
Task
.
SUB_TASK_GRFIS
);
taskService
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
carReviewTaskService
.
startReviewTask
(
task
.
getCarReviewTaskId
());
task
.
setNextNode
(
Task
.
SUB_TASK_TRFIS
);
taskService
.
updateById
(
task
);
}
}
@Override
public
void
doSubmit
(
Task
task
)
{
...
...
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