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
344003a9
Commit
344003a9
authored
Mar 04, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看问卷统计数据
parent
e3eea603
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
101 deletions
+138
-101
CarReviewTask.java
...-review/src/main/java/com/ruoyi/domain/CarReviewTask.java
+2
-2
ReviewStandard.java
...review/src/main/java/com/ruoyi/domain/ReviewStandard.java
+6
-0
SystemReviewTask.java
...view/src/main/java/com/ruoyi/domain/SystemReviewTask.java
+20
-0
StrategyCarReviewTaskPending.java
.../com/ruoyi/service/impl/StrategyCarReviewTaskPending.java
+17
-77
StrategySystemReviewTaskPending.java
...m/ruoyi/service/impl/StrategySystemReviewTaskPending.java
+93
-22
No files found.
quality-review/src/main/java/com/ruoyi/domain/CarReviewTask.java
View file @
344003a9
...
...
@@ -159,7 +159,7 @@ public class CarReviewTask implements Serializable {
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"审查细则符合率"
)
private
Long
detailsPass
;
private
Double
detailsPass
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"标准条款(条)"
)
...
...
@@ -167,7 +167,7 @@ public class CarReviewTask implements Serializable {
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"标准条款通过率"
)
private
Long
standardsPass
;
private
Double
standardsPass
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"参与审查人数(人)"
)
...
...
quality-review/src/main/java/com/ruoyi/domain/ReviewStandard.java
View file @
344003a9
...
...
@@ -30,6 +30,12 @@ public class ReviewStandard {
public
static
final
String
TYPE_CAR
=
"car"
;
// 车型审查类型
public
static
final
String
TYPE_TEST
=
"test"
;
// 车型试验类型
// 标准通过
public
static
final
Integer
PASSED
=
1
;
// 标准不通过
public
static
final
Integer
NO_PASSED
=
0
;
/**
* 主键
*/
...
...
quality-review/src/main/java/com/ruoyi/domain/SystemReviewTask.java
View file @
344003a9
...
...
@@ -157,4 +157,24 @@ public class SystemReviewTask {
@ApiModelProperty
(
"签名图片地址"
)
private
String
imagesUrl
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"审查细则(条)"
)
private
Integer
details
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"审查细则符合率"
)
private
Double
detailsPass
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"标准条款(条)"
)
private
Integer
standards
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"标准条款通过率"
)
private
Double
standardsPass
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
"参与审查人数(人)"
)
private
Integer
person
;
}
quality-review/src/main/java/com/ruoyi/service/impl/StrategyCarReviewTaskPending.java
View file @
344003a9
...
...
@@ -16,10 +16,7 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -86,30 +83,6 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
// 获取最新问卷
List
<
ReviewStandard
>
standardTree
=
reviewStandardService
.
findTree
(
carReviewTask
.
getStandardId
(),
ReviewStandard
.
TYPE_CAR
);
List
<
ReviewStandard
>
reviewStandardList
=
reviewStandardMapper
.
findListByStandardIdAndType
(
carReviewTask
.
getStandardId
(),
ReviewStandard
.
TYPE_CAR
);
// 查询审查标准
List
<
ReviewKeyPoint
>
reviewKeyPointList
=
reviewKeyPointService
.
findByStandardList
(
reviewStandardList
);
// 查询审查要点
List
<
ReviewDetails
>
reivewDetailsList
=
reviewDetailsService
.
findByKeyPointsList
(
reviewKeyPointList
);
// 查询审查细则
// for(ReviewStandard standard : standardTree) {
// standard.setPassed(0);
// standardsNum ++;
// List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
//
// for(ReviewKeyPoint keypoint : keyPointList) {
// List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
//
// for(ReviewDetails details : reviewDetailsList) {
// detailsNum ++;
// ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
// if(reviewDetailsResult != null && reviewDetailsResult.getPassed() != 0) {
// standard.setPassed(reviewDetailsResult.getPassed());
// standardsPassNum ++;
// detailsPassNum ++;
// }
// }
// }
// }
// 获取当前问卷答案
List
<
ReviewDetailsResult
>
results
=
reviewDetailsResultService
.
findByTaskId
(
carReviewTask
.
getId
());
...
...
@@ -192,56 +165,12 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
// //审查细则(条)
// int detailsNum = 0;
//
// //审查细则符合数
// int detailsPassNum = 0;
//
// //标准条款(条)
// int standardsNum = 0;
//
// //标准条款通过数
// int standardsPassNum = 0;
//
// for(ReviewStandard standard : standards) {
// standard.setPassed(1);
// standardsNum ++;
// List<ReviewKeyPoint> keyPointList = standard.getKeyPointList();
//
// for(ReviewKeyPoint keypoint : keyPointList) {
// List<ReviewDetails> reviewDetailsList = keypoint.getReviewDetailsList();
//
// for(ReviewDetails details : reviewDetailsList) {
// detailsNum ++;
// ReviewDetailsResult reviewDetailsResult = resultMap.get(details.getId());
// if(reviewDetailsResult == null || reviewDetailsResult.getPassed() == 0) {
// standard.setPassed(reviewDetailsResult.getPassed());
// detailsPassNum ++;
// standardsPassNum ++;
//
// }
// if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
// ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
// reviewDetailsResult.setEnterpriseName(reviewEnterpriseArchive.getEnterpriseName());
// }
// details.setResult(reviewDetailsResult);
// }
// }
// }
List
<
TaskUserRelation
>
relationList
=
taskUserRelationMapper
.
selectQTeamMembers
(
taskMapper
.
findByCarReviewTaskId
(
carReviewTask
.
getId
()));
// carReviewTask.setDetails(detailsNum);
// carReviewTask.setDetailsPass(((long)detailsPassNum/(long)detailsNum));
// carReviewTask.setStandards(standardsNum);
// carReviewTask.setStandardsPass(((long)standardsPassNum/(long)standardsNum));
carReviewTask
.
setStandards
(
calculateStandards
(
standards
));
carReviewTask
.
setStandardsPass
(
calculateStandardsPass
(
standards
,
resultMap
)
/
(
long
)
carReviewTask
.
getStandards
());
carReviewTask
.
setStandardsPass
(
calculateStandardsPass
(
standards
,
resultMap
)
/
(
double
)
carReviewTask
.
getStandards
());
carReviewTask
.
setDetails
(
calculateDetails
(
standards
));
carReviewTask
.
setDetailsPass
((
calculateDetailsPass
(
standards
,
resultMap
)
/
(
long
)
carReviewTask
.
getDetails
()));
carReviewTask
.
setDetailsPass
((
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
carReviewTask
.
getDetails
()));
carReviewTask
.
setPerson
(
relationList
.
size
());
}
...
...
@@ -257,11 +186,17 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
))
{
standardsPass
=
standardsPass
+
1
;
if
(
!
detailsIsPass
(
reviewDetails
,
resultMap
))
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsPass
=
standardsPass
+
1
;
}
}
return
standardsPass
;
...
...
@@ -315,7 +250,12 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
private
boolean
detailsIsPass
(
ReviewDetails
reviewDetails
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
ReviewDetailsResult
result
=
resultMap
.
get
(
reviewDetails
.
getId
());
return
result
.
getPassed
()
==
1
;
if
(
result
!=
null
)
{
return
Objects
.
equals
(
result
.
getPassed
(),
ReviewStandard
.
PASSED
);
}
else
{
return
false
;
}
}
@Override
...
...
quality-review/src/main/java/com/ruoyi/service/impl/StrategySystemReviewTaskPending.java
View file @
344003a9
...
...
@@ -14,9 +14,7 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -62,6 +60,9 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
@Autowired
private
ReviewEnterpriseArchiveMapper
reviewEnterpriseArchiveMapper
;
@Autowired
private
TaskUserRelationMapper
taskUserRelationMapper
;
@Override
public
void
doStart
(
SystemReviewTask
systemReviewTask
)
{
throw
new
ServiceException
(
"不能开始一个已经开始的任务"
,
HttpStatus
.
ERROR
);
...
...
@@ -95,7 +96,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List
<
ReviewDetailsResult
>
results
=
reviewDetailsResultService
.
findByTaskId
(
systemReviewTask
.
getId
());
// 3. 将最终问卷归档到 standard 字段
setDetailsResult
(
standardTree
,
results
);
setDetailsResult
(
standardTree
,
results
,
systemReviewTask
);
systemReviewTask
.
setStandard
(
standardTree
);
...
...
@@ -139,7 +140,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
}
// 绑定问卷与答案
setDetailsResult
(
standardTree
,
results
);
setDetailsResult
(
standardTree
,
results
,
systemReviewTask
);
// 赋值给任务
systemReviewTask
.
setStandard
(
standardTree
);
...
...
@@ -155,30 +156,100 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
return
response
;
}
private
void
setDetailsResult
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
)
{
private
void
setDetailsResult
(
List
<
ReviewStandard
>
standards
,
List
<
ReviewDetailsResult
>
results
,
SystemReviewTask
systemReviewTask
)
{
Map
<
Long
,
ReviewDetailsResult
>
resultMap
=
results
.
stream
().
collect
(
Collectors
.
toMap
(
ReviewDetailsResult:
:
getReviewDetailsId
,
Function
.
identity
(),
(
v1
,
v2
)
->
v1
));
List
<
TaskUserRelation
>
relationList
=
taskUserRelationMapper
.
selectQTeamMembers
(
taskMapper
.
findByCarReviewTaskId
(
systemReviewTask
.
getId
()));
systemReviewTask
.
setStandards
(
calculateStandards
(
standards
));
systemReviewTask
.
setStandardsPass
(
calculateStandardsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getStandards
());
systemReviewTask
.
setDetails
(
calculateDetails
(
standards
));
systemReviewTask
.
setDetailsPass
((
calculateDetailsPass
(
standards
,
resultMap
)
/
(
double
)
systemReviewTask
.
getDetails
()));
systemReviewTask
.
setPerson
(
relationList
.
size
());
}
private
int
calculateStandards
(
List
<
ReviewStandard
>
standards
)
{
return
standards
.
size
();
}
private
long
calculateStandardsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
standardsPass
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
boolean
isPass
=
true
;
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(!
detailsIsPass
(
reviewDetails
,
resultMap
))
{
isPass
=
false
;
}
}
if
(
isPass
)
{
standardsPass
=
standardsPass
+
1
;
}
}
return
standardsPass
;
}
private
int
calculateDetails
(
List
<
ReviewStandard
>
standards
)
{
//审查细则(条)
int
detailsNum
=
0
;
for
(
ReviewStandard
standard
:
standards
)
{
standard
.
setPassed
(
1
);
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keypoint
:
keyPointList
)
{
List
<
ReviewDetails
>
reviewDetailsList
=
keypoint
.
getReviewDetailsList
();
for
(
ReviewDetails
details
:
reviewDetailsList
)
{
ReviewDetailsResult
reviewDetailsResult
=
resultMap
.
get
(
details
.
getId
());
if
(
reviewDetailsResult
==
null
||
reviewDetailsResult
.
getPassed
()
==
0
)
{
standard
.
setPassed
(
0
);
}
if
(
reviewDetailsResult
!=
null
&&
reviewDetailsResult
.
getReviewEnterpriseArchiveId
()
!=
null
)
{
ReviewEnterpriseArchive
reviewEnterpriseArchive
=
reviewEnterpriseArchiveMapper
.
selectById
(
reviewDetailsResult
.
getReviewEnterpriseArchiveId
());
reviewDetailsResult
.
setEnterpriseName
(
reviewEnterpriseArchive
.
getEnterpriseName
());
}
details
.
setResult
(
reviewDetailsResult
);
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
detailsNum
=
detailsNum
+
details
.
size
();
}
return
detailsNum
;
}
private
long
calculateDetailsPass
(
List
<
ReviewStandard
>
standards
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
long
detailsPass
=
0L
;
for
(
ReviewStandard
standard
:
standards
)
{
List
<
ReviewDetails
>
details
=
getDetailsByStandard
(
standard
);
for
(
ReviewDetails
reviewDetails
:
details
)
{
if
(
detailsIsPass
(
reviewDetails
,
resultMap
))
{
detailsPass
=
detailsPass
+
1
;
}
}
}
return
detailsPass
;
}
private
List
<
ReviewDetails
>
getDetailsByStandard
(
ReviewStandard
standard
)
{
List
<
ReviewDetails
>
details
=
new
ArrayList
();
List
<
ReviewKeyPoint
>
keyPointList
=
standard
.
getKeyPointList
();
for
(
ReviewKeyPoint
keyPoint
:
keyPointList
)
{
details
.
addAll
(
keyPoint
.
getReviewDetailsList
());
}
return
details
;
}
private
boolean
detailsIsPass
(
ReviewDetails
reviewDetails
,
Map
<
Long
,
ReviewDetailsResult
>
resultMap
)
{
ReviewDetailsResult
result
=
resultMap
.
get
(
reviewDetails
.
getId
());
if
(
result
!=
null
)
{
return
Objects
.
equals
(
result
.
getPassed
(),
ReviewStandard
.
PASSED
);
}
else
{
return
false
;
}
}
@Override
...
...
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