ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/OmdBtmTypeServiceImpl.java ÐÞ¸Ä |
| | |
| | | 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.constant.OmdBtmTypeConstant; |
| | | import com.vci.ubcs.omd.constant.BtmTypeConstant; |
| | | import com.vci.ubcs.omd.repeater.DomainRepeater; |
| | | import com.vci.ubcs.omd.service.IOmdBtmTypeAttributeService; |
| | | import com.vci.ubcs.omd.wrapper.OmdBtmTypeWrapper; |
| | | import com.vci.ubcs.omd.service.IBtmTypeAttributeService; |
| | | import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; |
| | | import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; |
| | | import com.vci.ubcs.omd.dto.OmdBtmTypeDTO; |
| | | import com.vci.ubcs.omd.dto.OmdBtmTypeLinkAttributesDTO; |
| | | import com.vci.ubcs.omd.entity.OmdBtmType; |
| | | import com.vci.ubcs.omd.entity.OmdBtmTypeAttribute; |
| | | import com.vci.ubcs.omd.entity.OsModifyAttributeInfoDO; |
| | | import com.vci.ubcs.omd.mapper.OmdBtmTypeMapper; |
| | | import com.vci.ubcs.omd.service.IOmdBtmTypeService; |
| | | import com.vci.ubcs.omd.vo.OmdBtmTypeVO; |
| | | import com.vci.ubcs.omd.vo.OmdBtmTypeAttributeVO; |
| | | import com.vci.ubcs.omd.vo.OsLinkTypeVO; |
| | | import com.vci.ubcs.omd.dto.BtmTypeDTO; |
| | | import com.vci.ubcs.omd.dto.BtmTypeLinkAttributesDTO; |
| | | import com.vci.ubcs.omd.entity.BtmType; |
| | | import com.vci.ubcs.omd.entity.BtmTypeAttribute; |
| | | import com.vci.ubcs.omd.entity.ModifyAttributeInfoDO; |
| | | 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.util.VciBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciDateUtil; |
| | |
| | | import org.springframework.transaction.support.DefaultTransactionDefinition; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import java.util.*; |
| | | |
| | |
| | | * @date 2023/4/23 |
| | | */ |
| | | @Service |
| | | public class OmdBtmTypeServiceImpl extends ServiceImpl<OmdBtmTypeMapper, OmdBtmType> implements IOmdBtmTypeService { |
| | | public class BtmTypeServiceImpl extends ServiceImpl<BtmTypeMapper, BtmType> implements IBtmTypeService { |
| | | |
| | | /** |
| | | * äºå¡ç®¡ç |
| | |
| | | * ä¸å¡ç±»åå
³è屿§æå¡ |
| | | */ |
| | | @Autowired |
| | | private IOmdBtmTypeAttributeService btmTypeAttributeService; |
| | | |
| | | @Autowired |
| | | private DomainRepeater domainRepeater; |
| | | private IBtmTypeAttributeService btmTypeAttributeService; |
| | | |
| | | /** |
| | | * è®¾ç½®å¹³å°æ¬èº«çä¸å¡ç±»å |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeVO getBtmTypeByOid(String pkBtmType) throws ServiceException { |
| | | public BtmTypeVO getBtmTypeByOid(String pkBtmType) throws ServiceException { |
| | | Func.requireNotNull(pkBtmType,"ä¸å¡ç±»å主é®ä¸è½ä¸ºç©º"); |
| | | OmdBtmTypeVO btmTypeVO = OmdBtmTypeWrapper.build().entityVO(baseMapper.selectOne(Wrappers.<OmdBtmType>query().lambda().eq(OmdBtmType::getOid, pkBtmType))); |
| | | BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(baseMapper.selectOne(Wrappers.<BtmType>query().lambda().eq(BtmType::getOid, pkBtmType))); |
| | | btmTypeVO.setAttributes(btmTypeAttributeService.getAttributeByBtmTypeOid(pkBtmType)); |
| | | return btmTypeVO; |
| | | } |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeVO> listBtmTypeByOids(String pkBtmTypes) throws ServiceException { |
| | | public List<BtmTypeVO> listBtmTypeByOids(String pkBtmTypes) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeVO> listBtmTypeByOidCollection(Collection<String> pkBtmTypeCollection) throws ServiceException { |
| | | public List<BtmTypeVO> listBtmTypeByOidCollection(Collection<String> pkBtmTypeCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeVO getBtmTypeById(String id) throws ServiceException { |
| | | public BtmTypeVO getBtmTypeById(String id) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeVO> listBtmTypeByIds(String ids) throws ServiceException { |
| | | public List<BtmTypeVO> listBtmTypeByIds(String ids) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeVO> listBtmTypeByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | public List<BtmTypeVO> listBtmTypeByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmType> listBtmTypeDOByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | public List<BtmType> listBtmTypeDOByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmType> listBtmTypeDOByOidCollection(Collection<String> oidCollection) throws ServiceException { |
| | | public List<BtmType> listBtmTypeDOByOidCollection(Collection<String> oidCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException ä¸å¡ç±»åä¸åå¨ï¼åæ°ä¸ºç©ºææ¥è¯¢åºéæ¶ä¼æåºé误 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> listHasAttributesByOid(String oid) throws ServiceException { |
| | | public List<BtmTypeAttributeVO> listHasAttributesByOid(String oid) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException ä¸å¡ç±»åä¸åå¨ï¼åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> listHasAttributeById(String id) throws ServiceException { |
| | | public List<BtmTypeAttributeVO> listHasAttributeById(String id) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException ä¸å¡ç±»åä¸åå¨ï¼åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public Map<String, List<OmdBtmTypeAttributeVO>> batchListHasAttributesByOidCollection(Collection<String> oidCollection) throws ServiceException { |
| | | public Map<String, List<BtmTypeAttributeVO>> batchListHasAttributesByOidCollection(Collection<String> oidCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException ä¸å¡ç±»åä¸åå¨ï¼åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public Map<String, List<OmdBtmTypeAttributeVO>> batchListHasAttributesByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | public Map<String, List<BtmTypeAttributeVO>> batchListHasAttributesByIdCollection(Collection<String> idCollection) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<OsLinkTypeVO> listLinkTypeForUsedBtmType(String pkBtmType) throws ServiceException { |
| | | public List<LinkTypeVO> listLinkTypeForUsedBtmType(String pkBtmType) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException æ·»å åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeDTO addSave(OmdBtmTypeDTO btmTypeDTO, boolean autoCreateTable) throws ServiceException { |
| | | public BtmTypeDTO addSave(BtmTypeDTO btmTypeDTO, boolean autoCreateTable) throws ServiceException { |
| | | TransactionStatus transaction = null; |
| | | DefaultTransactionDefinition def = null; |
| | | if (autoCreateTable) { |
| | |
| | | transaction = dataSourceTransactionManager.getTransaction(def); |
| | | // è·å¾äºå¡ç¶æ |
| | | } |
| | | OmdBtmType btmTypeDO = new OmdBtmType(); |
| | | BtmType btmTypeDO = new BtmType(); |
| | | try { |
| | | VciBaseUtil.alertNotNull(btmTypeDTO, "è¦æ·»å çä¸å¡ç±»å", btmTypeDTO.getId(), "ä¸å¡ç±»åçè±æåç§°", btmTypeDTO.getName(), "ä¸å¡ç±»å䏿åç§°"); |
| | | if (btmTypeDTO.isViewFlag() && (StringUtils.isBlank(btmTypeDTO.getViewCreateSql()) |
| | |
| | | if (btmTypeDTO.getId().length() > 24) { |
| | | throw new VciBaseException("ä¸å¡ç±»åè±æåç§°ä¸è½è¶
è¿18ï¼ç®åé¿åº¦ä¸º{0}", new Object[]{btmTypeDTO.getId().length()}); |
| | | } |
| | | List<OmdBtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId())); |
| | | List<BtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId())); |
| | | if (!CollectionUtils.isEmpty(btmTypeDOList) && btmTypeDOList.size() > 0) { |
| | | OmdBtmType existBtmType = btmTypeDOList.get(0); |
| | | BtmType existBtmType = btmTypeDOList.get(0); |
| | | throw new VciBaseException("ä¸å¡ç±»åè±æåç§°å·²ç»åå¨ï¼ä¸åºå大å°åï¼ï¼è¿ä¸ªè±æå称对åºç䏿å称为{0},å建人{1},å建æ¶é´{2}" |
| | | , new Object[]{existBtmType.getName(), existBtmType.getCreator(), VciDateUtil.date2Str(existBtmType.getCreateTime(), VciDateUtil.DateFormat)}); |
| | | } |
| | |
| | | btmTypeDO.setCreator(creator); |
| | | btmTypeDO.setCreateTime(now); |
| | | btmTypeDO.setOwner(creator); |
| | | btmTypeDO.setBtmname(OmdBtmTypeConstant.OMD_BTMTYPE); |
| | | btmTypeDO.setBtmname(BtmTypeConstant.OMD_BTMTYPE); |
| | | btmTypeDO.setTs(now); |
| | | if (StringUtils.isBlank(btmTypeDO.getTableName())) { |
| | | btmTypeDO.setTableName(getTableName(btmTypeDO.getId())); |
| | |
| | | throw e; |
| | | } |
| | | if (autoCreateTable) { |
| | | OmdBtmTypeVO btmTypeVO = OmdBtmTypeWrapper.build().entityVO(btmTypeDO); |
| | | BtmTypeVO btmTypeVO = BtmTypeWrapper.build().entityVO(btmTypeDO); |
| | | btmTypeVO.setAttributes(listHasAttributesByOid(btmTypeDO.getOid())); |
| | | checkTableSame(btmTypeVO); |
| | | } |
| | |
| | | * |
| | | * @param btmTypeVO ä¸å¡ç±»åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | private void checkTableSame(OmdBtmTypeVO btmTypeVO) { |
| | | private void checkTableSame(BtmTypeVO btmTypeVO) { |
| | | /*List<OmdBtmTypeVO> btmTypeVOList = new ArrayList<>(); |
| | | btmTypeVOList.add(btmTypeVO); |
| | | List<OsModifyAttributeInfoDO> modifyAttributeInfoDOList = ddlServiceI.checkDifferent(btmTypeVOList, null); |
| | |
| | | * @param creator å建人 |
| | | * @param now å½åæ¶é´ |
| | | */ |
| | | private void addAttributeForBtm(OmdBtmTypeDTO btmTypeDTO, String creator, Date now) throws VciBaseException{ |
| | | List<OmdBtmTypeLinkAttributesDTO> attributesDTOList = btmTypeDTO.getAttributesDTOList(); |
| | | private void addAttributeForBtm(BtmTypeDTO btmTypeDTO, String creator, Date now) throws VciBaseException{ |
| | | List<BtmTypeLinkAttributesDTO> attributesDTOList = btmTypeDTO.getAttributesDTOList(); |
| | | btmTypeAttributeService.checkAndInsert(btmTypeDTO.getOid(),attributesDTOList,creator,now); |
| | | } |
| | | |
| | |
| | | * @throws ServiceException ä¿®æ¹åºéçæ¶å伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeDTO editSave(OmdBtmTypeDTO btmTypeDTO, boolean autoEditTable) throws ServiceException { |
| | | public BtmTypeDTO editSave(BtmTypeDTO btmTypeDTO, boolean autoEditTable) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException 妿ä¸å¡ç±»å被å¼ç¨ï¼æè
å é¤åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void delete(OmdBtmTypeVO btmTypeVO, boolean autoDeleteTable) throws ServiceException { |
| | | public void delete(BtmTypeVO btmTypeVO, boolean autoDeleteTable) throws ServiceException { |
| | | |
| | | } |
| | | |
| | |
| | | * @throws ServiceException 妿ä¸å¡ç±»å被å¼ç¨ï¼æè
å é¤åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public void batchDelete(List<OmdBtmTypeVO> btmTypeVOList, boolean autoDeleteTable) throws ServiceException { |
| | | public void batchDelete(List<BtmTypeVO> btmTypeVOList, boolean autoDeleteTable) throws ServiceException { |
| | | |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºéæ¶ä¼æåºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<OsModifyAttributeInfoDO> checkDbTableSame(String pkBtmType) throws ServiceException { |
| | | public List<ModifyAttributeInfoDO> checkDbTableSame(String pkBtmType) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeAttribute btmTypeAttributeDTO2DO(OmdBtmTypeLinkAttributesDTO attributesDTO, String pkBtmType, String creator, Date now) { |
| | | public BtmTypeAttribute btmTypeAttributeDTO2DO(BtmTypeLinkAttributesDTO attributesDTO, String pkBtmType, String creator, Date now) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return æ°æ®å¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttribute> btmTypeAttributeVO2DO(List<OmdBtmTypeAttributeVO> thisBtmTypeHasAttributeVOList) { |
| | | public List<BtmTypeAttribute> btmTypeAttributeVO2DO(List<BtmTypeAttributeVO> thisBtmTypeHasAttributeVOList) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ¾ç¤ºå¯¹è±¡å表 |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> batchBtmTypeAttributeDO2VO(List<OmdBtmTypeAttribute> attributeDOList) { |
| | | public List<BtmTypeAttributeVO> batchBtmTypeAttributeDO2VO(List<BtmTypeAttribute> attributeDOList) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ¾ç¤ºå¯¹è±¡å表 |
| | | */ |
| | | @Override |
| | | public OmdBtmTypeAttributeVO btmTypeAttributeDO2VO(OmdBtmTypeAttribute attributesDO) { |
| | | public BtmTypeAttributeVO btmTypeAttributeDO2VO(BtmTypeAttribute attributesDO) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttribute> listAttributeDOByIdsForBtm(String id, Collection<String> attributeIdCollection) { |
| | | public List<BtmTypeAttribute> listAttributeDOByIdsForBtm(String id, Collection<String> attributeIdCollection) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> listAttributeByBtmTypeId(String id) { |
| | | public List<BtmTypeAttributeVO> listAttributeByBtmTypeId(String id) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return 屿§çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> listAttributeByBtmTypeOid(String oid) { |
| | | public List<BtmTypeAttributeVO> listAttributeByBtmTypeOid(String oid) { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @throws ServiceException åæ°ä¸ºç©ºæè
æ¥è¯¢åºé伿åºå¼å¸¸ |
| | | */ |
| | | @Override |
| | | public List<OmdBtmTypeAttributeVO> batchListAttributeByBtmType(Collection<String> oidsOrIds, boolean queryById) throws ServiceException { |
| | | public List<BtmTypeAttributeVO> batchListAttributeByBtmType(Collection<String> oidsOrIds, boolean queryById) throws ServiceException { |
| | | return null; |
| | | } |
| | | |
| | |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public boolean submit(OmdBtmTypeDTO btmTypeDTO) { |
| | | //addSave(btmTypeDTO,false); |
| | | public boolean submit(BtmTypeDTO btmTypeDTO) { |
| | | addSave(btmTypeDTO,false); |
| | | try { |
| | | Object result = domainRepeater.submitBtmType(btmTypeDTO.getDomain(), Objects.requireNonNull(BeanUtil.copy(btmTypeDTO, OmdBtmTypeVO.class))); |
| | | if (result instanceof R){ |
| | | R r = (R) result; |
| | | if (r.isSuccess()){ |
| | | return true; |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), Objects.requireNonNull(BeanUtil.copy(btmTypeDTO, BtmTypeVO.class))); |
| | | return result.isSuccess(); |
| | | } catch (NacosException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |