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

This commit is contained in:
BianLzhaoMin 2024-05-29 14:21:46 +08:00
commit b13667f377
3 changed files with 91 additions and 106 deletions

View File

@ -36,6 +36,7 @@ public class TmTask implements Serializable {
private Long parentId; private Long parentId;
private Integer outNum; private Integer outNum;
private Long deptId; private Long deptId;
private String nickName;
/** /**
* 任务类型(定义数据字典) * 任务类型(定义数据字典)

View File

@ -615,79 +615,17 @@ 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<TmTask> list = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
record.setDeptId(deptId);
List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record); List<TmTask> tmTaskList = tmTaskMapper.getAuditManageListByLeaseTmTask(record);
for (TmTask tmTask : tmTaskList) { for (TmTask tmTask : tmTaskList) {
int count = 0; int count = 0;
tmTask.setDeptId(deptId);
if (tmTask != null) { if (tmTask != null) {
// 去查询任务分单表 // 去查询任务分单表
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask);
if (collect != null) { if (collect.size() > 0) {
int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy());
//施管部只能看到机具分公司101的数据 if (roles.contains("admin")) {
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) {
@ -708,28 +646,67 @@ public class TmTaskServiceImpl implements TmTaskService {
} }
} }
} }
} } else if (deptId == 101) { //机具经理书记副经理查看数据
} List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
} if (deptId1 == 101) {
tmTask.setPreCountNum(count); List<LeaseApplyInfo> applyInfoList = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
} auditListByLeaseInfo.addAll(applyInfoList);
}
for (TmTask tmTask : list) { if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
int count = 0; // 对领料任务集合查询具体详情
if (tmTask != null) { for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
// 去查询任务分单表 if (leaseApplyInfo != null) {
List<LeaseApplyInfo> collect = tmTaskMapper.getAuditManageListByLeaseInfo(tmTask); // 去查询领料任务详情表
int deptId1 = tmTaskMapper.getDeptId(collect.get(0).getCreateBy()); List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
if (roles.contains("sgb")) { if (leaseApplyDetails.size() > 0) {
// 对领料任务集合查询具体详情 for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList()); if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) {
if (deptId1 == 210) { // 统计预领数量
List<LeaseApplyInfo> list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList()); count += leaseApplyDetail.getPreNum();
auditListByLeaseInfo.addAll(list1); }
} }
if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) { // 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
tmTask.setRemark(collect.get(0).getRemark());
}
}
}
}
} else 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());
}
}
}
}
} else if (deptId == deptId1) { //其他各分公司可以看到的数据权限
// 对领料任务集合查询具体详情 // 对领料任务集合查询具体详情
for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) { for (LeaseApplyInfo leaseApplyInfo : collect) {
if (leaseApplyInfo != null) { if (leaseApplyInfo != null) {
// 去查询领料任务详情表 // 去查询领料任务详情表
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
@ -743,35 +720,42 @@ public class TmTaskServiceImpl implements TmTaskService {
// 塞入领料任务详情的集合中 // 塞入领料任务详情的集合中
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails); leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
// 存入领料任务实体集合 // 存入领料任务实体集合
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo); tmTask.setLeaseApplyInfoList(collect);
tmTask.setRemark(collect.get(0).getRemark()); tmTask.setRemark(collect.get(0).getRemark());
} }
} }
} }
} } else if (roles.contains("sgb")) {
} // 对领料任务集合查询具体详情
List<LeaseApplyInfo> auditListByLeaseInfo = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 101).collect(Collectors.toList());
if (roles.contains("admin")) { if (deptId1 == 210) {
// 对领料任务集合查询具体详情 List<LeaseApplyInfo> list1 = collect.stream().filter(t -> t.getCompanyId() != null).filter(t -> t.getCompanyId() == 102).collect(Collectors.toList());
for (LeaseApplyInfo leaseApplyInfo : collect) { auditListByLeaseInfo.addAll(list1);
if (leaseApplyInfo != null) { }
// 去查询领料任务详情表 if (auditListByLeaseInfo != null && !auditListByLeaseInfo.isEmpty()) {
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo); // 对领料任务集合查询具体详情
if (leaseApplyDetails.size() > 0) { for (LeaseApplyInfo leaseApplyInfo : auditListByLeaseInfo) {
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) { if (leaseApplyInfo != null) {
if (leaseApplyDetail != null && leaseApplyDetail.getPreNum() != null) { // 去查询领料任务详情表
// 统计预领数量 List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyManageDetails(leaseApplyInfo);
count += leaseApplyDetail.getPreNum(); 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(collect);
tmTask.setRemark(collect.get(0).getRemark());
} }
} }
} }
} }
} }
tmTask.setPreCountNum(count); tmTask.setPreCountNum(count);

View File

@ -913,7 +913,7 @@
</select> </select>
<select id="getAuditListByLeaseTmTaskByPeople" resultType="com.bonus.sgzb.app.domain.TmTask"> <select id="getAuditListByLeaseTmTaskByPeople" resultType="com.bonus.sgzb.app.domain.TmTask">
SELECT DISTINCT SELECT DISTINCT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName, tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,su.nick_name as nickName,
bpl.lot_id as proId,bpl.lot_name as proName, bpl.lot_id as proId,bpl.lot_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName, bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime, lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,