From 1930b4e59d60c015ffa7bfee92e4bc227b90dcb3 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 28 五月 2025 15:41:41 +0800 Subject: [PATCH] 1.Dnc产品结构树检索nc文件 2.新增批次功能 3.新增审签查询流程 4.修改刀具系统查询 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java | 144 +++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 130 insertions(+), 14 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 b5e0bb4..bb050d9 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,5 +1,7 @@ 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; @@ -7,10 +9,13 @@ 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; @@ -22,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; @Service public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { @@ -49,6 +55,11 @@ private IProductMixService productMixService; @Autowired private IProductPermissionService productPermissionService; + @Autowired + @Lazy + private IDocInfoService docInfoService; + @Autowired + private IDeviceTypeService deviceTypeService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -80,7 +91,7 @@ if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } - oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(),"4","1"); + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(), DocAttributionTypeEnum.OPERATION.getCode().toString(),"1"); }else { ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId()); if(componentInfo == null) @@ -92,7 +103,7 @@ if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } - oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); } boolean b = super.save(stream); if(!b) @@ -109,7 +120,7 @@ PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); perm.setBusinessId(stream.getProcessId()); - perm.setBusinessType("5"); + perm.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(perm); }); if(!processionDepartmentList.isEmpty()) { @@ -124,7 +135,7 @@ } } //娣诲姞鐢ㄦ埛鏉冮檺 - b = productPermissionService.add(stream.getProcessId(), userId,"5"); + b = productPermissionService.add(stream.getProcessId(), userId,DocAttributionTypeEnum.PROCESS.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } @@ -132,17 +143,17 @@ ProductMix productMix; if (stream.getPsvId() != null) { productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPsvId()) - ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); + ,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(),5,new Date()); + ,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("5"); + permissionStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(permissionStream); } @@ -190,7 +201,7 @@ 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); } @@ -305,12 +316,12 @@ en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); + 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("5"); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -352,7 +363,7 @@ if(en != null) { processionDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -387,12 +398,12 @@ en.setProcessId(processStream.getProcessId()); permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); + 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("5"); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -423,7 +434,7 @@ if(en != null) { permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -444,4 +455,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> processSpecVersions = workStepService.getByWorkStepOtherFile(treeInfoRequest); + docInfos.addAll(processSpecVersions); + } + } + 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