测试问题项修改

This commit is contained in:
csyue 2024-05-29 10:57:05 +08:00
parent fcbc5f720e
commit 6cd6940519
1 changed files with 111 additions and 34 deletions

View File

@ -615,16 +615,78 @@ public class TmTaskServiceImpl implements TmTaskService {
public List<TmTask> getLeaseAuditManageList(TmTask record) { public List<TmTask> getLeaseAuditManageList(TmTask record) {
Set<String> roles = SecurityUtils.getLoginUser().getRoles(); Set<String> roles = SecurityUtils.getLoginUser().getRoles();
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
List<LeaseApplyInfo> collect; List<TmTask> list = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
int count = 0; record.setDeptId(deptId);
List<LeaseApplyInfo> leaseApplyInfoList = new ArrayList<>();
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record); List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
if (roles.contains("admin")) {
for (TmTask tmTask : tmTaskList) { for (TmTask tmTask : tmTaskList) {
if (tmTask != null) { int count = 0;
// 去查询任务分单表 if (tmTask != null) {
collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); // 去查询任务分单表
record.setDeptId(null); List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy());
//施管部只能看到机具分公司101的数据
if (deptId == 101) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
if (deptId1 == 101) {
List<LeaseApplyInfo> applyInfoList = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
auditListByLeaseInfo.addAll(applyInfoList);
}
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 && leaseApplyDetail.getPreNum() != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
tmTask.setRemark(collect.get(0).getRemark());
}
}
}
}
}
if (deptId == 102) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
if (deptId1 == 102) {
List<LeaseApplyInfo> list2 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
auditListByLeaseInfo.addAll(list2);
}
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 && leaseApplyDetail.getPreNum() != null) {
// 统计预领数量
count += leaseApplyDetail.getPreNum();
}
}
// 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
tmTask.setRemark(collect.get(0).getRemark());
}
}
}
}
}
//只能查詢改部門下的數據
if (deptId == deptId1) {
// 对领料任务集合查询具体详情 // 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : collect) { for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) { if (leaseApplyInfo != null) {
@ -646,34 +708,50 @@ public class TmTaskServiceImpl implements TmTaskService {
} }
} }
} }
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
} }
tmTask.setPreCountNum(count);
}
} else { for (TmTask tmTask : list) {
for (TmTask tmTask : tmTaskList) { int count = 0;
collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); if (tmTask != null) {
for (LeaseApplyInfo leaseApplyInfo : collect) { // 去查询任务分单表
String createBy = leaseApplyInfo.getCreateBy(); List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
// 查询当前领料人所属部门 int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy());
int deptId1 = tmTaskMapper.getDeptId(createBy); if (roles.contains("sgb")) {
if ((deptId == 101 && leaseApplyInfo.getCompanyId() == 101) || (deptId1 == deptId && deptId1 == 101)) { // 对领料任务集合查询具体详情
leaseApplyInfoList.add(leaseApplyInfo); List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
if (deptId1 == 210) {
List<LeaseApplyInfo> list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
auditListByLeaseInfo.addAll(list1);
} }
if ((deptId == 102 && leaseApplyInfo.getCompanyId() == 102) || (deptId1 == deptId && deptId1 == 102)) { if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
leaseApplyInfoList.add(leaseApplyInfo); // 对领料任务集合查询具体详情
} for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
if ((roles.contains("sgb") && leaseApplyInfo.getCompanyId() == 101) || (deptId1 == 210)) { if (leaseApplyInfo != null) {
leaseApplyInfoList.add(leaseApplyInfo); // 去查询领料任务详情表
} List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
if (roles.contains("fgs") && (deptId == deptId1)) { if (leaseApplyDetails.size() > 0) {
leaseApplyInfoList.add(leaseApplyInfo); 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());
}
}
}
} }
} }
if (leaseApplyInfoList != null && !leaseApplyInfoList.isEmpty()) { if (roles.contains("admin")) {
// 对领料任务集合查询具体详情 // 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) { for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) { if (leaseApplyInfo != null) {
// 去查询领料任务详情表 // 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
@ -687,15 +765,14 @@ public class TmTaskServiceImpl implements TmTaskService {
// 塞入领料任务详情的集合中 // 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合 // 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(leaseApplyInfoList); tmTask.setLeaseApplyInfoList(collect);
tmTask.setRemark(leaseApplyInfoList.get(0).getRemark()); tmTask.setRemark(collect.get(0).getRemark());
} }
} }
} }
} }
// 塞入预领的合计数量
tmTask.setPreCountNum(count);
} }
tmTask.setPreCountNum(count);
} }
List<TmTask> tmTasks = tmTaskList.stream().filter(t -> t.getLeaseApplyInfoList() != null).collect(Collectors.toList()); List<TmTask> tmTasks = tmTaskList.stream().filter(t -> t.getLeaseApplyInfoList() != null).collect(Collectors.toList());
return tmTasks; return tmTasks;