| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.code.entity.DockingPreAttrRange; |
| | | import com.vci.ubcs.code.entity.DockingPreClassify; |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.DockingPreClassifyMapper; |
| | | import com.vci.ubcs.code.service.IDockingPreClassifyService; |
| | | import com.vci.ubcs.code.service.IDockingPreViewModelService; |
| | | import com.vci.ubcs.code.vo.pagemodel.DockingPreClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.DockingPreViewModelVO; |
| | | import com.vci.ubcs.code.wrapper.DockingPreClassifyWrapper; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.revision.model.TreeWrapperOptions; |
| | | import com.vci.ubcs.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | import static com.vci.ubcs.code.constant.MdmBtmTypeConstant.CODE_CLASSIFY_OID_FIELD; |
| | | import static com.vci.ubcs.code.service.impl.CodeClassifyServiceImpl.PARENT_FIELD_NAME; |
| | | |
| | | /** |
| | | * 集团分类业务服务 |
| | |
| | | * @date 2023-05-23 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class DockingPreClassifyServiceImpl extends ServiceImpl<DockingPreClassifyMapper, DockingPreClassify> implements IDockingPreClassifyService { |
| | | /*** |
| | | * 集团分类属性 |
| | | */ |
| | | @Resource |
| | | private DockingPreClassifyMapper dockingPreClassifyMapper; |
| | | |
| | | /*** |
| | | * 集团分类属性 |
| | | */ |
| | | @Resource |
| | | private IDockingPreViewModelService dockingPreViewModelService; |
| | | |
| | | /** |
| | | * 对象的操作 |
| | | */ |
| | | @Resource |
| | | private RevisionModelUtil revisionModelUtil; |
| | | /*** |
| | | * 集团分类树对象查 |
| | | *@param treeQueryObject 集团分类查询对象 |
| | | *@return 返回分类树对象 |
| | | */ |
| | | @Override |
| | | public List<Tree> treeCompanyGroupClassify(TreeQueryObject treeQueryObject) { |
| | | log.info("获取集团分类树start..."); |
| | | Map<String,String> conditionMap= treeQueryObject.getConditionMap(); |
| | | TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME.toLowerCase(Locale.ROOT)); |
| | | treeWrapperOptions.copyFromTreeQuery(treeQueryObject); |
| | | List<DockingPreClassifyVO> dockingPreClassifyVOS= getCompanyGourpClassByParentId(treeQueryObject.getParentOid(),true); |
| | | List<Tree> tree= revisionModelUtil.doList2Trees(dockingPreClassifyVOS,treeWrapperOptions,(DockingPreClassifyVO s) ->{ |
| | | //可以在这里处理树节点的显示 |
| | | return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s |
| | | .getLcStatus()) ? (" 【停用】 ") : ""); |
| | | }); |
| | | Iterator var6 = tree.listIterator(); |
| | | while(var6.hasNext()){ |
| | | Tree trees = (Tree) var6.next(); |
| | | boolean checkHasChild=dockingPreClassifyMapper.checkHasChild(trees.getOid()); |
| | | //如果与条件传过来的值匹配的上则设置为选中 |
| | | if(conditionMap.containsKey(CODE_CLASSIFY_OID_FIELD)){ |
| | | trees.setChecked(true); |
| | | } |
| | | ; |
| | | if(checkHasChild){ |
| | | trees.setLeaf(false); |
| | | }else{ |
| | | trees.setLeaf(true); |
| | | } |
| | | } |
| | | log.info("获取集团分类树end..."); |
| | | return tree; |
| | | } |
| | | |
| | | /*** |
| | | * 根据父分类id查询层级树数据对象集合 |
| | | * @param pid 集团分类的oid |
| | | * @return 返回层级树数据对象集合 |
| | | */ |
| | | private List<DockingPreClassifyVO> getCompanyGourpClassByParentId(String pid,boolean isContainView){ |
| | | log.info("根据父分类pid->"+pid+"查询层级树数据对象集合start..."); |
| | | List<DockingPreClassify> doList =dockingPreClassifyMapper.selectCompanyGroupClassifyVOByTree(pid); |
| | | List<DockingPreClassifyVO>dockingPreClassifyVOS= DockingPreClassifyWrapper.build().entityVOs(doList); |
| | | if(isContainView){ |
| | | dockingPreClassifyVOS.stream().forEach(dockingPreClassifyVO -> { |
| | | List<DockingPreViewModelVO> dockingViewVOS= dockingPreViewModelService.selectDockingPreViewModelByClassId(dockingPreClassifyVO.getOid(),isContainView); |
| | | dockingPreClassifyVO.setDockingPreViewModelVOList(dockingViewVOS); |
| | | }); |
| | | } |
| | | log.info("根据父分类pid->"+pid+"查询层级树数据对象集合end..."); |
| | | return dockingPreClassifyVOS; |
| | | } |
| | | } |