From 9423f2936340d82b046ec615381c1c5e03698557 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期五, 27 九月 2024 17:56:53 +0800 Subject: [PATCH] 1、主要完成对获取UI上下文的定义接口的优化,优化的方向为对多次获取业务类型对象进行转换而导致耗时较久的问题继续修改,还有对多次获取属性对象进行转换对象导致耗时过长问题进行修改。 2、对树的数据查询接口的优化,对多次获取属性对象进行转换对象导致耗时过长问题进行修改。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java | 45 ++++++++++++++++++++++++++------------------- 1 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java index 6ba98e7..30f044b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIDataServiceImpl.java @@ -21,6 +21,7 @@ import com.vci.starter.web.pagemodel.*; import com.vci.starter.web.util.*; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; +import com.vci.web.enumpck.DeleteTypeEnum; import com.vci.web.enumpck.UIFieldTypeEnum; import com.vci.web.enumpck.UITreeLoadTypeEnum; import com.vci.web.query.UIDataGridQuery; @@ -68,6 +69,11 @@ */ @Autowired private OsBtmServiceI btmService; + /** + * 灞炴�ф湇鍔� + */ + @Autowired + private OsAttributeServiceI attrService; /** * 閾炬帴绫诲瀷 @@ -129,10 +135,10 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public DataGrid getDataForGrid(UIDataGridQuery dataGridQuery) throws VciBaseException { + public DataGrid getDataForGrid(UIDataGridQuery dataGridQuery) throws VciBaseException, PLException { VciBaseUtil.alertNotNull(dataGridQuery,"鏌ヨ瀵硅薄",dataGridQuery.getBtmname(),"涓氬姟绫诲瀷",dataGridQuery.getTableDefineId()); //鍏堝垽鏂煡璇㈡ā鏉� - UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid()).getTableDefineVO(); + UITableDefineVO tableDefineVO = uiEngineService.getComponentByOid(dataGridQuery.getComponentOid(),null).getTableDefineVO(); String queryTemplate = !CollectionUtils.isEmpty(dataGridQuery.getSourceData())?dataGridQuery.getSourceData().getOrDefault("querytemplate",tableDefineVO.getQueryTemplateName()):tableDefineVO.getQueryTemplateName(); if(StringUtils.isBlank(queryTemplate)){ //璇存槑娌℃湁璁剧疆鏌ヨ妯℃澘锛岄渶瑕佺湅鐪嬪湪杩欎釜琛ㄦ牸鎵�鍦ㄧ殑缁勪欢鏈夋病鏈夎缃� @@ -338,7 +344,8 @@ @Override public List<Tree> getDataForTree(UITreeQuery treeQuery) throws VciBaseException { VciBaseUtil.alertNotNull(treeQuery,"琛ㄥ崟鐨勬煡璇㈠璞�",treeQuery.getBtmname(),"涓氬姟绫诲瀷鐨勪俊鎭�",treeQuery.getComponentOid(),"鏍戞墍鍦ㄧ殑缁勪欢鐨勪富閿�"); - UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid()); + Map<String, OsAttributeVO> attributeVOMap = attrService.selectAllAttributeMap(); + UIComponentVO componentVO = uiEngineService.getComponentByOid(treeQuery.getComponentOid(),attributeVOMap); if(componentVO == null || StringUtils.isBlank(componentVO.getOid())){ throw new VciBaseException("鏍戠殑閰嶇疆淇℃伅娌℃湁鑾峰彇鍒�"); } @@ -381,7 +388,7 @@ if(StringUtils.isBlank(treeDefineVO.getLinkType())){ //杩欎釜鏄笟鍔$被鍨嬬殑鑷弬鐓� //浠ュ墠鐨勫钩鍙版病鏈夊鑷弬鐓ц繖绉嶆湁鍏ㄩ儴鏌ヨ鐨� - OsBtmTypeVO btmTypeVO = btmService.getBtmById(treeDefineVO.getBtmType()); + OsBtmTypeVO btmTypeVO = btmService.getBtmById(treeDefineVO.getBtmType(),attributeVOMap); queryFieldList.addAll(btmTypeVO.getAttributes().stream().map(OsBtmTypeAttributeVO::getId).collect(Collectors.toList())); queryFieldList.addAll(WebBoServiceImpl.BO_BASE_FIELD_MAP.values()); @@ -1363,7 +1370,7 @@ }catch (Throwable e){ //璇存槑鍚庣疆浜嬩欢鍑虹幇浜嗛敊璇紝閭d箞灏遍渶瑕佸垹闄や互鍓嶇殑杩欐潯鏁版嵁 try { - platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(afterBOs.toArray(new BusinessObject[0]),1); + platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(afterBOs.toArray(new BusinessObject[0]),DeleteTypeEnum.OID_AND_TS.getValue()); } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -1683,13 +1690,6 @@ throw new VciBaseException(formLinkDataDTO.isDirection()?"from绔�":"to绔�" + "鐨勪笟鍔$被鍨嬩负绌�"); } - //鏌ヨfrom绔殑 - BusinessObject fromCbo = new BusinessObject(); - try { - fromCbo = platformClientUtil.getBOFService().readBusinessObject(fromOid,fromBtmName); - } catch (PLException vciError) { - throw WebUtil.getVciBaseException(vciError); - } String finalPrefix = prefix; formLinkDataDTO.getData().forEach((key, value)->{ if(key.toLowerCase().startsWith(finalPrefix)){ @@ -1710,10 +1710,12 @@ return BaseResult.fail(resultClo.getMsg(),resultClo.getMsgObjs()); } clo = resultClo.getObj(); + if(StringUtils.isBlank(clo.toOid)){ + clo.toOid = toCbo.oid; + } //鎵ц淇濆瓨 BusinessObject[] bos = new BusinessObject[1]; ObjectTool.dealBusinessObjectNullValue(toCbo); - ObjectTool.dealLinkObjectNullValue(clo); bos[0] = toCbo; try { platformClientUtil.getBOFService().createBusinessObjectWithLink(bos,clo); @@ -1768,7 +1770,6 @@ if(editFlag){ try { LinkObject linkObject = platformClientUtil.getBOFService().readLinkObjectById(formLinkDataDTO.getOid(), formLinkDataDTO.getLinkType()); - clo = new LinkObject(); clo = linkObject; } catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); @@ -1781,6 +1782,14 @@ clo.createTime = System.currentTimeMillis(); clo.ts = System.currentTimeMillis(); clo.ltName = formLinkDataDTO.getLinkType(); + clo.toOid = formLinkDataDTO.getToid(); + clo.toNameOid = formLinkDataDTO.getTnameoid(); + clo.toRevOid = formLinkDataDTO.getTrevisionoid(); + clo.toBTName = formLinkDataDTO.getTbtmname(); + clo.fromOid = formLinkDataDTO.getFoid(); + clo.fromBTName = formLinkDataDTO.getFbtmname(); + clo.fromNameOid = formLinkDataDTO.getFnameoid(); + clo.fromRevOid = formLinkDataDTO.getFrevisionoid(); } // LinkObject finalClo = clo; @@ -2039,7 +2048,7 @@ if (ruleVO == null || StringUtils.isBlank(ruleVO.getOid())) { throw new VciBaseException("{0}閲岀殑鐗堟湰瑙勫垯璁剧疆寰椾笉姝g‘锛屽湪绯荤粺涓病鏈夋壘鍒皗1}杩欎釜鐗堟湰瑙勫垯", new String[]{btmTypeVO.getName(), btmTypeVO.getRevisionRuleId()}); } - cbo.revisionValue = ruleVO.getStartCode(); + cbo.revisionValue = ruleVO.getInitialValue(); } if (StringUtils.isBlank(cbo.nameoid)) { cbo.nameoid = VciBaseUtil.getPk(); @@ -2157,8 +2166,6 @@ String prefix = formLinkDataDTO.isDirection()?LO_FROM_PREFIX:LO_TO_PREFIX; String toOid = formLinkDataDTO.isDirection()?formLinkDataDTO.getFoid():formLinkDataDTO.getToid(); String toBtmName = formLinkDataDTO.isDirection()?formLinkDataDTO.getFbtmname():formLinkDataDTO.getTbtmname(); - String fromOid = formLinkDataDTO.isDirection()?formLinkDataDTO.getToid():formLinkDataDTO.getFoid(); - String fromBtmName = formLinkDataDTO.isDirection()?formLinkDataDTO.getTbtmname():formLinkDataDTO.getFbtmname(); Map<String,String> boData = new HashMap<>(); Map<String,String> loData = new HashMap<>(); @@ -2295,7 +2302,7 @@ if(deleteLinkDataDTO.isDeleteFromData()){ fromBtmDataGroups.forEach((btm,cbos)->{ try{ - platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); + platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]), DeleteTypeEnum.OID_AND_TS.getValue()); }catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } @@ -2304,7 +2311,7 @@ if(deleteLinkDataDTO.isDeleteToData()){ toBtmDataGroups.forEach((btm,cbos)->{ try{ - platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),1); + platformClientUtil.getBOFactoryService().batchDeleteBusinessObject(cbos.toArray(new BusinessObject[0]),DeleteTypeEnum.OID_AND_TS.getValue()); }catch (PLException vciError) { throw WebUtil.getVciBaseException(vciError); } -- Gitblit v1.9.3