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
0f9d0abe
Commit
0f9d0abe
authored
Dec 21, 2023
by
王飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feat
1、实现了任务的开始和关闭功能。 Reference N/A
parent
3b05cea6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
133 additions
and
16 deletions
+133
-16
StrategySystemReviewTask.java
...main/java/com/ruoyi/service/StrategySystemReviewTask.java
+6
-0
SystemReviewTaskService.java
.../main/java/com/ruoyi/service/SystemReviewTaskService.java
+7
-0
StrategySystemReviewTaskClose.java
...com/ruoyi/service/impl/StrategySystemReviewTaskClose.java
+17
-0
StrategySystemReviewTaskContext.java
...m/ruoyi/service/impl/StrategySystemReviewTaskContext.java
+2
-2
StrategySystemReviewTaskFinish.java
...om/ruoyi/service/impl/StrategySystemReviewTaskFinish.java
+17
-0
StrategySystemReviewTaskNew.java
...a/com/ruoyi/service/impl/StrategySystemReviewTaskNew.java
+26
-0
StrategySystemReviewTaskPending.java
...m/ruoyi/service/impl/StrategySystemReviewTaskPending.java
+31
-4
SystemReviewTaskServiceImpl.java
...a/com/ruoyi/service/impl/SystemReviewTaskServiceImpl.java
+9
-10
SystemReviewTaskController.java
...c/main/java/com/ruoyi/web/SystemReviewTaskController.java
+8
-0
SystemReviewTaskStartRequest.java
...a/com/ruoyi/web/request/SystemReviewTaskStartRequest.java
+10
-0
No files found.
quality-review/src/main/java/com/ruoyi/service/StrategySystemReviewTask.java
View file @
0f9d0abe
...
@@ -5,6 +5,12 @@ import com.ruoyi.web.response.SystemReviewTaskViewResponse;
...
@@ -5,6 +5,12 @@ import com.ruoyi.web.response.SystemReviewTaskViewResponse;
public
interface
StrategySystemReviewTask
{
public
interface
StrategySystemReviewTask
{
void
doStart
(
SystemReviewTask
systemReviewTask
);
void
doSubmit
(
SystemReviewTask
systemReviewTask
);
void
doClose
(
SystemReviewTask
systemReviewTask
);
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
);
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
);
}
}
quality-review/src/main/java/com/ruoyi/service/SystemReviewTaskService.java
View file @
0f9d0abe
...
@@ -3,6 +3,7 @@ package com.ruoyi.service;
...
@@ -3,6 +3,7 @@ package com.ruoyi.service;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskStartRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
/**
/**
...
@@ -25,4 +26,10 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
...
@@ -25,4 +26,10 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
*/
*/
SystemReviewTaskViewResponse
view
(
Long
taskId
);
SystemReviewTaskViewResponse
view
(
Long
taskId
);
/**
* 开始一个任务
* @param request
*/
void
start
(
SystemReviewTaskStartRequest
request
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskClose.java
View file @
0f9d0abe
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
...
@@ -10,6 +12,21 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -10,6 +12,21 @@ import org.springframework.transaction.annotation.Transactional;
@Service
(
SystemReviewTask
.
STATUS_CLOSE
)
@Service
(
SystemReviewTask
.
STATUS_CLOSE
)
public
class
StrategySystemReviewTaskClose
implements
StrategySystemReviewTask
{
public
class
StrategySystemReviewTaskClose
implements
StrategySystemReviewTask
{
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能开始一个已关闭的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doSubmit
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能提交一个已关闭的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doClose
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能关闭一个已关闭的任务"
,
HttpStatus
.
ERROR
);
}
// CLOSE状态下
// CLOSE状态下
// 1.standard字段使用task中归档的问卷
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 2.不查询场景变更任务
...
...
quality-review/src/main/java/com/ruoyi/service/impl/St
ate
SystemReviewTaskContext.java
→
quality-review/src/main/java/com/ruoyi/service/impl/St
rategy
SystemReviewTaskContext.java
View file @
0f9d0abe
...
@@ -10,12 +10,12 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -10,12 +10,12 @@ import java.util.concurrent.ConcurrentHashMap;
@Transactional
@Transactional
@Service
@Service
public
class
St
ate
SystemReviewTaskContext
{
public
class
St
rategy
SystemReviewTaskContext
{
@Autowired
@Autowired
private
final
Map
<
String
,
StrategySystemReviewTask
>
resourceMap
=
new
ConcurrentHashMap
<>();
private
final
Map
<
String
,
StrategySystemReviewTask
>
resourceMap
=
new
ConcurrentHashMap
<>();
public
St
ate
SystemReviewTaskContext
(
Map
<
String
,
StrategySystemReviewTask
>
strategyMap
)
{
public
St
rategy
SystemReviewTaskContext
(
Map
<
String
,
StrategySystemReviewTask
>
strategyMap
)
{
this
.
resourceMap
.
clear
();
this
.
resourceMap
.
clear
();
strategyMap
.
forEach
(
resourceMap:
:
put
);
strategyMap
.
forEach
(
resourceMap:
:
put
);
}
}
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskFinish.java
View file @
0f9d0abe
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
...
@@ -10,6 +12,21 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -10,6 +12,21 @@ import org.springframework.transaction.annotation.Transactional;
@Service
(
SystemReviewTask
.
STATUS_FINISH
)
@Service
(
SystemReviewTask
.
STATUS_FINISH
)
public
class
StrategySystemReviewTaskFinish
implements
StrategySystemReviewTask
{
public
class
StrategySystemReviewTaskFinish
implements
StrategySystemReviewTask
{
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能开始一个已完成的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doSubmit
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能提交一个已完成的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doClose
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能关闭一个已完成的任务"
,
HttpStatus
.
ERROR
);
}
// FINISH状态下
// FINISH状态下
// 1.standard字段使用task中归档的问卷
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 2.不查询场景变更任务
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskNew.java
View file @
0f9d0abe
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.mapper.SystemReviewTaskMapper
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
...
@@ -9,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -9,6 +12,7 @@ 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
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Transactional
@Transactional
...
@@ -18,6 +22,28 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask {
...
@@ -18,6 +22,28 @@ public class StrategySystemReviewTaskNew implements StrategySystemReviewTask {
@Autowired
@Autowired
private
ReviewStandardService
reviewStandardService
;
private
ReviewStandardService
reviewStandardService
;
@Autowired
private
SystemReviewTaskMapper
systemReviewTaskMapper
;
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
systemReviewTask
.
setTaskBeginTime
(
new
Date
());
systemReviewTask
.
setTaskStatus
(
SystemReviewTask
.
STATUS_PENDING
);
systemReviewTaskMapper
.
updateById
(
systemReviewTask
);
}
@Override
public
void
doSubmit
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能提交一个尚未开始的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doClose
(
SystemReviewTask
systemReviewTask
)
{
systemReviewTask
.
setTaskEndTime
(
new
Date
());
systemReviewTask
.
setTaskStatus
(
SystemReviewTask
.
STATUS_CLOSE
);
systemReviewTaskMapper
.
updateById
(
systemReviewTask
);
}
// NEW状态下
// NEW状态下
// 1.standard字段查询当前最新问卷
// 1.standard字段查询当前最新问卷
// 2.不查询场景变更任务
// 2.不查询场景变更任务
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskPending.java
View file @
0f9d0abe
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.exception.ServiceException
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.service.ReviewDetailsResultService
;
import
com.ruoyi.mapper.SystemReviewTaskMapper
;
import
com.ruoyi.service.ReviewSceneChangeTaskService
;
import
com.ruoyi.service.*
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
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
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.function.Function
;
...
@@ -28,6 +29,32 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
...
@@ -28,6 +29,32 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
@Autowired
private
ReviewSceneChangeTaskService
reviewSceneChangeTaskService
;
private
ReviewSceneChangeTaskService
reviewSceneChangeTaskService
;
@Autowired
private
SystemReviewTaskMapper
systemReviewTaskMapper
;
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能开始一个已经开始的任务"
,
HttpStatus
.
ERROR
);
}
@Override
public
void
doSubmit
(
SystemReviewTask
systemReviewTask
)
{
// TODO
// 1. 获取最新问卷
// 2. 所有细则必须有对应答案
// 3. 答案的 id + text 必须与细则对应的答案一致
// 4. 将最终问卷归档到 standard 字段
// 5. 填充task_end_time
// 6. 修改任务状态为 FINISH
}
@Override
public
void
doClose
(
SystemReviewTask
systemReviewTask
)
{
systemReviewTask
.
setTaskEndTime
(
new
Date
());
systemReviewTask
.
setTaskStatus
(
SystemReviewTask
.
STATUS_CLOSE
);
systemReviewTaskMapper
.
updateById
(
systemReviewTask
);
}
// PENDING状态下
// PENDING状态下
// 1.standard字段查询当前最新问卷
// 1.standard字段查询当前最新问卷
// 2.查询场景变更任务
// 2.查询场景变更任务
...
...
quality-review/src/main/java/com/ruoyi/service/impl/SystemReviewTaskServiceImpl.java
View file @
0f9d0abe
...
@@ -10,14 +10,13 @@ import com.ruoyi.mapper.SystemReviewTaskMapper;
...
@@ -10,14 +10,13 @@ import com.ruoyi.mapper.SystemReviewTaskMapper;
import
com.ruoyi.service.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskStartRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
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
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
/**
* @author wangfei
* @author wangfei
...
@@ -35,13 +34,7 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
...
@@ -35,13 +34,7 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
private
SystemReviewTaskService
systemReviewTaskService
;
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
@Autowired
private
ReviewStandardService
reviewStandardService
;
private
StrategySystemReviewTaskContext
strategySystemReviewTaskContext
;
@Autowired
private
ReviewDetailsResultService
reviewDetailsResultService
;
@Autowired
private
StateSystemReviewTaskContext
stateSystemReviewTaskContext
;
@Autowired
@Autowired
private
ISysUserService
sysUserService
;
private
ISysUserService
sysUserService
;
...
@@ -88,7 +81,13 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
...
@@ -88,7 +81,13 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
@Override
@Override
public
SystemReviewTaskViewResponse
view
(
Long
taskId
)
{
public
SystemReviewTaskViewResponse
view
(
Long
taskId
)
{
SystemReviewTask
systemReviewTask
=
systemReviewTaskService
.
getById
(
taskId
);
SystemReviewTask
systemReviewTask
=
systemReviewTaskService
.
getById
(
taskId
);
return
stateSystemReviewTaskContext
.
getResource
(
systemReviewTask
.
getTaskStatus
()).
doView
(
systemReviewTask
);
return
strategySystemReviewTaskContext
.
getResource
(
systemReviewTask
.
getTaskStatus
()).
doView
(
systemReviewTask
);
}
@Override
public
void
start
(
SystemReviewTaskStartRequest
request
)
{
SystemReviewTask
systemReviewTask
=
systemReviewTaskService
.
getById
(
request
.
getTaskId
());
strategySystemReviewTaskContext
.
getResource
(
systemReviewTask
.
getTaskStatus
()).
doStart
(
systemReviewTask
);
}
}
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/SystemReviewTaskController.java
View file @
0f9d0abe
...
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
...
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskStartRequest
;
import
com.ruoyi.web.request.SystemReviewTaskViewRequest
;
import
com.ruoyi.web.request.SystemReviewTaskViewRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
...
@@ -42,4 +43,11 @@ public class SystemReviewTaskController extends BaseController {
...
@@ -42,4 +43,11 @@ public class SystemReviewTaskController extends BaseController {
return
AjaxResult
.
success
(
systemReviewTaskViewResponse
);
return
AjaxResult
.
success
(
systemReviewTaskViewResponse
);
}
}
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/start"
)
public
AjaxResult
view
(
@Validated
@RequestBody
SystemReviewTaskStartRequest
request
)
{
systemReviewTaskService
.
start
(
request
);
return
AjaxResult
.
success
();
}
}
}
quality-review/src/main/java/com/ruoyi/web/request/SystemReviewTaskStartRequest.java
0 → 100644
View file @
0f9d0abe
package
com
.
ruoyi
.
web
.
request
;
import
lombok.Data
;
@Data
public
class
SystemReviewTaskStartRequest
{
private
Long
taskId
;
}
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