Merge branch 'dev-nx' of http://192.168.0.56:3000/bonus/devicesmgt into dev-nx

This commit is contained in:
BianLzhaoMin 2024-05-28 18:42:24 +08:00
commit 0a8d75d077
4 changed files with 57 additions and 17 deletions

View File

@ -75,7 +75,7 @@ public class SysLoginService {
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
throw new ServiceException("登录用户" + username + " 不存在");
throw new ServiceException("用户不存在/密码错误");
}
if (R.FAIL == userResult.getCode()) {

View File

@ -217,6 +217,7 @@ public class TmTaskController extends BaseController {
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
leaseApplyInfo.setType("2"); // 设置审批层级先固定2层后期根据接口传入Type区分来源设定
leaseApplyInfo.setLeaseType(task.getLeaseType());
leaseApplyInfo.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
leaseApplyInfo.setEstimateLeaseTime(task.getEstimateLeaseTime());
// 创建领料任务返回领料任务编号

View File

@ -442,11 +442,8 @@ public class TmTaskServiceImpl implements TmTaskService {
List<TmTask> tmTaskList;
if (roles.contains(STRING_ADMIN)) {
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
} else if (deptId == 101) {
record.setCompanyId(101);
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record);
} else if (deptId == 102) {
record.setCompanyId(102);
} else if (deptId != null) {
record.setCompanyId(deptId.intValue());
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record);
} else {
String username = SecurityUtils.getLoginUser().getUsername();
@ -618,19 +615,37 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseAuditManageList(TmTask record) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (roles.contains("fgs")) {
List<TmTask> tmTaskList = new ArrayList<>();
if (roles.contains("admin")) {
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else if (roles.contains("em01") || roles.contains("em02")) { //机具经理机具副经理
record.setDeptId(101L);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else if (roles.contains("sgb")) { //施管部经理
record.setDeptId(210L);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else if (roles.contains("dm01") || roles.contains("dm04")) { //调试经理调试安全专责
record.setDeptId(102L);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else if (roles.contains("dm02")) { //调试审核员
record.setCompanyId(102);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else if (roles.contains("fgs")) { //各分公司经理
record.setDeptId(deptId);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
} else { //其他角色只能看到自己部门下的数据
record.setDeptId(deptId);
tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
}
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
for (TmTask tmTask : tmTaskList) {
int count = 0;
if (tmTask != null) {
tmTask.setDeptId(deptId);
// 去查询任务分单表
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
//没有companyId的用户或者是分公司账号可以看到所有数据
if (companyId == null || roles.contains("fgs")) {
//管理员可以看到所有数据
if (roles.contains("admin")) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) {
@ -651,9 +666,7 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
}
//施管部只能看到机具分公司101的数据
if (roles.contains("jjfgs") || roles.contains("sgb") || deptId == 101) {
} else if (roles.contains("em01") || roles.contains("em02") || roles.contains("sgb")) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
@ -677,9 +690,7 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
}
//安监部只能看到设备分公司102的数据
if (roles.contains("tsfgs") || roles.contains("ajb") || deptId == 102) {
} else if (roles.contains("dm01") || roles.contains("dm04") || roles.contains("dm02")) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
@ -703,6 +714,31 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
} else {
//其他部门人只能看到自己部门下的数据
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCreateBy().equals(deptId.toString())).collect(Collectors.toList());
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
// 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if (leaseApplyInfo != null) {
// 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
if (leaseApplyDetails.size() > 0) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
if (leaseApplyDetail != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
tmTask.setRemark(collect.get(0).getRemark());
}
}
}
}
}
// 塞入预领的合计数量
tmTask.setPreCountNum(count);

View File

@ -561,6 +561,9 @@
<if test="record.deptId != null and record.deptId != '' ">
AND su.dept_id = #{record.deptId}
</if>
<if test="record.companyId != null ">
AND lai.company_id = #{record.companyId}
</if>
<if test="record.taskId != null and record.taskId != '' ">
AND tt.task_id = #{record.taskId}
</if>