From 1f0a10ab714699acc85430b90bcb5a1eeaad1eec Mon Sep 17 00:00:00 2001 From: xiejun <xj@2023> Date: 星期一, 17 七月 2023 10:14:45 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java | 48 ++++++++++++++++++++++++++++++------------------ 1 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java index a75265e..23d8bde 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/BtmTypeServiceImpl.java @@ -10,7 +10,7 @@ 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; +import com.vci.ubcs.omd.entity.*; import com.vci.ubcs.omd.repeater.DomainRepeater; import com.vci.ubcs.omd.service.*; import com.vci.ubcs.omd.vo.*; @@ -19,9 +19,6 @@ import com.vci.ubcs.starter.web.constant.OmdRegExpConstant; 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.ModifyAttributeInfo; import com.vci.ubcs.omd.mapper.BtmTypeMapper; import com.vci.ubcs.starter.exception.VciBaseException; import com.vci.ubcs.starter.web.enumpck.BooleanEnum; @@ -85,6 +82,12 @@ */ @Autowired private IAttributeService attributeService; + + /** + * 鐢熷懡鍛ㄦ湡鐨勬湇鍔� + */ + @Autowired + private ILifeCycleService lifeCycleService; /** * 琛ㄥ悕鍓嶇紑 @@ -204,7 +207,7 @@ */ @Override public List<BtmType> listBtmTypeDOByIdCollection(Collection<String> idCollection) throws ServiceException { - return CollectionUtils.isEmpty(idCollection) ? null : baseMapper.selectList(Wrappers.<BtmType>query().lambda().in(BtmType::getId, idCollection)); + return CollectionUtils.isEmpty(idCollection) ? null : baseMapper.selectByIdCollection(idCollection); } /** @@ -495,7 +498,7 @@ } checkBtmTypeBeforeSave(btmTypeDTO); BtmType btmTypeDO = Optional.ofNullable(BeanUtil.copy(btmTypeDTO, BtmType.class)).orElseGet(BtmType::new); - btmTypeDO.setBizDomain(btmTypeDTO.getDomain()); + btmTypeDO.setBizDomain(btmTypeDTO.getBizDomain()); List<BtmTypeLinkAttributesDTO> attributes = btmTypeDTO.getAttributes(); List<BtmTypeAttributeVO> afterAttributes; if (StringUtils.isBlank(btmTypeDO.getOid())){ @@ -521,7 +524,7 @@ try { if (autoCreateTable) { // checkTableSame(btmTypeVO); - R result = DomainRepeater.submitBtmType(btmTypeDTO.getDomain(), btmTypeVO); + R result = DomainRepeater.submitBtmType(btmTypeDTO.getBizDomain(), btmTypeVO); if (result.isSuccess()){ List<ModifyAttributeInfo> infoList = new ArrayList<>(); Object data = result.getData(); @@ -595,11 +598,14 @@ if (btmTypeDTO.getId().length() > 24) { throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О涓嶈兘瓒呰繃18锛岀洰鍓嶉暱搴︿负{0}", new Object[]{btmTypeDTO.getId().length()}); } - List<BtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId())); + List<BtmType> btmTypeDOList = listBtmTypeDOByIdCollection(VciBaseUtil.str2List(btmTypeDTO.getId().toLowerCase(Locale.ROOT))); if (!CollectionUtils.isEmpty(btmTypeDOList) && btmTypeDOList.size() > 0) { + boolean exist = btmTypeDOList.stream().filter(btm -> StringUtils.isNotBlank(btm.getOid())).anyMatch(btm -> !StringUtils.equals(btmTypeDTO.getOid(), btm.getOid())); BtmType existBtmType = btmTypeDOList.get(0); - throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О宸茬粡瀛樺湪锛堜笉鍖哄垎澶у皬鍐欙級锛岃繖涓嫳鏂囧悕绉板搴旂殑涓枃鍚嶇О涓簕0},鍒涘缓浜簕1},鍒涘缓鏃堕棿{2}" - , new Object[]{existBtmType.getName(), existBtmType.getCreator(), VciDateUtil.date2Str(existBtmType.getCreateTime(), VciDateUtil.DateFormat)}); + if (exist) { + throw new VciBaseException("涓氬姟绫诲瀷鑻辨枃鍚嶇О宸茬粡瀛樺湪锛堜笉鍖哄垎澶у皬鍐欙級锛岃繖涓嫳鏂囧悕绉板搴旂殑涓枃鍚嶇О涓簕0},鍒涘缓浜簕1},鍒涘缓鏃堕棿{2}" + , new Object[]{existBtmType.getName(), existBtmType.getCreator(), VciDateUtil.date2Str(existBtmType.getCreateTime(), VciDateUtil.DateFormat)}); + } } if (btmTypeDTO.isRevisionFlag()){ // 闇�瑕佹帶鍒剁増鏈� @@ -614,13 +620,14 @@ if (btmTypeDTO.isLifeCycleFlag()){ // 闇�瑕佹帶鍒剁敓鍛藉懆鏈� //妫�鏌ヤ娇鐢ㄧ殑鐢熷懡鍛ㄦ湡鏄惁瀛樺湪 -// if (StringUtils.isNotBlank(btmTypeDTO.getLifeCycleId()) -// && !FrameWorkLcStatusConstant.EMTYPE_LIFE_CYCLE.equalsIgnoreCase(btmTypeDTO.getLifeCycleId())) { -// if (lifeCycleServiceI.checkLifeCycleExist(btmTypeDTO.getLifeCycleId())) { -// throw new VciBaseException("鐢熷懡鍛ㄦ湡{0}[{1}]鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉", -// new Object[]{btmTypeDTO.getLifeCycleId(), btmTypeDTO.getLifeCycleName()}); -// } -// } + if (StringUtils.isNotBlank(btmTypeDTO.getLifeCycleId()) +// && !FrameWorkLcStatusConstant.EMTYPE_LIFE_CYCLE.equalsIgnoreCase(btmTypeDTO.getLifeCycleId()) + ) { + if (lifeCycleService.getOne(Wrappers.<LifeCycleRule>query().lambda().eq(LifeCycleRule::getId,btmTypeDTO.getLifeCycleId())) == null) { + throw new VciBaseException("鐢熷懡鍛ㄦ湡{0}[{1}]鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉", + new Object[]{btmTypeDTO.getLifeCycleId(), btmTypeDTO.getLifeCycleName()}); + } + } // if (StringUtils.isNotBlank(btmTypeDTO.getSubLifeCycleId())) { // if (lifeCycleServiceI.checkLifeCycleExist(btmTypeDTO.getSubLifeCycleId())) { // throw new VciBaseException("澶囩敤鐢熷懡鍛ㄦ湡{0}[{1}]涓叾涓湁鏌愪簺鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇峰厛鏌ヨ瘉", @@ -652,7 +659,10 @@ try { Map<String, String> domain = Optional.ofNullable(DomainRepeater.getDomain()).orElseGet(ArrayList::new).stream().collect(Collectors.toMap(DomainVO::getValue, DomainVO::getLabel)); List<BtmTypeVO> vos = BtmTypeWrapper.build().listEntityVO(baseMapper.selectAll()); - Map<String, List<BtmTypeVO>> domainMap = vos.stream().sorted(Comparator.comparing(BtmTypeVO::getId)).collect(Collectors.groupingBy(BtmTypeVO::getBizDomain)); + if (CollectionUtils.isEmpty(vos)){ + return new ArrayList<>(); + } + Map<String, List<BtmTypeVO>> domainMap = Optional.ofNullable(vos).orElseGet(ArrayList::new).stream().sorted(Comparator.comparing(BtmTypeVO::getId)).collect(Collectors.groupingBy(BtmTypeVO::getBizDomain)); List<BtmTreeVO> treeList = new ArrayList<>(); domainMap.forEach((k,v)-> { if (domain.containsKey(k)){ @@ -661,11 +671,13 @@ parent.setName(label); parent.setLabel(label); parent.setId(k); + parent.setLevel(1); parent.setChildList(v.stream().map(s -> { BtmTreeVO child = new BtmTreeVO(); child.setOid(s.getOid()); child.setName(s.getName()); child.setId(s.getId()); + child.setLevel(2); child.setLabel(s.getId() + (s.getName() == null ? "" : "(" + s.getName() + ")")); return child; }).collect(Collectors.toList())); -- Gitblit v1.9.3