| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | |
| | | import java.util.Set; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import java.util.Arrays; |
| | | |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.enums.CommonGroupTypeEnum; |
| | | import com.qianwen.smartman.common.utils.ExtraLambdaQueryWrapper; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.utils.ValidatorUtils; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.qianwen.core.excel.util.ExcelUtil; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.support.Condition; |
| | |
| | | import com.qianwen.core.tool.node.ForestNodeMerger; |
| | | import com.qianwen.core.tool.utils.CollectionUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.enums.CommonGroupTypeEnum; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.utils.ValidatorUtils; |
| | | import com.qianwen.smartman.modules.cps.convert.CommonGroupConvert; |
| | | import com.qianwen.smartman.modules.cps.entity.CommonGroup; |
| | | import com.qianwen.smartman.modules.cps.entity.CommonGroupOfItem; |
| | |
| | | import com.qianwen.smartman.modules.system.entity.ParamBiz; |
| | | import com.qianwen.smartman.modules.system.service.IDictService; |
| | | import com.qianwen.smartman.modules.system.service.IParamBizService; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/CommonGroupServiceImpl.class */ |
| | | public class CommonGroupServiceImpl extends ServiceImpl<CommonGroupMapper, CommonGroup> implements ICommonGroupService { |
| | | private static final String PARENT_ID = "parentId"; |
| | | private static final String ROOT_NODE_CONFIGURE_ERROR = "The root node is not configured or configured incorrectly"; |
| | |
| | | private WorkstationMapper workstationMapper; |
| | | |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public Boolean changeStatus(List<Long> ids, Integer status) { |
| | | return update(Wrappers.<CommonGroup>lambdaUpdate() |
| | | .set(CommonGroup::getStatus, status) |
| | | .in(CommonGroup::getId, ids)); |
| | | /* |
| | | return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getStatus(); |
| | | }, status)).in((v0) -> { |
| | | return v0.getId(); |
| | | }, ids)));*/ |
| | | |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroup> getAllSubGroup(Long id, String groupType, Integer groupCategory) { |
| | | return this.baseMapper.getAllSubGroup(id, groupType, groupCategory); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroupVO> lazyList(Long parentId, String groupType, Integer groupCategory, Map<String, Object> param) { |
| | | if (Func.isEmpty(param.get(PARENT_ID)) && param.size() == 1) { |
| | | parentId = BladeConstant.TOP_PARENT_ID; |
| | |
| | | return this.baseMapper.lazyList(AuthUtil.getTenantId(), parentId, groupType, groupCategory, param); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroupVO> tree(String tenantId, String groupType, Integer groupCategory) { |
| | | return ForestNodeMerger.merge(this.baseMapper.tree(tenantId, groupType, groupCategory)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroupVO> lazyTree(String tenantId, Long parentId) { |
| | | if (AuthUtil.isAdministrator()) { |
| | | tenantId = ""; |
| | |
| | | return ForestNodeMerger.merge(this.baseMapper.lazyTree(tenantId, parentId)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public String getGroupIds(String tenantId, String groupNames, String groupType, Integer groupCategory) { |
| | | List<CommonGroup> commonList = this.baseMapper.selectList( |
| | | Wrappers.<CommonGroup>query().lambda() |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public String getGroupIdsByFuzzy(String tenantId, String groupNames, String groupType, Integer groupCategory) { |
| | | LambdaQueryWrapper<CommonGroup> queryWrapper = Wrappers.<CommonGroup>query().lambda().eq(CommonGroup::getTenantId, tenantId).eq(CommonGroup::getGroupType, groupType).eq(CommonGroup::getGroupCategory, groupCategory); |
| | | queryWrapper.and(wrapper -> { |
| | | List<String> names = Func.toStrList(groupNames); |
| | | names.forEach(name -> { |
| | | LambdaQueryWrapper lambdaQueryWrapper = (LambdaQueryWrapper) (wrapper.like(CommonGroup::getName, name)).or(); |
| | | wrapper.like(CommonGroup::getName, name).or(); |
| | | }); |
| | | }); |
| | | /* |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<String> getGroupNames(String groupIds) { |
| | | return this.baseMapper.getGroupNames(Func.toLongArray(groupIds)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public boolean removeGroup(String ids) { |
| | | Long cnt = this.baseMapper.selectCount(Wrappers.<CommonGroup>query().lambda().in(CommonGroup::getParentId, Func.toLongList(ids))); |
| | | /* |
| | |
| | | return removeByIds(Func.toLongList(ids)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public CommonGroup insert(CommonGroup group) { |
| | | if (Func.isEmpty(group.getParentId())) { |
| | | group.setTenantId(AuthUtil.getTenantId()); |
| | |
| | | return group; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public CommonGroup update(CommonGroup group) { |
| | | validateGroup(group); |
| | | saveOrUpdate(group); |
| | | return group; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public void move(Long id, Long parentId, String groupType, Integer groupCategory) { |
| | | CommonGroup group = (CommonGroup) getById(id); |
| | | if (group.getParentId().equals(id)) { |
| | |
| | | update(group); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroup> getGroupChildren(Long parentId, boolean recursive, String groupType, Integer groupCategory) { |
| | | if (!recursive) { |
| | | return this.baseMapper.selectList(Wrappers.<CommonGroup>query().lambda() |
| | |
| | | }, parentId));*/ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<CommonGroupVO> search(String groupName, Long parentId, String groupType, Integer groupCategory) { |
| | | LambdaQueryWrapper<CommonGroup> wrapper = Wrappers.<CommonGroup>query().lambda().eq(CommonGroup::getGroupType, groupType).eq(CommonGroup::getGroupCategory, groupCategory); |
| | | /*Wrapper wrapper = (LambdaQueryWrapper) ((LambdaQueryWrapper) Wrappers.query().lambda().eq((v0) -> { |
| | |
| | | return CommonGroupConvert.INSTANCE.convert(groupList); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<Long> getCommonGroupChildIds(String code, String groupType, Integer groupCategory) { |
| | | List<CommonGroup> childList = getCommonGroupChildList(code, groupType, groupCategory, null); |
| | | if (Func.isNotEmpty(childList)) { |
| | | List<Long> groupIdList = (List) childList.stream().map((v0) -> { |
| | | List<Long> groupIdList = childList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | return groupIdList; |
| | |
| | | .eq(CommonGroup::getGroupCategory, groupCategory).eq(Func.isNotEmpty(status), CommonGroup::getStatus, status).likeRight(Func.isNotEmpty(code), CommonGroup::getCode, code)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public HashMap<String, Long> getCommonGroupNameMap(String groupType, Integer groupCategory) { |
| | | return getCommonGroupMap(null, groupType, groupCategory, null); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public HashMap<String, Long> getCommonGroupNameMap(String code, String groupType, Integer groupCategory) { |
| | | return getCommonGroupMap(code, groupType, groupCategory, null); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public HashMap<String, Long> getCommonGroupNameMap(String groupType, Integer groupCategory, Integer status) { |
| | | return getCommonGroupMap(null, groupType, groupCategory, status); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public HashMap<String, Long> getCommonGroupNameMap(String code, String groupType, Integer groupCategory, Integer status) { |
| | | return getCommonGroupMap(code, groupType, groupCategory, status); |
| | | } |
| | |
| | | if (Func.isEmpty(childList)) { |
| | | return resultMap; |
| | | } |
| | | Map<Long, List<CommonGroup>> dataMap = (Map) childList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | Map<Long, List<CommonGroup>> dataMap = childList.stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getParentId(); |
| | | })); |
| | | List<CommonGroup> commonGroups = dataMap.get(BladeConstant.TOP_PARENT_ID); |
| | |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public CommonGroup getRootNode(String groupType, Integer groupCategory) { |
| | | //CommonGroup::getParentId |
| | | List<CommonGroup> commonGroupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getGroupType, groupType) |
| | |
| | | return commonGroupList.get(0); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public Long getRootNodeId(String groupType, Integer groupCategory) { |
| | | return getRootNode(groupType, groupCategory).getId(); |
| | | } |
| | | |
| | | private String getParentName(List<String> codeList, List<CommonGroup> parentList) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | Map<String, String> map = (Map) parentList.stream().filter(x -> { |
| | | Map<String, String> map = parentList.stream().filter(x -> { |
| | | return !BladeConstant.TOP_PARENT_ID.equals(x.getParentId()); |
| | | }).collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public BladeFile importCommonGroup(List<CommonGroupImport> data, CommonGroupTypeVO commonGroupTypeVO) { |
| | | if (Func.isEmpty(data)) { |
| | |
| | | } |
| | | } |
| | | if (!flag.booleanValue()) { |
| | | MultipartFile multipartFile = ExcelUtil.exportFillTemplateToMultipartFile(ExcelConstant.DIRECTORY + "organizationFailTemplate" + ExcelConstant.SUFFIX, MessageUtils.message("excel.import.failed.report.name", new Object[0]) + ExcelConstant.SUFFIX, "部门信息表", (List) data.stream().filter(x -> { |
| | | MultipartFile multipartFile = ExcelUtil.exportFillTemplateToMultipartFile(ExcelConstant.DIRECTORY + "organizationFailTemplate" + ExcelConstant.SUFFIX, MessageUtils.message("excel.import.failed.report.name", new Object[0]) + ExcelConstant.SUFFIX, "部门信息表", data.stream().filter(x -> { |
| | | return Func.isNotEmpty(x.getFailReason()); |
| | | }).collect(Collectors.toList()), (Object) null, (AbstractMergeStrategy) null); |
| | | BladeFile bladeFile = this.ossBuilder.tempTemplate().putFile(multipartFile.getOriginalFilename(), multipartFile); |
| | |
| | | return null; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationGroupVO> listWorkstationGroup(String groupType, String groupCategory, String groupTag) { |
| | | List<CommonGroup> commonGroupList = list(Wrappers.<CommonGroup>lambdaQuery() |
| | | .eq(Func.isNotBlank(groupType), CommonGroup::getGroupType, groupType) |
| | |
| | | }, groupTag));*/ |
| | | List<WorkstationGroupVO> result = CommonGroupConvert.INSTANCE.convert1(commonGroupList); |
| | | if (CollectionUtil.isNotEmpty(result)) { |
| | | List<String> codeList = (List) result.stream().map((v0) -> { |
| | | List<String> codeList = result.stream().map((v0) -> { |
| | | return v0.getCode(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(codeList)) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationInGroupVO> groupWorkstationListType(CommonGroupTypeVO commonGroupTypeVO) { |
| | | List<CommonGroup> groupList = list(Wrappers.<CommonGroup>lambdaQuery() |
| | | .eq(CommonGroup::getGroupType, commonGroupTypeVO.getGroupType()) |
| | |
| | | }, commonGroupTypeVO.getGroupCategory())).orderByAsc((v0) -> { |
| | | return v0.getSort(); |
| | | }));*/ |
| | | List<Long> groupIds = (List) groupList.stream().map((v0) -> { |
| | | List<Long> groupIds = groupList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | List<CommonGroupOfItem> itemList = this.commonGroupOfItemService.list(Wrappers.<CommonGroupOfItem>lambdaQuery().in(Func.isNotEmpty(groupIds), CommonGroupOfItem::getGroupId, groupIds)); |
| | | List<Workstation> workstations = this.workstationService.listMachine(commonGroupTypeVO.getStatus(), commonGroupTypeVO.getKeyword()); |
| | | List<WorkstationInGroupVO> list = (List) groupList.stream().filter(o -> { |
| | | List<WorkstationInGroupVO> list = groupList.stream().filter(o -> { |
| | | return Func.isNotEmpty(o.getParentId()); |
| | | }).map(o2 -> { |
| | | return WorkstationInGroupVO.builder().id(o2.getId()).parentId(o2.getParentId()).title(o2.getName()).code("").isWorkstation(Boolean.FALSE).isGroup(Boolean.TRUE).groupTag(o2.getGroupTag()).build(); |
| | | }).collect(Collectors.toList()); |
| | | list.addAll((Collection) workstations.stream().flatMap(o1 -> { |
| | | list.addAll( workstations.stream().flatMap(o1 -> { |
| | | Long id = o1.getId(); |
| | | return itemList.stream().filter(o22 -> { |
| | | Integer distinguish = commonGroupTypeVO.getDistinguish(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationInGroupVO> groupWorkstationListLazy(Long groupId) { |
| | | //CommonGroup::getSort |
| | | List<CommonGroup> commonGroupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getParentId, groupId).orderByAsc(CommonGroup::getSort)); |
| | | List<WorkstationInGroupVO> collect = (List) commonGroupList.stream().map(commonGroup -> { |
| | | List<WorkstationInGroupVO> collect = commonGroupList.stream().map(commonGroup -> { |
| | | return WorkstationInGroupVO.builder().parentId(groupId).isWorkstation(false).isGroup(true).code(commonGroup.getCode()).title(commonGroup.getName()).groupTag(commonGroup.getGroupTag()).id(commonGroup.getId()).build(); |
| | | }).collect(Collectors.toList()); |
| | | //CommonGroupOfItem::getGroupType |
| | |
| | | List<Long> workstationIds = (List) commonGroupOfItemList.stream().map((v0) -> { |
| | | return v0.getItemId(); |
| | | }).collect(Collectors.toList());*/ |
| | | List<Workstation> workstations = (List) this.workstationService.listByIds(workstationIds).stream().filter(s -> { |
| | | List<Workstation> workstations = this.workstationService.listByIds(workstationIds).stream().filter(s -> { |
| | | return CommonConstant.ENABLE.equals(s.getStatus()); |
| | | }).filter((v0) -> { |
| | | return Func.isNotEmpty(v0); |
| | | }).collect(Collectors.toList()); |
| | | List<WorkstationInGroupVO> collect1 = (List) workstations.stream().map(workstation -> { |
| | | List<WorkstationInGroupVO> collect1 = workstations.stream().map(workstation -> { |
| | | return WorkstationInGroupVO.builder().isWorkstation(true).isGroup(false).id(workstation.getId()).title(workstation.getName()).code(workstation.getName()).parentId((Long) workstationIdToGroupId.get(workstation.getId())).supportCncRw(workstation.getSupportCncRw()).build(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(collect1)) { |
| | |
| | | List<CommonGroup> commonGroupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getParentId, groupId).orderByAsc(CommonGroup::getSort)); |
| | | List<WorkstationInGroupVO> collect = Lists.newArrayList(); |
| | | if (Func.isNotEmpty(commonGroupList)) { |
| | | List<Long> ids = (List) commonGroupList.stream().map((v0) -> { |
| | | List<Long> ids = commonGroupList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | List<CommonGroupOfItem> commonGroupOfItemList = this.commonGroupOfItemService.list(Wrappers.<CommonGroupOfItem>lambdaQuery().in(CommonGroupOfItem::getGroupId, ids) |
| | |
| | | return v0.getGroupId(); |
| | | })); |
| | | if (Func.isNotEmpty(commonGroupOfItemList)) { |
| | | List<Long> workstationIds = (List) commonGroupOfItemList.stream().map((v0) -> { |
| | | List<Long> workstationIds = commonGroupOfItemList.stream().map((v0) -> { |
| | | return v0.getItemId(); |
| | | }).collect(Collectors.toList()); |
| | | List<Workstation> workstations = (List) this.workstationService.listByIds(workstationIds).stream().filter(s -> { |
| | | List<Workstation> workstations = this.workstationService.listByIds(workstationIds).stream().filter(s -> { |
| | | return CommonConstant.ENABLE.equals(s.getStatus()); |
| | | }).filter((v0) -> { |
| | | return Func.isNotEmpty(v0); |
| | | }).collect(Collectors.toList()); |
| | | List<WorkstationInGroupVO> collect1 = (List) workstations.stream().map(workstation -> { |
| | | List<WorkstationInGroupVO> collect1 = workstations.stream().map(workstation -> { |
| | | return WorkstationInGroupVO.builder().isWorkstation(true).isGroup(false).id(workstation.getId()).title(workstation.getName()).code(workstation.getName()).parentId((Long) workstationIdToGroupId.get(workstation.getId())).supportCncRw(workstation.getSupportCncRw()).build(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(collect1)) { |
| | |
| | | return collect; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationInGroupVO> groupFtpDirectoryListLazy(Long groupId) { |
| | | List<CommonGroup> commonGroupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getParentId, groupId).orderByAsc(Arrays.asList(CommonGroup::getSort)) ); |
| | | |
| | |
| | | }, groupId)).orderByAsc((v0) -> { |
| | | return v0.getSort(); |
| | | }));*/ |
| | | List<WorkstationInGroupVO> collect = (List) commonGroupList.stream().map(commonGroup -> { |
| | | List<WorkstationInGroupVO> collect = commonGroupList.stream().map(commonGroup -> { |
| | | return WorkstationInGroupVO.builder().parentId(groupId).isWorkstation(false).isGroup(true).code(commonGroup.getCode()).title(commonGroup.getName()).groupTag(commonGroup.getGroupTag()).id(commonGroup.getId()).build(); |
| | | }).collect(Collectors.toList()); |
| | | List<Long> bindingFtps = (List) this.wsRelationTdService.list().stream().map((v0) -> { |
| | | List<Long> bindingFtps = this.wsRelationTdService.list().stream().map((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }).collect(Collectors.toList()); |
| | | //CommonGroupOfItem::getGroupType |
| | |
| | | return v0.getGroupId(); |
| | | })); |
| | | if (Func.isNotEmpty(commonGroupOfItemList)) { |
| | | List<Long> workstationIds = (List) ((List) commonGroupOfItemList.stream().map((v0) -> { |
| | | List<Long> workstationIds = (commonGroupOfItemList.stream().map((v0) -> { |
| | | return v0.getItemId(); |
| | | }).collect(Collectors.toList())).stream().filter(item -> { |
| | | return !bindingFtps.contains(item); |
| | | }).collect(Collectors.toList()); |
| | | List<Workstation> workstations = (List) this.workstationService.listByIds(workstationIds).stream().filter((v0) -> { |
| | | List<Workstation> workstations = this.workstationService.listByIds(workstationIds).stream().filter((v0) -> { |
| | | return Func.isNotEmpty(v0); |
| | | }).collect(Collectors.toList()); |
| | | List<WorkstationInGroupVO> workstationInGroupVOList = (List) workstations.stream().map(workstation -> { |
| | | List<WorkstationInGroupVO> workstationInGroupVOList = workstations.stream().map(workstation -> { |
| | | return WorkstationInGroupVO.builder().isWorkstation(true).isGroup(false).id(workstation.getId()).title(workstation.getName()).code(workstation.getName()).parentId((Long) workstationIdToGroupId.get(workstation.getId())).supportCncRw(workstation.getSupportCncRw()).build(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(workstationInGroupVOList)) { |
| | |
| | | return collect; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationInGroupVO> groupFtpDirectoryWorkstationList(CommonGroupFtpVO commonGroupFtpVO) { |
| | | List<CommonGroup> groupList = list(Wrappers.<CommonGroup>lambdaQuery() |
| | | .eq(CommonGroup::getGroupType, commonGroupFtpVO.getGroupType()) |
| | | .eq(CommonGroup::getGroupCategory, commonGroupFtpVO.getGroupCategory()) |
| | | .orderByAsc(CommonGroup::getSort)); |
| | | |
| | | List<Long> groupIds = (List) groupList.stream().map((v0) -> { |
| | | List<Long> groupIds = groupList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | //CommonGroupOfItem::getGroupType |
| | |
| | | .in(Func.isNotEmpty(groupIds), CommonGroupOfItem::getGroupId, groupIds) |
| | | .eq(CommonGroupOfItem::getGroupType, commonGroupFtpVO.getGroupType())); |
| | | |
| | | List<Long> bindingFtps = (List) this.wsRelationTdService.list().stream().map((v0) -> { |
| | | List<Long> bindingFtps = this.wsRelationTdService.list().stream().map((v0) -> { |
| | | return v0.getWorkstationId(); |
| | | }).collect(Collectors.toList()); |
| | | |
| | |
| | | return v0.getWorkstationId(); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(ftpRelationIds)) { |
| | | bindingFtps = (List) bindingFtps.stream().filter(s -> { |
| | | bindingFtps = bindingFtps.stream().filter(s -> { |
| | | return !ftpRelationIds.contains(s); |
| | | }).collect(Collectors.toList()); |
| | | } |
| | |
| | | return WorkstationInGroupVO.builder().id(o2.getId()).parentId(o2.getParentId()).title(o2.getName()).code("").isWorkstation(Boolean.FALSE).isGroup(Boolean.TRUE).groupTag(o2.getGroupTag()).build(); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | list2.addAll((Collection) workstations.stream().flatMap(o1 -> { |
| | | list2.addAll(workstations.stream().flatMap(o1 -> { |
| | | Long id = o1.getId(); |
| | | return itemList.stream().filter(o22 -> { |
| | | return id.equals(o22.getItemId()); |
| | |
| | | return list2; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<MdcWorkStationGroupVO> getMdcGroup() { |
| | | ParamBiz param = new ParamBiz(); |
| | | param.setUserId(AuthUtil.getUserId()); |
| | |
| | | //CommonGroup::getGroupType |
| | | List<CommonGroup> groupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getGroupType, CommonGroupTypeEnum.WORKSTATION.getName())); |
| | | if (detail == null) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | List<MdcWorkStationGroupVO> result = JSONArray.parseArray(detail.getParamValue(), MdcWorkStationGroupVO.class); |
| | | if (CollectionUtil.isEmpty(result)) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | Set<Long> groupIdSet = (Set) groupList.stream().map((v0) -> { |
| | | Set<Long> groupIdSet = groupList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toSet()); |
| | | Iterator<MdcWorkStationGroupVO> ite = result.iterator(); |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean deleteGroup(Long groupId) { |
| | | CommonGroup commonGroup = (CommonGroup) getOne(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getId, groupId)); |
| | |
| | | verificationProductionLineCommonGroup(commonGroup); |
| | | validCraftVersionBing(groupId); |
| | | String groupTag = commonGroup.getGroupTag(); |
| | | List<Long> groupIdList = (List) this.baseMapper.getAllSubGroup(groupId, commonGroup.getGroupType(), commonGroup.getGroupCategory()).stream().map((v0) -> { |
| | | List<Long> groupIdList = this.baseMapper.getAllSubGroup(groupId, commonGroup.getGroupType(), commonGroup.getGroupCategory()).stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | //CommonGroupOfItem::getGroupId |
| | |
| | | } |
| | | |
| | | private void validCraftVersionBing(Long groupId) { |
| | | long count = this.lineService.count((Wrapper) Wrappers.lambdaQuery(CraftVersionLine.class).eq((v0) -> { |
| | | return v0.getGroupId(); |
| | | }, groupId)); |
| | | long count = this.lineService.count(Wrappers.lambdaQuery(CraftVersionLine.class).eq(CraftVersionLine::getGroupId, groupId)); |
| | | ThrowFun.isTrue(count > 0).throwMessage(MessageUtils.message("cps.common.group.line.bind.version", new Object[0])); |
| | | } |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public CommonGroup getDefaultGroup(String groupType, Integer groupCategory) { |
| | | |
| | | return (CommonGroup) getOne(Wrappers.<CommonGroup>lambdaQuery() |
| | |
| | | .eq(CommonGroup::getName, CommonGroupConstant.WORKSTATION_TYPE.equals(groupType) ? CommonGroupConstant.DEFAULT_NAME : CommonGroupConstant.DEFAULT_GROUP_NAME)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<WorkstationInGroupVO> groupWorkstationList(CommonGroupTypeVO commonGroupTypeVO) { |
| | | List<CommonGroup> groupList = list(Wrappers.<CommonGroup>lambdaQuery().eq(CommonGroup::getGroupType, commonGroupTypeVO.getGroupType()) |
| | | .eq(CommonGroup::getGroupCategory, commonGroupTypeVO.getGroupCategory()) |
| | |
| | | }, (v0) -> { |
| | | return v0.getName(); |
| | | })); |
| | | List<WorkstationInGroupVO> list = (List) groupList.stream().filter(o -> { |
| | | List<WorkstationInGroupVO> list = groupList.stream().filter(o -> { |
| | | return Func.isNotEmpty(o.getParentId()); |
| | | }).map(o2 -> { |
| | | return WorkstationInGroupVO.builder().id(o2.getId()).parentId(o2.getParentId()).parentName((String) groupMap.get(o2.getParentId())).title(o2.getName()).code("").isWorkstation(Boolean.FALSE).isGroup(Boolean.TRUE).groupTag(o2.getGroupTag()).build(); |
| | | }).collect(Collectors.toList()); |
| | | list.addAll((Collection) workstations.stream().flatMap(o1 -> { |
| | | list.addAll(workstations.stream().flatMap(o1 -> { |
| | | Long id = o1.getId(); |
| | | return itemList.stream().filter(o22 -> { |
| | | return id.equals(o22.getItemId()); |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public Map<Long, Set<Long>> groupWorkstationMap(List<String> groupIds) { |
| | | //CommonGroupOfItem::getGroupId |
| | | List<CommonGroupOfItem> groupOfItems = this.commonGroupOfItemService.list(Wrappers.<CommonGroupOfItem>lambdaQuery() |
| | |
| | | }, Collectors.toSet()))); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICommonGroupService |
| | | @Override |
| | | public List<JimuTreeVO> groupWorkstationListJimu(String pid) { |
| | | List<JimuTreeVO> result = new ArrayList<>(); |
| | | if (Func.isEmpty(pid)) { |