¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.code.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.code.bo.TreeWrapperOptions; |
| | | import com.vci.ubcs.code.entity.CodeClassify; |
| | | import com.vci.ubcs.code.entity.CodeClstemplateEntity; |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyMapper; |
| | | import com.vci.ubcs.code.mapper.CodeClstemplateMapper; |
| | | import com.vci.ubcs.code.service.ICodeClassifyService; |
| | | import com.vci.ubcs.code.service.ICodeKeyattrrepeatService; |
| | | import com.vci.ubcs.code.service.ICodeRuleService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.TreeQueryObject; |
| | | import com.vci.ubcs.com.vci.starter.revision.service.RevisionModelUtil; |
| | | import com.vci.ubcs.com.vci.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.com.vci.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.*; |
| | | |
| | | @Service |
| | | public class CodeClassifyServiceImpl extends ServiceImpl<CodeClassifyMapper, CodeClassify> implements ICodeClassifyService { |
| | | |
| | | @Resource |
| | | private CodeClassifyMapper codeClassifyMapper; |
| | | |
| | | @Resource |
| | | private CodeClstemplateMapper codeClstemplateMapper; |
| | | |
| | | @Resource |
| | | private ICodeRuleService codeRuleService; |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Resource |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Resource |
| | | private ICodeKeyattrrepeatService iCodeKeyattrrepeatService; |
| | | /** |
| | | * ä¸çº§èç¹ç屿§åç§° |
| | | */ |
| | | public static final String PARENT_FIELD_NAME = "parentCodeClassifyOid"; |
| | | /** |
| | | * ä½¿ç¨æ¥è¯¢å°è£
卿¥æ¥è¯¢ |
| | | * @param wrapper æ¥è¯¢å°è£
å¨ |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClassify> selectByWrapper(Wrapper wrapper) { |
| | | return codeClassifyMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CodeClassifyVO> selectPlCodeClassifyPage(IPage<CodeClassifyVO> page, CodeClassifyVO plCodeClassify) { |
| | | return page.setRecords(codeClassifyMapper.selectPlCodeClassifyPage(page, plCodeClassify)); |
| | | } |
| | | |
| | | @Override |
| | | public R addSave(CodeClassify codeClassifyEntity) { |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyEntity.getParentCodeClassifyOid()) && StringUtils.isNotBlank(codeClassifyEntity.getBtmTypeId())){ |
| | | return R.fail("åªæå¨é¡¶å±ç主é¢åºåç±»æè½è®¾ç½®ä¸å¡ç±»å"); |
| | | } |
| | | codeClassifyEntity.setCreator(AuthUtil.getUser().getUserName()); |
| | | codeClassifyEntity.setCreateTime(new Date()); |
| | | codeClassifyEntity.setTs(new Date()); |
| | | codeClassifyEntity.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | codeClassifyEntity.setLastModifyTime(new Date()); |
| | | int insertNumber = codeClassifyMapper.insert(codeClassifyEntity); |
| | | return R.status(SqlHelper.retBool(insertNumber)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºåç±» |
| | | * @param codeClassifyEntity 主é¢åºåç±»æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public R editSave(CodeClassify codeClassifyEntity) { |
| | | if(codeClassifyEntity == null || codeClassifyEntity.getOid() == null){ |
| | | return R.fail("ä¼ å
¥æ°æ®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | //æ£æ¥ts |
| | | Map<String,Object> condition = new HashMap<>(2); |
| | | condition.put("oid",codeClassifyEntity.getOid()); |
| | | condition.put("ts",codeClassifyEntity.getTs()); |
| | | CodeClassify detail = codeClassifyMapper |
| | | .selectOne(Condition.getQueryWrapper(condition,CodeClassify.class)); |
| | | if(detail == null){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyEntity.getParentCodeClassifyOid()) && StringUtils.isNotBlank(codeClassifyEntity.getBtmTypeId())){ |
| | | return R.fail("åªæå¨é¡¶å±ç主é¢åºåç±»æè½è®¾ç½®ä¸å¡ç±»å"); |
| | | } |
| | | codeClassifyEntity.setLastModifier(AuthUtil.getUser().getUserName()); |
| | | codeClassifyEntity.setLastModifyTime(new Date()); |
| | | int insertNumber = codeClassifyMapper.updateById(codeClassifyEntity); |
| | | |
| | | // //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çãåªæå¯ç¨ç¶æçåç±»ææ¨é |
| | | // if(FRAMEWORK_DATA_ENABLED.equals(codeClassifyDO.getLcStatus())); |
| | | // { |
| | | // codeDuckingServiceI.insertCache1(CACHE_TYPE_CLASSIFY_EDIT,FRAMEWORK_DATA_ENABLED,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, codeClassifyDO.getOid(), codeClassifyDTO.getTs()); |
| | | // } |
| | | return R.status(SqlHelper.retBool(insertNumber)); |
| | | // return BaseResult.success(codeClassifyDO2VO(codeClassifyDO)); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥ 主é¢åºåç±»æ¯å¦å é¤ |
| | | * @param codeClassifyEntity 主é¢åºåç±»æ°æ®ä¼ è¾å¯¹è±¡ï¼å¿
é¡»è¦æoidåts屿§ |
| | | * @return æ§è¡ç»æ success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | @Override |
| | | public R checkIsCanDelete(CodeClassify codeClassifyEntity) { |
| | | if(codeClassifyEntity == null || codeClassifyEntity.getOid() == null){ |
| | | return R.fail("ä¼ å
¥æ°æ®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | codeClassifyEntity = selectByOid(codeClassifyEntity.getOid()); |
| | | return checkIsCanDeleteForDO(codeClassifyEntity); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | private CodeClassify selectByOid(String oid){ |
| | | |
| | | CodeClassify codeClassifyEntity = codeClassifyMapper.selectById(oid.trim()); |
| | | if(codeClassifyEntity == null || StringUtils.isBlank(codeClassifyEntity.getOid())){ |
| | | throw new ServiceException("dataOidNotExist");//æ ¹æ®ä¸»é®idæªæ¥å°ç¸å
³æ°æ® |
| | | } |
| | | return codeClassifyEntity; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | * @param codeClassifyEntity æ°æ®åºä¸çæ°æ®å¯¹è±¡ |
| | | * @return success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | private R checkIsCanDeleteForDO(CodeClassify codeClassifyEntity) { |
| | | |
| | | //æ£æ¥ts |
| | | Map<String,Object> condition = new HashMap<>(2); |
| | | condition.put("oid",codeClassifyEntity.getOid()); |
| | | condition.put("ts",codeClassifyEntity.getTs()); |
| | | CodeClassify detail = codeClassifyMapper |
| | | .selectOne(Condition.getQueryWrapper(condition,CodeClassify.class)); |
| | | if(detail == null){//䏿¯ææ°çä¸è®©æ¹ |
| | | throw new ServiceException("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | // return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | //æ ¡éªä¸çº§æ¯å¦æå¼ç¨ |
| | | if(checkChildIsLinked(detail.getOid())){ |
| | | return R.fail("dataCascadeLinkedNotDelete"); |
| | | } |
| | | return R.data(checkHasChild(detail.getOid())); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥æ¯å¦æä¸çº§æ¯å¦å
³èäºæ°æ® |
| | | * |
| | | * @param oid ä¸»é® |
| | | * @return true 表示æå¼ç¨ï¼false表示没æå¼ç¨ |
| | | */ |
| | | @Override |
| | | public boolean checkChildIsLinked(String oid) { |
| | | |
| | | Map<String,String> childOids = codeClassifyMapper.selectAllLevelChildOid(oid.trim()); |
| | | if(!CollectionUtils.isEmpty(childOids)){ |
| | | for(String childOid: childOids.keySet()){ |
| | | if(!checkIsLinked(childOid)){ |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦è¢«å¼ç¨ |
| | | * @param oid ä¸»é® |
| | | */ |
| | | private boolean checkIsLinked(String oid) { |
| | | //TODO æ·»å éè¦æ ¡éªå¼ç¨çå°æ¹ |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkHasChild(String oid) { |
| | | if(StringUtils.isBlank(oid)){ |
| | | throw new ServiceException("oidä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | return codeClassifyMapper.checkHasChild(oid.trim()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å é¤ä¸»é¢åºåç±» |
| | | * @param codeClassify 主é¢åºåç±»æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | */ |
| | | @Override |
| | | public R deleteCodeClassify(CodeClassify codeClassify) { |
| | | |
| | | if(codeClassify == null || codeClassify.getOid() == null){ |
| | | throw new ServiceException("ä¼ å
¥åæ°ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | codeClassify = codeClassifyMapper.selectById(codeClassify.getOid()); |
| | | |
| | | R result = checkIsCanDeleteForDO(codeClassify); |
| | | |
| | | //å
ç®ç§°æ¯å¦æå
³è模æ¿ï¼ææ¨¡æ¿è¦å
å é¤ |
| | | Map<String,Object> condition = new HashMap<>(2); |
| | | condition.put("codeClassifyOid",codeClassify.getOid()); |
| | | List<CodeClstemplateEntity> codeClstemplateEntities = codeClstemplateMapper.selectByMap(condition); |
| | | // VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(CodeClassifyTemplateDO.class); |
| | | // queryWrapper.addQueryMap("codeClassifyOid",codeClassifyDTO.getOid()); |
| | | // List<CodeClassifyTemplateDO> codeClassifyTemplateDOListHaveTemplate = codeClassifyTemplateMapper.selectByWrapper(queryWrapper); |
| | | if(codeClstemplateEntities.size()>0){ |
| | | return R.fail("åç±»å
³è模æ¿ï¼è¯·å
å é¤!"); |
| | | } |
| | | |
| | | //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çã |
| | | //1ãæ¥è¯¢è¦å é¤çç¶ç±»æ°æ® |
| | | List<CodeClassify> deletes = new ArrayList<CodeClassify>(); |
| | | deletes.add(codeClassify); |
| | | |
| | | if(result.isSuccess()) { |
| | | //æ¾ä¸çº§çï¼è¿ä¸ªæ¯å¯ä»¥å é¤çæ¶å |
| | | Map<String,String> childrenOids = codeClassifyMapper.selectAllLevelChildOid(codeClassify.getOid().trim()); |
| | | if (!CollectionUtils.isEmpty(childrenOids)) { |
| | | Collection<Collection<String>> childrenCollections = VciBaseUtil.switchCollectionForOracleIn(childrenOids.keySet()); |
| | | for(Collection<String> s : childrenCollections){ |
| | | |
| | | //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çã |
| | | //2ãæ¥è¯¢è¦å é¤çåç±»æ°æ® |
| | | List<CodeClassify> codeClassifyDOList = codeClassifyMapper.selectBatchIds(s); |
| | | deletes.addAll(codeClassifyDOList); |
| | | codeClassifyMapper.deleteBatchIds(s); |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | return result; |
| | | } |
| | | |
| | | //æ§è¡å é¤æä½ |
| | | int deleteCount = codeClassifyMapper.deleteById(codeClassify.getOid()); |
| | | |
| | | //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥ |
| | | for (CodeClassify codeClassifyTemp:deletes){ |
| | | //codeDuckingServiceI.insertCache1(CACHE_TYPE_CLASSIFY_DELETE,FRAMEWORK_DATA_DISABLED,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, codeClassifyDO1.getOid(), DateUtils.addHours(new Date(),1));//è¿éæ¯å½åæ¶é´ |
| | | |
| | | //åå¨è¦å é¤çæ°æ® |
| | | // CacheUtil.put(); |
| | | CacheUtil.put("ubcs:code", "bean:id:", codeClassifyTemp.getOid(), codeClassifyTemp); |
| | | // codeDuckingServiceI.cacheDeleteData(codeClassifyTemp.getOid(), codeClassifyTemp); |
| | | } |
| | | return R.data(deleteCount>0); |
| | | // return null; |
| | | } |
| | | |
| | | /** |
| | | * å¯ç¨ãåç¨ |
| | | * @param oid ä¸»é® |
| | | * @param lcStatus ç¶æ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public R updateLcStatus(String oid, String lcStatus){ |
| | | |
| | | //æ¥è¯¢ä¿®æ¹åts |
| | | CodeClassify codeClassify = codeClassifyMapper.selectById(oid);//ä¸»è¦æ¯ä¸ºäºæ¥è¯¢ts |
| | | codeClassify.setLcStatus(lcStatus); |
| | | //å¯ç¨ãåç¨ |
| | | // int u = codeClassifyMapper.updateLcStatus(oid,lcStatus); |
| | | int count = codeClassifyMapper.updateById(codeClassify); |
| | | // //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çã |
| | | // if(u!=0) { |
| | | // codeDuckingServiceI.insertCache1(lcStatus,lcStatus,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, oid, codeClassifyDO_old.getTs()); |
| | | // } |
| | | return R.data(SqlHelper.retBool(count)); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±» |
| | | * @param oidCollections 主é®éåï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return 主é¢åºåç±»æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public Collection<CodeClassifyVO> listCodeClassifyByOids(Collection<String> oidCollections) { |
| | | VciBaseUtil.alertNotNull(oidCollections,"æ°æ®å¯¹è±¡ä¸»é®éå"); |
| | | List<CodeClassify> codeClassifyDOList = listCodeClassifyDOByOidCollections(oidCollections); |
| | | return codeClassifyDO2VOs(codeClassifyDOList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使ç¨ä¸»é®éåæ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oidCollections 主é®çéå |
| | | * @return æ°æ®å¯¹è±¡å表 |
| | | */ |
| | | private List<CodeClassify> listCodeClassifyDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeClassify> codeClassifyList = new ArrayList<CodeClassify>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeClassify> tempDOList = codeClassifyMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeClassifyList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeClassifyList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¹éæ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassifys æ°æ®å¯¹è±¡å表 |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> codeClassifyDO2VOs(Collection<CodeClassify> codeClassifys) { |
| | | List<CodeClassifyVO> voList = new ArrayList<CodeClassifyVO>(); |
| | | if(!CollectionUtils.isEmpty(codeClassifys)){ |
| | | for(CodeClassify s: codeClassifys){ |
| | | CodeClassifyVO vo = codeClassifyDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®å¯¹è±¡è½¬æ¢ä¸ºæ¾ç¤ºå¯¹è±¡ |
| | | * @param codeClassify æ°æ®å¯¹è±¡ |
| | | * @return æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO codeClassifyDO2VO(CodeClassify codeClassify) { |
| | | CodeClassifyVO vo = new CodeClassifyVO(); |
| | | if(codeClassify != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeClassify,vo); |
| | | //妿ælcstatusçç±»çè¯ |
| | | vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * åç
§æ 主é¢åºåç±» |
| | | * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | * @return 主é¢åºåç±»æ¾ç¤ºæ |
| | | */ |
| | | @Override |
| | | public List<Tree> referTree(TreeQueryObject treeQueryObject) { |
| | | if(treeQueryObject == null){ |
| | | treeQueryObject = new TreeQueryObject(); |
| | | } |
| | | if(treeQueryObject.getConditionMap() == null){ |
| | | treeQueryObject.setConditionMap(new HashMap<>()); |
| | | } |
| | | if(treeQueryObject.getConditionMap().containsKey(LC_STATUS)) { |
| | | treeQueryObject.getConditionMap().remove(LC_STATUS); |
| | | } |
| | | if(treeQueryObject.getExtandParamsMap() ==null || !treeQueryObject.getExtandParamsMap().containsKey(REFER_SHOW_DISABLED_QUERY_KEY)) { |
| | | } |
| | | treeQueryObject.getConditionMap().put(LC_STATUS, FRAMEWORK_DATA_ENABLED); |
| | | return treeCodeClassify(treeQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸»é¢åºåç±» æ |
| | | * @param treeQueryObject æ æ¥è¯¢å¯¹è±¡ |
| | | * @return 主é¢åºåç±» æ¾ç¤ºæ |
| | | */ |
| | | @Override |
| | | public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) { |
| | | List<CodeClassify> doList =codeClassifyMapper.selectCodeClassifyVOByTree(treeQueryObject.getParentOid()); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME.toLowerCase(Locale.ROOT)); |
| | | treeWrapperOptions.copyFromTreeQuery(treeQueryObject); |
| | | List<Tree> tree= revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO 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=codeClassifyMapper.checkHasChild(trees.getOid()); |
| | | if(checkHasChild){ |
| | | trees.setLeaf(false); |
| | | }else{ |
| | | trees.setLeaf(true); |
| | | } |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | // /** |
| | | // * æ ¹æ®æ å½¢æ¥è¯¢å¯¹è±¡æ¥æ¥è¯¢æ°æ®å¯¹è±¡ |
| | | // * |
| | | // * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | // * @return æ¥è¯¢ç»æ,æ°æ®å¯¹è±¡ |
| | | // */ |
| | | // @Override |
| | | // public List<CodeClassifyVO> selectCodeClassifyDOByTree(TreeQueryObject treeQueryObject) { |
| | | // VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(null,CodeClassifyDO.class); |
| | | // VciParentQueryOption parentQueryOption = new VciParentQueryOption(); |
| | | // parentQueryOption.setParentFieldName(PARENT_FIELD_NAME); |
| | | // queryWrapperForDO.parentQueryChild(treeQueryObject,parentQueryOption); |
| | | // if(StringUtils.isBlank(treeQueryObject.getSort())) { |
| | | // PageHelper pageHelper = new PageHelper(-1); |
| | | // pageHelper.addDefaultAsc("id"); |
| | | // queryWrapperForDO.setPageHelper(pageHelper); |
| | | // } |
| | | // return codeClassifyMapper.selectByWrapper(queryWrapperForDO); |
| | | // } |
| | | |
| | | /** |
| | | * 导åºåç±» |
| | | * |
| | | * @param oid åç±»ä¸»é® |
| | | * @return excelæä»¶è·¯å¾ |
| | | */ |
| | | @Override |
| | | public String exportClassify(String oid) { |
| | | // VciBaseUtil.alertNotNull(oid,"åç±»ç主é®"); |
| | | // CodeClassify codeClassify = codeClassifyMapper.selectById(oid); |
| | | // codeClassify.setDataLevel(0); |
| | | // codeClassify.setPath(codeClassify.getId()); |
| | | // List<CodeClassifyVO> codeClassifyVOS = listChildrenClassify(oid, true, "id", false); |
| | | // if(codeClassifyVOS ==null){ |
| | | // codeClassifyVOS = new ArrayList<>(); |
| | | // } |
| | | // CodeClassifyVO codeClassifyVO = new CodeClassifyVO(); |
| | | // BeanUtils.copyProperties(codeClassify,codeClassifyVO); |
| | | // codeClassifyVOS.add(codeClassifyVO); |
| | | // |
| | | // //æ¥è¯¢ä¸ä¸è§åçç¼å·ï¼åå
³é®å±æ§éå¤è§å |
| | | // List<String> codeRuleOids = codeClassifyVOS.stream().filter(s -> org.apache.commons.lang3.StringUtils.isNotBlank(s.getCoderuleoid())).map(CodeClassifyVO::getCoderuleoid).collect(Collectors.toList()); |
| | | // Map<String, CodeRuleVO> ruleVOMap = new HashMap<>(); |
| | | // if(!CollectionUtils.isEmpty(codeRuleOids)){ |
| | | // VciBaseUtil.switchCollectionForOracleIn(codeRuleOids).stream().forEach(ruleOids->{ |
| | | // Collection<CodeRuleVO> ruleVOS = codeRuleService.listCodeRuleByOids(ruleOids); |
| | | // ruleVOMap.putAll( Optional.ofNullable(ruleVOS).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t))); |
| | | // }); |
| | | // } |
| | | // //æ¾å
³é®å±æ§è§å |
| | | // List<String> keyRuleOids = codeClassifyVOS.stream().filter(s -> org.apache.commons.lang3.StringUtils.isNotBlank(s.getCodekeyattrrepeatoid())).map(CodeClassifyVO::getCodekeyattrrepeatoid).collect(Collectors.toList()); |
| | | // Map<String, CodeKeyAttrRepeatRuleVO> keyRuleVOMap = new HashMap<>(); |
| | | // if(!CollectionUtils.isEmpty(keyRuleOids)){ |
| | | // VciBaseUtil.switchCollectionForOracleIn(keyRuleOids).stream().forEach(ruleOids->{ |
| | | // Collection<CodeKeyAttrRepeatRuleVO> ruleVOS = iCodeKeyattrrepeatService.listCodeKeyAttrRepeatRuleByOids(ruleOids); |
| | | // keyRuleVOMap.putAll( Optional.ofNullable(ruleVOS).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t))); |
| | | // }); |
| | | // } |
| | | // //ok,åexcel |
| | | // String excelName = LocalFileUtil.getDefaultTempFolder() + File.separator + "导åºåç±».xls"; |
| | | // try { |
| | | // new File(excelName).createNewFile(); |
| | | // } catch (Throwable e) { |
| | | // throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelName}, e); |
| | | // } |
| | | // List<WriteExcelData> excelDataList = new ArrayList<>(); |
| | | // excelDataList.add(new WriteExcelData(0,0,"åç±»ç¼å·")); |
| | | // excelDataList.add(new WriteExcelData(0,1,"åç±»åç§°")); |
| | | // excelDataList.add(new WriteExcelData(0,2,"ä¸å¡ç±»åç¼å·")); |
| | | // excelDataList.add(new WriteExcelData(0,3,"ä¸å¡ç±»ååç§°")); |
| | | // excelDataList.add(new WriteExcelData(0,4,"ç¼ç è§åç¼å·")); |
| | | // excelDataList.add(new WriteExcelData(0,5,"ç¼ç è§ååç§°")); |
| | | // excelDataList.add(new WriteExcelData(0,6,"æ¥éè§åç¼å·")); |
| | | // excelDataList.add(new WriteExcelData(0,7,"æ¥éè§ååç§°")); |
| | | // excelDataList.add(new WriteExcelData(0,8,"å类路å¾")); |
| | | // excelDataList.add(new WriteExcelData(0,9,"ç¶æ")); |
| | | // excelDataList.add(new WriteExcelData(0,10,"åç±»å±çº§")); |
| | | // excelDataList.add(new WriteExcelData(0,11,"æè¿°")); |
| | | // for (int i = 0; i < codeClassifyVOS.size(); i++) { |
| | | // CodeClassifyVO vo = codeClassifyVOS.get(i); |
| | | // excelDataList.add(new WriteExcelData(i+1,0,vo.getId())); |
| | | // excelDataList.add(new WriteExcelData(i+1,1,vo.getName())); |
| | | // excelDataList.add(new WriteExcelData(i+1,2,vo.getBtmtypeid())); |
| | | // excelDataList.add(new WriteExcelData(i+1,3,vo.getBtmtypename())); |
| | | // excelDataList.add(new WriteExcelData(i+1,4, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCoderuleoid())?ruleVOMap.getOrDefault(vo.getCoderuleoid(),new CodeRuleVO()).getId():"")); |
| | | // excelDataList.add(new WriteExcelData(i+1,5, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCoderuleoid())?ruleVOMap.getOrDefault(vo.getCoderuleoid(),new CodeRuleVO()).getName():"")); |
| | | // excelDataList.add(new WriteExcelData(i+1,6, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCodekeyattrrepeatoid())?keyRuleVOMap.getOrDefault(vo.getCodekeyattrrepeatoid(),new CodeKeyAttrRepeatRuleVO()).getId():"")); |
| | | // excelDataList.add(new WriteExcelData(i+1,7, org.apache.commons.lang3.StringUtils.isNotBlank(vo.getCodekeyattrrepeatoid())?keyRuleVOMap.getOrDefault(vo.getCodekeyattrrepeatoid(),new CodeKeyAttrRepeatRuleVO()).getName():"")); |
| | | // excelDataList.add(new WriteExcelData(i+1,8,vo.getOid().equalsIgnoreCase(classifyVO.getOid())?vo.getPath():classifyVO.getPath() + vo.getPath())); |
| | | // excelDataList.add(new WriteExcelData(i+1,9,FrameworkDataLCStatus.getTextByValue(vo.getLcStatus()))); |
| | | // excelDataList.add(new WriteExcelData(i+1,10,vo.getDataLevel())); |
| | | // excelDataList.add(new WriteExcelData(i+1,11,vo.getDescription())); |
| | | // } |
| | | // WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | // ExcelUtil.writeDataToFile(excelName, excelOption); |
| | | return null; |
| | | // return excelName; |
| | | } |
| | | |
| | | /** |
| | | * è·åå级ç主é¢åºåç±» |
| | | * |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | | * @param allLevel æ¯å¦ææçå±çº§ |
| | | * @param fieldInPath å¨è·¯å¾ä¸çåæ®µ |
| | | * @param enable æ¯å¦åªæ¾ç¤ºå¯ç¨ |
| | | * @return åç±»çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> listChildrenClassify(String codeClassifyOid, boolean allLevel, String fieldInPath, boolean enable) { |
| | | if(allLevel){ |
| | | List<CodeClassify> classifyDOS = codeClassifyMapper.selectAllLevelChildHasPath(codeClassifyOid); |
| | | if(!CollectionUtils.isEmpty(classifyDOS)){ |
| | | classifyDOS = classifyDOS.stream().filter(s->FRAMEWORK_DATA_ENABLED.equalsIgnoreCase(s.getLcStatus())).collect(Collectors.toList()); |
| | | } |
| | | return codeClassifyDO2VOs(classifyDOS); |
| | | }else{ |
| | | //åªæ¥è¯¢ä¸æ¡ï¼é£path就没å¿
è¦æ¥è¯¢äº |
| | | Map<String,Object> conditionMap = new HashMap<>(); |
| | | conditionMap.put("parentcodeclassifyoid",codeClassifyOid); |
| | | if (enable){ |
| | | conditionMap.put("lcstatus",FRAMEWORK_DATA_ENABLED); |
| | | } |
| | | return codeClassifyDO2VOs(codeClassifyMapper.selectByMap(conditionMap)); |
| | | } |
| | | } |
| | | } |