材料员功能优化

This commit is contained in:
mashuai 2025-09-28 09:53:45 +08:00
parent 5e7dcea2d2
commit e194a430fe
3 changed files with 18 additions and 79 deletions

View File

@ -604,7 +604,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
public List<MaterialRetainedTeamTotalVo> getTeamNumList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
List<IwsTeamUserVo> iwsTeamUserVos = new ArrayList<>();
BmTeam teamData = new BmTeam();
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
@ -614,46 +613,24 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
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);
if (CollectionUtil.isNotEmpty(departId)) {
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getAllProjectList(departId);
if (CollectionUtil.isNotEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
}
}
}
}
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());
if (teamData == null) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (deptId != null) {
// 删除元素
teamNumList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
}
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
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);
@ -663,50 +640,6 @@ 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;
// }
/**
* 后台班组在用库存查询二级页面
* @param bean

View File

@ -873,6 +873,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="teamName != null and teamName != ''">
and bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
and bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
bu.unit_id,
bp.pro_id

View File

@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update sys_workflow_record set workflow_id = #{workflowId} where id = #{id}
</update>
<delete id="deleteSysWorkflowRecord">
delete from sys_workflow_record where task_id = #{taskId}
delete from sys_workflow_record where task_type = '25' AND task_id = #{taskId}
</delete>
<select id="getSysWorkflowRecodeByTaskId" parameterType="Integer" resultType="com.bonus.material.work.domain.dto.SysWorkflowAuditDto">
@ -142,6 +142,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
task_type as taskType,
task_code as taskCode
from sys_workflow_record
where task_id = #{id}
where task_type = '25' AND task_id = #{id}
</select>
</mapper>