This commit is contained in:
mashuai 2025-10-24 17:15:15 +08:00
parent 9689475e41
commit 712142380a
6 changed files with 46 additions and 29 deletions

View File

@ -125,12 +125,9 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} /*else { }
// 材料员权限
list = filterList(list, username);
}*/
} }
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
for (MaterialBackApplyInfo materialRetainedEquipmentInfo : list) { for (MaterialBackApplyInfo materialRetainedEquipmentInfo : list) {
@ -269,12 +266,9 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} /*else { }
// 材料员权限
list = filterList(list, username);
}*/
} }
long time7 = System.currentTimeMillis(); long time7 = System.currentTimeMillis();
System.err.println("过滤数据耗时time7 - time6" + (time7 - time6)); System.err.println("过滤数据耗时time7 - time6" + (time7 - time6));
@ -683,7 +677,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }

View File

@ -142,7 +142,7 @@ public class MaterialBackAppointmentServiceImpl implements MaterialBackAppointme
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -308,7 +308,7 @@ public class MaterialBackAppointmentServiceImpl implements MaterialBackAppointme
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }

View File

@ -140,7 +140,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream() sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getTeamLeaderIdCard()) || username.equals(item.getTeamLeaderIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getTeamLeaderIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -307,7 +307,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream() sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -484,7 +484,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream() sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -957,7 +957,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) { if (teamData != null) {
// 将list中班组身份证号与username相同的元素过滤处理 // 将list中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} /*else { } /*else {
// 材料员权限 // 材料员权限
@ -1464,7 +1464,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
List<LeaseTotalInfo> list = materialLeaseInfoMapper.getLeaseInfoDetails(info); List<LeaseTotalInfo> list = materialLeaseInfoMapper.getLeaseInfoDetails(info);
if (!hasSpecialRole) { if (!hasSpecialRole) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(list) && deptId != null) { if (!CollectionUtils.isEmpty(list) && deptId != null && teamData == null) {
// 删除元素 // 删除元素
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit())); list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
} }
@ -1474,7 +1474,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) { if (teamData != null) {
// 将list中班组身份证号与username相同的元素过滤处理 // 将list中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item ->StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }

View File

@ -76,7 +76,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
mergedList = mergedList.stream() mergedList = mergedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -182,7 +182,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null) { if (teamData != null) {
// usList 中班组身份证号与 username 相同的元素过滤处理 // usList 中班组身份证号与 username 相同的元素过滤处理
usList = usList.stream() usList = usList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -341,7 +341,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -439,7 +439,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
@ -523,7 +523,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null) { if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
list = list.stream() list = list.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
return getMaterialRetainedEquipmentInfo(list); return getMaterialRetainedEquipmentInfo(list);
@ -1396,7 +1396,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
if (teamData != null){ if (teamData != null){
// 将sortedList中班组身份证号与username相同的元素过滤处理 // 将sortedList中班组身份证号与username相同的元素过滤处理
recordList = recordList.stream() recordList = recordList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
for (MaterialStorageAndUseNumInfo record : recordList) { for (MaterialStorageAndUseNumInfo record : recordList) {
@ -1460,7 +1460,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
// 1. 过滤数据并行流加速大集合过滤 // 1. 过滤数据并行流加速大集合过滤
if (teamData != null) { if (teamData != null) {
recordList = recordList.parallelStream() recordList = recordList.parallelStream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isNotBlank(item.getIdCard()) && username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -11,6 +11,7 @@ import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.basic.domain.BmUnit; import com.bonus.material.basic.domain.BmUnit;
import com.bonus.material.basic.mapper.BmUnitMapper; import com.bonus.material.basic.mapper.BmUnitMapper;
import com.bonus.material.clz.domain.BmTeam; import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
import com.bonus.material.clz.service.MaterialLeaseInfoService; import com.bonus.material.clz.service.MaterialLeaseInfoService;
import com.bonus.material.common.domain.dto.SelectDto; import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo; import com.bonus.material.common.domain.vo.AgreementVo;
@ -324,6 +325,30 @@ public class SelectServiceImpl implements SelectService {
list = list.stream().filter(info -> projectIdList.contains(info.getProjectId())).collect(Collectors.toList()); list = list.stream().filter(info -> projectIdList.contains(info.getProjectId())).collect(Collectors.toList());
} }
} }
// 查询所有未结算的工程
List<String> projectIdList = mapper.getUnsettledProId();
// 使用 HashSet 来加速查找过程
Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
// 过滤掉不在未结算工程集合内的工程
Iterator<BmProject> iterator = list.iterator();
while (iterator.hasNext()) {
BmProject info = iterator.next();
String proId = info.getProId() != null ?
info.getProId().toString() : null;
if (proId == null || !unsettledProjectIds.contains(proId)) {
iterator.remove();
continue;
}
// 根据工程去机具协议表查询关联协议数据
List<MaterialRetainedEquipmentInfo> agreementIdList = mapper.getAgreementId(info.getProId().toString());
// 根据工程去材料站协议表查询关联协议数据
List<MaterialRetainedEquipmentInfo> storageAgreementIdList = mapper.getStorageAgreementId(info.getProId().toString());
// 如果获取的协议数据为空则移除该行数据
if (com.alibaba.nacos.common.utils.CollectionUtils.isEmpty(agreementIdList) && com.alibaba.nacos.common.utils.CollectionUtils.isEmpty(storageAgreementIdList)) {
iterator.remove();
}
}
} }
} }
} }

View File

@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus, bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus,
sda.dict_label as taskStatusName, sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum, IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lod.num),0) as alNum, IFNULL(sum(lad.al_num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart, bp.contract_part as contractPart,
sd.dept_name as impUnitName, sd.dept_name as impUnitName,
@ -67,8 +67,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lease_apply_info lai lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id left join lease_apply_details lad on lai.id = lad.parent_id
LEFT JOIN (SELECT parent_id,type_id ,IFNULL( sum( out_num ), 0 ) as num FROM lease_out_details
GROUP BY parent_id,type_id) lod ON lai.id = lod.parent_id and lad.type_id = lod.type_id
left join tm_task_agreement tta on lai.task_id = tta.task_id left join tm_task_agreement tta on lai.task_id = tta.task_id
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_unit bu on bu.unit_id = bai.unit_id left join bm_unit bu on bu.unit_id = bai.unit_id