From e314a4c4b135bba134ad943dbbbfaa65caf38961 Mon Sep 17 00:00:00 2001 From: csyue <1203338439@qq.com> Date: Wed, 29 May 2024 13:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98=E9=A1=B9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/service/impl/TmTaskServiceImpl.java | 114 ++++++++---------- 1 file changed, 49 insertions(+), 65 deletions(-) diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index 21326edf..72cf6d13 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -615,11 +615,6 @@ public class TmTaskServiceImpl implements TmTaskService { public List getLeaseAuditManageList(TmTask record) { Set roles = SecurityUtils.getLoginUser().getRoles(); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); - List list = tmTaskMapper.getAuditManageListByLeaseTmTask(record); - if (deptId == 101 || deptId == 102) { - record.setCompanyId(deptId.intValue()); - } - List tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record); for (TmTask tmTask : tmTaskList) { @@ -629,8 +624,30 @@ public class TmTaskServiceImpl implements TmTaskService { List collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); if (collect.size() > 0) { int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); + if (roles.contains("admin")) { + // 对领料任务集合查询具体详情 + for (LeaseApplyInfo leaseApplyInfo : collect) { + if (leaseApplyInfo != null) { + // 去查询领料任务详情表 + List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); + if (leaseApplyDetails.size() > 0) { + for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { + // 统计预领数量 + count += leaseApplyDetail.getPreNum(); + } + } + // 塞入领料任务详情的集合中 + leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); + // 存入领料任务实体集合 + tmTask.setLeaseApplyInfoList(collect); + tmTask.setRemark(collect.get(0).getRemark()); + } + } + } + } //机具经理、书记、副经理查看数据 - if (deptId == 101) { + else if (deptId == 101) { List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); if (deptId1 == 101) { List applyInfoList = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); @@ -661,9 +678,9 @@ public class TmTaskServiceImpl implements TmTaskService { } } // 调试公司可以看到的数据权限 - if (deptId == 102) { + else if (deptId == 102) { List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); - if (deptId1 == 102){ + if (deptId1 == 102) { List list2 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); auditListByLeaseInfo.addAll(list2); } @@ -692,7 +709,7 @@ public class TmTaskServiceImpl implements TmTaskService { } } //其他各分公司可以看到的数据权限 - if (deptId == deptId1) { + else if (deptId == deptId1) { // 对领料任务集合查询具体详情 for (LeaseApplyInfo leaseApplyInfo : collect) { if (leaseApplyInfo != null) { @@ -713,70 +730,37 @@ public class TmTaskServiceImpl implements TmTaskService { } } } - } - } - } - tmTask.setPreCountNum(count); - } - - for (TmTask tmTask : list) { - int count = 0; - if (tmTask != null) { - // 去查询任务分单表 - List collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); - int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); - if (roles.contains("sgb")) { - // 对领料任务集合查询具体详情 - List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); - if (deptId1 == 210) { - List list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); - auditListByLeaseInfo.addAll(list1); - } - if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { + } else if (roles.contains("sgb")) { // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); + List auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); + if (deptId1 == 210) { + List list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); + auditListByLeaseInfo.addAll(list1); + } + if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { + // 对领料任务集合查询具体详情 + for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { + if (leaseApplyInfo != null) { + // 去查询领料任务详情表 + List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); + if (leaseApplyDetails.size() > 0) { + for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { + if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { + // 统计预领数量 + count += leaseApplyDetail.getPreNum(); + } } + // 塞入领料任务详情的集合中 + leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); + // 存入领料任务实体集合 + tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); + tmTask.setRemark(collect.get(0).getRemark()); } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); - tmTask.setRemark(collect.get(0).getRemark()); } } } } - } - if (roles.contains("admin")) { - // 对领料任务集合查询具体详情 - for (LeaseApplyInfo leaseApplyInfo : collect) { - if (leaseApplyInfo != null) { - // 去查询领料任务详情表 - List leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); - if (leaseApplyDetails.size() > 0) { - for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { - if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { - // 统计预领数量 - count += leaseApplyDetail.getPreNum(); - } - } - // 塞入领料任务详情的集合中 - leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); - // 存入领料任务实体集合 - tmTask.setLeaseApplyInfoList(collect); - tmTask.setRemark(collect.get(0).getRemark()); - } - } - } } } tmTask.setPreCountNum(count);