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
bcbfe9de
Commit
bcbfe9de
authored
Mar 05, 2024
by
王飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、封装nextNode计算方式。
parent
8e91fdbb
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 @
bcbfe9de
...
@@ -8,7 +8,8 @@ public interface TaskState {
...
@@ -8,7 +8,8 @@ public interface TaskState {
void
doCreate
(
Task
task
,
List
<
String
>
taskList
);
void
doCreate
(
Task
task
,
List
<
String
>
taskList
);
void
doStart
(
Task
task
);
void
doStart
(
Task
task
);
void
doSubmit
(
Task
task
);
void
doSubmit
(
Task
task
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
bcbfe9de
...
@@ -55,9 +55,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
...
@@ -55,9 +55,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
@Autowired
private
ReviewDetailsMapper
reviewDetailsMapper
;
private
ReviewDetailsMapper
reviewDetailsMapper
;
@Autowired
private
AutomobileEnterpriseMapper
automobileEnterpriseMapper
;
@Autowired
@Autowired
private
TaskStateFacade
taskStateFacade
;
private
TaskStateFacade
taskStateFacade
;
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateAdapter.java
0 → 100644
View file @
bcbfe9de
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 @
bcbfe9de
...
@@ -3,8 +3,6 @@ package com.ruoyi.service.impl;
...
@@ -3,8 +3,6 @@ package com.ruoyi.service.impl;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.service.CarReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
@@ -15,12 +13,10 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -15,12 +13,10 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Transactional
@Transactional
@Service
@Service
public
class
TaskStateNew
implements
TaskState
,
InitializingBean
{
public
class
TaskStateNew
extends
TaskStateAdapter
implements
TaskState
,
InitializingBean
{
@Autowired
@Autowired
private
TaskStateContext
taskStateContext
;
private
TaskStateContext
taskStateContext
;
...
@@ -31,12 +27,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
...
@@ -31,12 +27,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
@Autowired
@Autowired
private
TaskService
taskService
;
private
TaskService
taskService
;
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
CarReviewTaskService
carReviewTaskService
;
@Override
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
...
@@ -63,26 +53,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
...
@@ -63,26 +53,6 @@ public class TaskStateNew implements TaskState, InitializingBean {
taskService
.
updateById
(
task
);
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
@Override
public
void
doSubmit
(
Task
task
)
{
public
void
doSubmit
(
Task
task
)
{
throw
new
ServiceException
(
"不能提交一个尚未开始的任务"
,
HttpStatus
.
ERROR
);
throw
new
ServiceException
(
"不能提交一个尚未开始的任务"
,
HttpStatus
.
ERROR
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskStatePending.java
View file @
bcbfe9de
...
@@ -6,8 +6,7 @@ import com.ruoyi.domain.CarReviewTask;
...
@@ -6,8 +6,7 @@ import com.ruoyi.domain.CarReviewTask;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.mapper.ReviewDetailsMapper
;
import
com.ruoyi.mapper.ReviewDetailsMapper
;
import
com.ruoyi.service.CarReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
@@ -17,11 +16,10 @@ import org.springframework.stereotype.Service;
...
@@ -17,11 +16,10 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
@Transactional
@Transactional
@Service
@Service
public
class
TaskStatePending
implements
TaskState
,
InitializingBean
{
public
class
TaskStatePending
extends
TaskStateAdapter
implements
TaskState
,
InitializingBean
{
@Autowired
@Autowired
private
TaskStateContext
taskStateContext
;
private
TaskStateContext
taskStateContext
;
...
@@ -35,37 +33,13 @@ public class TaskStatePending implements TaskState, InitializingBean {
...
@@ -35,37 +33,13 @@ public class TaskStatePending implements TaskState, InitializingBean {
@Autowired
@Autowired
private
ApplicationContext
applicationContext
;
private
ApplicationContext
applicationContext
;
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
CarReviewTaskService
carReviewTaskService
;
@Override
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
throw
new
ServiceException
(
"不能创建一个已经开始的任务"
,
HttpStatus
.
ERROR
);
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
@Override
public
void
doSubmit
(
Task
task
)
{
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