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
3b05cea6
Commit
3b05cea6
authored
Dec 21, 2023
by
王飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feat
1、实现审查任务在不同的状态下具有不同的view行为。 Reference N/A
parent
6d9e40c3
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
357 additions
and
106 deletions
+357
-106
ReviewDetailsResult.java
...w/src/main/java/com/ruoyi/domain/ReviewDetailsResult.java
+1
-2
SystemReviewTask.java
...view/src/main/java/com/ruoyi/domain/SystemReviewTask.java
+12
-6
ReviewDetailsResultMapper.java
...main/java/com/ruoyi/mapper/ReviewDetailsResultMapper.java
+1
-1
ReviewSceneChangeTaskMapper.java
...in/java/com/ruoyi/mapper/ReviewSceneChangeTaskMapper.java
+4
-0
ReviewDetailsResultService.java
...in/java/com/ruoyi/service/ReviewDetailsResultService.java
+1
-1
ReviewSceneChangeTaskService.java
.../java/com/ruoyi/service/ReviewSceneChangeTaskService.java
+10
-0
StrategySystemReviewTask.java
...main/java/com/ruoyi/service/StrategySystemReviewTask.java
+10
-0
SystemReviewTaskService.java
.../main/java/com/ruoyi/service/SystemReviewTaskService.java
+13
-4
ReviewDetailsResultServiceImpl.java
...om/ruoyi/service/impl/ReviewDetailsResultServiceImpl.java
+3
-4
ReviewSceneChangeTaskServiceImpl.java
.../ruoyi/service/impl/ReviewSceneChangeTaskServiceImpl.java
+8
-0
StateSystemReviewTaskContext.java
.../com/ruoyi/service/impl/StateSystemReviewTaskContext.java
+26
-0
StrategySystemReviewTaskClose.java
...com/ruoyi/service/impl/StrategySystemReviewTaskClose.java
+25
-0
StrategySystemReviewTaskFinish.java
...om/ruoyi/service/impl/StrategySystemReviewTaskFinish.java
+25
-0
StrategySystemReviewTaskNew.java
...a/com/ruoyi/service/impl/StrategySystemReviewTaskNew.java
+40
-0
StrategySystemReviewTaskPending.java
...m/ruoyi/service/impl/StrategySystemReviewTaskPending.java
+77
-0
SystemReviewTaskServiceImpl.java
...a/com/ruoyi/service/impl/SystemReviewTaskServiceImpl.java
+31
-67
SystemReviewTaskController.java
...c/main/java/com/ruoyi/web/SystemReviewTaskController.java
+13
-3
SystemReviewTaskCreateRequest.java
.../com/ruoyi/web/request/SystemReviewTaskCreateRequest.java
+15
-0
SystemReviewTaskViewRequest.java
...va/com/ruoyi/web/request/SystemReviewTaskViewRequest.java
+10
-0
SystemReviewTaskViewResponse.java
.../com/ruoyi/web/response/SystemReviewTaskViewResponse.java
+22
-0
ReviewDetailsResultMapper.xml
...w/src/main/resources/mapper/ReviewDetailsResultMapper.xml
+3
-3
ReviewSceneChangeTaskMapper.xml
...src/main/resources/mapper/ReviewSceneChangeTaskMapper.xml
+7
-0
SystemReviewTaskMapper.xml
...view/src/main/resources/mapper/SystemReviewTaskMapper.xml
+0
-1
SystemReviewTaskTest.java
...i-admin/src/test/java/com/ruoyi/SystemReviewTaskTest.java
+0
-14
No files found.
quality-review/src/main/java/com/ruoyi/domain/ReviewDetailsResult.java
View file @
3b05cea6
package
com
.
ruoyi
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
...
...
@@ -38,7 +37,7 @@ public class ReviewDetailsResult implements Serializable {
/**
* 厂商适用于该细则的场景截图或照片(多个url用","分隔)
*/
private
String
images
u
rl
;
private
String
images
U
rl
;
/**
* 关联到的细则id
...
...
quality-review/src/main/java/com/ruoyi/domain/SystemReviewTask.java
View file @
3b05cea6
...
...
@@ -19,6 +19,17 @@ import lombok.experimental.Accessors;
@Accessors
(
chain
=
true
)
@Data
public
class
SystemReviewTask
{
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_NEW
=
"NEW"
;
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_PENDING
=
"PENDING"
;
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_FINISH
=
"FINISH"
;
@TableField
(
exist
=
false
)
public
static
final
String
STATUS_CLOSE
=
"CLOSE"
;
/**
* 主键
*/
...
...
@@ -45,11 +56,6 @@ public class SystemReviewTask {
*/
private
String
taskInitiatorDept
;
/**
* 任务发起人岗位
*/
private
String
taskInitiatorOrg
;
/**
* 任务结果(PASS、REJECT)
*/
...
...
@@ -66,7 +72,7 @@ public class SystemReviewTask {
private
Date
taskEndTime
;
/**
* 审查标准
归档
* 审查标准
*/
@TableField
(
value
=
"standard"
,
typeHandler
=
StandardJsonTypeHandler
.
class
)
private
List
<
ReviewStandard
>
standard
;
...
...
quality-review/src/main/java/com/ruoyi/mapper/ReviewDetailsResultMapper.java
View file @
3b05cea6
...
...
@@ -16,7 +16,7 @@ import java.util.List;
@Repository
public
interface
ReviewDetailsResultMapper
extends
BaseMapper
<
ReviewDetailsResult
>
{
List
<
ReviewDetailsResult
>
findByTask
No
(
@Param
(
"taskNo"
)
String
taskNo
);
List
<
ReviewDetailsResult
>
findByTask
Id
(
@Param
(
"taskId"
)
Long
taskId
);
}
...
...
quality-review/src/main/java/com/ruoyi/mapper/ReviewSceneChangeTaskMapper.java
View file @
3b05cea6
...
...
@@ -3,6 +3,9 @@ package com.ruoyi.mapper;
import
com.ruoyi.domain.ReviewSceneChangeTask
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Mapper
...
...
@@ -11,6 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public
interface
ReviewSceneChangeTaskMapper
extends
BaseMapper
<
ReviewSceneChangeTask
>
{
List
<
ReviewSceneChangeTask
>
findLastChangeByAfterTime
(
Date
date
);
}
...
...
quality-review/src/main/java/com/ruoyi/service/ReviewDetailsResultService.java
View file @
3b05cea6
...
...
@@ -12,6 +12,6 @@ import java.util.List;
*/
public
interface
ReviewDetailsResultService
extends
IService
<
ReviewDetailsResult
>
{
List
<
ReviewDetailsResult
>
findByTask
No
(
String
taskNo
);
List
<
ReviewDetailsResult
>
findByTask
Id
(
Long
taskId
);
}
quality-review/src/main/java/com/ruoyi/service/ReviewSceneChangeTaskService.java
View file @
3b05cea6
...
...
@@ -3,6 +3,9 @@ package com.ruoyi.service;
import
com.ruoyi.domain.ReviewSceneChangeTask
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author wangfei
* @description 针对表【t_review_scene_change_task(审查场景变更任务)】的数据库操作Service
...
...
@@ -35,4 +38,11 @@ public interface ReviewSceneChangeTaskService extends IService<ReviewSceneChange
*/
void
close
(
Long
taskId
);
/**
* 获取指定时间之后的每个场景的最后变更记录
* @param date
* @return
*/
List
<
ReviewSceneChangeTask
>
findLastChangeByAfterTime
(
Date
date
);
}
quality-review/src/main/java/com/ruoyi/service/StrategySystemReviewTask.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
public
interface
StrategySystemReviewTask
{
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
);
}
quality-review/src/main/java/com/ruoyi/service/SystemReviewTaskService.java
View file @
3b05cea6
...
...
@@ -2,8 +2,8 @@ package com.ruoyi.service;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
/**
* @author wangfei
...
...
@@ -12,8 +12,17 @@ import java.util.List;
*/
public
interface
SystemReviewTaskService
extends
IService
<
SystemReviewTask
>
{
void
createTaskTest
(
String
bizInfo
,
List
<
Long
>
userIds
);
/**
* 创建一个体系审查任务
* @param request
*/
void
createTaskTest
(
SystemReviewTaskCreateRequest
request
);
SystemReviewTask
loadTaskById
(
Long
id
);
/**
* 查看
* @param taskId
* @return
*/
SystemReviewTaskViewResponse
view
(
Long
taskId
);
}
quality-review/src/main/java/com/ruoyi/service/impl/ReviewDetailsResultServiceImpl.java
View file @
3b05cea6
...
...
@@ -17,15 +17,14 @@ import java.util.List;
*/
@Transactional
@Service
public
class
ReviewDetailsResultServiceImpl
extends
ServiceImpl
<
ReviewDetailsResultMapper
,
ReviewDetailsResult
>
implements
ReviewDetailsResultService
{
public
class
ReviewDetailsResultServiceImpl
extends
ServiceImpl
<
ReviewDetailsResultMapper
,
ReviewDetailsResult
>
implements
ReviewDetailsResultService
{
@Autowired
private
ReviewDetailsResultMapper
reviewDetailsResultMapper
;
@Override
public
List
<
ReviewDetailsResult
>
findByTask
No
(
String
taskNo
)
{
return
reviewDetailsResultMapper
.
findByTask
No
(
taskNo
);
public
List
<
ReviewDetailsResult
>
findByTask
Id
(
Long
taskId
)
{
return
reviewDetailsResultMapper
.
findByTask
Id
(
taskId
);
}
}
...
...
quality-review/src/main/java/com/ruoyi/service/impl/ReviewSceneChangeTaskServiceImpl.java
View file @
3b05cea6
...
...
@@ -41,6 +41,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Autowired
private
ReviewSceneService
reviewSceneService
;
@Autowired
private
ReviewSceneChangeTaskMapper
reviewSceneChangeTaskMapper
;
@Override
public
void
create
(
ReviewSceneChangeTask
reviewSceneChangeTask
)
{
...
...
@@ -127,6 +130,11 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
ReviewSceneChangeTask
task
=
getById
(
taskId
);
}
@Override
public
List
<
ReviewSceneChangeTask
>
findLastChangeByAfterTime
(
Date
date
)
{
return
reviewSceneChangeTaskMapper
.
findLastChangeByAfterTime
(
date
);
}
private
void
checkTaskStatus
(
String
status
)
{
if
(
status
!=
null
&&
ReviewSceneChangeTask
.
STATUS_FINISH
.
equals
(
status
))
{
throw
new
ServiceException
(
"不能处理一个已经完成的任务"
,
HttpStatus
.
ERROR
);
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StateSystemReviewTaskContext.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Transactional
@Service
public
class
StateSystemReviewTaskContext
{
@Autowired
private
final
Map
<
String
,
StrategySystemReviewTask
>
resourceMap
=
new
ConcurrentHashMap
<>();
public
StateSystemReviewTaskContext
(
Map
<
String
,
StrategySystemReviewTask
>
strategyMap
)
{
this
.
resourceMap
.
clear
();
strategyMap
.
forEach
(
resourceMap:
:
put
);
}
public
StrategySystemReviewTask
getResource
(
String
operation
){
return
resourceMap
.
get
(
operation
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskClose.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Transactional
@Service
(
SystemReviewTask
.
STATUS_CLOSE
)
public
class
StrategySystemReviewTaskClose
implements
StrategySystemReviewTask
{
// CLOSE状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
)
{
SystemReviewTaskViewResponse
response
=
new
SystemReviewTaskViewResponse
();
response
.
setSystemReviewTask
(
systemReviewTask
);
return
response
;
}
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskFinish.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Transactional
@Service
(
SystemReviewTask
.
STATUS_FINISH
)
public
class
StrategySystemReviewTaskFinish
implements
StrategySystemReviewTask
{
// FINISH状态下
// 1.standard字段使用task中归档的问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
)
{
SystemReviewTaskViewResponse
response
=
new
SystemReviewTaskViewResponse
();
response
.
setSystemReviewTask
(
systemReviewTask
);
return
response
;
}
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskNew.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
@Service
(
SystemReviewTask
.
STATUS_NEW
)
public
class
StrategySystemReviewTaskNew
implements
StrategySystemReviewTask
{
@Autowired
private
ReviewStandardService
reviewStandardService
;
// NEW状态下
// 1.standard字段查询当前最新问卷
// 2.不查询场景变更任务
// 3.无需联查问卷答案
@Override
public
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
)
{
// 获取最新问卷
List
<
ReviewStandard
>
standardTree
=
reviewStandardService
.
findTree
();
// 将问卷赋值到任务
systemReviewTask
.
setStandard
(
standardTree
);
// 生成返回结果
SystemReviewTaskViewResponse
response
=
new
SystemReviewTaskViewResponse
();
response
.
setSystemReviewTask
(
systemReviewTask
);
return
response
;
}
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskPending.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.service.ReviewDetailsResultService
;
import
com.ruoyi.service.ReviewSceneChangeTaskService
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.StrategySystemReviewTask
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Transactional
@Service
(
SystemReviewTask
.
STATUS_PENDING
)
public
class
StrategySystemReviewTaskPending
implements
StrategySystemReviewTask
{
@Autowired
private
ReviewStandardService
reviewStandardService
;
@Autowired
private
ReviewDetailsResultService
reviewDetailsResultService
;
@Autowired
private
ReviewSceneChangeTaskService
reviewSceneChangeTaskService
;
// PENDING状态下
// 1.standard字段查询当前最新问卷
// 2.查询场景变更任务
// 3.需要联查问卷答案
@Override
public
SystemReviewTaskViewResponse
doView
(
SystemReviewTask
systemReviewTask
)
{
// 获取最新问卷
List
<
ReviewStandard
>
standardTree
=
reviewStandardService
.
findTree
();
// 获取当前问卷答案
List
<
ReviewDetailsResult
>
results
=
reviewDetailsResultService
.
findByTaskId
(
systemReviewTask
.
getId
());
// 绑定问卷与答案
setDetailsResult
(
standardTree
,
results
);
// 赋值给任务
systemReviewTask
.
setStandard
(
standardTree
);
// 查询场景变更任务便于提醒用户场景变动
List
<
ReviewSceneChangeTask
>
lastChanges
=
reviewSceneChangeTaskService
.
findLastChangeByAfterTime
(
systemReviewTask
.
getTaskBeginTime
());
// 构建返回结果
SystemReviewTaskViewResponse
response
=
new
SystemReviewTaskViewResponse
();
response
.
setSystemReviewTask
(
systemReviewTask
);
response
.
setReviewSceneChangeTasks
(
lastChanges
);
return
response
;
}
private
void
setDetailsResult
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
)
{
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keypoint
:
keyPointList
)
{
List
<
ReviewDetails
>
reviewDetailsList
=
keypoint
.
getReviewDetailsList
();
for
(
ReviewDetails
details
:
reviewDetailsList
)
{
details
.
setResult
(
resultMap
.
get
(
details
.
getId
()));
}
}
}
}
}
quality-review/src/main/java/com/ruoyi/service/impl/SystemReviewTaskServiceImpl.java
View file @
3b05cea6
...
...
@@ -6,12 +6,11 @@ import com.ruoyi.common.core.domain.model.LoginUser;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.mapper.ReviewDetailsResultMapper
;
import
com.ruoyi.mapper.SystemReviewTaskMapper
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.service.SystemReviewTaskUserRelationService
;
import
com.ruoyi.service.*
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -20,8 +19,6 @@ import java.util.*;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
/**
* @author wangfei
* @description 针对表【t_system_review_task(体系审查任务)】的数据库操作Service实现
...
...
@@ -29,104 +26,71 @@ import static java.util.stream.Collectors.toList;
*/
@Transactional
@Service
public
class
SystemReviewTaskServiceImpl
extends
ServiceImpl
<
SystemReviewTaskMapper
,
SystemReviewTask
>
implements
SystemReviewTaskService
{
public
class
SystemReviewTaskServiceImpl
extends
ServiceImpl
<
SystemReviewTaskMapper
,
SystemReviewTask
>
implements
SystemReviewTaskService
{
@Autowired
private
SystemReviewTaskUserRelationService
systemReviewTaskUserRelationService
;
@Autowired
private
ReviewDetailsResultMapper
reviewDetailsResultMapper
;
private
SystemReviewTaskService
systemReviewTaskService
;
@Autowired
private
ReviewStandardService
reviewStandardService
;
@Autowired
private
SystemReviewTaskUserRelationService
systemReviewTaskUserRelation
Service
;
private
ReviewDetailsResultService
reviewDetailsResult
Service
;
@Autowired
private
S
ystemReviewTaskService
systemReviewTaskService
;
private
S
tateSystemReviewTaskContext
stateSystemReviewTaskContext
;
@Autowired
private
ISysUserService
sysUserService
;
@Override
public
void
createTaskTest
(
S
tring
bizInfo
,
List
<
Long
>
userIds
)
{
public
void
createTaskTest
(
S
ystemReviewTaskCreateRequest
request
)
{
// 构建任务创建者
LoginUser
loginUser
=
SecurityUtils
.
getLoginUser
();
SysUser
initiator
=
sysUserService
.
selectUserById
(
loginUser
.
getUserId
());
//
构建任务参与者
Long
leaderId
=
userIds
.
get
(
0
)
;
List
<
Sys
User
>
sysUsers
=
sysUserService
.
selectUserListByIds
(
userIds
);
SysUser
leader
=
null
;
for
(
SysUser
sysUser
:
sysUsers
)
{
if
(
sysUser
.
getUserId
().
equals
(
leaderId
))
{
leader
=
sysUser
;
//
找到审查组长
SystemReviewTaskUserRelation
leader
=
null
;
List
<
Sys
temReviewTaskUserRelation
>
auditors
=
request
.
getAuditors
(
);
for
(
SystemReviewTaskUserRelation
auditor
:
auditors
)
{
if
(
auditor
.
getIsLeader
()
==
1
)
{
leader
=
auditor
;
break
;
}
}
// 构建并保存任务信息
List
<
ReviewStandard
>
allStandardTree
=
reviewStandardService
.
findTree
();
SystemReviewTask
task
=
new
SystemReviewTask
()
.
setNo
(
SnowflakeUtil
.
generate
().
toString
())
.
set
Task
No
(
SnowflakeUtil
.
generate
().
toString
())
.
setTaskInitiator
(
initiator
.
getNickName
())
.
setTaskInitiatorDept
(
initiator
.
getDept
().
getDeptName
())
.
setTaskStatus
(
"NEW"
)
.
setBizInfo
(
bizInfo
)
.
setLeaderId
(
leaderId
)
.
setLeader
(
leader
.
getNickName
())
.
setCreateTime
(
new
Date
())
.
setStandard
(
allStandardTree
);
.
setTaskStatus
(
SystemReviewTask
.
STATUS_NEW
)
.
setBizInfo
(
request
.
getBizInfo
())
.
setLeaderId
(
leader
.
getUserId
())
.
setLeader
(
leader
.
getName
())
.
setCreateTime
(
new
Date
());
systemReviewTaskService
.
save
(
task
);
// 构建并保存该任务所关联的审核组信息
List
<
SystemReviewTaskUserRelation
>
relations
=
new
ArrayList
();
for
(
SysUser
sysUser
:
sysUsers
)
{
SystemReviewTaskUserRelation
relation
=
new
SystemReviewTaskUserRelation
()
.
setTaskId
(
task
.
getId
())
.
setUserId
(
sysUser
.
getUserId
())
.
setName
(
sysUser
.
getNickName
())
.
setIsLeader
(
sysUser
.
getUserId
().
equals
(
leaderId
)
?
1
:
0
);
relations
.
add
(
relation
);
for
(
SystemReviewTaskUserRelation
auditor
:
auditors
)
{
auditor
.
setTaskId
(
task
.
getId
());
}
systemReviewTaskUserRelationService
.
saveBatch
(
relations
);
systemReviewTaskUserRelationService
.
saveBatch
(
auditors
);
}
@Override
public
SystemReviewTask
loadTaskById
(
Long
id
)
{
// 根据id获取体系审查任务
SystemReviewTask
task
=
getById
(
id
);
// 构建该任务的问卷与答案
List
<
ReviewStandard
>
standard
=
task
.
getStandard
();
List
<
ReviewDetailsResult
>
results
=
reviewDetailsResultMapper
.
findByTaskNo
(
task
.
getNo
());
setDetailsResult
(
standard
,
results
);
// 返回任务
return
task
;
public
SystemReviewTaskViewResponse
view
(
Long
taskId
)
{
SystemReviewTask
systemReviewTask
=
systemReviewTaskService
.
getById
(
taskId
);
return
stateSystemReviewTaskContext
.
getResource
(
systemReviewTask
.
getTaskStatus
()).
doView
(
systemReviewTask
);
}
private
void
setDetailsResult
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
)
{
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keypoint
:
keyPointList
)
{
List
<
ReviewDetails
>
reviewDetailsList
=
keypoint
.
getReviewDetailsList
();
for
(
ReviewDetails
details
:
reviewDetailsList
)
{
details
.
setResult
(
resultMap
.
get
(
details
.
getId
()));
}
}
}
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/SystemReviewTaskController.java
View file @
3b05cea6
...
...
@@ -5,7 +5,9 @@ import com.ruoyi.common.core.controller.BaseController;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
com.ruoyi.web.request.CreateSystemReviewTaskRequest
;
import
com.ruoyi.web.request.SystemReviewTaskCreateRequest
;
import
com.ruoyi.web.request.SystemReviewTaskViewRequest
;
import
com.ruoyi.web.response.SystemReviewTaskViewResponse
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
import
org.apache.skywalking.apm.toolkit.trace.Tags
;
import
org.apache.skywalking.apm.toolkit.trace.Trace
;
...
...
@@ -27,9 +29,17 @@ public class SystemReviewTaskController extends BaseController {
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@Log
(
title
=
"体系审查任务"
,
businessType
=
BusinessType
.
INSERT
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/create"
)
public
AjaxResult
create
(
@Validated
@RequestBody
CreateSystemReviewTask
Request
request
)
{
systemReviewTaskService
.
createTaskTest
(
request
.
getBizInfo
(),
request
.
getUserIds
()
);
public
AjaxResult
create
(
@Validated
@RequestBody
SystemReviewTaskCreate
Request
request
)
{
systemReviewTaskService
.
createTaskTest
(
request
);
return
success
();
}
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/view"
)
public
AjaxResult
view
(
@Validated
@RequestBody
SystemReviewTaskViewRequest
request
)
{
SystemReviewTaskViewResponse
systemReviewTaskViewResponse
=
systemReviewTaskService
.
view
(
request
.
getTaskId
());
return
AjaxResult
.
success
(
systemReviewTaskViewResponse
);
}
}
quality-review/src/main/java/com/ruoyi/web/request/
CreateSystemReviewTask
Request.java
→
quality-review/src/main/java/com/ruoyi/web/request/
SystemReviewTaskCreate
Request.java
View file @
3b05cea6
package
com
.
ruoyi
.
web
.
request
;
import
com.ruoyi.domain.SystemReviewTaskUserRelation
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
CreateSystemReviewTask
Request
{
public
class
SystemReviewTaskCreate
Request
{
private
String
bizInfo
;
private
List
<
Long
>
userId
s
;
private
List
<
SystemReviewTaskUserRelation
>
auditor
s
;
}
quality-review/src/main/java/com/ruoyi/web/request/SystemReviewTaskViewRequest.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
web
.
request
;
import
lombok.Data
;
@Data
public
class
SystemReviewTaskViewRequest
{
private
Long
taskId
;
}
quality-review/src/main/java/com/ruoyi/web/response/SystemReviewTaskViewResponse.java
0 → 100644
View file @
3b05cea6
package
com
.
ruoyi
.
web
.
response
;
import
com.ruoyi.domain.ReviewSceneChangeTask
;
import
com.ruoyi.domain.SystemReviewTask
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SystemReviewTaskViewResponse
{
/**
* 任务信息
*/
private
SystemReviewTask
systemReviewTask
;
/**
* 任务开始后的场景变更信息
*/
private
List
<
ReviewSceneChangeTask
>
reviewSceneChangeTasks
;
}
quality-review/src/main/resources/mapper/ReviewDetailsResultMapper.xml
View file @
3b05cea6
...
...
@@ -9,7 +9,7 @@
<result
property=
"passed"
column=
"passed"
jdbcType=
"TINYINT"
/>
<result
property=
"sceneId"
column=
"scene_id"
jdbcType=
"BIGINT"
/>
<result
property=
"scene"
column=
"scene"
jdbcType=
"VARCHAR"
/>
<result
property=
"images
url"
column=
"imagesU
rl"
jdbcType=
"VARCHAR"
/>
<result
property=
"images
Url"
column=
"images_u
rl"
jdbcType=
"VARCHAR"
/>
<result
property=
"reviewDetailsId"
column=
"review_details_id"
jdbcType=
"BIGINT"
/>
<result
property=
"taskId"
column=
"task_id"
jdbcType=
"BIGINT"
/>
</resultMap>
...
...
@@ -19,7 +19,7 @@
scene,imagesUrl,review_details_id,
task_no
</sql>
<select
id=
"findByTask
No
"
resultType=
"com.ruoyi.domain.ReviewDetailsResult"
>
SELECT id, passed, scene_id, scene, images
Url, review_details_id, task_no FROM t_review_details_result WHERE task_no = #{taskNo
}
<select
id=
"findByTask
Id
"
resultType=
"com.ruoyi.domain.ReviewDetailsResult"
>
SELECT id, passed, scene_id, scene, images
_url, review_details_id, task_id FROM t_review_details_result WHERE task_id = #{taskId
}
</select>
</mapper>
quality-review/src/main/resources/mapper/ReviewSceneChangeTaskMapper.xml
View file @
3b05cea6
...
...
@@ -22,4 +22,11 @@
<result
property=
"taskEndTime"
column=
"task_end_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<select
id=
"findLastChangeByAfterTime"
resultType=
"com.ruoyi.domain.ReviewSceneChangeTask"
>
SELECT * FROM t_review_scene_change_task WHERE id IN
(
SELECT MAX(id) FROM t_review_scene_change_task WHERE task_status = 'FINISH' AND task_result = 'PASS' AND task_end_time >= #{date} GROUP BY review_scene_id
)
</select>
</mapper>
quality-review/src/main/resources/mapper/SystemReviewTaskMapper.xml
View file @
3b05cea6
...
...
@@ -10,7 +10,6 @@
<result
property=
"taskStatus"
column=
"task_status"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskInitiator"
column=
"task_initiator"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskInitiatorDept"
column=
"task_initiator_dept"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskInitiatorOrg"
column=
"task_initiator_org"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskResult"
column=
"task_result"
jdbcType=
"VARCHAR"
/>
<result
property=
"taskBeginTime"
column=
"task_begin_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"taskEndTime"
column=
"task_end_time"
jdbcType=
"TIMESTAMP"
/>
...
...
ruoyi-admin/src/test/java/com/ruoyi/SystemReviewTaskTest.java
View file @
3b05cea6
package
com
.
ruoyi
;
import
cn.hutool.json.JSONUtil
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.service.SystemReviewTaskService
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
public
class
SystemReviewTaskTest
{
@Autowired
private
SystemReviewTaskService
systemReviewTaskService
;
@Test
public
void
loadTaskByIdTest
()
{
Long
id
=
1735530241750740994L
;
SystemReviewTask
task
=
systemReviewTaskService
.
loadTaskById
(
id
);
System
.
out
.
println
(
JSONUtil
.
toJsonPrettyStr
(
task
));
}
@Test
public
void
testOSSUrl
()
{
String
bucket
=
"vehicle-quality-review-oss"
;
...
...
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