fix(smartfactory): 修复工厂主管权限查询时的空指针异常
- 在 HandlingGroupAmountSpecificationsServiceImpl 类中,增加了对 factoryId 不为空的过滤 - 修复了在 getHandlingGroupAmountSpecificationsPage 和 getTotalNum 方法中可能发生的空指针异常 - 优化了代码逻辑,提高了系统稳定性
This commit is contained in:
parent
ca80611f91
commit
6cf49d88b1
@ -15,7 +15,6 @@ import cn.iocoder.yudao.module.smartfactory.service.handlingspecifications.Handl
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -69,8 +68,9 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
public PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
if (CollUtil.isNotEmpty(deptRespDTOS)) {
|
||||
pageReqVO.setFactoryIds(deptRespDTOS.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
List<DeptRespDTO> factoryDeptVOs = deptRespDTOS.stream().filter(item -> item.getFactoryId() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(factoryDeptVOs)) {
|
||||
pageReqVO.setFactoryIds(factoryDeptVOs.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
IPage<HandlingGroupAmountSpecificationsDO> pageResult = handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsPage(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
|
||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||
@ -170,8 +170,9 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(getLoginUserId()).getCheckedData();
|
||||
if (CollUtil.isNotEmpty(deptRespDTOS)) {
|
||||
dto.setFactoryIds(deptRespDTOS.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
List<DeptRespDTO> factoryDeptVOs = deptRespDTOS.stream().filter(item -> item.getFactoryId() != null).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(factoryDeptVOs)) {
|
||||
dto.setFactoryIds(factoryDeptVOs.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return handlingGroupAmountSpecificationsMapper.getTotalNum(dto);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user