¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO; |
| | | import com.vci.ubcs.code.entity.*; |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.*; |
| | | import com.vci.ubcs.code.po.CodeClassifyPO; |
| | | 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.CodeAllCodeVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.enums.EnumEnum; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.omd.feign.IBtmTypeClient; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.starter.bo.WriteExcelData; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.ubcs.starter.poi.bo.WriteExcelOption; |
| | | import com.vci.ubcs.starter.poi.constant.ExcelLangCodeConstant; |
| | | import com.vci.ubcs.starter.poi.util.ExcelUtil; |
| | | 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.util.BladeTreeQueryObject; |
| | | import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; |
| | | import com.vci.ubcs.starter.util.LocalFileUtil; |
| | | import com.vci.ubcs.starter.util.MdmBtmTypeConstant; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.LangBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import com.vci.ubcs.system.cache.NacosConfigCache; |
| | | import com.vci.ubcs.system.dto.ClassifyAuthDTO; |
| | | import com.vci.ubcs.system.feign.ISysClient; |
| | | import org.apache.poi.hssf.util.HSSFColor; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | 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.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.awt.event.ItemEvent; |
| | | import java.io.File; |
| | | 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 CodeClassifyTemplateMapper codeClassifyTemplateMapper; |
| | | |
| | | @Resource |
| | | private ICodeRuleService codeRuleService; |
| | | |
| | | @Resource |
| | | private IBtmTypeClient btmTypeClient; |
| | | |
| | | @Resource |
| | | private ISysClient sysClient; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | /** |
| | | * 对象çæä½ |
| | | */ |
| | | @Resource |
| | | private RevisionModelUtil revisionModelUtil; |
| | | |
| | | @Resource |
| | | private ICodeKeyAttrRepeatService iCodeKeyattrrepeatService; |
| | | |
| | | @Resource |
| | | private CodeAllCodeMapper codeAllCodeMapper; |
| | | |
| | | @Resource |
| | | private CodeSerialValueMapper codeSerialValueMapper; |
| | | |
| | | @Resource |
| | | private CodeBasicSecMapper codeBasicSecMapper; |
| | | |
| | | /** |
| | | * ä¸çº§èç¹ç屿§åç§° |
| | | */ |
| | | public static final String PARENT_FIELD_NAME = "parentCodeClassifyOid"; |
| | | |
| | | /** |
| | | * ä½¿ç¨æ¥è¯¢å°è£
卿¥æ¥è¯¢ |
| | | * @param wrapper æ¥è¯¢å°è£
å¨ |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClassify> selectByWrapper(Wrapper wrapper) { |
| | | return codeClassifyMapper.selectList(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ |
| | | * @param wrapper æ¥è¯¢å°è£
å¨ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> select1(Wrapper wrapper) { |
| | | |
| | | return codeClassifyMapper.selectObjs(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<CodeClassifyVO> selectPlCodeClassifyPage(IPage<CodeClassifyVO> page, CodeClassifyVO plCodeClassify) { |
| | | return page.setRecords(codeClassifyMapper.selectPlCodeClassifyPage(page, plCodeClassify,AuthUtil.getTenantId() |
| | | .equals( |
| | | NacosConfigCache |
| | | .getAdminUserInfo() |
| | | .getTenantId() |
| | | ) ? null:AuthUtil.getTenantId())); |
| | | } |
| | | |
| | | /** |
| | | * 主é¢åºå®ä¹è¡¨ æ°å¢ |
| | | * @param |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addSave(CodeClassify codeClassifyEntity) { |
| | | try { |
| | | VciBaseUtil.alertNotNull(codeClassifyEntity.getId(),"主é¢åºç¼å·ä¸è½ä¸ºç©ºï¼",codeClassifyEntity.getName(),"主é¢åºåç§°ä¸è½ä¸ºç©ºï¼"); |
| | | }catch (VciBaseException e){ |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | if(StringUtils.isNotBlank(codeClassifyEntity.getParentCodeClassifyOid()) && StringUtils.isNotBlank(codeClassifyEntity.getBtmTypeId())){ |
| | | return R.fail("åªæå¨é¡¶å±ç主é¢åºåç±»æè½è®¾ç½®ä¸å¡ç±»å"); |
| | | } |
| | | if(StringUtils.isEmpty(codeClassifyEntity.getParentCodeClassifyOid()) && StringUtils.isBlank(codeClassifyEntity.getBtmTypeId())){ |
| | | return R.fail("主é¢åºå
³èçä¸å¡ç±»åä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | QueryWrapper<CodeClassify> classifyQueryWrapper = new QueryWrapper<>(); |
| | | classifyQueryWrapper.eq("parentCodeClassifyOid",codeClassifyEntity.getParentCodeClassifyOid()); |
| | | classifyQueryWrapper.eq("id",codeClassifyEntity.getId()); |
| | | List<CodeClassify> codeClassifyList = baseMapper.selectList(classifyQueryWrapper); |
| | | if(codeClassifyList.size()!=0){ |
| | | return R.fail("å½ååç±»ä¸ä¸å
许åç±»ç¼å·éå¤ï¼è¯·æ£æ¥ï¼ï¼ï¼"); |
| | | } |
| | | if(Func.isNotEmpty(codeClassifyEntity.getParentCodeClassifyOid())){ |
| | | CodeClassify codeClassify = baseMapper.selectOne(Wrappers.<CodeClassify>query().lambda().eq(CodeClassify::getOid, codeClassifyEntity.getParentCodeClassifyOid())); |
| | | codeClassifyEntity.setBtmTypeId(codeClassify.getBtmTypeId()); |
| | | codeClassifyEntity.setBtmTypeName(codeClassify.getBtmTypeName()); |
| | | } |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeClassifyEntity, MdmBtmTypeConstant.CODE_CLASSIFY); |
| | | codeClassifyEntity.setLcStatus(FRAMEWORK_DATA_ENABLED); |
| | | boolean resBoolean = SqlHelper.retBool(codeClassifyMapper.insert(codeClassifyEntity)); |
| | | if (!resBoolean) { |
| | | return R.status(resBoolean); |
| | | } |
| | | // åç±»æ·»å æåï¼ç»ç³»ç»ç®¡çååå½åè§è²å¢å åç±»æéåæ°æ®æé |
| | | ClassifyAuthDTO classifyAuthDTO = new ClassifyAuthDTO(); |
| | | classifyAuthDTO.setClassifyId(codeClassifyEntity.getOid()); |
| | | // classifyAuthDTO.setClassId(codeClassifyEntity.getId()); |
| | | R r = sysClient.saveAddClassifyDefaultAuth(classifyAuthDTO); |
| | | if (!r.isSuccess()) { |
| | | throw new ServiceException("ç»è§è²æäºé»è®¤æéæ¶åºç°é误ï¼åå ï¼"+r.getMsg()); |
| | | } |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¸»é¢åºåç±» |
| | | * @param codeClassifyEntity 主é¢åºåç±»æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R editSave(CodeClassify codeClassifyEntity) { |
| | | if(codeClassifyEntity == null || codeClassifyEntity.getOid() == null){ |
| | | return R.fail("ä¼ å
¥æ°æ®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | //æ£æ¥ts |
| | | CodeClassify detail = codeClassifyMapper.selectById(codeClassifyEntity.getOid()); |
| | | if(!detail.getTs().toString().equals(codeClassifyEntity.getTs().toString())){//䏿¯ææ°çä¸è®©æ¹ |
| | | return R.fail("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(codeClassifyEntity.getParentCodeClassifyOid()) && StringUtils.isNotBlank(codeClassifyEntity.getBtmTypeId())){ |
| | | return R.fail("åªæå¨é¡¶å±ç主é¢åºåç±»æè½è®¾ç½®ä¸å¡ç±»å"); |
| | | } |
| | | // codeClassifyEntity.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | codeClassifyEntity.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount())); |
| | | codeClassifyEntity.setLastModifyTime(new Date()); |
| | | codeClassifyEntity.setTs(new Date()); |
| | | int updateEntity = codeClassifyMapper.updateById(codeClassifyEntity); |
| | | // 妿䏿¯å¶åç»ç¹ï¼åéè¦ä¿®æ¹å
¶ä¸ææçååç±»ï¼æ¯å¦åä¸å
³é®å±æ§æ ¡éªçå¼ |
| | | String oid = codeClassifyEntity.getOid(); |
| | | List<CodeClassify> codeClassifies = codeClassifyMapper.selectStartWithCurrentOid(oid); |
| | | int updateAttr = 0; |
| | | // ä¸ä¸ºç©ºå°±éè¦è¯¥å½ååç±»ä¸ææååç±»çisParticipateCheck |
| | | if(!codeClassifies.isEmpty()){ |
| | | List<String> oids = codeClassifies.stream().map(CodeClassify::getOid).collect(Collectors.toList()); |
| | | LambdaUpdateWrapper<CodeClassify> updateWrapper = Wrappers.<CodeClassify>update() |
| | | .lambda().in(CodeClassify::getOid, oids) |
| | | .set(CodeClassify::getIsParticipateCheck, codeClassifyEntity.getIsParticipateCheck()); |
| | | // ç¶åç±»çä¸å¡ç±»ååäºæ´æ¹ï¼ææååç±»çé½å¾è¿è¡æ´æ¹ |
| | | if(!codeClassifyEntity.getBtmTypeId().equals(detail.getBtmTypeId())){ |
| | | updateWrapper.set(CodeClassify::getBtmTypeId,codeClassifyEntity.getBtmTypeId()) |
| | | .set(CodeClassify::getBtmTypeName,codeClassifyEntity.getBtmTypeName()); |
| | | } |
| | | updateAttr = codeClassifyMapper.update(null,updateWrapper); |
| | | |
| | | } |
| | | |
| | | // //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çãåªæå¯ç¨ç¶æçåç±»ææ¨é |
| | | // 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(updateAttr) & SqlHelper.retBool(updateEntity)); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥ 主é¢åºåç±»æ¯å¦å é¤ |
| | | * @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("ä¼ å
¥æ°æ®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | CodeClassify codeClassifyNew = selectByOid(codeClassifyEntity.getOid()); |
| | | if(codeClassifyNew == null){ |
| | | return R.fail("æªæ¥è¯¢å°ç¸å
³æ°æ®ï¼"); |
| | | } |
| | | codeClassifyNew.setTs(codeClassifyEntity.getTs()); |
| | | return checkIsCanDeleteForDO(codeClassifyEntity); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢æ°æ®å¯¹è±¡ |
| | | * @param oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | private CodeClassify selectByOid(String oid){ |
| | | List<CodeClassify> codeClassifyEntityList = codeClassifyMapper.selectClassifyByKeyAndReseRel("'" + oid.trim() + "'"); |
| | | if (codeClassifyEntityList.isEmpty() || codeClassifyEntityList.get(0) == null || StringUtils.isBlank(codeClassifyEntityList.get(0).getOid())) { |
| | | throw new ServiceException("dataOidNotExist");//æ ¹æ®ä¸»é®idæªæ¥å°ç¸å
³æ°æ® |
| | | } |
| | | return codeClassifyEntityList.get(0); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | * @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(codeClassifyEntity)); |
| | | // .selectOne(Condition.getQueryWrapper(condition,CodeClassify.class)); |
| | | if(detail == null){//䏿¯ææ°çä¸è®©æ¹ |
| | | throw new ServiceException("å½åæ°æ®ä¸æ¯ææ°ï¼è¯·å·æ°ååä¿®æ¹ï¼"); |
| | | } |
| | | //æ ¡éªä¸çº§æ¯å¦æå¼ç¨ |
| | | if(checkChildIsLinked(detail.getOid())){ |
| | | return R.fail("dataCascadeLinkedNotDelete"); |
| | | } |
| | | if(checkHasChild(detail.getOid())){ |
| | | return R.fail("æ¤æ°æ®æä¸çº§ï¼æ æ³è¿è¡å é¤ï¼"); |
| | | } |
| | | return R.status(!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<CodeClassifyTemplate> codeClstemplateEntities = codeClassifyTemplateMapper.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); |
| | | baseMapper.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){ |
| | | |
| | | List<CodeClassify> classifyList = codeClassifyMapper.selectStartWithCurrentOid(oid); |
| | | Date now = new Date(); |
| | | // String userId = String.valueOf(AuthUtil.getUserId()); |
| | | String account = AuthUtil.getUserAccount(); |
| | | classifyList = classifyList.stream().map(s -> { |
| | | s.setLcStatus(lcStatus); |
| | | s.setTs(now); |
| | | s.setLastModifier(account); |
| | | s.setLastModifyTime(now); |
| | | return s; |
| | | }).collect(Collectors.toList()); |
| | | // //æ¥è¯¢ä¿®æ¹åts |
| | | // CodeClassify codeClassify = codeClassifyMapper.selectById(oid);//ä¸»è¦æ¯ä¸ºäºæ¥è¯¢ts |
| | | // codeClassify.setLcStatus(lcStatus); |
| | | // codeClassify.setTs(new Date()); |
| | | // codeClassify.setLastModifyTime(new Date()); |
| | | // codeClassify.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | //å¯ç¨ãåç¨ |
| | | // int u = codeClassifyMapper.updateLcStatus(oid,lcStatus); |
| | | // int count = codeClassifyMapper.updateById(codeClassify); |
| | | codeClassifyMapper.batchUpdateLcStatus(classifyList); |
| | | // //å¤çæ°æ®éæé»è¾,æååæ§è¡éæç¬¬ä¸æ¥,åç±»æ°æ®ç¹æ®å¤çã |
| | | // if(u!=0) { |
| | | // codeDuckingServiceI.insertCache1(lcStatus,lcStatus,DOCKING_DEFAULT_CLASSIFY, DOCKING_DEFAULT_CLASSIFYOID, oid, codeClassifyDO_old.getTs()); |
| | | // } |
| | | // return R.data(SqlHelper.retBool(count)); |
| | | return R.success(""); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·å主é¢åºåç±» |
| | | * @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) throws ServiceException{ |
| | | 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 oid ä¸»é® |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | private CodeClassify selectByOidRel(String oid){ |
| | | |
| | | List<CodeClassify> codeClassifyList = codeClassifyMapper.selectClassifyByKeyAndReseRel("'"+oid.trim()+"'"); |
| | | // CodeClassify codeClassifyEntity = (CodeClassify) codeClassifyList; |
| | | if(codeClassifyList.size() == 0 ){ |
| | | throw new ServiceException("dataNotExist");//æ ¹æ®ä¸»é®idæªæ¥å°ç¸å
³æ°æ® |
| | | } |
| | | // if(codeClassifyEntity == null || StringUtils.isBlank(codeClassifyEntity.getOid())){ |
| | | // throw new ServiceException("dataOidNotExist");//æ ¹æ®ä¸»é®idæªæ¥å°ç¸å
³æ°æ® |
| | | // } |
| | | return codeClassifyList.get(0); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸»é¢åºåç±» æ |
| | | * @param treeQueryObject æ æ¥è¯¢å¯¹è±¡ |
| | | * @return 主é¢åºåç±» æ¾ç¤ºæ |
| | | */ |
| | | @Override |
| | | public List<Tree> treeCodeClassify(TreeQueryObject treeQueryObject) throws ServiceException{ |
| | | List<CodeClassify> doList = null; |
| | | String id = null; |
| | | String lcStatus = null; |
| | | if(!Objects.isNull(treeQueryObject.getConditionMap())){ |
| | | id = treeQueryObject.getConditionMap().getOrDefault("id",null); |
| | | lcStatus = treeQueryObject.getConditionMap().getOrDefault("lcStatus",null); |
| | | } |
| | | if(StringUtils.isNotBlank(id) || StringUtils.isNotBlank(lcStatus) ){ |
| | | //String tableName = this.getTableName(treeQueryObject.getConditionMap().get("btmTypeId"),treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus")); |
| | | // TODO: 2024-1-24 23:25æå»æäºæå è½½ï¼å 为ä¼å½±åæ°æ®ææè¿æ»¤ååç±»æç´¢åè½ï¼èä¸è¿å¿æè§æ²¡å¿
è¦åæå è½½ |
| | | doList = codeClassifyMapper |
| | | .selectCodeClassifyDOByTree( |
| | | treeQueryObject.getConditionMap().get("id"), |
| | | treeQueryObject.getConditionMap().get("lcStatus"), |
| | | treeQueryObject.getParentOid(), |
| | | VciBaseUtil.checkAdminTenant() ? null:AuthUtil.getTenantId() |
| | | /*tableName*/ |
| | | ); |
| | | }else{ |
| | | // åªè¦å端ä¼ä¼ åæ°è¿æ¥å°±ä¸ä¼åºç°èµ°è¿å¥çæ
åµï¼æä»¥æ¥è¯¢æ»æ°æ²¡å¨è¿å¿æ·»å |
| | | doList =codeClassifyMapper.selectCodeClassifyVOByTree( |
| | | treeQueryObject.getParentOid(), |
| | | VciBaseUtil.checkAdminTenant() ? null:AuthUtil.getTenantId() |
| | | ); |
| | | } |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME); |
| | | treeWrapperOptions.copyFromTreeQuery(treeQueryObject); |
| | | List<Tree> tree = revisionModelUtil.doList2Trees(voList,treeWrapperOptions,(CodeClassifyVO s) ->{ |
| | | //å¯ä»¥å¨è¿éå¤çæ èç¹çæ¾ç¤º |
| | | return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s |
| | | .getLcStatus()) ? (" ãåç¨ã ") : ""); |
| | | }); |
| | | // éè¶
ç®¡è¿æ»¤æªææçåç±» |
| | | if(!VciBaseUtil.checkAdminTenant()){ |
| | | // é£äºåç±»å
·å¤æ¥çæé |
| | | R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds( |
| | | Arrays.asList(AuthUtil.getUser().getRoleId().split(",")), |
| | | treeQueryObject.getConditionMap().getOrDefault("authType","classify_auth"), |
| | | treeQueryObject.getConditionMap().getOrDefault("buttonCode","classify_view"), |
| | | treeQueryObject.getConditionMap().getOrDefault("menuCode","classifyTree") |
| | | ); |
| | | // 请æ±å¤±è´¥æè
请æ±å¾å°çå
·å¤æ¥çæéçåç±»idéå为空 |
| | | if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){ |
| | | throw new ServiceException("ä¸»æ°æ®æ¥çæéæªé
ç½®ï¼æé
ç½®æè¯¯ï¼"); |
| | | } |
| | | // è¿æ»¤ |
| | | filterTreeNodes(tree,viewClassByRoleIds.getData()); |
| | | } |
| | | // å è½½åç±»æ¯å¦å
·æååç±» |
| | | tree.parallelStream().forEach(item -> { |
| | | boolean checkHasChild = checkHasChild(item.getOid()); |
| | | item.setLeaf(!checkHasChild); |
| | | }); |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * åç±»ææè¿æ»¤ææ²¡ææéçåç±» |
| | | * @param trees |
| | | * @param classifyIds |
| | | */ |
| | | private void filterTreeNodes(List<Tree> trees, List<String> classifyIds) { |
| | | Iterator<Tree> iterator = trees.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Tree tree = iterator.next(); |
| | | /*Boolean checkHasChild = checkHasChild(tree.getOid()); |
| | | tree.setLeaf(!checkHasChild);*/ |
| | | if (classifyIds.contains(tree.getOid())) { |
| | | // 妿顶å±èç¹åå¨ classifyIds ï¼ç´æ¥ä¿çå
¶åèç¹éå |
| | | continue; |
| | | } |
| | | if (tree.getChildren() != null && !tree.getChildren().isEmpty()) { |
| | | filterTreeNodes(tree.getChildren(), classifyIds); |
| | | } |
| | | if (!hasMatchingChild(tree, classifyIds)) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean hasMatchingChild(Tree tree, List<String> classifyIds) { |
| | | if (classifyIds.contains(tree.getOid())) { |
| | | return true; |
| | | } |
| | | if (tree.getChildren() != null) { |
| | | for (Tree child : tree.getChildren()) { |
| | | if (hasMatchingChild(child, classifyIds)) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * åç±»å è½½æ¶è·åä¸å¡ç±»åidï¼æ¼æ¥ä¸å¡ç±»å表å |
| | | * @return |
| | | */ |
| | | private String getTableName(String btmTypeId,String id,String lcStatus){ |
| | | if(Func.isNotEmpty(btmTypeId)){ |
| | | return VciBaseUtil.getTableName(btmTypeId,true); |
| | | } |
| | | LambdaQueryWrapper<CodeClassify> wrapper = Wrappers.<CodeClassify>query() |
| | | .lambda().select(CodeClassify::getBtmTypeId) |
| | | .eq(CodeClassify::getLcStatus, lcStatus) |
| | | .isNotNull(CodeClassify::getBtmTypeId) |
| | | .last("limit 1") |
| | | .eq(CodeClassify::getId,id).isNull(CodeClassify::getParentCodeClassifyOid); |
| | | |
| | | CodeClassify codeClassify = codeClassifyMapper.selectOne(wrapper); |
| | | if(Func.isEmpty(codeClassify) || Func.isEmpty(codeClassify.getBtmTypeId())){ |
| | | throw new ServiceException("æ¥è¯¢ä¸»æ°æ®æ»æ°æ¶ï¼æªè·åå°ä¸å¡ç±»åIDï¼"); |
| | | } |
| | | return VciBaseUtil.getTableName(codeClassify.getBtmTypeId(),true); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æ å½¢æ¥è¯¢å¯¹è±¡æ¥æ¥è¯¢æ°æ®å¯¹è±¡ |
| | | * |
| | | * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | * @return æ¥è¯¢ç»æ,æ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> selectCodeClassifyDOByTree(TreeQueryObject treeQueryObject) { |
| | | List<CodeClassify> doList =codeClassifyMapper.selectCodeClassifyVOByTree(treeQueryObject.getParentOid(),AuthUtil.getTenantId()); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | return voList; |
| | | } |
| | | |
| | | /*** |
| | | * |
| | | * @param parentOid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> selectCodeClassifyVOByParentId(String parentOid) { |
| | | List<CodeClassify> doList =codeClassifyMapper.selectCodeClassifyDOByParentId(parentOid,AuthUtil.getTenantId()); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åºèç¹åç§°è·ååç±» |
| | | * @param libName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> getRMLibByName(String libName) { |
| | | List<String> libNameList=new ArrayList<>(); |
| | | if(StringUtils.isNotBlank(libName)){ |
| | | libNameList=VciBaseUtil.str2List(libName); |
| | | } |
| | | List<CodeClassify> doList =codeClassifyMapper.getRMLibByName(libNameList,"Enabled",AuthUtil.getTenantId() |
| | | .equals( |
| | | NacosConfigCache |
| | | .getAdminUserInfo() |
| | | .getTenantId() |
| | | ) ? null:AuthUtil.getTenantId()); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | return voList; |
| | | } |
| | | |
| | | /*** |
| | | * æ ¹æ®oidè·åä¸é¢ææçåç±»ä¿¡æ¯ |
| | | * @param oid |
| | | * @return |
| | | */ |
| | | public List<CodeClassifyVO> selectAllClassifyByOid(String oid, String fieldInPath){ |
| | | List<CodeClassify> codeClassifyList=codeClassifyMapper.selectAllClassifyByOid(oid,fieldInPath,AuthUtil.getTenantId()); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(codeClassifyList); |
| | | return voList; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é¡¶å±èç¹oidæ¥è¯¢ææé¤å½åèç¹ä»¥å¤ææä¸å䏿 ¡éªçåç±»oid |
| | | * @param topOid |
| | | * @param currentOid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String selectLeafByParentClassifyOid(String topOid, String currentOid) { |
| | | List<CodeClassify> codeClassifies = codeClassifyMapper.selectLeafByParentClassifyOid(topOid, currentOid); |
| | | if(codeClassifies.isEmpty()){ |
| | | return ""; |
| | | } |
| | | String oids = codeClassifies.stream() |
| | | .map(CodeClassify::getOid) |
| | | .map(s -> "'" + s + "'") |
| | | .collect(Collectors.joining(","));; |
| | | return oids; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®é¡¶å±èç¹oidæ¥è¯¢ææå¶åèç¹åç±»oid |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String selectLeafByPid(String pid) { |
| | | List<CodeClassify> codeClassifies = codeClassifyMapper.selectLeafByPid(pid); |
| | | if(codeClassifies.isEmpty()){ |
| | | return ""; |
| | | } |
| | | String oids = codeClassifies.stream() |
| | | .map(CodeClassify::getOid) |
| | | .map(s ->s) |
| | | .collect(Collectors.joining(","));; |
| | | return oids; |
| | | } |
| | | |
| | | /** |
| | | * æµæ°´ä¾èµçæ |
| | | */ |
| | | @Override |
| | | public R flowingDependencyGen(String classifyOid) { |
| | | //æ¥è¯¢æ¤åç±»ä¸é¢çææåç±» |
| | | List<CodeClassify> codeClassifyList=codeClassifyMapper.selectAllClassifyByOid(classifyOid,AuthUtil.getTenantId(),null); |
| | | //æ¥è¯¢ç å¼è¡¨ï¼è·åæå¤§æµæ°´ |
| | | List<CodeAllCode> codeAllCodeVOS = codeAllCodeMapper.selectGroupByClassify("'" + codeClassifyList.stream() |
| | | .map(classfiy -> classfiy.getOid()).collect(Collectors.joining("','")) + "'","'${sav}'"); |
| | | //徿µæ°´è¡¨éé¢å æ°æ®ï¼æåæ´æ°ï¼æ åæ·»å æ°æ®ã |
| | | for (CodeAllCode codeAllCodeVO : codeAllCodeVOS) { |
| | | if(Func.isEmpty(codeAllCodeVO.getSerialUnit())){ |
| | | throw new ServiceException("ç¼ç 为ï¼" + codeAllCodeVO.getId() + "çç 弿°æ®æµæ°´ä¾èµä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | try { |
| | | CodeRuleVO codeRuleVO = codeRuleService.getObjectByOid(codeAllCodeVO.getCodeRuleOid()); |
| | | if(Func.isEmpty(codeRuleVO)){ |
| | | continue; |
| | | } |
| | | }catch (Exception e){ |
| | | continue; |
| | | } |
| | | QueryWrapper<CodeBasicSec> secWrapper = new QueryWrapper<>(); |
| | | secWrapper.eq("PKCODERULE",codeAllCodeVO.getCodeRuleOid()); |
| | | secWrapper.eq("SECTYPE","codeserialsec"); |
| | | List<CodeBasicSec> codeBasicSecs = codeBasicSecMapper.selectList(secWrapper); |
| | | if(codeBasicSecs.size() == 0 ){ |
| | | throw new ServiceException("æ ¹æ®ç å¼IDï¼" + codeAllCodeVO.getCodeRuleOid() + ",ç æ®µç±»åä¸ºæµæ°´ç 段(codeserialsec),å¨åºç¡ç æ®µä¸æªæ¾å°ç¸å
³æ°æ®ï¼"); |
| | | } |
| | | QueryWrapper<CodeSerialValue> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("codeRuleOid",codeAllCodeVO.getCodeRuleOid()); |
| | | wrapper.eq("serialUnit",codeAllCodeVO.getSerialUnit()); |
| | | wrapper.eq("codeSecOid",codeBasicSecs.get(0).getOid()); |
| | | List<CodeSerialValue> codeSerialValues = codeSerialValueMapper.selectList(wrapper); |
| | | if(codeSerialValues.size() == 0){ |
| | | CodeSerialValue newSerialValue = new CodeSerialValue(); |
| | | DefaultAttrAssimtUtil.addDefaultAttrAssimt(newSerialValue,"codeserialvalue"); |
| | | newSerialValue.setCodeRuleOid(codeAllCodeVO.getCodeRuleOid()); |
| | | newSerialValue.setCodeSecOid(codeBasicSecs.get(0).getOid()); |
| | | newSerialValue.setSerialUnit(codeAllCodeVO.getSerialUnit()); |
| | | newSerialValue.setMaxSerial(codeAllCodeVO.getUnFillSerial()); |
| | | newSerialValue.setLctid("defaultLC"); |
| | | newSerialValue.setLcStatus("Exist"); |
| | | codeSerialValueMapper.insert(newSerialValue); |
| | | }else{ |
| | | codeSerialValues.get(0).setMaxSerial(codeAllCodeVO.getUnFillSerial()); |
| | | codeSerialValues.get(0).setLastModifyTime(new Date()); |
| | | codeSerialValues.get(0).setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | codeSerialValues.get(0).setTs(new Date()); |
| | | codeSerialValueMapper.updateById(codeSerialValues.get(0)); |
| | | } |
| | | } |
| | | return R.success("æä½æåï¼"); |
| | | } |
| | | |
| | | /*** |
| | | * æ ¹æ®åç±»æè¿°å¤æ³¨ååºèç¹æ¥è¯¢åç±»ä¿¡æ¯ |
| | | * @param desc |
| | | * @param codeLibName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> getRMTypeByDescAndLib(String desc, String codeLibName) { |
| | | List<CodeClassify> doList =codeClassifyMapper.getRMTypeByDesc(desc,"Enabled",AuthUtil.getTenantId()); |
| | | if (CollectionUtils.isEmpty(doList)) { |
| | | return new LinkedList<CodeClassifyVO>(); |
| | | } |
| | | CodeClassify codeClassify=doList.get(0); |
| | | List<CodeClassify> codeClassifyList=codeClassifyMapper.selectAllParenClassifytByOid(codeClassify.getOid(),AuthUtil.getTenantId()); |
| | | CodeClassify currentLib = codeClassifyList.get(codeClassifyList.size() - 1); |
| | | if (!currentLib.getName().equals(codeLibName)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(codeClassifyList); |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ç¼å·çè·¯å¾è·å对象 |
| | | * |
| | | * @param fieldPath ç¼å·çè·¯å¾ï¼ä¸å®è¦ä»æé¡¶å±èç¹å¼å§ï¼æ ¼å¼ä¸ºxxx/yyy/zz è¿æ · |
| | | * @return åç±»çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO getObjectByClsfNamePath(String fieldPath){ |
| | | CodeClassifyVO codeClassifyVO=new CodeClassifyVO(); |
| | | List<CodeClassify> classifyList = codeClassifyMapper.selectByFieldNamePath(fieldPath,"name"); |
| | | if(classifyList.size()>0){ |
| | | codeClassifyVO=codeClassifyDO2VO(classifyList.get(0)); |
| | | } |
| | | return codeClassifyVO; |
| | | } |
| | | /*** |
| | | * æ ¹æ®ä¸çº§èç¹è·åä¸çº§èç¹ä»£å·è·¯å¾ååç§°è·¯å¾ |
| | | * @param classifyId |
| | | * @param enable |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CodeClassifyVO> getIdPathToNamePathByParentId(String classifyId, boolean enable) { |
| | | List<CodeClassify> doList= codeClassifyMapper.getIdPathToNamePathByParentId(classifyId); |
| | | List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); |
| | | return voList; |
| | | } |
| | | |
| | | // /** |
| | | // * æ ¹æ®æ å½¢æ¥è¯¢å¯¹è±¡æ¥æ¥è¯¢æ°æ®å¯¹è±¡ |
| | | // * |
| | | // * @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 -> 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); |
| | | // Collection<CodeRuleVO> ruleVOS = null; |
| | | ruleVOMap.putAll( Optional.ofNullable(ruleVOS).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.toMap(s->s.getOid(),t->t))); |
| | | }); |
| | | } |
| | | //æ¾å
³é®å±æ§è§å |
| | | List<String> keyRuleOids = codeClassifyVOS.stream().filter(s -> 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,"æè¿°")); |
| | | codeClassifyVOS = codeClassifyVOS.stream().sorted(Comparator.comparing(CodeClassifyVO::getDataLevel)).collect(Collectors.toList()); |
| | | 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, StringUtils.isNotBlank(vo.getCodeRuleOid())?ruleVOMap.getOrDefault(vo.getCodeRuleOid(),new CodeRuleVO()).getId():"")); |
| | | excelDataList.add(new WriteExcelData(i+1,5, StringUtils.isNotBlank(vo.getCodeRuleOid())?ruleVOMap.getOrDefault(vo.getCodeRuleOid(),new CodeRuleVO()).getName():"")); |
| | | excelDataList.add(new WriteExcelData(i+1,6, StringUtils.isNotBlank(vo.getCodeKeyAttrRepeatOid())?keyRuleVOMap.getOrDefault(vo.getCodeKeyAttrRepeatOid(),new CodeKeyAttrRepeatRuleVO()).getId():"")); |
| | | excelDataList.add(new WriteExcelData(i+1,7, StringUtils.isNotBlank(vo.getCodeKeyAttrRepeatOid())?keyRuleVOMap.getOrDefault(vo.getCodeKeyAttrRepeatOid(),new CodeKeyAttrRepeatRuleVO()).getName():"")); |
| | | excelDataList.add(new WriteExcelData(i+1,8,vo.getOid().equalsIgnoreCase(codeClassify.getOid())?vo.getPath():codeClassify.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 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,fieldInPath,AuthUtil.getTenantId()); |
| | | if(!CollectionUtils.isEmpty(classifyDOS)){ |
| | | classifyDOS = classifyDOS.parallelStream().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)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å建导å
¥æ¨¡æ¿ |
| | | * |
| | | * @return excelæä»¶è·¯å¾ |
| | | */ |
| | | @Override |
| | | public String createImportExcel() { |
| | | //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<>(); |
| | | WriteExcelData excelData = new WriteExcelData(0, 0, "åç±»ç¼å·"); |
| | | excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); |
| | | excelDataList.add(excelData); |
| | | WriteExcelData excelData1 = new WriteExcelData(0, 1, "åç±»åç§°"); |
| | | excelData1.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); |
| | | excelDataList.add(excelData1); |
| | | excelDataList.add(new WriteExcelData(0,2,"ä¸å¡ç±»åç¼å·")); |
| | | excelDataList.add(new WriteExcelData(0,3,"ç¼ç è§åç¼å·")); |
| | | excelDataList.add(new WriteExcelData(0,4,"æ¥éè§åç¼å·")); |
| | | WriteExcelData excelData2 = new WriteExcelData(0, 5, "å类路å¾"); |
| | | excelData2.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex())); |
| | | excelDataList.add(excelData2); |
| | | excelDataList.add(new WriteExcelData(0,6,"ç¶æ")); |
| | | WriteExcelOption excelOption = new WriteExcelOption(excelDataList); |
| | | ExcelUtil.writeDataToFile(excelName, excelOption); |
| | | return excelName; |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥åç±» |
| | | * |
| | | * @param file1 æä»¶çä¿¡æ¯ |
| | | * @return é误æä»¶çå°å |
| | | */ |
| | | @Override |
| | | public void importClassify(File file1) { |
| | | VciBaseUtil.alertNotNull(file1,"excelæä»¶"); |
| | | if(!file1.exists()){ |
| | | throw new VciBaseException("导å
¥çexcelæä»¶ä¸åå¨,{0}",new String[]{file1.getPath()}); |
| | | } |
| | | ReadExcelOption excelOption = new ReadExcelOption(); |
| | | List<CodeClassifyPO> poList = null; |
| | | try{ |
| | | poList = ExcelUtil.readDataObjectFromExcel(file1,CodeClassifyPO.class,excelOption,(value,po,fieldName)->{ |
| | | po.setLcStatus(FrameworkDataLCStatus.getValueByText(po.getLcStatusText())); |
| | | if(StringUtils.isBlank(po.getLcStatusText())){ |
| | | po.setLcStatus(FrameworkDataLCStatus.ENABLED.getValue()); |
| | | } |
| | | }); |
| | | }catch (Exception e){ |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error("读åexcelå
å®¹çæ¶ååºç°äºé误",e); |
| | | } |
| | | throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e); |
| | | } |
| | | //å»é¤æ´è¡é½æ¯ç©ºçæ
åµ |
| | | |
| | | if(CollectionUtils.isEmpty(poList)){ |
| | | throw new VciBaseException(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); |
| | | } |
| | | |
| | | poList = poList.stream().filter(s->!(StringUtils.isBlank(s.getId()) && StringUtils.isBlank(s.getName()) && StringUtils.isBlank(s.getPath()))).collect(Collectors.toList()); |
| | | |
| | | List<CodeClassify> codeClassify = new ArrayList<>(); |
| | | //ççè·¯å¾æ¯å¦æéå¤ |
| | | Map<String/**è·¯å¾**/, Long/**个æ°**/> pathCountMap = poList.stream().filter(s->StringUtils.isNotBlank(s.getPath())).collect(Collectors.groupingBy(s -> s.getPath(), Collectors.counting())); |
| | | List<String> repeatPaths = Optional.ofNullable(pathCountMap).orElse(new HashMap<>()).entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(repeatPaths)){ |
| | | //æéå¤çå
容 |
| | | List<String> rowIndexList = new ArrayList<>(); |
| | | poList.stream().forEach(po->{ |
| | | if(repeatPaths.contains(po.getPath())){ |
| | | rowIndexList.add(po.getRowIndex()); |
| | | } |
| | | }); |
| | | throw new VciBaseException("è·¯å¾æéå¤,{0}",new String[]{rowIndexList.stream().collect(Collectors.joining(","))}); |
| | | } |
| | | //ç¼å·è·åä¸å¡ç±»åæå¡ |
| | | List<String> ruleOids = poList.stream().filter( |
| | | s -> StringUtils.isNotBlank(s.getCodeRuleId())) |
| | | .map(CodeClassifyPO::getCodeRuleId) |
| | | .collect(Collectors.toList()); |
| | | Map<String, CodeRuleVO> ruleVOMap = Optional.ofNullable(ruleOids.size()==0 ? null:codeRuleService.listCodeRuleByIds(ruleOids,true) |
| | | ).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t,(o1,o2)->o2)); |
| | | |
| | | List<String> keyOids = poList.stream().filter(s -> StringUtils.isNotBlank(s.getKeyRepeatRuleId())) |
| | | .map(CodeClassifyPO::getKeyRepeatRuleId).collect(Collectors.toList()); |
| | | Map<String,CodeKeyAttrRepeatRuleVO> keyRuleVOMap =Optional.ofNullable(keyOids.size()==0 ? null: iCodeKeyattrrepeatService.listCodeKeyAttrRepeatRuleByOids(keyOids) |
| | | ).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t,(o1,o2)->o2)); |
| | | |
| | | List<String> btmOids = poList.stream().filter(s -> StringUtils.isNotBlank(s.getBtmTypeId())) |
| | | .map(CodeClassifyPO::getBtmTypeId).collect(Collectors.toList()); |
| | | Map<String, BtmTypeVO> btmVOMap = Optional |
| | | .ofNullable(btmOids.size()==0 ? null: btmTypeClient.selectByIdCollection(btmOids).getData()) |
| | | .orElse(new ArrayList<BtmTypeVO>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t,(o1,o2)->o2)); |
| | | // Map<String, CodeOsbtmtypeVO> btmVOMap = null; |
| | | Map<String/**è·¯å¾**/,String/**主é®**/> oidPathMap = new HashMap<>(); |
| | | |
| | | //æä»¬éè¦æ¥è¯¢ææå·²ç»åå¨çåç±»ï¼ä¸»è¦æ¯è·¯å¾ï¼ç¨æ¥å¤æåç±»çæ°æ® |
| | | List<CodeClassify> existClassifyDOs = codeClassifyMapper.selectAllLevelChildHasPath("",null,AuthUtil.getTenantId()); |
| | | Map<String/**è·¯å¾**/, CodeClassify/**å·²ç»åå¨çæ°æ®**/> pathDOMap = Optional.ofNullable(existClassifyDOs).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(s -> { |
| | | String path = s.getPath(); |
| | | if(StringUtils.isNotBlank(path) && path.startsWith("#")){ |
| | | return path.substring(1); |
| | | } |
| | | return path; |
| | | }, t -> t)); |
| | | poList.stream().forEach(po->{ |
| | | CodeClassify classify = new CodeClassify(); |
| | | VciBaseUtil.alertNotNull(po.getId(),"åç±»ç¼å·",po.getName(),"åç±»åç§°",po.getPath(),"å类路å¾"); |
| | | if(StringUtils.isNotBlank(po.getBtmTypeId()) && !btmVOMap.containsKey(po.getBtmTypeId().toLowerCase(Locale.ROOT))){ |
| | | throw new VciBaseException("第{0}è¡çä¸å¡ç±»å{1}å¨ç³»ç»ä¸ä¸åå¨",new String[]{String.valueOf(VciBaseUtil.getInt(po.getRowIndex())+1),po.getBtmTypeId()}); |
| | | } |
| | | if(StringUtils.isNotBlank(po.getCodeRuleId()) && !ruleVOMap.containsKey(po.getCodeRuleId().toLowerCase(Locale.ROOT))){ |
| | | throw new VciBaseException("第{0}è¡çç¼ç è§å{1}å¨ç³»ç»ä¸ä¸åå¨",new String[]{String.valueOf(po.getRowIndex()+1),po.getCodeRuleId()}); |
| | | } |
| | | if(StringUtils.isNotBlank(po.getKeyRepeatRuleId()) && !keyRuleVOMap.containsKey(po.getKeyRepeatRuleId().toLowerCase(Locale.ROOT))){ |
| | | throw new VciBaseException("第{0}è¡çå
³é®å±æ§æ¥éè§å{1}å¨ç³»ç»ä¸ä¸åå¨",new String[]{String.valueOf(po.getRowIndex()+1),po.getKeyRepeatRuleId()}); |
| | | } |
| | | classify.setOid(VciBaseUtil.getPk()); |
| | | classify.setId(po.getId()); |
| | | classify.setName(po.getName()); |
| | | classify.setDescription(po.getDescription()); |
| | | oidPathMap.put(po.getPath(),classify.getOid()); |
| | | if(StringUtils.isNotBlank(po.getBtmTypeId())){ |
| | | BtmTypeVO typeVO = (BtmTypeVO)btmVOMap.get(po.getBtmTypeId().toLowerCase(Locale.ROOT)); |
| | | classify.setBtmTypeId(typeVO.getId()); |
| | | classify.setBtmTypeName(typeVO.getName()); |
| | | } |
| | | if(StringUtils.isNotBlank(po.getCodeRuleId())){ |
| | | CodeRuleVO codeRuleVO = ruleVOMap.get(po.getCodeRuleId().toLowerCase(Locale.ROOT)); |
| | | classify.setCodeRuleOid(codeRuleVO.getOid()); |
| | | } |
| | | if(StringUtils.isNotBlank(po.getKeyRepeatRuleId())){ |
| | | CodeKeyAttrRepeatRuleVO repeatRuleVO = keyRuleVOMap.get(po.getKeyRepeatRuleId()); |
| | | classify.setCodeKeyAttrRepeatOid(repeatRuleVO.getOid()); |
| | | } |
| | | classify.setLcStatus(po.getLcStatus()); |
| | | classify.setPath(po.getPath()); |
| | | codeClassify.add(classify); |
| | | }); |
| | | //è¦çåå¨çï¼ä¿®æ¹è·¯å¾å¯¹åºçä¸»é® |
| | | Map<String/**è·¯å¾**/,String/**主é®**/> catchedOidPathMap = new HashMap<>(); |
| | | if(!CollectionUtils.isEmpty(oidPathMap)){ |
| | | oidPathMap.forEach((path,oid)->{ |
| | | if(pathDOMap.containsKey(path)){ |
| | | //说æåå¨ |
| | | catchedOidPathMap.put(path,pathDOMap.get(path).getOid()); |
| | | }else{ |
| | | catchedOidPathMap.put(path,oid); |
| | | } |
| | | }); |
| | | } |
| | | List<CodeClassify> addClassifyDOList = new ArrayList<>(); |
| | | List<CodeClassify> editClassifyDOList = new ArrayList<>(); |
| | | codeClassify.stream().forEach(classifyDO->{ |
| | | |
| | | //è¦çä¸çº§æ¯ä¸æ¯åå¨å¦ |
| | | String parentPath = classifyDO.getPath(); |
| | | if(parentPath.contains("#")) { |
| | | parentPath = parentPath.substring(0, parentPath.lastIndexOf("#")); |
| | | } |
| | | if((!catchedOidPathMap.containsKey(parentPath) && !pathDOMap.containsKey(parentPath) )&& !classifyDO.getPath().equalsIgnoreCase(classifyDO.getId())){ |
| | | throw new VciBaseException("åç±»ç¼å·[{0}],åç±»åç§°[{1}]ï¼è·¯å¾ä¸º[{2}]çä¸çº§åç±»å¨ç³»ç»ä¸ï¼å¨æ¬æ¬¡å¯¼å
¥çæ°æ®åç³»ç»ä¸åæ²¡ææ¾å°",new String[]{classifyDO.getId(),classifyDO.getName(),classifyDO.getPath()}); |
| | | } |
| | | if (!classifyDO.getPath().equalsIgnoreCase(classifyDO.getId())){ |
| | | //䏿¯é¡¶çº§çæ¶åï¼è¦è®¾ç½®ä¸çº§çä¸»é® |
| | | |
| | | classifyDO.setParentCodeClassifyOid(catchedOidPathMap.containsKey(parentPath)?catchedOidPathMap.get(parentPath):pathDOMap.get(parentPath).getOid()); |
| | | } |
| | | if(classifyDO.getPath().equalsIgnoreCase(classifyDO.getId()) && StringUtils.isBlank(classifyDO.getBtmTypeId())){ |
| | | throw new VciBaseException("åç±»ç¼å·[{0}],åç±»åç§°[{1}]ï¼æ¯é¡¶å±åç±»ï¼éè¦è®¾ç½®ä¸å¡ç±»åç¼å·",new String[]{classifyDO.getId(),classifyDO.getName()}); |
| | | } |
| | | if(pathDOMap.containsKey(classifyDO.getPath())){ |
| | | //åå¨ï¼éè¦ä¿®æ¹å¯¹è±¡ |
| | | classifyDO.setOid(catchedOidPathMap.get(classifyDO.getPath())); |
| | | CodeClassify classifyDOInDB = pathDOMap.get(classifyDO.getPath()); |
| | | classifyDOInDB.setOid(classifyDO.getOid()); |
| | | classifyDOInDB.setId(classifyDO.getId()); |
| | | classifyDOInDB.setName(classifyDO.getName()); |
| | | classifyDOInDB.setDescription(classifyDO.getDescription()); |
| | | classifyDOInDB.setBtmTypeId(classifyDO.getBtmTypeId()); |
| | | classifyDOInDB.setBtmTypeName(classifyDO.getBtmTypeName()); |
| | | classifyDOInDB.setCodeRuleOid(classifyDO.getCodeRuleOid()); |
| | | classifyDOInDB.setCodeRuleOidName(classifyDO.getCodeRuleOidName()); |
| | | classifyDOInDB.setParentCodeClassifyOid(classifyDO.getParentCodeClassifyOid()); |
| | | classifyDOInDB.setCodeKeyAttrRepeatOid(classifyDO.getCodeKeyAttrRepeatOid()); |
| | | classifyDOInDB.setCodeKeyAttrRepeatOidName(classifyDO.getCodeKeyAttrRepeatOidName()); |
| | | if(classifyDOInDB.getOrderNum() == null){ |
| | | classifyDOInDB.setOrderNum(0); |
| | | } |
| | | editClassifyDOList.add(classifyDOInDB); |
| | | }else{ |
| | | //æ¯æ°çï¼ç´æ¥æ·»å å°±è¡äº |
| | | //夿巿ä¹å¤ç? |
| | | classifyDO.setOrderNum(0); |
| | | addClassifyDOList.add(classifyDO); |
| | | } |
| | | }); |
| | | if(!CollectionUtils.isEmpty(editClassifyDOList)){ |
| | | VciBaseUtil.switchCollectionForOracleIn(editClassifyDOList).stream().forEach( |
| | | // classifyDOs->{codeClassifyMapper..updateById(classifyDOs.stream().collect(Collectors.toList())); |
| | | classifyDos->{ |
| | | for (CodeClassify classifyDo : classifyDos) { |
| | | codeClassifyMapper.updateById(classifyDo); |
| | | } |
| | | // } |
| | | }); |
| | | } |
| | | if(!CollectionUtils.isEmpty(addClassifyDOList)){ |
| | | // revisionModelUtil.wrapperForBatchAdd(addClassifyDOList); |
| | | VciBaseUtil.switchCollectionForOracleIn(addClassifyDOList).stream().forEach(classifyDOs->{ |
| | | for (CodeClassify classifyDO : classifyDOs) { |
| | | classifyDO.setCreateTime(new Date()); |
| | | classifyDO.setTs(new Date()); |
| | | classifyDO.setBtmname("codeclassify"); |
| | | classifyDO.setLcStatus("Enabled"); |
| | | classifyDO.setOwner(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | // classifyDO.setCreator(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | // classifyDO.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId())); |
| | | classifyDO.setCreator(String.valueOf(AuthUtil.getUser().getAccount())); |
| | | classifyDO.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount())); |
| | | classifyDO.setLastModifyTime(new Date()); |
| | | codeClassifyMapper.insert(classifyDO); |
| | | } |
| | | // codeClassifyMapper.batchInsert(classifyDOs.stream().collect(Collectors.toList())); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * è·ååç±»å
³èç屿§ |
| | | * |
| | | * @param baseQueryObject æ¥è¯¢å¯¹è±¡ï¼å¿
é¡»æcodeClassifyOidï¼æ¯æidånameä¸¤ç§æ¥è¯¢æ¡ä»¶ |
| | | * @return 屿§çä¿¡æ¯ï¼å
å«é»è®¤ç屿§ |
| | | */ |
| | | @Override |
| | | public DataGrid<BtmTypeAttributeVO> listClassifyLinkAttr(BaseQueryObject baseQueryObject) throws ServiceException{ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | if(baseQueryObject.getConditionMap() == null){ |
| | | baseQueryObject.setConditionMap(new HashMap<>()); |
| | | } |
| | | String classifyOid = baseQueryObject.getConditionMap().getOrDefault("codeClassifyOid",""); |
| | | String btmTypeOid = baseQueryObject.getConditionMap().getOrDefault("btmTypeOid",""); |
| | | String id = baseQueryObject.getConditionMap().getOrDefault("id",""); |
| | | String name = baseQueryObject.getConditionMap().getOrDefault("name",""); |
| | | if(StringUtils.isBlank(classifyOid)){ |
| | | return new DataGrid<>(); |
| | | } |
| | | if(StringUtils.isBlank(btmTypeOid)){ |
| | | return new DataGrid<>(); |
| | | } |
| | | CodeClassifyVO topClassifyVO = getTopClassifyVO(classifyOid); |
| | | if(topClassifyVO == null || StringUtils.isBlank(topClassifyVO.getBtmTypeId())){ |
| | | return new DataGrid<>(); |
| | | } |
| | | |
| | | Map<String,Object> condition = new HashMap<>(1); |
| | | condition.put("pkbtmtype",topClassifyVO.getBtmTypeId()); |
| | | R<BtmTypeVO> btmTypeDetail = btmTypeClient.getDetail(btmTypeOid); |
| | | if(!btmTypeDetail.isSuccess()){ |
| | | throw new ServiceException("ä¸å¡ç±»åfeignæ¥å£è°ç¨åºé"); |
| | | } |
| | | List<BtmTypeAttributeVO> unDefaultAttributes = btmTypeDetail.getData().getAttributes(); |
| | | // List<CodeOsbtmtypeattributeEntity> unDefaultAttributes = codeOsbtmtypeattributeMapper.selectByMap(condition); |
| | | // List<OsBtmTypeAttributeVO> unDefaultAttributes = btmService. (topClassifyVO.getBtmtypeid()); |
| | | List<BtmTypeAttributeVO> attributeVOS = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(unDefaultAttributes)){ |
| | | unDefaultAttributes.stream().forEach(attr->{ |
| | | BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO(); |
| | | BeanUtils.copyProperties(attr,attributeVO); |
| | | attributeVO.setAttrDataType(attr.getAttrDataType()); |
| | | attributeVO.setAttributeLength(attr.getAttributeLength()); |
| | | attributeVO.setBtmTypeId(btmTypeDetail.getData().getId()); |
| | | attributeVO.setBtmname(btmTypeDetail.getData().getName()); |
| | | attributeVO.setAttrDataTypeText(EnumCache.getValue(EnumEnum.VCI_FIELD_TYPE,attr.getAttrDataType())); |
| | | boolean add = true; |
| | | if(StringUtils.isNotBlank(id) && !attributeVO.getId().contains(id.replace("*",""))){ |
| | | add = false; |
| | | } |
| | | if(StringUtils.isNotBlank(name) && !attributeVO.getName().contains(name.replace("*",""))){ |
| | | add = false; |
| | | } |
| | | if(add){ |
| | | attributeVOS.add(attributeVO); |
| | | } |
| | | }); |
| | | } |
| | | R<BtmTypeVO> btmTypeVOR = btmTypeClient.getDefaultAttrByBtmId(topClassifyVO.getBtmTypeId()); |
| | | if(!btmTypeVOR.isSuccess()){ |
| | | throw new ServiceException("ä¸å¡ç±»åfeignæ¥å£è°ç¨åºé"); |
| | | } |
| | | List<BtmTypeAttributeVO> defaultAttrVOS = btmTypeVOR.getData().getAttributes(); |
| | | |
| | | // å两个éåå·®é |
| | | List<String> ids = unDefaultAttributes.stream().map(BtmTypeAttributeVO::getId).collect(Collectors.toList()); |
| | | defaultAttrVOS.forEach(item->{ |
| | | if(!ids.contains(item.getId())){ |
| | | BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO(); |
| | | BeanUtils.copyProperties(item,attributeVO); |
| | | attributeVO.setAttrDataType(item.getAttrDataType()); |
| | | attributeVO.setAttributeLength(item.getAttributeLength()); |
| | | attributeVO.setBtmTypeId(btmTypeDetail.getData().getId()); |
| | | attributeVO.setBtmname(btmTypeDetail.getData().getName()); |
| | | attributeVO.setAttrDataTypeText(EnumCache.getValue(EnumEnum.VCI_FIELD_TYPE,item.getAttrDataType())); |
| | | boolean add = true; |
| | | if(StringUtils.isNotBlank(id) && !item.getId().contains(id.replace("*",""))){ |
| | | add = false; |
| | | } |
| | | if(StringUtils.isNotBlank(name) && !item.getName().contains(name.replace("*",""))){ |
| | | add = false; |
| | | } |
| | | if(add){ |
| | | attributeVOS.add(attributeVO); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | DataGrid<BtmTypeAttributeVO> dataGrid = new DataGrid<>(); |
| | | dataGrid.setData(attributeVOS); |
| | | dataGrid.setTotal(attributeVOS.size()); |
| | | return dataGrid; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½ååç±»çé¡¶å±åç±» |
| | | * |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | | * @return é¡¶å±åç±»çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO getTopClassifyVO(String codeClassifyOid) { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"åç±»ç主é®"); |
| | | |
| | | // List<Map<String,Object>> classifyDOS = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid); |
| | | List<CodeClassify> classifyDOS = selectAllLevelParentByOid(codeClassifyOid); |
| | | |
| | | if(!CollectionUtils.isEmpty(classifyDOS)){ |
| | | CodeClassify classifyDO = classifyDOS.stream().filter(s -> StringUtils.isBlank(s.getParentCodeClassifyOid())).findFirst().orElseGet(() -> null); |
| | | if(classifyDO!=null){ |
| | | return codeClassifyDO2VO(classifyDO); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * è·åå½ååç±»çææä¸çº§åç±»ï¼å«æ¬æ¬¡æ¥è¯¢å±çº§å·ï¼ |
| | | * @param oid ä¸»é® |
| | | * @return ææçä¸çº§ |
| | | */ |
| | | @Override |
| | | public List<CodeClassify> selectAllLevelParentByOid(String oid){ |
| | | // String sql = "select oid,level from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY) + " start with oid= :oid connect by prior PARENTCODECLASSIFYOID = oid "; |
| | | // Map< String,String> conditionMap = new HashMap< String,String>(); |
| | | // conditionMap.put("oid",oid); |
| | | |
| | | List<Map<String,Object>> cbos = codeClassifyMapper.selectAllLevelParentByOid(oid); |
| | | Map<String,String> oidLevelMap = new HashMap<>(); |
| | | Optional.ofNullable(cbos).orElseGet(()->new ArrayList<>()).stream().forEach(cbo->{ |
| | | // ç¨keyåmapå¼å¹¶ä¸ä¸åºå大å°å |
| | | oidLevelMap.put(cbo.getOrDefault("OID",cbo.get("oid")).toString(),cbo.get("LEVEL").toString()); |
| | | }); |
| | | if(CollectionUtils.isEmpty(oidLevelMap)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | //使ç¨ä¸»é®æ¥è¯¢ä¸ä¸ |
| | | String oids = ""; |
| | | for (String s : oidLevelMap.keySet()) { |
| | | oids += "'"+s+"',"; |
| | | } |
| | | List<CodeClassify> classifyDOS = codeClassifyMapper.selectClassifyByKeyAndReseRel(oids.substring(0,oids.length()-1)); |
| | | if(!CollectionUtils.isEmpty(classifyDOS)){ |
| | | classifyDOS.stream().forEach(classifyDO->{ |
| | | classifyDO.setDataLevel(VciBaseUtil.getInt(oidLevelMap.getOrDefault(classifyDO.getOid(),"0"))); |
| | | classifyDO.setLcStatusText(EnumCache.getValue("codeLcstatus",classifyDO.getLcStatus())); |
| | | }); |
| | | } |
| | | return classifyDOS; |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·å主é¢åºåç±» |
| | | * @param oid ä¸»é® |
| | | * @return 主é¢åºåç±»æ¾ç¤ºå¯¹è±¡ |
| | | * @throws VciBaseException åæ°ä¸ºç©ºï¼æ°æ®ä¸å卿¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO getObjectByOid(String oid) throws VciBaseException{ |
| | | return codeClassifyDO2VO(selectByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨ç¼å·çè·¯å¾è·å对象 |
| | | * |
| | | * @param idPath ç¼å·çè·¯å¾ï¼ä¸å®è¦ä»æé¡¶å±èç¹å¼å§ï¼æ ¼å¼ä¸ºxxx/yyy/zz è¿æ · |
| | | * @return åç±»çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public CodeClassifyVO getObjectByIdPath(String idPath) { |
| | | List<Map<String, Object>> idPathValues = codeClassifyMapper.selectByFieldPath("#" + idPath); |
| | | CodeClassify classifyDO = null; |
| | | if (idPathValues != null){ |
| | | classifyDO = codeClassifyMapper.selectByIdRel(idPathValues.get(0).get("OID").toString()); |
| | | } |
| | | return codeClassifyDO2VO(classifyDO); |
| | | } |
| | | |
| | | /** |
| | | * 主é¢åºçæ ,å·²èè°ä¸å¡ç±»åæ¥è¯¢feign |
| | | * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | * @return 主é¢åºæ¾ç¤ºæ |
| | | */ |
| | | @Override |
| | | public List<Tree> treeTopCodeClassify(TreeQueryObject treeQueryObject) { |
| | | if(treeQueryObject == null){ |
| | | treeQueryObject = new TreeQueryObject(); |
| | | } |
| | | if(treeQueryObject.getConditionMap() == null){ |
| | | treeQueryObject.setConditionMap(new HashMap<String,String>()); |
| | | } |
| | | treeQueryObject.getConditionMap().put(PARENT_FIELD_NAME, "=null"); |
| | | List<Tree> trees = treeCodeClassify(treeQueryObject); |
| | | treeQueryObject.getConditionMap().put("domain", AppConstant.APPLICATION_NAME_CODE); |
| | | BaseQueryObject baseQueryObject = new BaseQueryObject(); |
| | | baseQueryObject.setConditionMap(treeQueryObject.getConditionMap()); |
| | | List<BtmTypeVO> btmTypeVOS = btmTypeClient.getRef(baseQueryObject).getData(); |
| | | if(Func.isEmpty(btmTypeVOS) || Func.isEmpty(trees)){ |
| | | return null; |
| | | } |
| | | List<Tree> treeList = trees.stream().filter(tree -> !CollectionUtils.isEmpty(btmTypeVOS.stream().filter(btmType -> { |
| | | if(Objects.equals(tree.getAttributes().get("btmTypeId"), btmType.getId())){ |
| | | tree.getAttributes().put("btmTypeOid",btmType.getOid()); |
| | | return true; |
| | | } |
| | | return false; |
| | | }).collect(Collectors.toList()))) |
| | | .collect(Collectors.toList()); |
| | | return treeList; |
| | | } |
| | | |
| | | /** |
| | | * è·åè¿ä¸ªåç±»ä¸çä¸å¡ç±»åï¼å½å没æå°±è·åä¸çº§ç第ä¸ä¸ªä¸å¡ç±»å |
| | | * @param oid å½ååç±»çoid |
| | | * @return oid,id,name,btmtypeid,btmtypenameï¼æ²¡æå°±è¿ånull |
| | | */ |
| | | @Override |
| | | public CodeClassify selectBtmOrParentBtm(String oid){ |
| | | List<CodeClassify> oidList = selectAllLevelParents(oid); |
| | | return oidList.size()==0?null:oidList.get(0); |
| | | } |
| | | |
| | | /** |
| | | * è·åææå±çº§ä¸çº§å
³èä¸å¡ç±»åæ°æ® |
| | | * @param oid å½ååç±»çoid |
| | | * @return oid,id,name,btmtypeid,btmtypename |
| | | */ |
| | | @Override |
| | | public List<CodeClassify> selectAllLevelParents(String oid){ |
| | | // String sql = "select oid,id,name,btmtypeid,btmtypename from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY) + " where btmtypeid is not null start with oid= :oid connect by prior PARENTCODECLASSIFYOID=oid "; |
| | | // Map< String,String> conditionMap = new HashMap< String,String>(); |
| | | // conditionMap.put("oid",oid); |
| | | // List<Map> dataList = boService.queryBySqlForMap(sql,conditionMap); |
| | | List<Map<String, Object>> dataList = codeClassifyMapper.selectAllLevelParents(oid); |
| | | List<CodeClassify> oidList = new ArrayList<CodeClassify>(); |
| | | if(!CollectionUtils.isEmpty(dataList)){ |
| | | for(Map data:dataList){ |
| | | CodeClassify codeClassifyDO = new CodeClassify(); |
| | | codeClassifyDO.setOid(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"OID"))); |
| | | codeClassifyDO.setId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"ID"))); |
| | | codeClassifyDO.setName(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"NAME"))); |
| | | codeClassifyDO.setBtmTypeId(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"BTMTYPEID"))); |
| | | codeClassifyDO.setBtmTypeName(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getMapValueIgnoreCase(data,"BTMTYPENAME"))); |
| | | oidList.add(codeClassifyDO); |
| | | } |
| | | } |
| | | return oidList; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææä¸å±ç¶èç¹çoid |
| | | * @param oid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> selectAllParentOid(String oid){ |
| | | if(Func.isBlank(oid)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | return this.codeClassifyMapper.selectAllParentOid(oid); |
| | | } |
| | | |
| | | /** |
| | | * 使ç¨å类主é®è·ååç±»ç¸å
³çææä¿¡æ¯ |
| | | * |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | | * @return åç±»ä¸çº§ï¼ä¸çº§çä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public CodeClassifyFullInfoBO getClassifyFullInfo(String codeClassifyOid) { |
| | | VciBaseUtil.alertNotNull(codeClassifyOid,"åç±»ç主é®"); |
| | | CodeClassifyFullInfoBO fullInfo = new CodeClassifyFullInfoBO(); |
| | | CodeClassify classifyDO = selectByOidRel(codeClassifyOid); |
| | | //æ¥è¯¢ä¸çº§ |
| | | fullInfo.setCurrentClassifyVO(codeClassifyDO2VO(classifyDO)); |
| | | // List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid); |
| | | // List<Map<String, Object>> maps = selectAllLevelParentByOid(codeClassifyOid); |
| | | List<CodeClassify> codeClassifyList = selectAllLevelParentByOid(codeClassifyOid); |
| | | // for (Map<String, Object> map : maps) { |
| | | // CodeClassify codeClassify = new CodeClassify(); |
| | | // codeClassify.setOid(String.valueOf(map.get("OID"))); |
| | | // codeClassify.setDataLevel((Integer) map.get("LEVEL")); |
| | | // codeClassifyList.add(codeClassify); |
| | | // } |
| | | |
| | | fullInfo.setParentClassifyVOs(codeClassifyDO2VOs(codeClassifyList)); |
| | | if(!CollectionUtils.isEmpty(fullInfo.getParentClassifyVOs())){ |
| | | fullInfo.setTopClassifyVO(fullInfo.getParentClassifyVOs().stream().filter(s->StringUtils.isBlank(s.getParentCodeClassifyOid())).findFirst().orElseGet(()->null)); |
| | | } |
| | | return fullInfo; |
| | | } |
| | | |
| | | /** |
| | | * ç»è®¡åèç¹çä¸ªæ° |
| | | * |
| | | * @param codeClassifyOid åç±»çä¸»é® |
| | | * @return ä¸ªæ° |
| | | */ |
| | | @Override |
| | | public int countChildrenByClassifyOid(String codeClassifyOid) { |
| | | // Map<String,String> conditionMap = new HashMap<>(); |
| | | // conditionMap.put("parentCodeClassifyOid",codeClassifyOid); |
| | | QueryWrapper<CodeClassify> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("parentCodeClassifyOid",codeClassifyOid); |
| | | return codeClassifyMapper.selectCount(wrapper).intValue(); |
| | | } |
| | | |
| | | } |