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
3e0ec55f
Commit
3e0ec55f
authored
Apr 03, 2024
by
wdy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务小组成员名称、部门获取
parent
860c2515
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
154 additions
and
18 deletions
+154
-18
TaskMapper.java
...ity-review/src/main/java/com/ruoyi/mapper/TaskMapper.java
+10
-0
TestRecordsMapper.java
...iew/src/main/java/com/ruoyi/mapper/TestRecordsMapper.java
+2
-0
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+83
-18
UserNameResponse.java
...rc/main/java/com/ruoyi/web/response/UserNameResponse.java
+25
-0
TaskMapper.xml
quality-review/src/main/resources/mapper/TaskMapper.xml
+29
-0
TestRecordsMapper.xml
...ty-review/src/main/resources/mapper/TestRecordsMapper.xml
+5
-0
No files found.
quality-review/src/main/java/com/ruoyi/mapper/TaskMapper.java
View file @
3e0ec55f
...
...
@@ -2,6 +2,7 @@ package com.ruoyi.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.ruoyi.domain.Task
;
import
com.ruoyi.domain.TaskUserRelation
;
import
com.ruoyi.domain.vo.EnterpriseFilePdfVO
;
import
com.ruoyi.domain.vo.InspectionReportPdfVO
;
import
com.ruoyi.web.request.TaskFindFinishRequest
;
...
...
@@ -10,6 +11,7 @@ import com.ruoyi.web.request.TaskFindRequest;
import
com.ruoyi.web.request.TaskListRequest
;
import
com.ruoyi.web.response.TaskFindResponse
;
import
com.ruoyi.web.response.TaskScenarioResponse
;
import
com.ruoyi.web.response.UserNameResponse
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -56,4 +58,12 @@ public interface TaskMapper extends BaseMapper<Task> {
// 根据任务列表查询对应的场景数量
List
<
TaskScenarioResponse
>
findByTaskList
(
@Param
(
"responses"
)
List
<
TaskFindResponse
>
responses
);
// 任务列表查询小组成员名称、部门
List
<
UserNameResponse
>
findByUserIdList
(
@Param
(
"responses"
)
List
<
TaskFindResponse
>
responses
);
// 任务小组关系列表查询小组成员名称、部门
List
<
UserNameResponse
>
findByRelation
(
@Param
(
"relation"
)
List
<
TaskUserRelation
>
relation
);
List
<
UserNameResponse
>
findByFinishTaskList
(
@Param
(
"taskList"
)
List
<
Task
>
taskList
);
}
quality-review/src/main/java/com/ruoyi/mapper/TestRecordsMapper.java
View file @
3e0ec55f
...
...
@@ -11,4 +11,6 @@ import java.util.List;
public
interface
TestRecordsMapper
extends
BaseMapper
<
TestRecords
>
{
List
<
TestRecords
>
findByTaskId
(
@Param
(
"id"
)
String
id
);
Long
countResult
(
@Param
(
"projectId"
)
String
projectId
);
}
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
3e0ec55f
...
...
@@ -220,6 +220,10 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
List
<
TaskFindResponse
>
responses
=
taskMapper
.
findPending
(
request
,
userId
);
if
(
responses
!=
null
&&
responses
.
size
()
!=
0
)
{
// 小组成员
List
<
UserNameResponse
>
userList
=
taskMapper
.
findByUserIdList
(
responses
);
setLeader
(
userList
,
responses
);
// 体系审查子任务列表
List
<
SystemReviewTask
>
systemReviewTaskList
=
systemReviewTaskMapper
.
findByTaskList
(
responses
);
setSystemProgress
(
systemReviewTaskList
,
responses
);
...
...
@@ -253,7 +257,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Override
public
List
<
Task
>
findFinish
(
TaskFindFinishRequest
request
)
{
return
taskMapper
.
findFinish
(
request
);
List
<
Task
>
taskList
=
taskMapper
.
findFinish
(
request
);
List
<
UserNameResponse
>
responseList
=
taskMapper
.
findByFinishTaskList
(
taskList
);
setFinishLeader
(
responseList
,
taskList
);
return
taskList
;
}
@Override
...
...
@@ -354,26 +365,34 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Override
public
List
<
TaskFindResponse
>
findCreate
(
TaskFindRequest
request
,
Long
userId
)
{
List
<
TaskFindResponse
>
responses
=
taskMapper
.
findByUserId
(
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
(
response
.
getCarReviewTaskId
()
!=
null
)
{
CarReviewTask
carReviewTask
=
carReviewTaskMapper
.
selectById
(
response
.
getCarReviewTaskId
());
if
(
Objects
.
equals
(
carReviewTask
.
getTaskStatus
(),
CarReviewTask
.
TASK_STATUS_FINISH
))
{
response
.
setCarReview
(
100.0
);
if
(
responses
!=
null
&&
responses
.
size
()
!=
0
)
{
// 小组成员
List
<
UserNameResponse
>
userList
=
taskMapper
.
findByUserIdList
(
responses
);
setLeader
(
userList
,
responses
);
// 体系审查子任务列表
List
<
SystemReviewTask
>
systemReviewTaskList
=
systemReviewTaskMapper
.
findByTaskList
(
responses
);
setSystemProgress
(
systemReviewTaskList
,
responses
);
// 车型问卷子任务列表
List
<
CarReviewTask
>
carReviewTaskList
=
carReviewTaskMapper
.
findByTaskList
(
responses
);
setCarProgress
(
carReviewTaskList
,
responses
);
// 车型试验子任务列表
List
<
ModelTestTask
>
modelTestTaskList
=
modelTestTaskMapper
.
findByTaskList
(
responses
);
setModelProgress
(
modelTestTaskList
,
responses
);
for
(
TaskFindResponse
response
:
responses
)
{
String
[]
taskList
=
response
.
getTaskList
().
split
(
","
);
if
(
response
.
getPointer
()
<
taskList
.
length
)
{
response
.
setNextSubTask
(
taskList
[
response
.
getPointer
()]);
}
else
{
BigDecimal
num
=
new
BigDecimal
(((
double
)
reviewDetailsMapper
.
count
(
response
.
getCarReviewTaskId
(),
CarReviewTask
.
TYPE
))
*
100
*
0.9
);
response
.
setCarReview
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
response
.
setNextSubTask
(
taskList
[
taskList
.
length
-
1
]);
}
}
}
return
responses
;
}
...
...
@@ -435,7 +454,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Override
public
List
<
Task
>
findUserFinish
(
TaskFindFinishRequest
request
,
Long
userId
)
{
return
taskMapper
.
findUserFinish
(
request
,
userId
);
List
<
Task
>
taskList
=
taskMapper
.
findUserFinish
(
request
,
userId
);
List
<
UserNameResponse
>
responseList
=
taskMapper
.
findByFinishTaskList
(
taskList
);
setFinishLeader
(
responseList
,
taskList
);
return
taskList
;
}
@Override
...
...
@@ -679,6 +704,34 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
private
void
setFinishLeader
(
List
<
UserNameResponse
>
responseList
,
List
<
Task
>
taskList
)
{
if
(
responseList
!=
null
&&
responseList
.
size
()
!=
0
)
{
for
(
UserNameResponse
response
:
responseList
)
{
for
(
Task
task
:
taskList
)
{
if
(
Objects
.
equals
(
response
.
getUserId
(),
task
.
getLeaderId
()))
{
task
.
setLeader
(
response
.
getName
());
}
}
}
}
}
private
void
setLeader
(
List
<
UserNameResponse
>
userList
,
List
<
TaskFindResponse
>
responses
)
{
if
(
userList
!=
null
&&
userList
.
size
()
!=
0
)
{
for
(
UserNameResponse
response
:
userList
)
{
for
(
TaskFindResponse
findResponse
:
responses
)
{
if
(
Objects
.
equals
(
findResponse
.
getLeaderId
(),
response
.
getUserId
()))
{
findResponse
.
setLeader
(
response
.
getName
());
}
}
}
}
}
private
void
setTaskScenario
(
List
<
TaskScenarioResponse
>
scenarioResponseList
,
List
<
TaskFindResponse
>
responses
)
{
if
(
scenarioResponseList
!=
null
&&
scenarioResponseList
.
size
()
!=
0
)
{
...
...
@@ -1019,6 +1072,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 小组成员
List
<
TaskUserRelation
>
relation
=
taskUserRelationService
.
selectQTeamMembers
(
id
);
// 小组成员姓名、部门
List
<
UserNameResponse
>
userList
=
taskMapper
.
findByRelation
(
relation
);
for
(
UserNameResponse
response
:
userList
)
{
for
(
TaskUserRelation
taskUserRelation
:
relation
)
{
if
(
Objects
.
equals
(
response
.
getUserId
(),
taskUserRelation
.
getUserId
()))
{
taskUserRelation
.
setName
(
response
.
getName
());
taskUserRelation
.
setDeptName
(
response
.
getDeptName
());
}
}
}
// 小组成员状态
List
<
TaskUserRelation
>
relationList
=
taskUserRelationMapper
.
findByIdList
(
relation
);
...
...
quality-review/src/main/java/com/ruoyi/web/response/UserNameResponse.java
0 → 100644
View file @
3e0ec55f
package
com
.
ruoyi
.
web
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
"检验员VO"
)
public
class
UserNameResponse
{
@ApiModelProperty
(
"检验员id"
)
private
Long
userId
;
@ApiModelProperty
(
"名称"
)
private
String
name
;
@ApiModelProperty
(
"部门名称"
)
private
String
deptName
;
}
quality-review/src/main/resources/mapper/TaskMapper.xml
View file @
3e0ec55f
...
...
@@ -182,6 +182,8 @@
t.task_begin_time,
t.task_end_time,
t.standard_no,
t.task_list,
t.pointer,
srt.task_begin_time system_task_begin_time,
srt.task_end_time system_task_end_time,
srt.task_status review_status,
...
...
@@ -351,6 +353,33 @@
</foreach>
GROUP BY task_id
</select>
<select
id=
"findByUserIdList"
resultType=
"com.ruoyi.web.response.UserNameResponse"
>
SELECT s.user_id userId, s.nick_name name, sd.dept_name deptName
FROM sys_user s
LEFT JOIN sys_dept sd ON s.dept_id = sd.dept_id
WHERE s.user_id IN
<foreach
item=
"item"
collection=
"responses"
open=
"("
separator=
","
close=
")"
>
#{item.leaderId}
</foreach>
</select>
<select
id=
"findByRelation"
resultType=
"com.ruoyi.web.response.UserNameResponse"
>
SELECT s.user_id userId, s.nick_name name, sd.dept_name deptName
FROM sys_user s
LEFT JOIN sys_dept sd ON s.dept_id = sd.dept_id
WHERE s.user_id IN
<foreach
item=
"item"
collection=
"relation"
open=
"("
separator=
","
close=
")"
>
#{item.userId}
</foreach>
</select>
<select
id=
"findByFinishTaskList"
resultType=
"com.ruoyi.web.response.UserNameResponse"
>
SELECT s.user_id userId, s.nick_name name, sd.dept_name deptName
FROM sys_user s
LEFT JOIN sys_dept sd ON s.dept_id = sd.dept_id
WHERE s.user_id IN
<foreach
item=
"item"
collection=
"taskList"
open=
"("
separator=
","
close=
")"
>
#{item.leaderId}
</foreach>
</select>
</mapper>
quality-review/src/main/resources/mapper/TestRecordsMapper.xml
View file @
3e0ec55f
...
...
@@ -23,6 +23,11 @@
FROM t_test_records
WHERE project_id = #{id}
</select>
<select
id=
"countResult"
resultType=
"java.lang.Long"
>
SELECT COUNT(*) FROM t_test_records
WHERE project_id = #{projectId}
GROUP BY project_id
</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