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
0e9bb189
Commit
0e9bb189
authored
Mar 20, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询进行中的任务
parent
329111dc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
20 deletions
+133
-20
CarReviewTaskMapper.java
...w/src/main/java/com/ruoyi/mapper/CarReviewTaskMapper.java
+3
-0
ReviewDetailsMapper.java
...w/src/main/java/com/ruoyi/mapper/ReviewDetailsMapper.java
+7
-0
SystemReviewTaskMapper.java
...rc/main/java/com/ruoyi/mapper/SystemReviewTaskMapper.java
+3
-0
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+64
-20
CarReviewTaskMapper.xml
...-review/src/main/resources/mapper/CarReviewTaskMapper.xml
+8
-0
ReviewDetailsMapper.xml
...-review/src/main/resources/mapper/ReviewDetailsMapper.xml
+40
-0
SystemReviewTaskMapper.xml
...view/src/main/resources/mapper/SystemReviewTaskMapper.xml
+8
-0
No files found.
quality-review/src/main/java/com/ruoyi/mapper/CarReviewTaskMapper.java
View file @
0e9bb189
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import
com.ruoyi.domain.CarReviewTask
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -21,6 +22,8 @@ public interface CarReviewTaskMapper extends BaseMapper<CarReviewTask> {
List
<
CarReviewTask
>
findListByTaskStatus
(
@Param
(
"taskStatus"
)
String
taskStatus
);
List
<
CarReviewTask
>
findByDetailsResult
(
@Param
(
"detailId"
)
Long
detailId
);
List
<
CarReviewTask
>
findByTaskList
(
@Param
(
"responses"
)
List
<
TaskFindResponse
>
responses
);
}
...
...
quality-review/src/main/java/com/ruoyi/mapper/ReviewDetailsMapper.java
View file @
0e9bb189
package
com
.
ruoyi
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.CarReviewTask
;
import
com.ruoyi.domain.ReviewDetails
;
import
com.ruoyi.domain.ReviewKeyPoint
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.web.request.ReviewFindListRequest
;
import
com.ruoyi.web.response.ResultCountResponse
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -22,6 +25,10 @@ public interface ReviewDetailsMapper extends BaseMapper<ReviewDetails> {
Double
count
(
@Param
(
"taskId"
)
Long
taskId
,
@Param
(
"type"
)
String
type
);
List
<
ResultCountResponse
>
systemAnswerCount
(
@Param
(
"systemReviewTaskList"
)
List
<
SystemReviewTask
>
systemReviewTaskList
,
@Param
(
"type"
)
String
type
);
List
<
ResultCountResponse
>
carAnswerCount
(
@Param
(
"carReviewTaskList"
)
List
<
CarReviewTask
>
carReviewTaskList
,
@Param
(
"type"
)
String
type
);
// 根据要点id查询细则列表
List
<
ReviewDetails
>
findByKeyPointId
(
@Param
(
"keyPointId"
)
Long
keyPointId
);
...
...
quality-review/src/main/java/com/ruoyi/mapper/SystemReviewTaskMapper.java
View file @
0e9bb189
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.SystemReviewTask
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -15,4 +16,6 @@ public interface SystemReviewTaskMapper extends BaseMapper<SystemReviewTask> {
List
<
SystemReviewTask
>
findListInProcess
();
List
<
SystemReviewTask
>
findByDetailsResult
(
@Param
(
"detailId"
)
Long
detailId
);
List
<
SystemReviewTask
>
findByTaskList
(
@Param
(
"responses"
)
List
<
TaskFindResponse
>
responses
);
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
0e9bb189
...
...
@@ -184,32 +184,76 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Override
public
List
<
TaskFindResponse
>
findPending
(
TaskFindPendingRequest
request
,
Long
userId
)
{
List
<
TaskFindResponse
>
responses
=
taskMapper
.
findPending
(
request
,
userId
);
for
(
TaskFindResponse
response
:
responses
)
{
if
(
response
.
getSystemReviewTaskId
()
!=
null
)
{
SystemReviewTask
systemReviewTask
=
systemReviewTaskMapper
.
selectById
(
response
.
getSystemReviewTaskId
());
if
(
Objects
.
equals
(
systemReviewTask
.
getTaskStatus
(),
SystemReviewTask
.
STATUS_FINISH
))
{
response
.
setSystemReview
(
100.0
);
}
else
{
BigDecimal
num
=
new
BigDecimal
(((
double
)
reviewDetailsMapper
.
count
(
response
.
getSystemReviewTaskId
(),
SystemReviewTask
.
TYPE
))*
100
*
0.9
);
response
.
setSystemReview
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
if
(
responses
!=
null
&&
responses
.
size
()
!=
0
)
{
// 体系审查子任务列表
List
<
SystemReviewTask
>
systemReviewTaskList
=
systemReviewTaskMapper
.
findByTaskList
(
responses
);
if
(
systemReviewTaskList
!=
null
&&
systemReviewTaskList
.
size
()
!=
0
)
{
// 子任务列表进度
List
<
ResultCountResponse
>
responseLists
=
reviewDetailsMapper
.
systemAnswerCount
(
systemReviewTaskList
,
SystemReviewTask
.
TYPE
);
if
(
responseLists
!=
null
&&
responseLists
.
size
()
!=
0
)
{
// 设置子任务不为finish时,最大进度为90
for
(
ResultCountResponse
response
:
responseLists
)
{
if
(
Objects
.
equals
(
response
.
getTaskStatus
(),
SystemReviewTask
.
STATUS_FINISH
))
{
response
.
setSchedule
(
100.0
);
}
else
{
BigDecimal
num
=
new
BigDecimal
(
response
.
getSchedule
());
response
.
setSchedule
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
}
}
for
(
ResultCountResponse
responseList
:
responseLists
)
{
for
(
TaskFindResponse
response
:
responses
)
{
if
(
responseList
.
getTaskId
().
equals
(
response
.
getSystemReviewTaskId
()))
{
response
.
setSystemReview
(
responseList
.
getSchedule
());
}
}
}
}
}
if
(
response
.
getCarReviewTaskId
()
!=
null
)
{
CarReviewTask
carReviewTask
=
carReviewTaskMapper
.
selectById
(
response
.
getCarReviewTaskId
());
if
(
Objects
.
equals
(
carReviewTask
.
getTaskStatus
(),
CarReviewTask
.
TASK_STATUS_FINISH
))
{
response
.
setCarReview
(
100.0
);
}
else
{
BigDecimal
num
=
new
BigDecimal
(((
double
)
reviewDetailsMapper
.
count
(
response
.
getCarReviewTaskId
(),
CarReviewTask
.
TYPE
))
*
100
*
0.9
);
response
.
setCarReview
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
// 车型问卷子任务列表
List
<
CarReviewTask
>
carReviewTaskList
=
carReviewTaskMapper
.
findByTaskList
(
responses
);
if
(
carReviewTaskList
!=
null
&&
carReviewTaskList
.
size
()
!=
0
)
{
// 子任务列表进度
List
<
ResultCountResponse
>
carResponseList
=
reviewDetailsMapper
.
carAnswerCount
(
carReviewTaskList
,
CarReviewTask
.
TYPE
);
if
(
carResponseList
!=
null
&&
carResponseList
.
size
()
!=
0
)
{
// 设置子任务不为finish时,最大进度为90
for
(
ResultCountResponse
response
:
carResponseList
)
{
if
(
Objects
.
equals
(
response
.
getTaskStatus
(),
CarReviewTask
.
TASK_STATUS_FINISH
))
{
response
.
setSchedule
(
100.0
);
}
else
{
BigDecimal
num
=
new
BigDecimal
(
response
.
getSchedule
());
response
.
setSchedule
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
}
}
for
(
ResultCountResponse
responseList
:
carResponseList
)
{
for
(
TaskFindResponse
response
:
responses
)
{
if
(
responseList
.
getTaskId
().
equals
(
response
.
getCarReviewTaskId
()))
{
response
.
setCarReview
(
responseList
.
getSchedule
());
}
}
}
}
}
String
[]
taskList
=
response
.
getTaskList
().
split
(
","
);
if
(
response
.
getPointer
()
<
taskList
.
length
)
{
response
.
setNextSubTask
(
taskList
[
response
.
getPointer
()]);
}
else
{
response
.
setNextSubTask
(
taskList
[
taskList
.
length
-
1
]);
for
(
TaskFindResponse
response
:
responses
)
{
String
[]
taskList
=
response
.
getTaskList
().
split
(
","
);
if
(
response
.
getPointer
()
<
taskList
.
length
)
{
response
.
setNextSubTask
(
taskList
[
response
.
getPointer
()]);
}
else
{
response
.
setNextSubTask
(
taskList
[
taskList
.
length
-
1
]);
}
}
}
return
responses
;
}
...
...
quality-review/src/main/resources/mapper/CarReviewTaskMapper.xml
View file @
0e9bb189
...
...
@@ -56,4 +56,12 @@
LEFT JOIN t_review_details_result trdr ON tr.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and tr.task_status = 'PENDING'
</select>
<select
id=
"findByTaskList"
resultType=
"com.ruoyi.domain.CarReviewTask"
>
SELECT id,task_no,task_status,task_initiator,task_initiator_dept,task_result,task_begin_time,task_end_time,standard,create_time,leader_id,leader,standard_id,name,standard_no,file,submit_id,submit_name,images_url,details,standards
FROM t_car_review_task
WHERE id IN
<foreach
collection=
"responses"
item=
"task"
open=
"("
separator=
","
close=
")"
>
#{task.carReviewTaskId}
</foreach>
</select>
</mapper>
quality-review/src/main/resources/mapper/ReviewDetailsMapper.xml
View file @
0e9bb189
...
...
@@ -30,6 +30,46 @@
INNER JOIN t_review_standard trs ON trs.id = trk.review_standard_id
WHERE trs.type = #{type}), 1) AS resultOverSum
</select>
<select
id=
"systemAnswerCount"
resultType=
"com.ruoyi.web.response.ResultCountResponse"
>
<foreach
item=
"task"
collection=
"systemReviewTaskList"
separator=
"UNION ALL"
>
SELECT
#{task.id} AS taskId,
(IFNULL(
(SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{task.id}),
0
) /
IFNULL(
(SELECT COUNT(*) FROM t_review_details trd
INNER JOIN t_review_keypoint trk ON trk.id = trd.review_keypoint_id
INNER JOIN t_review_standard trs ON trs.id = trk.review_standard_id
WHERE trs.type = #{type}),
1
)) * 90 AS schedule,
ts.task_status AS taskStatus
from t_system_review_task ts where ts.id = #{task.id}
</foreach>
group by taskId
</select>
<select
id=
"carAnswerCount"
resultType=
"com.ruoyi.web.response.ResultCountResponse"
>
<foreach
item=
"task"
collection=
"carReviewTaskList"
separator=
"UNION ALL"
>
SELECT
#{task.id} AS taskId,
(IFNULL(
(SELECT COUNT(*) FROM t_review_details_result WHERE task_id = #{task.id}),
0
) /
IFNULL(
(SELECT COUNT(*) FROM t_review_details trd
INNER JOIN t_review_keypoint trk ON trk.id = trd.review_keypoint_id
INNER JOIN t_review_standard trs ON trs.id = trk.review_standard_id
WHERE trs.type = #{type}),
1
)) * 90 AS schedule,
tc.task_status AS taskStatus
from t_car_review_task tc where tc.id = #{task.id}
</foreach>
group by taskId
</select>
<select
id=
"findByKeyPointId"
resultType=
"com.ruoyi.domain.ReviewDetails"
>
SELECT id, text, review_keypoint_id FROM t_review_details
WHERE review_keypoint_id = #{keyPointId}
...
...
quality-review/src/main/resources/mapper/SystemReviewTaskMapper.xml
View file @
0e9bb189
...
...
@@ -48,5 +48,13 @@
LEFT JOIN t_review_details_result trdr ON ts.id = trdr.task_id
WHERE trdr.review_details_id = #{detailId} and ts.task_status = 'PENDING'
</select>
<select
id=
"findByTaskList"
resultType=
"com.ruoyi.domain.SystemReviewTask"
>
SELECT id, task_no, task_status, task_initiator, task_initiator_dept, task_result, task_begin_time, task_end_time, standard, create_time,leader,leader_id, standard_id, name, standard_no, file, submit_by_id, submit_by_name,images_url,details,standards
FROM t_system_review_task
WHERE id IN
<foreach
collection=
"responses"
item=
"task"
open=
"("
separator=
","
close=
")"
>
#{task.systemReviewTaskId}
</foreach>
</select>
</mapper>
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