| | |
| | | import com.alibaba.nacos.api.exception.NacosException; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.constant.BtmTypeFieldConstant; |
| | | import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO; |
| | | import com.vci.ubcs.omd.entity.Attribute; |
| | | import com.vci.ubcs.omd.repeater.DomainRepeater; |
| | | import com.vci.ubcs.omd.service.IAttributeService; |
| | | import com.vci.ubcs.omd.service.IBtmTypeAttributeService; |
| | | import com.vci.ubcs.omd.service.IModifyAttributeService; |
| | | import com.vci.ubcs.omd.vo.BtmTypeTreeVO; |
| | | import com.vci.ubcs.omd.service.*; |
| | | import com.vci.ubcs.omd.vo.*; |
| | | import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; |
| | | import com.vci.ubcs.omd.wrapper.ModifyAttributeWrapper; |
| | | import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; |
| | |
| | | import com.vci.ubcs.omd.entity.BtmTypeAttribute; |
| | | import com.vci.ubcs.omd.entity.ModifyAttributeInfo; |
| | | import com.vci.ubcs.omd.mapper.BtmTypeMapper; |
| | | import com.vci.ubcs.omd.service.IBtmTypeService; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.omd.vo.LinkTypeVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.enumpck.BooleanEnum; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | |
| | | */ |
| | | @Autowired |
| | | private IModifyAttributeService modifyAttributeService; |
| | | |
| | | /** |
| | | * 版本规则的服务 |
| | | */ |
| | | @Autowired |
| | | private IRevisionRuleService revisionRuleService; |
| | | |
| | | /** |
| | | * 属性的服务 |
| | |
| | | btmTypeDO.setTableName(getTableName(btmTypeDO.getId(),btmTypeDO.getDomain())); |
| | | } |
| | | // 添加属性 |
| | | btmTypeDTO.setOid(btmTypeDO.getOid()); |
| | | afterAttributes = addAttributeForBtm(btmTypeDTO); |
| | | baseMapper.insert(btmTypeDO); |
| | | }else { |
| | |
| | | if (btmTypeDTO.isRevisionFlag()){ |
| | | // 需要控制版本 |
| | | // 检查使用的版本规则是否存在 |
| | | // if (StringUtils.isNotBlank(btmTypeDTO.getRevisionRuleId())) { |
| | | // if (revisionRuleServiceI.checkRevisionRuleExist(btmTypeDTO.getRevisionRuleId())) { |
| | | // throw new VciBaseException("版本规则{0}[{1}]在系统中不存在,请先查证", |
| | | // new Object[]{btmTypeDTO.getRevisionRuleId(), btmTypeDTO.getRevisionRuleName()}); |
| | | // } |
| | | // } |
| | | if (StringUtils.isNotBlank(btmTypeDTO.getRevisionRuleId())) { |
| | | if (revisionRuleService.checkRevisionRuleExist(btmTypeDTO.getRevisionRuleId())) { |
| | | throw new VciBaseException("版本规则{0}[{1}]在系统中不存在,请先查证", |
| | | new Object[]{btmTypeDTO.getRevisionRuleId(), btmTypeDTO.getRevisionRuleName()}); |
| | | } |
| | | } |
| | | btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.REVISION_MANAGE_FIELD_MAP)); |
| | | } |
| | | if (btmTypeDTO.isLifeCycleFlag()){ |
| | |
| | | // 需要控制密级 |
| | | btmTypeDTO.setAttributes(addAttributeByFieldMap(btmTypeDTO.getAttributes(),BtmTypeFieldConstant.SECRET_MANAGE_FIELD_MAP)); |
| | | } |
| | | if (StringUtils.isBlank(btmTypeDTO.getOid())) { |
| | | btmTypeDTO.setOid(VciBaseUtil.getPk()); |
| | | } |
| | | } |
| | | @Override |
| | | public boolean deleteLogic(@NotEmpty List<Long> ids) { |
| | |
| | | @Override |
| | | public List<BtmTypeTreeVO> treeDomain() { |
| | | try { |
| | | List<String> domain = DomainRepeater.getDomain(); |
| | | Map<String, String> domain = Optional.ofNullable(DomainRepeater.getDomain()).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(s -> s.getValue(), t -> t.getLabel())); |
| | | List<BtmTypeVO> vos = BtmTypeWrapper.build().listEntityVO(baseMapper.selectAll()); |
| | | Map<String, List<BtmTypeVO>> domainMap = vos.stream().collect(Collectors.groupingBy(BtmTypeVO::getDomain)); |
| | | List<BtmTypeTreeVO> treeList = new ArrayList<>(); |
| | | domainMap.forEach((k,v)-> { |
| | | if (domain.contains(k)){ |
| | | if (domain.containsKey(k)){ |
| | | String label = domain.get(k); |
| | | BtmTypeTreeVO parent = new BtmTypeTreeVO(); |
| | | parent.setOid(k); |
| | | parent.setName(k); |
| | | parent.setName(label); |
| | | parent.setId(k); |
| | | parent.setChildList(v.stream().map(s -> { |
| | | BtmTypeTreeVO child = new BtmTypeTreeVO(); |
| | | child.setOid(s.getOid()); |
| | | child.setName(s.getId() + " " + (s.getName() == null ? "" : s.getName())); |
| | | child.setId(s.getId()); |
| | | return child; |
| | | }).collect(Collectors.toList())); |
| | | treeList.add(parent); |
| | |
| | | public List<BtmTypeVO> getFromTable(String domain) { |
| | | VciBaseUtil.alertNotNull(domain,"领域值"); |
| | | try { |
| | | if (!DomainRepeater.getDomain().contains(domain)){ |
| | | if (!DomainRepeater.getDomain().stream().collect(Collectors.toMap(DomainVO::getValue, DomainVO::getLabel)).containsKey(domain)){ |
| | | return null; |
| | | } |
| | | R result = DomainRepeater.getFromTable(domain); |
| | |
| | | Attribute attribute = new Attribute(); |
| | | attribute.setKey(attr.getId()); |
| | | attribute.setLabel(attr.getName()); |
| | | attribute.setDictKey(attr.getAttrDataType()); |
| | | attribute.setTypeCode("attributeType"); |
| | | attribute.setTypeKey(attr.getAttrDataType()); |
| | | // attribute.setDictKey(attr.getAttrDataType()); |
| | | attribute.setMaxLength(attr.getAttributeLength()); |
| | | attribute.setPrecision(attr.getPrecisionLength()); |
| | | attribute.setDescription(attr.getDescription()); |
| | |
| | | attribute.setReferToName(attr.getReferBtmTypeName()); |
| | | attribute.setTs(now); |
| | | attribute.setCreateTime(now); |
| | | attribute.setIsDeleted(0); |
| | | attribute.setCreateUser(AuthUtil.getUserId()); |
| | | idAttrMap.put(attribute.getKey(),attribute); |
| | | // 在这里给业务类型设置版本控制、生命周期控制、密级控制相关的信息 |
| | |
| | | attributeService.saveBatch(idAttrMap.values()); |
| | | }else { |
| | | List<Attribute> addList = idAttrMap.values().stream().filter(a -> existAttr.stream().noneMatch(b -> StringUtils.equals(a.getKey(), b.getKey()))).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(addList)) { |
| | | if (!CollectionUtils.isEmpty(addList)) { |
| | | attributeService.saveBatch(addList); |
| | | } |
| | | } |