This commit is contained in:
parent
cadfdc6cdc
commit
0ae0d50578
|
|
@ -590,34 +590,53 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
@Override
|
||||
public List<MaterialRetainedTeamTotalVo> getTeamNumList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<MaterialRetainedTeamTotalVo> teamNumList = materialMachineMapper.getTeamNumList(bean);
|
||||
if (!CollectionUtils.isEmpty(departId)) {
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
List<BmProject> list = mapper.getProjectInfo(new BmProject());
|
||||
if (CollectionUtils.isNotEmpty(list) && CollectionUtils.isNotEmpty(projectIdList)) {
|
||||
// 找出list中projectId与projectIdList中相同的数据
|
||||
list = list.stream().filter(info -> projectIdList.contains(info.getProjectId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 获取list中的projectId
|
||||
List<String> collect = list.stream().map(BmProject::getProjectId).distinct().collect(Collectors.toList());
|
||||
// 根据i8工程id查询班组信息
|
||||
List<IwsTeamUserVo> iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(collect);
|
||||
if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) {
|
||||
if (CollectionUtil.isNotEmpty(teamNumList)) {
|
||||
// 筛选出teamNumList中班组名称和iwsTeamUserVos中班组名称相同的数据
|
||||
teamNumList = teamNumList.stream().filter(item -> iwsTeamUserVos.stream().anyMatch(info -> info.getTeamName().equals(item.getTeamName()))).collect(Collectors.toList());
|
||||
}
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
List<IwsTeamUserVo> iwsTeamUserVos = new ArrayList<>();
|
||||
BmTeam teamData = new BmTeam();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getAllProjectList(departId);
|
||||
List<BmProject> list = mapper.getProjectInfo(new BmProject());
|
||||
if (CollectionUtils.isNotEmpty(list) && CollectionUtils.isNotEmpty(projectIdList)) {
|
||||
// 找出list中projectId与projectIdList中相同的数据
|
||||
list = list.stream().filter(info -> projectIdList.contains(info.getProjectId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 获取list中的projectId
|
||||
List<String> collect = list.stream().map(BmProject::getProjectId).distinct().collect(Collectors.toList());
|
||||
// 根据i8工程id查询班组信息
|
||||
iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(collect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (CollectionUtils.isNotEmpty(teamNumList)) {
|
||||
List<MaterialRetainedTeamTotalVo> teamNumList = materialMachineMapper.getTeamNumList(bean);
|
||||
for (MaterialRetainedTeamTotalVo materialRetainedEquipmentInfo : teamNumList) {
|
||||
// 根据班组名称查询分包单位
|
||||
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
|
||||
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
|
||||
}
|
||||
if(bean.getSubUnitName()!=null && !bean.getSubUnitName().equals("") && !teamNumList.isEmpty()){
|
||||
// 根据传入的SubUnitName过滤列表
|
||||
teamNumList = teamNumList.stream()
|
||||
.filter(item -> StringUtils.equals(item.getSubUnitName(), bean.getSubUnitName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (!hasSpecialRole) {
|
||||
if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) {
|
||||
if (CollectionUtil.isNotEmpty(teamNumList)) {
|
||||
// 筛选出teamNumList中班组名称和iwsTeamUserVos中班组名称相同的数据
|
||||
List<IwsTeamUserVo> finalIwsTeamUserVos = iwsTeamUserVos;
|
||||
teamNumList = teamNumList.stream().filter(item -> finalIwsTeamUserVos.stream().anyMatch(info -> info.getTeamName().equals(item.getTeamName()))).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (deptId != null) {
|
||||
// 删除元素
|
||||
teamNumList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
|
|
@ -630,6 +649,48 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
}
|
||||
return teamNumList;
|
||||
}
|
||||
// public List<MaterialRetainedTeamTotalVo> getTeamNumList(MaterialRetainedEquipmentInfo bean) {
|
||||
// String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// // 根据用户名查询项目部信息
|
||||
// List<String> departId = mapper.getDepartId(username);
|
||||
// // 根据项目部id查询工程信息
|
||||
// List<MaterialRetainedTeamTotalVo> teamNumList = materialMachineMapper.getTeamNumList(bean);
|
||||
// if (!CollectionUtils.isEmpty(departId)) {
|
||||
// List<String> projectIdList = mapper.getProjectId(departId);
|
||||
// List<BmProject> list = mapper.getProjectInfo(new BmProject());
|
||||
// if (CollectionUtils.isNotEmpty(list) && CollectionUtils.isNotEmpty(projectIdList)) {
|
||||
// // 找出list中projectId与projectIdList中相同的数据
|
||||
// list = list.stream().filter(info -> projectIdList.contains(info.getProjectId())).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isNotEmpty(list)) {
|
||||
// // 获取list中的projectId
|
||||
// List<String> collect = list.stream().map(BmProject::getProjectId).distinct().collect(Collectors.toList());
|
||||
// // 根据i8工程id查询班组信息
|
||||
// List<IwsTeamUserVo> iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(collect);
|
||||
// if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) {
|
||||
// if (CollectionUtil.isNotEmpty(teamNumList)) {
|
||||
// // 筛选出teamNumList中班组名称和iwsTeamUserVos中班组名称相同的数据
|
||||
// teamNumList = teamNumList.stream().filter(item -> iwsTeamUserVos.stream().anyMatch(info -> info.getTeamName().equals(item.getTeamName()))).collect(Collectors.toList());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 根据用户名判断用户是否为班组长
|
||||
// BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
// Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
// if (CollectionUtils.isNotEmpty(teamNumList)) {
|
||||
// if (deptId != null) {
|
||||
// // 删除元素
|
||||
// teamNumList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
// }
|
||||
// if (teamData != null) {
|
||||
// return teamNumList.stream().filter(item -> {
|
||||
// return StringUtils.isNotBlank(item.getIdCard()) && item.getIdCard().equals(username);
|
||||
// }).collect(Collectors.toList());
|
||||
// }
|
||||
// }
|
||||
// return teamNumList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 后台班组在用库存查询二级页面
|
||||
|
|
|
|||
Loading…
Reference in New Issue