| | |
| | | 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.BtmTypeConstant; |
| | | import com.vci.ubcs.omd.constant.BtmTypeFieldConstant; |
| | | import com.vci.ubcs.omd.dto.BtmAndLinkTypeDdlDTO; |
| | | import com.vci.ubcs.omd.entity.Attribute; |
| | |
| | | btmType.setOid(VciBaseUtil.getPk()); |
| | | btmType.setTs(now); |
| | | btmType.setCreator(user); |
| | | btmType.setBtmName("btmType"); |
| | | btmType.setBtmName(BtmTypeConstant.BTMTYPE); |
| | | btmType.setCreateTime(now); |
| | | btmType.setDomain(domain); |
| | | btmType.setLastModifyTime(now); |
| | |
| | | }).map(attr -> { |
| | | // 添加属性,1是校验,2是添加 |
| | | Attribute attribute = new Attribute(); |
| | | attribute.setKey(attr.getId()); |
| | | attribute.setLabel(attr.getName()); |
| | | attribute.setId(attr.getId()); |
| | | attribute.setName(attr.getName()); |
| | | attribute.setTypeCode("attributeType"); |
| | | attribute.setTypeKey(attr.getAttrDataType()); |
| | | // attribute.setDictKey(attr.getAttrDataType()); |
| | |
| | | attribute.setReferToId(attr.getReferBtmTypeId()); |
| | | attribute.setReferToName(attr.getReferBtmTypeName()); |
| | | attribute.setTs(now); |
| | | attribute.setOwner(user); |
| | | attribute.setCreateTime(now); |
| | | attribute.setIsDeleted(0); |
| | | attribute.setCreateUser(AuthUtil.getUserId()); |
| | | idAttrMap.put(attribute.getKey(),attribute); |
| | | attribute.setLastModifier(user); |
| | | attribute.setLastModifyTime(now); |
| | | attribute.setBtmName(BtmTypeConstant.ATTRIBUTE); |
| | | attribute.setCreator(user); |
| | | attribute.setOid(VciBaseUtil.getPk()); |
| | | idAttrMap.put(attribute.getId(),attribute); |
| | | // 在这里给业务类型设置版本控制、生命周期控制、密级控制相关的信息 |
| | | |
| | | // 添加业务类型和属性的关系 |
| | |
| | | btmTypeAttribute.setCreateTime(now); |
| | | btmTypeAttribute.setLastModifier(user); |
| | | btmTypeAttribute.setLastModifyTime(now); |
| | | // btmTypeAttribute.setBtmName("btmTypeAttribute"); |
| | | btmTypeAttribute.setOid(VciBaseUtil.getPk()); |
| | | btmTypeAttribute.setBtmName(btmType.getId()); |
| | | btmTypeAttribute.setOwner(user); |
| | |
| | | btmType.setConsistence(BooleanEnum.TRUE.getValue()); |
| | | btmList.add(btmType); |
| | | }); |
| | | List<Attribute> existAttr = attributeService.list(Wrappers.<Attribute>query().lambda().in(Attribute::getKey, attributeIds)); |
| | | List<Attribute> existAttr = attributeService.list(Wrappers.<Attribute>query().lambda().in(Attribute::getId, attributeIds)); |
| | | if (!CollectionUtils.isEmpty(btmList)){ |
| | | baseMapper.batchInsert(btmList); |
| | | } |
| | |
| | | if (CollectionUtils.isEmpty(existAttr)){ |
| | | 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()); |
| | | List<Attribute> addList = idAttrMap.values().stream().filter(a -> existAttr.stream().noneMatch(b -> StringUtils.equals(a.getId(), b.getId()))).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(addList)) { |
| | | attributeService.saveBatch(addList); |
| | | } |