From ec1d61de19f0fe6c3efc781e5d7a6af2ed65ae5d Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期二, 10 六月 2025 10:51:49 +0800 Subject: [PATCH] DNC 文档导入、回传文档、解析文档、取消原有设备 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java | 298 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 217 insertions(+), 81 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java index f266d1a..82587b2 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java @@ -1,25 +1,26 @@ package org.jeecg.modules.dnc.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; 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.dnc.request.ProcessStreamRequest; -import org.jeecg.modules.dnc.entity.*; +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; @@ -27,10 +28,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; @Service public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { @@ -40,16 +39,11 @@ @Autowired private IProcessInfoService processInfoService; @Autowired - private IPartsInfoService partsInfoService; + private IProcessSpecVersionService processSpecVersionService; @Autowired - private IDocInfoService docInfoService; + private IMdcEquipmentService mdcEquipmentService; @Autowired - @Lazy - private IDeviceInfoService deviceInfoService; - @Autowired - private INcLogInfoService iNcLogInfoService; - @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IProcessionDepartmentService processionDepartmentService; @Autowired @@ -58,10 +52,20 @@ 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<PermissionStreamNew> oldDepartPermList=new ArrayList<>(); if(stream == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(!ValidateUtil.validateString(stream.getProductId())) @@ -76,18 +80,19 @@ String userId = user.getId(); if(!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - if(ValidateUtil.validateString(stream.getPartsId())) { - PartsInfo partsInfo = partsInfoService.getById(stream.getPartsId()); - if(partsInfo == null) - ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE); - if(!stream.getProductId().equals(partsInfo.getProductId())) + 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(partsInfo.getComponentId())) + if(!stream.getComponentId().equals(psv.getComponentId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); - ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), partsInfo.getPartsId()); + 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) @@ -99,25 +104,58 @@ 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); - //娣诲姞鐢ㄦ埛鏉冮檺 - ProcessionPermission permission = new ProcessionPermission(); - permission.setProcessId(stream.getProcessId()); - permission.setUserId(userId); - processStreamPermissionService.save(permission); - //娣诲姞鏉冮檺楠岃瘉 - PermissionStream permissionStream = new PermissionStream(); - permissionStream.setUserId(userId); - permissionStream.setProductId(stream.getProductId()); - permissionStream.setComponentId(stream.getComponentId()); - if (StrUtil.isNotEmpty(stream.getPartsId())){ - permissionStream.setPartsId(stream.getPartsId()); + //娣诲姞閮ㄩ棬鏉冮檺 + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); + List<PermissionStreamNew> 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); + } } - permissionStream.setProcessId(stream.getProcessId()); - return permissionStreamService.save(permissionStream); + //娣诲姞鐢ㄦ埛鏉冮檺 + 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 @@ -135,18 +173,13 @@ stream.setComponentId(null); stream.setPartsId(null); stream.setProcessName(stream.getProcessName().toUpperCase()); - stream.setProcessCode(null); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(3); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("宸ュ簭鍙凤細"+en.getProcessCode()); - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); + stream.setProcessCode(stream.getProcessCode().toUpperCase()); boolean b = super.updateById(stream); + //鍚屾淇敼缁撴瀯鏍� + ProductMix productMix = productMixService.getById(Long.parseLong(id)); + productMix.setName(stream.getProcessName()); + productMix.setCode(stream.getProcessCode()); + productMixService.updateById(productMix); if(!b) ExceptionCast.cast(CommonCode.FAIL); ProcessInfo processInfo = new ProcessInfo(); @@ -169,10 +202,13 @@ ExceptionCast.cast(ProcessInfoCode.WORKSTEP_HAS_DATA); } //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","5").eq("attribution_id",id)); + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().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); } @@ -200,13 +236,13 @@ } @Override - public List<ProcessStream> findByPartsId(String partsId) { - return super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).list(); + public List<ProcessStream> findBypsvId(String psvId) { + return super.lambdaQuery().eq(ProcessStream::getPsvId, psvId).list(); } @Override - public ProcessStream findByProcessNoAndPartsId(String processNo, String partsId) { - List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).eq(ProcessStream::getProcessCode, processNo).list(); + public ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId) { + List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPsvId, psvsId).eq(ProcessStream::getProcessCode, processNo).list(); if(list == null || list.isEmpty()) return null; return list.get(0); @@ -224,8 +260,8 @@ public List<ProcessStream> validateDeviceProcessInfo(String pnCode, String deviceNo) { if(!ValidateUtil.validateString(pnCode) || !ValidateUtil.validateString(deviceNo)) ExceptionCast.cast(CommonCode.INVALID_PARAM); - DeviceInfo deviceInfo = deviceInfoService.getByDeviceNo(deviceNo); - if(deviceInfo == null) + MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(deviceNo); + if(mdcEquipment == null) ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); PermissionStream stream = componentInfoService.validateComponentOrPartsPnCode(pnCode); if(stream == null) @@ -272,7 +308,7 @@ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en == null) { @@ -281,14 +317,12 @@ en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(),item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - stream.setProcessId(processStream.getProcessId()); + stream.setBusinessId(processStream.getProcessId()); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -299,7 +333,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -324,14 +358,13 @@ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en != null) { processionDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId() - ,processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -343,7 +376,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -357,7 +390,7 @@ if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en == null) { @@ -366,14 +399,12 @@ en.setProcessId(processStream.getProcessId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - stream.setProcessId(processStream.getProcessId()); + stream.setBusinessId(processStream.getProcessId()); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -384,7 +415,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -398,13 +429,13 @@ if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -417,7 +448,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -425,4 +456,109 @@ return true; } + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘 + * 鐢靛瓙鏍锋澘鐩存帴鎸傚湪宸ュ簭涓� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByProcessStreamOtherFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<ProcessStream> 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<ProcessStream> list = super.list(queryWrapper); + List<DocInfo> 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<String> id =new ArrayList<>(); + id.add(treeInfoRequest.getAttributionId()); + treeInfoRequest.setProcessIds(id); + List<DocInfo> workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest); + docInfos.addAll(workSteps); + } + } + return docInfos; + } + + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByProcessStreamNCFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<ProcessStream> 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<ProcessStream> list = super.list(queryWrapper); + List<DocInfo> docInfos = new ArrayList<>(); + //NC鏂囦欢瀛樺湪瀵瑰簲鐨勮澶囩被涓嬶紝鎵�浠ラ渶瑕佽繃婊� + if (!list.isEmpty()) { + List<String> processIds = list.stream().map(ProcessStream::getProcessId).collect(Collectors.toList()); + List<DeviceType> deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(processIds, + DocAttributionTypeEnum.PROCESS.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); + if (deviceTypeList != null && !deviceTypeList.isEmpty()) { + List<String> deviceManagementIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); + DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); + BeanUtil.copyProperties(treeInfoRequest,docQuery); + docQuery.setAttributionIds(String.join(",",deviceManagementIds)); + docQuery.setDocClassCode("NC"); + docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ + List<String> id =new ArrayList<>(); + id.add(treeInfoRequest.getAttributionId()); + treeInfoRequest.setProcessIds(id); + List<DocInfo> docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); + docInfos.addAll(docInfoList); + } + return docInfos; + } + return null; + } + } -- Gitblit v1.9.3