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
a1ec0a44
Commit
a1ec0a44
authored
Feb 04, 2024
by
王飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangfei' into 'dev'
Wangfei See merge request
!77
parents
59df62d7
3e7b5c16
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
311 additions
and
22 deletions
+311
-22
Task.java
quality-review/src/main/java/com/ruoyi/domain/Task.java
+12
-4
TaskState.java
...ity-review/src/main/java/com/ruoyi/service/TaskState.java
+14
-0
StrategyCarReviewTaskSigned.java
...a/com/ruoyi/service/impl/StrategyCarReviewTaskSigned.java
+4
-1
StrategySystemReviewTaskSigned.java
...om/ruoyi/service/impl/StrategySystemReviewTaskSigned.java
+4
-1
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+9
-16
TaskStateContext.java
...rc/main/java/com/ruoyi/service/impl/TaskStateContext.java
+25
-0
TaskStateFacade.java
...src/main/java/com/ruoyi/service/impl/TaskStateFacade.java
+32
-0
TaskStateFinish.java
...src/main/java/com/ruoyi/service/impl/TaskStateFinish.java
+44
-0
TaskStateNew.java
...ew/src/main/java/com/ruoyi/service/impl/TaskStateNew.java
+80
-0
TaskStatePending.java
...rc/main/java/com/ruoyi/service/impl/TaskStatePending.java
+87
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/Task.java
View file @
a1ec0a44
...
...
@@ -24,11 +24,16 @@ import java.util.List;
public
class
Task
{
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_RUNNABLE
=
"RUNNABLE"
;
public
static
final
String
RUN_
STATUS_RUNNABLE
=
"RUNNABLE"
;
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_RUNNING
=
"RUNNING"
;
public
static
final
String
RUN_STATUS_STATUS_RUNNING
=
"RUNNING"
;
@TableField
(
exist
=
false
)
public
static
final
String
TASK_STATUS_NEW
=
"NEW"
;
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_FINISH
=
"FINISH"
;
public
static
final
String
TASK_STATUS_PENDING
=
"PENDING"
;
@TableField
(
exist
=
false
)
public
static
final
String
TASK_STATUS_FINISH
=
"FINISH"
;
@TableField
(
exist
=
false
)
public
static
final
String
SUB_TASK_GRFIS
=
"grfis"
;
...
...
@@ -58,9 +63,12 @@ public class Task {
@ApiModelProperty
(
"任务名称"
)
private
String
taskName
;
@ApiModelProperty
(
"任务状态
(NEW、FINISH)
"
)
@ApiModelProperty
(
"任务状态
[NEW、PENDING、FINISH]
"
)
private
String
taskStatus
;
@ApiModelProperty
(
"运行状态[RUNNABLE、RUNNING]"
)
public
String
runStatus
;
@ApiModelProperty
(
"下一个节点 SUB_TASK_SRAIF(体系审查子任务)、SUB_TASK_TRFIS(车辆实验子任务)、SUB_TASK_GRFIS(车辆问卷子任务)"
)
private
String
nextNode
;
...
...
quality-review/src/main/java/com/ruoyi/service/TaskState.java
0 → 100644
View file @
a1ec0a44
package
com
.
ruoyi
.
service
;
import
com.ruoyi.domain.Task
;
import
java.util.List
;
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/StrategyCarReviewTaskSigned.java
View file @
a1ec0a44
...
...
@@ -43,6 +43,9 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
@Autowired
private
TaskMapper
taskMapper
;
@Autowired
private
TaskStateFacade
taskStateFacade
;
// SIGNED状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
...
...
@@ -84,7 +87,7 @@ public class StrategyCarReviewTaskSigned implements StrategyCarReviewTask, Initi
// 5.再找带该子任务所属的总任务,将总任务的状态由 RUNNING 改回 RUNNABLE
Task
task
=
taskMapper
.
selectById
(
taskMapper
.
findByCarReviewTaskId
(
carReviewTask
.
getId
()));
task
.
setTaskStatus
(
Task
.
STATUS_RUNNABLE
);
task
StateFacade
.
doSubmit
(
task
);
carReviewTaskMapper
.
updateById
(
carReviewTask
);
taskMapper
.
updateById
(
task
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskSigned.java
View file @
a1ec0a44
...
...
@@ -42,6 +42,9 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
@Autowired
private
TaskMapper
taskMapper
;
@Autowired
private
TaskStateFacade
taskStateFacade
;
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
...
...
@@ -73,7 +76,7 @@ public class StrategySystemReviewTaskSigned implements StrategySystemReviewTask,
// 5.再找带该子任务所属的总任务,将总任务的状态由 RUNNING 改回 RUNNABLE
Task
task
=
taskMapper
.
selectById
(
taskMapper
.
findBySystemReviewTaskId
(
systemReviewTask
.
getId
()));
task
.
setTaskStatus
(
Task
.
STATUS_RUNNABLE
);
task
StateFacade
.
doSubmit
(
task
);
systemReviewTaskMapper
.
updateById
(
systemReviewTask
);
taskMapper
.
updateById
(
task
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
a1ec0a44
...
...
@@ -59,6 +59,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
@Autowired
private
AutomobileEnterpriseMapper
automobileEnterpriseMapper
;
@Autowired
private
TaskStateFacade
taskStateFacade
;
@Override
public
List
<
Task
>
findList
(
TaskListRequest
request
)
{
return
taskMapper
.
findList
(
request
);
...
...
@@ -87,7 +91,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
Task
task
=
new
Task
();
task
.
setTaskInitiator
(
initiator
.
getNickName
());
task
.
setTaskInitiatorDept
(
initiator
.
getDept
().
getDeptName
());
task
.
setTaskStatus
(
Task
.
STATUS_RUNNABLE
);
task
.
setTaskStatus
(
Task
.
TASK_STATUS_NEW
);
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeader
(
leader
.
getName
());
task
.
setCreateTime
(
new
Date
());
...
...
@@ -98,24 +102,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
AutomobileEnterprise
automobileEnterprise
=
automobileEnterpriseMapper
.
selectAutomobileEnterpriseById
(
request
.
getProductionId
());
task
.
setProductionEnterprise
(
automobileEnterprise
.
getEnterpriseName
());
String
nextNode
=
null
;
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_TRFIS
))
{
nextNode
=
Task
.
SUB_TASK_TRFIS
;
}
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_GRFIS
))
{
// 保存车型审查问卷任务
nextNode
=
Task
.
SUB_TASK_GRFIS
;;
task
.
setCarReviewTaskId
(
saveCarReview
(
request
,
initiator
,
standard
,
leader
));
}
if
(
request
.
getTaskList
().
contains
(
Task
.
SUB_TASK_SRAIF
))
{
// 保存体系审查任务
nextNode
=
Task
.
SUB_TASK_SRAIF
;
task
.
setSystemReviewTaskId
(
saveSystemReview
(
request
,
initiator
,
standard
,
leader
));
}
task
.
setNextNode
(
nextNode
);
taskService
.
save
(
task
);
// 构建并保存该任务所关联的审核组信息
...
...
@@ -195,18 +190,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
carRequest
.
setTaskId
(
task
.
getCarReviewTaskId
());
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_SRAIF
))
{
systemReviewTaskService
.
start
(
systemRequest
);
task
.
setTaskStatus
(
Task
.
STATUS_RUNNING
);
task
.
setNextNode
(
Task
.
SUB_TASK_GRFIS
);
taskMapper
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
carReviewTaskService
.
startReviewTask
(
carRequest
);
task
.
setTaskStatus
(
Task
.
STATUS_RUNNING
);
task
.
setNextNode
(
Task
.
SUB_TASK_TRFIS
);
taskMapper
.
updateById
(
task
);
}
taskStateFacade
.
doStart
(
task
);
}
public
Long
saveSystemReview
(
TaskCreateRequest
request
,
SysUser
initiator
,
Standard
standard
,
TaskUserRelation
leader
)
{
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateContext.java
0 → 100644
View file @
a1ec0a44
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.service.StrategyReviewSceneChange
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Transactional
@Service
public
class
TaskStateContext
{
private
final
Map
<
String
,
TaskState
>
strategyMap
=
new
ConcurrentHashMap
<>();
public
void
putResource
(
String
key
,
TaskState
taskState
)
{
strategyMap
.
put
(
key
,
taskState
);
}
public
TaskState
getResource
(
String
operation
){
return
strategyMap
.
get
(
operation
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateFacade.java
0 → 100644
View file @
a1ec0a44
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
@Component
public
class
TaskStateFacade
implements
TaskState
{
@Autowired
private
TaskStateContext
taskStateContext
;
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
taskStateContext
.
getResource
(
task
.
getTaskStatus
()).
doCreate
(
task
,
taskList
);
}
@Override
public
void
doStart
(
Task
task
)
{
taskStateContext
.
getResource
(
task
.
getTaskStatus
()).
doStart
(
task
);
}
@Override
public
void
doSubmit
(
Task
task
)
{
taskStateContext
.
getResource
(
task
.
getTaskStatus
()).
doSubmit
(
task
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateFinish.java
0 → 100644
View file @
a1ec0a44
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.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
@Service
public
class
TaskStateFinish
implements
TaskState
,
InitializingBean
{
@Autowired
private
TaskStateContext
taskStateContext
;
@Autowired
private
ApplicationContext
applicationContext
;
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
throw
new
ServiceException
(
"不能创建一个已经结束的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doStart
(
Task
task
)
{
throw
new
ServiceException
(
"不能开始一个已经结束的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doSubmit
(
Task
task
)
{
throw
new
ServiceException
(
"不能完成一个已经结束的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
taskStateContext
.
putResource
(
Task
.
TASK_STATUS_FINISH
,
applicationContext
.
getBean
(
this
.
getClass
()));
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskStateNew.java
0 → 100644
View file @
a1ec0a44
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.TaskService
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Objects
;
@Transactional
@Service
public
class
TaskStateNew
implements
TaskState
,
InitializingBean
{
@Autowired
private
TaskStateContext
taskStateContext
;
@Autowired
private
ApplicationContext
applicationContext
;
@Autowired
private
TaskService
taskService
;
@Override
public
void
doCreate
(
Task
task
,
List
<
String
>
taskList
)
{
String
nextNode
=
null
;
if
(
taskList
.
contains
(
Task
.
SUB_TASK_TRFIS
))
{
nextNode
=
Task
.
SUB_TASK_TRFIS
;
}
if
(
taskList
.
contains
(
Task
.
SUB_TASK_GRFIS
))
{
// 保存车型审查问卷任务
nextNode
=
Task
.
SUB_TASK_GRFIS
;;
}
if
(
taskList
.
contains
(
Task
.
SUB_TASK_SRAIF
))
{
// 保存体系审查任务
nextNode
=
Task
.
SUB_TASK_SRAIF
;
}
task
.
setNextNode
(
nextNode
);
}
@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
))
{
task
.
setNextNode
(
Task
.
SUB_TASK_GRFIS
);
taskService
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
task
.
setNextNode
(
Task
.
SUB_TASK_TRFIS
);
taskService
.
updateById
(
task
);
}
taskService
.
updateById
(
task
);
}
@Override
public
void
doSubmit
(
Task
task
)
{
throw
new
ServiceException
(
"不能提交一个尚未开始的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
taskStateContext
.
putResource
(
Task
.
TASK_STATUS_PENDING
,
applicationContext
.
getBean
(
this
.
getClass
()));
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskStatePending.java
0 → 100644
View file @
a1ec0a44
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.CarReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.mapper.ReviewDetailsMapper
;
import
com.ruoyi.service.TaskService
;
import
com.ruoyi.service.TaskState
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
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
{
@Autowired
private
TaskStateContext
taskStateContext
;
private
ReviewDetailsMapper
reviewDetailsMapper
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
ApplicationContext
applicationContext
;
@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
))
{
task
.
setNextNode
(
Task
.
SUB_TASK_GRFIS
);
taskService
.
updateById
(
task
);
}
else
if
(
Objects
.
equals
(
task
.
getNextNode
(),
Task
.
SUB_TASK_GRFIS
))
{
task
.
setNextNode
(
Task
.
SUB_TASK_TRFIS
);
taskService
.
updateById
(
task
);
}
}
@Override
public
void
doSubmit
(
Task
task
)
{
long
subTaskCount
=
0
;
if
(
task
.
getSystemReviewTaskId
()
!=
null
)
{
subTaskCount
=
reviewDetailsMapper
.
count
(
task
.
getSystemReviewTaskId
(),
SystemReviewTask
.
TYPE
);
}
if
(
task
.
getCarReviewTaskId
()
!=
null
)
{
subTaskCount
=
reviewDetailsMapper
.
count
(
task
.
getCarReviewTaskId
(),
CarReviewTask
.
TYPE
);
}
if
(
subTaskCount
>
0
)
{
task
.
setTaskStatus
(
Task
.
TASK_STATUS_PENDING
);
task
.
setRunStatus
(
Task
.
RUN_STATUS_RUNNABLE
);
}
else
{
task
.
setTaskStatus
(
Task
.
TASK_STATUS_FINISH
);
task
.
setRunStatus
(
Task
.
RUN_STATUS_STATUS_RUNNING
);
}
taskService
.
updateById
(
task
);
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
taskStateContext
.
putResource
(
Task
.
TASK_STATUS_PENDING
,
applicationContext
.
getBean
(
this
.
getClass
()));
}
}
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