This commit is contained in:
mashuai 2025-12-05 12:05:46 +08:00
parent a2f3eee3d5
commit 673732f1dc
5 changed files with 68 additions and 13 deletions

View File

@ -155,4 +155,10 @@ public interface TmTaskMapper {
Integer getNumISenoughOther(MaType maType);
MaType getNumByTypeId(MaType maType);
/**
* 获取机具经理和机具副经理的审核人id
* @return
*/
List<Long> getUserIdListByRoleName();
}

View File

@ -662,11 +662,12 @@ public class TmTaskServiceImpl implements TmTaskService {
@Override
public List<TmTask> getLeaseOutListByUser(TmTask task) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
if (roles.contains(STRING_ADMIN)) {
//管理员机具经理可以查看全部设备
if (roles.contains(STRING_ADMIN) || roles.contains(STRING_EM01)) {
return tmTaskMapper.getLeaseOutListByAdmin(task);
} else if (roles.contains(STRING_JJBZ) || roles.contains(STRING_FBZ) || roles.contains(STRING_EM01)
} else if (roles.contains(STRING_JJBZ) || roles.contains(STRING_FBZ)
|| roles.contains(STRING_EM02) || roles.contains(STRING_EM03)) {
//机具班长副班长机具经理机具副经理安全员可以查看机具设备
//机具班长副班长机具副经理安全员可以查看机具设备
return tmTaskMapper.getLeaseOutListByjjbz(task);
} else if (roles.contains(STRING_DM01)) {
//调试经理可以查看调试设备
@ -894,6 +895,7 @@ public class TmTaskServiceImpl implements TmTaskService {
*/
@Override
public List<TmTask> getLeaseAuditManageList(TmTask record) {
boolean isManager = false;
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
@ -902,6 +904,14 @@ public class TmTaskServiceImpl implements TmTaskService {
if (tmTask == null) {
continue;
}
// 获取机具经理和机具副经理的审核人id
List<Long> userIdList = tmTaskMapper.getUserIdListByRoleName();
Long userId = SecurityUtils.getLoginUser().getUserid();
if (CollectionUtils.isNotEmpty(userIdList)) {
if (userIdList.contains(userId)) {
isManager = true;
}
}
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
if (collect.isEmpty()) {
continue;
@ -910,7 +920,7 @@ public class TmTaskServiceImpl implements TmTaskService {
if (deptId1 == null) {
continue;
}
List<LeaseApplyInfo> filteredList = filterLeaseApplyInfoList(roles, deptId, deptId1, collect);
List<LeaseApplyInfo> filteredList = filterLeaseApplyInfoList(isManager, tmTask, roles, deptId, deptId1, collect);
processLeaseApplyInfoList(tmTaskMapper, tmTask, filteredList, deptId1, collect.get(0).getRemark());
}
@ -919,7 +929,7 @@ public class TmTaskServiceImpl implements TmTaskService {
private static List<LeaseApplyInfo> filterLeaseApplyInfoList(Set<String> roles, Long deptId, int deptId1, List<LeaseApplyInfo> collect) {
private static List<LeaseApplyInfo> filterLeaseApplyInfoList(boolean isManager, TmTask task, Set<String> roles, Long deptId, int deptId1, List<LeaseApplyInfo> collect) {
if (roles.contains("admin") || deptId == 100) {
return collect;
} else if (deptId == 101) {
@ -931,6 +941,12 @@ public class TmTaskServiceImpl implements TmTaskService {
.filter(t -> t.getCompanyId() != null && t.getCompanyId() == 102)
.collect(Collectors.toList()));
}
// 即为内部审核又是调试设备
if (task.getTaskStatus() == 32 && collect.get(0).getCompanyId() == 102) {
if (isManager) {
return collect;
}
}
return auditListByLeaseInfo;
} else if (deptId == 102) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream()
@ -1040,6 +1056,18 @@ public class TmTaskServiceImpl implements TmTaskService {
int result = 0;
int taskId = 0;
int num = 0;
boolean isManager = false;
// 获取机具经理和机具副经理的审核人id
List<Long> userIdList = tmTaskMapper.getUserIdListByRoleName();
Long userId = SecurityUtils.getLoginUser().getUserid();
if (CollectionUtils.isNotEmpty(userIdList)) {
if (userIdList.contains(userId)) {
// 只针对于调试设备内部审核修改为机具经理审核
if (record.getCompanyId() != null && record.getCompanyId() == 102) {
isManager = true;
}
}
}
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
if (StringUtils.isNotNull(record)) {
// 先审核任务表
@ -1049,7 +1077,12 @@ public class TmTaskServiceImpl implements TmTaskService {
// 再审核领料任务信息表
List<LeaseApplyInfo> leaseApplyInfoList = record.getLeaseApplyInfoList();
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
List<LeaseApplyInfo> applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
List<LeaseApplyInfo> applyInfoList = new ArrayList<>();
if (isManager) {
applyInfoList = leaseApplyInfoList;
} else {
applyInfoList = leaseApplyInfoList.stream().filter(t -> t.getCompanyId().equals(companyId.intValue())).collect(Collectors.toList());
}
if (CollUtil.isNotEmpty(applyInfoList)) {
for (LeaseApplyInfo leaseApplyInfo : applyInfoList) {
taskId = leaseApplyInfo.getTaskId();

View File

@ -1489,4 +1489,17 @@
mt.type_id = #{typeId}
</select>
<select id="getUserIdListByRoleName" resultType="java.lang.Long">
SELECT DISTINCT
u.user_id
FROM
sys_user u
LEFT JOIN sys_user_role sur ON u.user_id = sur.user_id
left join sys_role sr on sur.role_id = sr.role_id
WHERE
u.STATUS = '0'
AND u.del_flag = '0'
AND sr.role_id IN (127,128)
</select>
</mapper>

View File

@ -62,7 +62,7 @@ public class ToDoServiceImpl implements ToDoService {
for (ToDoBean toDoBean : collect) {
if (deptId.equals(toDoBean.getDeptId()) && "30".equals(toDoBean.getTaskStatus())) {
toDoBeanArrayList.add(toDoBean);
} else if ("32".equals(toDoBean.getTaskStatus()) && toDoBean.getCompanyId() == 101) {
} else if ("32".equals(toDoBean.getTaskStatus()) /*&& toDoBean.getCompanyId() == 101*/) {
toDoBeanArrayList.add(toDoBean);
}
}
@ -77,9 +77,9 @@ public class ToDoServiceImpl implements ToDoService {
for (ToDoBean toDoBean : collect) {
if (deptId.equals(toDoBean.getDeptId()) && "30".equals(toDoBean.getTaskStatus())) {
beanList.add(toDoBean);
} else if ("32".equals(toDoBean.getTaskStatus()) && toDoBean.getCompanyId() == 102) {
} /*else if ("32".equals(toDoBean.getTaskStatus()) && toDoBean.getCompanyId() == 102) {
beanList.add(toDoBean);
}
}*/
}
return beanList;
// 各分公司经理
@ -87,7 +87,7 @@ public class ToDoServiceImpl implements ToDoService {
// 将collect集合中taskStatus为30的数据过滤出来并且collect集合中的deptId不为101或者102
return collect.stream().filter(toDoBean -> "30".equals(toDoBean.getTaskStatus()) &&
deptId.equals(toDoBean.getDeptId())).collect(Collectors.toList());
} else if (roles.contains(STRING_DM02)) {
} /*else if (roles.contains(STRING_DM02)) {
List<ToDoBean> beans = new ArrayList<>();
for (ToDoBean toDoBean : collect) {
if ("32".equals(toDoBean.getTaskStatus()) && toDoBean.getCompanyId() == 102) {
@ -95,7 +95,7 @@ public class ToDoServiceImpl implements ToDoService {
}
}
return beans;
}
}*/
}
return toDoList;
}

View File

@ -858,8 +858,11 @@ public class SysUserServiceImpl implements ISysUserService {
user.setPickingFirst(s);
}
} else if (TaskStatusEnum.STAY_INTERNAL_AUDIT.getInfo().equals(urgentProcessingUser.getTaskStatus())) {
//获取调试经理和机具副经理的信息
userList = userMapper.selectUserByDm();
/*//获取调试经理和机具副经理的信息
userList = userMapper.selectUserByDm();*/
// todo 2025-12-04 审核流程更改调试内部审核改为机具经理审核
//获取机具经理和机具副经理的信息
userList = userMapper.selectUserByEm();
for (SysUser user : userList) {
String s = selectPickingFirst(user);
user.setPickingFirst(s);