From 73be743ff89b54fa14fb07afa72e6d833406a381 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期一, 16 六月 2025 16:49:09 +0800
Subject: [PATCH] 工具管理-调整参数导入增加集团公司编码、标记、工具简称字段
---
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java | 271 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 207 insertions(+), 64 deletions(-)
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
index d289e58..6a6c10f 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -11,6 +11,7 @@
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum;
import org.jeecg.modules.dnc.dto.ComponentExt;
import org.jeecg.modules.dnc.entity.*;
import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -87,6 +88,10 @@
@Autowired
@Lazy
private IDocInfoService docInfoService;
+ @Autowired
+ private IDeviceTypeService deviceTypeService;
+ @Autowired
+ private IDeviceManagementService deviceManagementService;
@Override
@Transactional(rollbackFor = {Exception.class})
@@ -130,7 +135,7 @@
PermissionStreamNew stream = new PermissionStreamNew();
stream.setBusinessId(productInfo.getProductId());
stream.setDepartId(departId);
- stream.setBusinessType("1");
+ stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString());
permissionStreamNewService.save(stream);
}
}
@@ -138,7 +143,7 @@
PermissionStreamNew stream = new PermissionStreamNew();
stream.setBusinessId(productInfo.getProductId());
stream.setUserId(userId);
- stream.setBusinessType("1");
+ stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString());
return permissionStreamNewService.addPermissionStreamNew(stream);
}
@@ -159,8 +164,8 @@
boolean b = super.updateById(productInfo);
//鍚屾淇敼缁撴瀯鏍�
ProductMix productMix = productMixService.getById(Long.parseLong(id));
- productMix.setName(productInfo.getProductName());
- productMix.setCode(productInfo.getProductNo());
+ productMix.setTreeName(productInfo.getProductName());
+ productMix.setTreeCode(productInfo.getProductNo());
productMixService.updateById(productMix);
if (!b)
return false;
@@ -174,12 +179,12 @@
return false;
}
}
- PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, "1");
+ PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, DocAttributionTypeEnum.PRODUCT.getCode().toString());
if (stream == null) {
stream = new PermissionStreamNew();
stream.setBusinessId(productInfo.getProductId());
stream.setUserId(userId);
- stream.setBusinessType("1");
+ stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString());
return permissionStreamNewService.save(stream);
}
return b;
@@ -258,7 +263,7 @@
ExceptionCast.cast(ProductInfoCode.PRODUCT_PROCESS_EXIST);
boolean b = productPermissionService.deleteByProductId(id);
//楠岃瘉鏄惁瀛樺湪鏂囨。
- List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", "1").eq("attribution_id", id));
+ List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", DocAttributionTypeEnum.PRODUCT.getCode() ).eq("attribution_id", id));
if (!docRelativeList.isEmpty()) {
ExceptionCast.cast(ProductInfoCode.PRODUCT_DOC_EXIST);
}
@@ -267,10 +272,10 @@
b = productDepartmentService.deleteByProductId(id);
if (!b)
ExceptionCast.cast(CommonCode.FAIL);
- b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","0");
+ b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"0");
if (!b)
ExceptionCast.cast(CommonCode.FAIL);
- b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","1");
+ b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1");
if (!b)
ExceptionCast.cast(CommonCode.FAIL);
b = productMixService.removeById(id);
@@ -287,37 +292,37 @@
String userId = user.getId();
if (!ValidateUtil.validateString(userId))
ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST);
- if (nodeType == 1) {
+ if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) {
ProductInfo productInfo = super.getById(paramId);
if (productInfo == null)
ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST);
PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(paramId, userId,"1");
return permission != null;
- } else if (nodeType == 2) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) {
ComponentInfo componentInfo = componentInfoService.getById(paramId);
if (componentInfo == null)
ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST);
PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(componentInfo.getComponentId(), userId,"2");
return permission != null;
- } else if (nodeType == 3) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) {
PartsInfo partsInfo = partsInfoService.getById(paramId);
if (partsInfo == null)
ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), userId, "3");
return permission != null;
- } else if (nodeType == 4) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) {
ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId);
if (processSpecVersion == null)
ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST);
PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(),userId,"4");
return permission != null;
- } else if (nodeType == 5) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) {
ProcessStream processStream = processStreamService.getById(paramId);
if (processStream == null)
ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST);
PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), userId,"5");
return permission != null;
- } else if (nodeType == 6) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) {
WorkStep workStep = workStepService.getById(paramId);
if (workStep == null)
ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST);
@@ -331,17 +336,17 @@
public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) {
if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId))
return null;
- if (nodeType == 1) {
+ if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) {
return productPermissionService.getUserPermsByProductId(paramId);
- } else if (nodeType == 2) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) {
return componentPermissionService.getUserPermsByComponentId(paramId);
- } else if (nodeType == 3) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) {
return partsPermissionService.getUserPermsByProductId(paramId);
- } else if (nodeType == 4) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) {
return processSpecVersionPermissionService.getUserPermsByProductId(paramId);
- } else if (nodeType == 5) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) {
return iProcessStreamPermissionService.getUserPermsByProductId(paramId);
- } else if (nodeType == 6) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) {
return iWorkStepPermissionService.getUserPermsByProductId(paramId);
} else {
return null;
@@ -352,17 +357,17 @@
public List<SysUser> getUserNonPermsList(Integer nodeType, String paramId) {
if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId))
return null;
- if (nodeType == 1) {
+ if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) {
return productPermissionService.getUserNonPermsByProductId(paramId);
- } else if (nodeType == 2) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){
return componentPermissionService.getUserNonPermsByComponentId(paramId);
- } else if (nodeType == 3) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) {
return partsPermissionService.getUserNonPermsByProductId(paramId);
- } else if (nodeType == 4) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) {
return processSpecVersionPermissionService.getUserNonPermsByProductId(paramId);
- } else if (nodeType == 5) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) {
return iProcessStreamPermissionService.getUserNonPermsByProductId(paramId);
- } else if (nodeType == 6) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) {
return iWorkStepPermissionService.getUserNonPermsByProductId(paramId);
} else {
return null;
@@ -373,17 +378,17 @@
public List<MdcProduction> getDepartPermsList(Integer nodeType, String paramId) {
if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId))
return null;
- if (nodeType == 1) {
+ if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) {
return productDepartmentService.getDepartPermsByProductId(paramId);
- } else if (nodeType == 2) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){
return componentDepartmentService.getDepartPermsByComponentId(paramId);
- } else if (nodeType == 3) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) {
return partsDepartmentService.getDepartPermsByPartsId(paramId);
- } else if (nodeType == 4) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) {
return processSpecVersionDepartmentService.getDepartPermsByPsvId(paramId);
- }else if (nodeType == 5) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) {
return processionDepartmentService.getDepartPermsByProcessId(paramId);
- } else if (nodeType == 6) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) {
return workStepDepartmentService.getDepartPermsByStepId(paramId);
}
else {
@@ -395,17 +400,17 @@
public List<MdcProduction> getDepartNonPermsList(Integer nodeType, String paramId) {
if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId))
return null;
- if (nodeType == 1) {
+ if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) {
return productDepartmentService.getDepartNonPermsByProductId(paramId);
- } else if (nodeType == 2) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){
return componentDepartmentService.getDepartNonPermsByComponentId(paramId);
- } else if (nodeType == 3) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) {
return partsDepartmentService.getDepartNonPermsByProductId(paramId);
- } else if (nodeType == 4) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) {
return processionDepartmentService.getDepartNonPermsByProcessId(paramId);
- } else if (nodeType == 5) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) {
return processionDepartmentService.getDepartNonPermsByProcessId(paramId);
- } else if (nodeType == 6) {
+ } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) {
return workStepDepartmentService.getDepartNonPermsByStepId(paramId);
} else {
return null;
@@ -417,6 +422,7 @@
* @param paramId 浜у搧鏍戣妭鐐筰d
* @param relativeFlag 1 鏄� 2 鍚�
* @param userIds 娣诲姞鐢ㄦ埛ids
+ * todo浼樺寲缁撴瀯锛岄噰鐢╩ix琛ㄨ繘琛岀埗瀛愰�掑綊鏌ヨ锛屽垎绫昏繘琛屾潈闄愬垎閰嶏紙鍗曡〃鏌ヨ锛�
* @return
*/
@Override
@@ -452,6 +458,7 @@
* @param paramId 浜у搧鏍戣妭鐐筰d
* @param relativeFlag 1 鏄� 2 鍚�
* @param departmentIds 娣诲姞閮ㄩ棬ids
+ * todo浼樺寲缁撴瀯锛岄噰鐢╩ix琛ㄨ繘琛岀埗瀛愰�掑綊鏌ヨ锛屽垎绫昏繘琛屾潈闄愬垎閰嶏紙鍗曡〃鏌ヨ锛�
* @return
*/
@Override
@@ -487,6 +494,7 @@
* @param paramId 浜у搧鏍戣妭鐐筰d
* @param relativeFlag 1 鏄� 2 鍚�
* @param userIds 绉婚櫎鐢ㄦ埛ids
+ * todo浼樺寲缁撴瀯锛岄噰鐢╩ix琛ㄨ繘琛岀埗瀛愰�掑綊鏌ヨ锛屽垎绫昏繘琛屾潈闄愬垎閰嶏紙鍗曡〃鏌ヨ锛�
* @return
*/
@Override
@@ -521,6 +529,7 @@
* @param paramId 浜у搧鏍戣妭鐐筰d
* @param relativeFlag 1 鏄� 2 鍚�
* @param departmentIds 绉婚櫎閮ㄩ棬ids
+ * todo浼樺寲缁撴瀯锛岄噰鐢╩ix琛ㄨ繘琛岀埗瀛愰�掑綊鏌ヨ锛屽垎绫昏繘琛屾潈闄愬垎閰嶏紙鍗曡〃鏌ヨ锛�
* @return
*/
@Override
@@ -570,7 +579,7 @@
stream = new PermissionStreamNew();
stream.setUserId(item.getId());
stream.setBusinessId(productInfo.getProductId());
- stream.setBusinessType("1");
+ stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString());
permissionStreamList.add(stream);
}
});
@@ -645,7 +654,7 @@
stream = new PermissionStreamNew();
stream.setDepartId(item.getId());
stream.setBusinessId(productInfo.getProductId());
- stream.setBusinessType("1");
+ stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString());
permissionStreamList.add(stream);
}
});
@@ -700,7 +709,7 @@
public List<String> getDepartIdsByParams(Integer nodeType, String paramId) {
List<String> departIds = new ArrayList<>();
//5-宸ュ簭
- if (nodeType == 5) {
+ if (Objects.equals(nodeType, DocAttributionTypeEnum.PROCESS.getCode())) {
ProcessStream processStream = processStreamService.getById(paramId);
if (processStream == null)
return null;
@@ -711,7 +720,7 @@
departIds.add(item.getDepartId());
});
//6-宸ユ
- } else if (nodeType == 6) {
+ } else if (Objects.equals(nodeType, DocAttributionTypeEnum.WORKSITE.getCode())) {
WorkStep workStep = workStepService.getById(paramId);
if (workStep == null)
return null;
@@ -755,7 +764,7 @@
@Override
public List<CommonGenericTree> loadTree(String userId, Integer nodeType, String paramId) {
- if (nodeType == 1) {
+ if (Objects.equals(nodeType, DocAttributionTypeEnum.PRODUCT.getCode())) {
List<ComponentInfo> componentInfoList = componentInfoService.getByProductIdAndUserId(paramId, userId);
if (componentInfoList == null || componentInfoList.isEmpty())
return Collections.emptyList();
@@ -768,13 +777,13 @@
node.setLabel(c.getComponentName());
node.setParentId(c.getProductId());
node.setIconClass("");
- node.setType(2);
+ node.setType(DocAttributionTypeEnum.COMPONENT.getCode());
node.setRField(c.getProductId());
node.setEntity(c);
list.add(node);
}
return list;
- } else if (nodeType == 2) {
+ } else if (Objects.equals(nodeType, DocAttributionTypeEnum.COMPONENT.getCode())) {
List<ComponentInfo> componentInfoList = componentInfoService.getByParentIdAndUserId(paramId, userId);
List<CommonGenericTree> list = new ArrayList<>();
CommonGenericTree<ComponentInfo> componentNode;
@@ -786,7 +795,7 @@
componentNode.setLabel(c.getComponentName());
componentNode.setParentId(c.getParentId());
componentNode.setIconClass("");
- componentNode.setType(2);
+ componentNode.setType(DocAttributionTypeEnum.COMPONENT.getCode());
componentNode.setRField(c.getProductId());
componentNode.setEntity(c);
list.add(componentNode);
@@ -803,7 +812,7 @@
partNode.setLabel(part.getPartsName());
partNode.setParentId(part.getComponentId());
partNode.setIconClass("");
- partNode.setType(3);
+ partNode.setType(DocAttributionTypeEnum.PARTS.getCode());
partNode.setRField(part.getComponentId());
partNode.setEntity(part);
partNode.setLeaf(true);
@@ -1036,7 +1045,6 @@
if (treeInfoRequest.getAttributionType() == 1 && StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) {
queryWrapper.eq(ProductInfo::getProductId, treeInfoRequest.getAttributionId());
}
- // 绠�鍖栨潯浠跺垽鏂�
queryWrapper.like(StrUtil.isNotBlank(treeInfoRequest.getTreeCode()), ProductInfo::getProductNo, treeInfoRequest.getTreeCode())
.like(StrUtil.isNotBlank(treeInfoRequest.getTreeName()), ProductInfo::getProductName, treeInfoRequest.getTreeName());
List<ProductInfo> productInfoList = super.list(queryWrapper);
@@ -1045,15 +1053,12 @@
productInfoList=new ArrayList<>();
}
if (CollectionUtil.isNotEmpty(productInfoList)) {
- // 浣跨敤ID鍒楄〃鑰岄潪鎷兼帴瀛楃涓�
- List<String> productIds = productInfoList.stream()
- .map(ProductInfo::getProductId)
- .collect(Collectors.toList());
+ String ids=productInfoList.stream().map(ProductInfo::getProductId).collect(Collectors.joining(","));
DocInfoQueryRequest docQuery = new DocInfoQueryRequest();
BeanUtil.copyProperties(treeInfoRequest, docQuery);
- docQuery.setAttributionIds(productIds.toString()); // 鍋囪setAttributionIds鎺ュ彈List<String>
+ docQuery.setAttributionIds(ids);
docQuery.setDocClassCode("OTHER");
- docQuery.setAttributionType(1);
+ docQuery.setAttributionType(DocAttributionTypeEnum.PRODUCT.getCode());
docInfos = docInfoService.findListByDocQuery(docQuery);
}
// 鍒涘缓鏂拌姹傚璞¢伩鍏嶆薄鏌撳師鍙傛暟
@@ -1064,6 +1069,8 @@
docInfos.addAll(componentInfoService.getByComponentInfo(componentRequest));
docInfos.addAll(partsInfoService.getByPartsInfo(componentRequest));
docInfos.addAll(processSpecVersionService.getByProcessSpecVersion(componentRequest));
+ docInfos.addAll(processStreamService.getByProcessStreamOtherFile(componentRequest));
+ docInfos.addAll(workStepService.getByWorkStepOtherFile(componentRequest));
return getByTreeOtherFileInfo(docInfos);
case 2:
return getByTreeOtherFileInfo(componentInfoService.getByComponentInfo(treeInfoRequest));
@@ -1071,6 +1078,98 @@
return getByTreeOtherFileInfo(partsInfoService.getByPartsInfo(treeInfoRequest));
case 4:
return getByTreeOtherFileInfo(processSpecVersionService.getByProcessSpecVersion(treeInfoRequest));
+ case 5:
+ return getByTreeOtherFileInfo(processStreamService.getByProcessStreamOtherFile(treeInfoRequest));
+ case 6:
+ return getByTreeOtherFileInfo(workStepService.getByWorkStepOtherFile(treeInfoRequest));
+ }
+ return new ArrayList<>();
+ }
+
+ /**
+ * 閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢
+ * @param treeInfoRequest
+ * @return
+ */
+ @Override
+ public List<DocInfo> getByTreeNcFileInfo(TreeInfoRequest treeInfoRequest){
+ //浜у搧銆侀儴浠躲�侀浂浠躲�佸伐鑹鸿绋嬬増鏈兘娌℃湁瀵瑰簲鐨凬C鏂囦欢锛岀洿鎺ユ煡璇㈠瓙缁撴瀯
+ switch (treeInfoRequest.getAttributionType()){
+ case 1:
+ LambdaQueryWrapper<ProductInfo> queryWrapper = new LambdaQueryWrapper<>();
+ // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠�
+ if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) {
+ queryWrapper.eq(ProductInfo::getProductId, treeInfoRequest.getAttributionId());
+ }
+ // 绠�鍖栨潯浠跺垽鏂�
+ queryWrapper.like(StrUtil.isNotBlank(treeInfoRequest.getTreeCode()), ProductInfo::getProductNo, treeInfoRequest.getTreeCode())
+ .like(StrUtil.isNotBlank(treeInfoRequest.getTreeName()), ProductInfo::getProductName, treeInfoRequest.getTreeName());
+ List<ProductInfo> productInfoList = super.list(queryWrapper);
+ if (CollectionUtil.isNotEmpty(productInfoList)) {
+ treeInfoRequest.setProductIds(productInfoList.stream().map(ProductInfo::getProductId).collect(Collectors.toList()));
+ }
+ return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest));
+ case 2:
+ LambdaQueryWrapper<ComponentInfo> componentInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠�
+ if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) {
+ componentInfoLambdaQueryWrapper.eq(ComponentInfo::getComponentId, treeInfoRequest.getAttributionId());
+ }
+ componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ComponentInfo::getComponentCode, treeInfoRequest.getTreeCode());
+ componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ComponentInfo::getComponentName, treeInfoRequest.getTreeName());
+ componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),ComponentInfo::getStructureType, treeInfoRequest.getStructureType());
+ componentInfoLambdaQueryWrapper.orderByDesc(ComponentInfo::getCreateTime);
+ List<ComponentInfo> componentInfoList = componentInfoService.list(componentInfoLambdaQueryWrapper);
+ if (CollectionUtil.isNotEmpty(componentInfoList)) {
+ treeInfoRequest.setComponentIds(componentInfoList.stream().map(ComponentInfo::getComponentId).collect(Collectors.toList()));
+ }
+ return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest));
+ case 3:
+ LambdaQueryWrapper<PartsInfo> partsInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) {
+ partsInfoLambdaQueryWrapper.in(PartsInfo::getProductId, treeInfoRequest.getProductIds());
+ }
+ if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) {
+ partsInfoLambdaQueryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds());
+ }
+ if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){
+ partsInfoLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),PartsInfo::getPartsId,treeInfoRequest.getAttributionId());
+ }
+ partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),PartsInfo::getPartsCode, treeInfoRequest.getTreeCode());
+ partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),PartsInfo::getPartsName, treeInfoRequest.getTreeName());
+ partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),PartsInfo::getStructureType, treeInfoRequest.getStructureType());
+ partsInfoLambdaQueryWrapper.orderByDesc(PartsInfo::getCreateTime);
+ List<PartsInfo> list = partsInfoService.list(partsInfoLambdaQueryWrapper);
+ if (CollectionUtil.isNotEmpty(list)) {
+ treeInfoRequest.setPartsIds(list.stream().map(PartsInfo::getPartsId).collect(Collectors.toList()));
+ }
+ return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest));
+ case 4:
+ LambdaQueryWrapper<ProcessSpecVersion> processSpecVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) {
+ processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getProductId, treeInfoRequest.getProductIds());
+ }
+ if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) {
+ processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getComponentId, treeInfoRequest.getComponentIds());
+ }
+ if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) {
+ processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getPartsId, treeInfoRequest.getPartsIds());
+ }
+ if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){
+ processSpecVersionLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessSpecVersion::getId,treeInfoRequest.getAttributionId());
+ }
+ processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessSpecVersion::getProcessSpecVersionName, treeInfoRequest.getTreeName());
+ processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessSpecVersion::getProcessSpecVersionCode, treeInfoRequest.getTreeName());
+ processSpecVersionLambdaQueryWrapper.orderByDesc(ProcessSpecVersion::getCreateTime);
+ List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.list(processSpecVersionLambdaQueryWrapper);
+ if (CollectionUtil.isNotEmpty(processSpecVersions)) {
+ treeInfoRequest.setPsvIds(processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList()));
+ }
+ return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest));
+ case 5:
+ return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest));
+ case 6:
+ return getByTreeNcFileInfo(workStepService.getByWorkStepNCFile(treeInfoRequest));
}
return new ArrayList<>();
}
@@ -1084,21 +1183,65 @@
ProductInfo productInfo=this.getById(docInfo.getAttributionId());
docInfo.setNodeName(productInfo.getProductName());
docInfo.setNodeCode(productInfo.getProductNo());
+ docInfo.setNodeId(productInfo.getProductId());
break;
case 2:
ComponentInfo componentInfo=componentInfoService.getById(docInfo.getAttributionId());
docInfo.setNodeName(componentInfo.getComponentName());
docInfo.setNodeCode(componentInfo.getComponentCode());
+ docInfo.setNodeId(componentInfo.getComponentId());
break;
case 3:
PartsInfo partsInfo=partsInfoService.getById(docInfo.getAttributionId());
docInfo.setNodeCode(partsInfo.getPartsCode());
docInfo.setNodeName(partsInfo.getPartsName());
+ docInfo.setNodeId(partsInfo.getPartsId());
break;
case 4:
ProcessSpecVersion processSpecVersion=processSpecVersionService.getById(docInfo.getAttributionId());
docInfo.setNodeName(processSpecVersion.getProcessSpecVersionName());
docInfo.setNodeCode(processSpecVersion.getProcessSpecVersionCode());
+ docInfo.setNodeId(processSpecVersion.getId());
+ break;
+ case 5:
+ ProcessStream processStream=processStreamService.getById(docInfo.getAttributionId());
+ docInfo.setNodeName(processStream.getProcessName());
+ docInfo.setNodeCode(processStream.getProcessCode());
+ docInfo.setNodeId(processStream.getProcessId());
+ break;
+ case 6:
+ WorkStep workStep=workStepService.getById(docInfo.getAttributionId());
+ docInfo.setNodeName(workStep.getStepName());
+ docInfo.setNodeCode(workStep.getStepName());
+ docInfo.setNodeId(workStep.getId());
+ break;
+ }
+ });
+ }
+ return docInfos;
+ }
+
+ private List<DocInfo> getByTreeNcFileInfo(List<DocInfo> docInfos){
+ //瀵规墍灞瀒d杩涜缈昏瘧
+ if (docInfos != null && !docInfos.isEmpty()) {
+ docInfos.forEach(docInfo -> {
+ //NC鏂囦欢瀛樺湪璁惧绫讳笅
+ DeviceType deviceType=deviceTypeService.getById(docInfo.getAttributionId());
+ DeviceManagement deviceManagement= deviceManagementService.getById(deviceType.getDeviceManagementId());
+ docInfo.setDeviceName(deviceManagement.getDeviceManagementName());
+ docInfo.setDeviceCode(deviceManagement.getDeviceManagementCode());
+ if (deviceType.getAttributionType().equals(DocAttributionTypeEnum.PROCESS.getCode())){
+ //宸ュ簭涓嬬殑璁惧绫�
+ ProcessStream processStream=processStreamService.getById(deviceType.getAttributionId());
+ docInfo.setNodeName(processStream.getProcessName());
+ docInfo.setNodeCode(processStream.getProcessCode());
+ docInfo.setNodeId(processStream.getProcessId());
+ }else {
+ //宸ユ涓嬬殑璁惧绫�
+ WorkStep workStep=workStepService.getById(deviceType.getAttributionId());
+ docInfo.setNodeName(workStep.getStepName());
+ docInfo.setNodeCode(workStep.getStepName());
+ docInfo.setNodeId(workStep.getId());
}
});
}
@@ -1256,7 +1399,7 @@
ComponentInfo cpInfo = componentInfoMap.get(cp.getComponentId());
PermissionStreamNew s = new PermissionStreamNew();
s.setBusinessId(cpInfo.getComponentId());
- s.setBusinessType("2");
+ s.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
s.setUserId(cp.getUserId());
permissionStreamList.add(s);
}
@@ -1287,7 +1430,7 @@
PartsInfo ptInfo = partsInfoMap.get(pp.getPartsId());
PermissionStreamNew s = new PermissionStreamNew();
s.setBusinessId(ptInfo.getPartsId());
- s.setBusinessType("3");
+ s.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
s.setUserId(pp.getUserId());
permissionStreamList.add(s);
}
@@ -1318,7 +1461,7 @@
ProcessSpecVersion processSpecVersion = processStreamMap.get(pp.getPsvId());
PermissionStreamNew s = new PermissionStreamNew();
s.setBusinessId(processSpecVersion.getId());
- s.setBusinessType("4");
+ s.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString());
s.setUserId(pp.getUserId());
permissionStreamList.add(s);
}
@@ -1349,7 +1492,7 @@
ProcessStream processStream = processStreamMap.get(pp.getProcessId());
PermissionStreamNew s = new PermissionStreamNew();
s.setBusinessId(processStream.getProcessId());
- s.setBusinessType("5");
+ s.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString());
s.setUserId(pp.getUserId());
permissionStreamList.add(s);
}
@@ -1380,7 +1523,7 @@
WorkStep workStep = workStepHashMap.get(ws.getStepId());
PermissionStreamNew s = new PermissionStreamNew();
s.setBusinessId(workStep.getId());
- s.setBusinessType("6");
+ s.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString());
s.setUserId(ws.getUserId());
permissionStreamList.add(s);
}
@@ -1608,7 +1751,7 @@
WorkStep workStep = workStepMap.get(wsDep.getStepId());
PermissionStreamNew permStream = new PermissionStreamNew();
permStream.setBusinessId(workStep.getId());
- permStream.setBusinessType("6");
+ permStream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString());
permStream.setDepartId(wsDep.getDepartId());
newPermissionStreams.add(permStream);
}
@@ -1679,7 +1822,7 @@
ProcessStream processStream = processStreamMap.get(procDep.getProcessId());
PermissionStreamNew permStream = new PermissionStreamNew();
permStream.setBusinessId(processStream.getProcessId());
- permStream.setBusinessType("5");
+ permStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString());
permStream.setDepartId(procDep.getDepartId());
newPermissionStreams.add(permStream);
}
@@ -1752,7 +1895,7 @@
ComponentInfo componentInfo = componentInfoMap.get(compDep.getComponentId());
PermissionStreamNew permStream = new PermissionStreamNew();
permStream.setBusinessId(componentInfo.getComponentId());
- permStream.setBusinessType("2");
+ permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
permStream.setDepartId(compDep.getDepartId());
newPermissionStreams.add(permStream);
}
@@ -1826,7 +1969,7 @@
childComponent = componentInfoMap.get(compDep.getComponentId());
PermissionStreamNew permStream = new PermissionStreamNew();
permStream.setBusinessId(childComponent.getComponentId());
- permStream.setBusinessType("2");
+ permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
permStream.setDepartId(compDep.getDepartId());
newPermissionStreams.add(permStream);
}
--
Gitblit v1.9.3