From 5b999730e081bb5ba934ebf361280ca477a0e714 Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期四, 14 八月 2025 17:03:04 +0800
Subject: [PATCH] 工厂建模功能调整
---
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 315 +++++++++++++++++++++++++++++++++++-----------------
1 files changed, 211 insertions(+), 104 deletions(-)
diff --git a/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
index cda1062..753837f 100644
--- a/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
+++ b/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -15,24 +15,23 @@
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.base.entity.Factory;
+import org.jeecg.modules.base.service.IFactoryService;
+import org.jeecg.modules.base.service.IUserFactoryService;
+import org.jeecg.modules.base.service.impl.FactoryServiceImpl;
import org.jeecg.modules.mdc.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDetailedDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.*;
-import org.jeecg.modules.mdc.mapper.MdcEquipmentDepartMapper;
-import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper;
-import org.jeecg.modules.mdc.mapper.MdcProductionEquipmentMapper;
-import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper;
+import org.jeecg.modules.mdc.mapper.*;
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
import org.jeecg.modules.mdc.service.*;
-import org.jeecg.modules.mdc.util.DateUtils;
-import org.jeecg.modules.mdc.util.DncCopyEquipment;
-import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil;
-import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil;
+import org.jeecg.modules.mdc.util.*;
import org.jeecg.modules.mdc.vo.*;
import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.service.*;
+import org.jeecg.modules.system.util.FindsFactorysChildrenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
@@ -60,15 +59,9 @@
@Resource
private MdcEquipmentDepartMapper mdcEquipmentDepartMapper;
@Resource
- private MdcProductionEquipmentMapper mdcProductionEquipmentMapper;
- @Resource
private ISysUserDepartService sysUserDepartService;
@Resource
- private IMdcUserProductionService mdcUserProductionService;
- @Resource
private ISysDepartService sysDepartService;
- @Resource
- private IMdcProductionService mdcProductionService;
@Resource
private IEquipmentWorkLineService equipmentWorkLineService;
@Resource
@@ -91,6 +84,15 @@
@Autowired
private IEquipmentService equipmentService;
+ @Autowired
+ private IFactoryService factoryService;
+
+ @Autowired
+ private IUserFactoryService userFactoryService;
+
+ @Autowired
+ private FactoryEquipmentMapper factoryEquipmentMapper;
+
@Override
public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) {
@@ -104,7 +106,7 @@
public Map<String, String> getProNamesByEquipmentIds(List<String> equipmentIds) {
List<MdcEquipmentProVo> list = this.baseMapper.getProNamesByEquipmentIds(equipmentIds);
Map<String, String> res = new HashMap(5);
- list.forEach(item -> res.merge(item.getEquipmentId(), item.getProductionName(), (a, b) -> a + "," + b));
+ list.forEach(item -> res.merge(item.getEquipmentId(), item.getFactoryName(), (a, b) -> a + "," + b));
return res;
}
@@ -125,8 +127,8 @@
if (oConvertUtils.isNotEmpty(selectedProduction)) {
String[] arr = selectedProduction.split(",");
for (String productionId : arr) {
- MdcProductionEquipment mdcProductionEquipment = new MdcProductionEquipment(mdcEquipment.getId(), productionId);
- mdcProductionEquipmentMapper.insert(mdcProductionEquipment);
+ FactoryEquipment mdcProductionEquipment = new FactoryEquipment(mdcEquipment.getId(), productionId);
+ factoryEquipmentMapper.insert(mdcProductionEquipment);
}
}
}
@@ -152,17 +154,17 @@
}
}
//step.3 淇敼浜х嚎
- String productions = mdcEquipment.getSelectedProduction();
+ String productions = mdcEquipment.getSelectedFactory();
String[] array = {};
if (oConvertUtils.isNotEmpty(productions)) {
array = productions.split(",");
}
//鍏堝垹鍚庡姞
- mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getEquipmentId, mdcEquipment.getId()));
+ factoryEquipmentMapper.delete(new LambdaQueryWrapper<FactoryEquipment>().eq(FactoryEquipment::getEquipmentId, mdcEquipment.getId()));
if (oConvertUtils.isNotEmpty(productions)) {
for (String productionId : array) {
- MdcProductionEquipment productionEquipment = new MdcProductionEquipment(mdcEquipment.getId(), productionId);
- mdcProductionEquipmentMapper.insert(productionEquipment);
+ FactoryEquipment productionEquipment = new FactoryEquipment(mdcEquipment.getId(), productionId);
+ factoryEquipmentMapper.insert(productionEquipment);
}
}
}
@@ -176,7 +178,7 @@
// 2. 鍒犻櫎璁惧閮ㄩ棬鍏崇郴
line += mdcEquipmentDepartMapper.delete(new LambdaQueryWrapper<MdcEquipmentDepart>().eq(MdcEquipmentDepart::getEquipmentId, id));
// 3. 鍒犻櫎璁惧浜х嚎鍏崇郴
- line += mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getEquipmentId, id));
+ line += factoryEquipmentMapper.delete(new LambdaQueryWrapper<FactoryEquipment>().eq(FactoryEquipment::getEquipmentId, id));
return line != 0;
}
@@ -189,7 +191,7 @@
// 2. 鍒犻櫎璁惧閮ㄩ棬鍏崇郴
line += mdcEquipmentDepartMapper.delete(new LambdaQueryWrapper<MdcEquipmentDepart>().in(MdcEquipmentDepart::getEquipmentId, equipmentIds));
// 3. 鍒犻櫎璁惧浜х嚎鍏崇郴
- line += mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().in(MdcProductionEquipment::getEquipmentId, equipmentIds));
+ line += factoryEquipmentMapper.delete(new LambdaQueryWrapper<FactoryEquipment>().in(FactoryEquipment::getEquipmentId, equipmentIds));
return line != 0;
}
@@ -214,15 +216,15 @@
mdcEquipmentDepartMapper.delete(new LambdaQueryWrapper<MdcEquipmentDepart>().eq(MdcEquipmentDepart::getDepId, departId).in(MdcEquipmentDepart::getEquipmentId, equipmentIdList));
}
- @Override
- public void removeEquipmentForProduction(String productionId, String equipmentId) {
- mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).eq(MdcProductionEquipment::getEquipmentId, equipmentId));
- }
+// @Override
+// public void removeEquipmentForProduction(String productionId, String equipmentId) {
+// mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).eq(MdcProductionEquipment::getEquipmentId, equipmentId));
+// }
- @Override
- public void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList) {
- mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).in(MdcProductionEquipment::getEquipmentId, equipmentIdList));
- }
+// @Override
+// public void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList) {
+// mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).in(MdcProductionEquipment::getEquipmentId, equipmentIdList));
+// }
@Override
public List<MdcEquipmentTree> loadTreeListByDepart(String userId) {
@@ -293,23 +295,84 @@
@Override
public List<MdcEquipmentTree> loadTreeListByProduction(String userId) {
//鑾峰彇鎵�鏈変骇绾挎暟鎹�
- List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).eq(MdcProduction::getMdcFlag, CommonConstant.DEFAULT_1).orderByAsc(MdcProduction::getProductionOrder));
+ List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(Factory::getSorter));
//鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
- List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
- List<String> allProductionIds = new ArrayList<>();
+ List<String> factoryIds = userFactoryService.queryFactoryIdsByUserId(userId);
+ List<String> allFactoryIds = new ArrayList<>();
//鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
- if (productionIds != null && !productionIds.isEmpty()) {
- for (String productionId : productionIds) {
- this.getAllProductionIds(productionList, productionId, allProductionIds);
+ if (factoryIds != null && !factoryIds.isEmpty()) {
+ for (String factoryId : factoryIds) {
+ this.getAllFactoryIds(factoryList, factoryId, allFactoryIds);
}
}
//杩囨护浜х嚎鏁版嵁
- List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
+ List<Factory> list = factoryList.stream().filter((Factory factory) -> allFactoryIds.contains(factory.getId())).collect(Collectors.toList());
//缁勮浜х嚎璁惧鏍�
- List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
+ List<MdcEquipmentTree> treeList = FindsEquipmentFactoryUtil.wrapEquipmentFactoryTreeList(list);
//濉厖璁惧鏁版嵁
- FillEquipmentByProduction(treeList);
+ FillEquipmentByFactory(treeList);
+
+
+// //鑾峰彇鎵�鏈変骇绾挎暟鎹�
+// List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).eq(MdcProduction::getMdcFlag, CommonConstant.DEFAULT_1).orderByAsc(MdcProduction::getProductionOrder));
+// //鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
+// List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
+// List<String> allProductionIds = new ArrayList<>();
+// //鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
+// if (productionIds != null && !productionIds.isEmpty()) {
+// for (String productionId : productionIds) {
+// this.getAllProductionIds(productionList, productionId, allProductionIds);
+// }
+// }
+// //杩囨护浜х嚎鏁版嵁
+// List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
+// //缁勮浜х嚎璁惧鏍�
+// List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
+// 濉厖璁惧鏁版嵁
+// FillEquipmentByProduction(treeList);
return treeList;
+ }
+
+ /**
+ * 浜х嚎璁惧鏍戝~鍏呰澶囨暟鎹�
+ */
+ private void FillEquipmentByFactory(List<MdcEquipmentTree> treeList) {
+ for (MdcEquipmentTree mdcEquipmentTree : treeList) {
+ List<MdcEquipment> equipmentList = this.baseMapper.queryByFactoryId(mdcEquipmentTree.getKey());
+ if (equipmentList != null && !equipmentList.isEmpty()) {
+ for (MdcEquipment mdcEquipment : equipmentList) {
+ MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment);
+ tree.setParentId(mdcEquipmentTree.getKey());
+ tree.setEntity(mdcEquipment);
+ tree.setType(2);
+ mdcEquipmentTree.getChildren().add(tree);
+ }
+ mdcEquipmentTree.setLeaf(false);
+ }
+ if (!mdcEquipmentTree.getChildren().isEmpty()) {
+ FillEquipmentByFactory(mdcEquipmentTree.getChildren());
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇鎵�鏈夌殑浜х嚎id锛堝寘鍚墍鏈変笂绾э級
+ */
+ private void getAllFactoryIds(List<Factory> factoryList, String factoryId, List<String> allFactoryIds) {
+ if (!allFactoryIds.contains(factoryId)) {
+ allFactoryIds.add(factoryId);
+ }
+ for (Factory factory : factoryList) {
+ if (StringUtils.isEmpty(factory.getParentId())) {
+ continue;
+ }
+ if (factoryId.equals(factory.getId())) {
+ if (!allFactoryIds.contains(factory.getParentId())) {
+ allFactoryIds.add(factory.getParentId());
+ getAllFactoryIds(factoryList, factory.getParentId(), allFactoryIds);
+ }
+ }
+ }
}
/**
@@ -513,30 +576,74 @@
@Override
public List<String> getEquipmentIdsProduction(String userId, String key) {
//鑾峰彇鎵�鏈変骇绾挎暟鎹�
- List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+ List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0).orderByAsc(Factory::getSorter));
//鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
- List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
- List<String> allProductionIds = new ArrayList<>();
+ List<String> factoryIds = userFactoryService.queryFactoryIdsByUserId(userId);
+ List<String> allFactoryIds = new ArrayList<>();
//鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
- if (productionIds != null && !productionIds.isEmpty()) {
- for (String productionId : productionIds) {
- this.getAllProductionIds(productionList, productionId, allProductionIds);
+ if (factoryIds != null && !factoryIds.isEmpty()) {
+ for (String productionId : factoryIds) {
+ this.getAllFactoryIds(factoryList, productionId, allFactoryIds);
}
}
//鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d
- if (allProductionIds.isEmpty()) {
+ if (allFactoryIds.isEmpty()) {
return null;
}
- List<String> equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIds);
+ List<String> equipmentIds = this.baseMapper.queryIdsByFactorys(allFactoryIds);
if (StringUtils.isNotEmpty(key)) {
//key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾т骇绾縤d
- List<String> partProduction = this.findAllProductions(key);
- partProduction.add(key);
+ List<String> partFactory = this.findAllFactorys(key);
+ partFactory.add(key);
//杩囨护鏃犳潈闄愪骇绾縤d
- List<String> allProductionIdsByKey = partProduction.stream().filter(allProductionIds::contains).collect(Collectors.toList());
- equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIdsByKey);
+ List<String> allFactoryIdsByKey = partFactory.stream().filter(allFactoryIds::contains).collect(Collectors.toList());
+ equipmentIds = this.baseMapper.queryIdsByFactorys(allFactoryIdsByKey);
}
return equipmentIds;
+
+ //鑾峰彇鎵�鏈変骇绾挎暟鎹�
+// List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+// //鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
+// List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
+// List<String> allProductionIds = new ArrayList<>();
+// //鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
+// if (productionIds != null && !productionIds.isEmpty()) {
+// for (String productionId : productionIds) {
+// this.getAllProductionIds(productionList, productionId, allProductionIds);
+// }
+// }
+// //鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d
+// if (allProductionIds.isEmpty()) {
+// return null;
+// }
+// List<String> equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIds);
+// if (StringUtils.isNotEmpty(key)) {
+// //key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾т骇绾縤d
+// List<String> partProduction = this.findAllProductions(key);
+// partProduction.add(key);
+// //杩囨护鏃犳潈闄愪骇绾縤d
+// List<String> allProductionIdsByKey = partProduction.stream().filter(allProductionIds::contains).collect(Collectors.toList());
+// equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIdsByKey);
+// }
+// return equipmentIds;
+//
+ }
+
+ /**
+ * 鏍规嵁鐖剁骇id閫掑綊鏌ヨ鎵�鏈変笅绾d闆嗗悎
+ */
+ private List<String> findAllFactorys(String key) {
+ List<String> factoryIds = new ArrayList<>();
+ List<Factory> factorys = factoryService.queryFacByPid(key);
+ if (factorys != null && !factorys.isEmpty()) {
+ List<String> ids = factorys.stream().map(Factory::getId).collect(Collectors.toList());
+ factoryIds.addAll(ids);
+ for (Factory factory : factorys) {
+ List<String> allFactorys = findAllFactorys(factory.getId());
+ factoryIds.addAll(allFactorys);
+ }
+ }
+ return factoryIds;
}
/**
@@ -590,22 +697,22 @@
return this.baseMapper.selectPage(page, queryWrapper);
}
- /**
- * 鏍规嵁鐖剁骇id閫掑綊鏌ヨ鎵�鏈変笅绾d闆嗗悎
- */
- private List<String> findAllProductions(String key) {
- List<String> productions = new ArrayList<>();
- List<MdcProduction> mdcProductions = mdcProductionService.queryProdByPid(key);
- if (mdcProductions != null && !mdcProductions.isEmpty()) {
- List<String> ids = mdcProductions.stream().map(MdcProduction::getId).collect(Collectors.toList());
- productions.addAll(ids);
- for (MdcProduction mdcProduction : mdcProductions) {
- List<String> allProductions = findAllProductions(mdcProduction.getId());
- productions.addAll(allProductions);
- }
- }
- return productions;
- }
+// /**
+// * 鏍规嵁鐖剁骇id閫掑綊鏌ヨ鎵�鏈変笅绾d闆嗗悎
+// */
+// private List<String> findAllProductions(String key) {
+// List<String> productions = new ArrayList<>();
+// List<MdcProduction> mdcProductions = mdcProductionService.queryProdByPid(key);
+// if (mdcProductions != null && !mdcProductions.isEmpty()) {
+// List<String> ids = mdcProductions.stream().map(MdcProduction::getId).collect(Collectors.toList());
+// productions.addAll(ids);
+// for (MdcProduction mdcProduction : mdcProductions) {
+// List<String> allProductions = findAllProductions(mdcProduction.getId());
+// productions.addAll(allProductions);
+// }
+// }
+// return productions;
+// }
/**
* 浜х嚎璁惧鏍戝~鍏呰澶囨暟鎹�
@@ -730,7 +837,7 @@
public IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req) {
if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
// 閫掑綊鏌ヨ鎵�鏈夊瓙鑺傜偣
- List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
+ List<String> productionIds = factoryService.recursionChildren(mdcEquipment.getProductionName());
mdcEquipment.setProductionIds(productionIds);
}
return this.baseMapper.pageList(page, mdcEquipment);
@@ -806,38 +913,38 @@
public List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment) {
if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
// 閫掑綊鏌ヨ鎵�鏈夊瓙鑺傜偣
- List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
+ List<String> productionIds = factoryService.recursionChildren(mdcEquipment.getProductionName());
mdcEquipment.setProductionIds(productionIds);
}
return this.baseMapper.exportXlsList(mdcEquipment);
}
- /**
- * 閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�
- *
- * @param ids
- * @return
- */
- @Override
- public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
- List<String> productionIds = Arrays.asList(ids.split(","));
- //鑾峰彇鎵�鏈変骇绾挎暟鎹�
- List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
- List<String> allProductionIds = new ArrayList<>();
- //鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
- if (!productionIds.isEmpty()) {
- for (String productionId : productionIds) {
- this.getAllProductionIds(productionList, productionId, allProductionIds);
- }
- }
- //杩囨护浜х嚎鏁版嵁
- List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
- //缁勮浜х嚎璁惧鏍�
- List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
- //濉厖璁惧鏁版嵁
- FillEquipmentByProduction(treeList);
- return treeList;
- }
+// /**
+// * 閫氳繃杞﹂棿ids鑾峰彇璁惧鏍�
+// *
+// * @param ids
+// * @return
+// */
+// @Override
+// public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
+// List<String> productionIds = Arrays.asList(ids.split(","));
+// //鑾峰彇鎵�鏈変骇绾挎暟鎹�
+// List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+// List<String> allProductionIds = new ArrayList<>();
+// //鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
+// if (!productionIds.isEmpty()) {
+// for (String productionId : productionIds) {
+// this.getAllProductionIds(productionList, productionId, allProductionIds);
+// }
+// }
+// //杩囨护浜х嚎鏁版嵁
+// List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
+// //缁勮浜х嚎璁惧鏍�
+// List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
+// //濉厖璁惧鏁版嵁
+// FillEquipmentByProduction(treeList);
+// return treeList;
+// }
/**
* 鏌ヨ鍗曡〃鏁版嵁
@@ -948,21 +1055,21 @@
return this.baseMapper.selectList(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, Arrays.asList(user.getEquipmentIds().split(StringPool.COMMA))));
}
//鑾峰彇鎵�鏈変骇绾挎暟鎹�
- List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
+ List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(Factory::getSorter));
//鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
- List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
- List<String> allProductionIds = new ArrayList<>();
+ List<String> factoryIds = userFactoryService.queryFactoryIdsByUserId(userId);
+ List<String> allFactoryIds = new ArrayList<>();
//鎵惧埌鎵�鏈変骇绾縤d鐨勪笂绾d
- if (productionIds != null && !productionIds.isEmpty()) {
- for (String productionId : productionIds) {
- this.getAllProductionIds(productionList, productionId, allProductionIds);
+ if (factoryIds != null && !factoryIds.isEmpty()) {
+ for (String factoryId : factoryIds) {
+ this.getAllFactoryIds(factoryList, factoryId, allFactoryIds);
}
}
//鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d
- if (allProductionIds.isEmpty()) {
+ if (allFactoryIds.isEmpty()) {
return null;
}
- List<MdcEquipment> equipmentIds = this.baseMapper.getEquipmentList(allProductionIds);
+ List<MdcEquipment> equipmentIds = this.baseMapper.getEquipmentList(allFactoryIds);
return equipmentIds;
}
--
Gitblit v1.9.3