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
9b071682
Commit
9b071682
authored
Nov 27, 2024
by
宋源硕
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'songyuanshuo' into 'dev'
2024/11/27新增和修改方法 See merge request
!465
parents
360fccb7
bdf696ac
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
181 additions
and
39 deletions
+181
-39
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+64
-7
SysUserController.java
...va/com/ruoyi/web/controller/system/SysUserController.java
+6
-0
SysUserVONew.java
...rc/main/java/com/ruoyi/system/domain/vo/SysUserVONew.java
+33
-0
SysUserMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+19
-13
SysUserRoleMapper.java
.../main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
+5
-0
ISysUserService.java
...c/main/java/com/ruoyi/system/service/ISysUserService.java
+3
-0
SysUserServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+19
-0
SysUserMapper.xml
...system/src/main/resources/mapper/system/SysUserMapper.xml
+27
-19
SysUserRoleMapper.xml
...em/src/main/resources/mapper/system/SysUserRoleMapper.xml
+5
-0
No files found.
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
9b071682
...
...
@@ -20,6 +20,7 @@ import com.ruoyi.domain.*;
import
com.ruoyi.domain.vo.CaseStatisticsVO
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.system.mapper.SysUserRoleMapper
;
import
com.ruoyi.system.service.ISysUserService
;
import
com.ruoyi.web.request.*
;
import
com.ruoyi.web.response.*
;
...
...
@@ -138,6 +139,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
@Autowired
private
TestRecordsMapper
testRecordsMapper
;
@Autowired
private
SysUserRoleMapper
sysUserRoleMapper
;
@Override
public
List
<
Task
>
findList
(
TaskListRequest
request
)
{
return
taskMapper
.
findList
(
request
);
...
...
@@ -196,8 +200,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
for
(
TaskUserRelation
auditor
:
auditors
)
{
if
(
auditor
.
getIsLeader
()
==
1
)
{
List
<
Long
>
roleIdList
=
sysUserRoleMapper
.
selectRoleIdByUserId
(
auditor
.
getUserId
());
for
(
Long
roleId
:
roleIdList
){
if
(
roleId
.
equals
(
112L
)){
leader
=
auditor
;
auditor
.
setIsLeader
(
1
);
break
;
}
}
if
(
leader
!=
null
){
break
;
}
}
...
...
@@ -334,8 +345,15 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
for
(
TaskUserRelation
auditor
:
auditors
)
{
if
(
auditor
.
getIsLeader
()
==
1
)
{
List
<
Long
>
roleIdList
=
sysUserRoleMapper
.
selectRoleIdByUserId
(
auditor
.
getUserId
());
for
(
Long
roleId
:
roleIdList
){
if
(
roleId
.
equals
(
112L
)){
leader
=
auditor
;
auditor
.
setIsLeader
(
1
);
break
;
}
}
if
(
leader
!=
null
){
break
;
}
}
...
...
@@ -588,10 +606,32 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
task
.
setStandardNo
(
standard
.
getStandardNo
());
task
.
setFile
(
standard
.
getFile
());
}
if
(
request
.
getEnterpriseName
()
!=
null
){
task
.
setEnterpriseName
(
request
.
getEnterpriseName
());
}
if
(
request
.
getEnterpriseId
()
!=
null
){
task
.
setEnterpriseId
(
request
.
getEnterpriseId
());
}
// 找到审查组长
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
for
(
TaskUserRelation
auditor
:
auditors
)
{
List
<
Long
>
roleIdList
=
sysUserRoleMapper
.
selectRoleIdByUserId
(
auditor
.
getUserId
());
for
(
Long
roleId
:
roleIdList
){
if
(
roleId
.
equals
(
112L
)){
leader
=
auditor
;
auditor
.
setIsLeader
(
1
);
break
;
}
}
if
(
leader
!=
null
){
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeader
(
leader
.
getName
());
break
;
}
}
/*TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors != null && auditors.size() != 0) {
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
...
...
@@ -603,7 +643,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
}
}
*/
// 暂存
taskService
.
save
(
task
);
...
...
@@ -657,6 +697,23 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 找到审查组长
TaskUserRelation
leader
=
null
;
List
<
TaskUserRelation
>
auditors
=
request
.
getAuditors
();
for
(
TaskUserRelation
auditor
:
auditors
)
{
List
<
Long
>
roleIdList
=
sysUserRoleMapper
.
selectRoleIdByUserId
(
auditor
.
getUserId
());
for
(
Long
roleId
:
roleIdList
){
if
(
roleId
.
equals
(
112L
)){
leader
=
auditor
;
auditor
.
setIsLeader
(
1
);
break
;
}
}
if
(
leader
!=
null
){
task
.
setLeaderId
(
leader
.
getUserId
());
task
.
setLeader
(
leader
.
getName
());
break
;
}
}
/*TaskUserRelation leader = null;
List<TaskUserRelation> auditors = request.getAuditors();
if (auditors != null && auditors.size() != 0) {
for(TaskUserRelation auditor : auditors) {
if(auditor.getIsLeader() == 1) {
...
...
@@ -667,7 +724,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 任务组长
task.setLeaderId(leader.getUserId());
task.setLeader(leader.getName());
}
}
*/
// 更新暂存
taskService
.
updateById
(
task
);
...
...
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
View file @
9b071682
...
...
@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
import
cn.hutool.core.collection.CollUtil
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.SysUserVONew
;
import
com.ruoyi.system.request.InspectionRequest
;
import
com.ruoyi.system.service.*
;
import
com.ruoyi.web.request.UserByRoleRequest
;
...
...
@@ -136,6 +137,11 @@ public class SysUserController extends BaseController
return
R
.
ok
(
userService
.
getInspection
());
}
@ApiOperation
(
"获取检验人员列表新"
)
@PostMapping
(
"/getInspectionNew"
)
public
R
<
List
<
SysUserVONew
>>
getInspectionNew
()
{
return
R
.
ok
(
userService
.
getInspectionNew
());
}
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"param1"
,
value
=
"arg[1]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@Log
(
title
=
"用户管理"
,
businessType
=
BusinessType
.
EXPORT
)
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVONew.java
0 → 100644
View file @
9b071682
package
com
.
ruoyi
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@Data
@Accessors
(
chain
=
true
)
public
class
SysUserVONew
{
@ApiModelProperty
(
"用户id"
)
private
Long
userId
;
@ApiModelProperty
(
"用户账号"
)
private
String
userName
;
@ApiModelProperty
(
"用户昵称"
)
private
String
nickname
;
@ApiModelProperty
(
"部门名称"
)
private
String
deptName
;
@ApiModelProperty
(
"角色id"
)
private
List
<
Long
>
roleId
;
@ApiModelProperty
(
"帐号状态(0正常 1停用)"
)
private
String
status
;
@ApiModelProperty
(
"删除标志(0代表存在 2代表删除)"
)
private
String
delFlag
;
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
View file @
9b071682
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.mapper;
import
java.util.List
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.SysUserVONew
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.request.InspectionRequest
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -161,4 +162,9 @@ public interface SysUserMapper
* @return
*/
List
<
SysUserVO
>
getInspection
();
/**
* 获取检验人员列表
* @return
*/
List
<
SysUserVONew
>
getInspectionNew
();
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java
View file @
9b071682
...
...
@@ -66,4 +66,9 @@ public interface SysUserRoleMapper
*根据roleId查询审核员Id
* */
List
<
Long
>
selectReviewerIdByRoleId
(
Long
roleId
);
/*
* 根据用户获取角色id
* */
List
<
Long
>
selectRoleIdByUserId
(
Long
userId
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
View file @
9b071682
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import
java.util.List
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.SysUserVONew
;
import
com.ruoyi.system.request.InspectionRequest
;
/**
...
...
@@ -239,4 +240,6 @@ public interface ISysUserService
* @return
*/
List
<
SysUserVO
>
getInspection
();
List
<
SysUserVONew
>
getInspectionNew
();
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
View file @
9b071682
...
...
@@ -7,6 +7,7 @@ import javax.validation.Validator;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.system.domain.vo.SysUserVO
;
import
com.ruoyi.system.domain.vo.SysUserVONew
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.mapper.*
;
import
com.ruoyi.system.request.InspectionRequest
;
...
...
@@ -621,6 +622,24 @@ public class SysUserServiceImpl implements ISysUserService
return
deduplicatedList
;
}
/**
* 获取检验人员列表
* @return
*/
@Override
public
List
<
SysUserVONew
>
getInspectionNew
()
{
List
<
SysUserVONew
>
userList
=
userMapper
.
getInspectionNew
();
for
(
SysUserVONew
sysUserVONew
:
userList
){
List
<
Long
>
roleId
=
userRoleMapper
.
selectRoleIdByUserId
(
sysUserVONew
.
getUserId
());
sysUserVONew
.
setRoleId
(
roleId
);
}
// 使用Stream API进行去重,基于userId字段
/*List<SysUserVO> deduplicatedList = userList.stream()
.filter(distinctByKey(user -> user.getUserId()))
.collect(Collectors.toList());*/
return
userList
;
}
// 辅助方法,用于去重
private
static
<
T
>
java
.
util
.
function
.
Predicate
<
T
>
distinctByKey
(
java
.
util
.
function
.
Function
<?
super
T
,
?>
keyExtractor
)
{
java
.
util
.
Map
<
Object
,
Boolean
>
seen
=
new
java
.
util
.
concurrent
.
ConcurrentHashMap
<>();
...
...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
View file @
9b071682
...
...
@@ -260,5 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sr.role_id IN (106, 112)
and u.del_flag = '0'
</select>
<select
id=
"getInspectionNew"
resultType=
"com.ruoyi.system.domain.vo.SysUserVONew"
>
select u.user_id,u.user_name,u.nick_name,u.status,u.del_flag, sd.dept_name
from sys_user u
left join sys_user_role sr on u.user_id = sr.user_id
left join sys_dept sd on sd.dept_id = u.dept_id
where sr.role_id IN (106, 112)
and u.del_flag = '0'
</select>
</mapper>
ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
View file @
9b071682
...
...
@@ -20,6 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectReviewerIdByRoleId"
resultType=
"java.lang.Long"
>
select user_id from sys_user_role where role_id = #{roleId}
</select>
<select
id=
"selectRoleIdByUserId"
resultType=
"java.lang.Long"
>
select role_id
from sys_user_role
where user_id = #{userId}
</select>
<delete
id=
"deleteUserRole"
parameterType=
"Long"
>
delete from sys_user_role where user_id in
...
...
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