package org.jeecg.modules.dnc.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.ProcessStreamMapper; import org.jeecg.modules.dnc.request.DocInfoQueryRequest; import org.jeecg.modules.dnc.request.ProcessStreamRequest; import org.jeecg.modules.dnc.request.TreeInfoRequest; import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; @Service public class ProcessStreamServiceImpl extends ServiceImpl implements IProcessStreamService { @Autowired @Lazy private IComponentInfoService componentInfoService; @Autowired private IProcessInfoService processInfoService; @Autowired private IProcessSpecVersionService processSpecVersionService; @Autowired private IMdcEquipmentService mdcEquipmentService; @Autowired private IPermissionStreamNewService permissionStreamNewService; @Autowired private IProcessionDepartmentService processionDepartmentService; @Autowired private IWorkStepService workStepService; @Autowired private IDocRelativeService iDocRelativeService; @Autowired private IProcessStreamPermissionService processStreamPermissionService; @Autowired private IProductMixService productMixService; @Autowired private IProductPermissionService productPermissionService; @Autowired @Lazy private IDocInfoService docInfoService; @Autowired private IDeviceTypeService deviceTypeService; @Override @Transactional(rollbackFor = {Exception.class}) public boolean addProcessStream(ProcessStream stream) { List oldDepartPermList=new ArrayList<>(); if(stream == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(!ValidateUtil.validateString(stream.getProductId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); if(!ValidateUtil.validateString(stream.getComponentId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); if(!ValidateUtil.validateString(stream.getProcessName())) ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); if(!ValidateUtil.validateString(stream.getProcessCode())) ExceptionCast.cast(ProcessInfoCode.PROCESS_CODE_NONE); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); if(!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); if(ValidateUtil.validateString(stream.getPsvId())) { ProcessSpecVersion psv = processSpecVersionService.getById(stream.getPsvId()); if(psv == null) ExceptionCast.cast(ProcessInfoCode.PROCESSSPECVERSION_NONE); if(!stream.getProductId().equals(psv.getProductId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); if(!stream.getComponentId().equals(psv.getComponentId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), psv.getId()); if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(), DocAttributionTypeEnum.OPERATION.getCode().toString(),"1"); }else { ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId()); if(componentInfo == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); if(!stream.getProductId().equals(componentInfo.getProductId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); stream.setPartsId(null); ProcessStream en = findByProcessNoAndComponentId(stream.getProcessCode(), componentInfo.getComponentId()); if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); } boolean b = super.save(stream); if(!b) ExceptionCast.cast(CommonCode.FAIL); //添加部门权限 if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { List processionDepartmentList = new ArrayList<>(); List permissionStreamList = new ArrayList<>(); oldDepartPermList.forEach(item -> { ProcessionDepartment pd = new ProcessionDepartment(); pd.setDepartId(item.getDepartId()); pd.setProcessId(stream.getProcessId()); processionDepartmentList.add(pd); PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); perm.setBusinessId(stream.getProcessId()); perm.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(perm); }); if(!processionDepartmentList.isEmpty()) { b = processionDepartmentService.saveBatch(processionDepartmentList); if(!b) ExceptionCast.cast(CommonCode.FAIL); } if(!permissionStreamList.isEmpty()) { b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) ExceptionCast.cast(CommonCode.FAIL); } } //添加用户权限 b = productPermissionService.add(stream.getProcessId(), userId,DocAttributionTypeEnum.PROCESS.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //添加结构树 ProductMix productMix; if (stream.getPsvId() != null) { productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPsvId()) ,stream.getProcessName(),stream.getProcessCode(),DocAttributionTypeEnum.PROCESS.getCode(),new Date()); }else { productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getComponentId()) ,stream.getProcessName(),stream.getProcessCode(),DocAttributionTypeEnum.PROCESS.getCode(),new Date()); } productMixService.save(productMix); //添加权限验证 PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setUserId(userId); permissionStream.setBusinessId(stream.getProcessId()); permissionStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(permissionStream); } @Override @Transactional(rollbackFor = {Exception.class}) public boolean editProcessStream(String id, ProcessStream stream) { if(!ValidateUtil.validateString(id) || stream == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(!ValidateUtil.validateString(stream.getProcessName())) ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); ProcessStream en = super.getById(id); if(en == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); stream.setProcessId(id); stream.setProductId(null); stream.setComponentId(null); stream.setPartsId(null); stream.setProcessName(stream.getProcessName().toUpperCase()); stream.setProcessCode(stream.getProcessCode().toUpperCase()); boolean b = super.updateById(stream); //同步修改结构树 ProductMix productMix = productMixService.getById(Long.parseLong(id)); productMix.setTreeName(stream.getProcessName()); productMix.setTreeCode(stream.getProcessCode()); productMixService.updateById(productMix); if(!b) ExceptionCast.cast(CommonCode.FAIL); ProcessInfo processInfo = new ProcessInfo(); processInfo.setProcessName(stream.getProcessName()); processInfo.setDescription(stream.getDescription()); return processInfoService.addOrEdit(processInfo); } @Override @Transactional(rollbackFor = {Exception.class}) public boolean deleteProcessStream(String id) { if(!ValidateUtil.validateString(id)) ExceptionCast.cast(CommonCode.INVALID_PARAM); ProcessStream en = super.getById(id); if(en == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); //验证工序下是否有工步 List workStepList=workStepService.list(new QueryWrapper().eq("process_id",id)); if(workStepList != null && !workStepList.isEmpty()) { ExceptionCast.cast(ProcessInfoCode.WORKSTEP_HAS_DATA); } //验证是否存在文档 List docRelativeList=iDocRelativeService.list(new QueryWrapper().eq("attribution_type",DocAttributionTypeEnum.PROCESS.getCode().toString()).eq("attribution_id",id)); if (!docRelativeList.isEmpty()){ ExceptionCast.cast(ProcessInfoCode.PROCESS_HAS_DOC); } boolean b = productMixService.removeById(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); return super.removeById(id); } @Override public List findByNodeParams(ProcessStreamRequest request) { if(request == null || !ValidateUtil.validateString(request.getProductId()) || !ValidateUtil.validateString(request.getComponentId())) return Collections.emptyList(); LambdaQueryChainWrapper lambdaQuery = super.lambdaQuery().eq(ProcessStream::getProductId, request.getProductId()).eq(ProcessStream::getComponentId, request.getComponentId()); if(ValidateUtil.validateString(request.getPartsId())) { lambdaQuery.eq(ProcessStream::getPartsId, request.getPartsId()); }else { lambdaQuery.isNull(ProcessStream::getPartsId); } return lambdaQuery.list(); } @Override public List findByProductId(String productId) { return super.lambdaQuery().eq(ProcessStream::getProductId, productId).list(); } @Override public List findByComponentId(String componentId) { return super.lambdaQuery().eq(ProcessStream::getComponentId, componentId).list(); } @Override public List findBypsvId(String psvId) { return super.lambdaQuery().eq(ProcessStream::getPsvId, psvId).list(); } @Override public ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId) { List list = super.lambdaQuery().eq(ProcessStream::getPsvId, psvsId).eq(ProcessStream::getProcessCode, processNo).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } @Override public ProcessStream findByProcessNoAndComponentId(String processNo, String componentId) { List list = super.lambdaQuery().eq(ProcessStream::getComponentId, componentId).eq(ProcessStream::getProcessCode, processNo).list(); if(list == null || list.isEmpty()) return null; return list.get(0); } @Override public List validateDeviceProcessInfo(String pnCode, String deviceNo) { if(!ValidateUtil.validateString(pnCode) || !ValidateUtil.validateString(deviceNo)) ExceptionCast.cast(CommonCode.INVALID_PARAM); MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(deviceNo); if(mdcEquipment == null) ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); PermissionStream stream = componentInfoService.validateComponentOrPartsPnCode(pnCode); if(stream == null) ExceptionCast.cast(ComponentInfoCode.COMPONENT_PN_NOT_EXIST); LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(ProcessStream::getProductId, stream.getProductId()); lambdaQueryWrapper.eq(ProcessStream::getComponentId, stream.getComponentId()); if(ValidateUtil.validateString(stream.getPartsId())) { lambdaQueryWrapper.eq(ProcessStream::getPartsId, stream.getPartsId()); } lambdaQueryWrapper.like(ProcessStream::getProcessingEquipmentCode, deviceNo); List list = super.list(lambdaQueryWrapper); if(list == null || list.isEmpty()) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); return list; } @Override public List getByuserPerms(String userId){ if(!ValidateUtil.validateString(userId)) return Collections.emptyList(); return super.getBaseMapper().getByUserPerms(userId); } @Override public List getByuserPerms(String userId,String queryParam){ if(!ValidateUtil.validateString(userId)) return Collections.emptyList(); if(!ValidateUtil.validateString(queryParam)) return Collections.emptyList(); LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); if(ValidateUtil.validateString(queryParam)) { queryWrapper.and(wrapper->wrapper.like(ProcessStream::getProcessName, queryParam) .or() .like(ProcessStream::getProcessName, queryParam)); } queryWrapper.orderByAsc(ProcessStream::getCreateTime); return super.list(queryWrapper); } @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddDepart(ProcessStream processStream, Collection departmentList) { if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List processionDepartmentList = new ArrayList<>(); List permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en == null) { en = new ProcessionDepartment(); en.setDepartId(item.getId()); en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(processStream.getProcessId()); stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); if(!processionDepartmentList.isEmpty()) { boolean b = processionDepartmentService.saveBatch(processionDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } @Override public List getByComponentIdList(String productId, List componentIds, List partsIds) { return super.baseMapper.findByPartsAndComponents(productId,componentIds,partsIds); } /** * 分配部门权限 * @param processStream * @param departmentList * @return */ @Override public boolean assignRemoveDepart(ProcessStream processStream, Collection departmentList){ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List processionDepartmentList = new ArrayList<>(); List permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en != null) { processionDepartmentList.add(en); } PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } }); if(!processionDepartmentList.isEmpty()) { boolean b = processionDepartmentService.removeByCollection(processionDepartmentList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddUser(ProcessStream processStream, Collection userList) { if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List permissionList = new ArrayList<>(); List permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en == null) { en = new ProcessionPermission(); en.setUserId(item.getId()); en.setProcessId(processStream.getProcessId()); permissionList.add(en); } PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(processStream.getProcessId()); stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); if(!permissionList.isEmpty()) { boolean b = processStreamPermissionService.saveBatch(permissionList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignRemoveUser(ProcessStream processStream, Collection userList) { if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List permissionList = new ArrayList<>(); List permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en != null) { permissionList.add(en); } PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } }); //清空用户权限校验 if(!permissionList.isEmpty()) { boolean b = processStreamPermissionService.removeByCollection(permissionList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } if(!permissionStreamList.isEmpty()) { boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } } return true; } /** * 通过工序号、工序名称等查询对应电子样板 * 电子样板直接挂在工序下 * @param treeInfoRequest * @return */ @Override public List getByProcessStreamOtherFile(TreeInfoRequest treeInfoRequest){ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { queryWrapper.in(ProcessStream::getProductId, treeInfoRequest.getProductIds()); } if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { queryWrapper.in(ProcessStream::getComponentId, treeInfoRequest.getComponentIds()); } if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { queryWrapper.in(ProcessStream::getPartsId, treeInfoRequest.getPartsIds()); } if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { queryWrapper.in(ProcessStream::getPsvId, treeInfoRequest.getPsvIds()); } if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessStream::getProcessId,treeInfoRequest.getAttributionId()); } queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessStream::getProcessName, treeInfoRequest.getTreeName()); queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessStream::getProcessCode, treeInfoRequest.getTreeName()); queryWrapper.orderByDesc(ProcessStream::getCreateTime); List list = super.list(queryWrapper); List docInfos; if (list == null || list.isEmpty() || StrUtil.isNotBlank(treeInfoRequest.getStructureType())){ return new ArrayList<>(); }else { String ids=list.stream().map(ProcessStream::getProcessId).collect(Collectors.joining(",")); DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(ids); docQuery.setDocClassCode("OTHER"); docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); docInfos=docInfoService.findListByDocQuery(docQuery); if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ List id =new ArrayList<>(); id.add(treeInfoRequest.getAttributionId()); treeInfoRequest.setProcessIds(id); List workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest); docInfos.addAll(workSteps); } } return docInfos; } /** * 通过工序号、工序名称等查询对应NC文件 * NC文件存在设备类下面 * @param treeInfoRequest * @return */ @Override public List getByProcessStreamNCFile(TreeInfoRequest treeInfoRequest){ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { queryWrapper.in(ProcessStream::getProductId, treeInfoRequest.getProductIds()); } if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { queryWrapper.in(ProcessStream::getComponentId, treeInfoRequest.getComponentIds()); } if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { queryWrapper.in(ProcessStream::getPartsId, treeInfoRequest.getPartsIds()); } if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { queryWrapper.in(ProcessStream::getPsvId, treeInfoRequest.getPsvIds()); } if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessStream::getProcessId,treeInfoRequest.getAttributionId()); } queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessStream::getProcessName, treeInfoRequest.getTreeName()); queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessStream::getProcessCode, treeInfoRequest.getTreeName()); queryWrapper.orderByDesc(ProcessStream::getCreateTime); List list = super.list(queryWrapper); List docInfos = new ArrayList<>(); //NC文件存在对应的设备类下,所以需要过滤 if (!list.isEmpty()) { List processIds = list.stream().map(ProcessStream::getProcessId).collect(Collectors.toList()); List deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(processIds, DocAttributionTypeEnum.PROCESS.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); if (deviceTypeList != null && !deviceTypeList.isEmpty()) { List deviceTypeIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(String.join(",",deviceTypeIds)); docQuery.setDocClassCode("NC"); docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); docInfos=docInfoService.findListByDocQuery(docQuery); } if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ List id =new ArrayList<>(); id.add(treeInfoRequest.getAttributionId()); treeInfoRequest.setProcessIds(id); List docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); docInfos.addAll(docInfoList); }else { treeInfoRequest.setProcessIds(processIds); List docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); docInfos.addAll(docInfoList); } return docInfos; } return null; } }